diff --git a/src/dawn_native/ComputePassEncoder.cpp b/src/dawn_native/ComputePassEncoder.cpp index 05c68fb11c..c12c15a6bf 100644 --- a/src/dawn_native/ComputePassEncoder.cpp +++ b/src/dawn_native/ComputePassEncoder.cpp @@ -295,14 +295,6 @@ namespace dawn_native { DAWN_TRY(ValidateCanUseAs(indirectBuffer, wgpu::BufferUsage::Indirect)); DAWN_TRY(mCommandBufferState.ValidateCanDispatch()); - // Indexed dispatches need a compute-shader based validation to check that the - // dispatch sizes aren't too big. Disallow them as unsafe until the validation - // is implemented. - DAWN_INVALID_IF( - GetDevice()->IsToggleEnabled(Toggle::DisallowUnsafeAPIs), - "DispatchIndirect is disallowed because it doesn't validate that the " - "dispatch size is valid yet."); - DAWN_INVALID_IF(indirectOffset % 4 != 0, "Indirect offset (%u) is not a multiple of 4.", indirectOffset); diff --git a/src/tests/unittests/validation/UnsafeAPIValidationTests.cpp b/src/tests/unittests/validation/UnsafeAPIValidationTests.cpp index 624305b015..8d0e9f7a6d 100644 --- a/src/tests/unittests/validation/UnsafeAPIValidationTests.cpp +++ b/src/tests/unittests/validation/UnsafeAPIValidationTests.cpp @@ -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;