Don't skip draw calls on zero-sized viewports.
If transform feedback is active, primitives still need to be rendered even
if no pixels are written to the framebuffer.
Instead of checking for active transform feedback, simply remove the draw
call skipping optimization since it is most likely an application mistake to
draw with a zero sized viewport and we shouldn't optimize for this case.
This change doesn't affect the clear calls because the viewport is set to the
framebuffer size which is non-zero.
BUG=angle:743
Change-Id: I04af9d6de5aad3040e3c6b3c24990e107e21ad36
Reviewed-on: https://chromium-review.googlesource.com/218508
Reviewed-by: Brandon Jones <bajones@chromium.org>
Reviewed-by: Shannon Woods <shannonwoods@chromium.org>
Tested-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libGLESv2/Context.cpp b/src/libGLESv2/Context.cpp
index eb71e71..f2852b0 100644
--- a/src/libGLESv2/Context.cpp
+++ b/src/libGLESv2/Context.cpp
@@ -1325,7 +1325,7 @@
// Applies the render target surface, depth stencil surface, viewport rectangle and
// scissor rectangle to the renderer
-bool Context::applyRenderTarget(GLenum drawMode, bool ignoreViewport)
+void Context::applyRenderTarget(GLenum drawMode, bool ignoreViewport)
{
Framebuffer *framebufferObject = mState.getDrawFramebuffer();
ASSERT(framebufferObject && framebufferObject->completeness() == GL_FRAMEBUFFER_COMPLETE);
@@ -1334,15 +1334,10 @@
float nearZ, farZ;
mState.getDepthRange(&nearZ, &farZ);
- if (!mRenderer->setViewport(mState.getViewport(), nearZ, farZ, drawMode, mState.getRasterizerState().frontFace,
- ignoreViewport))
- {
- return false;
- }
+ mRenderer->setViewport(mState.getViewport(), nearZ, farZ, drawMode, mState.getRasterizerState().frontFace,
+ ignoreViewport);
mRenderer->setScissorRectangle(mState.getScissor(), mState.isScissorTestEnabled());
-
- return true;
}
// Applies the fixed-function state (culling, depth test, alpha blending, stenciling, etc) to the Direct3D 9 device
@@ -1561,10 +1556,7 @@
ClearParameters clearParams = mState.getClearParameters(mask);
- if (!applyRenderTarget(GL_TRIANGLES, true)) // Clips the clear to the scissor rectangle but not the viewport
- {
- return Error(GL_NO_ERROR);
- }
+ applyRenderTarget(GL_TRIANGLES, true); // Clips the clear to the scissor rectangle but not the viewport
return mRenderer->clear(clearParams, mState.getDrawFramebuffer());
}
@@ -1595,10 +1587,7 @@
clearParams.depthClearValue = values[0];
}
- if (!applyRenderTarget(GL_TRIANGLES, true)) // Clips the clear to the scissor rectangle but not the viewport
- {
- return Error(GL_NO_ERROR);
- }
+ applyRenderTarget(GL_TRIANGLES, true); // Clips the clear to the scissor rectangle but not the viewport
return mRenderer->clear(clearParams, mState.getDrawFramebuffer());
}
@@ -1619,10 +1608,7 @@
clearParams.colorUIClearValue = ColorUI(values[0], values[1], values[2], values[3]);
clearParams.colorClearType = GL_UNSIGNED_INT;
- if (!applyRenderTarget(GL_TRIANGLES, true)) // Clips the clear to the scissor rectangle but not the viewport
- {
- return Error(GL_NO_ERROR);
- }
+ applyRenderTarget(GL_TRIANGLES, true); // Clips the clear to the scissor rectangle but not the viewport
return mRenderer->clear(clearParams, mState.getDrawFramebuffer());
}
@@ -1653,10 +1639,7 @@
clearParams.stencilClearValue = values[1];
}
- if (!applyRenderTarget(GL_TRIANGLES, true)) // Clips the clear to the scissor rectangle but not the viewport
- {
- return Error(GL_NO_ERROR);
- }
+ applyRenderTarget(GL_TRIANGLES, true); // Clips the clear to the scissor rectangle but not the viewport
return mRenderer->clear(clearParams, mState.getDrawFramebuffer());
}
@@ -1675,10 +1658,7 @@
clearParams.clearStencil = true;
clearParams.stencilClearValue = stencil;
- if (!applyRenderTarget(GL_TRIANGLES, true)) // Clips the clear to the scissor rectangle but not the viewport
- {
- return Error(GL_NO_ERROR);
- }
+ applyRenderTarget(GL_TRIANGLES, true); // Clips the clear to the scissor rectangle but not the viewport
return mRenderer->clear(clearParams, mState.getDrawFramebuffer());
}
@@ -1721,11 +1701,7 @@
return;
}
- if (!applyRenderTarget(mode, false))
- {
- return;
- }
-
+ applyRenderTarget(mode, false);
applyState(mode);
GLenum err = mRenderer->applyVertexBuffer(programBinary, mState.getVertexArray()->getVertexAttributes(), mState.getVertexAttribCurrentValues(), first, count, instances);
@@ -1787,11 +1763,7 @@
return;
}
- if (!applyRenderTarget(mode, false))
- {
- return;
- }
-
+ applyRenderTarget(mode, false);
applyState(mode);
VertexArray *vao = mState.getVertexArray();