r300g: Correct colorbuffer measurements.
authorCorbin Simpson <MostAwesomeDude@gmail.com>
Tue, 9 Feb 2010 21:50:54 +0000 (13:50 -0800)
committerCorbin Simpson <MostAwesomeDude@gmail.com>
Tue, 9 Feb 2010 21:50:54 +0000 (13:50 -0800)
Also clarify changes from pointminmax.

src/gallium/drivers/r300/r300_screen.c
src/gallium/drivers/r300/r300_state.c
src/gallium/drivers/r300/r300_texture.c

index da4ec542ade23a9f3ea3112f8cfaf24811918099..13cd04a80ccb98c4d0ddd6a0b53cc9f68fa231c6 100644 (file)
@@ -186,8 +186,10 @@ static float r300_get_paramf(struct pipe_screen* pscreen, int param)
              * rendering limits. 2048 pixels should be enough for anybody. */
             if (r300screen->caps->is_r500) {
                 return 4096.0f;
+            } else if (r300screen->caps->is_r400) {
+                return 4021.0f;
             } else {
-                return 2048.0f;
+                return 2560.0f;
             }
         case PIPE_CAP_MAX_TEXTURE_ANISOTROPY:
             return 16.0f;
index d07e90860c28e2f2b61a093045044eb3dfd556bd..5fe9285a4b2fb6aa33fb36718bb2a4b9d49bbc56 100644 (file)
@@ -493,6 +493,8 @@ static void
                                const struct pipe_framebuffer_state* state)
 {
     struct r300_context* r300 = r300_context(pipe);
+    struct r300_screen* r300screen = r300_screen(pipe->screen);
+    unsigned max_width, max_height;
     uint32_t zbuffer_bpp = 0;
 
     r300->fb_state.size = (10 * state->nr_cbufs) +
@@ -505,6 +507,20 @@ static void
         return;
     }
 
+    if (r300screen->caps->is_r500) {
+        max_width = max_height = 4096;
+    } else if (r300screen->caps->is_r400) {
+        max_width = max_height = 4021;
+    } else {
+        max_width = max_height = 2560;
+    }
+
+    if (state->width > max_width || state->height > max_height) {
+        debug_printf("r300: Implementation error: Render targets are too "
+        "big in %s, refusing to bind framebuffer state!\n", __FUNCTION__);
+        return;
+    }
+
     if (r300->draw) {
         draw_flush(r300->draw);
     }
@@ -607,6 +623,7 @@ static void r300_set_polygon_stipple(struct pipe_context* pipe,
 static void* r300_create_rs_state(struct pipe_context* pipe,
                                   const struct pipe_rasterizer_state* state)
 {
+    struct r300_screen* r300screen = r300_screen(pipe->screen);
     struct r300_rs_state* rs = CALLOC_STRUCT(r300_rs_state);
 
     /* Copy rasterizer state for Draw. */
@@ -621,20 +638,28 @@ static void* r300_create_rs_state(struct pipe_context* pipe,
     /* If bypassing TCL, or if no TCL engine is present, turn off the HW TCL.
      * Else, enable HW TCL and force Draw's TCL off. */
     if (state->bypass_vs_clip_and_viewport ||
-            !r300_screen(pipe->screen)->caps->has_tcl) {
+            !r300screen->caps->has_tcl) {
         rs->vap_control_status |= R300_VAP_TCL_BYPASS;
     }
 
     rs->point_size = pack_float_16_6x(state->point_size) |
         (pack_float_16_6x(state->point_size) << R300_POINTSIZE_X_SHIFT);
 
-        /* set hw limits - clamping done by state tracker in vs or point_size
-           XXX always need to emit this? */
-        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);
+        /* 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_r500) {
+            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;
index 67bf8ce13fd8a22842c0ec7cc9417736d3fbbbb8..417a57384c4e2e1d180b3973f49627844b57753e 100644 (file)
@@ -80,7 +80,6 @@ static void r300_setup_texture_state(struct r300_screen* screen, struct r300_tex
             state->format2 |= R500_TXHEIGHT_BIT11;
         }
     }
-    assert(is_r500 || (pt->width0 <= 2048 && pt->height0 <= 2048));
 
     SCREEN_DBG(screen, DBG_TEX, "r300: Set texture state (%dx%d, %d levels)\n",
                pt->width0, pt->height0, pt->last_level);