mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-15 08:06:19 +00:00
Unmark DispatchIndirect as an unsafe API
Validation is now implemented. end2end_tests added in https://dawn-review.googlesource.com/c/dawn/+/67142 CTS tests enabled in https://chromium-review.googlesource.com/c/chromium/src/+/3254613 Fixed: dawn:1039 Change-Id: I03ae6bba4f11d6fa0aa2a83f3b6d72aa43c5e2df Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/68040 Reviewed-by: Brandon Jones <bajones@chromium.org> Reviewed-by: Loko Kung <lokokung@google.com> Commit-Queue: Austin Eng <enga@chromium.org>
This commit is contained in:
@@ -28,46 +28,6 @@ class UnsafeAPIValidationTest : public ValidationTest {
|
||||
}
|
||||
};
|
||||
|
||||
// Check that DispatchIndirect is disallowed as part of unsafe APIs.
|
||||
TEST_F(UnsafeAPIValidationTest, DispatchIndirectDisallowed) {
|
||||
// Create the index and indirect buffers.
|
||||
wgpu::BufferDescriptor indirectBufferDesc;
|
||||
indirectBufferDesc.size = 64;
|
||||
indirectBufferDesc.usage = wgpu::BufferUsage::Indirect;
|
||||
wgpu::Buffer indirectBuffer = device.CreateBuffer(&indirectBufferDesc);
|
||||
|
||||
// Create the dummy compute pipeline.
|
||||
wgpu::ComputePipelineDescriptor pipelineDesc;
|
||||
pipelineDesc.compute.entryPoint = "main";
|
||||
pipelineDesc.compute.module =
|
||||
utils::CreateShaderModule(device, "[[stage(compute), workgroup_size(1)]] fn main() {}");
|
||||
wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&pipelineDesc);
|
||||
|
||||
// Control case: dispatch is allowed.
|
||||
{
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
wgpu::ComputePassEncoder pass = encoder.BeginComputePass();
|
||||
|
||||
pass.SetPipeline(pipeline);
|
||||
pass.Dispatch(1, 1, 1);
|
||||
|
||||
pass.EndPass();
|
||||
encoder.Finish();
|
||||
}
|
||||
|
||||
// Error case: dispatch indirect is disallowed.
|
||||
{
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
wgpu::ComputePassEncoder pass = encoder.BeginComputePass();
|
||||
|
||||
pass.SetPipeline(pipeline);
|
||||
pass.DispatchIndirect(indirectBuffer, 0);
|
||||
|
||||
pass.EndPass();
|
||||
ASSERT_DEVICE_ERROR(encoder.Finish());
|
||||
}
|
||||
}
|
||||
|
||||
// Check that dynamic storage buffers are disallowed.
|
||||
TEST_F(UnsafeAPIValidationTest, DynamicStorageBuffer) {
|
||||
wgpu::BindGroupLayoutEntry entry;
|
||||
|
||||
Reference in New Issue
Block a user