Skip to content

[naga] [msl-out] Error: as_type cast from 'long' to 'metal::uint' (aka 'unsigned int') is not allowed #7435

@LegNeato

Description

@LegNeato

Description

When compiling this code with rust-gpu, I get valid spirv asm. I then pass it to naga to translate to metal (as I am on macOS) and I get these errors:

                        float _e11563 = function_119(metal::float2(_e7495 * 7.6543, _e7496 * 7.6543));
                              ^
program_source:16276:67: error: as_type cast from 'long' to 'metal::uint' (aka 'unsigned int') is not allowed
                    int _e13236 = as_type<int>(as_type<uint>(1) + as_type<uint>((_e13226 == _e13226) ? ((_e13226 > as_type<float>(1325400063u)) ? 2147483647 : ((_e13226 < as_type<float>(3472883712u)) ? -2147483648 : naga_f2i32(_e13226))) : 0));
                                                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
program_source:16304:67: error: as_type cast from 'long' to 'metal::uint' (aka 'unsigned int') is not allowed
                    int _e13273 = as_type<int>(as_type<uint>(1) + as_type<uint>((_e13263 == _e13263) ? ((_e13263 > as_type<float>(1325400063u)) ? 2147483647 : ((_e13263 < as_type<float>(3472883712u)) ? -2147483648 : naga_f2i32(_e13263))) : 0));
                                                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Repro steps
It's a bit convoluted...

  1. Checkout Update deps Rust-GPU/rust-gpu-shadertoys#33
  2. Patch in Reduce repo MSRV from 1.85 to 1.84 #7425
  3. In build.rs, remove the check that turns it off on macos or in shaders/lib.rs, delete everything in the match except 21 => filtering_procedurals::Inputs

I'll work on getting the raw spirv.

Note I tested with the change from #7422 by @jamienicol and it still was not fixed.

Expected vs observed behavior
The shader to translate to metal code that compiles.

Platform
macOS, latest master of wgpu

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions