-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add support for leading_zeros and trailing_zeros, panics during linking
- Loading branch information
1 parent
6e2c84d
commit 702cb97
Showing
4 changed files
with
88 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Test all trailing and leading zeros. No need to test ones, they just call the zero variant with !value | ||
|
||
// build-pass | ||
|
||
use spirv_std::spirv; | ||
|
||
#[spirv(fragment)] | ||
pub fn leading_zeros_u32( | ||
#[spirv(descriptor_set = 0, binding = 0, storage_buffer)] buffer: &u32, | ||
out: &mut u32, | ||
) { | ||
*out = u32::leading_zeros(*buffer); | ||
} | ||
|
||
#[spirv(fragment)] | ||
pub fn trailing_zeros_u32( | ||
#[spirv(descriptor_set = 0, binding = 0, storage_buffer)] buffer: &u32, | ||
out: &mut u32, | ||
) { | ||
*out = u32::trailing_zeros(*buffer); | ||
} | ||
|
||
#[spirv(fragment)] | ||
pub fn leading_zeros_i32( | ||
#[spirv(descriptor_set = 0, binding = 0, storage_buffer)] buffer: &i32, | ||
out: &mut u32, | ||
) { | ||
*out = i32::leading_zeros(*buffer); | ||
} | ||
|
||
#[spirv(fragment)] | ||
pub fn trailing_zeros_i32( | ||
#[spirv(descriptor_set = 0, binding = 0, storage_buffer)] buffer: &i32, | ||
out: &mut u32, | ||
) { | ||
*out = i32::trailing_zeros(*buffer); | ||
} |