mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Merge pull request #12913 from unknownbrackets/gles-invalidate
Add glInvalidateFramebuffer on clobber
This commit is contained in:
commit
09238edd8e
1 changed files with 38 additions and 0 deletions
|
@ -609,6 +609,44 @@ void GLQueueRunner::RunSteps(const std::vector<GLRStep *> &steps, bool skipGLCal
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto ignoresContents = [](GLRRenderPassAction act) {
|
||||||
|
return act == GLRRenderPassAction::CLEAR || act == GLRRenderPassAction::DONT_CARE;
|
||||||
|
};
|
||||||
|
int invalidateAllMask = GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT;
|
||||||
|
|
||||||
|
for (int j = 0; j < (int)steps.size() - 1; ++j) {
|
||||||
|
GLRStep &primaryStep = *steps[j];
|
||||||
|
if (primaryStep.stepType == GLRStepType::RENDER) {
|
||||||
|
const GLRFramebuffer *fb = primaryStep.render.framebuffer;
|
||||||
|
|
||||||
|
// Let's see if we can invalidate it...
|
||||||
|
int invalidateMask = 0;
|
||||||
|
for (int i = j + 1; i < (int)steps.size(); ++i) {
|
||||||
|
const GLRStep &secondaryStep = *steps[i];
|
||||||
|
if (secondaryStep.stepType == GLRStepType::RENDER && secondaryStep.render.framebuffer == fb) {
|
||||||
|
if (ignoresContents(secondaryStep.render.color))
|
||||||
|
invalidateMask |= GL_COLOR_BUFFER_BIT;
|
||||||
|
if (ignoresContents(secondaryStep.render.depth))
|
||||||
|
invalidateMask |= GL_DEPTH_BUFFER_BIT;
|
||||||
|
if (ignoresContents(secondaryStep.render.stencil))
|
||||||
|
invalidateMask |= GL_STENCIL_BUFFER_BIT;
|
||||||
|
|
||||||
|
if (invalidateMask == invalidateAllMask)
|
||||||
|
break;
|
||||||
|
} else if (secondaryStep.dependencies.contains(fb)) {
|
||||||
|
// Can't do it, this step may depend on fb's data.
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (invalidateMask) {
|
||||||
|
GLRRenderData data{ GLRRenderCommand::INVALIDATE };
|
||||||
|
data.clear.clearMask = invalidateMask;
|
||||||
|
primaryStep.commands.push_back(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
CHECK_GL_ERROR_IF_DEBUG();
|
CHECK_GL_ERROR_IF_DEBUG();
|
||||||
size_t renderCount = 0;
|
size_t renderCount = 0;
|
||||||
for (size_t i = 0; i < steps.size(); i++) {
|
for (size_t i = 0; i < steps.size(); i++) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue