Impl RenderPassEncoder::SetViewport: add more tests

This patch meant to add tests for SetViewport to verify that the
viewport we set in one render pass will not impact the viewport(s)
in other render pass(es).

These newly added tests exposed a potential error on OpenGL backend.

This patch also implemented SetViewport and fixed the bug on OpenGL.

BUG=dawn:53, dawn:189
TEST=dawn_end2end_tests

Change-Id: Ia2e74f003c02acdcf983b24a3386efab30793652
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9140
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
This commit is contained in:
Yunchao He
2019-07-18 16:17:34 +00:00
committed by Commit Bot service account
parent 1546bfbdec
commit 91ec571d17
2 changed files with 69 additions and 22 deletions

View File

@@ -655,6 +655,7 @@ namespace dawn_native { namespace opengl {
persistentPipelineState.SetDefaultState(gl);
gl.BlendColor(0, 0, 0, 0);
gl.Viewport(0, 0, renderPass->width, renderPass->height);
gl.DepthRangef(0.0, 1.0);
gl.Scissor(0, 0, renderPass->width, renderPass->height);
// Clear framebuffer attachments as needed
@@ -808,6 +809,13 @@ namespace dawn_native { namespace opengl {
persistentPipelineState.SetStencilReference(gl, cmd->reference);
} break;
case Command::SetViewport: {
SetViewportCmd* cmd = mCommands.NextCommand<SetViewportCmd>();
gl.Viewport(static_cast<int>(cmd->x), static_cast<int>(cmd->y),
static_cast<int>(cmd->width), static_cast<int>(cmd->height));
gl.DepthRangef(cmd->minDepth, cmd->maxDepth);
} break;
case Command::SetScissorRect: {
SetScissorRectCmd* cmd = mCommands.NextCommand<SetScissorRectCmd>();
gl.Scissor(cmd->x, cmd->y, cmd->width, cmd->height);