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