OgreRenderSystemCapabilities.h 24 KB

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