/src/ogre/OgreMain/include/OgreRenderSystemCapabilities.h
Line | Count | Source |
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-2014 Torus Knot Software Ltd |
8 | | |
9 | | Permission is hereby granted, free of charge, to any person obtaining a copy |
10 | | of this software and associated documentation files (the "Software"), to deal |
11 | | in the Software without restriction, including without limitation the rights |
12 | | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
13 | | copies of the Software, and to permit persons to whom the Software is |
14 | | furnished to do so, subject to the following conditions: |
15 | | |
16 | | The above copyright notice and this permission notice shall be included in |
17 | | all copies or substantial portions of the Software. |
18 | | |
19 | | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
20 | | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
21 | | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
22 | | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
23 | | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
24 | | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
25 | | THE SOFTWARE. |
26 | | ----------------------------------------------------------------------------- |
27 | | */ |
28 | | #ifndef __RenderSystemCapabilities__ |
29 | | #define __RenderSystemCapabilities__ |
30 | | |
31 | | // Precompiler options |
32 | | #include "OgrePrerequisites.h" |
33 | | #include "OgreStringVector.h" |
34 | | #include "OgreStringConverter.h" |
35 | | #include "OgreHeaderPrefix.h" |
36 | | #include "OgreGpuProgram.h" |
37 | | |
38 | | // Because there are more than 32 possible Capabilities, more than 1 int is needed to store them all. |
39 | | // In fact, an array of integers is used to store capabilities. However all the capabilities are defined in the single |
40 | | // enum. The only way to know which capabilities should be stored where in the array is to use some of the 32 bits |
41 | | // to record the category of the capability. These top few bits are used as an index into mCapabilities array |
42 | | // The lower bits are used to identify each capability individually by setting 1 bit for each |
43 | | |
44 | | // Identifies how many bits are reserved for categories |
45 | | // NOTE: Although 4 bits (currently) are enough |
46 | | #define CAPS_CATEGORY_SIZE 4 |
47 | | #define OGRE_CAPS_BITSHIFT (32 - CAPS_CATEGORY_SIZE) |
48 | | #define CAPS_CATEGORY_MASK (((1 << CAPS_CATEGORY_SIZE) - 1) << OGRE_CAPS_BITSHIFT) |
49 | | #define OGRE_CAPS_VALUE(cat, val) ((cat << OGRE_CAPS_BITSHIFT) | (1 << val)) |
50 | | |
51 | | namespace Ogre |
52 | | { |
53 | | /** \addtogroup Core |
54 | | * @{ |
55 | | */ |
56 | | /** \addtogroup RenderSystem |
57 | | * @{ |
58 | | */ |
59 | | |
60 | | /// Enumerates the categories of capabilities |
61 | | enum CapabilitiesCategory |
62 | | { |
63 | | CAPS_CATEGORY_COMMON = 0, |
64 | | CAPS_CATEGORY_COMMON_2 = 1, |
65 | | CAPS_CATEGORY_D3D9 = 2, |
66 | | CAPS_CATEGORY_GL = 3, |
67 | | CAPS_CATEGORY_COMMON_3 = 4, |
68 | | /// Placeholder for max value |
69 | | CAPS_CATEGORY_COUNT = 5 |
70 | | }; |
71 | | |
72 | | /// Enum describing the different hardware capabilities we want to check for |
73 | | /// OGRE_CAPS_VALUE(a, b) defines each capability |
74 | | /// a is the category (which can be from 0 to 15) |
75 | | /// b is the value (from 0 to 27) |
76 | | enum Capabilities |
77 | | { |
78 | | /// specifying a "-1" in the index buffer starts a new draw command. |
79 | | RSC_PRIMITIVE_RESTART = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 0), |
80 | | /// GL ES2/ES3 does not support generating mipmaps for compressed formats in hardware |
81 | | RSC_AUTOMIPMAP_COMPRESSED = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 1), |
82 | | /// Supports anisotropic texture filtering |
83 | | RSC_ANISOTROPY = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 2), |
84 | | /// Supports depth clamping |
85 | | RSC_DEPTH_CLAMP = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 3), |
86 | | /// Supports linewidth != 1.0 |
87 | | RSC_WIDE_LINES = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 4), |
88 | | /// Supports hardware stencil buffer |
89 | | RSC_HWSTENCIL = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 5), |
90 | | /// Supports read/write buffers with atomic counters (e.g. RWStructuredBuffer or SSBO) |
91 | | RSC_READ_WRITE_BUFFERS = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 6), |
92 | | /// Supports compressed textures in the ASTC format |
93 | | RSC_TEXTURE_COMPRESSION_ASTC = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 7), |
94 | | /// Supports 32bit hardware index buffers |
95 | | RSC_32BIT_INDEX = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 8), |
96 | | /// Supports vertex programs (vertex shaders) |
97 | | /// @deprecated All targeted APIs by Ogre support this feature |
98 | | RSC_VERTEX_PROGRAM = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 9), |
99 | | /// Supports tessellation domain and hull programs |
100 | | RSC_TESSELLATION_PROGRAM = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 10), |
101 | | /// Supports 2D Texture Arrays |
102 | | RSC_TEXTURE_2D_ARRAY = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 11), |
103 | | /// Supports separate stencil updates for both front and back faces |
104 | | RSC_TWO_SIDED_STENCIL = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 12), |
105 | | /// Supports wrapping the stencil value at the range extremeties |
106 | | RSC_STENCIL_WRAP = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 13), |
107 | | /// Supports hardware occlusion queries |
108 | | RSC_HWOCCLUSION = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 14), |
109 | | /// Supports user clipping planes |
110 | | RSC_USER_CLIP_PLANES = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 15), |
111 | | /// Supports hardware compute programs |
112 | | RSC_COMPUTE_PROGRAM = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 16), |
113 | | /// Supports 1d textures |
114 | | RSC_TEXTURE_1D = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 17), |
115 | | /// Supports hardware render-to-texture (bigger than framebuffer) |
116 | | RSC_HWRENDER_TO_TEXTURE = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 18), |
117 | | /// Supports float textures and render targets |
118 | | RSC_TEXTURE_FLOAT = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 19), |
119 | | /// Supports non-power of two textures |
120 | | RSC_NON_POWER_OF_2_TEXTURES = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 20), |
121 | | /// Supports 3d (volume) textures |
122 | | RSC_TEXTURE_3D = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 21), |
123 | | /// Supports basic point sprite rendering |
124 | | RSC_POINT_SPRITES = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 22), |
125 | | /// @deprecated same as RSC_POINT_SPRITES |
126 | | RSC_POINT_EXTENDED_PARAMETERS = RSC_POINT_SPRITES, |
127 | | /// Supports rendering to vertex buffers |
128 | | RSC_HWRENDER_TO_VERTEX_BUFFER = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 23), |
129 | | /// @deprecated use getNumVertexTextureUnits() |
130 | | RSC_VERTEX_TEXTURE_FETCH = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 24), |
131 | | /// Supports mipmap LOD biasing |
132 | | RSC_MIPMAP_LOD_BIAS = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 25), |
133 | | /// Supports hardware geometry programs |
134 | | RSC_GEOMETRY_PROGRAM = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 26), |
135 | | /// Supports unaligned #VET_HALF3, #VET_SHORT3, #VET_USHORT3 formats |
136 | | RSC_VERTEX_FORMAT_16X3 = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 27), |
137 | | |
138 | | /// Supports compressed textures |
139 | | RSC_TEXTURE_COMPRESSION = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 0), |
140 | | /// Supports compressed textures in the DXT/ST3C formats |
141 | | RSC_TEXTURE_COMPRESSION_DXT = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 1), |
142 | | /// Supports compressed textures in the VTC format |
143 | | RSC_TEXTURE_COMPRESSION_VTC = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 2), |
144 | | /// Supports compressed textures in the PVRTC format |
145 | | RSC_TEXTURE_COMPRESSION_PVRTC = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 3), |
146 | | /// Supports compressed textures in the ATC format |
147 | | RSC_TEXTURE_COMPRESSION_ATC = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 4), |
148 | | /// Supports compressed textures in the ETC1 format |
149 | | RSC_TEXTURE_COMPRESSION_ETC1 = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 5), |
150 | | /// Supports compressed textures in the ETC2 format |
151 | | RSC_TEXTURE_COMPRESSION_ETC2 = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 6), |
152 | | /// Supports compressed textures in BC4 and BC5 format (DirectX feature level 10_0) |
153 | | RSC_TEXTURE_COMPRESSION_BC4_BC5 = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 7), |
154 | | /// Supports compressed textures in BC6H and BC7 format (DirectX feature level 11_0) |
155 | | RSC_TEXTURE_COMPRESSION_BC6H_BC7 = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 8), |
156 | | /// Supports fixed-function pipeline |
157 | | RSC_FIXED_FUNCTION = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 9), |
158 | | /// Supports #VET_INT_10_10_10_2_NORM |
159 | | RSC_VERTEX_FORMAT_INT_10_10_10_2 = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 10), |
160 | | /// Supports Alpha to Coverage (A2C) |
161 | | RSC_ALPHA_TO_COVERAGE = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 11), |
162 | | /// Supports reading back compiled shaders |
163 | | RSC_CAN_GET_COMPILED_SHADER_BUFFER = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 12), |
164 | | /// Supports HW gamma, both in the framebuffer and as texture. |
165 | | RSC_HW_GAMMA = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 13), |
166 | | /// @deprecated do not use |
167 | | RSC_RTT_MAIN_DEPTHBUFFER_ATTACHABLE = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 14), |
168 | | /// Supports attaching a buffer to a render target that is smaller than the buffer. |
169 | | /// Otherwise must be of _exact_ same resolution. D3D 9, OGL 3.0 (not 2.0, not D3D10) |
170 | | RSC_RTT_INDEPENDENT_BUFFER_SIZE = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 15), |
171 | | /// @deprecated use RSC_RTT_INDEPENDENT_BUFFER_SIZE |
172 | | RSC_RTT_DEPTHBUFFER_RESOLUTION_LESSEQUAL = RSC_RTT_INDEPENDENT_BUFFER_SIZE, |
173 | | /// Supports using vertex buffers for instance data |
174 | | RSC_VERTEX_BUFFER_INSTANCE_DATA = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 16), |
175 | | /// Supports mesh and task programs |
176 | | RSC_MESH_PROGRAM = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 17), |
177 | | /// Supports setting viewport and rendertarget array index from any shader stage |
178 | | RSC_VP_RT_INDEX_ANY_SHADER = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 18), |
179 | | /// Supports backing GpuSharedParameters by a hardware constant/uniform buffer (UBO / cbuffer) |
180 | | RSC_UNIFORM_BUFFERS = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 19), |
181 | | |
182 | | // ***** DirectX specific caps ***** |
183 | | /// Is DirectX feature "per stage constants" supported |
184 | | RSC_PERSTAGECONSTANT = OGRE_CAPS_VALUE(CAPS_CATEGORY_D3D9, 0), |
185 | | /// D3D11: supports reading back the inactive depth-stencil buffer as texture |
186 | | RSC_READ_BACK_AS_TEXTURE = OGRE_CAPS_VALUE(CAPS_CATEGORY_D3D9, 1), |
187 | | /// the renderer will try to use W-buffers when available |
188 | | /// W-buffers are enabled by default for 16bit depth buffers and disabled for all other |
189 | | /// depths. |
190 | | RSC_WBUFFER = OGRE_CAPS_VALUE(CAPS_CATEGORY_D3D9, 2), |
191 | | /// D3D11: Supports asynchronous hardware occlusion queries |
192 | | RSC_HWOCCLUSION_ASYNCHRONOUS = OGRE_CAPS_VALUE(CAPS_CATEGORY_D3D9, 3), |
193 | | RSC_HWRENDER_TO_TEXTURE_3D = OGRE_CAPS_VALUE(CAPS_CATEGORY_D3D9, 4), |
194 | | /// All MRTs must have same bit depths |
195 | | RSC_MRT_SAME_BIT_DEPTHS = OGRE_CAPS_VALUE(CAPS_CATEGORY_D3D9, 5), |
196 | | |
197 | | // ***** GL Specific Caps ***** |
198 | | /// Support for PBuffer |
199 | | RSC_PBUFFER = OGRE_CAPS_VALUE(CAPS_CATEGORY_GL, 0), |
200 | | /// Support for Separate Shader Objects |
201 | | RSC_SEPARATE_SHADER_OBJECTS = OGRE_CAPS_VALUE(CAPS_CATEGORY_GL, 1), |
202 | | /// Support for Vertex Array Objects (VAOs) |
203 | | RSC_VAO = OGRE_CAPS_VALUE(CAPS_CATEGORY_GL, 2), |
204 | | /// with Separate Shader Objects the gl_PerVertex interface block must be redeclared |
205 | | /// but some drivers misbehave and do not compile if we do so |
206 | | RSC_GLSL_SSO_REDECLARE = OGRE_CAPS_VALUE(CAPS_CATEGORY_GL, 3), |
207 | | /// Supports debugging/ profiling events |
208 | | RSC_DEBUG = OGRE_CAPS_VALUE(CAPS_CATEGORY_GL, 4), |
209 | | /// RS can map driver buffer storage directly instead of using a shadow buffer |
210 | | RSC_MAPBUFFER = OGRE_CAPS_VALUE(CAPS_CATEGORY_GL, 5), |
211 | | |
212 | | // deprecated caps, all aliasing to RSC_VERTEX_PROGRAM |
213 | | /// @deprecated assume present |
214 | | RSC_INFINITE_FAR_PLANE = RSC_VERTEX_PROGRAM, |
215 | | /// @deprecated assume present |
216 | | RSC_FRAGMENT_PROGRAM = RSC_VERTEX_PROGRAM, |
217 | | RSC_TESSELLATION_DOMAIN_PROGRAM = RSC_TESSELLATION_PROGRAM, |
218 | | RSC_TESSELLATION_HULL_PROGRAM = RSC_TESSELLATION_PROGRAM |
219 | | }; |
220 | | |
221 | | /// DriverVersion is used by RenderSystemCapabilities and both GL and D3D9 |
222 | | /// to store the version of the current GPU driver |
223 | | struct _OgreExport DriverVersion |
224 | | { |
225 | | int major; |
226 | | int minor; |
227 | | int release; |
228 | | int build; |
229 | | |
230 | | DriverVersion() |
231 | 0 | { |
232 | 0 | major = minor = release = build = 0; |
233 | 0 | } |
234 | | |
235 | | String toString() const; |
236 | | void fromString(const String& versionString); |
237 | | }; |
238 | | |
239 | | /** Enumeration of GPU vendors. */ |
240 | | enum GPUVendor |
241 | | { |
242 | | GPU_UNKNOWN = 0, |
243 | | GPU_NVIDIA, |
244 | | GPU_AMD, |
245 | | GPU_INTEL, |
246 | | GPU_IMAGINATION_TECHNOLOGIES, |
247 | | GPU_APPLE, //!< Apple Software Renderer |
248 | | GPU_NOKIA, |
249 | | GPU_MS_SOFTWARE, //!< Microsoft software device |
250 | | GPU_MS_WARP, //!< Microsoft WARP (Windows Advanced Rasterization Platform) software device - http://msdn.microsoft.com/en-us/library/dd285359.aspx |
251 | | GPU_ARM, //!< For the Mali chipsets |
252 | | GPU_QUALCOMM, |
253 | | GPU_MOZILLA, //!< WebGL on Mozilla/Firefox based browser |
254 | | GPU_WEBKIT, //!< WebGL on WebKit/Chrome base browser |
255 | | /// placeholder |
256 | | GPU_VENDOR_COUNT |
257 | | }; |
258 | | |
259 | | /** This class stores the capabilities of the graphics card. |
260 | | |
261 | | This information is set by the individual render systems. |
262 | | */ |
263 | | class _OgreExport RenderSystemCapabilities : public RenderSysAlloc |
264 | | { |
265 | | |
266 | | public: |
267 | | |
268 | | typedef std::set<String> ShaderProfiles; |
269 | | private: |
270 | | /// This is used to build a database of RSC's |
271 | | /// if a RSC with same name, but newer version is introduced, the older one |
272 | | /// will be removed |
273 | | DriverVersion mDriverVersion; |
274 | | /// GPU Vendor |
275 | | GPUVendor mVendor; |
276 | | |
277 | | static String msGPUVendorStrings[GPU_VENDOR_COUNT]; |
278 | | static void initVendorStrings(); |
279 | | |
280 | | /// The number of texture units available |
281 | | ushort mNumTextureUnits; |
282 | | /// The stencil buffer bit depth |
283 | | ushort mStencilBufferBitDepth; |
284 | | /// Stores the capabilities flags. |
285 | | int mCapabilities[CAPS_CATEGORY_COUNT]; |
286 | | /// Which categories are relevant |
287 | | bool mCategoryRelevant[CAPS_CATEGORY_COUNT]; |
288 | | /// The name of the device as reported by the render system |
289 | | String mDeviceName; |
290 | | /// The identifier associated with the render system for which these capabilities are valid |
291 | | String mRenderSystemName; |
292 | | |
293 | | /// The number of floating-point 4-vector constants |
294 | | ushort mConstantFloatCount[GPT_COUNT]; |
295 | | /// The number of simultaneous render targets supported |
296 | | ushort mNumMultiRenderTargets; |
297 | | /// The maximum point size |
298 | | Real mMaxPointSize; |
299 | | /// Are non-POW2 textures feature-limited? |
300 | | bool mNonPOW2TexturesLimited; |
301 | | /// The maximum supported anisotropy |
302 | | Real mMaxSupportedAnisotropy; |
303 | | /// The number of vertex texture units supported |
304 | | ushort mNumVertexTextureUnits; |
305 | | /// The number of vertices a geometry program can emit in a single run |
306 | | int mGeometryProgramNumOutputVertices; |
307 | | |
308 | | /// The list of supported shader profiles |
309 | | ShaderProfiles mSupportedShaderProfiles; |
310 | | |
311 | | /// The number of vertex attributes available |
312 | | ushort mNumVertexAttributes; |
313 | | public: |
314 | | RenderSystemCapabilities (); |
315 | | |
316 | | /** Set the driver version. */ |
317 | | void setDriverVersion(const DriverVersion& version) |
318 | 0 | { |
319 | 0 | mDriverVersion = version; |
320 | 0 | } |
321 | | |
322 | | void parseDriverVersionFromString(const String& versionString) |
323 | 0 | { |
324 | 0 | DriverVersion version; |
325 | 0 | version.fromString(versionString); |
326 | 0 | setDriverVersion(version); |
327 | 0 | } |
328 | | |
329 | | |
330 | | DriverVersion getDriverVersion() const |
331 | 0 | { |
332 | 0 | return mDriverVersion; |
333 | 0 | } |
334 | | |
335 | | GPUVendor getVendor() const |
336 | 0 | { |
337 | 0 | return mVendor; |
338 | 0 | } |
339 | | |
340 | | void setVendor(GPUVendor v) |
341 | 0 | { |
342 | 0 | mVendor = v; |
343 | 0 | } |
344 | | |
345 | | /// Parse and set vendor |
346 | | void parseVendorFromString(const String& vendorString) |
347 | 0 | { |
348 | 0 | setVendor(vendorFromString(vendorString)); |
349 | 0 | } |
350 | | |
351 | | /// Convert a vendor string to an enum |
352 | | static GPUVendor vendorFromString(const String& vendorString); |
353 | | /// Convert a vendor enum to a string |
354 | | static const String& vendorToString(GPUVendor v); |
355 | | |
356 | | bool isDriverOlderThanVersion(const DriverVersion &v) const |
357 | 0 | { |
358 | 0 | if (mDriverVersion.major < v.major) |
359 | 0 | return true; |
360 | 0 | else if (mDriverVersion.major == v.major && |
361 | 0 | mDriverVersion.minor < v.minor) |
362 | 0 | return true; |
363 | 0 | else if (mDriverVersion.major == v.major && |
364 | 0 | mDriverVersion.minor == v.minor && |
365 | 0 | mDriverVersion.release < v.release) |
366 | 0 | return true; |
367 | 0 | else if (mDriverVersion.major == v.major && |
368 | 0 | mDriverVersion.minor == v.minor && |
369 | 0 | mDriverVersion.release == v.release && |
370 | 0 | mDriverVersion.build < v.build) |
371 | 0 | return true; |
372 | 0 | return false; |
373 | 0 | } |
374 | | |
375 | | void setNumTextureUnits(ushort num) |
376 | 0 | { |
377 | 0 | mNumTextureUnits = num; |
378 | 0 | } |
379 | | |
380 | | /// @deprecated do not use |
381 | | void setStencilBufferBitDepth(ushort num) |
382 | 0 | { |
383 | 0 | mStencilBufferBitDepth = num; |
384 | 0 | } |
385 | | |
386 | | /// The number of simultaneous render targets supported |
387 | | void setNumMultiRenderTargets(ushort num) |
388 | 0 | { |
389 | 0 | mNumMultiRenderTargets = num; |
390 | 0 | } |
391 | | |
392 | | void setNumVertexAttributes(ushort num) |
393 | 0 | { |
394 | 0 | mNumVertexAttributes = num; |
395 | 0 | } |
396 | | |
397 | | ushort getNumVertexAttributes(void) const |
398 | 0 | { |
399 | 0 | return mNumVertexAttributes; |
400 | 0 | } |
401 | | |
402 | | /** Returns the number of texture units the current output hardware |
403 | | supports. |
404 | | |
405 | | For use in rendering, this determines how many texture units the |
406 | | are available for multitexturing (i.e. rendering multiple |
407 | | textures in a single pass). Where a Material has multiple |
408 | | texture layers, it will try to use multitexturing where |
409 | | available, and where it is not available, will perform multipass |
410 | | rendering to achieve the same effect. This property only applies |
411 | | to the fixed-function pipeline, the number available to the |
412 | | programmable pipeline depends on the shader model in use. |
413 | | */ |
414 | | ushort getNumTextureUnits(void) const |
415 | 0 | { |
416 | 0 | return mNumTextureUnits; |
417 | 0 | } |
418 | | |
419 | | /// @deprecated assume 8-bit stencil buffer |
420 | | ushort getStencilBufferBitDepth(void) const |
421 | 0 | { |
422 | 0 | return mStencilBufferBitDepth; |
423 | 0 | } |
424 | | |
425 | | /// The number of simultaneous render targets supported |
426 | | ushort getNumMultiRenderTargets(void) const |
427 | 0 | { |
428 | 0 | return mNumMultiRenderTargets; |
429 | 0 | } |
430 | | |
431 | | /** Returns true if capability is render system specific |
432 | | */ |
433 | | bool isCapabilityRenderSystemSpecific(const Capabilities c) const |
434 | 0 | { |
435 | 0 | int cat = c >> OGRE_CAPS_BITSHIFT; |
436 | 0 | if(cat == CAPS_CATEGORY_GL || cat == CAPS_CATEGORY_D3D9) |
437 | 0 | return true; |
438 | 0 | return false; |
439 | 0 | } |
440 | | |
441 | | /** Adds a capability flag |
442 | | */ |
443 | | void setCapability(const Capabilities c) |
444 | 0 | { |
445 | 0 | int index = (CAPS_CATEGORY_MASK & c) >> OGRE_CAPS_BITSHIFT; |
446 | 0 | // zero out the index from the stored capability |
447 | 0 | mCapabilities[index] |= (c & ~CAPS_CATEGORY_MASK); |
448 | 0 | } |
449 | | |
450 | | /** Remove a capability flag |
451 | | */ |
452 | | void unsetCapability(const Capabilities c) |
453 | 0 | { |
454 | 0 | int index = (CAPS_CATEGORY_MASK & c) >> OGRE_CAPS_BITSHIFT; |
455 | 0 | // zero out the index from the stored capability |
456 | 0 | mCapabilities[index] &= (~c | CAPS_CATEGORY_MASK); |
457 | 0 | } |
458 | | |
459 | | /** Checks for a capability |
460 | | */ |
461 | | bool hasCapability(const Capabilities c) const |
462 | 0 | { |
463 | 0 | int index = (CAPS_CATEGORY_MASK & c) >> OGRE_CAPS_BITSHIFT; |
464 | 0 | // test against |
465 | 0 | if(mCapabilities[index] & (c & ~CAPS_CATEGORY_MASK)) |
466 | 0 | { |
467 | 0 | return true; |
468 | 0 | } |
469 | 0 | else |
470 | 0 | { |
471 | 0 | return false; |
472 | 0 | } |
473 | 0 | } |
474 | | |
475 | | /** Adds the profile to the list of supported profiles |
476 | | */ |
477 | | void addShaderProfile(const String& profile); |
478 | | |
479 | | /** Remove a given shader profile, if present. |
480 | | */ |
481 | | void removeShaderProfile(const String& profile); |
482 | | |
483 | | /** Returns true if profile is in the list of supported profiles |
484 | | */ |
485 | | bool isShaderProfileSupported(const String& profile) const; |
486 | | |
487 | | /** Returns a set of all supported shader profiles |
488 | | * */ |
489 | | const ShaderProfiles& getSupportedShaderProfiles() const |
490 | 0 | { |
491 | 0 | return mSupportedShaderProfiles; |
492 | 0 | } |
493 | | |
494 | | |
495 | | /// The number of floating-point 4-vector constants vertex programs support |
496 | | ushort getConstantFloatCount(GpuProgramType programType) const |
497 | 0 | { |
498 | 0 | return mConstantFloatCount[programType]; |
499 | 0 | } |
500 | | |
501 | | /// sets the device name for Render system |
502 | | void setDeviceName(const String& name) |
503 | 0 | { |
504 | 0 | mDeviceName = name; |
505 | 0 | } |
506 | | |
507 | | /// gets the device name for render system |
508 | | String getDeviceName() const |
509 | 0 | { |
510 | 0 | return mDeviceName; |
511 | 0 | } |
512 | | |
513 | | /// The number of floating-point 4-vector constants vertex programs support |
514 | | void setVertexProgramConstantFloatCount(ushort c) |
515 | 0 | { |
516 | 0 | mConstantFloatCount[GPT_VERTEX_PROGRAM] = c; |
517 | 0 | } |
518 | | /// The number of floating-point 4-vector constants geometry programs support |
519 | | void setGeometryProgramConstantFloatCount(ushort c) |
520 | 0 | { |
521 | 0 | mConstantFloatCount[GPT_GEOMETRY_PROGRAM] = c; |
522 | 0 | } |
523 | | /// The number of floating-point 4-vector constants fragment programs support |
524 | | void setFragmentProgramConstantFloatCount(ushort c) |
525 | 0 | { |
526 | 0 | mConstantFloatCount[GPT_FRAGMENT_PROGRAM] = c; |
527 | 0 | } |
528 | | |
529 | | /// Maximum point screen size in pixels |
530 | | void setMaxPointSize(Real s) |
531 | 0 | { |
532 | 0 | mMaxPointSize = s; |
533 | 0 | } |
534 | | /// Maximum point screen size in pixels |
535 | | Real getMaxPointSize(void) const |
536 | 0 | { |
537 | 0 | return mMaxPointSize; |
538 | 0 | } |
539 | | /// Non-POW2 textures limited |
540 | | void setNonPOW2TexturesLimited(bool l) |
541 | 0 | { |
542 | 0 | mNonPOW2TexturesLimited = l; |
543 | 0 | } |
544 | | /** Are non-power of two textures limited in features? |
545 | | |
546 | | If the RSC_NON_POWER_OF_2_TEXTURES capability is set, but this |
547 | | method returns true, you can use non power of 2 textures only if: |
548 | | <ul><li>You load them explicitly with no mip maps</li> |
549 | | <li>You don't use DXT texture compression</li> |
550 | | <li>You use clamp texture addressing</li></ul> |
551 | | */ |
552 | | bool getNonPOW2TexturesLimited(void) const |
553 | 0 | { |
554 | 0 | return mNonPOW2TexturesLimited; |
555 | 0 | } |
556 | | /// Set the maximum supported anisotropic filtering |
557 | | void setMaxSupportedAnisotropy(Real s) |
558 | 0 | { |
559 | 0 | mMaxSupportedAnisotropy = s; |
560 | 0 | } |
561 | | /// Get the maximum supported anisotropic filtering |
562 | | Real getMaxSupportedAnisotropy() const |
563 | 0 | { |
564 | 0 | return mMaxSupportedAnisotropy; |
565 | 0 | } |
566 | | |
567 | | /// Set the number of vertex texture units supported |
568 | | void setNumVertexTextureUnits(ushort n) |
569 | 0 | { |
570 | 0 | mNumVertexTextureUnits = n; |
571 | 0 | } |
572 | | /// Get the number of vertex texture units supported |
573 | | ushort getNumVertexTextureUnits(void) const |
574 | 0 | { |
575 | 0 | return mNumVertexTextureUnits; |
576 | 0 | } |
577 | | |
578 | | /// Set the number of vertices a single geometry program run can emit |
579 | | void setGeometryProgramNumOutputVertices(int numOutputVertices) |
580 | 0 | { |
581 | 0 | mGeometryProgramNumOutputVertices = numOutputVertices; |
582 | 0 | } |
583 | | /// Get the number of vertices a single geometry program run can emit |
584 | | int getGeometryProgramNumOutputVertices(void) const |
585 | 0 | { |
586 | 0 | return mGeometryProgramNumOutputVertices; |
587 | 0 | } |
588 | | |
589 | | /// Get the identifier of the rendersystem from which these capabilities were generated |
590 | | const String& getRenderSystemName(void) const |
591 | 0 | { |
592 | 0 | return mRenderSystemName; |
593 | 0 | } |
594 | | /// Set the identifier of the rendersystem from which these capabilities were generated |
595 | | void setRenderSystemName(const String& rs) |
596 | 0 | { |
597 | 0 | mRenderSystemName = rs; |
598 | 0 | } |
599 | | |
600 | | /// Mark a category as 'relevant' or not, ie will it be reported |
601 | | void setCategoryRelevant(CapabilitiesCategory cat, bool relevant) |
602 | 0 | { |
603 | 0 | mCategoryRelevant[cat] = relevant; |
604 | 0 | } |
605 | | |
606 | | /// Return whether a category is 'relevant' or not, ie will it be reported |
607 | | bool isCategoryRelevant(CapabilitiesCategory cat) |
608 | 0 | { |
609 | 0 | return mCategoryRelevant[cat]; |
610 | 0 | } |
611 | | |
612 | | |
613 | | |
614 | | /** Write the capabilities to the pass in Log */ |
615 | | void log(Log* pLog) const; |
616 | | |
617 | | /// The number of floating-point 4-vector constants compute programs support |
618 | | void setComputeProgramConstantFloatCount(ushort c) |
619 | 0 | { |
620 | 0 | mConstantFloatCount[GPT_COMPUTE_PROGRAM] = c; |
621 | 0 | } |
622 | | /// The number of floating-point 4-vector constants tessellation Domain programs support |
623 | | void setTessellationDomainProgramConstantFloatCount(ushort c) |
624 | 0 | { |
625 | 0 | mConstantFloatCount[GPT_DOMAIN_PROGRAM] = c; |
626 | 0 | } |
627 | | /// The number of floating-point 4-vector constants tessellation Hull programs support |
628 | | void setTessellationHullProgramConstantFloatCount(ushort c) |
629 | 0 | { |
630 | 0 | mConstantFloatCount[GPT_HULL_PROGRAM] = c; |
631 | 0 | } |
632 | | |
633 | | }; |
634 | | |
635 | 0 | inline String to_string(GPUVendor v) { return RenderSystemCapabilities::vendorToString(v); } |
636 | 0 | inline String to_string(const DriverVersion& v) { return v.toString(); } |
637 | | |
638 | | /** @} */ |
639 | | /** @} */ |
640 | | } // namespace |
641 | | |
642 | | |
643 | | #include "OgreHeaderSuffix.h" |
644 | | |
645 | | #endif // __RenderSystemCapabilities__ |
646 | | |