This repository was archived by the owner on Oct 31, 2025. It is now read-only.

Description
Example & Steps To Reproduce
Passing a structure containing two Vec3s to a closure results in the following error message:
error: Pointer operand 435[%435] must be a memory object declaration
%436 = OpFunctionCall %void %sdf_shader__main_fs___closure_0_ %429 %435
|
= note: module "/Users/lachlansneff/dev/sdf/target/spirv-builder/spirv-unknown-unknown/release/deps/sdf_shader.spv"
warning: internal error
|
= note: spirv-opt failed, leaving as unoptimized
= note: module "/Users/lachlansneff/dev/sdf/target/spirv-builder/spirv-unknown-unknown/release/deps/sdf_shader.spv"
error: invalid id:0:0 - Pointer operand 435[%435] must be a memory object declaration
%436 = OpFunctionCall %void %sdf_shader__main_fs___closure_0_ %429 %435
|
= note: spirv-val failed
= note: module "/Users/lachlansneff/dev/sdf/target/spirv-builder/spirv-unknown-unknown/release/deps/sdf_shader.spv"
A way to repro is with the following code:
struct Foo {
a: Vec3,
b: Vec3,
}
fn bar(f: impl Fn(Foo)) {
f(Foo { a: Vec3::zero(), b: Vec3::zero() })
}
#[spirv(fragment)]
pub fn main_fs(_: Output<Vec4>) {
bar(|_| {});
}
System Info
- Rust: rustc 1.51.0-nightly (257becbfe 2020-12-27)
- OS: macOS 10.15.6