r300g: move the emission of GA_POINT_MINMAX into emit_fb_state
authorMarek Olšák <maraeo@gmail.com>
Sat, 27 Feb 2010 19:05:00 +0000 (20:05 +0100)
committerMarek Olšák <maraeo@gmail.com>
Sat, 27 Feb 2010 19:09:38 +0000 (20:09 +0100)
The only practical limits are the ones derived from the currently-set
framebuffer state.

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

index 8704f1852937b693c7b4e7f3a2aeec264100d003..ac14e3f0df438abcdcddeaa1d6358a217e12669a 100644 (file)
@@ -86,7 +86,6 @@ struct r300_rs_state {
     uint32_t vap_control_status;    /* R300_VAP_CNTL_STATUS: 0x2140 */
     uint32_t antialiasing_config;   /* R300_GB_AA_CONFIG: 0x4020 */
     uint32_t point_size;            /* R300_GA_POINT_SIZE: 0x421c */
-    uint32_t point_minmax;          /* R300_GA_POINT_MINMAX: 0x4230 */
     uint32_t line_control;          /* R300_GA_LINE_CNTL: 0x4234 */
     float depth_scale;            /* R300_SU_POLY_OFFSET_FRONT_SCALE: 0x42a4 */
                                   /* R300_SU_POLY_OFFSET_BACK_SCALE: 0x42ac */
index 1ea622f8507bab0aeb964b9dc36edb0547c9bb1f..7fc66dd26501ed1ed3859cfa9da5f07307a31c69 100644 (file)
@@ -388,7 +388,7 @@ void r300_emit_fb_state(struct r300_context* r300, void* state)
     CS_LOCALS(r300);
 
     BEGIN_CS((10 * fb->nr_cbufs) + (2 * (4 - fb->nr_cbufs)) +
-             (fb->zsbuf ? 10 : 0) + 6);
+             (fb->zsbuf ? 10 : 0) + 8);
 
     /* Flush and free renderbuffer caches. */
     OUT_CS_REG(R300_RB3D_DSTCACHE_CTLSTAT,
@@ -447,6 +447,8 @@ void r300_emit_fb_state(struct r300_context* r300, void* state)
                      0, RADEON_GEM_DOMAIN_VRAM, 0);
     }
 
+    OUT_CS_REG(R300_GA_POINT_MINMAX,
+        (MAX2(fb->width, fb->height) * 6) << R300_GA_POINT_MINMAX_MAX_SHIFT);
     END_CS;
 }
 
@@ -582,15 +584,13 @@ void r300_emit_rs_state(struct r300_context* r300, void* state)
     float scale, offset;
     CS_LOCALS(r300);
 
-    BEGIN_CS(18 + (rs->polygon_offset_enable ? 5 : 0));
+    BEGIN_CS(17 + (rs->polygon_offset_enable ? 5 : 0));
     OUT_CS_REG(R300_VAP_CNTL_STATUS, rs->vap_control_status);
 
     OUT_CS_REG(R300_GB_AA_CONFIG, rs->antialiasing_config);
 
     OUT_CS_REG(R300_GA_POINT_SIZE, rs->point_size);
-    OUT_CS_REG_SEQ(R300_GA_POINT_MINMAX, 2);
-    OUT_CS(rs->point_minmax);
-    OUT_CS(rs->line_control);
+    OUT_CS_REG(R300_GA_LINE_CNTL, rs->line_control);
 
     if (rs->polygon_offset_enable) {
         scale = rs->depth_scale * 12;
index 2c4beee5ad68b942ca1c6b854a90ead65b86b623..f1f0de1a46365c8bf6f8ccb9545e790183bdc958 100644 (file)
@@ -599,7 +599,7 @@ static void
     memcpy(r300->fb_state.state, state, sizeof(struct pipe_framebuffer_state));
 
     r300->fb_state.size = (10 * state->nr_cbufs) + (2 * (4 - state->nr_cbufs)) +
-                          (state->zsbuf ? 10 : 0) + 6;
+                          (state->zsbuf ? 10 : 0) + 8;
 
     r300_fb_update_tiling_flags(r300, r300->fb_state.state, state);
 
@@ -718,22 +718,6 @@ static void* r300_create_rs_state(struct pipe_context* pipe,
     rs->point_size = pack_float_16_6x(state->point_size) |
         (pack_float_16_6x(state->point_size) << R300_POINTSIZE_X_SHIFT);
 
-        /* Point minimum and maximum sizes. This register has to be emitted,
-         * and it'd be a step backwards to put it in invariant state. */
-        if (r300screen->caps->is_r500) {
-            rs->point_minmax =
-            ((int)(0.0 * 6.0) << R300_GA_POINT_MINMAX_MIN_SHIFT) |
-            ((int)(4096.0 * 6.0) << R300_GA_POINT_MINMAX_MAX_SHIFT);
-        } else if (r300screen->caps->is_r400) {
-            rs->point_minmax =
-            ((int)(0.0 * 6.0) << R300_GA_POINT_MINMAX_MIN_SHIFT) |
-            ((int)(4021.0 * 6.0) << R300_GA_POINT_MINMAX_MAX_SHIFT);
-        } else {
-            rs->point_minmax =
-            ((int)(0.0 * 6.0) << R300_GA_POINT_MINMAX_MIN_SHIFT) |
-            ((int)(2560.0 * 6.0) << R300_GA_POINT_MINMAX_MAX_SHIFT);
-        }
-
     rs->line_control = pack_float_16_6x(state->line_width) |
         R300_GA_LINE_CNTL_END_TYPE_COMP;
 
@@ -832,6 +816,7 @@ static void r300_bind_rs_state(struct pipe_context* pipe, void* state)
     }
 
     r300->rs_state.state = rs;
+    r300->rs_state.size = 17 + (r300->polygon_offset_enabled ? 5 : 0);
     /* XXX Why is this still needed, dammit!? */
     r300->scissor_state.dirty = TRUE;
     r300->viewport_state.dirty = TRUE;