svga: test register W component in emit_kil()
[mesa.git] / src / gallium / drivers / svga / svga_state_fs.c
index 1310fd9825fa8a71d7f686cf0107fce422b331c7..349aa275f188f391624e7d09ff7eda74c13b42a8 100644 (file)
@@ -76,7 +76,7 @@ static enum pipe_error compile_fs( struct svga_context *svga,
 
    result = svga_translate_fragment_program( fs, key );
    if (result == NULL) {
-      ret = PIPE_ERROR_OUT_OF_MEMORY;
+      ret = PIPE_ERROR;  /* some problem during translation */
       goto fail;
    }
 
@@ -131,13 +131,12 @@ static int make_fs_key( const struct svga_context *svga,
       /* SVGA_NEW_RAST
        */
       key->light_twoside = svga->curr.rast->templ.light_twoside;
-      key->front_cw = (svga->curr.rast->templ.front_winding == 
-                       PIPE_WINDING_CW);
+      key->front_ccw = svga->curr.rast->templ.front_ccw;
    }
 
    /* The blend workaround for simulating logicop xor behaviour
     * requires that the incoming fragment color be white.  This change
-    * achieves that by creating a varient of the current fragment
+    * achieves that by creating a variant of the current fragment
     * shader that overrides all output colors with 1,1,1,1
     *   
     * This will work for most shaders, including those containing
@@ -168,6 +167,11 @@ static int make_fs_key( const struct svga_context *svga,
             key->tex[i].unnormalized = TRUE;
             ++key->num_unnormalized_coords;
          }
+
+         key->tex[i].swizzle_r = svga->curr.sampler_views[i]->swizzle_r;
+         key->tex[i].swizzle_g = svga->curr.sampler_views[i]->swizzle_g;
+         key->tex[i].swizzle_b = svga->curr.sampler_views[i]->swizzle_b;
+         key->tex[i].swizzle_a = svga->curr.sampler_views[i]->swizzle_a;
       }
    }
    key->num_textures = svga->curr.num_sampler_views;
@@ -180,6 +184,15 @@ static int make_fs_key( const struct svga_context *svga,
       }
    }
 
+   /* sprite coord gen state */
+   for (i = 0; i < svga->curr.num_samplers; ++i) {
+      key->tex[i].sprite_texgen =
+         svga->curr.rast->templ.sprite_coord_enable & (1 << i);
+   }
+
+   key->sprite_origin_lower_left = (svga->curr.rast->templ.sprite_coord_mode
+                                    == PIPE_SPRITE_COORD_LOWER_LEFT);
+
    return 0;
 }