svga: fix a crash happening before setting fragment shaders.
authorZack Rusin <zackr@vmware.com>
Wed, 1 Feb 2012 04:12:22 +0000 (23:12 -0500)
committerZack Rusin <zackr@vmware.com>
Wed, 1 Feb 2012 21:34:57 +0000 (16:34 -0500)
In certain situations API's will call pipe->clear which doesn't
require fragment shader, but then we'd try to verify the pipeline
and assume fragment shader was always set. This was leading to
crash when API would just call simple clear's before anything else.

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
src/gallium/drivers/svga/svga_state_need_swtnl.c

index 8c39a4b76f05e0184242bef5c39402eef622ecec..32355d136cde4da2a6ad376f065731ea3b532d0a 100644 (file)
@@ -145,7 +145,8 @@ update_need_pipeline( struct svga_context *svga,
     */
    if (svga->curr.reduced_prim == PIPE_PRIM_POINTS) {
       unsigned sprite_coord_gen = svga->curr.rast->templ.sprite_coord_enable;
-      unsigned generic_inputs = svga->curr.fs->generic_inputs;
+      unsigned generic_inputs =
+         svga->curr.fs ? svga->curr.fs->generic_inputs : 0;
 
       if (sprite_coord_gen &&
           (generic_inputs & ~sprite_coord_gen)) {