r300g: fix gl_PointCoord
authorMarek Olšák <maraeo@gmail.com>
Wed, 25 Aug 2010 02:55:01 +0000 (04:55 +0200)
committerMarek Olšák <maraeo@gmail.com>
Wed, 25 Aug 2010 02:57:11 +0000 (04:57 +0200)
Is this hackish or is this the correct way to use point_quad_rasterization?
Copied from nvfx.

src/gallium/drivers/r300/r300_state.c

index 3e35d7ab285c71490998f0b945af596f6d1cd1f5..47e359cd5f56dcf465ff4cb9b6f42652bb66065c 100644 (file)
@@ -950,6 +950,11 @@ static void* r300_create_rs_state(struct pipe_context* pipe,
     rs->rs = *state;
     rs->rs_draw = *state;
 
+    /* Generate point sprite texture coordinates in GENERIC0
+     * if point_quad_rasterization is TRUE. */
+    rs->rs.sprite_coord_enable = state->point_quad_rasterization *
+                                 (state->sprite_coord_enable | 1);
+
     /* Override some states for Draw. */
     rs->rs_draw.sprite_coord_enable = 0; /* We can do this in HW. */
 
@@ -1051,10 +1056,10 @@ static void* r300_create_rs_state(struct pipe_context* pipe,
 
     /* Point sprites */
     stuffing_enable = 0;
-    if (state->sprite_coord_enable) {
+    if (rs->rs.sprite_coord_enable) {
         stuffing_enable = R300_GB_POINT_STUFF_ENABLE;
         for (i = 0; i < 8; i++) {
-            if (state->sprite_coord_enable & (1 << i))
+            if (rs->rs.sprite_coord_enable & (1 << i))
                 stuffing_enable |=
                     R300_GB_TEX_ST << (R300_GB_TEX0_SOURCE_SHIFT + (i*2));
         }