gl: don't rename inputs/outputs

This commit is contained in:
chyyran 2022-11-24 02:24:05 -05:00
parent 6d11323520
commit cb8af115c7
3 changed files with 12 additions and 13 deletions

View file

@ -702,21 +702,18 @@ impl CompileShader<GLSL> for CrossReflect<glsl::Target> {
let fragment_resources = self.fragment.get_shader_resources()?;
for res in &vertex_resources.stage_inputs {
let location = self.vertex.get_decoration(res.id, Decoration::Location)?;
self.vertex
.set_name(res.id, &format!("LIBRA_ATTRIBUTE_{location}"))?;
self.vertex.unset_decoration(res.id, Decoration::Location)?;
}
for res in &vertex_resources.stage_outputs {
let location = self.vertex.get_decoration(res.id, Decoration::Location)?;
self.vertex
.set_name(res.id, &format!("LIBRA_VARYING_{location}"))?;
// let location = self.vertex.get_decoration(res.id, Decoration::Location)?;
// self.vertex
// .set_name(res.id, &format!("LIBRA_VARYING_{location}"))?;
self.vertex.unset_decoration(res.id, Decoration::Location)?;
}
for res in &fragment_resources.stage_inputs {
let location = self.fragment.get_decoration(res.id, Decoration::Location)?;
self.fragment
.set_name(res.id, &format!("LIBRA_VARYING_{location}"))?;
// let location = self.fragment.get_decoration(res.id, Decoration::Location)?;
// self.fragment
// .set_name(res.id, &format!("LIBRA_VARYING_{location}"))?;
self.fragment
.unset_decoration(res.id, Decoration::Location)?;
}

View file

@ -381,14 +381,16 @@ impl FilterChain {
gl::AttachShader(program, vertex);
gl::AttachShader(program, fragment);
for res in &vertex_resources.stage_inputs {
for res in vertex_resources.stage_inputs {
let loc = glsl
.context
.compiler
.vertex
.get_decoration(res.id, Decoration::Location)?;
let loc_name = format!("LIBRA_ATTRIBUTE_{loc}\0");
gl::BindAttribLocation(program, loc, loc_name.as_str().as_ptr().cast())
let mut name = res.name;
name.push('\0');
gl::BindAttribLocation(program, loc, name.as_str().as_ptr().cast())
}
gl::LinkProgram(program);
gl::DeleteShader(vertex);

View file

@ -27,7 +27,7 @@ mod tests {
fn triangle_gl() {
let (glfw, window, events, shader, vao) = hello_triangle::setup();
let mut filter =
FilterChain::load_from_path("../test/slang-shaders/crt/crt-royale.slangp")
FilterChain::load_from_path("../test/slang-shaders/vhs/VHSPro.slangp")
.unwrap();
hello_triangle::do_loop(glfw, window, events, shader, vao, &mut filter);
}