Make sure to disable stencil in UIContext::Begin. Add logic ops to thin3d for completeness.

This commit is contained in:
Henrik Rydgard committed 2015-01-04 17:57:52 +01:00
1 parent fe94cb6146
commit 6ee1c8e9ee
4 files changed
+51 -1

No files matched your search

+22
View File
@@ -32,6 +32,26 @@ enum T3DComparison : int {
ALWAYS,
};
// Had to prefix with LOGIC, too many clashes
enum T3DLogicOp : int {
LOGIC_CLEAR,
LOGIC_SET,
LOGIC_COPY,
LOGIC_COPY_INVERTED,
LOGIC_NOOP,
LOGIC_INVERT,
LOGIC_AND,
LOGIC_NAND,
LOGIC_OR,
LOGIC_NOR,
LOGIC_XOR,
LOGIC_EQUIV,
LOGIC_AND_REVERSE,
LOGIC_AND_INVERTED,
LOGIC_OR_REVERSE,
LOGIC_OR_INVERTED,
};
enum T3DBlendFactor : int {
ZERO,
ONE,
@@ -251,6 +271,8 @@ struct T3DBlendStateDesc {
T3DBlendEquation eqAlpha;
T3DBlendFactor srcAlpha;
T3DBlendFactor dstAlpha;
bool logicEnabled;
T3DLogicOp logicOp;
// int colorMask;
};
+1
View File
@@ -507,6 +507,7 @@ Thin3DBlendState *Thin3DDX9Context::CreateBlendState(const T3DBlendStateDesc &de
bs->eqAlpha = blendEqToD3D9[desc.eqAlpha];
bs->srcAlpha = blendFactorToD3D9[desc.srcAlpha];
bs->dstAlpha = blendFactorToD3D9[desc.dstAlpha];
// Ignore logic ops, we don't support them in D3D9
return bs;
}
+27 -1
View File
@@ -41,6 +41,25 @@ static const unsigned short blendFactorToGL[] = {
GL_CONSTANT_COLOR,
};
static const unsigned short logicOpToGL[] = {
GL_CLEAR,
GL_SET,
GL_COPY,
GL_COPY_INVERTED,
GL_NOOP,
GL_INVERT,
GL_AND,
GL_NAND,
GL_OR,
GL_NOR,
GL_XOR,
GL_EQUIV,
GL_AND_REVERSE,
GL_AND_INVERTED,
GL_OR_REVERSE,
GL_OR_INVERTED,
};
static const unsigned short primToGL[] = {
GL_POINTS,
GL_LINES,
@@ -64,6 +83,8 @@ public:
bool enabled;
GLuint eqCol, eqAlpha;
GLuint srcCol, srcAlpha, dstCol, dstAlpha;
bool logicEnabled;
GLuint logicOp;
// int maskBits;
// uint32_t fixedColor;
@@ -75,7 +96,10 @@ public:
// glstate.blendColor.set(fixedColor);
#if !defined(USING_GLES2)
glstate.colorLogicOp.disable();
glstate.colorLogicOp.set(logicEnabled);
if (logicEnabled) {
glstate.logicOp.set(logicOp);
}
#endif
// glstate.colorMask.set(maskBits & 1, (maskBits >> 1) & 1, (maskBits >> 2) & 1, (maskBits >> 3) & 1);
@@ -510,6 +534,8 @@ Thin3DBlendState *Thin3DGLContext::CreateBlendState(const T3DBlendStateDesc &des
bs->eqAlpha = blendEqToGL[desc.eqAlpha];
bs->srcAlpha = blendFactorToGL[desc.srcAlpha];
bs->dstAlpha = blendFactorToGL[desc.dstAlpha];
bs->logicEnabled = desc.logicEnabled;
bs->logicOp = logicOpToGL[desc.logicOp];
return bs;
}
+1
View File
@@ -41,6 +41,7 @@ void UIContext::Begin() {
thin3d_->SetDepthStencilState(depth_);
thin3d_->SetRenderState(T3DRenderState::CULL_MODE, T3DCullMode::NO_CULL);
thin3d_->SetTexture(0, uitexture_);
thin3d_->SetScissorEnabled(false);
UIBegin(uishader_);
}