reflect: stop adding null bytes to uniform names

This commit is contained in:
chyyran 2024-08-10 13:53:23 -04:00 committed by Ronny Chan
parent 1e0727f89d
commit 77b957bf5e
2 changed files with 4 additions and 5 deletions

View file

@ -146,7 +146,6 @@ impl CompileShader<GLSL> for CrossReflect<targets::Glsl> {
self.fragment self.fragment
.set_decoration(res.id, Decoration::Binding, DecorationValue::unset())?; .set_decoration(res.id, Decoration::Binding, DecorationValue::unset())?;
let mut name = res.name.to_string(); let mut name = res.name.to_string();
name.push('\0');
texture_fixups.push((name, binding)); texture_fixups.push((name, binding));
} }

View file

@ -63,8 +63,8 @@ impl<T: GLInterface> FilterChainImpl<T> {
let offset = meta.offset(); let offset = meta.offset();
if offset.ubo.is_some() { if offset.ubo.is_some() {
let vert_name = format!("LIBRA_UBO_VERTEX_INSTANCE.{}\0", meta.id()); let vert_name = format!("LIBRA_UBO_VERTEX_INSTANCE.{}", meta.id());
let frag_name = format!("LIBRA_UBO_FRAGMENT_INSTANCE.{}\0", meta.id()); let frag_name = format!("LIBRA_UBO_FRAGMENT_INSTANCE.{}", meta.id());
unsafe { unsafe {
let vertex = gl::GetUniformLocation(pipeline, vert_name.as_ptr().cast()); let vertex = gl::GetUniformLocation(pipeline, vert_name.as_ptr().cast());
let fragment = gl::GetUniformLocation(pipeline, frag_name.as_ptr().cast()); let fragment = gl::GetUniformLocation(pipeline, frag_name.as_ptr().cast());
@ -74,8 +74,8 @@ impl<T: GLInterface> FilterChainImpl<T> {
} }
if offset.push.is_some() { if offset.push.is_some() {
let vert_name = format!("LIBRA_PUSH_VERTEX_INSTANCE.{}\0", meta.id()); let vert_name = format!("LIBRA_PUSH_VERTEX_INSTANCE.{}", meta.id());
let frag_name = format!("LIBRA_PUSH_FRAGMENT_INSTANCE.{}\0", meta.id()); let frag_name = format!("LIBRA_PUSH_FRAGMENT_INSTANCE.{}", meta.id());
unsafe { unsafe {
let vertex = gl::GetUniformLocation(pipeline, vert_name.as_ptr().cast()); let vertex = gl::GetUniformLocation(pipeline, vert_name.as_ptr().cast());
let fragment = gl::GetUniformLocation(pipeline, frag_name.as_ptr().cast()); let fragment = gl::GetUniformLocation(pipeline, frag_name.as_ptr().cast());