Fix indexed color mask handling in renderstate

This commit is contained in:
baldurk
2018-06-21 11:32:14 +01:00
parent fb3c9ac992
commit d8af674bcb
2 changed files with 23 additions and 5 deletions
+1
View File
@@ -398,6 +398,7 @@ extern bool IsGLES;
// 99 means the extension never became core, so you can easily just do a check of CoreVersion >= NN
// and they will always fail.
#define EXTENSION_CHECKS() \
EXT_TO_CHECK(30, 30, EXT_draw_buffers2) \
EXT_TO_CHECK(31, 99, ARB_texture_buffer_object) \
EXT_TO_CHECK(33, 30, ARB_explicit_attrib_location) \
EXT_TO_CHECK(33, 30, ARB_sampler_objects) \
+22 -5
View File
@@ -1190,8 +1190,17 @@ void GLRenderState::FetchState(WrappedOpenGL *gl)
m_Real->glGetIntegerv(eGL_STENCIL_CLEAR_VALUE, (GLint *)&StencilClearValue);
for(GLuint i = 0; i < RDCMIN(maxDraws, (GLuint)ARRAY_COUNT(ColorMasks)); i++)
m_Real->glGetBooleanv(eGL_COLOR_WRITEMASK, &ColorMasks[i].red);
if(HasExt[EXT_draw_buffers2] || HasExt[ARB_draw_buffers_blend])
{
for(GLuint i = 0; i < RDCMIN(maxDraws, (GLuint)ARRAY_COUNT(ColorMasks)); i++)
m_Real->glGetBooleani_v(eGL_COLOR_WRITEMASK, i, &ColorMasks[i].red);
}
else
{
m_Real->glGetBooleanv(eGL_COLOR_WRITEMASK, &ColorMasks[0].red);
for(size_t i = 1; i < ARRAY_COUNT(ColorMasks); i++)
memcpy(&ColorMasks[i], &ColorMasks[0], sizeof(ColorMask));
}
m_Real->glGetIntegeri_v(eGL_SAMPLE_MASK_VALUE, 0, (GLint *)&SampleMask[0]);
m_Real->glGetIntegerv(eGL_SAMPLE_COVERAGE_VALUE, (GLint *)&SampleCoverage);
@@ -1615,9 +1624,17 @@ void GLRenderState::ApplyState(WrappedOpenGL *gl)
m_Real->glClearStencil((GLint)StencilClearValue);
for(GLuint i = 0; i < RDCMIN(maxDraws, (GLuint)ARRAY_COUNT(ColorMasks)); i++)
m_Real->glColorMaski(i, ColorMasks[i].red, ColorMasks[i].green, ColorMasks[i].blue,
ColorMasks[i].alpha);
if(HasExt[EXT_draw_buffers2] || HasExt[ARB_draw_buffers_blend])
{
for(GLuint i = 0; i < RDCMIN(maxDraws, (GLuint)ARRAY_COUNT(ColorMasks)); i++)
m_Real->glColorMaski(i, ColorMasks[i].red, ColorMasks[i].green, ColorMasks[i].blue,
ColorMasks[i].alpha);
}
else
{
m_Real->glColorMask(ColorMasks[0].red, ColorMasks[0].green, ColorMasks[0].blue,
ColorMasks[0].alpha);
}
m_Real->glSampleMaski(0, (GLbitfield)SampleMask[0]);
m_Real->glSampleCoverage(SampleCoverage, SampleCoverageInvert ? GL_TRUE : GL_FALSE);