Browse Source

Stencil: style

1vanK 3 years ago
parent
commit
7242e3c6c1

+ 8 - 8
Source/Urho3D/AngelScript/Generated_Members.h

@@ -10022,8 +10022,8 @@ template <class T> void RegisterMembers_Graphics(asIScriptEngine* engine, const
     // void Graphics::CleanupScratchBuffers()
     // void Graphics::CleanupScratchBuffers()
     engine->RegisterObjectMethod(className, "void CleanupScratchBuffers()", AS_METHODPR(T, CleanupScratchBuffers, (), void), AS_CALL_THISCALL);
     engine->RegisterObjectMethod(className, "void CleanupScratchBuffers()", AS_METHODPR(T, CleanupScratchBuffers, (), void), AS_CALL_THISCALL);
 
 
-    // void Graphics::Clear(ClearTargetFlags flags, const Color& color = Color(0.0f, 0.0f, 0.0f, 0.0f), float depth = 1.0f, unsigned stencil = 0)
-    engine->RegisterObjectMethod(className, "void Clear(ClearTargetFlags, const Color&in = Color(0.0f, 0.0f, 0.0f, 0.0f), float = 1.0f, uint = 0)", AS_METHODPR(T, Clear, (ClearTargetFlags, const Color&, float, unsigned), void), AS_CALL_THISCALL);
+    // void Graphics::Clear(ClearTargetFlags flags, const Color& color = Color(0.0f, 0.0f, 0.0f, 0.0f), float depth = 1.0f, u32 stencil = 0)
+    engine->RegisterObjectMethod(className, "void Clear(ClearTargetFlags, const Color&in = Color(0.0f, 0.0f, 0.0f, 0.0f), float = 1.0f, uint = 0)", AS_METHODPR(T, Clear, (ClearTargetFlags, const Color&, float, u32), void), AS_CALL_THISCALL);
 
 
     // void Graphics::ClearParameterSource(ShaderParameterGroup group)
     // void Graphics::ClearParameterSource(ShaderParameterGroup group)
     engine->RegisterObjectMethod(className, "void ClearParameterSource(ShaderParameterGroup)", AS_METHODPR(T, ClearParameterSource, (ShaderParameterGroup), void), AS_CALL_THISCALL);
     engine->RegisterObjectMethod(className, "void ClearParameterSource(ShaderParameterGroup)", AS_METHODPR(T, ClearParameterSource, (ShaderParameterGroup), void), AS_CALL_THISCALL);
@@ -10263,8 +10263,8 @@ template <class T> void RegisterMembers_Graphics(asIScriptEngine* engine, const
     engine->RegisterObjectMethod(className, "bool GetSRGBWriteSupport() const", AS_METHODPR(T, GetSRGBWriteSupport, () const, bool), AS_CALL_THISCALL);
     engine->RegisterObjectMethod(className, "bool GetSRGBWriteSupport() const", AS_METHODPR(T, GetSRGBWriteSupport, () const, bool), AS_CALL_THISCALL);
     engine->RegisterObjectMethod(className, "bool get_sRGBWriteSupport() const", AS_METHODPR(T, GetSRGBWriteSupport, () const, bool), AS_CALL_THISCALL);
     engine->RegisterObjectMethod(className, "bool get_sRGBWriteSupport() const", AS_METHODPR(T, GetSRGBWriteSupport, () const, bool), AS_CALL_THISCALL);
 
 
-    // unsigned Graphics::GetStencilCompareMask() const
-    engine->RegisterObjectMethod(className, "uint GetStencilCompareMask() const", AS_METHODPR(T, GetStencilCompareMask, () const, unsigned), AS_CALL_THISCALL);
+    // u32 Graphics::GetStencilCompareMask() const
+    engine->RegisterObjectMethod(className, "uint GetStencilCompareMask() const", AS_METHODPR(T, GetStencilCompareMask, () const, u32), AS_CALL_THISCALL);
 
 
     // StencilOp Graphics::GetStencilFail() const
     // StencilOp Graphics::GetStencilFail() const
     engine->RegisterObjectMethod(className, "StencilOp GetStencilFail() const", AS_METHODPR(T, GetStencilFail, () const, StencilOp), AS_CALL_THISCALL);
     engine->RegisterObjectMethod(className, "StencilOp GetStencilFail() const", AS_METHODPR(T, GetStencilFail, () const, StencilOp), AS_CALL_THISCALL);
@@ -10281,8 +10281,8 @@ template <class T> void RegisterMembers_Graphics(asIScriptEngine* engine, const
     // CompareMode Graphics::GetStencilTestMode() const
     // CompareMode Graphics::GetStencilTestMode() const
     engine->RegisterObjectMethod(className, "CompareMode GetStencilTestMode() const", AS_METHODPR(T, GetStencilTestMode, () const, CompareMode), AS_CALL_THISCALL);
     engine->RegisterObjectMethod(className, "CompareMode GetStencilTestMode() const", AS_METHODPR(T, GetStencilTestMode, () const, CompareMode), AS_CALL_THISCALL);
 
 
-    // unsigned Graphics::GetStencilWriteMask() const
-    engine->RegisterObjectMethod(className, "uint GetStencilWriteMask() const", AS_METHODPR(T, GetStencilWriteMask, () const, unsigned), AS_CALL_THISCALL);
+    // u32 Graphics::GetStencilWriteMask() const
+    engine->RegisterObjectMethod(className, "uint GetStencilWriteMask() const", AS_METHODPR(T, GetStencilWriteMask, () const, u32), AS_CALL_THISCALL);
 
 
     // StencilOp Graphics::GetStencilZFail() const
     // StencilOp Graphics::GetStencilZFail() const
     engine->RegisterObjectMethod(className, "StencilOp GetStencilZFail() const", AS_METHODPR(T, GetStencilZFail, () const, StencilOp), AS_CALL_THISCALL);
     engine->RegisterObjectMethod(className, "StencilOp GetStencilZFail() const", AS_METHODPR(T, GetStencilZFail, () const, StencilOp), AS_CALL_THISCALL);
@@ -10506,8 +10506,8 @@ template <class T> void RegisterMembers_Graphics(asIScriptEngine* engine, const
     engine->RegisterObjectMethod(className, "void SetSRGB(bool)", AS_METHODPR(T, SetSRGB, (bool), void), AS_CALL_THISCALL);
     engine->RegisterObjectMethod(className, "void SetSRGB(bool)", AS_METHODPR(T, SetSRGB, (bool), void), AS_CALL_THISCALL);
     engine->RegisterObjectMethod(className, "void set_sRGB(bool)", AS_METHODPR(T, SetSRGB, (bool), void), AS_CALL_THISCALL);
     engine->RegisterObjectMethod(className, "void set_sRGB(bool)", AS_METHODPR(T, SetSRGB, (bool), void), AS_CALL_THISCALL);
 
 
-    // void Graphics::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)
-    engine->RegisterObjectMethod(className, "void SetStencilTest(bool, CompareMode = CMP_ALWAYS, StencilOp = OP_KEEP, StencilOp = OP_KEEP, StencilOp = OP_KEEP, uint = 0, uint = M_MAX_UNSIGNED, uint = M_MAX_UNSIGNED)", AS_METHODPR(T, SetStencilTest, (bool, CompareMode, StencilOp, StencilOp, StencilOp, unsigned, unsigned, unsigned), void), AS_CALL_THISCALL);
+    // void Graphics::SetStencilTest(bool enable, CompareMode mode = CMP_ALWAYS, StencilOp pass = OP_KEEP, StencilOp fail = OP_KEEP, StencilOp zFail = OP_KEEP, u32 stencilRef = 0, u32 compareMask = M_U32_MASK_ALL_BITS, u32 writeMask = M_U32_MASK_ALL_BITS)
+    engine->RegisterObjectMethod(className, "void SetStencilTest(bool, CompareMode = CMP_ALWAYS, StencilOp = OP_KEEP, StencilOp = OP_KEEP, StencilOp = OP_KEEP, uint = 0, uint = M_U32_MASK_ALL_BITS, uint = M_U32_MASK_ALL_BITS)", AS_METHODPR(T, SetStencilTest, (bool, CompareMode, StencilOp, StencilOp, StencilOp, u32, u32, u32), void), AS_CALL_THISCALL);
 
 
     // void Graphics::SetTexture(unsigned index, Texture* texture)
     // void Graphics::SetTexture(unsigned index, Texture* texture)
     engine->RegisterObjectMethod(className, "void SetTexture(uint, Texture@+)", AS_METHODPR(T, SetTexture, (unsigned, Texture*), void), AS_CALL_THISCALL);
     engine->RegisterObjectMethod(className, "void SetTexture(uint, Texture@+)", AS_METHODPR(T, SetTexture, (unsigned, Texture*), void), AS_CALL_THISCALL);

+ 2 - 2
Source/Urho3D/Graphics/Graphics.cpp

@@ -1899,8 +1899,8 @@ void Graphics::SetClipPlane(bool enable, const Plane& clipPlane, const Matrix3x4
 #endif
 #endif
 }
 }
 
 
-void Graphics::SetStencilTest(bool enable, CompareMode mode, StencilOp pass, StencilOp fail, StencilOp zFail, unsigned stencilRef,
-    unsigned compareMask, unsigned writeMask)
+void Graphics::SetStencilTest(bool enable, CompareMode mode, StencilOp pass, StencilOp fail, StencilOp zFail, u32 stencilRef,
+    u32 compareMask, u32 writeMask)
 {
 {
     GAPI gapi = Graphics::GetGAPI();
     GAPI gapi = Graphics::GetGAPI();
 
 

+ 12 - 12
Source/Urho3D/Graphics/Graphics.h

@@ -206,7 +206,7 @@ public:
     /// End frame rendering and swap buffers.
     /// End frame rendering and swap buffers.
     void EndFrame();
     void EndFrame();
     /// Clear any or all of rendertarget, depth buffer and stencil buffer.
     /// Clear any or all of rendertarget, depth buffer and stencil buffer.
-    void Clear(ClearTargetFlags flags, const Color& color = Color(0.0f, 0.0f, 0.0f, 0.0f), float depth = 1.0f, unsigned stencil = 0);
+    void Clear(ClearTargetFlags flags, const Color& color = Color(0.0f, 0.0f, 0.0f, 0.0f), float depth = 1.0f, u32 stencil = 0);
     /// Resolve multisampled backbuffer to a texture rendertarget. The texture's size should match the viewport size.
     /// Resolve multisampled backbuffer to a texture rendertarget. The texture's size should match the viewport size.
     bool ResolveToTexture(Texture2D* destination, const IntRect& viewport);
     bool ResolveToTexture(Texture2D* destination, const IntRect& viewport);
     /// Resolve a multisampled texture on itself.
     /// Resolve a multisampled texture on itself.
@@ -317,7 +317,7 @@ public:
     /// Set stencil test.
     /// Set stencil test.
     void SetStencilTest
     void SetStencilTest
         (bool enable, CompareMode mode = CMP_ALWAYS, StencilOp pass = OP_KEEP, StencilOp fail = OP_KEEP, StencilOp zFail = OP_KEEP,
         (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);
+            u32 stencilRef = 0, u32 compareMask = M_U32_MASK_ALL_BITS, u32 writeMask = M_U32_MASK_ALL_BITS);
     /// Set a custom clipping plane. The plane is specified in world space, but is dependent on the view and projection matrices.
     /// Set a custom clipping plane. The plane is specified in world space, but is dependent on the view and projection matrices.
     void SetClipPlane(bool enable, const Plane& clipPlane = Plane::UP, const Matrix3x4& view = Matrix3x4::IDENTITY,
     void SetClipPlane(bool enable, const Plane& clipPlane = Plane::UP, const Matrix3x4& view = Matrix3x4::IDENTITY,
         const Matrix4& projection = Matrix4::IDENTITY);
         const Matrix4& projection = Matrix4::IDENTITY);
@@ -645,10 +645,10 @@ public:
     u32 GetStencilRef() const { return stencilRef_; }
     u32 GetStencilRef() const { return stencilRef_; }
 
 
     /// Return stencil compare bitmask.
     /// Return stencil compare bitmask.
-    unsigned GetStencilCompareMask() const { return stencilCompareMask_; }
+    u32 GetStencilCompareMask() const { return stencilCompareMask_; }
 
 
     /// Return stencil write bitmask.
     /// Return stencil write bitmask.
-    unsigned GetStencilWriteMask() const { return stencilWriteMask_; }
+    u32 GetStencilWriteMask() const { return stencilWriteMask_; }
 
 
     /// Return whether a custom clipping plane is in use.
     /// Return whether a custom clipping plane is in use.
     bool GetUseClipPlane() const { return useClipPlane_; }
     bool GetUseClipPlane() const { return useClipPlane_; }
@@ -893,7 +893,7 @@ private:
     bool TakeScreenShot_OGL(Image& destImage);
     bool TakeScreenShot_OGL(Image& destImage);
     bool BeginFrame_OGL();
     bool BeginFrame_OGL();
     void EndFrame_OGL();
     void EndFrame_OGL();
-    void Clear_OGL(ClearTargetFlags flags, const Color& color = Color(0.0f, 0.0f, 0.0f, 0.0f), float depth = 1.0f, unsigned stencil = 0);
+    void Clear_OGL(ClearTargetFlags flags, const Color& color = Color(0.0f, 0.0f, 0.0f, 0.0f), float depth = 1.0f, u32 stencil = 0);
     bool ResolveToTexture_OGL(Texture2D* destination, const IntRect& viewport);
     bool ResolveToTexture_OGL(Texture2D* destination, const IntRect& viewport);
     bool ResolveToTexture_OGL(Texture2D* texture);
     bool ResolveToTexture_OGL(Texture2D* texture);
     bool ResolveToTexture_OGL(TextureCube* texture);
     bool ResolveToTexture_OGL(TextureCube* texture);
@@ -946,7 +946,7 @@ private:
     void SetScissorTest_OGL(bool enable, const Rect& rect = Rect::FULL, bool borderInclusive = true);
     void SetScissorTest_OGL(bool enable, const Rect& rect = Rect::FULL, bool borderInclusive = true);
     void SetScissorTest_OGL(bool enable, const IntRect& rect);
     void SetScissorTest_OGL(bool enable, const IntRect& rect);
     void SetClipPlane_OGL(bool enable, const Plane& clipPlane, const Matrix3x4& view, const Matrix4& projection);
     void SetClipPlane_OGL(bool enable, const Plane& clipPlane, const Matrix3x4& view, const Matrix4& projection);
-    void SetStencilTest_OGL(bool enable, CompareMode mode, StencilOp pass, StencilOp fail, StencilOp zFail, unsigned stencilRef, unsigned compareMask, unsigned writeMask);
+    void SetStencilTest_OGL(bool enable, CompareMode mode = CMP_ALWAYS, StencilOp pass = OP_KEEP, StencilOp fail = OP_KEEP, StencilOp zFail = OP_KEEP, u32 stencilRef = 0, u32 compareMask = M_U32_MASK_ALL_BITS, u32 writeMask = M_U32_MASK_ALL_BITS);
     bool IsInitialized_OGL() const;
     bool IsInitialized_OGL() const;
     bool GetDither_OGL() const;
     bool GetDither_OGL() const;
     bool IsDeviceLost_OGL() const;
     bool IsDeviceLost_OGL() const;
@@ -997,7 +997,7 @@ private:
     bool TakeScreenShot_D3D9(Image& destImage);
     bool TakeScreenShot_D3D9(Image& destImage);
     bool BeginFrame_D3D9();
     bool BeginFrame_D3D9();
     void EndFrame_D3D9();
     void EndFrame_D3D9();
-    void Clear_D3D9(ClearTargetFlags flags, const Color& color = Color(0.0f, 0.0f, 0.0f, 0.0f), float depth = 1.0f, unsigned stencil = 0);
+    void Clear_D3D9(ClearTargetFlags flags, const Color& color = Color(0.0f, 0.0f, 0.0f, 0.0f), float depth = 1.0f, u32 stencil = 0);
     bool ResolveToTexture_D3D9(Texture2D* destination, const IntRect& viewport);
     bool ResolveToTexture_D3D9(Texture2D* destination, const IntRect& viewport);
     bool ResolveToTexture_D3D9(Texture2D* texture);
     bool ResolveToTexture_D3D9(Texture2D* texture);
     bool ResolveToTexture_D3D9(TextureCube* texture);
     bool ResolveToTexture_D3D9(TextureCube* texture);
@@ -1050,7 +1050,7 @@ private:
     void SetScissorTest_D3D9(bool enable, const Rect& rect = Rect::FULL, bool borderInclusive = true);
     void SetScissorTest_D3D9(bool enable, const Rect& rect = Rect::FULL, bool borderInclusive = true);
     void SetScissorTest_D3D9(bool enable, const IntRect& rect);
     void SetScissorTest_D3D9(bool enable, const IntRect& rect);
     void SetClipPlane_D3D9(bool enable, const Plane& clipPlane, const Matrix3x4& view, const Matrix4& projection);
     void SetClipPlane_D3D9(bool enable, const Plane& clipPlane, const Matrix3x4& view, const Matrix4& projection);
-    void SetStencilTest_D3D9(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);
+    void SetStencilTest_D3D9(bool enable, CompareMode mode = CMP_ALWAYS, StencilOp pass = OP_KEEP, StencilOp fail = OP_KEEP, StencilOp zFail = OP_KEEP, u32 stencilRef = 0, u32 compareMask = M_U32_MASK_ALL_BITS, u32 writeMask = M_U32_MASK_ALL_BITS);
     bool IsInitialized_D3D9() const;
     bool IsInitialized_D3D9() const;
     bool GetDither_D3D9() const;
     bool GetDither_D3D9() const;
     bool IsDeviceLost_D3D9() const;
     bool IsDeviceLost_D3D9() const;
@@ -1101,7 +1101,7 @@ private:
     bool TakeScreenShot_D3D11(Image& destImage);
     bool TakeScreenShot_D3D11(Image& destImage);
     bool BeginFrame_D3D11();
     bool BeginFrame_D3D11();
     void EndFrame_D3D11();
     void EndFrame_D3D11();
-    void Clear_D3D11(ClearTargetFlags flags, const Color& color = Color(0.0f, 0.0f, 0.0f, 0.0f), float depth = 1.0f, unsigned stencil = 0);
+    void Clear_D3D11(ClearTargetFlags flags, const Color& color = Color(0.0f, 0.0f, 0.0f, 0.0f), float depth = 1.0f, u32 stencil = 0);
     bool ResolveToTexture_D3D11(Texture2D* destination, const IntRect& viewport);
     bool ResolveToTexture_D3D11(Texture2D* destination, const IntRect& viewport);
     bool ResolveToTexture_D3D11(Texture2D* texture);
     bool ResolveToTexture_D3D11(Texture2D* texture);
     bool ResolveToTexture_D3D11(TextureCube* texture);
     bool ResolveToTexture_D3D11(TextureCube* texture);
@@ -1154,7 +1154,7 @@ private:
     void SetScissorTest_D3D11(bool enable, const Rect& rect = Rect::FULL, bool borderInclusive = true);
     void SetScissorTest_D3D11(bool enable, const Rect& rect = Rect::FULL, bool borderInclusive = true);
     void SetScissorTest_D3D11(bool enable, const IntRect& rect);
     void SetScissorTest_D3D11(bool enable, const IntRect& rect);
     void SetClipPlane_D3D11(bool enable, const Plane& clipPlane, const Matrix3x4& view, const Matrix4& projection);
     void SetClipPlane_D3D11(bool enable, const Plane& clipPlane, const Matrix3x4& view, const Matrix4& projection);
-    void SetStencilTest_D3D11(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);
+    void SetStencilTest_D3D11(bool enable, CompareMode mode = CMP_ALWAYS, StencilOp pass = OP_KEEP, StencilOp fail = OP_KEEP, StencilOp zFail = OP_KEEP, u32 stencilRef = 0, u32 compareMask = M_U32_MASK_ALL_BITS, u32 writeMask = M_U32_MASK_ALL_BITS);
     bool IsInitialized_D3D11() const;
     bool IsInitialized_D3D11() const;
     bool GetDither_D3D11() const;
     bool GetDither_D3D11() const;
     bool IsDeviceLost_D3D11() const;
     bool IsDeviceLost_D3D11() const;
@@ -1323,9 +1323,9 @@ private:
     /// Stencil test reference value.
     /// Stencil test reference value.
     u32 stencilRef_{};
     u32 stencilRef_{};
     /// Stencil compare bitmask.
     /// Stencil compare bitmask.
-    unsigned stencilCompareMask_{};
+    u32 stencilCompareMask_{};
     /// Stencil write bitmask.
     /// Stencil write bitmask.
-    unsigned stencilWriteMask_{};
+    u32 stencilWriteMask_{};
     /// Current custom clip plane in post-projection space.
     /// Current custom clip plane in post-projection space.
     Vector4 clipPlane_;
     Vector4 clipPlane_;
     /// Stencil test enable flag.
     /// Stencil test enable flag.

+ 7 - 7
Source/Urho3D/GraphicsAPI/Direct3D11/D3D11Graphics.cpp

@@ -482,7 +482,7 @@ void Graphics::EndFrame_D3D11()
     CleanupScratchBuffers();
     CleanupScratchBuffers();
 }
 }
 
 
-void Graphics::Clear_D3D11(ClearTargetFlags flags, const Color& color, float depth, unsigned stencil)
+void Graphics::Clear_D3D11(ClearTargetFlags flags, const Color& color, float depth, u32 stencil)
 {
 {
     IntVector2 rtSize = GetRenderTargetDimensions_D3D11();
     IntVector2 rtSize = GetRenderTargetDimensions_D3D11();
 
 
@@ -1544,8 +1544,8 @@ void Graphics::SetScissorTest_D3D11(bool enable, const IntRect& rect)
     }
     }
 }
 }
 
 
-void Graphics::SetStencilTest_D3D11(bool enable, CompareMode mode, StencilOp pass, StencilOp fail, StencilOp zFail, unsigned stencilRef,
-    unsigned compareMask, unsigned writeMask)
+void Graphics::SetStencilTest_D3D11(bool enable, CompareMode mode, StencilOp pass, StencilOp fail, StencilOp zFail, u32 stencilRef,
+    u32 compareMask, u32 writeMask)
 {
 {
     GraphicsImpl_D3D11* impl = GetImpl_D3D11();
     GraphicsImpl_D3D11* impl = GetImpl_D3D11();
 
 
@@ -2355,8 +2355,8 @@ void Graphics::ResetCachedState_D3D11()
     stencilFail_ = OP_KEEP;
     stencilFail_ = OP_KEEP;
     stencilZFail_ = OP_KEEP;
     stencilZFail_ = OP_KEEP;
     stencilRef_ = 0;
     stencilRef_ = 0;
-    stencilCompareMask_ = M_MAX_UNSIGNED;
-    stencilWriteMask_ = M_MAX_UNSIGNED;
+    stencilCompareMask_ = M_U32_MASK_ALL_BITS;
+    stencilWriteMask_ = M_U32_MASK_ALL_BITS;
     useClipPlane_ = false;
     useClipPlane_ = false;
     impl->shaderProgram_ = nullptr;
     impl->shaderProgram_ = nullptr;
     impl->renderTargetsDirty_ = true;
     impl->renderTargetsDirty_ = true;
@@ -2518,8 +2518,8 @@ void Graphics::PrepareDraw_D3D11()
                 stateDesc.DepthWriteMask = depthWrite_ ? D3D11_DEPTH_WRITE_MASK_ALL : D3D11_DEPTH_WRITE_MASK_ZERO;
                 stateDesc.DepthWriteMask = depthWrite_ ? D3D11_DEPTH_WRITE_MASK_ALL : D3D11_DEPTH_WRITE_MASK_ZERO;
                 stateDesc.DepthFunc = d3dCmpFunc[depthTestMode_];
                 stateDesc.DepthFunc = d3dCmpFunc[depthTestMode_];
                 stateDesc.StencilEnable = stencilTest_ ? TRUE : FALSE;
                 stateDesc.StencilEnable = stencilTest_ ? TRUE : FALSE;
-                stateDesc.StencilReadMask = (unsigned char)stencilCompareMask_;
-                stateDesc.StencilWriteMask = (unsigned char)stencilWriteMask_;
+                stateDesc.StencilReadMask = (UINT8)stencilCompareMask_;
+                stateDesc.StencilWriteMask = (UINT8)stencilWriteMask_;
                 stateDesc.FrontFace.StencilFailOp = d3dStencilOp[stencilFail_];
                 stateDesc.FrontFace.StencilFailOp = d3dStencilOp[stencilFail_];
                 stateDesc.FrontFace.StencilDepthFailOp = d3dStencilOp[stencilZFail_];
                 stateDesc.FrontFace.StencilDepthFailOp = d3dStencilOp[stencilZFail_];
                 stateDesc.FrontFace.StencilPassOp = d3dStencilOp[stencilPass_];
                 stateDesc.FrontFace.StencilPassOp = d3dStencilOp[stencilPass_];

+ 5 - 5
Source/Urho3D/GraphicsAPI/Direct3D9/D3D9Graphics.cpp

@@ -696,7 +696,7 @@ void Graphics::EndFrame_D3D9()
     CleanupScratchBuffers();
     CleanupScratchBuffers();
 }
 }
 
 
-void Graphics::Clear_D3D9(ClearTargetFlags flags, const Color& color, float depth, unsigned stencil)
+void Graphics::Clear_D3D9(ClearTargetFlags flags, const Color& color, float depth, u32 stencil)
 {
 {
     DWORD d3dFlags = 0;
     DWORD d3dFlags = 0;
     if (flags & CLEAR_COLOR)
     if (flags & CLEAR_COLOR)
@@ -1833,8 +1833,8 @@ void Graphics::SetScissorTest_D3D9(bool enable, const IntRect& rect)
     }
     }
 }
 }
 
 
