r300: A bit more cleanup and state handling.
authorCorbin Simpson <MostAwesomeDude@gmail.com>
Wed, 4 Feb 2009 08:50:38 +0000 (00:50 -0800)
committerCorbin Simpson <MostAwesomeDude@gmail.com>
Wed, 4 Feb 2009 08:50:38 +0000 (00:50 -0800)
src/gallium/drivers/r300/r300_context.h
src/gallium/drivers/r300/r300_state.c

index 0cb0ec20d5316734f8347b64fb3661847da3febe..e0aad660184a9684b854e2830fff09bbf6d9f6fb 100644 (file)
@@ -87,15 +87,17 @@ struct r300_scissor_state {
 struct r300_texture_state {
 };
 
-#define R300_NEW_BLEND           0x0001
-#define R300_NEW_BLEND_COLOR     0x0002
-#define R300_NEW_DSA             0x0004
-#define R300_NEW_FRAGMENT_SHADER 0x0008
-#define R300_NEW_RASTERIZER      0x0010
-#define R300_NEW_SAMPLER         0x0020
-#define R300_NEW_SCISSOR         0x2000
-#define R300_NEW_VERTEX_SHADER   0x4000
-#define R300_NEW_KITCHEN_SINK    0x7fff
+#define R300_NEW_BLEND           0x000001
+#define R300_NEW_BLEND_COLOR     0x000002
+#define R300_NEW_DSA             0x000004
+#define R300_NEW_FRAMEBUFFERS    0x000008
+#define R300_NEW_FRAGMENT_SHADER 0x000010
+#define R300_NEW_RASTERIZER      0x000020
+#define R300_NEW_SAMPLER         0x000040
+#define R300_NEW_SCISSOR         0x004000
+#define R300_NEW_TEXTURE         0x008000
+#define R300_NEW_VERTEX_SHADER   0x800000
+#define R300_NEW_KITCHEN_SINK    0xffffff
 
 struct r300_texture {
     /* Parent class */
index 6bb8379dd5d0c5a868ae526f2d06ea0b6b7e112d..b4b50ce1a9ca19299ffc4c446c091b5949d8e9f5 100644 (file)
@@ -394,7 +394,7 @@ static void
 
     r300->framebuffer_state = *state;
 
-    /* XXX do we need to mark dirty state? */
+    r300->dirty_state |= R300_NEW_FRAMEBUFFERS;
 }
 
 /* Create fragment shader state. */
@@ -428,31 +428,6 @@ static void r300_set_polygon_stipple(struct pipe_context* pipe,
     /* XXX */
 }
 
-#if 0
-struct pipe_rasterizer_state
-{
-    unsigned flatshade:1;
-    unsigned light_twoside:1;
-    unsigned fill_cw:2;        /**< PIPE_POLYGON_MODE_x */
-    unsigned fill_ccw:2;       /**< PIPE_POLYGON_MODE_x */
-    unsigned scissor:1;
-    unsigned poly_smooth:1;
-    unsigned poly_stipple_enable:1;
-    unsigned point_smooth:1;
-    unsigned point_sprite:1;
-    unsigned multisample:1;         /* XXX maybe more ms state in future */
-    unsigned line_smooth:1;
-    unsigned line_last_pixel:1;
-    unsigned bypass_clipping:1;
-    unsigned bypass_vs:1; /**< Skip the vertex shader.  Note that the shader is
-    still needed though, to indicate inputs/outputs */
-    unsigned origin_lower_left:1;  /**< Is (0,0) the lower-left corner? */
-    unsigned flatshade_first:1;   /**< take color attribute from the first vertex of a primitive */
-    unsigned gl_rasterization_rules:1; /**< enable tweaks for GL rasterization?  */
-    ubyte sprite_coord_mode[PIPE_MAX_SHADER_OUTPUTS]; /**< PIPE_SPRITE_COORD_ */
-};
-#endif
-
 static INLINE int pack_float_16_6x(float f) {
     return ((int)(f * 6.0) & 0xffff);
 }
@@ -693,15 +668,16 @@ static void r300_set_sampler_textures(struct pipe_context* pipe,
         if (r300->textures[i] != (struct r300_texture*)texture[i]) {
             pipe_texture_reference((struct pipe_texture**)&r300->textures[i],
                 texture[i]);
-            /* XXX NEW_TEXTURE instead? */
-            r300->dirty_state |= (R300_NEW_SAMPLER << i);
+            r300->dirty_state |= (R300_NEW_TEXTURE << i);
         }
     }
 
     for (i = count; i < 8; i++) {
-        /* XXX also state change? */
-        pipe_texture_reference((struct pipe_texture**)&r300->textures[i],
-            NULL);
+        if (r300->textures[i]) {
+            pipe_texture_reference((struct pipe_texture**)&r300->textures[i],
+                NULL);
+            r300->dirty_state |= (R300_NEW_TEXTURE << i);
+        }
     }
 
     r300->texture_count = count;