Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

532 lines
16 KiB

  1. //===== Copyright � 1996-2005, Valve Corporation, All rights reserved. ======//
  2. //
  3. // Purpose: API-independent render state declarations
  4. //
  5. // $NoKeywords: $
  6. //
  7. //===========================================================================//
  8. #ifndef RENDERSTATE_H
  9. #define RENDERSTATE_H
  10. #ifdef _WIN32
  11. #pragma once
  12. #endif
  13. #include "tier1/interface.h"
  14. #include "tier1/generichash.h"
  15. #include "basetypes.h"
  16. #include "mathlib/mathlib.h"
  17. //-----------------------------------------------------------------------------
  18. // Handle to render state objects
  19. //-----------------------------------------------------------------------------
  20. DECLARE_POINTER_HANDLE( RsRasterizerStateHandle_t );
  21. #define RENDER_RASTERIZER_STATE_HANDLE_INVALID ( (RsRasterizerStateHandle_t)0 )
  22. DECLARE_POINTER_HANDLE( RsDepthStencilStateHandle_t );
  23. #define RENDER_DEPTH_STENCIL_STATE_HANDLE_INVALID ( (RsDepthStencilStateHandle_t)0 )
  24. DECLARE_POINTER_HANDLE( RsBlendStateHandle_t );
  25. #define RENDER_BLEND_STATE_HANDLE_INVALID ( (RsBlendStateHandle_t)0 )
  26. //-----------------------------------------------------------------------------
  27. // Packs a float4 color to ARGB 8-bit int color compatible with D3D9
  28. //-----------------------------------------------------------------------------
  29. FORCEINLINE uint32 PackFloat4ColorToUInt32( float flR, float flG, float flB, float flA )
  30. {
  31. uint32 nR, nG, nB, nA;
  32. nR = uint32( flR * 255.0f );
  33. nG = uint32( flG * 255.0f );
  34. nB = uint32( flB * 255.0f );
  35. nA = uint32( flA * 255.0f );
  36. return ( ( nA & 0xFF ) << 24 ) | ( ( nR & 0xFF ) << 16 ) | ( ( nG & 0xFF ) << 8 ) | ( ( nB & 0xFF ) );
  37. }
  38. //-----------------------------------------------------------------------------
  39. // Packs a float4 color to ARGB 8-bit int color compatible with D3D9, clamping the floats to [0, 1]
  40. //-----------------------------------------------------------------------------
  41. FORCEINLINE uint32 ClampAndPackFloat4ColorToUInt32( float flR, float flG, float flB, float flA )
  42. {
  43. uint32 nR, nG, nB, nA;
  44. nR = uint32( clamp( flR, 0.0f, 1.0f ) * 255.0f );
  45. nG = uint32( clamp( flG, 0.0f, 1.0f ) * 255.0f );
  46. nB = uint32( clamp( flB, 0.0f, 1.0f ) * 255.0f );
  47. nA = uint32( clamp( flA, 0.0f, 1.0f ) * 255.0f );
  48. return ( ( nA & 0xFF ) << 24 ) | ( ( nR & 0xFF ) << 16 ) | ( ( nG & 0xFF ) << 8 ) | ( ( nB & 0xFF ) );
  49. }
  50. //-----------------------------------------------------------------------------
  51. // Unpacks an ARGB 8-bit int color to 4 floats
  52. //-----------------------------------------------------------------------------
  53. FORCEINLINE void UnpackUint32ColorToFloat4( uint32 nPackedColor, float* pflR, float* pflG, float* pflB, float* pflA )
  54. {
  55. uint32 nR, nG, nB, nA;
  56. nR = ( nPackedColor >> 16 ) & 0xFF;
  57. nG = ( nPackedColor >> 8 ) & 0xFF;
  58. nB = ( nPackedColor ) & 0xFF;
  59. nA = ( nPackedColor >> 24 ) & 0xFF;
  60. *pflR = nR * 255.0f;
  61. *pflG = nG * 255.0f;
  62. *pflB = nB * 255.0f;
  63. *pflA = nA * 255.0f;
  64. }
  65. enum RsCullMode_t
  66. {
  67. RS_CULL_NONE = 0,
  68. RS_CULL_BACK = 1,
  69. RS_CULL_FRONT = 2
  70. };
  71. enum RsFillMode_t
  72. {
  73. RS_FILL_SOLID = 0,
  74. RS_FILL_WIREFRAME = 1
  75. };
  76. enum RsComparison_t
  77. {
  78. RS_CMP_NEVER = 0,
  79. RS_CMP_LESS = 1,
  80. RS_CMP_EQUAL = 2,
  81. RS_CMP_LESS_EQUAL = 3,
  82. RS_CMP_GREATER = 4,
  83. RS_CMP_NOT_EQUAL = 5,
  84. RS_CMP_GREATER_EQUAL = 6,
  85. RS_CMP_ALWAYS = 7
  86. };
  87. enum RsStencilOp_t
  88. {
  89. RS_STENCIL_OP_KEEP = 0,
  90. RS_STENCIL_OP_ZERO = 1,
  91. RS_STENCIL_OP_REPLACE = 2,
  92. RS_STENCIL_OP_INCR_SAT = 3,
  93. RS_STENCIL_OP_DECR_SAT = 4,
  94. RS_STENCIL_OP_INVERT = 5,
  95. RS_STENCIL_OP_INCR = 6,
  96. RS_STENCIL_OP_DECR = 7
  97. };
  98. enum RsHiStencilComparison360_t
  99. {
  100. RS_HI_STENCIL_CMP_EQUAL = 0,
  101. RS_HI_STENCIL_CMP_NOT_EQUAL = 1
  102. };
  103. enum RsHiZMode360_t
  104. {
  105. RS_HI_Z_AUTOMATIC = 0,
  106. RS_HI_Z_DISABLE = 1,
  107. RS_HI_Z_ENABLE = 2
  108. };
  109. enum RsBlendOp_t
  110. {
  111. RS_BLEND_OP_ADD = 0,
  112. RS_BLEND_OP_SUBTRACT = 1,
  113. RS_BLEND_OP_REV_SUBTRACT = 2,
  114. RS_BLEND_OP_MIN = 3,
  115. RS_BLEND_OP_MAX = 4
  116. };
  117. enum RsBlendMode_t
  118. {
  119. RS_BLEND_MODE_ZERO = 0,
  120. RS_BLEND_MODE_ONE = 1,
  121. RS_BLEND_MODE_SRC_COLOR = 2,
  122. RS_BLEND_MODE_INV_SRC_COLOR = 3,
  123. RS_BLEND_MODE_SRC_ALPHA = 4,
  124. RS_BLEND_MODE_INV_SRC_ALPHA = 5,
  125. RS_BLEND_MODE_DEST_ALPHA = 6,
  126. RS_BLEND_MODE_INV_DEST_ALPHA = 7,
  127. RS_BLEND_MODE_DEST_COLOR = 8,
  128. RS_BLEND_MODE_INV_DEST_COLOR = 9,
  129. RS_BLEND_MODE_SRC_ALPHA_SAT = 10,
  130. RS_BLEND_MODE_BLEND_FACTOR = 11,
  131. RS_BLEND_MODE_INV_BLEND_FACTOR = 12
  132. };
  133. enum RsColorWriteEnableBits_t
  134. {
  135. RS_COLOR_WRITE_ENABLE_R = 0x1,
  136. RS_COLOR_WRITE_ENABLE_G = 0x2,
  137. RS_COLOR_WRITE_ENABLE_B = 0x4,
  138. RS_COLOR_WRITE_ENABLE_A = 0x8,
  139. RS_COLOR_WRITE_ENABLE_ALL = RS_COLOR_WRITE_ENABLE_R | RS_COLOR_WRITE_ENABLE_G | RS_COLOR_WRITE_ENABLE_B | RS_COLOR_WRITE_ENABLE_A
  140. };
  141. enum
  142. {
  143. RS_MAX_RENDER_TARGETS = 8
  144. };
  145. //-----------------------------------------------------------------------------
  146. struct RsRasterizerStateDesc_t
  147. {
  148. RsFillMode_t m_nFillMode;
  149. RsCullMode_t m_nCullMode;
  150. bool m_bDepthClipEnable;
  151. bool m_bMultisampleEnable;
  152. int32 m_nDepthBias; // TODO: make this a float?
  153. float32 m_flDepthBiasClamp;
  154. float32 m_flSlopeScaledDepthBias;
  155. /* Not exposing these DX11 states
  156. BOOL FrontCounterClockwise;
  157. BOOL ScissorEnable;
  158. BOOL AntialiasedLineEnable;
  159. This needs to be passed in explicitly when setting the blend state op:
  160. uint32 multisamplemask;
  161. */
  162. FORCEINLINE uint32 HashValue() const
  163. {
  164. // TODO: Optimize this
  165. return HashItem( *this );
  166. }
  167. FORCEINLINE bool operator==( RsRasterizerStateDesc_t const &state ) const
  168. {
  169. return memcmp( this, &state, sizeof( RsRasterizerStateDesc_t ) ) == 0;
  170. }
  171. };
  172. //-----------------------------------------------------------------------------
  173. struct RsDepthStencilStateDesc_t
  174. {
  175. bool m_bDepthTestEnable;
  176. bool m_bDepthWriteEnable;
  177. RsComparison_t m_depthFunc;
  178. RsHiZMode360_t m_hiZEnable360;
  179. RsHiZMode360_t m_hiZWriteEnable360;
  180. bool m_bStencilEnable;
  181. uint8 m_nStencilReadMask;
  182. uint8 m_nStencilWriteMask;
  183. RsStencilOp_t m_frontStencilFailOp;
  184. RsStencilOp_t m_frontStencilDepthFailOp;
  185. RsStencilOp_t m_frontStencilPassOp;
  186. RsComparison_t m_frontStencilFunc;
  187. RsStencilOp_t m_backStencilFailOp;
  188. RsStencilOp_t m_backStencilDepthFailOp;
  189. RsStencilOp_t m_backStencilPassOp;
  190. RsComparison_t m_backStencilFunc;
  191. bool m_bHiStencilEnable360;
  192. bool m_bHiStencilWriteEnable360;
  193. RsHiStencilComparison360_t m_hiStencilFunc360;
  194. uint8 m_nHiStencilRef360;
  195. // Stencil ref not part of this, it's set explicitly when binding DS state block
  196. // TODO: Figure out if I should pull the 360 HiStencil ref out too.
  197. FORCEINLINE uint32 HashValue() const
  198. {
  199. // TODO: Optimize this
  200. return HashItem( *this );
  201. }
  202. FORCEINLINE bool operator==( RsDepthStencilStateDesc_t const &state ) const
  203. {
  204. return memcmp( this, &state, sizeof( RsDepthStencilStateDesc_t ) ) == 0;
  205. }
  206. };
  207. //-----------------------------------------------------------------------------
  208. struct RsBlendStateDesc_t
  209. {
  210. bool m_bAlphaToCoverageEnable;
  211. bool m_bIndependentBlendEnable;
  212. bool m_bHighPrecisionBlendEnable360;
  213. bool m_bBlendEnable[RS_MAX_RENDER_TARGETS];
  214. RsBlendMode_t m_srcBlend[RS_MAX_RENDER_TARGETS];
  215. RsBlendMode_t m_destBlend[RS_MAX_RENDER_TARGETS];
  216. RsBlendOp_t m_blendOp[RS_MAX_RENDER_TARGETS];
  217. RsBlendMode_t m_srcBlendAlpha[RS_MAX_RENDER_TARGETS];
  218. RsBlendMode_t m_destBlendAlpha[RS_MAX_RENDER_TARGETS];
  219. RsBlendOp_t m_blendOpAlpha[RS_MAX_RENDER_TARGETS];
  220. uint8 m_nRenderTargetWriteMask[RS_MAX_RENDER_TARGETS];
  221. FORCEINLINE uint32 HashValue() const
  222. {
  223. // TODO: Optimize this
  224. return HashItem( *this );
  225. }
  226. FORCEINLINE bool operator==( RsBlendStateDesc_t const &state ) const
  227. {
  228. return memcmp( this, &state, sizeof( RsBlendStateDesc_t ) ) == 0;
  229. }
  230. };
  231. enum RsFilter_t
  232. {
  233. RS_FILTER_MIN_MAG_MIP_POINT = 0,
  234. RS_FILTER_MIN_MAG_POINT_MIP_LINEAR = 0x1,
  235. RS_FILTER_MIN_POINT_MAG_LINEAR_MIP_POINT = 0x4,
  236. RS_FILTER_MIN_POINT_MAG_MIP_LINEAR = 0x5,
  237. RS_FILTER_MIN_LINEAR_MAG_MIP_POINT = 0x10,
  238. RS_FILTER_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 0x11,
  239. RS_FILTER_MIN_MAG_LINEAR_MIP_POINT = 0x14,
  240. RS_FILTER_MIN_MAG_MIP_LINEAR = 0x15,
  241. RS_FILTER_ANISOTROPIC = 0x55,
  242. RS_FILTER_COMPARISON_MIN_MAG_MIP_POINT = 0x80,
  243. RS_FILTER_COMPARISON_MIN_MAG_POINT_MIP_LINEAR = 0x81,
  244. RS_FILTER_COMPARISON_MIN_POINT_MAG_LINEAR_MIP_POINT = 0x84,
  245. RS_FILTER_COMPARISON_MIN_POINT_MAG_MIP_LINEAR = 0x85,
  246. RS_FILTER_COMPARISON_MIN_LINEAR_MAG_MIP_POINT = 0x90,
  247. RS_FILTER_COMPARISON_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 0x91,
  248. RS_FILTER_COMPARISON_MIN_MAG_LINEAR_MIP_POINT = 0x94,
  249. RS_FILTER_COMPARISON_MIN_MAG_MIP_LINEAR = 0x95,
  250. RS_FILTER_COMPARISON_ANISOTROPIC = 0xd5
  251. };
  252. enum RsFilterType_t
  253. {
  254. RS_FILTER_TYPE_POINT = 0,
  255. RS_FILTER_TYPE_LINEAR = 1
  256. };
  257. FORCEINLINE RsFilter_t RsEncodeBasicTextureFilter( RsFilterType_t minFilter, RsFilterType_t magFilter, RsFilterType_t mipFilter, bool bComparison )
  258. {
  259. return static_cast< RsFilter_t >( ( bComparison ? 0x80 : 0 ) | ( ( minFilter & 0x3 ) << 4 ) | ( ( magFilter & 0x3 ) << 2 ) | ( mipFilter & 0x3 ) );
  260. }
  261. FORCEINLINE RsFilter_t RsEncodeAnisoTextureFilter( bool bComparison )
  262. {
  263. return RsEncodeBasicTextureFilter( RS_FILTER_TYPE_LINEAR, RS_FILTER_TYPE_LINEAR, RS_FILTER_TYPE_LINEAR, bComparison );
  264. }
  265. FORCEINLINE RsFilterType_t RsGetTextureMinFilterType( RsFilter_t filter )
  266. {
  267. return static_cast< RsFilterType_t >( 0x3 & ( filter >> 4 ) );
  268. }
  269. FORCEINLINE RsFilterType_t RsGetTextureMagFilterType( RsFilter_t filter )
  270. {
  271. return static_cast< RsFilterType_t >( 0x3 & ( filter >> 2 ) );
  272. }
  273. FORCEINLINE RsFilterType_t RsGetTextureMipFilterType( RsFilter_t filter )
  274. {
  275. return static_cast< RsFilterType_t >( 0x3 & filter );
  276. }
  277. FORCEINLINE bool RsIsComparisonTextureFilter( RsFilter_t filter )
  278. {
  279. return ( filter & 0x80 ) != 0;
  280. }
  281. FORCEINLINE bool RsIsAnisoTextureFilter( RsFilter_t filter )
  282. {
  283. return static_cast< RsFilter_t >( filter & ~0x80 ) == RS_FILTER_ANISOTROPIC;
  284. }
  285. enum RsTextureAddressMode_t
  286. {
  287. RS_TEXTURE_ADDRESS_WRAP = 0,
  288. RS_TEXTURE_ADDRESS_MIRROR = 1,
  289. RS_TEXTURE_ADDRESS_CLAMP = 2,
  290. RS_TEXTURE_ADDRESS_BORDER = 3,
  291. RS_TEXTURE_ADDRESS_MIRROR_ONCE = 4
  292. };
  293. //-----------------------------------------------------------------------------
  294. class CSamplerStateDesc
  295. {
  296. public:
  297. explicit CSamplerStateDesc( RsFilter_t filter = RS_FILTER_MIN_MAG_MIP_LINEAR,
  298. RsTextureAddressMode_t addressU = RS_TEXTURE_ADDRESS_WRAP,
  299. RsTextureAddressMode_t addressV = RS_TEXTURE_ADDRESS_WRAP,
  300. RsTextureAddressMode_t addressW = RS_TEXTURE_ADDRESS_WRAP,
  301. float32 flMipLodBias = 0.0f,
  302. uint32 nMaxAniso = 16,
  303. RsComparison_t comparisonFunc = RS_CMP_LESS,
  304. uint32 nMinLod = 0,
  305. uint32 nMaxLod = 16,
  306. bool bSrgbFetch = false,
  307. bool bFetch4 = false )
  308. {
  309. SetFilterMode( filter );
  310. SetTextureAddressModeU( addressU );
  311. SetTextureAddressModeV( addressU );
  312. SetTextureAddressModeW( addressU );
  313. SetMipLodBias( flMipLodBias );
  314. SetMaxAnisotropy( nMaxAniso );
  315. SetComparisonFunc( comparisonFunc );
  316. SetMinMaxLod( nMinLod, nMaxLod );
  317. SetSrgbFetchEnabled( bSrgbFetch );
  318. SetFetch4Enabled( bFetch4 );
  319. float32 flZeros[4] = { 0.0f, 0.0f, 0.0f, 0.0f };
  320. SetBorderColor( flZeros );
  321. m_nPad = 0;
  322. }
  323. FORCEINLINE RsFilter_t GetFilterMode() const { return static_cast< RsFilter_t >( m_nFilterMode ); }
  324. FORCEINLINE void SetFilterMode( RsFilter_t filter ) { m_nFilterMode = filter; }
  325. FORCEINLINE RsTextureAddressMode_t GetTextureAddressModeU() const { return static_cast< RsTextureAddressMode_t >( m_nAddressU ); }
  326. FORCEINLINE RsTextureAddressMode_t GetTextureAddressModeV() const { return static_cast< RsTextureAddressMode_t >( m_nAddressV ); }
  327. FORCEINLINE RsTextureAddressMode_t GetTextureAddressModeW() const { return static_cast< RsTextureAddressMode_t >( m_nAddressW ); }
  328. FORCEINLINE void SetTextureAddressModeU( RsTextureAddressMode_t addressMode ) { m_nAddressU = addressMode; }
  329. FORCEINLINE void SetTextureAddressModeV( RsTextureAddressMode_t addressMode ) { m_nAddressV = addressMode; }
  330. FORCEINLINE void SetTextureAddressModeW( RsTextureAddressMode_t addressMode ) { m_nAddressW = addressMode; }
  331. FORCEINLINE float32 GetMipLodBias() const
  332. {
  333. return float32( m_nMipLodBias ) / 16.0f * ( m_nMipLodBiasSign ? -1.0f : 1.0f );
  334. }
  335. FORCEINLINE void SetMipLodBias( float32 flBias )
  336. {
  337. m_nMipLodBias = int( fabsf( flBias ) * 16.0f );
  338. m_nMipLodBiasSign = ( flBias >= 0.0f ) ? 0 : 1;
  339. }
  340. FORCEINLINE uint32 GetMaxAnisotropy() const { return 1 << m_nAnisoExp; }
  341. FORCEINLINE void SetMaxAnisotropy( uint32 nMaxAniso )
  342. {
  343. uint32 nAnisoExp = uint32( FastLog2( MAX( nMaxAniso, 1 ) ) );
  344. m_nAnisoExp = MIN( nAnisoExp, 7 );
  345. }
  346. FORCEINLINE RsComparison_t GetComparisonFunc() const { return static_cast< RsComparison_t >( m_nComparisonFunc ); }
  347. FORCEINLINE void SetComparisonFunc( RsComparison_t compFunc ) { m_nComparisonFunc = compFunc; }
  348. FORCEINLINE void SetBorderColor( const float32 *pBorderColor )
  349. {
  350. m_nBorderColor8Bit = ClampAndPackFloat4ColorToUInt32( pBorderColor[0], pBorderColor[1], pBorderColor[2], pBorderColor[3] );
  351. }
  352. FORCEINLINE void GetBorderColor( float32 *pBorderColorOut ) const
  353. {
  354. UnpackUint32ColorToFloat4( m_nBorderColor8Bit, pBorderColorOut, pBorderColorOut + 1, pBorderColorOut + 2, pBorderColorOut + 3 );
  355. }
  356. FORCEINLINE uint32 GetBorderColor32Bit() const
  357. {
  358. return m_nBorderColor8Bit;
  359. }
  360. FORCEINLINE void GetMinMaxLod( uint32 *pMinLodOut, uint32 *pMaxLodOut ) const
  361. {
  362. *pMinLodOut = m_nMinLod;
  363. *pMaxLodOut = m_nMaxLod;
  364. }
  365. FORCEINLINE uint32 GetMinLod() const
  366. {
  367. return m_nMinLod;
  368. }
  369. FORCEINLINE uint32 GetMaxLod() const
  370. {
  371. return m_nMaxLod;
  372. }
  373. FORCEINLINE void SetMinMaxLod( uint32 nMinLod, uint32 nMaxLod )
  374. {
  375. m_nMinLod = MIN( 15, nMinLod );
  376. m_nMaxLod = MIN( 15, nMaxLod );
  377. }
  378. FORCEINLINE void SetMinLod( uint32 nMinLod )
  379. {
  380. m_nMinLod = MIN( 15, nMinLod );
  381. }
  382. FORCEINLINE void SetMaxLod( uint32 nMaxLod )
  383. {
  384. m_nMaxLod = MIN( 15, nMaxLod );
  385. }
  386. bool GetFetch4Enabled() const { return m_nFetch4Enable ? true : false; }
  387. void SetFetch4Enabled( bool bEnable ) { m_nFetch4Enable = bEnable; }
  388. bool GetSrgbFetchEnabled() const { return m_nSrgbFetchEnable ? true : false; }
  389. void SetSrgbFetchEnabled( bool bEnable ) { m_nSrgbFetchEnable = bEnable; }
  390. FORCEINLINE uint32 HashValue( void ) const
  391. {
  392. COMPILE_TIME_ASSERT( sizeof( CSamplerStateDesc ) == 12 );
  393. return Hash12( this );
  394. }
  395. FORCEINLINE bool operator==( CSamplerStateDesc const &state ) const
  396. {
  397. return memcmp( this, &state, sizeof( CSamplerStateDesc ) ) == 0;
  398. }
  399. private:
  400. // 32 bits
  401. uint32 m_nFilterMode : 8;
  402. uint32 m_nMipLodBias : 8; // 4.4 fixed point
  403. uint32 m_nMipLodBiasSign : 1;
  404. uint32 m_nAddressU : 3;
  405. uint32 m_nAddressV : 3;
  406. uint32 m_nAddressW : 3;
  407. uint32 m_nAnisoExp : 3;
  408. uint32 m_nComparisonFunc : 3;
  409. // 32 bits
  410. uint32 m_nBorderColor8Bit;
  411. // 32 bits (18 bits available for extension
  412. uint32 m_nMinLod : 6; // TODO: Either make them fixed-point, or kick them out of the state block alltogether
  413. uint32 m_nMaxLod : 6;
  414. uint32 m_nFetch4Enable : 1;
  415. uint32 m_nSrgbFetchEnable : 1;
  416. uint32 m_nPad : 18;
  417. };
  418. //-----------------------------------------------------------------------------
  419. // Enums for builtin state objects
  420. //-----------------------------------------------------------------------------
  421. enum RenderCullMode_t
  422. {
  423. RENDER_CULLMODE_CULL_BACKFACING = 0, // this culls polygons with clockwise winding
  424. RENDER_CULLMODE_CULL_FRONTFACING = 1, // this culls polygons with counterclockwise winding
  425. RENDER_CULLMODE_CULL_NONE = 2, // no culling
  426. };
  427. enum RenderZBufferMode_t
  428. {
  429. RENDER_ZBUFFER_NONE = 0,
  430. RENDER_ZBUFFER_ZTEST_AND_WRITE,
  431. RENDER_ZBUFFER_ZTEST_NO_WRITE,
  432. RENDER_ZBUFFER_ZTEST_GREATER_NO_WRITE,
  433. RENDER_ZBUFFER_ZTEST_EQUAL_NO_WRITE,
  434. // Stencil modes
  435. RENDER_ZBUFFER_NONE_STENCIL_TEST_NOTEQUAL,
  436. RENDER_ZBUFFER_ZTEST_AND_WRITE_STENCIL_SET1,
  437. RENDER_ZBUFFER_ZTEST_NO_WRITE_STENCIL_TEST_NOTEQUAL_SET0,
  438. RENDER_ZBUFFER_ZTEST_GREATER_NO_WRITE_STENCIL_TEST_NOTEQUAL_SET0,
  439. RENDER_ZBUFFER_NUM_BUILTIN_MODES
  440. };
  441. enum RenderBlendMode_t
  442. {
  443. RENDER_BLEND_NONE = 0,
  444. RENDER_BLEND_NOPIXELWRITE = 1,
  445. RENDER_BLEND_RGBAPIXELWRITE,
  446. RENDER_BLEND_ALPHABLENDING,
  447. RENDER_BLEND_ADDITIVE_ON_ALPHA,
  448. RENDER_NUM_BUILTIN_BLENDSTATES
  449. };
  450. #endif // RENDERSTATE_H