-
Notifications
You must be signed in to change notification settings - Fork 86
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Expected Behaviour
no crash when using bool / Option(bool) (note: in particular, the bug was observed when using iterators over bool)
Example & Steps To Reproduce
This code fail to compile:
#![cfg_attr(target_arch = "spirv", no_std)]
use spirv_std::glam::UVec3;
use spirv_std::spirv;
#[spirv(compute(threads(64)))]
pub fn main_cs(
#[spirv(global_invocation_id)] id: UVec3,
#[spirv(storage_buffer, descriptor_set = 0, binding = 0)] buffer: &mut [u32],
) {
let mut t =test();
buffer[1] += t.next().unwrap() as u32;
}
struct T{}
#[inline(never)]
pub fn test()->impl Iterator<Item = bool>{
T{}
}
impl Iterator for T {
type Item=bool;
fn next(&mut self) -> Option<Self::Item> {
return Some(true);
}
}The relevant part of the error
error: error:0:0 - Expected Result Type to be a pointer or int or float vector or scalar type: Bitcast
%40 = OpBitcast %bool %33
NB: the error also happen the other way arround (cast from bool to char).
It also seem that these cast force to use the Capability::Int8 when no Int8 is used in similar cases
System Info
- Rust: rustc 1.90.0-nightly
- OS: artix linux with kernel 6.17.8-artix1-1
- GPU: NVIDIA Corporation GA102 [GeForce RTX 3080 Ti]
- SPIR-V: SPIRV-Tools v2025.4 v2025.4-0-g7f2d9ee92
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working