Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Firestar99 opened this issue Jan 27, 2025 · 2 comments · May be fixed by #213
Open

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

Firestar99 opened this issue Jan 27, 2025 · 2 comments · May be fixed by #213
Labels
bug Something isn't working

Comments

@Firestar99
Copy link
Member

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

@Firestar99 Firestar99 added the bug Something isn't working label Jan 27, 2025
@LegNeato
Copy link
Collaborator

Here is the code:

Yeah, doesn't look right 🤔

@Firestar99
Copy link
Member Author

Firestar99 commented Jan 29, 2025

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

@Firestar99 Firestar99 linked a pull request Jan 29, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants