Mesa (master): softpipe/gs: fix a crash when a gs isn't present

Zack Rusin zack at kemper.freedesktop.org
Tue Jun 15 06:12:30 PDT 2010


Module: Mesa
Branch: master
Commit: 92e521a79982f19279f72c34772d33c9c28e2bed
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=92e521a79982f19279f72c34772d33c9c28e2bed

Author: Zack Rusin <zackr at vmware.com>
Date:   Tue Jun 15 06:12:56 2010 -0400

softpipe/gs: fix a crash when a gs isn't present

---

 src/gallium/drivers/softpipe/sp_state_sampler.c |   36 ++++++++++++----------
 1 files changed, 20 insertions(+), 16 deletions(-)

diff --git a/src/gallium/drivers/softpipe/sp_state_sampler.c b/src/gallium/drivers/softpipe/sp_state_sampler.c
index 09b0ffc..79d9516 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 );
       }
    }
 



More information about the mesa-commit mailing list