2
0

gfxAPI.cpp 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. //-----------------------------------------------------------------------------
  2. // Copyright (c) 2012 GarageGames, LLC
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to
  6. // deal in the Software without restriction, including without limitation the
  7. // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  8. // sell copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  20. // IN THE SOFTWARE.
  21. //-----------------------------------------------------------------------------
  22. #include "gfx/gfxAPI.h"
  23. IMPLEMENT_SCOPE( GFXAPI, GFX,,
  24. "Graphics subystem." );
  25. IMPLEMENT_STRUCT( GFXVideoMode,
  26. GFXVideoMode, GFXAPI,
  27. "Descriptor for a specific video mode." )
  28. FIELD( resolution, resolution, 1, "Width and height of the mode's resolution in pixels." )
  29. FIELD( bitDepth, bitDepth, 1, "Bits per pixel." )
  30. FIELD( refreshRate, refreshRate, 1, "Frequency at which the screen is refreshed (in Hertz)." )
  31. FIELD( fullScreen, fullScreen, 1, "Whether this is a fullscreen or windowed mode." )
  32. FIELD( wideScreen, wideScreen, 1, "Whether this is a widescreen display mode." )
  33. FIELD( antialiasLevel, antialiasLevel, 1, "Maximum or desired antialiasing level." )
  34. END_IMPLEMENT_STRUCT;
  35. ImplementEnumType( GFXAdapterType,
  36. "Back-end graphics API used by the GFX subsystem.\n\n"
  37. "@ingroup GFX" )
  38. { OpenGL, "OpenGL", "OpenGL." },
  39. { Direct3D11, "D3D11", "Direct3D 11." },
  40. { NullDevice, "NullDevice", "Null device for dedicated servers." }
  41. EndImplementEnumType;
  42. ImplementEnumType( GFXBlend,
  43. "The supported blend modes.\n"
  44. "@ingroup GFX" )
  45. { GFXBlendZero, "GFXBlendZero", "(0, 0, 0, 0)" },
  46. { GFXBlendOne, "GFXBlendOne", "(1, 1, 1, 1)" },
  47. { GFXBlendSrcColor, "GFXBlendSrcColor", "(Rs, Gs, Bs, As)" },
  48. { GFXBlendInvSrcColor, "GFXBlendInvSrcColor", "(1 - Rs, 1 - Gs, 1 - Bs, 1 - As)" },
  49. { GFXBlendSrcAlpha, "GFXBlendSrcAlpha", "(As, As, As, As)" },
  50. { GFXBlendInvSrcAlpha, "GFXBlendInvSrcAlpha", "( 1 - As, 1 - As, 1 - As, 1 - As)" },
  51. { GFXBlendDestAlpha, "GFXBlendDestAlpha", "(Ad Ad Ad Ad)" },
  52. { GFXBlendInvDestAlpha, "GFXBlendInvDestAlpha", "(1 - Ad 1 - Ad 1 - Ad 1 - Ad)" },
  53. { GFXBlendDestColor, "GFXBlendDestColor", "(Rd, Gd, Bd, Ad)" },
  54. { GFXBlendInvDestColor, "GFXBlendInvDestColor", "(1 - Rd, 1 - Gd, 1 - Bd, 1 - Ad)" },
  55. { GFXBlendSrcAlphaSat, "GFXBlendSrcAlphaSat", "(f, f, f, 1) where f = min(As, 1 - Ad)" }
  56. EndImplementEnumType;
  57. ImplementEnumType( GFXCmpFunc,
  58. "The supported comparison functions.\n"
  59. "@ingroup GFX" )
  60. { GFXCmpNever, "GFXCmpNever" },
  61. { GFXCmpLess, "GFXCmpLess" },
  62. { GFXCmpEqual, "GFXCmpEqual" },
  63. { GFXCmpLessEqual, "GFXCmpLessEqual" },
  64. { GFXCmpGreater, "GFXCmpGreater" },
  65. { GFXCmpNotEqual, "GFXCmpNotEqual" },
  66. { GFXCmpGreaterEqual, "GFXCmpGreaterEqual" },
  67. { GFXCmpAlways, "GFXCmpAlways" },
  68. EndImplementEnumType;
  69. ImplementEnumType( GFXTextureAddressMode,
  70. "The texture address modes.\n"
  71. "@ingroup GFX" )
  72. { GFXAddressWrap, "GFXAddressWrap" },
  73. { GFXAddressMirror, "GFXAddressMirror" },
  74. { GFXAddressClamp, "GFXAddressClamp" },
  75. { GFXAddressBorder, "GFXAddressBorder" },
  76. { GFXAddressMirrorOnce, "GFXAddressMirrorOnce" }
  77. EndImplementEnumType;
  78. ImplementEnumType( GFXTextureFilterType,
  79. "The texture filter types.\n"
  80. "@ingroup GFX" )
  81. { GFXTextureFilterNone, "GFXTextureFilterNone" },
  82. { GFXTextureFilterPoint, "GFXTextureFilterPoint" },
  83. { GFXTextureFilterLinear, "GFXTextureFilterLinear" },
  84. { GFXTextureFilterAnisotropic, "GFXTextureFilterAnisotropic" },
  85. EndImplementEnumType;
  86. ImplementEnumType( GFXFormat,
  87. "The texture formats.\n"
  88. "@note Not all formats are supported on all platforms.\n"
  89. "@ingroup GFX" )
  90. { GFXFormatR8G8B8, "GFXFormatR8G8B8" },
  91. { GFXFormatR8G8B8A8, "GFXFormatR8G8B8A8" },
  92. { GFXFormatR8G8B8A8_SRGB, "GFXFormatR8G8B8A8_SRGB" },
  93. { GFXFormatR8G8B8X8, "GFXFormatR8G8B8X8" },
  94. { GFXFormatR32F, "GFXFormatR32F" },
  95. { GFXFormatR5G6B5, "GFXFormatR5G6B5" },
  96. { GFXFormatR5G5B5A1, "GFXFormatR5G5B5A1" },
  97. { GFXFormatR5G5B5X1, "GFXFormatR5G5B5X1" },
  98. { GFXFormatA4L4, "GFXFormatA4L4" },
  99. { GFXFormatA8L8, "GFXFormatA8L8" },
  100. { GFXFormatA8, "GFXFormatA8" },
  101. { GFXFormatL8, "GFXFormatL8" },
  102. { GFXFormatBC1, "GFXFormatBC1" },
  103. { GFXFormatBC2, "GFXFormatBC2" },
  104. { GFXFormatBC3, "GFXFormatBC3" },
  105. { GFXFormatBC4, "GFXFormatBC4" },
  106. { GFXFormatBC5, "GFXFormatBC5" },
  107. { GFXFormatD32, "GFXFormatD32" },
  108. { GFXFormatD24X8, "GFXFormatD24X8" },
  109. { GFXFormatD24S8, "GFXFormatD24S8" },
  110. { GFXFormatD24FS8, "GFXFormatD24FS8" },
  111. { GFXFormatD16, "GFXFormatD16" },
  112. { GFXFormatR32G32B32A32F, "GFXFormatR32G32B32A32F" },
  113. { GFXFormatR16G16B16A16F, "GFXFormatR16G16B16A16F" },
  114. { GFXFormatL16, "GFXFormatL16" },
  115. { GFXFormatR16G16B16A16, "GFXFormatR16G16B16A16" },
  116. { GFXFormatR16G16, "GFXFormatR16G16" },
  117. { GFXFormatR16F, "GFXFormatR16F" },
  118. { GFXFormatR16G16F, "GFXFormatR16G16F" },
  119. { GFXFormatR10G10B10A2, "GFXFormatR10G10B10A2" },
  120. EndImplementEnumType;
  121. ImplementEnumType( GFXCullMode,
  122. "The render cull modes.\n"
  123. "@ingroup GFX" )
  124. { GFXCullNone, "GFXCullNone" },
  125. { GFXCullCW, "GFXCullCW" },
  126. { GFXCullCCW, "GFXCullCCW" }
  127. EndImplementEnumType;
  128. ImplementEnumType( GFXStencilOp,
  129. "The stencil operators.\n"
  130. "@ingroup GFX" )
  131. { GFXStencilOpKeep, "GFXStencilOpKeep" },
  132. { GFXStencilOpZero, "GFXStencilOpZero" },
  133. { GFXStencilOpReplace, "GFXStencilOpReplace" },
  134. { GFXStencilOpIncrSat, "GFXStencilOpIncrSat" },
  135. { GFXStencilOpDecrSat, "GFXStencilOpDecrSat" },
  136. { GFXStencilOpInvert, "GFXStencilOpInvert" },
  137. { GFXStencilOpIncr, "GFXStencilOpIncr" },
  138. { GFXStencilOpDecr, "GFXStencilOpDecr" },
  139. EndImplementEnumType;
  140. ImplementEnumType( GFXBlendOp,
  141. "The blend operators.\n"
  142. "@ingroup GFX" )
  143. { GFXBlendOpAdd, "GFXBlendOpAdd" },
  144. { GFXBlendOpSubtract, "GFXBlendOpSubtract" },
  145. { GFXBlendOpRevSubtract, "GFXBlendOpRevSubtract" },
  146. { GFXBlendOpMin, "GFXBlendOpMin" },
  147. { GFXBlendOpMax, "GFXBlendOpMax" }
  148. EndImplementEnumType;