Closed Bug 1985191 Opened 1 year ago Closed 1 year ago

WGSL: `atan2(2.0, 0.0)` results in a validation error

Categories

(Core :: Graphics: WebGPU, defect, P2)

defect

Tracking

()

RESOLVED FIXED

People

(Reporter: ErichDonGubler, Unassigned)

References

Details

Steps to reproduce

  1. Obtain a GPUDevice and call its createShaderModule method, like the following:

    const code = `
    fn do_thing() -> f32 {
      return atan2(0.0, -1.0);
    }`
    
    const adapter = await navigator.gpu.requestAdapter()
    const device = await adapter.requestDevice()
    device.createShaderModule({ code })
    

    Observe that the following error is returned in the web console:

    23:56:43.053 Uncaptured WebGPU error: Shader module creation failed: Shader validation error
    23:56:43.053
    Encountered one or more errors while creating shader module
    23:56:43.053
    WebGPU compilation info for shader module (1 error(s), 0 warning(s), 0 info)
    23:56:43.053
    
    Shader validation error: Function [0] 'do_thing' is invalid
      ┌─ :2:1
      │  
    2 │ ╭ fn do_thing() -> f32 {
    3 │ │   return atan2(0.0, -1.0);
      │ │                ^^^ naga::ir::Expression [0]
      │ ╰──────────────────────────^ naga::ir::Function [0]
      │  
      = Expression [0] is invalid
      = Abstract types may only appear in constant expressions
    

    I expect that this snippet run without any errors.

Priority: -- → P2
Summary: WGSL: `atan(2.0, 0.0)` results in a validation error → WGSL: `atan2(2.0, 0.0)` results in a validation error
Depends on: 1991551
No longer depends on: webgpu-update-wgpu

Confirmed fixed just now in my Firefox Nightly web console. 😀

Status: NEW → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.