Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/ogre_src_v1-9-0/OgreMain/include/OgreRenderSystemCapabilities.h @ 148

Last change on this file since 148 was 148, checked in by patricwi, 6 years ago

Added new dependencies for ogre1.9 and cegui0.8

File size: 32.4 KB
Line 
1/*
2-----------------------------------------------------------------------------
3This source file is part of OGRE
4(Object-oriented Graphics Rendering Engine)
5For the latest info, see http://www.ogre3d.org/
6
7Copyright (c) 2000-2013 Torus Knot Software Ltd
8
9Permission is hereby granted, free of charge, to any person obtaining a copy
10of this software and associated documentation files (the "Software"), to deal
11in the Software without restriction, including without limitation the rights
12to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13copies of the Software, and to permit persons to whom the Software is
14furnished to do so, subject to the following conditions:
15
16The above copyright notice and this permission notice shall be included in
17all copies or substantial portions of the Software.
18
19THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25THE SOFTWARE.
26-----------------------------------------------------------------------------
27*/
28#ifndef __RenderSystemCapabilities__
29#define __RenderSystemCapabilities__
30
31// Precompiler options
32#include "OgrePrerequisites.h"
33#include "OgreString.h"
34#include "OgreStringConverter.h"
35#include "OgreStringVector.h"
36#include "OgreResource.h"
37#include "OgreLogManager.h"
38#include "OgreHeaderPrefix.h"
39
40// Because there are more than 32 possible Capabilities, more than 1 int is needed to store them all.
41// In fact, an array of integers is used to store capabilities. However all the capabilities are defined in the single
42// enum. The only way to know which capabilities should be stored where in the array is to use some of the 32 bits
43// to record the category of the capability.  These top few bits are used as an index into mCapabilities array
44// The lower bits are used to identify each capability individually by setting 1 bit for each
45
46// Identifies how many bits are reserved for categories
47// NOTE: Although 4 bits (currently) are enough
48#define CAPS_CATEGORY_SIZE 4
49#define OGRE_CAPS_BITSHIFT (32 - CAPS_CATEGORY_SIZE)
50#define CAPS_CATEGORY_MASK (((1 << CAPS_CATEGORY_SIZE) - 1) << OGRE_CAPS_BITSHIFT)
51#define OGRE_CAPS_VALUE(cat, val) ((cat << OGRE_CAPS_BITSHIFT) | (1 << val))
52
53namespace Ogre
54{
55        /** \addtogroup Core
56        *  @{
57        */
58        /** \addtogroup RenderSystem
59        *  @{
60        */
61
62        /// Enumerates the categories of capabilities
63        enum CapabilitiesCategory
64        {
65                CAPS_CATEGORY_COMMON = 0,
66                CAPS_CATEGORY_COMMON_2 = 1,
67                CAPS_CATEGORY_D3D9 = 2,
68                CAPS_CATEGORY_GL = 3,
69                /// Placeholder for max value
70                CAPS_CATEGORY_COUNT = 4
71        };
72
73        /// Enum describing the different hardware capabilities we want to check for
74        /// OGRE_CAPS_VALUE(a, b) defines each capability
75        // a is the category (which can be from 0 to 15)
76        // b is the value (from 0 to 27)
77        enum Capabilities
78        {
79                /// Supports generating mipmaps in hardware
80                RSC_AUTOMIPMAP              = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 0),
81                RSC_BLENDING                = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 1),
82                /// Supports anisotropic texture filtering
83                RSC_ANISOTROPY              = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 2),
84                /// Supports fixed-function DOT3 texture blend
85                RSC_DOT3                    = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 3),
86                /// Supports cube mapping
87                RSC_CUBEMAPPING             = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 4),
88                /// Supports hardware stencil buffer
89                RSC_HWSTENCIL               = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 5),
90                /// Supports hardware vertex and index buffers
91                RSC_VBO                     = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 7),
92                /// Supports vertex programs (vertex shaders)
93                RSC_VERTEX_PROGRAM          = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 9),
94                /// Supports fragment programs (pixel shaders)
95                RSC_FRAGMENT_PROGRAM        = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 10),
96                /// Supports performing a scissor test to exclude areas of the screen
97                RSC_SCISSOR_TEST            = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 11),
98                /// Supports separate stencil updates for both front and back faces
99                RSC_TWO_SIDED_STENCIL       = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 12),
100                /// Supports wrapping the stencil value at the range extremeties
101                RSC_STENCIL_WRAP            = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 13),
102                /// Supports hardware occlusion queries
103                RSC_HWOCCLUSION             = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 14),
104                /// Supports user clipping planes
105                RSC_USER_CLIP_PLANES        = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 15),
106                /// Supports the VET_UBYTE4 vertex element type
107                RSC_VERTEX_FORMAT_UBYTE4    = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 16),
108                /// Supports infinite far plane projection
109                RSC_INFINITE_FAR_PLANE      = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 17),
110                /// Supports hardware render-to-texture (bigger than framebuffer)
111                RSC_HWRENDER_TO_TEXTURE     = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 18),
112                /// Supports float textures and render targets
113                RSC_TEXTURE_FLOAT           = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 19),
114                /// Supports non-power of two textures
115                RSC_NON_POWER_OF_2_TEXTURES = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 20),
116                /// Supports 3d (volume) textures
117                RSC_TEXTURE_3D              = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 21),
118                /// Supports basic point sprite rendering
119                RSC_POINT_SPRITES           = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 22),
120                /// Supports extra point parameters (minsize, maxsize, attenuation)
121                RSC_POINT_EXTENDED_PARAMETERS = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 23),
122                /// Supports vertex texture fetch
123                RSC_VERTEX_TEXTURE_FETCH = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 24),
124                /// Supports mipmap LOD biasing
125                RSC_MIPMAP_LOD_BIAS = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 25),
126                /// Supports hardware geometry programs
127                RSC_GEOMETRY_PROGRAM = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 26),
128                /// Supports rendering to vertex buffers
129                RSC_HWRENDER_TO_VERTEX_BUFFER = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 27),
130
131                /// Supports compressed textures
132                RSC_TEXTURE_COMPRESSION = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 0),
133                /// Supports compressed textures in the DXT/ST3C formats
134                RSC_TEXTURE_COMPRESSION_DXT = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 1),
135                /// Supports compressed textures in the VTC format
136                RSC_TEXTURE_COMPRESSION_VTC = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 2),
137                /// Supports compressed textures in the PVRTC format
138                RSC_TEXTURE_COMPRESSION_PVRTC = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 3),
139                /// Supports compressed textures in the ATC format
140                RSC_TEXTURE_COMPRESSION_ATC = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 4),
141                /// Supports compressed textures in the ETC1 format
142                RSC_TEXTURE_COMPRESSION_ETC1 = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 5),
143                /// Supports compressed textures in the ETC2 format
144                RSC_TEXTURE_COMPRESSION_ETC2 = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 6),
145                /// Supports compressed textures in BC4 and BC5 format (DirectX feature level 10_0)
146                RSC_TEXTURE_COMPRESSION_BC4_BC5 = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 7),
147                /// Supports compressed textures in BC6H and BC7 format (DirectX feature level 11_0)
148                RSC_TEXTURE_COMPRESSION_BC6H_BC7 = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 8),
149                /// Supports fixed-function pipeline
150                RSC_FIXED_FUNCTION = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 9),
151                /// Supports MRTs with different bit depths
152                RSC_MRT_DIFFERENT_BIT_DEPTHS = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 10),
153                /// Supports Alpha to Coverage (A2C)
154                RSC_ALPHA_TO_COVERAGE = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 11),
155                /// Supports Blending operations other than +
156                RSC_ADVANCED_BLEND_OPERATIONS = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 12),
157                /// Supports a separate depth buffer for RTTs. D3D 9 & 10, OGL w/FBO (RSC_FBO implies this flag)
158                RSC_RTT_SEPARATE_DEPTHBUFFER = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 13),
159                /// Supports using the MAIN depth buffer for RTTs. D3D 9&10, OGL w/FBO support unknown
160                /// (undefined behavior?), OGL w/ copy supports it
161                RSC_RTT_MAIN_DEPTHBUFFER_ATTACHABLE = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 14),
162                /// Supports attaching a depth buffer to an RTT that has width & height less or equal than RTT's.
163                /// Otherwise must be of _exact_ same resolution. D3D 9, OGL 3.0 (not 2.0, not D3D10)
164                RSC_RTT_DEPTHBUFFER_RESOLUTION_LESSEQUAL = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 15),
165                /// Supports using vertex buffers for instance data
166                RSC_VERTEX_BUFFER_INSTANCE_DATA = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 16),
167                /// Supports using vertex buffers for instance data
168                RSC_CAN_GET_COMPILED_SHADER_BUFFER = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 17),
169                /// Supports dynamic linkage/shader subroutine
170                RSC_SHADER_SUBROUTINE = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 18),
171
172                RSC_HWRENDER_TO_TEXTURE_3D = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 19),
173                /// Supports 1d textures
174                RSC_TEXTURE_1D              = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 20),
175                /// Supports hardware tesselation hull programs
176                RSC_TESSELATION_HULL_PROGRAM = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 21),
177                /// Supports hardware tesselation domain programs
178                RSC_TESSELATION_DOMAIN_PROGRAM = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 22),
179                /// Supports hardware compute programs
180                RSC_COMPUTE_PROGRAM = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 23),
181                /// Supports asynchronous hardware occlusion queries
182                RSC_HWOCCLUSION_ASYNCHRONOUS = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 24),
183                /// Supports asynchronous hardware occlusion queries
184                RSC_ATOMIC_COUNTERS = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 25),
185
186                // ***** DirectX specific caps *****
187                /// Is DirectX feature "per stage constants" supported
188                RSC_PERSTAGECONSTANT = OGRE_CAPS_VALUE(CAPS_CATEGORY_D3D9, 0),
189
190                // ***** GL Specific Caps *****
191                /// Supports OpenGL version 1.5
192                RSC_GL1_5_NOVBO    = OGRE_CAPS_VALUE(CAPS_CATEGORY_GL, 1),
193                /// Support for Frame Buffer Objects (FBOs)
194                RSC_FBO              = OGRE_CAPS_VALUE(CAPS_CATEGORY_GL, 2),
195                /// Support for Frame Buffer Objects ARB implementation (regular FBO is higher precedence)
196                RSC_FBO_ARB          = OGRE_CAPS_VALUE(CAPS_CATEGORY_GL, 3),
197                /// Support for Frame Buffer Objects ATI implementation (ARB FBO is higher precedence)
198                RSC_FBO_ATI          = OGRE_CAPS_VALUE(CAPS_CATEGORY_GL, 4),
199                /// Support for PBuffer
200                RSC_PBUFFER          = OGRE_CAPS_VALUE(CAPS_CATEGORY_GL, 5),
201                /// Support for GL 1.5 but without HW occlusion workaround
202                RSC_GL1_5_NOHWOCCLUSION = OGRE_CAPS_VALUE(CAPS_CATEGORY_GL, 6),
203                /// Support for point parameters ARB implementation
204                RSC_POINT_EXTENDED_PARAMETERS_ARB = OGRE_CAPS_VALUE(CAPS_CATEGORY_GL, 7),
205                /// Support for point parameters EXT implementation
206                RSC_POINT_EXTENDED_PARAMETERS_EXT = OGRE_CAPS_VALUE(CAPS_CATEGORY_GL, 8),
207                /// Support for Separate Shader Objects
208                RSC_SEPARATE_SHADER_OBJECTS = OGRE_CAPS_VALUE(CAPS_CATEGORY_GL, 9),
209                /// Support for Vertex Array Objects (VAOs)
210        RSC_VAO              = OGRE_CAPS_VALUE(CAPS_CATEGORY_GL, 10)
211        };
212
213        /// DriverVersion is used by RenderSystemCapabilities and both GL and D3D9
214        /// to store the version of the current GPU driver
215        struct _OgreExport DriverVersion
216        {
217                int major;
218                int minor;
219                int release;
220                int build;
221
222                DriverVersion() 
223                {
224                        major = minor = release = build = 0;
225                }
226
227                String toString() const 
228                {
229                        StringUtil::StrStreamType str;
230                        str << major << "." << minor << "." << release << "." << build;
231                        return str.str();
232                }
233
234                void fromString(const String& versionString)
235                {
236                        StringVector tokens = StringUtil::split(versionString, ".");
237                        if(!tokens.empty())
238                        {
239                                major = StringConverter::parseInt(tokens[0]);
240                                if (tokens.size() > 1)
241                                        minor = StringConverter::parseInt(tokens[1]);
242                                if (tokens.size() > 2)
243                                        release = StringConverter::parseInt(tokens[2]);
244                                if (tokens.size() > 3)
245                                        build = StringConverter::parseInt(tokens[3]);
246                        }
247
248                }
249        };
250
251        /** Enumeration of GPU vendors. */
252        enum GPUVendor
253        {
254                GPU_UNKNOWN = 0,
255                GPU_NVIDIA = 1,
256                GPU_AMD = 2,
257                GPU_INTEL = 3,
258                GPU_S3 = 4,
259                GPU_MATROX = 5,
260                GPU_3DLABS = 6,
261                GPU_SIS = 7,
262        GPU_IMAGINATION_TECHNOLOGIES = 8,
263        GPU_APPLE = 9,  // Apple Software Renderer
264        GPU_NOKIA = 10,
265                GPU_MS_SOFTWARE = 11, // Microsoft software device
266                GPU_MS_WARP = 12, // Microsoft WARP (Windows Advanced Rasterization Platform) software device - http://msdn.microsoft.com/en-us/library/dd285359.aspx
267        GPU_ARM = 13, // For the Mali chipsets
268        GPU_QUALCOMM = 14,
269
270                /// placeholder
271                GPU_VENDOR_COUNT = 15
272        };
273
274        /** singleton class for storing the capabilities of the graphics card.
275        @remarks
276        This class stores the capabilities of the graphics card.  This
277        information is set by the individual render systems.
278        */
279        class _OgreExport RenderSystemCapabilities : public RenderSysAlloc
280        {
281
282        public:
283
284                typedef set<String>::type ShaderProfiles;
285        private:
286                /// This is used to build a database of RSC's
287                /// if a RSC with same name, but newer version is introduced, the older one
288                /// will be removed
289                DriverVersion mDriverVersion;
290                /// GPU Vendor
291                GPUVendor mVendor;
292
293                static StringVector msGPUVendorStrings;
294                static void initVendorStrings();
295
296                /// The number of world matrices available
297                ushort mNumWorldMatrices;
298                /// The number of texture units available
299                ushort mNumTextureUnits;
300                /// The stencil buffer bit depth
301                ushort mStencilBufferBitDepth;
302                /// The number of matrices available for hardware blending
303                ushort mNumVertexBlendMatrices;
304                /// Stores the capabilities flags.
305                int mCapabilities[CAPS_CATEGORY_COUNT];
306                /// Which categories are relevant
307                bool mCategoryRelevant[CAPS_CATEGORY_COUNT];
308                /// The name of the device as reported by the render system
309                String mDeviceName;
310                /// The identifier associated with the render system for which these capabilities are valid
311                String mRenderSystemName;
312
313                /// The number of floating-point constants vertex programs support
314                ushort mVertexProgramConstantFloatCount;           
315                /// The number of integer constants vertex programs support
316                ushort mVertexProgramConstantIntCount;           
317                /// The number of boolean constants vertex programs support
318                ushort mVertexProgramConstantBoolCount;           
319                /// The number of floating-point constants geometry programs support
320                ushort mGeometryProgramConstantFloatCount;           
321                /// The number of integer constants vertex geometry support
322                ushort mGeometryProgramConstantIntCount;           
323                /// The number of boolean constants vertex geometry support
324                ushort mGeometryProgramConstantBoolCount;           
325                /// The number of floating-point constants fragment programs support
326                ushort mFragmentProgramConstantFloatCount;           
327                /// The number of integer constants fragment programs support
328                ushort mFragmentProgramConstantIntCount;           
329                /// The number of boolean constants fragment programs support
330                ushort mFragmentProgramConstantBoolCount;
331                /// The number of simultaneous render targets supported
332                ushort mNumMultiRenderTargets;
333                /// The maximum point size
334                Real mMaxPointSize;
335                /// Are non-POW2 textures feature-limited?
336                bool mNonPOW2TexturesLimited;
337                /// The maximum supported anisotropy
338                Real mMaxSupportedAnisotropy;
339                /// The number of vertex texture units supported
340                ushort mNumVertexTextureUnits;
341                /// Are vertex texture units shared with fragment processor?
342                bool mVertexTextureUnitsShared;
343                /// The number of vertices a geometry program can emit in a single run
344                int mGeometryProgramNumOutputVertices;
345
346
347                /// The list of supported shader profiles
348                ShaderProfiles mSupportedShaderProfiles;
349
350                // Support for new shader stages in shader model 5.0
351                /// The number of floating-point constants tesselation Hull programs support
352                ushort mTesselationHullProgramConstantFloatCount;           
353                /// The number of integer constants tesselation Hull programs support
354                ushort mTesselationHullProgramConstantIntCount;           
355                /// The number of boolean constants tesselation Hull programs support
356                ushort mTesselationHullProgramConstantBoolCount;
357                /// The number of floating-point constants tesselation Domain programs support
358                ushort mTesselationDomainProgramConstantFloatCount;           
359                /// The number of integer constants tesselation Domain programs support
360                ushort mTesselationDomainProgramConstantIntCount;           
361                /// The number of boolean constants tesselation Domain programs support
362                ushort mTesselationDomainProgramConstantBoolCount;
363                /// The number of floating-point constants compute programs support
364                ushort mComputeProgramConstantFloatCount;           
365                /// The number of integer constants compute programs support
366                ushort mComputeProgramConstantIntCount;           
367                /// The number of boolean constants compute programs support
368                ushort mComputeProgramConstantBoolCount;
369
370
371
372        public: 
373                RenderSystemCapabilities ();
374                virtual ~RenderSystemCapabilities ();
375
376                virtual size_t calculateSize() const {return 0;}
377
378                /** Set the driver version. */
379                void setDriverVersion(const DriverVersion& version)
380                {
381                        mDriverVersion = version;
382                }
383
384                void parseDriverVersionFromString(const String& versionString)
385                {
386                        DriverVersion version;
387                        version.fromString(versionString);
388                        setDriverVersion(version);
389                }
390
391
392                DriverVersion getDriverVersion() const
393                {
394                        return mDriverVersion;
395                }
396
397                GPUVendor getVendor() const
398                {
399                        return mVendor;
400                }
401
402                void setVendor(GPUVendor v)
403                {
404                        mVendor = v;
405                }
406
407                /// Parse and set vendor
408                void parseVendorFromString(const String& vendorString)
409                {
410                        setVendor(vendorFromString(vendorString));
411                }
412
413                /// Convert a vendor string to an enum
414                static GPUVendor vendorFromString(const String& vendorString);
415                /// Convert a vendor enum to a string
416                static String vendorToString(GPUVendor v);
417
418                bool isDriverOlderThanVersion(DriverVersion v) const
419                {
420                        if (mDriverVersion.major < v.major)
421                                return true;
422                        else if (mDriverVersion.major == v.major && 
423                                mDriverVersion.minor < v.minor)
424                                return true;
425                        else if (mDriverVersion.major == v.major && 
426                                mDriverVersion.minor == v.minor && 
427                                mDriverVersion.release < v.release)
428                                return true;
429                        else if (mDriverVersion.major == v.major && 
430                                mDriverVersion.minor == v.minor && 
431                                mDriverVersion.release == v.release &&
432                                mDriverVersion.build < v.build)
433                                return true;
434                        return false;
435                }
436
437                void setNumWorldMatrices(ushort num)
438                {
439                        mNumWorldMatrices = num;
440                }
441
442                void setNumTextureUnits(ushort num)
443                {
444                        mNumTextureUnits = num;
445                }
446
447                void setStencilBufferBitDepth(ushort num)
448                {
449                        mStencilBufferBitDepth = num;
450                }
451
452                void setNumVertexBlendMatrices(ushort num)
453                {
454                        mNumVertexBlendMatrices = num;
455                }
456
457                /// The number of simultaneous render targets supported
458                void setNumMultiRenderTargets(ushort num)
459                {
460                        mNumMultiRenderTargets = num;
461                }
462
463                ushort getNumWorldMatrices(void) const
464                { 
465                        return mNumWorldMatrices;
466                }
467
468                /** Returns the number of texture units the current output hardware
469                supports.
470
471                For use in rendering, this determines how many texture units the
472                are available for multitexturing (i.e. rendering multiple
473                textures in a single pass). Where a Material has multiple
474                texture layers, it will try to use multitexturing where
475                available, and where it is not available, will perform multipass
476                rendering to achieve the same effect. This property only applies
477                to the fixed-function pipeline, the number available to the
478                programmable pipeline depends on the shader model in use.
479                */
480                ushort getNumTextureUnits(void) const
481                {
482                        return mNumTextureUnits;
483                }
484
485                /** Determines the bit depth of the hardware accelerated stencil
486                buffer, if supported.
487                @remarks
488                If hardware stencilling is not supported, the software will
489                provide an 8-bit software stencil.
490                */
491                ushort getStencilBufferBitDepth(void) const
492                {
493                        return mStencilBufferBitDepth;
494                }
495
496                /** Returns the number of matrices available to hardware vertex
497                blending for this rendering system. */
498                ushort getNumVertexBlendMatrices(void) const
499                {
500                        return mNumVertexBlendMatrices;
501                }
502
503                /// The number of simultaneous render targets supported
504                ushort getNumMultiRenderTargets(void) const
505                {
506                        return mNumMultiRenderTargets;
507                }
508
509                /** Returns true if capability is render system specific
510                */
511                bool isCapabilityRenderSystemSpecific(const Capabilities c) const
512                {
513                        int cat = c >> OGRE_CAPS_BITSHIFT;
514                        if(cat == CAPS_CATEGORY_GL || cat == CAPS_CATEGORY_D3D9)
515                                return true;
516                        return false;
517                }
518
519                /** Adds a capability flag
520                */
521                void setCapability(const Capabilities c) 
522                { 
523                        int index = (CAPS_CATEGORY_MASK & c) >> OGRE_CAPS_BITSHIFT;
524                        // zero out the index from the stored capability
525                        mCapabilities[index] |= (c & ~CAPS_CATEGORY_MASK);
526                }
527
528                /** Remove a capability flag
529                */
530                void unsetCapability(const Capabilities c) 
531                { 
532                        int index = (CAPS_CATEGORY_MASK & c) >> OGRE_CAPS_BITSHIFT;
533                        // zero out the index from the stored capability
534                        mCapabilities[index] &= (~c | CAPS_CATEGORY_MASK);
535                }
536
537                /** Checks for a capability
538                */
539                bool hasCapability(const Capabilities c) const
540                {
541                        int index = (CAPS_CATEGORY_MASK & c) >> OGRE_CAPS_BITSHIFT;
542                        // test against
543                        if(mCapabilities[index] & (c & ~CAPS_CATEGORY_MASK))
544                        {
545                                return true;
546                        }
547                        else
548                        {
549                                return false;
550                        }
551                }
552
553                /** Adds the profile to the list of supported profiles
554                */
555                void addShaderProfile(const String& profile)
556                {
557                        mSupportedShaderProfiles.insert(profile);
558
559                }
560
561                /** Remove a given shader profile, if present.
562                */
563                void removeShaderProfile(const String& profile)
564                {
565                        mSupportedShaderProfiles.erase(profile);
566                }
567
568                /** Returns true if profile is in the list of supported profiles
569                */
570                bool isShaderProfileSupported(const String& profile) const
571                {
572                        return (mSupportedShaderProfiles.end() != mSupportedShaderProfiles.find(profile));
573                }
574
575
576                /** Returns a set of all supported shader profiles
577                * */
578                const ShaderProfiles& getSupportedShaderProfiles() const
579                {
580                        return mSupportedShaderProfiles;
581                }
582
583
584                /// The number of floating-point constants vertex programs support
585                ushort getVertexProgramConstantFloatCount(void) const
586                {
587                        return mVertexProgramConstantFloatCount;           
588                }
589                /// The number of integer constants vertex programs support
590                ushort getVertexProgramConstantIntCount(void) const
591                {
592                        return mVertexProgramConstantIntCount;           
593                }
594                /// The number of boolean constants vertex programs support
595                ushort getVertexProgramConstantBoolCount(void) const
596                {
597                        return mVertexProgramConstantBoolCount;           
598                }
599                /// The number of floating-point constants geometry programs support
600                ushort getGeometryProgramConstantFloatCount(void) const
601                {
602                        return mGeometryProgramConstantFloatCount;           
603                }
604                /// The number of integer constants geometry programs support
605                ushort getGeometryProgramConstantIntCount(void) const
606                {
607                        return mGeometryProgramConstantIntCount;           
608                }
609                /// The number of boolean constants geometry programs support
610                ushort getGeometryProgramConstantBoolCount(void) const
611                {
612                        return mGeometryProgramConstantBoolCount;           
613                }
614                /// The number of floating-point constants fragment programs support
615                ushort getFragmentProgramConstantFloatCount(void) const
616                {
617                        return mFragmentProgramConstantFloatCount;           
618                }
619                /// The number of integer constants fragment programs support
620                ushort getFragmentProgramConstantIntCount(void) const
621                {
622                        return mFragmentProgramConstantIntCount;           
623                }
624                /// The number of boolean constants fragment programs support
625                ushort getFragmentProgramConstantBoolCount(void) const
626                {
627                        return mFragmentProgramConstantBoolCount;           
628                }
629
630                /// sets the device name for Render system
631                void setDeviceName(const String& name)
632                {
633                        mDeviceName = name;
634                }
635
636                /// gets the device name for render system
637                String getDeviceName() const
638                {
639                        return mDeviceName;
640                }
641
642                /// The number of floating-point constants vertex programs support
643                void setVertexProgramConstantFloatCount(ushort c)
644                {
645                        mVertexProgramConstantFloatCount = c;           
646                }
647                /// The number of integer constants vertex programs support
648                void setVertexProgramConstantIntCount(ushort c)
649                {
650                        mVertexProgramConstantIntCount = c;           
651                }
652                /// The number of boolean constants vertex programs support
653                void setVertexProgramConstantBoolCount(ushort c)
654                {
655                        mVertexProgramConstantBoolCount = c;           
656                }
657                /// The number of floating-point constants geometry programs support
658                void setGeometryProgramConstantFloatCount(ushort c)
659                {
660                        mGeometryProgramConstantFloatCount = c;           
661                }
662                /// The number of integer constants geometry programs support
663                void setGeometryProgramConstantIntCount(ushort c)
664                {
665                        mGeometryProgramConstantIntCount = c;           
666                }
667                /// The number of boolean constants geometry programs support
668                void setGeometryProgramConstantBoolCount(ushort c)
669                {
670                        mGeometryProgramConstantBoolCount = c;           
671                }
672                /// The number of floating-point constants fragment programs support
673                void setFragmentProgramConstantFloatCount(ushort c)
674                {
675                        mFragmentProgramConstantFloatCount = c;           
676                }
677                /// The number of integer constants fragment programs support
678                void setFragmentProgramConstantIntCount(ushort c)
679                {
680                        mFragmentProgramConstantIntCount = c;           
681                }
682                /// The number of boolean constants fragment programs support
683                void setFragmentProgramConstantBoolCount(ushort c)
684                {
685                        mFragmentProgramConstantBoolCount = c;           
686                }
687                /// Maximum point screen size in pixels
688                void setMaxPointSize(Real s)
689                {
690                        mMaxPointSize = s;
691                }
692                /// Maximum point screen size in pixels
693                Real getMaxPointSize(void) const
694                {
695                        return mMaxPointSize;
696                }
697                /// Non-POW2 textures limited
698                void setNonPOW2TexturesLimited(bool l)
699                {
700                        mNonPOW2TexturesLimited = l;
701                }
702                /** Are non-power of two textures limited in features?
703                @remarks
704                If the RSC_NON_POWER_OF_2_TEXTURES capability is set, but this
705                method returns true, you can use non power of 2 textures only if:
706                <ul><li>You load them explicitly with no mip maps</li>
707                <li>You don't use DXT texture compression</li>
708                <li>You use clamp texture addressing</li></ul>
709                */
710                bool getNonPOW2TexturesLimited(void) const
711                {
712                        return mNonPOW2TexturesLimited;
713                }
714                /// Set the maximum supported anisotropic filtering
715                void setMaxSupportedAnisotropy(Real s)
716                {
717                        mMaxSupportedAnisotropy = s;
718                }
719                /// Get the maximum supported anisotropic filtering
720                Real getMaxSupportedAnisotropy()
721                {
722                        return mMaxSupportedAnisotropy;
723                }
724
725                /// Set the number of vertex texture units supported
726                void setNumVertexTextureUnits(ushort n)
727                {
728                        mNumVertexTextureUnits = n;
729                }
730                /// Get the number of vertex texture units supported
731                ushort getNumVertexTextureUnits(void) const
732                {
733                        return mNumVertexTextureUnits;
734                }
735                /// Set whether the vertex texture units are shared with the fragment processor
736                void setVertexTextureUnitsShared(bool shared)
737                {
738                        mVertexTextureUnitsShared = shared;
739                }
740                /// Get whether the vertex texture units are shared with the fragment processor
741                bool getVertexTextureUnitsShared(void) const
742                {
743                        return mVertexTextureUnitsShared;
744                }
745
746                /// Set the number of vertices a single geometry program run can emit
747                void setGeometryProgramNumOutputVertices(int numOutputVertices)
748                {
749                        mGeometryProgramNumOutputVertices = numOutputVertices;
750                }
751                /// Get the number of vertices a single geometry program run can emit
752                int getGeometryProgramNumOutputVertices(void) const
753                {
754                        return mGeometryProgramNumOutputVertices;
755                }
756
757                /// Get the identifier of the rendersystem from which these capabilities were generated
758                String getRenderSystemName(void) const
759                {
760                        return mRenderSystemName;
761                }
762                ///  Set the identifier of the rendersystem from which these capabilities were generated
763                void setRenderSystemName(const String& rs)
764                {
765                        mRenderSystemName = rs;
766                }
767
768                /// Mark a category as 'relevant' or not, ie will it be reported
769                void setCategoryRelevant(CapabilitiesCategory cat, bool relevant)
770                {
771                        mCategoryRelevant[cat] = relevant;
772                }
773
774                /// Return whether a category is 'relevant' or not, ie will it be reported
775                bool isCategoryRelevant(CapabilitiesCategory cat)
776                {
777                        return mCategoryRelevant[cat];
778                }
779
780
781
782                /** Write the capabilities to the pass in Log */
783                void log(Log* pLog);
784
785                // Support for new shader stages in shader model 5.0
786                /// The number of floating-point constants tesselation Hull programs support
787                void setTesselationHullProgramConstantFloatCount(ushort c)
788                {
789                        mTesselationHullProgramConstantFloatCount = c;           
790                }
791                /// The number of integer constants tesselation Domain programs support
792                void setTesselationHullProgramConstantIntCount(ushort c)
793                {
794                        mTesselationHullProgramConstantIntCount = c;           
795                }
796                /// The number of boolean constants tesselation Domain programs support
797                void setTesselationHullProgramConstantBoolCount(ushort c)
798                {
799                        mTesselationHullProgramConstantBoolCount = c;           
800                }
801                /// The number of floating-point constants fragment programs support
802                ushort getTesselationHullProgramConstantFloatCount(void) const
803                {
804                        return mTesselationHullProgramConstantFloatCount;           
805                }
806                /// The number of integer constants fragment programs support
807                ushort getTesselationHullProgramConstantIntCount(void) const
808                {
809                        return mTesselationHullProgramConstantIntCount;           
810                }
811                /// The number of boolean constants fragment programs support
812                ushort getTesselationHullProgramConstantBoolCount(void) const
813                {
814                        return mTesselationHullProgramConstantBoolCount;           
815                }
816
817                /// The number of floating-point constants tesselation Domain programs support
818                void setTesselationDomainProgramConstantFloatCount(ushort c)
819                {
820                        mTesselationDomainProgramConstantFloatCount = c;           
821                }
822                /// The number of integer constants tesselation Domain programs support
823                void setTesselationDomainProgramConstantIntCount(ushort c)
824                {
825                        mTesselationDomainProgramConstantIntCount = c;           
826                }
827                /// The number of boolean constants tesselation Domain programs support
828                void setTesselationDomainProgramConstantBoolCount(ushort c)
829                {
830                        mTesselationDomainProgramConstantBoolCount = c;           
831                }
832                /// The number of floating-point constants fragment programs support
833                ushort getTesselationDomainProgramConstantFloatCount(void) const
834                {
835                        return mTesselationDomainProgramConstantFloatCount;           
836                }
837                /// The number of integer constants fragment programs support
838                ushort getTesselationDomainProgramConstantIntCount(void) const
839                {
840                        return mTesselationDomainProgramConstantIntCount;           
841                }
842                /// The number of boolean constants fragment programs support
843                ushort getTesselationDomainProgramConstantBoolCount(void) const
844                {
845                        return mTesselationDomainProgramConstantBoolCount;           
846                }
847
848                /// The number of floating-point constants compute programs support
849                void setComputeProgramConstantFloatCount(ushort c)
850                {
851                        mComputeProgramConstantFloatCount = c;           
852                }
853                /// The number of integer constants compute programs support
854                void setComputeProgramConstantIntCount(ushort c)
855                {
856                        mComputeProgramConstantIntCount = c;           
857                }
858                /// The number of boolean constants compute programs support
859                void setComputeProgramConstantBoolCount(ushort c)
860                {
861                        mComputeProgramConstantBoolCount = c;           
862                }
863                /// The number of floating-point constants fragment programs support
864                ushort getComputeProgramConstantFloatCount(void) const
865                {
866                        return mComputeProgramConstantFloatCount;           
867                }
868                /// The number of integer constants fragment programs support
869                ushort getComputeProgramConstantIntCount(void) const
870                {
871                        return mComputeProgramConstantIntCount;           
872                }
873                /// The number of boolean constants fragment programs support
874                ushort getComputeProgramConstantBoolCount(void) const
875                {
876                        return mComputeProgramConstantBoolCount;           
877                }
878
879        };
880
881        /** @} */
882        /** @} */
883} // namespace
884
885
886#include "OgreHeaderSuffix.h"
887
888#endif // __RenderSystemCapabilities__
889
Note: See TracBrowser for help on using the repository browser.