rt(gl): fix glShaderSource going past the buffer

This commit is contained in:
chyyran 2024-09-08 11:19:14 -04:00 committed by Ronny Chan
parent a7dd40a79f
commit 075a2981e1
3 changed files with 7 additions and 6 deletions

View file

@ -1,4 +1,4 @@
use gl::types::{GLenum, GLuint};
use gl::types::{GLenum, GLint, GLuint};
use crate::error;
use crate::error::FilterChainError;
@ -6,12 +6,13 @@ use librashader_reflect::back::glsl::GlslVersion;
pub unsafe fn gl_compile_shader(stage: GLenum, source: &str) -> error::Result<GLuint> {
let (shader, compile_status) = unsafe {
let lens = [source.len() as GLint];
let shader = gl::CreateShader(stage);
gl::ShaderSource(
shader,
1,
&source.as_bytes().as_ptr().cast(),
std::ptr::null(),
&source.as_ptr().cast(),
lens.as_ptr(),
);
gl::CompileShader(shader);
let mut compile_status = 0;

View file

@ -30,8 +30,8 @@ fn triangle_gl46() {
let mut filter = FilterChainGL::load_from_path(
// "../test/slang-shaders/vhs/VHSPro.slangp",
// "../test/slang-shaders/test/history.slangp",
"../test/shaders_slang/crt/crt-royale.slangp",
// "../test/shadersslang/bezel/Mega_Bezel/Presets/MBZ__0__SMOOTH-ADV.slangp",
// "../test/shaders_slang/crt/crt-royale.slangp",
"../test/shaders_slang/bezel/Mega_Bezel/Presets/MBZ__0__SMOOTH-ADV.slangp",
Some(&FilterChainOptionsGL {
glsl_version: 0,
use_dsa: true,

@ -1 +1 @@
Subproject commit e04aa575febae5927db6b445a3c47b8f4221df78
Subproject commit 24f9468e2ef254fa91464939bc73aa63ce4aedf4