Commit fdb376ea by Charlie Lao Committed by Commit Bot

Vulkan: minimize-gpu-work: Skip blit from offscreen fbo

Since we only care about driver state tracking logic, blit is unrelated here. This further reduce the noise of test result. Instead of blit and swap every N frame, we will issue glFlush for offscreen rendering. The onscreen will still issue swap every frame. Bug: b/186881553 Change-Id: Id048eaafa6dcef26d851fd19f069331d240e1bf5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2846527 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarIan Elliott <ianelliott@google.com> Reviewed-by: 's avatarCody Northrop <cnorthrop@google.com>
parent 3fc83291
...@@ -1154,56 +1154,66 @@ void TracePerfTest::drawBenchmark() ...@@ -1154,56 +1154,66 @@ void TracePerfTest::drawBenchmark()
if (params.surfaceType == SurfaceType::Offscreen) if (params.surfaceType == SurfaceType::Offscreen)
{ {
GLint currentDrawFBO, currentReadFBO; if (gMinimizeGPUWork)
glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &currentDrawFBO);
glGetIntegerv(GL_READ_FRAMEBUFFER_BINDING, &currentReadFBO);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
glBindFramebuffer(GL_READ_FRAMEBUFFER,
mOffscreenFramebuffers[mTotalFrameCount % mMaxOffscreenBufferCount]);
uint32_t frameX = (mOffscreenFrameCount % kFramesPerXY) % kFramesPerX;
uint32_t frameY = (mOffscreenFrameCount % kFramesPerXY) / kFramesPerX;
uint32_t windowX = kOffscreenOffsetX + frameX * kOffscreenFrameWidth;
uint32_t windowY = kOffscreenOffsetY + frameY * kOffscreenFrameHeight;
if (gVerboseLogging)
{
printf("Frame %d: x %d y %d (screen x %d, screen y %d)\n", mOffscreenFrameCount, frameX,
frameY, windowX, windowY);
}
GLboolean scissorTest = GL_FALSE;
glGetBooleanv(GL_SCISSOR_TEST, &scissorTest);
if (scissorTest)
{
glDisable(GL_SCISSOR_TEST);
}
glBlitFramebuffer(0, 0, mWindowWidth, mWindowHeight, windowX, windowY,
windowX + kOffscreenFrameWidth, windowY + kOffscreenFrameHeight,
GL_COLOR_BUFFER_BIT, GL_NEAREST);
if (frameX == kFramesPerX - 1 && frameY == kFramesPerY - 1)
{
swap();
glBindFramebuffer(GL_FRAMEBUFFER, 0);
glClear(GL_COLOR_BUFFER_BIT);
mOffscreenFrameCount = 0;
}
else
{ {
// To keep GPU work minimum, we skip the blit.
glFlush(); glFlush();
mOffscreenFrameCount++; mOffscreenFrameCount++;
} }
else
if (scissorTest)
{ {
glEnable(GL_SCISSOR_TEST); GLint currentDrawFBO, currentReadFBO;
glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &currentDrawFBO);
glGetIntegerv(GL_READ_FRAMEBUFFER_BINDING, &currentReadFBO);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
glBindFramebuffer(
GL_READ_FRAMEBUFFER,
mOffscreenFramebuffers[mOffscreenFrameCount % mMaxOffscreenBufferCount]);
uint32_t frameX = (mOffscreenFrameCount % kFramesPerXY) % kFramesPerX;
uint32_t frameY = (mOffscreenFrameCount % kFramesPerXY) / kFramesPerX;
uint32_t windowX = kOffscreenOffsetX + frameX * kOffscreenFrameWidth;
uint32_t windowY = kOffscreenOffsetY + frameY * kOffscreenFrameHeight;
if (gVerboseLogging)
{
printf("Frame %d: x %d y %d (screen x %d, screen y %d)\n", mOffscreenFrameCount,
frameX, frameY, windowX, windowY);
}
GLboolean scissorTest = GL_FALSE;
glGetBooleanv(GL_SCISSOR_TEST, &scissorTest);
if (scissorTest)
{
glDisable(GL_SCISSOR_TEST);
}
glBlitFramebuffer(0, 0, mWindowWidth, mWindowHeight, windowX, windowY,
windowX + kOffscreenFrameWidth, windowY + kOffscreenFrameHeight,
GL_COLOR_BUFFER_BIT, GL_NEAREST);
if (frameX == kFramesPerX - 1 && frameY == kFramesPerY - 1)
{
swap();
glBindFramebuffer(GL_FRAMEBUFFER, 0);
glClear(GL_COLOR_BUFFER_BIT);
mOffscreenFrameCount = 0;
}
else
{
glFlush();
mOffscreenFrameCount++;
}
if (scissorTest)
{
glEnable(GL_SCISSOR_TEST);
}
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, currentDrawFBO);
glBindFramebuffer(GL_READ_FRAMEBUFFER, currentReadFBO);
} }
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, currentDrawFBO);
glBindFramebuffer(GL_READ_FRAMEBUFFER, currentReadFBO);
mTotalFrameCount++; mTotalFrameCount++;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment