mirror of
https://gitlab.com/suyu-emu/suyu.git
synced 2024-03-15 23:15:44 +00:00
gl_rasterizer: Minor sort changes to clearing
This commit is contained in:
parent
15cadc3948
commit
98c8948b23
|
@ -408,13 +408,12 @@ void RasterizerOpenGL::ConfigureClearFramebuffer(bool using_color_fb, bool using
|
||||||
}
|
}
|
||||||
|
|
||||||
void RasterizerOpenGL::Clear() {
|
void RasterizerOpenGL::Clear() {
|
||||||
const auto& maxwell3d = system.GPU().Maxwell3D();
|
const auto& gpu = system.GPU().Maxwell3D();
|
||||||
|
if (!gpu.ShouldExecute()) {
|
||||||
if (!maxwell3d.ShouldExecute()) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto& regs = maxwell3d.regs;
|
const auto& regs = gpu.regs;
|
||||||
bool use_color{};
|
bool use_color{};
|
||||||
bool use_depth{};
|
bool use_depth{};
|
||||||
bool use_stencil{};
|
bool use_stencil{};
|
||||||
|
@ -424,14 +423,13 @@ void RasterizerOpenGL::Clear() {
|
||||||
use_color = true;
|
use_color = true;
|
||||||
}
|
}
|
||||||
if (use_color) {
|
if (use_color) {
|
||||||
// TODO: Signal state tracker about these changes
|
|
||||||
state_tracker.NotifyColorMask0();
|
state_tracker.NotifyColorMask0();
|
||||||
glColorMaski(0, regs.clear_buffers.R != 0, regs.clear_buffers.G != 0,
|
glColorMaski(0, regs.clear_buffers.R != 0, regs.clear_buffers.G != 0,
|
||||||
regs.clear_buffers.B != 0, regs.clear_buffers.A != 0);
|
regs.clear_buffers.B != 0, regs.clear_buffers.A != 0);
|
||||||
|
|
||||||
SyncFramebufferSRGB();
|
|
||||||
// TODO(Rodrigo): Determine if clamping is used on clears
|
// TODO(Rodrigo): Determine if clamping is used on clears
|
||||||
SyncFragmentColorClampState();
|
SyncFragmentColorClampState();
|
||||||
|
SyncFramebufferSRGB();
|
||||||
}
|
}
|
||||||
if (regs.clear_buffers.Z) {
|
if (regs.clear_buffers.Z) {
|
||||||
ASSERT_MSG(regs.zeta_enable != 0, "Tried to clear Z but buffer is not enabled!");
|
ASSERT_MSG(regs.zeta_enable != 0, "Tried to clear Z but buffer is not enabled!");
|
||||||
|
@ -441,7 +439,7 @@ void RasterizerOpenGL::Clear() {
|
||||||
glDepthMask(GL_TRUE);
|
glDepthMask(GL_TRUE);
|
||||||
}
|
}
|
||||||
if (regs.clear_buffers.S) {
|
if (regs.clear_buffers.S) {
|
||||||
ASSERT_MSG(regs.zeta_enable != 0, "Tried to clear stencil but buffer is not enabled!");
|
ASSERT_MSG(regs.zeta_enable, "Tried to clear stencil but buffer is not enabled!");
|
||||||
use_stencil = true;
|
use_stencil = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -450,20 +448,20 @@ void RasterizerOpenGL::Clear() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigureClearFramebuffer(use_color, use_depth, use_stencil);
|
|
||||||
|
|
||||||
SyncRasterizeEnable();
|
SyncRasterizeEnable();
|
||||||
|
|
||||||
if (regs.clear_flags.scissor) {
|
if (regs.clear_flags.scissor) {
|
||||||
SyncScissorTest();
|
SyncScissorTest();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Signal state tracker about these changes
|
// TODO(Rodrigo): Find out if blending affects clearing
|
||||||
state_tracker.NotifyBlend0();
|
state_tracker.NotifyBlend0();
|
||||||
// TODO(Rodrigo): Find out if these changes affect clearing
|
|
||||||
glDisablei(GL_BLEND, 0);
|
glDisablei(GL_BLEND, 0);
|
||||||
|
|
||||||
UNIMPLEMENTED_IF(regs.clear_flags.viewport);
|
UNIMPLEMENTED_IF(regs.clear_flags.viewport);
|
||||||
|
|
||||||
|
ConfigureClearFramebuffer(use_color, use_depth, use_stencil);
|
||||||
|
|
||||||
if (use_color) {
|
if (use_color) {
|
||||||
glClearBufferfv(GL_COLOR, 0, regs.clear_color);
|
glClearBufferfv(GL_COLOR, 0, regs.clear_color);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue