From: Zack Rusin Date: Tue, 15 Jun 2010 10:12:56 +0000 (-0400) Subject: softpipe/gs: fix a crash when a gs isn't present X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=92e521a79982f19279f72c34772d33c9c28e2bed;p=mesa.git softpipe/gs: fix a crash when a gs isn't present --- diff --git a/src/gallium/drivers/softpipe/sp_state_sampler.c b/src/gallium/drivers/softpipe/sp_state_sampler.c index 09b0ffc1dad..79d9516ad9c 100644 --- a/src/gallium/drivers/softpipe/sp_state_sampler.c +++ b/src/gallium/drivers/softpipe/sp_state_sampler.c @@ -350,23 +350,27 @@ softpipe_reset_sampler_varients(struct softpipe_context *softpipe) } } - for (i = 0; i <= softpipe->gs->max_sampler; i++) { - if (softpipe->geometry_samplers[i]) { - struct pipe_resource *texture = NULL; - - if (softpipe->geometry_sampler_views[i]) { - texture = softpipe->geometry_sampler_views[i]->texture; + if (softpipe->gs) { + for (i = 0; i <= softpipe->gs->max_sampler; i++) { + if (softpipe->geometry_samplers[i]) { + struct pipe_resource *texture = NULL; + + if (softpipe->geometry_sampler_views[i]) { + texture = softpipe->geometry_sampler_views[i]->texture; + } + + softpipe->tgsi.geom_samplers_list[i] = + get_sampler_varient( + i, + sp_sampler(softpipe->geometry_samplers[i]), + texture, + TGSI_PROCESSOR_GEOMETRY ); + + sp_sampler_varient_bind_texture( + softpipe->tgsi.geom_samplers_list[i], + softpipe->geometry_tex_cache[i], + texture ); } - - softpipe->tgsi.geom_samplers_list[i] = - get_sampler_varient( i, - sp_sampler(softpipe->geometry_samplers[i]), - texture, - TGSI_PROCESSOR_GEOMETRY ); - - sp_sampler_varient_bind_texture( softpipe->tgsi.geom_samplers_list[i], - softpipe->geometry_tex_cache[i], - texture ); } }