mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-22 10:51:50 -05:00
GPU: Support clears that don't clear the color buffer.
This commit is contained in:
parent
be51120d23
commit
c1811ed3d1
2 changed files with 17 additions and 6 deletions
|
@ -420,8 +420,9 @@ bool Maxwell3D::IsShaderStageEnabled(Regs::ShaderStage stage) const {
|
|||
}
|
||||
|
||||
void Maxwell3D::ProcessClearBuffers() {
|
||||
ASSERT(regs.clear_buffers.R && regs.clear_buffers.G && regs.clear_buffers.B &&
|
||||
regs.clear_buffers.A);
|
||||
ASSERT(regs.clear_buffers.R == regs.clear_buffers.G &&
|
||||
regs.clear_buffers.R == regs.clear_buffers.B &&
|
||||
regs.clear_buffers.R == regs.clear_buffers.A);
|
||||
|
||||
VideoCore::g_renderer->Rasterizer()->Clear();
|
||||
}
|
||||
|
|
|
@ -300,6 +300,20 @@ bool RasterizerOpenGL::AccelerateDrawBatch(bool is_indexed) {
|
|||
void RasterizerOpenGL::Clear() {
|
||||
const auto& regs = Core::System().GetInstance().GPU().Maxwell3D().regs;
|
||||
|
||||
GLbitfield clear_mask = 0;
|
||||
if (regs.clear_buffers.R && regs.clear_buffers.G && regs.clear_buffers.B &&
|
||||
regs.clear_buffers.A) {
|
||||
clear_mask |= GL_COLOR_BUFFER_BIT;
|
||||
}
|
||||
if (regs.clear_buffers.Z)
|
||||
clear_mask |= GL_DEPTH_BUFFER_BIT;
|
||||
|
||||
if (clear_mask == 0)
|
||||
return;
|
||||
|
||||
// Sync the depth test state before configuring the framebuffer surfaces.
|
||||
SyncDepthTestState();
|
||||
|
||||
// TODO(bunnei): Implement these
|
||||
const bool has_stencil = false;
|
||||
const bool using_color_fb = true;
|
||||
|
@ -353,10 +367,6 @@ void RasterizerOpenGL::Clear() {
|
|||
regs.clear_color[3]);
|
||||
glClearDepth(regs.clear_depth);
|
||||
|
||||
GLbitfield clear_mask = GL_COLOR_BUFFER_BIT;
|
||||
if (regs.clear_buffers.Z)
|
||||
clear_mask |= GL_DEPTH_BUFFER_BIT;
|
||||
|
||||
glClear(clear_mask);
|
||||
|
||||
// Mark framebuffer surfaces as dirty
|
||||
|
|
Loading…
Reference in a new issue