Coverage Report

Created: 2025-10-12 07:23

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/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
0
#define CAPS_CATEGORY_SIZE 4
47
0
#define OGRE_CAPS_BITSHIFT (32 - CAPS_CATEGORY_SIZE)
48
0
#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
180
        // ***** DirectX specific caps *****
181
        /// Is DirectX feature "per stage constants" supported
182
        RSC_PERSTAGECONSTANT = OGRE_CAPS_VALUE(CAPS_CATEGORY_D3D9, 0),
183
        /// D3D11: supports reading back the inactive depth-stencil buffer as texture
184
        RSC_READ_BACK_AS_TEXTURE = OGRE_CAPS_VALUE(CAPS_CATEGORY_D3D9, 1),
185
        /// the renderer will try to use W-buffers when available
186
        /// W-buffers are enabled by default for 16bit depth buffers and disabled for all other
187
        /// depths.
188
        RSC_WBUFFER              = OGRE_CAPS_VALUE(CAPS_CATEGORY_D3D9, 2),
189
        /// D3D11: Supports asynchronous hardware occlusion queries
190
        RSC_HWOCCLUSION_ASYNCHRONOUS = OGRE_CAPS_VALUE(CAPS_CATEGORY_D3D9, 3),
191
        RSC_HWRENDER_TO_TEXTURE_3D = OGRE_CAPS_VALUE(CAPS_CATEGORY_D3D9, 4),
192
        /// All MRTs must have same bit depths
193
        RSC_MRT_SAME_BIT_DEPTHS = OGRE_CAPS_VALUE(CAPS_CATEGORY_D3D9, 5),
194
195
        // ***** GL Specific Caps *****
196
        /// Support for PBuffer
197
        RSC_PBUFFER          = OGRE_CAPS_VALUE(CAPS_CATEGORY_GL, 0),
198
        /// Support for Separate Shader Objects
199
        RSC_SEPARATE_SHADER_OBJECTS = OGRE_CAPS_VALUE(CAPS_CATEGORY_GL, 1),
200
        /// Support for Vertex Array Objects (VAOs)
201
        RSC_VAO              = OGRE_CAPS_VALUE(CAPS_CATEGORY_GL, 2),
202
        /// with Separate Shader Objects the gl_PerVertex interface block must be redeclared
203
        /// but some drivers misbehave and do not compile if we do so
204
        RSC_GLSL_SSO_REDECLARE = OGRE_CAPS_VALUE(CAPS_CATEGORY_GL, 3),
205
        /// Supports debugging/ profiling events
206
        RSC_DEBUG = OGRE_CAPS_VALUE(CAPS_CATEGORY_GL, 4),
207
        /// RS can map driver buffer storage directly instead of using a shadow buffer
208
        RSC_MAPBUFFER = OGRE_CAPS_VALUE(CAPS_CATEGORY_GL, 5),
209
210
        // deprecated caps, all aliasing to RSC_VERTEX_PROGRAM
211
        /// @deprecated assume present
212
        RSC_INFINITE_FAR_PLANE = RSC_VERTEX_PROGRAM,
213
        /// @deprecated assume present
214
        RSC_FRAGMENT_PROGRAM = RSC_VERTEX_PROGRAM,
215
        RSC_TESSELLATION_DOMAIN_PROGRAM = RSC_TESSELLATION_PROGRAM,
216
        RSC_TESSELLATION_HULL_PROGRAM = RSC_TESSELLATION_PROGRAM
217
    };
218
219
    /// DriverVersion is used by RenderSystemCapabilities and both GL and D3D9
220
    /// to store the version of the current GPU driver
221
    struct _OgreExport DriverVersion 
222
    {
223
        int major;
224
        int minor;
225
        int release;
226
        int build;
227
228
        DriverVersion() 
229
0
        {
230
0
            major = minor = release = build = 0;
231
0
        }
232
233
        String toString() const;
234
        void fromString(const String& versionString);
235
    };
236
237
    /** Enumeration of GPU vendors. */
238
    enum GPUVendor
239
    {
240
        GPU_UNKNOWN = 0,
241
        GPU_NVIDIA,
242
        GPU_AMD,
243
        GPU_INTEL,
244
        GPU_IMAGINATION_TECHNOLOGIES,
245
        GPU_APPLE,  //!< Apple Software Renderer
246
        GPU_NOKIA,
247
        GPU_MS_SOFTWARE, //!< Microsoft software device
248
        GPU_MS_WARP, //!< Microsoft WARP (Windows Advanced Rasterization Platform) software device - http://msdn.microsoft.com/en-us/library/dd285359.aspx
249
        GPU_ARM, //!< For the Mali chipsets
250
        GPU_QUALCOMM,
251
        GPU_MOZILLA, //!<  WebGL on Mozilla/Firefox based browser
252
        GPU_WEBKIT, //!< WebGL on WebKit/Chrome base browser
253
        /// placeholder
254
        GPU_VENDOR_COUNT
255
    };
256
257
    /** This class stores the capabilities of the graphics card.
258
259
    This information is set by the individual render systems.
260
    */
261
    class _OgreExport RenderSystemCapabilities : public RenderSysAlloc
262
    {
263
264
    public:
265
266
        typedef std::set<String> ShaderProfiles;
267
    private:
268
        /// This is used to build a database of RSC's
269
        /// if a RSC with same name, but newer version is introduced, the older one 
270
        /// will be removed
271
        DriverVersion mDriverVersion;
272
        /// GPU Vendor
273
        GPUVendor mVendor;
274
275
        static String msGPUVendorStrings[GPU_VENDOR_COUNT];
276
        static void initVendorStrings();
277
278
        /// The number of texture units available
279
        ushort mNumTextureUnits;
280
        /// The stencil buffer bit depth
281
        ushort mStencilBufferBitDepth;
282
        /// Stores the capabilities flags.
283
        int mCapabilities[CAPS_CATEGORY_COUNT];
284
        /// Which categories are relevant
285
        bool mCategoryRelevant[CAPS_CATEGORY_COUNT];
286
        /// The name of the device as reported by the render system
287
        String mDeviceName;
288
        /// The identifier associated with the render system for which these capabilities are valid
289
        String mRenderSystemName;
290
291
        /// The number of floating-point 4-vector constants
292
        ushort mConstantFloatCount[GPT_COUNT];
293
        /// The number of simultaneous render targets supported
294
        ushort mNumMultiRenderTargets;
295
        /// The maximum point size
296
        Real mMaxPointSize;
297
        /// Are non-POW2 textures feature-limited?
298
        bool mNonPOW2TexturesLimited;
299
        /// The maximum supported anisotropy
300
        Real mMaxSupportedAnisotropy;
301
        /// The number of vertex texture units supported
302
        ushort mNumVertexTextureUnits;
303
        /// The number of vertices a geometry program can emit in a single run
304
        int mGeometryProgramNumOutputVertices;
305
306
        /// The list of supported shader profiles
307
        ShaderProfiles mSupportedShaderProfiles;
308
309
        /// The number of vertex attributes available
310
        ushort mNumVertexAttributes;
311
    public: 
312
        RenderSystemCapabilities ();
313
314
        /** Set the driver version. */
315
        void setDriverVersion(const DriverVersion& version)
316
0
        {
317
0
            mDriverVersion = version;
318
0
        }
319
320
        void parseDriverVersionFromString(const String& versionString)
321
0
        {
322
0
            DriverVersion version;
323
0
            version.fromString(versionString);
324
0
            setDriverVersion(version);
325
0
        }
326
327
328
        DriverVersion getDriverVersion() const
329
0
        {
330
0
            return mDriverVersion;
331
0
        }
332
333
        GPUVendor getVendor() const
334
0
        {
335
0
            return mVendor;
336
0
        }
337
338
        void setVendor(GPUVendor v)
339
0
        {
340
0
            mVendor = v;
341
0
        }
342
343
        /// Parse and set vendor
344
        void parseVendorFromString(const String& vendorString)
345
0
        {
346
0
            setVendor(vendorFromString(vendorString));
347
0
        }
348
349
        /// Convert a vendor string to an enum
350
        static GPUVendor vendorFromString(const String& vendorString);
351
        /// Convert a vendor enum to a string
352
        static const String& vendorToString(GPUVendor v);
353
354
        bool isDriverOlderThanVersion(const DriverVersion &v) const
355
0
        {
356
0
            if (mDriverVersion.major < v.major)
357
0
                return true;
358
0
            else if (mDriverVersion.major == v.major && 
359
0
                mDriverVersion.minor < v.minor)
360
0
                return true;
361
0
            else if (mDriverVersion.major == v.major && 
362
0
                mDriverVersion.minor == v.minor && 
363
0
                mDriverVersion.release < v.release)
364
0
                return true;
365
0
            else if (mDriverVersion.major == v.major && 
366
0
                mDriverVersion.minor == v.minor && 
367
0
                mDriverVersion.release == v.release &&
368
0
                mDriverVersion.build < v.build)
369
0
                return true;
370
0
            return false;
371
0
        }
372
373
        void setNumTextureUnits(ushort num)
374
0
        {
375
0
            mNumTextureUnits = num;
376
0
        }
377
378
        /// @deprecated do not use
379
        void setStencilBufferBitDepth(ushort num)
380
0
        {
381
0
            mStencilBufferBitDepth = num;
382
0
        }
383
384
        /// The number of simultaneous render targets supported
385
        void setNumMultiRenderTargets(ushort num)
386
0
        {
387
0
            mNumMultiRenderTargets = num;
388
0
        }
389
390
        void setNumVertexAttributes(ushort num)
391
0
        {
392
0
            mNumVertexAttributes = num;
393
0
        }
394
395
        ushort getNumVertexAttributes(void) const
396
0
        {
397
0
            return mNumVertexAttributes;
398
0
        }
399
400
        /** Returns the number of texture units the current output hardware
401
        supports.
402
403
        For use in rendering, this determines how many texture units the
404
        are available for multitexturing (i.e. rendering multiple 
405
        textures in a single pass). Where a Material has multiple 
406
        texture layers, it will try to use multitexturing where 
407
        available, and where it is not available, will perform multipass
408
        rendering to achieve the same effect. This property only applies
409
        to the fixed-function pipeline, the number available to the 
410
        programmable pipeline depends on the shader model in use.
411
        */
412
        ushort getNumTextureUnits(void) const
413
0
        {
414
0
            return mNumTextureUnits;
415
0
        }
416
417
        /// @deprecated assume 8-bit stencil buffer
418
        ushort getStencilBufferBitDepth(void) const
419
0
        {
420
0
            return mStencilBufferBitDepth;
421
0
        }
422
423
        /// The number of simultaneous render targets supported
424
        ushort getNumMultiRenderTargets(void) const
425
0
        {
426
0
            return mNumMultiRenderTargets;
427
0
        }
428
429
        /** Returns true if capability is render system specific
430
        */
431
        bool isCapabilityRenderSystemSpecific(const Capabilities c) const
432
0
        {
433
0
            int cat = c >> OGRE_CAPS_BITSHIFT;
434
0
            if(cat == CAPS_CATEGORY_GL || cat == CAPS_CATEGORY_D3D9)
435
0
                return true;
436
0
            return false;
437
0
        }
438
439
        /** Adds a capability flag
440
        */
441
        void setCapability(const Capabilities c) 
442
0
        { 
443
0
            int index = (CAPS_CATEGORY_MASK & c) >> OGRE_CAPS_BITSHIFT;
444
0
            // zero out the index from the stored capability
445
0
            mCapabilities[index] |= (c & ~CAPS_CATEGORY_MASK);
446
0
        }
447
448
        /** Remove a capability flag
449
        */
450
        void unsetCapability(const Capabilities c) 
451
0
        { 
452
0
            int index = (CAPS_CATEGORY_MASK & c) >> OGRE_CAPS_BITSHIFT;
453
0
            // zero out the index from the stored capability
454
0
            mCapabilities[index] &= (~c | CAPS_CATEGORY_MASK);
455
0
        }
456
457
        /** Checks for a capability
458
        */
459
        bool hasCapability(const Capabilities c) const
460
0
        {
461
0
            int index = (CAPS_CATEGORY_MASK & c) >> OGRE_CAPS_BITSHIFT;
462
            // test against
463
0
            if(mCapabilities[index] & (c & ~CAPS_CATEGORY_MASK))
464
0
            {
465
0
                return true;
466
0
            }
467
0
            else
468
0
            {
469
0
                return false;
470
0
            }
471
0
        }
472
473
        /** Adds the profile to the list of supported profiles
474
        */
475
        void addShaderProfile(const String& profile);
476
477
        /** Remove a given shader profile, if present.
478
        */
479
        void removeShaderProfile(const String& profile);
480
481
        /** Returns true if profile is in the list of supported profiles
482
        */
483
        bool isShaderProfileSupported(const String& profile) const;
484
485
        /** Returns a set of all supported shader profiles
486
        * */
487
        const ShaderProfiles& getSupportedShaderProfiles() const
488
0
        {
489
0
            return mSupportedShaderProfiles;
490
0
        }
491
492
493
        /// The number of floating-point 4-vector constants vertex programs support
494
        ushort getConstantFloatCount(GpuProgramType programType) const
495
0
        {
496
0
            return mConstantFloatCount[programType];
497
0
        }
498
499
        /// sets the device name for Render system
500
        void setDeviceName(const String& name)
501
0
        {
502
0
            mDeviceName = name;
503
0
        }
504
505
        /// gets the device name for render system
506
        String getDeviceName() const
507
0
        {
508
0
            return mDeviceName;
509
0
        }
510
511
        /// The number of floating-point 4-vector constants vertex programs support
512
        void setVertexProgramConstantFloatCount(ushort c)
513
0
        {
514
0
            mConstantFloatCount[GPT_VERTEX_PROGRAM] = c;
515
0
        }
516
        /// The number of floating-point 4-vector constants geometry programs support
517
        void setGeometryProgramConstantFloatCount(ushort c)
518
0
        {
519
0
            mConstantFloatCount[GPT_GEOMETRY_PROGRAM] = c;
520
0
        }
521
        /// The number of floating-point 4-vector constants fragment programs support
522
        void setFragmentProgramConstantFloatCount(ushort c)
523
0
        {
524
0
            mConstantFloatCount[GPT_FRAGMENT_PROGRAM] = c;
525
0
        }
526
527
        /// Maximum point screen size in pixels
528
        void setMaxPointSize(Real s)
529
0
        {
530
0
            mMaxPointSize = s;
531
0
        }
532
        /// Maximum point screen size in pixels
533
        Real getMaxPointSize(void) const
534
0
        {
535
0
            return mMaxPointSize;
536
0
        }
537
        /// Non-POW2 textures limited
538
        void setNonPOW2TexturesLimited(bool l)
539
0
        {
540
0
            mNonPOW2TexturesLimited = l;
541
0
        }
542
        /** Are non-power of two textures limited in features?
543
544
        If the RSC_NON_POWER_OF_2_TEXTURES capability is set, but this
545
        method returns true, you can use non power of 2 textures only if:
546
        <ul><li>You load them explicitly with no mip maps</li>
547
        <li>You don't use DXT texture compression</li>
548
        <li>You use clamp texture addressing</li></ul>
549
        */
550
        bool getNonPOW2TexturesLimited(void) const
551
0
        {
552
0
            return mNonPOW2TexturesLimited;
553
0
        }
554
        /// Set the maximum supported anisotropic filtering
555
        void setMaxSupportedAnisotropy(Real s)
556
0
        {
557
0
            mMaxSupportedAnisotropy = s;
558
0
        }
559
        /// Get the maximum supported anisotropic filtering
560
        Real getMaxSupportedAnisotropy() const
561
0
        {
562
0
            return mMaxSupportedAnisotropy;
563
0
        }
564
565
        /// Set the number of vertex texture units supported
566
        void setNumVertexTextureUnits(ushort n)
567
0
        {
568
0
            mNumVertexTextureUnits = n;
569
0
        }
570
        /// Get the number of vertex texture units supported
571
        ushort getNumVertexTextureUnits(void) const
572
0
        {
573
0
            return mNumVertexTextureUnits;
574
0
        }
575
576
        /// Set the number of vertices a single geometry program run can emit
577
        void setGeometryProgramNumOutputVertices(int numOutputVertices)
578
0
        {
579
0
            mGeometryProgramNumOutputVertices = numOutputVertices;
580
0
        }
581
        /// Get the number of vertices a single geometry program run can emit
582
        int getGeometryProgramNumOutputVertices(void) const
583
0
        {
584
0
            return mGeometryProgramNumOutputVertices;
585
0
        }
586
587
        /// Get the identifier of the rendersystem from which these capabilities were generated
588
        const String& getRenderSystemName(void) const
589
0
        {
590
0
            return mRenderSystemName;
591
0
        }
592
        ///  Set the identifier of the rendersystem from which these capabilities were generated
593
        void setRenderSystemName(const String& rs)
594
0
        {
595
0
            mRenderSystemName = rs;
596
0
        }
597
598
        /// Mark a category as 'relevant' or not, ie will it be reported
599
        void setCategoryRelevant(CapabilitiesCategory cat, bool relevant)
600
0
        {
601
0
            mCategoryRelevant[cat] = relevant;
602
0
        }
603
604
        /// Return whether a category is 'relevant' or not, ie will it be reported
605
        bool isCategoryRelevant(CapabilitiesCategory cat)
606
0
        {
607
0
            return mCategoryRelevant[cat];
608
0
        }
609
610
611
612
        /** Write the capabilities to the pass in Log */
613
        void log(Log* pLog) const;
614
615
        /// The number of floating-point 4-vector constants compute programs support
616
        void setComputeProgramConstantFloatCount(ushort c)
617
0
        {
618
0
            mConstantFloatCount[GPT_COMPUTE_PROGRAM] = c;
619
0
        }
620
        /// The number of floating-point 4-vector constants tessellation Domain programs support
621
        void setTessellationDomainProgramConstantFloatCount(ushort c)
622
0
        {
623
0
            mConstantFloatCount[GPT_DOMAIN_PROGRAM] = c;
624
0
        }
625
        /// The number of floating-point 4-vector constants tessellation Hull programs support
626
        void setTessellationHullProgramConstantFloatCount(ushort c)
627
0
        {
628
0
            mConstantFloatCount[GPT_HULL_PROGRAM] = c;
629
0
        }
630
631
    };
632
633
0
    inline String to_string(GPUVendor v) { return RenderSystemCapabilities::vendorToString(v); }
634
0
    inline String to_string(const DriverVersion& v) { return v.toString(); }
635
636
    /** @} */
637
    /** @} */
638
} // namespace
639
640
641
#include "OgreHeaderSuffix.h"
642
643
#endif // __RenderSystemCapabilities__
644