mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
[spv] fix unsigned selector and bitcast
This commit is contained in:
committed by
Dzmitry Malyshau
parent
afbcf05006
commit
7c2f4eac2e
@@ -1555,10 +1555,6 @@ impl Writer {
|
||||
kind,
|
||||
convert,
|
||||
} => {
|
||||
if !convert {
|
||||
return Err(Error::FeatureNotImplemented("bitcast"));
|
||||
}
|
||||
|
||||
let expr_id =
|
||||
self.write_expression(ir_module, ir_function, expr, block, function)?;
|
||||
let expr_kind = self
|
||||
|
||||
@@ -1466,9 +1466,29 @@ impl<I: Iterator<Item = u32>> Parser<I> {
|
||||
inst.expect_at_least(3)?;
|
||||
|
||||
let selector = self.next()?;
|
||||
let selector = self.lookup_expression[&selector].handle;
|
||||
let default = self.next()?;
|
||||
|
||||
let selector_lexp = &self.lookup_expression[&selector];
|
||||
let selector_lty = self.lookup_type.lookup(selector_lexp.type_id)?;
|
||||
let selector = match type_arena[selector_lty.handle].inner {
|
||||
crate::TypeInner::Scalar {
|
||||
kind: crate::ScalarKind::Uint,
|
||||
width: _,
|
||||
} => {
|
||||
// IR expects a signed integer, so do a bitcast
|
||||
expressions.append(crate::Expression::As {
|
||||
kind: crate::ScalarKind::Sint,
|
||||
expr: selector_lexp.handle,
|
||||
convert: false,
|
||||
})
|
||||
}
|
||||
crate::TypeInner::Scalar {
|
||||
kind: crate::ScalarKind::Sint,
|
||||
width: _,
|
||||
} => selector_lexp.handle,
|
||||
ref other => unimplemented!("Unexpected selector {:?}", other),
|
||||
};
|
||||
|
||||
let mut targets = Vec::new();
|
||||
for _ in 0..(inst.wc - 3) / 2 {
|
||||
let literal = self.next()?;
|
||||
|
||||
Reference in New Issue
Block a user