mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-06-25 16:03:38 +00:00
Validate EndPass isn't called more than once.
BUG=chromium:918254 Change-Id: I24db2f459bae7c0644a54472e56159ff8f5ab955 Reviewed-on: https://dawn-review.googlesource.com/c/3621 Reviewed-by: Kai Ninomiya <kainino@chromium.org> Reviewed-by: Yunchao He <yunchao.he@intel.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
parent
ac67fec1c9
commit
110bc7918f
@ -29,6 +29,10 @@ namespace dawn_native {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ProgrammablePassEncoder::EndPass() {
|
void ProgrammablePassEncoder::EndPass() {
|
||||||
|
if (mTopLevelBuilder->ConsumedError(ValidateCanRecordCommands())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
mTopLevelBuilder->PassEnded();
|
mTopLevelBuilder->PassEnded();
|
||||||
mAllocator = nullptr;
|
mAllocator = nullptr;
|
||||||
}
|
}
|
||||||
|
@ -85,6 +85,52 @@ TEST_F(CommandBufferValidationTest, EndedMidComputePass) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Test that a render pass cannot be ended twice
|
||||||
|
TEST_F(CommandBufferValidationTest, RenderPassEndedTwice) {
|
||||||
|
dawn::RenderPassDescriptor renderpass = CreateSimpleRenderPass();
|
||||||
|
|
||||||
|
// Control case, pass is ended once
|
||||||
|
{
|
||||||
|
dawn::CommandBufferBuilder builder = AssertWillBeSuccess(device.CreateCommandBufferBuilder());
|
||||||
|
dawn::RenderPassEncoder pass = builder.BeginRenderPass(renderpass);
|
||||||
|
pass.EndPass();
|
||||||
|
builder.GetResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Error case, pass ended twice
|
||||||
|
{
|
||||||
|
dawn::CommandBufferBuilder builder = AssertWillBeError(device.CreateCommandBufferBuilder());
|
||||||
|
dawn::RenderPassEncoder pass = builder.BeginRenderPass(renderpass);
|
||||||
|
pass.EndPass();
|
||||||
|
// TODO(cwallez@chromium.org) this should probably be a device error, but currently it
|
||||||
|
// produces a builder error.
|
||||||
|
pass.EndPass();
|
||||||
|
builder.GetResult();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Test that a compute pass cannot be ended twice
|
||||||
|
TEST_F(CommandBufferValidationTest, ComputePassEndedTwice) {
|
||||||
|
// Control case, pass is ended once.
|
||||||
|
{
|
||||||
|
dawn::CommandBufferBuilder builder = AssertWillBeSuccess(device.CreateCommandBufferBuilder());
|
||||||
|
dawn::ComputePassEncoder pass = builder.BeginComputePass();
|
||||||
|
pass.EndPass();
|
||||||
|
builder.GetResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Error case, pass ended twice
|
||||||
|
{
|
||||||
|
dawn::CommandBufferBuilder builder = AssertWillBeError(device.CreateCommandBufferBuilder());
|
||||||
|
dawn::ComputePassEncoder pass = builder.BeginComputePass();
|
||||||
|
pass.EndPass();
|
||||||
|
// TODO(cwallez@chromium.org) this should probably be a device error, but currently it
|
||||||
|
// produces a builder error.
|
||||||
|
pass.EndPass();
|
||||||
|
builder.GetResult();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Test that using a single buffer in multiple read usages in the same pass is allowed.
|
// Test that using a single buffer in multiple read usages in the same pass is allowed.
|
||||||
TEST_F(CommandBufferValidationTest, BufferWithMultipleReadUsage) {
|
TEST_F(CommandBufferValidationTest, BufferWithMultipleReadUsage) {
|
||||||
// Create a buffer used as both vertex and index buffer.
|
// Create a buffer used as both vertex and index buffer.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user