-void Graphics::SetStencilTest_D3D9(bool enable, CompareMode mode, StencilOp pass, StencilOp fail, StencilOp zFail, unsigned stencilRef,
-    unsigned compareMask, unsigned writeMask)
+void Graphics::SetStencilTest_D3D9(bool enable, CompareMode mode, StencilOp pass, StencilOp fail, StencilOp zFail, u32 stencilRef,
+    u32 compareMask, u32 writeMask)
 {
 {
     GraphicsImpl_D3D9* impl = GetImpl_D3D9();
     GraphicsImpl_D3D9* impl = GetImpl_D3D9();
 
 
@@ -2646,8 +2646,8 @@ void Graphics::ResetCachedState_D3D9()
     stencilFail_ = OP_KEEP;
     stencilFail_ = OP_KEEP;
     stencilZFail_ = OP_KEEP;
     stencilZFail_ = OP_KEEP;
     stencilRef_ = 0;
     stencilRef_ = 0;
-    stencilCompareMask_ = M_MAX_UNSIGNED;
-    stencilWriteMask_ = M_MAX_UNSIGNED;
+    stencilCompareMask_ = M_U32_MASK_ALL_BITS;
+    stencilWriteMask_ = M_U32_MASK_ALL_BITS;
     useClipPlane_ = false;
     useClipPlane_ = false;
     impl->blendEnable_ = FALSE;
     impl->blendEnable_ = FALSE;
     impl->srcBlend_ = D3DBLEND_ONE;
     impl->srcBlend_ = D3DBLEND_ONE;

+ 19 - 18
Source/Urho3D/GraphicsAPI/OpenGL/OGLGraphics.cpp

@@ -123,7 +123,7 @@ EMSCRIPTEN_BINDINGS(Module) {
 namespace Urho3D
 namespace Urho3D
 {
 {
 
 
-static const unsigned glCmpFunc[] =
+static const GLenum glCmpFunc[] =
 {
 {
     GL_ALWAYS,
     GL_ALWAYS,
     GL_EQUAL,
     GL_EQUAL,
@@ -134,7 +134,7 @@ static const unsigned glCmpFunc[] =
     GL_GEQUAL
     GL_GEQUAL
 };
 };
 
 
-static const unsigned glSrcBlend[] =
+static const GLenum glSrcBlend[] =
 {
 {
     GL_ONE,
     GL_ONE,
     GL_ONE,
     GL_ONE,
@@ -147,7 +147,7 @@ static const unsigned glSrcBlend[] =
     GL_SRC_ALPHA
     GL_SRC_ALPHA
 };
 };
 
 
-static const unsigned glDestBlend[] =
+static const GLenum glDestBlend[] =
 {
 {
     GL_ZERO,
     GL_ZERO,
     GL_ONE,
     GL_ONE,
@@ -160,7 +160,7 @@ static const unsigned glDestBlend[] =
     GL_ONE
     GL_ONE
 };
 };
 
 
-static const unsigned glBlendOp[] =
+static const GLenum glBlendOp[] =
 {
 {
     GL_FUNC_ADD,
     GL_FUNC_ADD,
     GL_FUNC_ADD,
     GL_FUNC_ADD,
@@ -174,14 +174,14 @@ static const unsigned glBlendOp[] =
 };
 };
 
 
 #ifndef GL_ES_VERSION_2_0
 #ifndef GL_ES_VERSION_2_0
-static const unsigned glFillMode[] =
+static const GLenum glFillMode[] =
 {
 {
     GL_FILL,
     GL_FILL,
     GL_LINE,
     GL_LINE,
     GL_POINT
     GL_POINT
 };
 };
 
 
-static const unsigned glStencilOps[] =
+static const GLenum glStencilOps[] =
 {
 {
     GL_KEEP,
     GL_KEEP,
     GL_ZERO,
     GL_ZERO,
@@ -191,7 +191,7 @@ static const unsigned glStencilOps[] =
 };
 };
 #endif
 #endif
 
 
-static const unsigned glElementTypes[] =
+static const GLenum glElementTypes[] =
 {
 {
     GL_INT,
     GL_INT,
     GL_FLOAT,
     GL_FLOAT,
@@ -202,7 +202,7 @@ static const unsigned glElementTypes[] =
     GL_UNSIGNED_BYTE
     GL_UNSIGNED_BYTE
 };
 };
 
 
-static const unsigned glElementComponents[] =
+static const GLint glElementComponents[] =
 {
 {
     1,
     1,
     1,
     1,
@@ -618,7 +618,7 @@ void Graphics::EndFrame_OGL()
     CleanupScratchBuffers();
     CleanupScratchBuffers();
 }
 }
 
 
-void Graphics::Clear_OGL(ClearTargetFlags flags, const Color& color, float depth, unsigned stencil)
+void Graphics::Clear_OGL(ClearTargetFlags flags, const Color& color, float depth, u32 stencil)
 {
 {
     PrepareDraw_OGL();
     PrepareDraw_OGL();
 
 
@@ -633,10 +633,10 @@ void Graphics::Clear_OGL(ClearTargetFlags flags, const Color& color, float depth
         SetColorWrite_OGL(true);
         SetColorWrite_OGL(true);
     if (flags & CLEAR_DEPTH && !oldDepthWrite)
     if (flags & CLEAR_DEPTH && !oldDepthWrite)
         SetDepthWrite_OGL(true);
         SetDepthWrite_OGL(true);
-    if (flags & CLEAR_STENCIL && stencilWriteMask_ != M_MAX_UNSIGNED)
-        glStencilMask(M_MAX_UNSIGNED);
+    if (flags & CLEAR_STENCIL && stencilWriteMask_ != M_U32_MASK_ALL_BITS)
+        glStencilMask(M_U32_MASK_ALL_BITS);
 
 
-    unsigned glFlags = 0;
+    GLbitfield glFlags = 0;
     if (flags & CLEAR_COLOR)
     if (flags & CLEAR_COLOR)
     {
     {
         glFlags |= GL_COLOR_BUFFER_BIT;
         glFlags |= GL_COLOR_BUFFER_BIT;
@@ -650,7 +650,7 @@ void Graphics::Clear_OGL(ClearTargetFlags flags, const Color& color, float depth
     if (flags & CLEAR_STENCIL)
     if (flags & CLEAR_STENCIL)
     {
     {
         glFlags |= GL_STENCIL_BUFFER_BIT;
         glFlags |= GL_STENCIL_BUFFER_BIT;
-        glClearStencil(stencil);
+        glClearStencil((GLint)stencil);
     }
     }
 
 
     // If viewport is less than full screen, set a scissor to limit the clear
     // If viewport is less than full screen, set a scissor to limit the clear
@@ -666,7 +666,7 @@ void Graphics::Clear_OGL(ClearTargetFlags flags, const Color& color, float depth
     SetScissorTest_OGL(false);
     SetScissorTest_OGL(false);
     SetColorWrite_OGL(oldColorWrite);
     SetColorWrite_OGL(oldColorWrite);
     SetDepthWrite_OGL(oldDepthWrite);
     SetDepthWrite_OGL(oldDepthWrite);
-    if (flags & CLEAR_STENCIL && stencilWriteMask_ != M_MAX_UNSIGNED)
+    if (flags & CLEAR_STENCIL && stencilWriteMask_ != M_U32_MASK_ALL_BITS)
         glStencilMask(stencilWriteMask_);
         glStencilMask(stencilWriteMask_);
 }
 }
 
 
@@ -2006,8 +2006,8 @@ void Graphics::SetClipPlane_OGL(bool enable, const Plane& clipPlane, const Matri
 #endif
 #endif
 }
 }
 
 
-void Graphics::SetStencilTest_OGL(bool enable, CompareMode mode, StencilOp pass, StencilOp fail, StencilOp zFail, unsigned stencilRef,
-    unsigned compareMask, unsigned writeMask)
+void Graphics::SetStencilTest_OGL(bool enable, CompareMode mode, StencilOp pass, StencilOp fail, StencilOp zFail, u32 stencilRef,
+    u32 compareMask, u32 writeMask)
 {
 {
 #ifndef GL_ES_VERSION_2_0
 #ifndef GL_ES_VERSION_2_0
     if (enable != stencilTest_)
     if (enable != stencilTest_)
@@ -2016,6 +2016,7 @@ void Graphics::SetStencilTest_OGL(bool enable, CompareMode mode, StencilOp pass,
             glEnable(GL_STENCIL_TEST);
             glEnable(GL_STENCIL_TEST);
         else
         else
             glDisable(GL_STENCIL_TEST);
             glDisable(GL_STENCIL_TEST);
+
         stencilTest_ = enable;
         stencilTest_ = enable;
     }
     }
 
 
@@ -3237,8 +3238,8 @@ void Graphics::ResetCachedState_OGL()
     stencilFail_ = OP_KEEP;
     stencilFail_ = OP_KEEP;
     stencilZFail_ = OP_KEEP;
     stencilZFail_ = OP_KEEP;
     stencilRef_ = 0;
     stencilRef_ = 0;
-    stencilCompareMask_ = M_MAX_UNSIGNED;
-    stencilWriteMask_ = M_MAX_UNSIGNED;
+    stencilCompareMask_ = M_U32_MASK_ALL_BITS;
+    stencilWriteMask_ = M_U32_MASK_ALL_BITS;
     useClipPlane_ = false;
     useClipPlane_ = false;
     impl->shaderProgram_ = nullptr;
     impl->shaderProgram_ = nullptr;
     impl->lastInstanceOffset_ = 0;
     impl->lastInstanceOffset_ = 0;