Closed
Description
#[spirv(fragment)]
pub fn main(mut xs: [f32; 3]) {
xs[0] = 0.0;
}
errors with:
error: error:0:0 - OpStore Pointer <id> '15[%15]' storage class is read-only
OpStore %15 %float_0
|
= note: spirv-val failed
This happens because we're passing the Input
OpVariable
pointer as the pointer for xs
.
Crucially, those are the semantics of an Operand::Move
call arguments in MIR, transferring ownership from the caller to the callee. That's not correct, the caller doesn't own the global OpVariable
, and should make a local copy (in a Function
-scoped OpVariable
), before passing a pointer to that in the call.
For MIR calls, this is where that's implemented, and we pretty much have to do the same dance (note that OperandValue::Ref(_).store(dest)
does a memcpy
).
Metadata
Metadata
Assignees
Labels
No labels