Revert "r300g: add generating texture coordinates for point sprites (WIP)"
authorCorbin Simpson <MostAwesomeDude@gmail.com>
Fri, 26 Mar 2010 11:15:53 +0000 (04:15 -0700)
committerCorbin Simpson <MostAwesomeDude@gmail.com>
Fri, 26 Mar 2010 11:15:53 +0000 (04:15 -0700)
This reverts commit cba6430524198a1bdcdeada03cbe946a454f3935.

Breaks celestia with a hardlock. :T

We really need to sit down and study texture stuffing further.

src/gallium/drivers/r300/r300_context.c
src/gallium/drivers/r300/r300_context.h
src/gallium/drivers/r300/r300_emit.c
src/gallium/drivers/r300/r300_state.c
src/gallium/drivers/r300/r300_state_derived.c
src/gallium/drivers/r300/r300_state_invariant.c

index 4433dcf..4b470b2 100644 (file)
@@ -195,8 +195,6 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
 
     r300_setup_atoms(r300);
 
-    r300->sprite_coord_index = -1;
-
     /* Open up the OQ BO. */
     r300->oqbo = screen->buffer_create(screen, 4096,
             PIPE_BUFFER_USAGE_PIXEL, 4096);
index 4bb3852..eb9178a 100644 (file)
@@ -99,16 +99,6 @@ struct r300_rs_state {
     uint32_t line_stipple_value;    /* R300_GA_LINE_STIPPLE_VALUE: 0x4260 */
     uint32_t color_control;         /* R300_GA_COLOR_CONTROL: 0x4278 */
     uint32_t polygon_mode;          /* R300_GA_POLY_MODE: 0x4288 */
-
-    /* Specifies top of Raster pipe specific enable controls,
-     * i.e. texture coordinates stuffing for points, lines, triangles */
-    uint32_t stuffing_enable;       /* R300_GB_ENABLE: 0x4008 */
-
-    /* Point sprites texture coordinates, 0: lower left, 1: upper right */
-    float point_texcoord_left;      /* R300_GA_POINT_S0: 0x4200 */
-    float point_texcoord_bottom;    /* R300_GA_POINT_T0: 0x4204 */
-    float point_texcoord_right;     /* R300_GA_POINT_S1: 0x4208 */
-    float point_texcoord_top;       /* R300_GA_POINT_T1: 0x420c */
 };
 
 struct r300_rs_block {
@@ -387,9 +377,6 @@ struct r300_context {
     uint32_t zbuffer_bpp;
     /* Whether scissor is enabled. */
     boolean scissor_enabled;
-    /* Point sprites texcoord index, -1 = unused. */
-    int sprite_coord_index;
-
     /* upload managers */
     struct u_upload_mgr *upload_vb;
     struct u_upload_mgr *upload_ib;
index 796e3ec..92266ba 100644 (file)
@@ -614,12 +614,6 @@ void r300_emit_rs_state(struct r300_context* r300, unsigned size, void* state)
     OUT_CS_REG(R300_GA_LINE_STIPPLE_CONFIG, rs->line_stipple_config);
     OUT_CS_REG(R300_GA_LINE_STIPPLE_VALUE, rs->line_stipple_value);
     OUT_CS_REG(R300_GA_POLY_MODE, rs->polygon_mode);
-    OUT_CS_REG(R300_GB_ENABLE, rs->stuffing_enable);
-    OUT_CS_REG_SEQ(R300_GA_POINT_S0, 4);
-    OUT_CS_32F(rs->point_texcoord_left);
-    OUT_CS_32F(rs->point_texcoord_bottom);
-    OUT_CS_32F(rs->point_texcoord_right);
-    OUT_CS_32F(rs->point_texcoord_top);
     END_CS;
 }
 
index 31e3211..8e92854 100644 (file)
@@ -714,7 +714,6 @@ static void* r300_create_rs_state(struct pipe_context* pipe,
 {
     struct r300_screen* r300screen = r300_screen(pipe->screen);
     struct r300_rs_state* rs = CALLOC_STRUCT(r300_rs_state);
-    unsigned coord_index;
 
     /* Copy rasterizer state for Draw. */
     rs->rs = *state;
@@ -807,32 +806,6 @@ static void* r300_create_rs_state(struct pipe_context* pipe,
         rs->color_control = R300_SHADE_MODEL_SMOOTH;
     }
 
-    /* Point sprites */
-    if (state->sprite_coord_enable) {
-        coord_index = ffs(state->sprite_coord_enable)-1;
-
-        SCREEN_DBG(r300screen, DBG_DRAW,
-                   "r300: point sprite: shader coord=%d\n", coord_index);
-
-        rs->stuffing_enable =
-            R300_GB_POINT_STUFF_ENABLE |
-            R300_GB_TEX_ST << (R300_GB_TEX0_SOURCE_SHIFT + (coord_index*2));
-
-        rs->point_texcoord_left = 0.0f;
-        rs->point_texcoord_right = 1.0f;
-
-        switch (state->sprite_coord_mode) {
-            case PIPE_SPRITE_COORD_UPPER_LEFT:
-                rs->point_texcoord_top = 0.0f;
-                rs->point_texcoord_bottom = 1.0f;
-                break;
-            case PIPE_SPRITE_COORD_LOWER_LEFT:
-                rs->point_texcoord_top = 1.0f;
-                rs->point_texcoord_bottom = 0.0f;
-                break;
-        }
-    }
-
     return (void*)rs;
 }
 
@@ -842,7 +815,6 @@ static void r300_bind_rs_state(struct pipe_context* pipe, void* state)
     struct r300_context* r300 = r300_context(pipe);
     struct r300_rs_state* rs = (struct r300_rs_state*)state;
     boolean scissor_was_enabled = r300->scissor_enabled;
-    int last_sprite_coord_index = r300->sprite_coord_index;
 
     if (r300->draw) {
         draw_flush(r300->draw);
@@ -852,22 +824,17 @@ static void r300_bind_rs_state(struct pipe_context* pipe, void* state)
     if (rs) {
         r300->polygon_offset_enabled = rs->rs.offset_cw || rs->rs.offset_ccw;
         r300->scissor_enabled = rs->rs.scissor;
-        r300->sprite_coord_index = ffs(rs->rs.sprite_coord_enable)-1;
     } else {
         r300->polygon_offset_enabled = FALSE;
         r300->scissor_enabled = FALSE;
-        r300->sprite_coord_index = -1;
     }
 
     UPDATE_STATE(state, r300->rs_state);
-    r300->rs_state.size = 24 + (r300->polygon_offset_enabled ? 5 : 0);
+    r300->rs_state.size = 17 + (r300->polygon_offset_enabled ? 5 : 0);
 
     if (scissor_was_enabled != r300->scissor_enabled) {
         r300->scissor_state.dirty = TRUE;
     }
-    if (last_sprite_coord_index != r300->sprite_coord_index) {
-        r300->rs_block_state.dirty = TRUE;
-    }
 }
 
 /* Free rasterizer state. */
index 8178d55..3560b6e 100644 (file)
@@ -178,8 +178,7 @@ static void r300_update_rs_block(struct r300_context* r300,
 
     /* Rasterize texture coordinates. */
     for (i = 0; i < ATTR_GENERIC_COUNT; i++) {
-        if (vs_outputs->generic[i] != ATTR_UNUSED ||
-            r300->sprite_coord_index == i) {
+        if (vs_outputs->generic[i] != ATTR_UNUSED) {
             /* Always rasterize if it's written by the VS,
              * otherwise it locks up. */
             rX00_rs_tex(&rs, tex_count, tex_count, FALSE);
@@ -187,8 +186,6 @@ static void r300_update_rs_block(struct r300_context* r300,
             /* Write it to the FS input register if it's used by the FS. */
             if (fs_inputs->generic[i] != ATTR_UNUSED) {
                 rX00_rs_tex_write(&rs, tex_count, fp_offset);
-                if (r300->sprite_coord_index == i)
-                    debug_printf("r300: SpriteCoord (generic index %i) is being written to reg %i\n", i, fp_offset);
                 fp_offset++;
             }
             tex_count++;
index 2d9a63d..4a2c682 100644 (file)
@@ -44,9 +44,13 @@ void r300_emit_invariant_state(struct r300_context* r300,
     struct r300_capabilities* caps = r300_screen(r300->context.screen)->caps;
     CS_LOCALS(r300);
 
-    BEGIN_CS(12 + (caps->has_tcl ? 2: 0));
+    BEGIN_CS(14 + (caps->has_tcl ? 2: 0));
 
     /*** Graphics Backend (GB) ***/
+    /* Various GB enables */
+    OUT_CS_REG(R300_GB_ENABLE, R300_GB_POINT_STUFF_ENABLE |
+                               R300_GB_LINE_STUFF_ENABLE  |
+                               R300_GB_TRIANGLE_STUFF_ENABLE);
     /* Subpixel multisampling for AA
      * These are commented out because glisse's CS checker doesn't like them.
      * I presume these will be re-enabled later.
@@ -74,7 +78,7 @@ void r300_emit_invariant_state(struct r300_context* r300,
     END_CS;
 
     /* XXX unsorted stuff from surface_fill */
-    BEGIN_CS(40 + (caps->has_tcl ? 7 : 0) +
+    BEGIN_CS(44 + (caps->has_tcl ? 7 : 0) +
              (caps->family >= CHIP_FAMILY_RV350 ? 4 : 0));
 
     if (caps->has_tcl) {
@@ -86,6 +90,11 @@ void r300_emit_invariant_state(struct r300_context* r300,
         OUT_CS_32F(1.0);
         OUT_CS_32F(1.0);
     }
+    /* XXX point tex stuffing */
+    OUT_CS_REG_SEQ(R300_GA_POINT_S0, 1);
+    OUT_CS_32F(0.0);
+    OUT_CS_REG_SEQ(R300_GA_POINT_S1, 1);
+    OUT_CS_32F(1.0);
     /* XXX line tex stuffing */
     OUT_CS_REG_SEQ(R300_GA_LINE_S0, 1);
     OUT_CS_32F(0.0);