From 92e521a79982f19279f72c34772d33c9c28e2bed Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Tue, 15 Jun 2010 06:12:56 -0400 Subject: softpipe/gs: fix a crash when a gs isn't present --- src/gallium/drivers/softpipe/sp_state_sampler.c | 36 ++++++++++++++----------- 1 file changed, 20 insertions(+), 16 deletions(-) (limited to 'src') 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 ); } } -- cgit v1.2.3