OpenGL: Set default values for dynamic states before clear

This patch fixes a bug on the OpenGL backend by setting default values
for dynamic states (blend color, viewport, scissor rectangle, etc) before
clearing the attachments of the render pass so that the full area of the
attachments can be cleared correctly.

BUG=dawn:126, dawn:137, dawn:141
TEST=dawn_end2end_tests

Change-Id: I9ddf74a67413ed51f83a69a3dc2c2377a0622cac
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/7080
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
Jiawei Shao
2019-05-08 23:59:03 +00:00
committed by Commit Bot service account
parent f112ceca34
commit 974a150327
2 changed files with 7 additions and 14 deletions

View File

@@ -680,6 +680,13 @@ namespace dawn_native { namespace opengl {
}
}
// Set defaults for dynamic state before executing clears and commands.
PersistentPipelineState persistentPipelineState;
persistentPipelineState.SetDefaultState();
glBlendColor(0, 0, 0, 0);
glViewport(0, 0, renderPass->width, renderPass->height);
glScissor(0, 0, renderPass->width, renderPass->height);
// Clear framebuffer attachments as needed
{
for (uint32_t i : IterateBitSet(renderPass->colorAttachmentsSet)) {
@@ -725,17 +732,9 @@ namespace dawn_native { namespace opengl {
RenderPipeline* lastPipeline = nullptr;
uint64_t indexBufferBaseOffset = 0;
PersistentPipelineState persistentPipelineState;
PushConstantTracker pushConstants;
InputBufferTracker inputBuffers;
// Set defaults for dynamic state
persistentPipelineState.SetDefaultState();
glBlendColor(0, 0, 0, 0);
glViewport(0, 0, renderPass->width, renderPass->height);
glScissor(0, 0, renderPass->width, renderPass->height);
Command type;
while (mCommands.NextCommandId(&type)) {
switch (type) {