Skip to content

u32::leading_zeros intrinic requires weird extension to work #210

Closed

Description

@Firestar99

Expected Behaviour

Using u32::leading_zeros() in any shader errors with:

error: extension SPV_INTEL_shader_integer_functions2 is required
[...]
note: used from within `<u32>::leading_zeros`

This should not even need some intel-specific extension, that function probably exists already in the GL450 extension. Especially since some hardware (AMD) has special instructions for bit counting.

System Info

rust-gpu master forked from 1932353

Activity

  1. added
    bug
    on Jan 27, 2025
  2. LegNeato commented on Jan 28, 2025

    @LegNeato
    Collaborator

    Here is the code:

    Yeah, doesn't look right 🤔

  3. Firestar99 commented on Jan 29, 2025

    @Firestar99
    MemberAuthor

    I'm having a look at it, it seems like GLSL.std.450 do have FindILsb, FindSMsb and FindUMsb instructions for this. Though they do slightly mismatch what rust expects when 0 is passed and are limited to 32 bits.

    https://registry.khronos.org/SPIR-V/specs/unified1/GLSL.std.450.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions