Fix Test Failure on AMD GL (#6726)

This commit is contained in:
Connor Fitzgerald authored and GitHub committed 2024-12-16 04:13:12 -05:00
1 parent f384a72bf6
commit 7f1e45ff88
2 files changed
+8 -4

No files matched your search

+4 -4
View File
@@ -1,14 +1,14 @@
use wgpu::util::DeviceExt;
use wgpu_test::{gpu_test, GpuTestConfiguration, TestParameters};
/// Running a compute shader with one or more of the workgroup sizes set to 0 implies that no work
/// Running a compute shader with a total workgroup count of zero implies that no work
/// should be done, and is a user error. Vulkan and DX12 accept this invalid input with grace, but
/// Metal does not guard against this and eventually the machine will crash. Since this is a public
/// API that may be given untrusted values in a browser, this must be protected again.
/// Metal and some OpenGL drivers do not guard against this and eventually the machine will crash.
/// Since this is a public API that may be given untrusted values in a browser, this must be protected again.
///
/// The following test should successfully do nothing on all platforms.
#[gpu_test]
static ZERO_WORKGROUP_SIZE: GpuTestConfiguration = GpuTestConfiguration::new()
static ZERO_WORKGROUP_COUNT: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default().limits(wgpu::Limits::default()))
.run_async(|ctx| async move {
let module = ctx
+4
View File
@@ -1177,6 +1177,10 @@ impl crate::CommandEncoder for super::CommandEncoder {
}
unsafe fn dispatch(&mut self, count: [u32; 3]) {
// Empty dispatches are invalid in OpenGL, but valid in WebGPU.
if count.iter().any(|&c| c == 0) {
return;
}
self.cmd_buffer.commands.push(C::Dispatch(count));
}
unsafe fn dispatch_indirect(&mut self, buffer: &super::Buffer, offset: wgt::BufferAddress) {