Skip to content

UVec min/max operations require Int8 capability in SPIR-V #314

Closed
@LegNeato

Description

@LegNeato

When using min() or max() methods on UVec types (UVec2, UVec3, UVec4)
in rust-gpu, the SPIR-V compiler emits an error requiring the Int8
capability:

  error: Missing required capabilities for types
    |
    = note: i8 type used without OpCapability Int8

Minimal reproduction:

use spirv_std::glam::UVec4;

let uv4 = UVec4::new(1, 2, 3, 4);
let result = uv4.min(UVec4::new(4, 3, 2, 1)); // Triggers Int8
requirement

Workaround:

Manual component-wise comparison works without requiring Int8:

  let min_x = if uv4.x < other.x { uv4.x } else { other.x };

Expected behavior:

UVec min/max operations should work without requiring the Int8
capability, as the vectors contain u32 values.

Environment:

  • rust-gpu version: master
  • glam version: via spirv-std

This appears to be an issue with how glam's min/max methods are
implemented for SPIR-V targets, possibly using i8 internally for
comparison operations.

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