I am using rust gpu to compile shaders. rust-gpu generates a single spirv for all stages. I am having the following issue I have this shader:
#![deny(warnings)]
mod shared;
extern crate spirv_std;
extern crate bytemuck;
use shared::glam::{Vec4, Vec3};
use spirv_std::spirv;
#[spirv(fragment)]
// pub fn main_fs(next_pos: Vec4, output: &mut Vec4)
pub fn main_fs(output: &mut Vec4)
{
// *output = Vec4::new(1.0, 0.0001 * next_pos.x, 0.0, 1.0);
*output = Vec4::new(1.0, 0.0001, 0.0, 1.0);
}
#[spirv(vertex)]
pub fn main_vs(
#[spirv(vertex_index)] vert_id: i32,
#[spirv(uniform, descriptor_set = 1, binding = 0)] toggle: &u32,
#[spirv(position, invariant)] out_pos: &mut Vec4,
position: Vec3,
offset_bind2: Vec3,
n_pos: &mut Vec4,
) {
*out_pos = Vec4::new(
(vert_id - 1) as f32 + (position.x + offset_bind2.x) * 0.000001,
((vert_id & 1) * 2 - 1) as f32,
0.0,
if *toggle == 0 { 1.0 } else { 0.0 },
);
*n_pos = *out_pos;
}
I am then parsing the generated spirv with spirq:
Variable::Output { name, location, ty } =>
{
if entry_point.exec_model != ExecutionModel::Fragment
{
continue;
}
println!("{:?}", ty);
println!("{:?}", name);
println!("{:?}", entry_point.exec_model);
attachment_outputs.push(parse_fragment_output(&ty));
}
Which is printing:
Vector(VectorType { scalar_ty: Float { bits: 32 }, nscalar: 4 })
Some("output")
Fragment
Vector(VectorType { scalar_ty: Float { bits: 32 }, nscalar: 4 })
Some("n_pos")
Fragment
So it seems that spirq is assigning all outputs from all shader stages to each entry point, instead of just those defined for that entry point alone.
I am using rust gpu to compile shaders. rust-gpu generates a single spirv for all stages. I am having the following issue I have this shader:
I am then parsing the generated spirv with spirq:
Which is printing:
So it seems that spirq is assigning all outputs from all shader stages to each entry point, instead of just those defined for that entry point alone.