Add query availability tracking in render pass encoder

The same query cannot be written twice in same render pass, so each
render pass also need to have its own query availability map.

Update timestamp query to only check the same query overwrite in same
render pass.

Bug: dawn:434
Change-Id: Icb070adf79a3d76c25367675f7432666eb0dd84f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/31180
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Hao Li <hao.x.li@intel.com>
This commit is contained in:
Hao Li
2020-11-16 02:24:06 +00:00
committed by Commit Bot service account
parent aabde6c88f
commit 575729e8dd
8 changed files with 91 additions and 86 deletions

View File

@@ -120,14 +120,6 @@ TEST_F(TimestampQueryValidationTest, WriteTimestampOnCommandEncoder) {
ASSERT_DEVICE_ERROR(encoder.Finish());
}
// Fail to write timestamp to the same index twice on command encoder
{
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
encoder.WriteTimestamp(timestampQuerySet, 0);
encoder.WriteTimestamp(timestampQuerySet, 0);
ASSERT_DEVICE_ERROR(encoder.Finish());
}
// Fail to submit timestamp query with a destroyed query set
{
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
@@ -172,26 +164,6 @@ TEST_F(TimestampQueryValidationTest, WriteTimestampOnComputePassEncoder) {
ASSERT_DEVICE_ERROR(encoder.Finish());
}
// Fail to write timestamp to the same index twice on compute encoder
{
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
wgpu::ComputePassEncoder pass = encoder.BeginComputePass();
pass.WriteTimestamp(timestampQuerySet, 0);
pass.WriteTimestamp(timestampQuerySet, 0);
pass.EndPass();
ASSERT_DEVICE_ERROR(encoder.Finish());
}
// Fail to write timestamp to the same index twice on command encoder and compute encoder
{
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
encoder.WriteTimestamp(timestampQuerySet, 0);
wgpu::ComputePassEncoder pass = encoder.BeginComputePass();
pass.WriteTimestamp(timestampQuerySet, 0);
pass.EndPass();
ASSERT_DEVICE_ERROR(encoder.Finish());
}
// Fail to submit timestamp query with a destroyed query set
{
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
@@ -240,23 +212,36 @@ TEST_F(TimestampQueryValidationTest, WriteTimestampOnRenderPassEncoder) {
ASSERT_DEVICE_ERROR(encoder.Finish());
}
// Fail to write timestamp to the same index twice on command encoder and render encoder
{
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass);
pass.WriteTimestamp(timestampQuerySet, 0);
pass.WriteTimestamp(timestampQuerySet, 0);
pass.EndPass();
ASSERT_DEVICE_ERROR(encoder.Finish());
}
// Fail to write timestamp to the same index twice on command encoder and render encoder
// Success to write timestamp to the same query index twice on command encoder and render
// encoder
{
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
encoder.WriteTimestamp(timestampQuerySet, 0);
wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass);
pass.WriteTimestamp(timestampQuerySet, 0);
pass.EndPass();
encoder.Finish();
}
// Success to write timestamp to the same query index twice on different render encoder
{
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
wgpu::RenderPassEncoder pass0 = encoder.BeginRenderPass(&renderPass);
pass0.WriteTimestamp(timestampQuerySet, 0);
pass0.EndPass();
wgpu::RenderPassEncoder pass1 = encoder.BeginRenderPass(&renderPass);
pass1.WriteTimestamp(timestampQuerySet, 0);
pass1.EndPass();
encoder.Finish();
}
// Fail to write timestamp to the same query index twice on same render encoder
{
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass);
pass.WriteTimestamp(timestampQuerySet, 0);
pass.WriteTimestamp(timestampQuerySet, 0);
pass.EndPass();
ASSERT_DEVICE_ERROR(encoder.Finish());
}