D3D9Graphics.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484
  1. //
  2. // Urho3D Engine
  3. // Copyright (c) 2008-2012 Lasse Öörni
  4. //
  5. // Permission is hereby granted, free of charge, to any person obtaining a copy
  6. // of this software and associated documentation files (the "Software"), to deal
  7. // in the Software without restriction, including without limitation the rights
  8. // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9. // copies of the Software, and to permit persons to whom the Software is
  10. // furnished to do so, subject to the following conditions:
  11. //
  12. // The above copyright notice and this permission notice shall be included in
  13. // all copies or substantial portions of the Software.
  14. //
  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. #pragma once
  24. #include "Color.h"
  25. #include "Object.h"
  26. #include "Rect.h"
  27. #include "GraphicsDefs.h"
  28. class Image;
  29. class IndexBuffer;
  30. class Matrix3;
  31. class Matrix4;
  32. class Matrix3x4;
  33. class GPUObject;
  34. class GraphicsImpl;
  35. class RenderSurface;
  36. class ShaderVariation;
  37. class Texture;
  38. class Texture2D;
  39. class TextureCube;
  40. class Vector3;
  41. class Vector4;
  42. class VertexBuffer;
  43. class VertexDeclaration;
  44. struct ShaderParameter;
  45. /// %Graphics subsystem. Manages the application window, rendering state and GPU resources.
  46. class Graphics : public Object
  47. {
  48. OBJECT(Graphics);
  49. public:
  50. /// Construct.
  51. Graphics(Context* context);
  52. /// Destruct. Close the window and release the Direct3D9 device .
  53. virtual ~Graphics();
  54. /// %Set window title.
  55. void SetWindowTitle(const String& windowTitle);
  56. /// %Set screen mode. Return true if successful.
  57. bool SetMode(int width, int height, bool fullscreen, bool vsync, bool tripleBuffer, int multiSample);
  58. /// %Set screen resolution only. Return true if successful.
  59. bool SetMode(int width, int height);
  60. /// Toggle between full screen and windowed mode. Return true if successful.
  61. bool ToggleFullscreen();
  62. /// Close the window.
  63. void Close();
  64. /// Take a screenshot. Return true if successful.
  65. bool TakeScreenShot(Image& destImage);
  66. /// Begin frame rendering. Return true if device available and can render.
  67. bool BeginFrame();
  68. /// End frame rendering and swap buffers.
  69. void EndFrame();
  70. /// Clear any or all of rendertarget, depth buffer and stencil buffer.
  71. void Clear(unsigned flags, const Color& color = Color(0.0f, 0.0f, 0.0f, 0.0f), float depth = 1.0f, unsigned stencil = 0);
  72. /// Resolve multisampled backbuffer to a texture rendertarget.
  73. bool ResolveToTexture(Texture2D* destination, const IntRect& viewport);
  74. /// Draw non-indexed geometry.
  75. void Draw(PrimitiveType type, unsigned vertexStart, unsigned vertexCount);
  76. /// Draw indexed geometry.
  77. void Draw(PrimitiveType type, unsigned indexStart, unsigned indexCount, unsigned minVertex, unsigned vertexCount);
  78. /// Draw indexed, instanced geometry. An instancing vertex buffer must be set.
  79. void DrawInstanced(PrimitiveType type, unsigned indexStart, unsigned indexCount, unsigned minVertex, unsigned vertexCount, unsigned instanceCount);
  80. /// %Set vertex buffer.
  81. void SetVertexBuffer(VertexBuffer* buffer);
  82. /// %Set multiple vertex buffers.
  83. bool SetVertexBuffers(const Vector<VertexBuffer*>& buffers, const PODVector<unsigned>& elementMasks, unsigned instanceOffset = 0);
  84. /// %Set multiple vertex buffers.
  85. bool SetVertexBuffers(const Vector<SharedPtr<VertexBuffer> >& buffers, const PODVector<unsigned>& elementMasks, unsigned instanceOffset = 0);
  86. /// %Set index buffer.
  87. void SetIndexBuffer(IndexBuffer* buffer);
  88. /// %Set shaders.
  89. void SetShaders(ShaderVariation* vs, ShaderVariation* ps);
  90. /// %Set shader float constants.
  91. void SetShaderParameter(StringHash param, const float* data, unsigned count);
  92. /// %Set shader float constant.
  93. void SetShaderParameter(StringHash param, float value);
  94. /// %Set shader color constant.
  95. void SetShaderParameter(StringHash param, const Color& color);
  96. /// %Set shader 3x3 matrix constant.
  97. void SetShaderParameter(StringHash param, const Matrix3& matrix);
  98. /// %Set shader 3D vector constant.
  99. void SetShaderParameter(StringHash param, const Vector3& vector);
  100. /// %Set shader 4x4 matrix constant.
  101. void SetShaderParameter(StringHash param, const Matrix4& matrix);
  102. /// %Set shader 4D vector constant.
  103. void SetShaderParameter(StringHash param, const Vector4& vector);
  104. /// %Set shader 3x4 matrix constant.
  105. void SetShaderParameter(StringHash param, const Matrix3x4& matrix);
  106. /// Register a shader parameter globally. Called by Shader.
  107. void RegisterShaderParameter(StringHash param, const ShaderParameter& definition);
  108. /// Check whether a shader parameter in the currently set shaders needs update.
  109. bool NeedParameterUpdate(StringHash param, const void* source);
  110. /// Check whether the current pixel shader uses a texture unit.
  111. bool NeedTextureUnit(TextureUnit unit);
  112. /// Clear remembered shader parameter source.
  113. void ClearParameterSource(StringHash param);
  114. /// Clear remembered shader parameter sources.
  115. void ClearParameterSources();
  116. /// Clear remembered transform shader parameter sources.
  117. void ClearTransformSources();
  118. /// %Set texture.
  119. void SetTexture(unsigned index, Texture* texture);
  120. /// %Set default texture filtering mode.
  121. void SetDefaultTextureFilterMode(TextureFilterMode mode);
  122. /// %Set texture anisotropy.
  123. void SetTextureAnisotropy(unsigned level);
  124. /// Reset all rendertargets, depth-stencil surface and viewport.
  125. void ResetRenderTargets();
  126. /// Reset specific rendertarget.
  127. void ResetRenderTarget(unsigned index);
  128. /// Reset depth-stencil surface.
  129. void ResetDepthStencil();
  130. /// %Set rendertarget.
  131. void SetRenderTarget(unsigned index, RenderSurface* renderTarget);
  132. /// %Set rendertarget.
  133. void SetRenderTarget(unsigned index, Texture2D* texture);
  134. /// %Set depth-stencil surface.
  135. void SetDepthStencil(RenderSurface* depthStencil);
  136. /// %Set depth-stencil surface.
  137. void SetDepthStencil(Texture2D* texture);
  138. /// %Set view texture (deferred rendering final output rendertarget) to prevent it from being sampled.
  139. void SetViewTexture(Texture* texture);
  140. /// %Set viewport.
  141. void SetViewport(const IntRect& rect);
  142. /// %Set alpha test.
  143. void SetAlphaTest(bool enable, CompareMode mode = CMP_ALWAYS, float alphaRef = 0.5f);
  144. /// %Set blending mode.
  145. void SetBlendMode(BlendMode mode);
  146. /// %Set color write on/off.
  147. void SetColorWrite(bool enable);
  148. /// %Set hardware culling mode.
  149. void SetCullMode(CullMode mode);
  150. /// %Set depth bias.
  151. void SetDepthBias(float constantBias, float slopeScaledBias);
  152. /// %Set depth compare.
  153. void SetDepthTest(CompareMode mode);
  154. /// %Set depth write on/off.
  155. void SetDepthWrite(bool enable);
  156. /// %Set polygon fill mode.
  157. void SetFillMode(FillMode mode);
  158. /// %Set scissor test.
  159. void SetScissorTest(bool enable, const Rect& rect = Rect::FULL, bool borderInclusive = true);
  160. /// %Set scissor test.
  161. void SetScissorTest(bool enable, const IntRect& rect);
  162. /// %Set stencil test.
  163. void SetStencilTest(bool enable, CompareMode mode = CMP_ALWAYS, StencilOp pass = OP_KEEP, StencilOp fail = OP_KEEP, StencilOp zFail = OP_KEEP, unsigned stencilRef = 0, unsigned compareMask = M_MAX_UNSIGNED, unsigned writeMask = M_MAX_UNSIGNED);
  164. /// %Set vertex buffer stream frequency.
  165. void SetStreamFrequency(unsigned index, unsigned frequency);
  166. /// Reset stream frequencies.
  167. void ResetStreamFrequencies();
  168. /// %Set force Shader Model 2 flag.
  169. void SetForceSM2(bool enable);
  170. /// Return whether rendering initialized.
  171. bool IsInitialized() const;
  172. /// Return graphics implementation, which holds the actual API-specific resources.
  173. GraphicsImpl* GetImpl() const { return impl_; }
  174. /// Return window title.
  175. const String& GetWindowTitle() const { return windowTitle_; }
  176. /// Return window width.
  177. int GetWidth() const { return width_; }
  178. /// Return window height.
  179. int GetHeight() const { return height_; }
  180. /// Return multisample mode (1 = no multisampling.)
  181. int GetMultiSample() const { return multiSample_; }
  182. /// Return whether window is fullscreen.
  183. bool GetFullscreen() const { return fullscreen_; }
  184. /// Return whether vertical sync is on.
  185. bool GetVSync() const { return vsync_; }
  186. /// Return whether triple buffering is enabled.
  187. bool GetTripleBuffer() const { return tripleBuffer_; }
  188. /// Return whether Direct3D device is lost, and can not yet render. This happens during fullscreen resolution switching.
  189. bool IsDeviceLost() const { return deviceLost_; }
  190. /// Return window handle.
  191. unsigned GetWindowHandle() const;
  192. /// Return number of primitives drawn this frame.
  193. unsigned GetNumPrimitives() const { return numPrimitives_; }
  194. /// Return number of batches drawn this frame.
  195. unsigned GetNumBatches() const { return numBatches_; }
  196. /// Return dummy color texture format for shadow maps. Is "NULL" (consume no video memory) if supported.
  197. unsigned GetDummyColorFormat() const { return dummyColorFormat_; }
  198. /// Return shadow map depth texture format, or 0 if not supported.
  199. unsigned GetShadowMapFormat() const { return shadowMapFormat_; }
  200. /// Return 24-bit shadow map depth texture format, or 0 if not supported.
  201. unsigned GetHiresShadowMapFormat() const { return hiresShadowMapFormat_; }
  202. /// Return whether Shader Model 3 is supported.
  203. bool GetSM3Support() const { return hasSM3_; }
  204. /// Return whether light pre-pass rendering is supported.
  205. bool GetLightPrepassSupport() const { return lightPrepassSupport_; }
  206. /// Return whether deferred rendering is supported.
  207. bool GetDeferredSupport() const { return deferredSupport_; }
  208. /// Return whether hardware depth can be read as a texture.
  209. bool GetHardwareDepthSupport() const { return hardwareDepthSupport_; }
  210. /// Return whether shadow map depth compare is done in hardware.
  211. bool GetHardwareShadowSupport() const { return hardwareShadowSupport_; }
  212. /// Return whether 24-bit shadow maps are supported.
  213. bool GetHiresShadowSupport() const { return hiresShadowSupport_; }
  214. /// Return whether stream offset is supported.
  215. bool GetStreamOffsetSupport() const { return streamOffsetSupport_; }
  216. /// Return whether DXT texture compression is supported. Always true on Direct3D9.
  217. bool GetCompressedTextureSupport() const { return true; }
  218. /// Return supported fullscreen resolutions.
  219. PODVector<IntVector2> GetResolutions() const;
  220. /// Return supported multisampling levels.
  221. PODVector<int> GetMultiSampleLevels() const;
  222. /// Return vertex buffer by index.
  223. VertexBuffer* GetVertexBuffer(unsigned index) const;
  224. /// Return current index buffer.
  225. IndexBuffer* GetIndexBuffer() const { return indexBuffer_; }
  226. /// Return current vertex declaration.
  227. VertexDeclaration* GetVertexDeclaration() const { return vertexDeclaration_; }
  228. /// Return current vertex shader.
  229. ShaderVariation* GetVertexShader() const { return vertexShader_; }
  230. /// Return current pixel shader.
  231. ShaderVariation* GetPixelShader() const { return pixelShader_; }
  232. /// Return texture unit index by name.
  233. TextureUnit GetTextureUnit(const String& name);
  234. /// Return current texture by texture unit index.
  235. Texture* GetTexture(unsigned index) const;
  236. /// Return default texture filtering mode.
  237. TextureFilterMode GetDefaultTextureFilterMode() const { return defaultTextureFilterMode_; }
  238. /// Return current rendertarget by index.
  239. RenderSurface* GetRenderTarget(unsigned index) const;
  240. /// Return current depth-stencil surface.
  241. RenderSurface* GetDepthStencil() const { return depthStencil_; }
  242. /// Return backbuffer depth-stencil texture, created if available.
  243. Texture2D* GetDepthTexture() const;
  244. /// Return the viewport coordinates.
  245. IntRect GetViewport() const { return viewport_; }
  246. /// Return whether alpha testing is enabled.
  247. bool GetAlphaTest() const { return alphaTest_; }
  248. /// Return alpha test compare mode.
  249. CompareMode GetAlphaTestMode() const { return alphaTestMode_; }
  250. /// Return texture anisotropy.
  251. unsigned GetTextureAnisotropy() const { return textureAnisotropy_; }
  252. /// Return alpha test reference value.
  253. float GetAlphaRef() const { return alphaRef_; }
  254. /// Return blending mode.
  255. BlendMode GetBlendMode() const { return blendMode_; }
  256. /// Return whether color write is enabled.
  257. bool GetColorWrite() const { return colorWrite_; }
  258. /// Return hardware culling mode.
  259. CullMode GetCullMode() const { return cullMode_; }
  260. /// Return depth constant bias.
  261. float GetDepthConstantBias() const { return constantDepthBias_; }
  262. /// Return depth slope scaled bias.
  263. float GetDepthSlopeScaledBias() const { return slopeScaledDepthBias_; }
  264. /// Return depth compare mode.
  265. CompareMode GetDepthTest() const { return depthTestMode_; }
  266. /// Return whether depth write is enabled.
  267. bool GetDepthWrite() const { return depthWrite_; }
  268. /// Return polygon fill mode.
  269. FillMode GetFillMode() const { return fillMode_; }
  270. /// Return whether stencil test is enabled.
  271. bool GetStencilTest() const { return stencilTest_; }
  272. /// Return whether scissor test is enabled.
  273. bool GetScissorTest() const { return scissorTest_; }
  274. /// Return scissor rectangle coordinates.
  275. const IntRect& GetScissorRect() const { return scissorRect_; }
  276. /// Return stencil compare mode.
  277. CompareMode GetStencilTestMode() const { return stencilTestMode_; }
  278. /// Return stencil operation to do if stencil test passes.
  279. StencilOp GetStencilPass() const { return stencilPass_; }
  280. /// Return stencil operation to do if stencil test fails.
  281. StencilOp GetStencilFail() const { return stencilFail_; }
  282. /// Return stencil operation to do if depth compare fails.
  283. StencilOp GetStencilZFail() const { return stencilZFail_; }
  284. /// Return stencil reference value.
  285. unsigned GetStencilRef() const { return stencilRef_; }
  286. /// Return stencil compare bitmask.
  287. unsigned GetStencilCompareMask() const { return stencilCompareMask_; }
  288. /// Return stencil write bitmask.
  289. unsigned GetStencilWriteMask() const { return stencilWriteMask_; }
  290. /// Return stream frequency by vertex buffer index.
  291. unsigned GetStreamFrequency(unsigned index) const;
  292. /// Return rendertarget width and height.
  293. IntVector2 GetRenderTargetDimensions() const;
  294. /// Return force Shader Model 2 flag.
  295. bool GetForceSM2() const { return forceSM2_; }
  296. /// Add a GPU object to keep track of. Called by GPUObject.
  297. void AddGPUObject(GPUObject* object);
  298. /// Remove a GPU object. Called by GPUObject.
  299. void RemoveGPUObject(GPUObject* object);
  300. /// Return the API-specific alpha texture format.
  301. static unsigned GetAlphaFormat();
  302. /// Return the API-specific luminance texture format.
  303. static unsigned GetLuminanceFormat();
  304. /// Return the API-specific luminance alpha texture format.
  305. static unsigned GetLuminanceAlphaFormat();
  306. /// Return the API-specific RGB texture format.
  307. static unsigned GetRGBFormat();
  308. /// Return the API-specific RGBA texture format.
  309. static unsigned GetRGBAFormat();
  310. /// Return the API-specific single channel float texture format.
  311. static unsigned GetFloatFormat();
  312. /// Return the API-specific linear depth texture format.
  313. static unsigned GetLinearDepthFormat();
  314. /// Return the API-specific hardware depth-stencil texture format.
  315. static unsigned GetDepthStencilFormat();
  316. private:
  317. /// Create the application window.
  318. bool OpenWindow(int width, int height);
  319. /// Adjust the window for new resolution and fullscreen mode.
  320. void AdjustWindow(int newWidth, int newHeight, bool newFullscreen);
  321. /// Create the Direct3D interface.
  322. bool CreateInterface();
  323. /// Create the Direct3D device.
  324. bool CreateDevice(unsigned adapter, unsigned deviceType);
  325. /// Check supported rendering features.
  326. void CheckFeatureSupport();
  327. /// Reset the Direct3D device.
  328. void ResetDevice();
  329. /// Notify all GPU resources so they can release themselves as needed.
  330. void OnDeviceLost();
  331. /// Notify all GPU resources so they can recreate themselves as needed.
  332. void OnDeviceReset();
  333. /// Reset cached rendering state.
  334. void ResetCachedState();
  335. /// Initialize texture unit mappings.
  336. void SetTextureUnitMappings();
  337. /// Handle operating system window message.
  338. void HandleWindowMessage(StringHash eventType, VariantMap& eventData);
  339. /// Implementation.
  340. GraphicsImpl* impl_;
  341. /// Window title.
  342. String windowTitle_;
  343. /// Window width.
  344. int width_;
  345. /// Window height.
  346. int height_;
  347. /// Multisampling mode.
  348. int multiSample_;
  349. /// Stored window X-position.
  350. int windowPosX_;
  351. /// Stored window Y-position.
  352. int windowPosY_;
  353. /// Fullscreen flag.
  354. bool fullscreen_;
  355. /// Vertical sync flag.
  356. bool vsync_;
  357. /// Triple buffering flag.
  358. bool tripleBuffer_;
  359. /// Direct3D device lost flag.
  360. bool deviceLost_;
  361. /// System depth-stencil flag.
  362. bool systemDepthStencil_;
  363. /// Light pre-pass rendering support flag.
  364. bool lightPrepassSupport_;
  365. /// Deferred rendering support flag.
  366. bool deferredSupport_;
  367. /// Hardware depth texture support flag.
  368. bool hardwareDepthSupport_;
  369. /// Hardware shadow map depth compare support flag.
  370. bool hardwareShadowSupport_;
  371. /// 24-bit shadow map support flag.
  372. bool hiresShadowSupport_;
  373. /// Stream offset support flag.
  374. bool streamOffsetSupport_;
  375. /// Shader Model 3 flag.
  376. bool hasSM3_;
  377. /// Force Shader Model 2 flag.
  378. bool forceSM2_;
  379. /// Number of primitives this frame.
  380. unsigned numPrimitives_;
  381. /// Number of batches this frame.
  382. unsigned numBatches_;
  383. /// GPU objects.
  384. Vector<GPUObject*> gpuObjects_;
  385. /// Vertex declarations.
  386. HashMap<unsigned long long, SharedPtr<VertexDeclaration> > vertexDeclarations_;
  387. /// Shadow map dummy color texture format.
  388. unsigned dummyColorFormat_;
  389. /// Shadow map depth texture format.
  390. unsigned shadowMapFormat_;
  391. /// Shadow map 24-bit depth texture format.
  392. unsigned hiresShadowMapFormat_;
  393. /// Vertex buffers in use.
  394. VertexBuffer* vertexBuffers_[MAX_VERTEX_STREAMS];
  395. /// Stream frequencies by vertex buffer.
  396. unsigned streamFrequencies_[MAX_VERTEX_STREAMS];
  397. /// Stream offsets by vertex buffer.
  398. unsigned streamOffsets_[MAX_VERTEX_STREAMS];
  399. /// Index buffer in use.
  400. IndexBuffer* indexBuffer_;
  401. /// Vertex declaration in use.
  402. VertexDeclaration* vertexDeclaration_;
  403. /// Vertex shader in use.
  404. ShaderVariation* vertexShader_;
  405. /// Pixel shader in use.
  406. ShaderVariation* pixelShader_;
  407. /// All known shader parameters.
  408. HashMap<StringHash, ShaderParameter> shaderParameters_;
  409. /// Textures in use.
  410. Texture* textures_[MAX_TEXTURE_UNITS];
  411. /// Texture unit mappings.
  412. HashMap<String, TextureUnit> textureUnits_;
  413. /// Rendertargets in use.
  414. RenderSurface* renderTargets_[MAX_RENDERTARGETS];
  415. /// Depth-stencil surface in use.
  416. RenderSurface* depthStencil_;
  417. /// Backbuffer depth-stencil texture.
  418. SharedPtr<Texture2D> depthTexture_;
  419. /// View texture.
  420. Texture* viewTexture_;
  421. /// Viewport coordinates.
  422. IntRect viewport_;
  423. /// Alpha test enable flag.
  424. bool alphaTest_;
  425. /// Alpha test compare mode.
  426. CompareMode alphaTestMode_;
  427. /// Alpha test reference value.
  428. float alphaRef_;
  429. /// Texture anisotropy level.
  430. unsigned textureAnisotropy_;
  431. /// Blending mode.
  432. BlendMode blendMode_;
  433. /// Color write enable.
  434. bool colorWrite_;
  435. /// Hardware culling mode.
  436. CullMode cullMode_;
  437. /// Depth constant bias.
  438. float constantDepthBias_;
  439. /// Depth slope scaled bias.
  440. float slopeScaledDepthBias_;
  441. /// Depth compare mode.
  442. CompareMode depthTestMode_;
  443. /// Depth write enable flag.
  444. bool depthWrite_;
  445. /// Polygon fill mode.
  446. FillMode fillMode_;
  447. /// Scissor test rectangle.
  448. IntRect scissorRect_;
  449. /// Scissor test enable flag.
  450. bool scissorTest_;
  451. /// Stencil test compare mode.
  452. CompareMode stencilTestMode_;
  453. /// Stencil operation on pass.
  454. StencilOp stencilPass_;
  455. /// Stencil operation on fail.
  456. StencilOp stencilFail_;
  457. /// Stencil operation on depth fail.
  458. StencilOp stencilZFail_;
  459. /// Stencil test enable flag.
  460. bool stencilTest_;
  461. /// Stencil test reference value.
  462. unsigned stencilRef_;
  463. /// Stencil compare bitmask.
  464. unsigned stencilCompareMask_;
  465. /// Stencil write bitmask.
  466. unsigned stencilWriteMask_;
  467. /// Default texture filtering mode.
  468. TextureFilterMode defaultTextureFilterMode_;
  469. };
  470. /// Register Graphics library objects.
  471. void RegisterGraphicsLibrary(Context* context);