Skip to content

Compute shaders produce wrong result when multiplying infinity with a variable #620

@wpmed92

Description

@wpmed92

Describe the bug

Compute shaders produce wrong result when multiplying infinity with a number, if that number is not known at compile time.

To Reproduce

Reproducible example:
https://gist.github.com/wpmed92/c045e98fdb5916670c31383096706406

Observed behavior

The result of the repro compute shader is all zeroes, whereas it should be all infs. (positive number multiplied by positive infinity)
If I modify the shader to just pass through pos_inf, the result is correct. If I modify the multiplication to multiply inf by a const, the result is also correct. The result is only incorrect, if I multiply by a variable that is not known at compile time.

Your environment

Chip: Apple M1 Pro
OS: 14.4.1 (23E224)
Backend: Metal
Python version: Python 3.8.10
wgpu version: wgpu 0.18.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions