Generate an error if scissor rect is empty

We need to change related tests in end2end_tests and unittests.

Bug=dawn:127
TEST=dawn_end2end_tests, dawn_unittests

Change-Id: I523d4eeb930990b5db381544b228d2f11912049b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/6240
Commit-Queue: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Yunchao He
2019-04-02 07:42:18 +00:00
committed by Commit Bot service account
parent 8e50ba19ba
commit 2a30e14074
3 changed files with 25 additions and 29 deletions

View File

@@ -30,17 +30,35 @@ TEST_F(SetScissorRectTest, Success) {
encoder.Finish();
}
// Test to check that an empty scissor is allowed
// Test to check that an empty scissor is not allowed
TEST_F(SetScissorRectTest, EmptyScissor) {
DummyRenderPass renderPass(device);
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
// Width of scissor rect is zero.
{
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass);
pass.SetScissorRect(0, 0, 0, 1);
pass.EndPass();
}
ASSERT_DEVICE_ERROR(encoder.Finish());
// Height of scissor rect is zero.
{
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass);
pass.SetScissorRect(0, 0, 1, 0);
pass.EndPass();
}
ASSERT_DEVICE_ERROR(encoder.Finish());
// Both width and height of scissor rect are zero.
{
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass);
pass.SetScissorRect(0, 0, 0, 0);
pass.EndPass();
}
encoder.Finish();
ASSERT_DEVICE_ERROR(encoder.Finish());
}
// Test to check that a scissor larger than the framebuffer is allowed