dawn_native: Make executeBundle of 0 bundles clear state

This was changed in WebGPU to make the behavior more consistent. See
https://github.com/gpuweb/gpuweb/pull/1373

Bug:
Change-Id: Icd5f6964a8bc58fdebe7c1a79d4353e6a1a52231
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38844
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
This commit is contained in:
Corentin Wallez 2021-01-27 18:41:44 +00:00 committed by Commit Bot service account
parent a28c44bf36
commit c57be50d9c
2 changed files with 3 additions and 8 deletions

View File

@ -147,12 +147,7 @@ namespace dawn_native {
case Command::ExecuteBundles: { case Command::ExecuteBundles: {
ExecuteBundlesCmd* cmd = commands->NextCommand<ExecuteBundlesCmd>(); ExecuteBundlesCmd* cmd = commands->NextCommand<ExecuteBundlesCmd>();
commands->NextData<Ref<RenderBundleBase>>(cmd->count); commands->NextData<Ref<RenderBundleBase>>(cmd->count);
commandBufferState = CommandBufferStateTracker{};
if (cmd->count > 0) {
// Reset state. It is invalidated after render bundle execution.
commandBufferState = CommandBufferStateTracker{};
}
break; break;
} }

View File

@ -501,7 +501,7 @@ TEST_F(RenderBundleValidationTest, ClearsState) {
ASSERT_DEVICE_ERROR(commandEncoder.Finish()); ASSERT_DEVICE_ERROR(commandEncoder.Finish());
} }
// Test executing 0 bundles does not clear command buffer state. // Test executing 0 bundles still clears command buffer state.
{ {
wgpu::CommandEncoder commandEncoder = device.CreateCommandEncoder(); wgpu::CommandEncoder commandEncoder = device.CreateCommandEncoder();
wgpu::RenderPassEncoder pass = commandEncoder.BeginRenderPass(&renderPass); wgpu::RenderPassEncoder pass = commandEncoder.BeginRenderPass(&renderPass);
@ -514,7 +514,7 @@ TEST_F(RenderBundleValidationTest, ClearsState) {
pass.Draw(3); pass.Draw(3);
pass.EndPass(); pass.EndPass();
commandEncoder.Finish(); ASSERT_DEVICE_ERROR(commandEncoder.Finish());
} }
} }