D3D9Graphics.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492
  1. //
  2. // Urho3D Engine
  3. // Copyright (c) 2008-2011 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 "HashMap.h"
  26. #include "Object.h"
  27. #include "Rect.h"
  28. #include "GraphicsDefs.h"
  29. class Image;
  30. class IndexBuffer;
  31. class Matrix3;
  32. class Matrix4;
  33. class Matrix3x4;
  34. class GPUObject;
  35. class GraphicsImpl;
  36. class RenderSurface;
  37. class ShaderVariation;
  38. class Texture;
  39. class Texture2D;
  40. class TextureCube;
  41. class Vector3;
  42. class Vector4;
  43. class VertexBuffer;
  44. class VertexDeclaration;
  45. struct ShaderParameter;
  46. static const unsigned NUM_QUERIES = 2;
  47. /// %Graphics subsystem. Manages the application window, rendering state and GPU resources.
  48. class Graphics : public Object
  49. {
  50. OBJECT(Graphics);
  51. public:
  52. /// Construct.
  53. Graphics(Context* context);
  54. /// Destruct. Close the window and release the Direct3D9 device .
  55. virtual ~Graphics();
  56. /// %Set window title.
  57. void SetWindowTitle(const String& windowTitle);
  58. /// %Set screen mode.
  59. bool SetMode(int width, int height, bool fullscreen, bool vsync, bool tripleBuffer, int multiSample);
  60. /// %Set screen resolution only.
  61. bool SetMode(int width, int height);
  62. /// Toggle between full screen and windowed mode.
  63. bool ToggleFullscreen();
  64. /// Close the window.
  65. void Close();
  66. /// Take a screenshot.
  67. bool TakeScreenShot(Image& destImage);
  68. /// %Set whether to flush GPU command queue at the end of each frame. Default true.
  69. void SetFlushGPU(bool enable);
  70. /// Begin frame rendering.
  71. bool BeginFrame();
  72. /// End frame rendering and swap buffers.
  73. void EndFrame();
  74. /// Clear any or all of render target, depth buffer and stencil buffer.
  75. void Clear(unsigned flags, const Color& color = Color(0.0f, 0.0f, 0.0f, 0.0f), float depth = 1.0f, unsigned stencil = 0);
  76. /// Draw non-indexed geometry.
  77. void Draw(PrimitiveType type, unsigned vertexStart, unsigned vertexCount);
  78. /// Draw indexed geometry.
  79. void Draw(PrimitiveType type, unsigned indexStart, unsigned indexCount, unsigned minVertex, unsigned vertexCount);
  80. /// Draw indexed, instanced geometry. An instancing vertex buffer must be set.
  81. void DrawInstanced(PrimitiveType type, unsigned indexStart, unsigned indexCount, unsigned minVertex, unsigned vertexCount, unsigned instanceCount);
  82. /// %Set vertex buffer.
  83. void SetVertexBuffer(VertexBuffer* buffer);
  84. /// %Set multiple vertex buffers.
  85. bool SetVertexBuffers(const Vector<VertexBuffer*>& buffers, const PODVector<unsigned>& elementMasks, unsigned instanceOffset = 0);
  86. /// %Set multiple vertex buffers.
  87. bool SetVertexBuffers(const Vector<SharedPtr<VertexBuffer> >& buffers, const PODVector<unsigned>& elementMasks, unsigned instanceOffset = 0);
  88. /// %Set index buffer.
  89. void SetIndexBuffer(IndexBuffer* buffer);
  90. /// %Set shaders.
  91. void SetShaders(ShaderVariation* vs, ShaderVariation* ps);
  92. /// %Set shader float constants.
  93. void SetShaderParameter(StringHash param, const float* data, unsigned count);
  94. /// %Set shader float constant.
  95. void SetShaderParameter(StringHash param, float value);
  96. /// %Set shader color constant.
  97. void SetShaderParameter(StringHash param, const Color& color);
  98. /// %Set shader 3x3 matrix constant.
  99. void SetShaderParameter(StringHash param, const Matrix3& matrix);
  100. /// %Set shader 3D vector constant.
  101. void SetShaderParameter(StringHash param, const Vector3& vector);
  102. /// %Set shader 4x4 matrix constant.
  103. void SetShaderParameter(StringHash param, const Matrix4& matrix);
  104. /// %Set shader 4D vector constant.
  105. void SetShaderParameter(StringHash param, const Vector4& vector);
  106. /// %Set shader 3x4 matrix constant.
  107. void SetShaderParameter(StringHash param, const Matrix3x4& matrix);
  108. /// Register a shader parameter globally. Called by Shader.
  109. void RegisterShaderParameter(StringHash param, const ShaderParameter& definition);
  110. /// Check whether a shader parameter in the currently set shaders needs update.
  111. bool NeedParameterUpdate(StringHash param, const void* source);
  112. /// Check whether the current pixel shader uses a texture unit.
  113. bool NeedTextureUnit(TextureUnit unit);
  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 render targets and depth stencil buffer (render to back buffer.)
  125. void ResetRenderTargets();
  126. /// Reset specific render target.
  127. void ResetRenderTarget(unsigned index);
  128. /// Reset depth stencil buffer.
  129. void ResetDepthStencil();
  130. /// %Set render target.
  131. void SetRenderTarget(unsigned index, RenderSurface* renderTarget);
  132. /// %Set render target.
  133. void SetRenderTarget(unsigned index, Texture2D* renderTexture);
  134. /// %Set depth stencil buffer.
  135. void SetDepthStencil(RenderSurface* depthStencil);
  136. /// %Set depth stencil buffer.
  137. void SetDepthStencil(Texture2D* depthTexture);
  138. /// %Set viewport.
  139. void SetViewport(const IntRect& rect);
  140. /// %Set alpha test.
  141. void SetAlphaTest(bool enable, CompareMode mode = CMP_ALWAYS, float alphaRef = 0.5f);
  142. /// %Set blending mode.
  143. void SetBlendMode(BlendMode mode);
  144. /// %Set color write on/off.
  145. void SetColorWrite(bool enable);
  146. /// %Set hardware culling mode.
  147. void SetCullMode(CullMode mode);
  148. /// %Set depth bias.
  149. void SetDepthBias(float constantBias, float slopeScaledBias);
  150. /// %Set depth compare.
  151. void SetDepthTest(CompareMode mode);
  152. /// %Set depth write on/off.
  153. void SetDepthWrite(bool enable);
  154. /// %Set polygon fill mode.
  155. void SetFillMode(FillMode mode);
  156. /// %Set scissor test.
  157. void SetScissorTest(bool enable, const Rect& rect = Rect::FULL, bool borderInclusive = true);
  158. /// %Set scissor test.
  159. void SetScissorTest(bool enable, const IntRect& rect);
  160. /// %Set stencil test.
  161. void SetStencilTest(bool enable, CompareMode mode = CMP_ALWAYS, StencilOp pass = OP_KEEP, StencilOp fail = OP_KEEP, StencilOp zFail = OP_KEEP, unsigned stencilRef = 0, unsigned stencilMask = M_MAX_UNSIGNED);
  162. /// %Set vertex buffer stream frequency.
  163. void SetStreamFrequency(unsigned index, unsigned frequency);
  164. /// Reset stream frequencies.
  165. void ResetStreamFrequencies();
  166. /// %Set force Shader Model 2 flag.
  167. void SetForceSM2(bool enable);
  168. /// %Set force fallback shaders flag.
  169. void SetForceFallback(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 GPU command queue is flushed at the end of each frame.
  189. bool GetFlushGPU() const { return flushGPU_; }
  190. /// Return whether Direct3D device is lost, and can not yet render. This happens during fullscreen resolution switching.
  191. bool IsDeviceLost() const { return deviceLost_; }
  192. /// Return window handle.
  193. unsigned GetWindowHandle() const;
  194. /// Return number of primitives drawn this frame.
  195. unsigned GetNumPrimitives() const { return numPrimitives_; }
  196. /// Return number of batches drawn this frame.
  197. unsigned GetNumBatches() const { return numBatches_; }
  198. /// Return dummy color texture format for shadow maps. Is "NULL" (consume no video memory) if supported.
  199. unsigned GetDummyColorFormat() const { return dummyColorFormat_; }
  200. /// Return shadow map depth texture format, or 0 if not supported.
  201. unsigned GetShadowMapFormat() const { return shadowMapFormat_; }
  202. /// Return 24-bit shadow map depth texture format, or 0 if not supported.
  203. unsigned GetHiresShadowMapFormat() const { return hiresShadowMapFormat_; }
  204. /// Return whether texture render targets are supported. Always true on Direct3D9
  205. bool GetRenderTargetSupport() const { return true; }
  206. /// Return whether fallback shaders are required.
  207. bool GetFallback() const { return fallback_; }
  208. /// Return whether Shader Model 3 is supported.
  209. bool GetSM3Support() const { return hasSM3_; }
  210. /// Return whether hardware depth can be read as a texture.
  211. bool GetHardwareDepthSupport() const { return hardwareDepthSupport_; }
  212. /// Return whether shadow map depth compare is done in hardware.
  213. bool GetHardwareShadowSupport() const { return hardwareShadowSupport_; }
  214. /// Return whether 24-bit shadow maps are supported.
  215. bool GetHiresShadowSupport() const { return hiresShadowSupport_; }
  216. /// Return whether stream offset is supported.
  217. bool GetStreamOffsetSupport() const { return streamOffsetSupport_; }
  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 render target by index.
  239. RenderSurface* GetRenderTarget(unsigned index) const;
  240. /// Return current depth stencil buffer.
  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 GetStencilMask() const { return stencilMask_; }
  288. /// Return stream frequency by vertex buffer index.
  289. unsigned GetStreamFrequency(unsigned index) const;
  290. /// Return render target width and height.
  291. IntVector2 GetRenderTargetDimensions() const;
  292. /// Return force Shader Model 2 flag.
  293. bool GetForceSM2() const { return forceSM2_; }
  294. /// Return force fallback mode flag.
  295. bool GetForceFallback() const { return forceFallback_; }
  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 depth texture format.
  311. static unsigned GetDepthFormat();
  312. /// Return the API-specific depth stencil texture format.
  313. static unsigned GetDepthStencilFormat();
  314. private:
  315. /// Create the application window.
  316. bool OpenWindow(int width, int height);
  317. /// Adjust the window for new resolution and fullscreen mode.
  318. void AdjustWindow(int newWidth, int newHeight, bool newFullscreen);
  319. /// Create the Direct3D interface.
  320. bool CreateInterface();
  321. /// Create the Direct3D device.
  322. bool CreateDevice(unsigned adapter, unsigned deviceType);
  323. /// Check supported graphics features.
  324. void CheckFeatureSupport();
  325. /// Reset the Direct3D device.
  326. void ResetDevice();
  327. /// Notify all GPU resources so they can release themselves as needed.
  328. void OnDeviceLost();
  329. /// Notify all GPU resources so they can recreate themselves as needed.
  330. void OnDeviceReset();
  331. /// Reset cached rendering state.
  332. void ResetCachedState();
  333. /// Initialize texture unit mappings.
  334. void SetTextureUnitMappings();
  335. /// Handle operating system window message.
  336. void HandleWindowMessage(StringHash eventType, VariantMap& eventData);
  337. /// Implementation.
  338. GraphicsImpl* impl_;
  339. /// Window title.
  340. String windowTitle_;
  341. /// Window width.
  342. int width_;
  343. /// Window height.
  344. int height_;
  345. /// Multisampling mode.
  346. int multiSample_;
  347. /// Stored window X-position.
  348. int windowPosX_;
  349. /// Stored window Y-position.
  350. int windowPosY_;
  351. /// Fullscreen flag.
  352. bool fullscreen_;
  353. /// Vertical sync flag.
  354. bool vsync_;
  355. /// Triple buffering flag.
  356. bool tripleBuffer_;
  357. /// Flush GPU command queue flag.
  358. bool flushGPU_;
  359. /// Direct3D device lost flag.
  360. bool deviceLost_;
  361. /// System depth stencil flag.
  362. bool systemDepthStencil_;
  363. /// Hardware depth texture support flag.
  364. bool hardwareDepthSupport_;
  365. /// Hardware shadow map depth compare support flag.
  366. bool hardwareShadowSupport_;
  367. /// 24-bit shadow map support flag.
  368. bool hiresShadowSupport_;
  369. /// Stream offset support flag.
  370. bool streamOffsetSupport_;
  371. /// Fallback shader mode flag.
  372. bool fallback_;
  373. /// Shader Model 3 flag.
  374. bool hasSM3_;
  375. /// Force Shader Model 2 flag.
  376. bool forceSM2_;
  377. /// Force fallback shaders flag.
  378. bool forceFallback_;
  379. /// Query (used to flush the GPU command queue) issued flags.
  380. bool queryIssued_[NUM_QUERIES];
  381. /// Current query index
  382. unsigned queryIndex_;
  383. /// Number of primitives this frame.
  384. unsigned numPrimitives_;
  385. /// Number of batches this frame.
  386. unsigned numBatches_;
  387. /// GPU objects.
  388. Vector<GPUObject*> gpuObjects_;
  389. /// Vertex declarations.
  390. HashMap<unsigned long long, SharedPtr<VertexDeclaration> > vertexDeclarations_;
  391. /// Shadow map dummy color texture format.
  392. unsigned dummyColorFormat_;
  393. /// Shadow map depth texture format.
  394. unsigned shadowMapFormat_;
  395. /// Shadow map 24-bit depth texture format.
  396. unsigned hiresShadowMapFormat_;
  397. /// Vertex buffers in use.
  398. VertexBuffer* vertexBuffers_[MAX_VERTEX_STREAMS];
  399. /// Stream frequencies by vertex buffer.
  400. unsigned streamFrequencies_[MAX_VERTEX_STREAMS];
  401. /// Stream offsets by vertex buffer.
  402. unsigned streamOffsets_[MAX_VERTEX_STREAMS];
  403. /// Index buffer in use.
  404. IndexBuffer* indexBuffer_;
  405. /// Vertex declaration in use.
  406. VertexDeclaration* vertexDeclaration_;
  407. /// Vertex shader in use.
  408. ShaderVariation* vertexShader_;
  409. /// Pixel shader in use.
  410. ShaderVariation* pixelShader_;
  411. /// All known shader parameters.
  412. HashMap<StringHash, ShaderParameter> shaderParameters_;
  413. /// Initial assignment of vertex shader constant registers for testing overlap.
  414. StringHash vsRegisterAssignments_[MAX_CONSTANT_REGISTERS];
  415. /// Initial assignment of pixel shader constant registers for testing overlap.
  416. StringHash psRegisterAssignments_[MAX_CONSTANT_REGISTERS];
  417. /// Overlapping shader parameters flag. If false, overlap checks can be skipped.
  418. bool shaderParametersOverlap_;
  419. /// Textures in use.
  420. Texture* textures_[MAX_TEXTURE_UNITS];
  421. /// Texture unit mappings.
  422. HashMap<String, TextureUnit> textureUnits_;
  423. /// Render targets in use.
  424. RenderSurface* renderTargets_[MAX_RENDERTARGETS];
  425. /// Depth stencil buffer in use.
  426. RenderSurface* depthStencil_;
  427. /// Backbuffer depth stencil texture.
  428. SharedPtr<Texture2D> depthTexture_;
  429. /// Viewport coordinates.
  430. IntRect viewport_;
  431. /// Alpha test enable flag.
  432. bool alphaTest_;
  433. /// Alpha test compare mode.
  434. CompareMode alphaTestMode_;
  435. /// Alpha test reference value.
  436. float alphaRef_;
  437. /// Texture anisotropy level.
  438. unsigned textureAnisotropy_;
  439. /// Blending mode.
  440. BlendMode blendMode_;
  441. /// Color write enable.
  442. bool colorWrite_;
  443. /// Hardware culling mode.
  444. CullMode cullMode_;
  445. /// Depth constant bias.
  446. float constantDepthBias_;
  447. /// Depth slope scaled bias.
  448. float slopeScaledDepthBias_;
  449. /// Depth compare mode.
  450. CompareMode depthTestMode_;
  451. /// Depth write enable flag.
  452. bool depthWrite_;
  453. /// Polygon fill mode.
  454. FillMode fillMode_;
  455. /// Scissor test rectangle.
  456. IntRect scissorRect_;
  457. /// Scissor test enable flag.
  458. bool scissorTest_;
  459. /// Stencil test compare mode.
  460. CompareMode stencilTestMode_;
  461. /// Stencil operation on pass.
  462. StencilOp stencilPass_;
  463. /// Stencil operation on fail.
  464. StencilOp stencilFail_;
  465. /// Stencil operation on depth fail.
  466. StencilOp stencilZFail_;
  467. /// Stencil test enable flag.
  468. bool stencilTest_;
  469. /// Stencil test reference value.
  470. unsigned stencilRef_;
  471. /// Stencil compare bitmask.
  472. unsigned stencilMask_;
  473. /// Default texture filtering mode.
  474. TextureFilterMode defaultTextureFilterMode_;
  475. };
  476. /// Register Graphics library objects.
  477. void RegisterGraphicsLibrary(Context* context);