OGLGraphics.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494
  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 "ArrayPtr.h"
  25. #include "Color.h"
  26. #include "GraphicsDefs.h"
  27. #include "HashMap.h"
  28. #include "Matrix3x4.h"
  29. #include "Object.h"
  30. #include "Rect.h"
  31. class Image;
  32. class IndexBuffer;
  33. class Matrix3;
  34. class Matrix4;
  35. class Matrix3x4;
  36. class GPUObject;
  37. class GraphicsImpl;
  38. class RenderSurface;
  39. class ShaderProgram;
  40. class ShaderVariation;
  41. class Texture;
  42. class Texture2D;
  43. class TextureCube;
  44. class Vector3;
  45. class Vector4;
  46. class VertexBuffer;
  47. typedef Map<Pair<ShaderVariation*, ShaderVariation*>, SharedPtr<ShaderProgram> > ShaderProgramMap;
  48. static const unsigned NUM_SCREEN_BUFFERS = 2;
  49. /// CPU-side buffer for VBO discard locking.
  50. struct DiscardLockBuffer
  51. {
  52. DiscardLockBuffer() :
  53. size_(0),
  54. reserved_(false)
  55. {
  56. }
  57. /// Buffer data.
  58. SharedArrayPtr<unsigned char> data_;
  59. /// Data size.
  60. unsigned size_;
  61. /// Reserved flag.
  62. bool reserved_;
  63. };
  64. /// %Graphics subsystem. Manages the application window, rendering state and GPU resources.
  65. class Graphics : public Object
  66. {
  67. OBJECT(Graphics);
  68. public:
  69. /// Construct.
  70. Graphics(Context* context_);
  71. /// Destruct. Release the OpenGL context and close the window.
  72. virtual ~Graphics();
  73. /// Set window title.
  74. void SetWindowTitle(const String& windowTitle);
  75. /// Set screen mode. Return true if successful.
  76. bool SetMode(int width, int height, bool fullscreen, bool vsync, bool tripleBuffer, int multiSample);
  77. /// Set screen resolution only. Return true if successful.
  78. bool SetMode(int width, int height);
  79. /// Toggle between full screen and windowed mode.
  80. bool ToggleFullscreen();
  81. /// Close the window.
  82. void Close();
  83. /// Take a screenshot.
  84. bool TakeScreenShot(Image& destImage);
  85. /// Begin frame rendering. Return true if device available and can render.
  86. bool BeginFrame();
  87. /// End frame rendering and swap buffers.
  88. void EndFrame();
  89. /// Clear any or all of rendertarget, depth buffer and stencil buffer.
  90. void Clear(unsigned flags, const Color& color = Color(0.0f, 0.0f, 0.0f, 0.0f), float depth = 1.0f, unsigned stencil = 0);
  91. /// Resolve multisampled backbuffer to a texture rendertarget.
  92. bool ResolveToTexture(Texture2D* destination, const IntRect& viewport);
  93. /// Draw non-indexed geometry.
  94. void Draw(PrimitiveType type, unsigned vertexStart, unsigned vertexCount);
  95. /// Draw indexed geometry.
  96. void Draw(PrimitiveType type, unsigned indexStart, unsigned indexCount, unsigned minVertex, unsigned vertexCount);
  97. /// Draw indexed, instanced geometry. No-op on OpenGL.
  98. void DrawInstanced(PrimitiveType type, unsigned indexStart, unsigned indexCount, unsigned minVertex, unsigned vertexCount, unsigned instanceCount);
  99. /// Set vertex buffer.
  100. void SetVertexBuffer(VertexBuffer* buffer);
  101. /// Set multiple vertex buffers.
  102. bool SetVertexBuffers(const Vector<VertexBuffer*>& buffers, const PODVector<unsigned>& elementMasks, unsigned instanceOffset = 0);
  103. /// Set multiple vertex buffers.
  104. bool SetVertexBuffers(const Vector<SharedPtr<VertexBuffer> >& buffers, const PODVector<unsigned>& elementMasks, unsigned instanceOffset = 0);
  105. /// Set index buffer.
  106. void SetIndexBuffer(IndexBuffer* buffer);
  107. /// Set shaders.
  108. void SetShaders(ShaderVariation* vs, ShaderVariation* ps);
  109. /// Set shader float constants.
  110. void SetShaderParameter(StringHash param, const float* data, unsigned count);
  111. /// Set shader float constant.
  112. void SetShaderParameter(StringHash param, float value);
  113. /// Set shader color constant.
  114. void SetShaderParameter(StringHash param, const Color& color);
  115. /// Set shader 3x3 matrix constant.
  116. void SetShaderParameter(StringHash param, const Matrix3& matrix);
  117. /// Set shader 3D vector constant.
  118. void SetShaderParameter(StringHash param, const Vector3& vector);
  119. /// Set shader 4x4 matrix constant.
  120. void SetShaderParameter(StringHash param, const Matrix4& matrix);
  121. /// Set shader 4D vector constant.
  122. void SetShaderParameter(StringHash param, const Vector4& vector);
  123. /// Set shader 4x3 matrix constant.
  124. void SetShaderParameter(StringHash param, const Matrix3x4& matrix);
  125. /// Check whether a shader parameter in the currently set shaders needs update.
  126. bool NeedParameterUpdate(StringHash param, const void* source);
  127. /// Check whether the current pixel shader uses a texture unit.
  128. bool NeedTextureUnit(TextureUnit unit);
  129. /// Clear remembered shader parameter source.
  130. void ClearParameterSource(StringHash param);
  131. /// Clear remembered shader parameter sources.
  132. void ClearParameterSources();
  133. /// Clear remembered transform shader parameter sources.
  134. void ClearTransformSources();
  135. /// Clean up unused shader programs.
  136. void CleanupShaderPrograms();
  137. /// Set texture.
  138. void SetTexture(unsigned index, Texture* texture);
  139. /// Bind texture unit 0 for update. Called by Texture.
  140. void SetTextureForUpdate(Texture* texture);
  141. /// Set default texture filtering mode.
  142. void SetDefaultTextureFilterMode(TextureFilterMode mode);
  143. /// Set texture anisotropy.
  144. void SetTextureAnisotropy(unsigned level);
  145. /// Dirty texture parameters of all textures (when global settings change.)
  146. void SetTextureParametersDirty();
  147. /// Reset all rendertargets, depth-stencil surface and viewport.
  148. void ResetRenderTargets();
  149. /// Reset specific rendertarget.
  150. void ResetRenderTarget(unsigned index);
  151. /// Reset depth-stencil surface.
  152. void ResetDepthStencil();
  153. /// Set rendertarget.
  154. void SetRenderTarget(unsigned index, RenderSurface* renderTarget);
  155. /// Set rendertarget.
  156. void SetRenderTarget(unsigned index, Texture2D* texture);
  157. /// Set depth-stencil surface.
  158. void SetDepthStencil(RenderSurface* depthStencil);
  159. /// Set depth-stencil surface.
  160. void SetDepthStencil(Texture2D* texture);
  161. /// %Set view texture (deferred rendering final output rendertarget) to prevent it from being sampled.
  162. void SetViewTexture(Texture* texture);
  163. /// Set viewport.
  164. void SetViewport(const IntRect& rect);
  165. /// Set alpha test.
  166. void SetAlphaTest(bool enable, CompareMode mode = CMP_ALWAYS, float alphaRef = 0.5f);
  167. /// Set blending mode.
  168. void SetBlendMode(BlendMode mode);
  169. /// Set color write on/off.
  170. void SetColorWrite(bool enable);
  171. /// Set hardware culling mode.
  172. void SetCullMode(CullMode mode);
  173. /// Set depth bias.
  174. void SetDepthBias(float constantBias, float slopeScaledBias);
  175. /// Set depth compare.
  176. void SetDepthTest(CompareMode mode);
  177. /// Set depth write on/off.
  178. void SetDepthWrite(bool enable);
  179. /// Set polygon fill mode.
  180. void SetFillMode(FillMode mode);
  181. /// Set scissor test.
  182. void SetScissorTest(bool enable, const Rect& rect = Rect::FULL, bool borderInclusive = true);
  183. /// Set scissor test.
  184. void SetScissorTest(bool enable, const IntRect& rect);
  185. /// Set stencil test.
  186. 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);
  187. /// Set vertex buffer stream frequency. No-op on OpenGL.
  188. void SetStreamFrequency(unsigned index, unsigned frequency);
  189. /// Reset stream frequencies. No-op on OpenGL.
  190. void ResetStreamFrequencies();
  191. /// Set force Shader Model 2 flag. No effect on OpenGL.
  192. void SetForceSM2(bool enable);
  193. /// Return whether rendering initialized.
  194. bool IsInitialized() const;
  195. /// Return graphics implementation, which holds the actual API-specific resources.
  196. GraphicsImpl* GetImpl() const { return impl_; }
  197. /// Return window title.
  198. const String& GetWindowTitle() const { return windowTitle_; }
  199. /// Return window width.
  200. int GetWidth() const { return width_; }
  201. /// Return window height.
  202. int GetHeight() const { return height_; }
  203. /// Return multisample mode (1 = no multisampling.)
  204. int GetMultiSample() const { return multiSample_; }
  205. /// Return whether window is fullscreen.
  206. bool GetFullscreen() const { return fullscreen_; }
  207. /// Return whether vertical sync is on.
  208. bool GetVSync() const { return vsync_; }
  209. /// Return whether triple buffering is enabled.
  210. bool GetTripleBuffer() const { return tripleBuffer_; }
  211. /// Return whether device is lost, and can not yet render. Always false on OpenGL.
  212. bool IsDeviceLost() const { return false; }
  213. /// Return window handle.
  214. void* GetWindowHandle() const;
  215. /// Return number of primitives drawn this frame.
  216. unsigned GetNumPrimitives() const { return numPrimitives_; }
  217. /// Return number of batches drawn this frame.
  218. unsigned GetNumBatches() const { return numBatches_; }
  219. /// Return dummy color texture format for shadow maps. Is always 0 on OpenGL.
  220. unsigned GetDummyColorFormat() const { return 0; }
  221. /// Return shadow map depth texture format, or 0 if not supported.
  222. unsigned GetShadowMapFormat() const { return shadowMapFormat_; }
  223. /// Return 24-bit shadow map depth texture format, or 0 if not supported.
  224. unsigned GetHiresShadowMapFormat() const { return hiresShadowMapFormat_; }
  225. /// Return whether Shader Model 3 is supported. Always false on OpenGL.
  226. bool GetSM3Support() const { return false; }
  227. /// Return whether light pre-pass rendering is supported.
  228. bool GetLightPrepassSupport() const { return lightPrepassSupport_; }
  229. /// Return whether deferred rendering is supported.
  230. bool GetDeferredSupport() const { return deferredSupport_; }
  231. /// Return whether hardware depth texture is supported.
  232. bool GetHardwareDepthSupport() const { return hardwareDepthSupport_; }
  233. /// Return whether shadow map depth compare is done in hardware. Always true on OpenGL.
  234. bool GetHardwareShadowSupport() const { return true; }
  235. /// Return whether 24-bit shadow maps are supported. Assume true on OpenGL.
  236. bool GetHiresShadowSupport() const { return true; }
  237. /// Return whether stream offset is supported. Always false on OpenGL.
  238. bool GetStreamOffsetSupport() const { return false; }
  239. /// Return whether DXT texture compression is supported.
  240. bool GetCompressedTextureSupport() const { return compressedTextureSupport_; }
  241. /// Return supported fullscreen resolutions.
  242. PODVector<IntVector2> GetResolutions() const;
  243. /// Return supported multisampling levels.
  244. PODVector<int> GetMultiSampleLevels() const;
  245. /// Return vertex buffer by index.
  246. VertexBuffer* GetVertexBuffer(unsigned index) const;
  247. /// Return index buffer.
  248. IndexBuffer* GetIndexBuffer() const { return indexBuffer_; }
  249. /// Return vertex shader.
  250. ShaderVariation* GetVertexShader() const { return vertexShader_; }
  251. /// Return pixel shader.
  252. ShaderVariation* GetPixelShader() const { return pixelShader_; }
  253. /// Return shader program.
  254. ShaderProgram* GetShaderProgram() const { return shaderProgram_; }
  255. /// Return texture unit index by name.
  256. TextureUnit GetTextureUnit(const String& name);
  257. /// Return texture unit name by index.
  258. const String& GetTextureUnitName(TextureUnit unit);
  259. /// Return texture by texture unit index.
  260. Texture* GetTexture(unsigned index) const;
  261. /// Return default texture filtering mode.
  262. TextureFilterMode GetDefaultTextureFilterMode() const { return defaultTextureFilterMode_; }
  263. /// Return rendertarget by index.
  264. RenderSurface* GetRenderTarget(unsigned index) const;
  265. /// Return depth-stencil surface.
  266. RenderSurface* GetDepthStencil() const { return depthStencil_; }
  267. /// Return readable depth-stencil texture. Not created automatically on OpenGL.
  268. Texture2D* GetDepthTexture() const { return 0; }
  269. /// Return the viewport coordinates.
  270. IntRect GetViewport() const { return viewport_; }
  271. /// Return whether alpha testing is enabled.
  272. bool GetAlphaTest() const { return alphaTest_; }
  273. /// Return alpha test compare mode.
  274. CompareMode GetAlphaTestMode() const { return alphaTestMode_; }
  275. /// Return texture anisotropy.
  276. unsigned GetTextureAnisotropy() const { return textureAnisotropy_; }
  277. /// Return alpha test reference value.
  278. float GetAlphaRef() const { return alphaRef_; }
  279. /// Return blending mode.
  280. BlendMode GetBlendMode() const { return blendMode_; }
  281. /// Return whether color write is enabled.
  282. bool GetColorWrite() const { return colorWrite_; }
  283. /// Return hardware culling mode.
  284. CullMode GetCullMode() const { return cullMode_; }
  285. /// Return depth constant bias.
  286. float GetDepthConstantBias() const { return constantDepthBias_; }
  287. /// Return depth slope scaled bias.
  288. float GetDepthSlopeScaledBias() const { return slopeScaledDepthBias_; }
  289. /// Return depth compare mode.
  290. CompareMode GetDepthTest() const { return depthTestMode_; }
  291. /// Return whether depth write is enabled.
  292. bool GetDepthWrite() const { return depthWrite_; }
  293. /// Return polygon fill mode.
  294. FillMode GetFillMode() const { return fillMode_; }
  295. /// Return whether stencil test is enabled.
  296. bool GetStencilTest() const { return stencilTest_; }
  297. /// Return whether scissor test is enabled.
  298. bool GetScissorTest() const { return scissorTest_; }
  299. /// Return scissor rectangle coordinates.
  300. const IntRect& GetScissorRect() const { return scissorRect_; }
  301. /// Return stencil compare mode.
  302. CompareMode GetStencilTestMode() const { return stencilTestMode_; }
  303. /// Return stencil operation to do if stencil test passes.
  304. StencilOp GetStencilPass() const { return stencilPass_; }
  305. /// Return stencil operation to do if stencil test fails.
  306. StencilOp GetStencilFail() const { return stencilFail_; }
  307. /// Return stencil operation to do if depth compare fails.
  308. StencilOp GetStencilZFail() const { return stencilZFail_; }
  309. /// Return stencil reference value.
  310. unsigned GetStencilRef() const { return stencilRef_; }
  311. /// Return stencil compare bitmask.
  312. unsigned GetStencilCompareMask() const { return stencilCompareMask_; }
  313. /// Return stencil write bitmask.
  314. unsigned GetStencilWriteMask() const { return stencilWriteMask_; }
  315. /// Return stream frequency by vertex buffer index. Always returns 0 on OpenGL.
  316. unsigned GetStreamFrequency(unsigned index) const { return 0; }
  317. /// Return rendertarget width and height.
  318. IntVector2 GetRenderTargetDimensions() const;
  319. /// Return force Shader Model 2 flag. Always false on OpenGL.
  320. bool GetForceSM2() const { return false; }
  321. /// Add a GPU object to keep track of. Called by GPUObject.
  322. void AddGPUObject(GPUObject* object);
  323. /// Remove a GPU object. Called by GPUObject.
  324. void RemoveGPUObject(GPUObject* object);
  325. /// Reserve a CPU side discard locking buffer.
  326. void* ReserveDiscardLockBuffer(unsigned size);
  327. /// Free a CPU side discard locking buffer.
  328. void FreeDiscardLockBuffer(void* buffer);
  329. /// Release/clear GPU objects and optionally close the window.
  330. void Release(bool clearGPUObjects, bool closeWindow);
  331. /// Clean up a render surface from all FBOs.
  332. void CleanupRenderSurface(RenderSurface* surface);
  333. /// Return the API-specific alpha texture format.
  334. static unsigned GetAlphaFormat();
  335. /// Return the API-specific luminance texture format.
  336. static unsigned GetLuminanceFormat();
  337. /// Return the API-specific luminance alpha texture format.
  338. static unsigned GetLuminanceAlphaFormat();
  339. /// Return the API-specific RGB texture format.
  340. static unsigned GetRGBFormat();
  341. /// Return the API-specific RGBA texture format.
  342. static unsigned GetRGBAFormat();
  343. /// Return the API-specific single channel float texture format.
  344. static unsigned GetFloatFormat();
  345. /// Return the API-specific linear depth texture format.
  346. static unsigned GetLinearDepthFormat();
  347. /// Return the API-specific hardware depth-stencil texture format.
  348. static unsigned GetDepthStencilFormat();
  349. private:
  350. /// Check supported rendering features.
  351. void CheckFeatureSupport();
  352. /// Select FBO and commit changes.
  353. void CommitFramebuffer();
  354. /// Check FBO completeness.
  355. bool CheckFramebuffer();
  356. /// Cleanup unused and unbound FBO's.
  357. void CleanupFramebuffers(bool deleteAll);
  358. /// Reset cached rendering state.
  359. void ResetCachedState();
  360. /// Initialize texture unit mappings.
  361. void SetTextureUnitMappings();
  362. /// Implementation.
  363. GraphicsImpl* impl_;
  364. /// Window title.
  365. String windowTitle_;
  366. /// Window width.
  367. int width_;
  368. /// Window height.
  369. int height_;
  370. /// Multisampling mode.
  371. int multiSample_;
  372. /// Fullscreen flag.
  373. bool fullscreen_;
  374. /// Vertical sync flag.
  375. bool vsync_;
  376. /// Triple buffering flag.
  377. bool tripleBuffer_;
  378. /// Light prepass support flag.
  379. bool lightPrepassSupport_;
  380. /// Deferred rendering support flag.
  381. bool deferredSupport_;
  382. /// Hardware depth support flag.
  383. bool hardwareDepthSupport_;
  384. /// Compressed texture support flag.
  385. bool compressedTextureSupport_;
  386. /// Number of primitives this frame.
  387. unsigned numPrimitives_;
  388. /// Number of batches this frame.
  389. unsigned numBatches_;
  390. /// GPU objects.
  391. Vector<GPUObject*> gpuObjects_;
  392. /// Discard lock buffers.
  393. Vector<DiscardLockBuffer> discardLockBuffers_;
  394. /// Shadow map depth texture format.
  395. unsigned shadowMapFormat_;
  396. /// Shadow map 24-bit depth texture format.
  397. unsigned hiresShadowMapFormat_;
  398. /// Vertex buffers in use.
  399. VertexBuffer* vertexBuffers_[MAX_VERTEX_STREAMS];
  400. /// Element mask in use.
  401. unsigned elementMasks_[MAX_VERTEX_STREAMS];
  402. /// Index buffer in use.
  403. IndexBuffer* indexBuffer_;
  404. /// Vertex shader in use.
  405. ShaderVariation* vertexShader_;
  406. /// Pixel shader in use.
  407. ShaderVariation* pixelShader_;
  408. /// Shader program in use.
  409. ShaderProgram* shaderProgram_;
  410. /// Linked shader programs.
  411. ShaderProgramMap shaderPrograms_;
  412. /// Shader parameters global frame number.
  413. unsigned shaderParameterFrame_;
  414. /// Textures in use.
  415. Texture* textures_[MAX_TEXTURE_UNITS];
  416. /// OpenGL texture types in use.
  417. unsigned textureTypes_[MAX_TEXTURE_UNITS];
  418. /// Texture unit mappings.
  419. Map<String, TextureUnit> textureUnits_;
  420. /// Rendertargets in use.
  421. RenderSurface* renderTargets_[MAX_RENDERTARGETS];
  422. /// Depth-stencil surface in use.
  423. RenderSurface* depthStencil_;
  424. /// View texture.
  425. Texture* viewTexture_;
  426. /// Viewport coordinates.
  427. IntRect viewport_;
  428. /// Alpha test enable flag.
  429. bool alphaTest_;
  430. /// Alpha test compare mode.
  431. CompareMode alphaTestMode_;
  432. /// Alpha test reference value.
  433. float alphaRef_;
  434. /// Texture anisotropy level.
  435. unsigned textureAnisotropy_;
  436. /// Blending mode.
  437. BlendMode blendMode_;
  438. /// Color write enable.
  439. bool colorWrite_;
  440. /// Hardware culling mode.
  441. CullMode cullMode_;
  442. /// Depth constant bias.
  443. float constantDepthBias_;
  444. /// Depth slope scaled bias.
  445. float slopeScaledDepthBias_;
  446. /// Depth compare mode.
  447. CompareMode depthTestMode_;
  448. /// Depth write enable flag.
  449. bool depthWrite_;
  450. /// Polygon fill mode.
  451. FillMode fillMode_;
  452. /// Scissor test rectangle.
  453. IntRect scissorRect_;
  454. /// Scissor test enable flag.
  455. bool scissorTest_;
  456. /// Stencil test compare mode.
  457. CompareMode stencilTestMode_;
  458. /// Stencil operation on pass.
  459. StencilOp stencilPass_;
  460. /// Stencil operation on fail.
  461. StencilOp stencilFail_;
  462. /// Stencil operation on depth fail.
  463. StencilOp stencilZFail_;
  464. /// Stencil test enable flag.
  465. bool stencilTest_;
  466. /// Stencil test reference value.
  467. unsigned stencilRef_;
  468. /// Stencil compare bitmask.
  469. unsigned stencilCompareMask_;
  470. /// Stencil write bitmask.
  471. unsigned stencilWriteMask_;
  472. /// Default texture filtering mode.
  473. TextureFilterMode defaultTextureFilterMode_;
  474. /// Map for additional depth textures, to emulate Direct3D9 ability to mix render texture and backbuffer rendering.
  475. HashMap<int, SharedPtr<Texture2D> > depthTextures_;
  476. };
  477. /// Register Graphics library objects.
  478. void RegisterGraphicsLibrary(Context* context_);