OgreRenderSystemCapabilities.h 24 KB

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