mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-16 16:37:08 +00:00
Validate CommmandBuffers aren't ended mid pass.
Also adds regression tests. BUG=chromium:914566 BUG=chromium:914641 Change-Id: Ic1f9f2440580c3598831c8b2d1310e81aa944133 Reviewed-on: https://dawn-review.googlesource.com/c/3321 Reviewed-by: Austin Eng <enga@chromium.org> Reviewed-by: Kai Ninomiya <kainino@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
e018292bed
commit
28c1fba1c0
@@ -25,10 +25,11 @@ TEST_F(CommandBufferValidationTest, Empty) {
|
||||
.GetResult();
|
||||
}
|
||||
|
||||
// Tests for basic render pass usage
|
||||
TEST_F(CommandBufferValidationTest, RenderPass) {
|
||||
auto renderpass = CreateSimpleRenderPass();
|
||||
// Test that a command buffer cannot be ended mid render pass
|
||||
TEST_F(CommandBufferValidationTest, EndedMidRenderPass) {
|
||||
dawn::RenderPassDescriptor renderpass = CreateSimpleRenderPass();
|
||||
|
||||
// Control case, command buffer ended after the pass is ended.
|
||||
{
|
||||
dawn::CommandBufferBuilder builder = AssertWillBeSuccess(device.CreateCommandBufferBuilder());
|
||||
dawn::RenderPassEncoder pass = builder.BeginRenderPass(renderpass);
|
||||
@@ -36,11 +37,52 @@ TEST_F(CommandBufferValidationTest, RenderPass) {
|
||||
builder.GetResult();
|
||||
}
|
||||
|
||||
// Error case, command buffer ended mid-pass.
|
||||
{
|
||||
dawn::CommandBufferBuilder builder = AssertWillBeError(device.CreateCommandBufferBuilder());
|
||||
dawn::RenderPassEncoder pass = builder.BeginRenderPass(renderpass);
|
||||
builder.GetResult();
|
||||
}
|
||||
|
||||
// Error case, command buffer ended mid-pass. Trying to use encoders after GetResult
|
||||
// should fail too.
|
||||
{
|
||||
dawn::CommandBufferBuilder builder = AssertWillBeError(device.CreateCommandBufferBuilder());
|
||||
dawn::RenderPassEncoder pass = builder.BeginRenderPass(renderpass);
|
||||
builder.GetResult();
|
||||
// TODO(cwallez@chromium.org) this should probably be a device error, but currently it
|
||||
// produces a builder error.
|
||||
pass.EndPass();
|
||||
}
|
||||
}
|
||||
|
||||
// Test that a command buffer cannot be ended mid compute pass
|
||||
TEST_F(CommandBufferValidationTest, EndedMidComputePass) {
|
||||
// Control case, command buffer ended after the pass is ended.
|
||||
{
|
||||
dawn::CommandBufferBuilder builder = AssertWillBeSuccess(device.CreateCommandBufferBuilder());
|
||||
dawn::ComputePassEncoder pass = builder.BeginComputePass();
|
||||
pass.EndPass();
|
||||
builder.GetResult();
|
||||
}
|
||||
|
||||
// Error case, command buffer ended mid-pass.
|
||||
{
|
||||
dawn::CommandBufferBuilder builder = AssertWillBeError(device.CreateCommandBufferBuilder());
|
||||
dawn::ComputePassEncoder pass = builder.BeginComputePass();
|
||||
builder.GetResult();
|
||||
}
|
||||
|
||||
// Error case, command buffer ended mid-pass. Trying to use encoders after GetResult
|
||||
// should fail too.
|
||||
{
|
||||
dawn::CommandBufferBuilder builder = AssertWillBeError(device.CreateCommandBufferBuilder());
|
||||
dawn::ComputePassEncoder pass = builder.BeginComputePass();
|
||||
builder.GetResult();
|
||||
// TODO(cwallez@chromium.org) this should probably be a device error, but currently it
|
||||
// produces a builder error.
|
||||
pass.EndPass();
|
||||
}
|
||||
}
|
||||
|
||||
// Test that using a single buffer in multiple read usages in the same pass is allowed.
|
||||
|
||||
Reference in New Issue
Block a user