CmRenderSystemCapabilities.h 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703
  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. Copyright (c) 2000-2011 Torus Knot Software Ltd
  7. Permission is hereby granted, free of charge, to any person obtaining a copy
  8. of this software and associated documentation files (the "Software"), to deal
  9. in the Software without restriction, including without limitation the rights
  10. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  11. copies of the Software, and to permit persons to whom the Software is
  12. furnished to do so, subject to the following conditions:
  13. The above copyright notice and this permission notice shall be included in
  14. all copies or substantial portions of the Software.
  15. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  21. THE SOFTWARE.
  22. -----------------------------------------------------------------------------
  23. */
  24. #ifndef __RenderSystemCapabilities__
  25. #define __RenderSystemCapabilities__ 1
  26. // Precompiler options
  27. #include "CmPrerequisites.h"
  28. #include "CmString.h"
  29. // Because there are more than 32 possible Capabilities, more than 1 int is needed to store them all.
  30. // In fact, an array of integers is used to store capabilities. However all the capabilities are defined in the single
  31. // enum. The only way to know which capabilities should be stored where in the array is to use some of the 32 bits
  32. // to record the category of the capability. These top few bits are used as an index into mCapabilities array
  33. // The lower bits are used to identify each capability individually by setting 1 bit for each
  34. // Identifies how many bits are reserved for categories
  35. // NOTE: Although 4 bits (currently) are enough
  36. #define CAPS_CATEGORY_SIZE 4
  37. #define OGRE_CAPS_BITSHIFT (32 - CAPS_CATEGORY_SIZE)
  38. #define CAPS_CATEGORY_MASK (((1 << CAPS_CATEGORY_SIZE) - 1) << OGRE_CAPS_BITSHIFT)
  39. #define OGRE_CAPS_VALUE(cat, val) ((cat << OGRE_CAPS_BITSHIFT) | (1 << val))
  40. namespace CamelotEngine
  41. {
  42. /** \addtogroup Core
  43. * @{
  44. */
  45. /** \addtogroup RenderSystem
  46. * @{
  47. */
  48. /// Enumerates the categories of capabilities
  49. enum CapabilitiesCategory
  50. {
  51. CAPS_CATEGORY_COMMON = 0,
  52. CAPS_CATEGORY_COMMON_2 = 1,
  53. CAPS_CATEGORY_D3D9 = 2,
  54. CAPS_CATEGORY_GL = 3,
  55. /// Placeholder for max value
  56. CAPS_CATEGORY_COUNT = 4
  57. };
  58. /// Enum describing the different hardware capabilities we want to check for
  59. /// OGRE_CAPS_VALUE(a, b) defines each capability
  60. // a is the category (which can be from 0 to 15)
  61. // b is the value (from 0 to 27)
  62. enum Capabilities
  63. {
  64. /// Supports generating mipmaps in hardware
  65. RSC_AUTOMIPMAP = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 0),
  66. RSC_BLENDING = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 1),
  67. /// Supports anisotropic texture filtering
  68. RSC_ANISOTROPY = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 2),
  69. /// Supports fixed-function DOT3 texture blend
  70. RSC_DOT3 = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 3),
  71. /// Supports cube mapping
  72. RSC_CUBEMAPPING = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 4),
  73. /// Supports hardware stencil buffer
  74. RSC_HWSTENCIL = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 5),
  75. /// Supports hardware vertex and index buffers
  76. RSC_VBO = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 7),
  77. /// Supports vertex programs (vertex shaders)
  78. RSC_VERTEX_PROGRAM = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 9),
  79. /// Supports fragment programs (pixel shaders)
  80. RSC_FRAGMENT_PROGRAM = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 10),
  81. /// Supports performing a scissor test to exclude areas of the screen
  82. RSC_SCISSOR_TEST = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 11),
  83. /// Supports separate stencil updates for both front and back faces
  84. RSC_TWO_SIDED_STENCIL = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 12),
  85. /// Supports wrapping the stencil value at the range extremeties
  86. RSC_STENCIL_WRAP = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 13),
  87. /// Supports hardware occlusion queries
  88. RSC_HWOCCLUSION = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 14),
  89. /// Supports user clipping planes
  90. RSC_USER_CLIP_PLANES = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 15),
  91. /// Supports the VET_UBYTE4 vertex element type
  92. RSC_VERTEX_FORMAT_UBYTE4 = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 16),
  93. /// Supports infinite far plane projection
  94. RSC_INFINITE_FAR_PLANE = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 17),
  95. /// Supports hardware render-to-texture (bigger than framebuffer)
  96. RSC_HWRENDER_TO_TEXTURE = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 18),
  97. /// Supports float textures and render targets
  98. RSC_TEXTURE_FLOAT = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 19),
  99. /// Supports non-power of two textures
  100. RSC_NON_POWER_OF_2_TEXTURES = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 20),
  101. /// Supports 3d (volume) textures
  102. RSC_TEXTURE_3D = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 21),
  103. /// Supports basic point sprite rendering
  104. RSC_POINT_SPRITES = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 22),
  105. /// Supports extra point parameters (minsize, maxsize, attenuation)
  106. RSC_POINT_EXTENDED_PARAMETERS = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 23),
  107. /// Supports vertex texture fetch
  108. RSC_VERTEX_TEXTURE_FETCH = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 24),
  109. /// Supports mipmap LOD biasing
  110. RSC_MIPMAP_LOD_BIAS = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 25),
  111. /// Supports hardware geometry programs
  112. RSC_GEOMETRY_PROGRAM = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 26),
  113. /// Supports rendering to vertex buffers
  114. RSC_HWRENDER_TO_VERTEX_BUFFER = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 27),
  115. /// Supports compressed textures
  116. RSC_TEXTURE_COMPRESSION = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 0),
  117. /// Supports compressed textures in the DXT/ST3C formats
  118. RSC_TEXTURE_COMPRESSION_DXT = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 1),
  119. /// Supports compressed textures in the VTC format
  120. RSC_TEXTURE_COMPRESSION_VTC = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 2),
  121. /// Supports compressed textures in the PVRTC format
  122. RSC_TEXTURE_COMPRESSION_PVRTC = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 3),
  123. /// Supports fixed-function pipeline
  124. RSC_FIXED_FUNCTION = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 4),
  125. /// Supports MRTs with different bit depths
  126. RSC_MRT_DIFFERENT_BIT_DEPTHS = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 5),
  127. /// Supports Alpha to Coverage (A2C)
  128. RSC_ALPHA_TO_COVERAGE = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 6),
  129. /// Supports Blending operations other than +
  130. RSC_ADVANCED_BLEND_OPERATIONS = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 7),
  131. // ***** DirectX specific caps *****
  132. /// Is DirectX feature "per stage constants" supported
  133. RSC_PERSTAGECONSTANT = OGRE_CAPS_VALUE(CAPS_CATEGORY_D3D9, 0),
  134. // ***** GL Specific Caps *****
  135. /// Supports openGL GLEW version 1.5
  136. RSC_GL1_5_NOVBO = OGRE_CAPS_VALUE(CAPS_CATEGORY_GL, 1),
  137. /// Support for Frame Buffer Objects (FBOs)
  138. RSC_FBO = OGRE_CAPS_VALUE(CAPS_CATEGORY_GL, 2),
  139. /// Support for Frame Buffer Objects ARB implementation (regular FBO is higher precedence)
  140. RSC_FBO_ARB = OGRE_CAPS_VALUE(CAPS_CATEGORY_GL, 3),
  141. /// Support for Frame Buffer Objects ATI implementation (ARB FBO is higher precedence)
  142. RSC_FBO_ATI = OGRE_CAPS_VALUE(CAPS_CATEGORY_GL, 4),
  143. /// Support for PBuffer
  144. RSC_PBUFFER = OGRE_CAPS_VALUE(CAPS_CATEGORY_GL, 5),
  145. /// Support for GL 1.5 but without HW occlusion workaround
  146. RSC_GL1_5_NOHWOCCLUSION = OGRE_CAPS_VALUE(CAPS_CATEGORY_GL, 6),
  147. /// Support for point parameters ARB implementation
  148. RSC_POINT_EXTENDED_PARAMETERS_ARB = OGRE_CAPS_VALUE(CAPS_CATEGORY_GL, 7),
  149. /// Support for point parameters EXT implementation
  150. RSC_POINT_EXTENDED_PARAMETERS_EXT = OGRE_CAPS_VALUE(CAPS_CATEGORY_GL, 8)
  151. };
  152. /// DriverVersion is used by RenderSystemCapabilities and both GL and D3D9
  153. /// to store the version of the current GPU driver
  154. struct CM_EXPORT DriverVersion
  155. {
  156. int major;
  157. int minor;
  158. int release;
  159. int build;
  160. DriverVersion()
  161. {
  162. major = minor = release = build = 0;
  163. }
  164. String toString() const
  165. {
  166. StringUtil::StrStreamType str;
  167. str << major << "." << minor << "." << release << "." << build;
  168. return str.str();
  169. }
  170. void fromString(const String& versionString)
  171. {
  172. std::vector<CamelotEngine::String> tokens = StringUtil::split(versionString, ".");
  173. if(!tokens.empty())
  174. {
  175. major = parseInt(tokens[0]);
  176. if (tokens.size() > 1)
  177. minor = parseInt(tokens[1]);
  178. if (tokens.size() > 2)
  179. release = parseInt(tokens[2]);
  180. if (tokens.size() > 3)
  181. build = parseInt(tokens[3]);
  182. }
  183. }
  184. };
  185. /** Enumeration of GPU vendors. */
  186. enum GPUVendor
  187. {
  188. GPU_UNKNOWN = 0,
  189. GPU_NVIDIA = 1,
  190. GPU_ATI = 2,
  191. GPU_INTEL = 3,
  192. GPU_S3 = 4,
  193. GPU_MATROX = 5,
  194. GPU_3DLABS = 6,
  195. GPU_SIS = 7,
  196. GPU_IMAGINATION_TECHNOLOGIES = 8,
  197. GPU_APPLE = 9, // Apple Software Renderer
  198. GPU_NOKIA = 10,
  199. /// placeholder
  200. GPU_VENDOR_COUNT = 11
  201. };
  202. /** singleton class for storing the capabilities of the graphics card.
  203. @remarks
  204. This class stores the capabilities of the graphics card. This
  205. information is set by the individual render systems.
  206. */
  207. class CM_EXPORT RenderSystemCapabilities
  208. {
  209. public:
  210. typedef set<String>::type ShaderProfiles;
  211. private:
  212. /// This is used to build a database of RSC's
  213. /// if a RSC with same name, but newer version is introduced, the older one
  214. /// will be removed
  215. DriverVersion mDriverVersion;
  216. /// GPU Vendor
  217. GPUVendor mVendor;
  218. static std::vector<CamelotEngine::String> msGPUVendorStrings;
  219. static void initVendorStrings();
  220. /// The number of world matrices available
  221. UINT16 mNumWorldMatrices;
  222. /// The number of texture units available
  223. UINT16 mNumTextureUnits;
  224. /// The stencil buffer bit depth
  225. UINT16 mStencilBufferBitDepth;
  226. /// The number of matrices available for hardware blending
  227. UINT16 mNumVertexBlendMatrices;
  228. /// Stores the capabilities flags.
  229. int mCapabilities[CAPS_CATEGORY_COUNT];
  230. /// Which categories are relevant
  231. bool mCategoryRelevant[CAPS_CATEGORY_COUNT];
  232. /// The name of the device as reported by the render system
  233. String mDeviceName;
  234. /// The identifier associated with the render system for which these capabilities are valid
  235. String mRenderSystemName;
  236. /// The number of floating-point constants vertex programs support
  237. UINT16 mVertexProgramConstantFloatCount;
  238. /// The number of integer constants vertex programs support
  239. UINT16 mVertexProgramConstantIntCount;
  240. /// The number of boolean constants vertex programs support
  241. UINT16 mVertexProgramConstantBoolCount;
  242. /// The number of floating-point constants geometry programs support
  243. UINT16 mGeometryProgramConstantFloatCount;
  244. /// The number of integer constants vertex geometry support
  245. UINT16 mGeometryProgramConstantIntCount;
  246. /// The number of boolean constants vertex geometry support
  247. UINT16 mGeometryProgramConstantBoolCount;
  248. /// The number of floating-point constants fragment programs support
  249. UINT16 mFragmentProgramConstantFloatCount;
  250. /// The number of integer constants fragment programs support
  251. UINT16 mFragmentProgramConstantIntCount;
  252. /// The number of boolean constants fragment programs support
  253. UINT16 mFragmentProgramConstantBoolCount;
  254. /// The number of simultaneous render targets supported
  255. UINT16 mNumMultiRenderTargets;
  256. /// The maximum point size
  257. float mMaxPointSize;
  258. /// Are non-POW2 textures feature-limited?
  259. bool mNonPOW2TexturesLimited;
  260. /// The number of vertex texture units supported
  261. UINT16 mNumVertexTextureUnits;
  262. /// Are vertex texture units shared with fragment processor?
  263. bool mVertexTextureUnitsShared;
  264. /// The number of vertices a geometry program can emit in a single run
  265. int mGeometryProgramNumOutputVertices;
  266. /// The list of supported shader profiles
  267. ShaderProfiles mSupportedShaderProfiles;
  268. public:
  269. RenderSystemCapabilities ();
  270. virtual ~RenderSystemCapabilities ();
  271. virtual size_t calculateSize() const {return 0;}
  272. /** Set the driver version. */
  273. void setDriverVersion(const DriverVersion& version)
  274. {
  275. mDriverVersion = version;
  276. }
  277. void parseDriverVersionFromString(const String& versionString)
  278. {
  279. DriverVersion version;
  280. version.fromString(versionString);
  281. setDriverVersion(version);
  282. }
  283. DriverVersion getDriverVersion() const
  284. {
  285. return mDriverVersion;
  286. }
  287. GPUVendor getVendor() const
  288. {
  289. return mVendor;
  290. }
  291. void setVendor(GPUVendor v)
  292. {
  293. mVendor = v;
  294. }
  295. /// Parse and set vendor
  296. void parseVendorFromString(const String& vendorString)
  297. {
  298. setVendor(vendorFromString(vendorString));
  299. }
  300. /// Convert a vendor string to an enum
  301. static GPUVendor vendorFromString(const String& vendorString);
  302. /// Convert a vendor enum to a string
  303. static String vendorToString(GPUVendor v);
  304. bool isDriverOlderThanVersion(DriverVersion v) const
  305. {
  306. if (mDriverVersion.major < v.major)
  307. return true;
  308. else if (mDriverVersion.major == v.major &&
  309. mDriverVersion.minor < v.minor)
  310. return true;
  311. else if (mDriverVersion.major == v.major &&
  312. mDriverVersion.minor == v.minor &&
  313. mDriverVersion.release < v.release)
  314. return true;
  315. else if (mDriverVersion.major == v.major &&
  316. mDriverVersion.minor == v.minor &&
  317. mDriverVersion.release == v.release &&
  318. mDriverVersion.build < v.build)
  319. return true;
  320. return false;
  321. }
  322. void setNumWorldMatrices(UINT16 num)
  323. {
  324. mNumWorldMatrices = num;
  325. }
  326. void setNumTextureUnits(UINT16 num)
  327. {
  328. mNumTextureUnits = num;
  329. }
  330. void setStencilBufferBitDepth(UINT16 num)
  331. {
  332. mStencilBufferBitDepth = num;
  333. }
  334. void setNumVertexBlendMatrices(UINT16 num)
  335. {
  336. mNumVertexBlendMatrices = num;
  337. }
  338. /// The number of simultaneous render targets supported
  339. void setNumMultiRenderTargets(UINT16 num)
  340. {
  341. mNumMultiRenderTargets = num;
  342. }
  343. UINT16 getNumWorldMatrices(void) const
  344. {
  345. return mNumWorldMatrices;
  346. }
  347. /** Returns the number of texture units the current output hardware
  348. supports.
  349. For use in rendering, this determines how many texture units the
  350. are available for multitexturing (i.e. rendering multiple
  351. textures in a single pass). Where a Material has multiple
  352. texture layers, it will try to use multitexturing where
  353. available, and where it is not available, will perform multipass
  354. rendering to achieve the same effect. This property only applies
  355. to the fixed-function pipeline, the number available to the
  356. programmable pipeline depends on the shader model in use.
  357. */
  358. UINT16 getNumTextureUnits(void) const
  359. {
  360. return mNumTextureUnits;
  361. }
  362. /** Determines the bit depth of the hardware accelerated stencil
  363. buffer, if supported.
  364. @remarks
  365. If hardware stencilling is not supported, the software will
  366. provide an 8-bit software stencil.
  367. */
  368. UINT16 getStencilBufferBitDepth(void) const
  369. {
  370. return mStencilBufferBitDepth;
  371. }
  372. /** Returns the number of matrices available to hardware vertex
  373. blending for this rendering system. */
  374. UINT16 getNumVertexBlendMatrices(void) const
  375. {
  376. return mNumVertexBlendMatrices;
  377. }
  378. /// The number of simultaneous render targets supported
  379. UINT16 getNumMultiRenderTargets(void) const
  380. {
  381. return mNumMultiRenderTargets;
  382. }
  383. /** Returns true if capability is render system specific
  384. */
  385. bool isCapabilityRenderSystemSpecific(const Capabilities c)
  386. {
  387. int cat = c >> OGRE_CAPS_BITSHIFT;
  388. if(cat == CAPS_CATEGORY_GL || cat == CAPS_CATEGORY_D3D9)
  389. return true;
  390. return false;
  391. }
  392. /** Adds a capability flag
  393. */
  394. void setCapability(const Capabilities c)
  395. {
  396. int index = (CAPS_CATEGORY_MASK & c) >> OGRE_CAPS_BITSHIFT;
  397. // zero out the index from the stored capability
  398. mCapabilities[index] |= (c & ~CAPS_CATEGORY_MASK);
  399. }
  400. /** Remove a capability flag
  401. */
  402. void unsetCapability(const Capabilities c)
  403. {
  404. int index = (CAPS_CATEGORY_MASK & c) >> OGRE_CAPS_BITSHIFT;
  405. // zero out the index from the stored capability
  406. mCapabilities[index] &= (~c | CAPS_CATEGORY_MASK);
  407. }
  408. /** Checks for a capability
  409. */
  410. bool hasCapability(const Capabilities c) const
  411. {
  412. int index = (CAPS_CATEGORY_MASK & c) >> OGRE_CAPS_BITSHIFT;
  413. // test against
  414. if(mCapabilities[index] & (c & ~CAPS_CATEGORY_MASK))
  415. {
  416. return true;
  417. }
  418. else
  419. {
  420. return false;
  421. }
  422. }
  423. /** Adds the profile to the list of supported profiles
  424. */
  425. void addShaderProfile(const String& profile)
  426. {
  427. mSupportedShaderProfiles.insert(profile);
  428. }
  429. /** Remove a given shader profile, if present.
  430. */
  431. void removeShaderProfile(const String& profile)
  432. {
  433. mSupportedShaderProfiles.erase(profile);
  434. }
  435. /** Returns true if profile is in the list of supported profiles
  436. */
  437. bool isShaderProfileSupported(const String& profile) const
  438. {
  439. return (mSupportedShaderProfiles.end() != mSupportedShaderProfiles.find(profile));
  440. }
  441. /** Returns a set of all supported shader profiles
  442. * */
  443. const ShaderProfiles& getSupportedShaderProfiles() const
  444. {
  445. return mSupportedShaderProfiles;
  446. }
  447. /// The number of floating-point constants vertex programs support
  448. UINT16 getVertexProgramConstantFloatCount(void) const
  449. {
  450. return mVertexProgramConstantFloatCount;
  451. }
  452. /// The number of integer constants vertex programs support
  453. UINT16 getVertexProgramConstantIntCount(void) const
  454. {
  455. return mVertexProgramConstantIntCount;
  456. }
  457. /// The number of boolean constants vertex programs support
  458. UINT16 getVertexProgramConstantBoolCount(void) const
  459. {
  460. return mVertexProgramConstantBoolCount;
  461. }
  462. /// The number of floating-point constants geometry programs support
  463. UINT16 getGeometryProgramConstantFloatCount(void) const
  464. {
  465. return mGeometryProgramConstantFloatCount;
  466. }
  467. /// The number of integer constants geometry programs support
  468. UINT16 getGeometryProgramConstantIntCount(void) const
  469. {
  470. return mGeometryProgramConstantIntCount;
  471. }
  472. /// The number of boolean constants geometry programs support
  473. UINT16 getGeometryProgramConstantBoolCount(void) const
  474. {
  475. return mGeometryProgramConstantBoolCount;
  476. }
  477. /// The number of floating-point constants fragment programs support
  478. UINT16 getFragmentProgramConstantFloatCount(void) const
  479. {
  480. return mFragmentProgramConstantFloatCount;
  481. }
  482. /// The number of integer constants fragment programs support
  483. UINT16 getFragmentProgramConstantIntCount(void) const
  484. {
  485. return mFragmentProgramConstantIntCount;
  486. }
  487. /// The number of boolean constants fragment programs support
  488. UINT16 getFragmentProgramConstantBoolCount(void) const
  489. {
  490. return mFragmentProgramConstantBoolCount;
  491. }
  492. /// sets the device name for Render system
  493. void setDeviceName(const String& name)
  494. {
  495. mDeviceName = name;
  496. }
  497. /// gets the device name for render system
  498. String getDeviceName() const
  499. {
  500. return mDeviceName;
  501. }
  502. /// The number of floating-point constants vertex programs support
  503. void setVertexProgramConstantFloatCount(UINT16 c)
  504. {
  505. mVertexProgramConstantFloatCount = c;
  506. }
  507. /// The number of integer constants vertex programs support
  508. void setVertexProgramConstantIntCount(UINT16 c)
  509. {
  510. mVertexProgramConstantIntCount = c;
  511. }
  512. /// The number of boolean constants vertex programs support
  513. void setVertexProgramConstantBoolCount(UINT16 c)
  514. {
  515. mVertexProgramConstantBoolCount = c;
  516. }
  517. /// The number of floating-point constants geometry programs support
  518. void setGeometryProgramConstantFloatCount(UINT16 c)
  519. {
  520. mGeometryProgramConstantFloatCount = c;
  521. }
  522. /// The number of integer constants geometry programs support
  523. void setGeometryProgramConstantIntCount(UINT16 c)
  524. {
  525. mGeometryProgramConstantIntCount = c;
  526. }
  527. /// The number of boolean constants geometry programs support
  528. void setGeometryProgramConstantBoolCount(UINT16 c)
  529. {
  530. mGeometryProgramConstantBoolCount = c;
  531. }
  532. /// The number of floating-point constants fragment programs support
  533. void setFragmentProgramConstantFloatCount(UINT16 c)
  534. {
  535. mFragmentProgramConstantFloatCount = c;
  536. }
  537. /// The number of integer constants fragment programs support
  538. void setFragmentProgramConstantIntCount(UINT16 c)
  539. {
  540. mFragmentProgramConstantIntCount = c;
  541. }
  542. /// The number of boolean constants fragment programs support
  543. void setFragmentProgramConstantBoolCount(UINT16 c)
  544. {
  545. mFragmentProgramConstantBoolCount = c;
  546. }
  547. /// Maximum point screen size in pixels
  548. void setMaxPointSize(float s)
  549. {
  550. mMaxPointSize = s;
  551. }
  552. /// Maximum point screen size in pixels
  553. float getMaxPointSize(void) const
  554. {
  555. return mMaxPointSize;
  556. }
  557. /// Non-POW2 textures limited
  558. void setNonPOW2TexturesLimited(bool l)
  559. {
  560. mNonPOW2TexturesLimited = l;
  561. }
  562. /** Are non-power of two textures limited in features?
  563. @remarks
  564. If the RSC_NON_POWER_OF_2_TEXTURES capability is set, but this
  565. method returns true, you can use non power of 2 textures only if:
  566. <ul><li>You load them explicitly with no mip maps</li>
  567. <li>You don't use DXT texture compression</li>
  568. <li>You use clamp texture addressing</li></ul>
  569. */
  570. bool getNonPOW2TexturesLimited(void) const
  571. {
  572. return mNonPOW2TexturesLimited;
  573. }
  574. /// Set the number of vertex texture units supported
  575. void setNumVertexTextureUnits(UINT16 n)
  576. {
  577. mNumVertexTextureUnits = n;
  578. }
  579. /// Get the number of vertex texture units supported
  580. UINT16 getNumVertexTextureUnits(void) const
  581. {
  582. return mNumVertexTextureUnits;
  583. }
  584. /// Set whether the vertex texture units are shared with the fragment processor
  585. void setVertexTextureUnitsShared(bool shared)
  586. {
  587. mVertexTextureUnitsShared = shared;
  588. }
  589. /// Get whether the vertex texture units are shared with the fragment processor
  590. bool getVertexTextureUnitsShared(void) const
  591. {
  592. return mVertexTextureUnitsShared;
  593. }
  594. /// Set the number of vertices a single geometry program run can emit
  595. void setGeometryProgramNumOutputVertices(int numOutputVertices)
  596. {
  597. mGeometryProgramNumOutputVertices = numOutputVertices;
  598. }
  599. /// Get the number of vertices a single geometry program run can emit
  600. int getGeometryProgramNumOutputVertices(void) const
  601. {
  602. return mGeometryProgramNumOutputVertices;
  603. }
  604. /// Get the identifier of the rendersystem from which these capabilities were generated
  605. String getRenderSystemName(void) const
  606. {
  607. return mRenderSystemName;
  608. }
  609. /// Set the identifier of the rendersystem from which these capabilities were generated
  610. void setRenderSystemName(const String& rs)
  611. {
  612. mRenderSystemName = rs;
  613. }
  614. /// Mark a category as 'relevant' or not, ie will it be reported
  615. void setCategoryRelevant(CapabilitiesCategory cat, bool relevant)
  616. {
  617. mCategoryRelevant[cat] = relevant;
  618. }
  619. /// Return whether a category is 'relevant' or not, ie will it be reported
  620. bool isCategoryRelevant(CapabilitiesCategory cat)
  621. {
  622. return mCategoryRelevant[cat];
  623. }
  624. };
  625. /** @} */
  626. /** @} */
  627. } // namespace
  628. #endif // __RenderSystemCapabilities__