From cb8af115c7e81c3688ab0cb33f2fea57b2ea3136 Mon Sep 17 00:00:00 2001 From: chyyran Date: Thu, 24 Nov 2022 02:24:05 -0500 Subject: [PATCH] gl: don't rename inputs/outputs --- librashader-reflect/src/reflect/cross.rs | 15 ++++++--------- librashader-runtime-gl/src/filter_chain.rs | 8 +++++--- librashader-runtime-gl/src/lib.rs | 2 +- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/librashader-reflect/src/reflect/cross.rs b/librashader-reflect/src/reflect/cross.rs index d4b6d1a..a3ff9a7 100644 --- a/librashader-reflect/src/reflect/cross.rs +++ b/librashader-reflect/src/reflect/cross.rs @@ -702,21 +702,18 @@ impl CompileShader for CrossReflect { 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)?; } diff --git a/librashader-runtime-gl/src/filter_chain.rs b/librashader-runtime-gl/src/filter_chain.rs index ef4d73b..7197524 100644 --- a/librashader-runtime-gl/src/filter_chain.rs +++ b/librashader-runtime-gl/src/filter_chain.rs @@ -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); diff --git a/librashader-runtime-gl/src/lib.rs b/librashader-runtime-gl/src/lib.rs index d4a7054..b9e8837 100644 --- a/librashader-runtime-gl/src/lib.rs +++ b/librashader-runtime-gl/src/lib.rs @@ -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); }