gl_state: Remove color mask tracking
This commit is contained in:
parent
2392b548be
commit
0914c70b7f
|
@ -411,12 +411,10 @@ void RasterizerOpenGL::Clear() {
|
||||||
use_color = true;
|
use_color = true;
|
||||||
}
|
}
|
||||||
if (use_color) {
|
if (use_color) {
|
||||||
clear_state.color_mask[0].red_enabled = regs.clear_buffers.R ? GL_TRUE : GL_FALSE;
|
|
||||||
clear_state.color_mask[0].green_enabled = regs.clear_buffers.G ? GL_TRUE : GL_FALSE;
|
|
||||||
clear_state.color_mask[0].blue_enabled = regs.clear_buffers.B ? GL_TRUE : GL_FALSE;
|
|
||||||
clear_state.color_mask[0].alpha_enabled = regs.clear_buffers.A ? GL_TRUE : GL_FALSE;
|
|
||||||
|
|
||||||
// TODO: Signal state tracker about these changes
|
// TODO: Signal state tracker about these changes
|
||||||
|
glColorMaski(0, regs.clear_buffers.R, regs.clear_buffers.G, regs.clear_buffers.B,
|
||||||
|
regs.clear_buffers.A);
|
||||||
|
|
||||||
SyncFramebufferSRGB();
|
SyncFramebufferSRGB();
|
||||||
// TODO(Rodrigo): Determine if clamping is used on clears
|
// TODO(Rodrigo): Determine if clamping is used on clears
|
||||||
SyncFragmentColorClampState();
|
SyncFragmentColorClampState();
|
||||||
|
@ -1071,15 +1069,14 @@ void RasterizerOpenGL::SyncColorMask() {
|
||||||
auto& maxwell3d = system.GPU().Maxwell3D();
|
auto& maxwell3d = system.GPU().Maxwell3D();
|
||||||
const auto& regs = maxwell3d.regs;
|
const auto& regs = maxwell3d.regs;
|
||||||
|
|
||||||
const std::size_t count =
|
if (regs.color_mask_common) {
|
||||||
regs.independent_blend_enable ? Tegra::Engines::Maxwell3D::Regs::NumRenderTargets : 1;
|
auto& mask = regs.color_mask[0];
|
||||||
for (std::size_t i = 0; i < count; i++) {
|
glColorMask(mask.R, mask.B, mask.G, mask.A);
|
||||||
const auto& source = regs.color_mask[regs.color_mask_common ? 0 : i];
|
} else {
|
||||||
auto& dest = state.color_mask[i];
|
for (std::size_t i = 0; i < Maxwell::NumRenderTargets; ++i) {
|
||||||
dest.red_enabled = (source.R == 0) ? GL_FALSE : GL_TRUE;
|
const auto& mask = regs.color_mask[regs.color_mask_common ? 0 : i];
|
||||||
dest.green_enabled = (source.G == 0) ? GL_FALSE : GL_TRUE;
|
glColorMaski(static_cast<GLuint>(i), mask.R, mask.G, mask.B, mask.A);
|
||||||
dest.blue_enabled = (source.B == 0) ? GL_FALSE : GL_TRUE;
|
}
|
||||||
dest.alpha_enabled = (source.A == 0) ? GL_FALSE : GL_TRUE;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -121,21 +121,6 @@ void OpenGLState::ApplyRasterizerDiscard() {
|
||||||
Enable(GL_RASTERIZER_DISCARD, cur_state.rasterizer_discard, rasterizer_discard);
|
Enable(GL_RASTERIZER_DISCARD, cur_state.rasterizer_discard, rasterizer_discard);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenGLState::ApplyColorMask() {
|
|
||||||
for (std::size_t i = 0; i < Maxwell::NumRenderTargets; ++i) {
|
|
||||||
const auto& updated = color_mask[i];
|
|
||||||
auto& current = cur_state.color_mask[i];
|
|
||||||
if (updated.red_enabled != current.red_enabled ||
|
|
||||||
updated.green_enabled != current.green_enabled ||
|
|
||||||
updated.blue_enabled != current.blue_enabled ||
|
|
||||||
updated.alpha_enabled != current.alpha_enabled) {
|
|
||||||
current = updated;
|
|
||||||
glColorMaski(static_cast<GLuint>(i), updated.red_enabled, updated.green_enabled,
|
|
||||||
updated.blue_enabled, updated.alpha_enabled);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void OpenGLState::ApplyStencilTest() {
|
void OpenGLState::ApplyStencilTest() {
|
||||||
Enable(GL_STENCIL_TEST, cur_state.stencil.test_enabled, stencil.test_enabled);
|
Enable(GL_STENCIL_TEST, cur_state.stencil.test_enabled, stencil.test_enabled);
|
||||||
|
|
||||||
|
@ -311,7 +296,6 @@ void OpenGLState::Apply() {
|
||||||
ApplyProgramPipeline();
|
ApplyProgramPipeline();
|
||||||
ApplyClipDistances();
|
ApplyClipDistances();
|
||||||
ApplyRasterizerDiscard();
|
ApplyRasterizerDiscard();
|
||||||
ApplyColorMask();
|
|
||||||
ApplyViewport();
|
ApplyViewport();
|
||||||
ApplyStencilTest();
|
ApplyStencilTest();
|
||||||
ApplyBlending();
|
ApplyBlending();
|
||||||
|
|
|
@ -15,15 +15,6 @@ class OpenGLState {
|
||||||
public:
|
public:
|
||||||
bool rasterizer_discard = false; // GL_RASTERIZER_DISCARD
|
bool rasterizer_discard = false; // GL_RASTERIZER_DISCARD
|
||||||
|
|
||||||
struct ColorMask {
|
|
||||||
GLboolean red_enabled = GL_TRUE;
|
|
||||||
GLboolean green_enabled = GL_TRUE;
|
|
||||||
GLboolean blue_enabled = GL_TRUE;
|
|
||||||
GLboolean alpha_enabled = GL_TRUE;
|
|
||||||
};
|
|
||||||
std::array<ColorMask, Tegra::Engines::Maxwell3D::Regs::NumRenderTargets>
|
|
||||||
color_mask; // GL_COLOR_WRITEMASK
|
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
bool test_enabled = false; // GL_STENCIL_TEST
|
bool test_enabled = false; // GL_STENCIL_TEST
|
||||||
struct {
|
struct {
|
||||||
|
@ -107,7 +98,6 @@ public:
|
||||||
void ApplyProgramPipeline();
|
void ApplyProgramPipeline();
|
||||||
void ApplyClipDistances();
|
void ApplyClipDistances();
|
||||||
void ApplyRasterizerDiscard();
|
void ApplyRasterizerDiscard();
|
||||||
void ApplyColorMask();
|
|
||||||
void ApplyStencilTest();
|
void ApplyStencilTest();
|
||||||
void ApplyViewport();
|
void ApplyViewport();
|
||||||
void ApplyTargetBlending(std::size_t target, bool force);
|
void ApplyTargetBlending(std::size_t target, bool force);
|
||||||
|
|
|
@ -570,6 +570,7 @@ void RendererOpenGL::DrawScreenTriangles(const ScreenInfo& screen_info, float x,
|
||||||
glDisable(GL_POLYGON_OFFSET_FILL);
|
glDisable(GL_POLYGON_OFFSET_FILL);
|
||||||
glCullFace(GL_BACK);
|
glCullFace(GL_BACK);
|
||||||
glFrontFace(GL_CW);
|
glFrontFace(GL_CW);
|
||||||
|
glColorMaski(0, GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
|
||||||
|
|
||||||
glVertexAttribFormat(PositionLocation, 2, GL_FLOAT, GL_FALSE,
|
glVertexAttribFormat(PositionLocation, 2, GL_FLOAT, GL_FALSE,
|
||||||
offsetof(ScreenRectVertex, position));
|
offsetof(ScreenRectVertex, position));
|
||||||
|
|
Loading…
Reference in New Issue