r600: implement texture border color
authorAlex Deucher <alexdeucher@gmail.com>
Tue, 28 Jul 2009 21:59:54 +0000 (17:59 -0400)
committerAlex Deucher <alexdeucher@gmail.com>
Tue, 28 Jul 2009 21:59:54 +0000 (17:59 -0400)
src/mesa/drivers/dri/r600/r600_tex.c
src/mesa/drivers/dri/r600/r700_render.c
src/mesa/drivers/dri/radeon/radeon_common_context.h

index a1e8945390045db0898a27b9523f5de5dea3cd9c..444024ee7e0de763101ffeb9f21a8afa990db3aa 100644 (file)
@@ -269,14 +269,12 @@ static void r600SetTexFilter(radeonTexObjPtr t, GLenum minf, GLenum magf, GLfloa
 
 static void r600SetTexBorderColor(radeonTexObjPtr t, const GLfloat color[4])
 {
-#if 0
-       GLubyte c[4];
-       CLAMPED_FLOAT_TO_UBYTE(c[0], color[0]);
-       CLAMPED_FLOAT_TO_UBYTE(c[1], color[1]);
-       CLAMPED_FLOAT_TO_UBYTE(c[2], color[2]);
-       CLAMPED_FLOAT_TO_UBYTE(c[3], color[3]);
-       t->pp_border_color = PACK_COLOR_8888(c[3], c[0], c[1], c[2]);
-#endif
+       t->TD_PS_SAMPLER0_BORDER_ALPHA = *((uint32_t*)&(color[3]));
+       t->TD_PS_SAMPLER0_BORDER_RED = *((uint32_t*)&(color[2]));
+       t->TD_PS_SAMPLER0_BORDER_GREEN = *((uint32_t*)&(color[1]));
+       t->TD_PS_SAMPLER0_BORDER_BLUE = *((uint32_t*)&(color[0]));
+        SETfield(t->SQ_TEX_SAMPLER0, SQ_TEX_BORDER_COLOR_REGISTER,
+                BORDER_COLOR_TYPE_shift, BORDER_COLOR_TYPE_mask);
 }
 
 /**
index f2fec27effa2ff18dab2da631df591a51ffa87b8..4e0d5391d0a0336319487f06e293ca2b99df8b45 100644 (file)
@@ -187,6 +187,15 @@ GLboolean r700SendTextureState(context_t *context)
                            R600_OUT_BATCH(r700->textures[i]->SQ_TEX_SAMPLER1);
                            R600_OUT_BATCH(r700->textures[i]->SQ_TEX_SAMPLER2);
                            END_BATCH();
+
+                           BEGIN_BATCH_NO_AUTOSTATE(2 + 4);
+                           R600_OUT_BATCH_REGSEQ((TD_PS_SAMPLER0_BORDER_RED + (i * 16)), 4);
+                           R600_OUT_BATCH(r700->textures[i]->TD_PS_SAMPLER0_BORDER_RED);
+                           R600_OUT_BATCH(r700->textures[i]->TD_PS_SAMPLER0_BORDER_GREEN);
+                           R600_OUT_BATCH(r700->textures[i]->TD_PS_SAMPLER0_BORDER_BLUE);
+                           R600_OUT_BATCH(r700->textures[i]->TD_PS_SAMPLER0_BORDER_ALPHA);
+                           END_BATCH();
+
                            COMMIT_BATCH();
                    }
            }
index e4a8da059656789ab2f84796e8190cc602d158f1..0cdacb1c36136bf4004c7b653044d77333afc2d2 100644 (file)
@@ -239,6 +239,11 @@ struct radeon_tex_obj {
        GLuint SQ_TEX_SAMPLER1;
        GLuint SQ_TEX_SAMPLER2;
 
+       GLuint TD_PS_SAMPLER0_BORDER_RED;
+       GLuint TD_PS_SAMPLER0_BORDER_GREEN;
+       GLuint TD_PS_SAMPLER0_BORDER_BLUE;
+       GLuint TD_PS_SAMPLER0_BORDER_ALPHA;
+
        GLboolean border_fallback;