From 3477f67057f11b3608366f7096f4c6f1c57db509 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Thu, 5 Jan 2017 13:47:15 +0100 Subject: [PATCH] st/mesa: fix a segfault when prog->sh.data is NULL Broken by: st/mesa: get Version from gl_program rather than gl_shader_program Reviewed-by: Samuel Pitoiset --- src/mesa/state_tracker/st_atom_texture.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mesa/state_tracker/st_atom_texture.c b/src/mesa/state_tracker/st_atom_texture.c index 58e753d..76e512f 100644 --- a/src/mesa/state_tracker/st_atom_texture.c +++ b/src/mesa/state_tracker/st_atom_texture.c @@ -123,11 +123,13 @@ update_textures(struct st_context *st, struct pipe_sampler_view *sampler_view = NULL; if (samplers_used & 1) { + /* prog->sh.data is NULL if it's ARB_fragment_program */ + unsigned glsl_version = prog->sh.data ? prog->sh.data->Version : 0; const GLuint texUnit = prog->SamplerUnits[unit]; GLboolean retval; retval = update_single_texture(st, &sampler_view, texUnit, - prog->sh.data->Version); + glsl_version); if (retval == GL_FALSE) continue; -- 2.7.4