1 | /*
|
---|
2 | -----------------------------------------------------------------------------
|
---|
3 | This source file is part of OGRE
|
---|
4 | (Object-oriented Graphics Rendering Engine)
|
---|
5 | For the latest info, see http://www.ogre3d.org/
|
---|
6 |
|
---|
7 | Copyright (c) 2000-2005 The OGRE Team
|
---|
8 | Also see acknowledgements in Readme.html
|
---|
9 |
|
---|
10 | This program is free software; you can redistribute it and/or modify it under
|
---|
11 | the terms of the GNU Lesser General Public License as published by the Free Software
|
---|
12 | Foundation; either version 2 of the License, or (at your option) any later
|
---|
13 | version.
|
---|
14 |
|
---|
15 | This program is distributed in the hope that it will be useful, but WITHOUT
|
---|
16 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
---|
17 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
---|
18 |
|
---|
19 | You should have received a copy of the GNU Lesser General Public License along with
|
---|
20 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
---|
21 | Place - Suite 330, Boston, MA 02111-1307, USA, or go to
|
---|
22 | http://www.gnu.org/copyleft/lesser.txt.
|
---|
23 | -----------------------------------------------------------------------------
|
---|
24 | */
|
---|
25 | #ifndef __RenderSystemCapabilities__
|
---|
26 | #define __RenderSystemCapabilities__ 1
|
---|
27 |
|
---|
28 | // Precompiler options
|
---|
29 | #include "OgrePrerequisites.h"
|
---|
30 | #include "OgreString.h"
|
---|
31 |
|
---|
32 | namespace Ogre {
|
---|
33 |
|
---|
34 | /// Enum describing the different hardware capabilities we want to check for
|
---|
35 | enum Capabilities
|
---|
36 | {
|
---|
37 | //RSC_MULTITEXTURE = 0x00000001,
|
---|
38 | /// Supporta generating mipmaps in hardware
|
---|
39 | RSC_AUTOMIPMAP = 0x00000002,
|
---|
40 | RSC_BLENDING = 0x00000004,
|
---|
41 | /// Supports anisotropic texture filtering
|
---|
42 | RSC_ANISOTROPY = 0x00000008,
|
---|
43 | /// Supports fixed-function DOT3 texture blend
|
---|
44 | RSC_DOT3 = 0x00000010,
|
---|
45 | /// Supports cube mapping
|
---|
46 | RSC_CUBEMAPPING = 0x00000020,
|
---|
47 | /// Supports hardware stencil buffer
|
---|
48 | RSC_HWSTENCIL = 0x00000040,
|
---|
49 | /// Supports hardware vertex and index buffers
|
---|
50 | RSC_VBO = 0x00000080,
|
---|
51 | /// Supports vertex programs (vertex shaders)
|
---|
52 | RSC_VERTEX_PROGRAM = 0x00000200,
|
---|
53 | /// Supports fragment programs (pixel shaders)
|
---|
54 | RSC_FRAGMENT_PROGRAM = 0x00000400,
|
---|
55 | /// Supports compressed textures
|
---|
56 | RSC_TEXTURE_COMPRESSION = 0x00000800,
|
---|
57 | /// Supports compressed textures in the DXT/ST3C formats
|
---|
58 | RSC_TEXTURE_COMPRESSION_DXT = 0x00001000,
|
---|
59 | /// Supports compressed textures in the VTC format
|
---|
60 | RSC_TEXTURE_COMPRESSION_VTC = 0x00002000,
|
---|
61 | /// Supports performing a scissor test to exclude areas of the screen
|
---|
62 | RSC_SCISSOR_TEST = 0x00004000,
|
---|
63 | /// Supports separate stencil updates for both front and back faces
|
---|
64 | RSC_TWO_SIDED_STENCIL = 0x00008000,
|
---|
65 | /// Supports wrapping the stencil value at the range extremeties
|
---|
66 | RSC_STENCIL_WRAP = 0x00010000,
|
---|
67 | /// Supports hardware occlusion queries
|
---|
68 | RSC_HWOCCLUSION = 0x00020000,
|
---|
69 | /// Supports user clipping planes
|
---|
70 | RSC_USER_CLIP_PLANES = 0x00040000,
|
---|
71 | /// Supports the VET_UBYTE4 vertex element type
|
---|
72 | RSC_VERTEX_FORMAT_UBYTE4 = 0x00080000,
|
---|
73 | /// Supports infinite far plane projection
|
---|
74 | RSC_INFINITE_FAR_PLANE = 0x00100000,
|
---|
75 | /// Supports hardware render-to-texture (bigger than framebuffer)
|
---|
76 | RSC_HWRENDER_TO_TEXTURE = 0x00200000,
|
---|
77 | /// Supports float textures and render targets
|
---|
78 | RSC_TEXTURE_FLOAT = 0x00400000,
|
---|
79 | /// Supports non-power of two textures
|
---|
80 | RSC_NON_POWER_OF_2_TEXTURES = 0x00800000,
|
---|
81 | /// Supports 3d (volume) textures
|
---|
82 | RSC_TEXTURE_3D = 0x01000000
|
---|
83 | };
|
---|
84 |
|
---|
85 | /** singleton class for storing the capabilities of the graphics card.
|
---|
86 | @remarks
|
---|
87 | This class stores the capabilities of the graphics card. This
|
---|
88 | information is set by the individual render systems.
|
---|
89 | */
|
---|
90 | class _OgreExport RenderSystemCapabilities
|
---|
91 | {
|
---|
92 | private:
|
---|
93 | /// The number of world matricies available
|
---|
94 | ushort mNumWorldMatrices;
|
---|
95 | /// The number of texture units available
|
---|
96 | ushort mNumTextureUnits;
|
---|
97 | /// The stencil buffer bit depth
|
---|
98 | ushort mStencilBufferBitDepth;
|
---|
99 | /// The number of matrices available for hardware blending
|
---|
100 | ushort mNumVertexBlendMatrices;
|
---|
101 | /// Stores the capabilities flags.
|
---|
102 | int mCapabilities;
|
---|
103 | /// The best vertex program that this card / rendersystem supports
|
---|
104 | String mMaxVertexProgramVersion;
|
---|
105 | /// The best fragment program that this card / rendersystem supports
|
---|
106 | String mMaxFragmentProgramVersion;
|
---|
107 | /// The number of floating-point constants vertex programs support
|
---|
108 | ushort mVertexProgramConstantFloatCount;
|
---|
109 | /// The number of integer constants vertex programs support
|
---|
110 | ushort mVertexProgramConstantIntCount;
|
---|
111 | /// The number of boolean constants vertex programs support
|
---|
112 | ushort mVertexProgramConstantBoolCount;
|
---|
113 | /// The number of floating-point constants fragment programs support
|
---|
114 | ushort mFragmentProgramConstantFloatCount;
|
---|
115 | /// The number of integer constants fragment programs support
|
---|
116 | ushort mFragmentProgramConstantIntCount;
|
---|
117 | /// The number of boolean constants fragment programs support
|
---|
118 | ushort mFragmentProgramConstantBoolCount;
|
---|
119 | /// The number of simultaneous render targets supported
|
---|
120 | ushort mNumMultiRenderTargets;
|
---|
121 | /// The maximum point size
|
---|
122 | Real mMaxPointSize;
|
---|
123 |
|
---|
124 | public:
|
---|
125 | RenderSystemCapabilities ();
|
---|
126 | ~RenderSystemCapabilities ();
|
---|
127 |
|
---|
128 | void setNumWorldMatricies(ushort num)
|
---|
129 | {
|
---|
130 | mNumWorldMatrices = num;
|
---|
131 | }
|
---|
132 |
|
---|
133 | void setNumTextureUnits(ushort num)
|
---|
134 | {
|
---|
135 | mNumTextureUnits = num;
|
---|
136 | }
|
---|
137 |
|
---|
138 | void setStencilBufferBitDepth(ushort num)
|
---|
139 | {
|
---|
140 | mStencilBufferBitDepth = num;
|
---|
141 | }
|
---|
142 |
|
---|
143 | void setNumVertexBlendMatrices(ushort num)
|
---|
144 | {
|
---|
145 | mNumVertexBlendMatrices = num;
|
---|
146 | }
|
---|
147 |
|
---|
148 | /// The number of simultaneous render targets supported
|
---|
149 | void setNumMultiRenderTargets(ushort num)
|
---|
150 | {
|
---|
151 | mNumMultiRenderTargets = num;
|
---|
152 | }
|
---|
153 |
|
---|
154 | ushort getNumWorldMatricies(void) const
|
---|
155 | {
|
---|
156 | return mNumWorldMatrices;
|
---|
157 | }
|
---|
158 |
|
---|
159 | /** Returns the number of texture units the current output hardware
|
---|
160 | supports.
|
---|
161 |
|
---|
162 | For use in rendering, this determines how many texture units the
|
---|
163 | are available for multitexturing (i.e. rendering multiple
|
---|
164 | textures in a single pass). Where a Material has multiple
|
---|
165 | texture layers, it will try to use multitexturing where
|
---|
166 | available, and where it is not available, will perform multipass
|
---|
167 | rendering to achieve the same effect.
|
---|
168 | */
|
---|
169 | ushort getNumTextureUnits(void) const
|
---|
170 | {
|
---|
171 | return mNumTextureUnits;
|
---|
172 | }
|
---|
173 |
|
---|
174 | /** Determines the bit depth of the hardware accelerated stencil
|
---|
175 | buffer, if supported.
|
---|
176 | @remarks
|
---|
177 | If hardware stencilling is not supported, the software will
|
---|
178 | provide an 8-bit software stencil.
|
---|
179 | */
|
---|
180 | ushort getStencilBufferBitDepth(void) const
|
---|
181 | {
|
---|
182 | return mStencilBufferBitDepth;
|
---|
183 | }
|
---|
184 |
|
---|
185 | /** Returns the number of matrices available to hardware vertex
|
---|
186 | blending for this rendering system. */
|
---|
187 | ushort numVertexBlendMatrices(void) const
|
---|
188 | {
|
---|
189 | return mNumVertexBlendMatrices;
|
---|
190 | }
|
---|
191 |
|
---|
192 | /// The number of simultaneous render targets supported
|
---|
193 | ushort numMultiRenderTargets(void) const
|
---|
194 | {
|
---|
195 | return mNumMultiRenderTargets;
|
---|
196 | }
|
---|
197 |
|
---|
198 | /** Adds a capability flag to mCapabilities
|
---|
199 | */
|
---|
200 | void setCapability(const Capabilities c)
|
---|
201 | {
|
---|
202 | mCapabilities |= c;
|
---|
203 | }
|
---|
204 |
|
---|
205 | /** Checks for a capability
|
---|
206 | */
|
---|
207 | bool hasCapability(const Capabilities c) const
|
---|
208 | {
|
---|
209 | if(mCapabilities & c)
|
---|
210 | {
|
---|
211 | return true;
|
---|
212 | }
|
---|
213 | else
|
---|
214 | {
|
---|
215 | return false;
|
---|
216 | }
|
---|
217 | }
|
---|
218 | /// Gets the best low-level vertex program version supported
|
---|
219 | const String& getMaxVertexProgramVersion(void) const
|
---|
220 | {
|
---|
221 | return mMaxVertexProgramVersion;
|
---|
222 | }
|
---|
223 | /// Gets the best fragment program that this card / rendersystem supports
|
---|
224 | const String& getMaxFragmentProgramVersion(void) const
|
---|
225 | {
|
---|
226 | return mMaxFragmentProgramVersion;
|
---|
227 | }
|
---|
228 | /// The number of floating-point constants vertex programs support
|
---|
229 | ushort getVertexProgramConstantFloatCount(void) const
|
---|
230 | {
|
---|
231 | return mVertexProgramConstantFloatCount;
|
---|
232 | }
|
---|
233 | /// The number of integer constants vertex programs support
|
---|
234 | ushort getVertexProgramConstantIntCount(void) const
|
---|
235 | {
|
---|
236 | return mVertexProgramConstantIntCount;
|
---|
237 | }
|
---|
238 | /// The number of boolean constants vertex programs support
|
---|
239 | ushort getVertexProgramConstantBoolCount(void) const
|
---|
240 | {
|
---|
241 | return mVertexProgramConstantBoolCount;
|
---|
242 | }
|
---|
243 | /// The number of floating-point constants fragment programs support
|
---|
244 | ushort getFragmentProgramConstantFloatCount(void) const
|
---|
245 | {
|
---|
246 | return mFragmentProgramConstantFloatCount;
|
---|
247 | }
|
---|
248 | /// The number of integer constants fragment programs support
|
---|
249 | ushort getFragmentProgramConstantIntCount(void) const
|
---|
250 | {
|
---|
251 | return mFragmentProgramConstantIntCount;
|
---|
252 | }
|
---|
253 | /// The number of boolean constants fragment programs support
|
---|
254 | ushort getFragmentProgramConstantBoolCount(void) const
|
---|
255 | {
|
---|
256 | return mFragmentProgramConstantBoolCount;
|
---|
257 | }
|
---|
258 |
|
---|
259 |
|
---|
260 |
|
---|
261 | /// sets the best low-level vertex program version supported
|
---|
262 | void setMaxVertexProgramVersion(const String& ver)
|
---|
263 | {
|
---|
264 | mMaxVertexProgramVersion = ver;
|
---|
265 | }
|
---|
266 | /// sets the best fragment program that this card / rendersystem supports
|
---|
267 | void setMaxFragmentProgramVersion(const String& ver)
|
---|
268 | {
|
---|
269 | mMaxFragmentProgramVersion = ver;
|
---|
270 | }
|
---|
271 | /// The number of floating-point constants vertex programs support
|
---|
272 | void setVertexProgramConstantFloatCount(ushort c)
|
---|
273 | {
|
---|
274 | mVertexProgramConstantFloatCount = c;
|
---|
275 | }
|
---|
276 | /// The number of integer constants vertex programs support
|
---|
277 | void setVertexProgramConstantIntCount(ushort c)
|
---|
278 | {
|
---|
279 | mVertexProgramConstantIntCount = c;
|
---|
280 | }
|
---|
281 | /// The number of boolean constants vertex programs support
|
---|
282 | void setVertexProgramConstantBoolCount(ushort c)
|
---|
283 | {
|
---|
284 | mVertexProgramConstantBoolCount = c;
|
---|
285 | }
|
---|
286 | /// The number of floating-point constants fragment programs support
|
---|
287 | void setFragmentProgramConstantFloatCount(ushort c)
|
---|
288 | {
|
---|
289 | mFragmentProgramConstantFloatCount = c;
|
---|
290 | }
|
---|
291 | /// The number of integer constants fragment programs support
|
---|
292 | void setFragmentProgramConstantIntCount(ushort c)
|
---|
293 | {
|
---|
294 | mFragmentProgramConstantIntCount = c;
|
---|
295 | }
|
---|
296 | /// The number of boolean constants fragment programs support
|
---|
297 | void setFragmentProgramConstantBoolCount(ushort c)
|
---|
298 | {
|
---|
299 | mFragmentProgramConstantBoolCount = c;
|
---|
300 | }
|
---|
301 | /// Maximum point screen size in pixels
|
---|
302 | void setMaxPointSize(Real s)
|
---|
303 | {
|
---|
304 | mMaxPointSize = s;
|
---|
305 | }
|
---|
306 | /// Maximum point screen size in pixels
|
---|
307 | Real getMaxPointSize(void) const
|
---|
308 | {
|
---|
309 | return mMaxPointSize;
|
---|
310 | }
|
---|
311 |
|
---|
312 |
|
---|
313 | /** Write the capabilities to the pass in Log */
|
---|
314 | void log(Log* pLog);
|
---|
315 |
|
---|
316 |
|
---|
317 |
|
---|
318 |
|
---|
319 | };
|
---|
320 | };
|
---|
321 |
|
---|
322 | #endif // __RenderSystemCapabilities__
|
---|
323 |
|
---|