Module: Mesa
Branch: master
Commit: 6a95996abb33a040f957ffedf3824afcc98a9e71
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6a95996abb33a040f957ffedf3824afcc98a9e71

Author: Corbin Simpson <[email protected]>
Date:   Fri Nov 20 14:55:22 2009 -0800

r300g: Texrect factor cleanup.

(0, 0, 0, 1) is a much saner default value, and texrect factors only need
to be (1/s, 1/t, 0, 1).

---

 src/gallium/drivers/r300/r300_emit.c |   24 ++++++++++++++----------
 1 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/src/gallium/drivers/r300/r300_emit.c 
b/src/gallium/drivers/r300/r300_emit.c
index 0bdf582..37e75ba 100644
--- a/src/gallium/drivers/r300/r300_emit.c
+++ b/src/gallium/drivers/r300/r300_emit.c
@@ -129,7 +129,7 @@ static const float * get_shader_constant(
     struct rc_constant * constant,
     struct r300_constant_buffer * externals)
 {
-    static float vec[4] = { 0.0, 0.0, 0.0, 0.0 };
+    static float vec[4] = { 0.0, 0.0, 0.0, 1.0 };
     struct pipe_texture *tex;
 
     switch(constant->Type) {
@@ -140,26 +140,30 @@ static const float * get_shader_constant(
             return constant->u.Immediate;
 
         case RC_CONSTANT_STATE:
-            switch (constant->u.State[0])
-            {
-                /* R3xx-specific */
+            switch (constant->u.State[0]) {
+                /* Factor for converting rectangle coords to
+                 * normalized coords. Should only show up on non-r500. */
                 case RC_STATE_R300_TEXRECT_FACTOR:
                     tex = &r300->textures[constant->u.State[1]]->tex;
                     vec[0] = 1.0 / tex->width[0];
                     vec[1] = 1.0 / tex->height[0];
-                    vec[2] = vec[3] = 1;
                     break;
 
                 default:
-                    assert(0);
+                    debug_printf("r300: Implementation error: "
+                        "Unknown RC_CONSTANT type %d\n", constant->u.State[0]);
             }
-            return vec;
+            break;
 
         default:
-            debug_printf("r300: Implementation error: Unhandled constant type 
%i\n",
-                constant->Type);
-            return vec;
+            debug_printf("r300: Implementation error: "
+                "Unhandled constant type %d\n", constant->Type);
     }
+
+    /* This should either be (0, 0, 0, 1), which should be a relatively safe
+     * RGBA or STRQ value, or it could be one of the RC_CONSTANT_STATE
+     * state factors. */
+    return vec;
 }
 
 /* Convert a normal single-precision float into the 7.16 format

_______________________________________________
mesa-commit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to