rspirv
rspirv copied to clipboard
LiftContext::convert struggles with linked multi-stage SPIRV
The two test shaders are identical.
#version 460
void main(){}
$ glslc test.vert -o vert.spv
$ glslc test.frag -o frag.spv
$ spirv-link vert.spv frag.spv -o test.spv
$ cargo run rspirv-test vert.spv frag.spv test.spv
vert.spv: success
frag.spv: success
thread 'main' panicked at 'Id 1 is already used', /home/incertia/.cargo/registry/src/github.com-1ecc6299db9ec823/rspirv-0.7.0/lift/storage.rs:42:35
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
We have a simple test driver that attempts to convert modules.
use rspirv::dr::*;
use rspirv::lift::*;
use std::env;
use std::fs::read;
fn main() {
for file in env::args().skip(1) {
match read(&file) {
Ok(spv) => match load_bytes(spv) {
Ok(module) => match LiftContext::convert(&module) {
Ok(module) => {
println!("{}: success", file);
}
Err(e) => {
println!("{}: {:?}", file, e);
}
},
Err(e) => {
println!("{}: {}", file, e);
}
},
Err(e) => {
println!("{}: {}", file, e);
}
}
}
}
spirv-dis does not report anything out of the ordinary.
$ spirv-dis test.spv
; SPIR-V
; Version: 1.0
; Generator: Khronos; 17
; Bound: 8
; Schema: 0
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %main "main"
OpEntryPoint Fragment %main_0 "main"
OpExecutionMode %main_0 OriginUpperLeft
OpSource GLSL 460
OpSourceExtension "GL_GOOGLE_cpp_style_line_directive"
OpSourceExtension "GL_GOOGLE_include_directive"
OpSource GLSL 460
OpSourceExtension "GL_GOOGLE_cpp_style_line_directive"
OpSourceExtension "GL_GOOGLE_include_directive"
OpName %main "main"
OpName %main_0 "main"
%void = OpTypeVoid
%5 = OpTypeFunction %void
%main = OpFunction %void None %5
%6 = OpLabel
OpReturn
OpFunctionEnd
%main_0 = OpFunction %void None %5
%7 = OpLabel
OpReturn
OpFunctionEnd
I'm not quite sure why we are attempting to create ID 1 twice.