Only call WillBeginRenderPass when encoder is current
Fixes an ASSERT when a render pass is started while another pass is already current. Bug: chromium:1253090 Change-Id: I085c1de225f9ba30a7f368fad3b1d8a97ed92c63 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65241 Auto-Submit: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org> Reviewed-by: Ken Rockot <rockot@google.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Brandon Jones <bajones@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
parent
e2c74d0b9d
commit
347a597f7d
|
@ -513,7 +513,6 @@ namespace dawn_native {
|
|||
uint32_t width = 0;
|
||||
uint32_t height = 0;
|
||||
Ref<AttachmentState> attachmentState;
|
||||
mEncodingContext.WillBeginRenderPass();
|
||||
bool success =
|
||||
mEncodingContext.TryEncode(this, [&](CommandAllocator* allocator) -> MaybeError {
|
||||
uint32_t sampleCount = 0;
|
||||
|
@ -523,6 +522,7 @@ namespace dawn_native {
|
|||
|
||||
ASSERT(width > 0 && height > 0 && sampleCount > 0);
|
||||
|
||||
mEncodingContext.WillBeginRenderPass();
|
||||
BeginRenderPassCmd* cmd =
|
||||
allocator->Allocate<BeginRenderPassCmd>(Command::BeginRenderPass);
|
||||
|
||||
|
|
|
@ -146,6 +146,31 @@ TEST_F(CommandBufferValidationTest, BeginComputePassBeforeEndPreviousPass) {
|
|||
}
|
||||
}
|
||||
|
||||
// Test that beginning a render pass before ending the previous pass causes an error.
|
||||
TEST_F(CommandBufferValidationTest, BeginRenderPassBeforeEndPreviousPass) {
|
||||
DummyRenderPass dummyRenderPass(device);
|
||||
|
||||
// Beginning a render pass before ending the render pass causes an error.
|
||||
{
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
wgpu::RenderPassEncoder renderPass1 = encoder.BeginRenderPass(&dummyRenderPass);
|
||||
wgpu::RenderPassEncoder renderPass2 = encoder.BeginRenderPass(&dummyRenderPass);
|
||||
renderPass2.EndPass();
|
||||
renderPass1.EndPass();
|
||||
ASSERT_DEVICE_ERROR(encoder.Finish());
|
||||
}
|
||||
|
||||
// Beginning a compute pass before ending a compute pass causes an error.
|
||||
{
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
wgpu::ComputePassEncoder computePass = encoder.BeginComputePass();
|
||||
wgpu::RenderPassEncoder renderPass = encoder.BeginRenderPass(&dummyRenderPass);
|
||||
renderPass.EndPass();
|
||||
computePass.EndPass();
|
||||
ASSERT_DEVICE_ERROR(encoder.Finish());
|
||||
}
|
||||
}
|
||||
|
||||
// Test that encoding command after a successful finish produces an error
|
||||
TEST_F(CommandBufferValidationTest, CallsAfterASuccessfulFinish) {
|
||||
// A buffer that can be used in CopyBufferToBuffer
|
||||
|
|
Loading…
Reference in New Issue