From 92af243a273f16f508046ff18e3123727c73be38 Mon Sep 17 00:00:00 2001 From: jp9000 Date: Tue, 19 Apr 2016 19:40:55 -0700 Subject: [PATCH] libobs-opengl: Fix bug with texelFetch shader intrinsic This is supposed to assign -1 to the sampler_id to indicate that no sampler need be assigned for the texture, but instead it was leaving the variable with uninitialized data, resulting in a crash when used. --- libobs-opengl/gl-shaderparser.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libobs-opengl/gl-shaderparser.c b/libobs-opengl/gl-shaderparser.c index 39f7f9f4a..61f19dc4c 100644 --- a/libobs-opengl/gl-shaderparser.c +++ b/libobs-opengl/gl-shaderparser.c @@ -312,11 +312,12 @@ static inline bool gl_write_texture_call(struct gl_shader_parser *glsp, if (!cf_next_token(cfp)) return false; sampler_id = sp_getsampler(glsp, cfp->cur_token); if (sampler_id == (size_t) -1) return false; - var->gl_sampler_id = sampler_id; if (!cf_next_token(cfp)) return false; if (!cf_token_is(cfp, ",")) return false; } + var->gl_sampler_id = sampler_id; + dstr_cat(&glsp->gl_string, call); dstr_cat(&glsp->gl_string, "("); dstr_cat(&glsp->gl_string, var->name);