r600: fill in some missing tex formats
authorAlex Deucher <alexdeucher@gmail.com>
Fri, 30 Oct 2009 19:02:34 +0000 (15:02 -0400)
committerAlex Deucher <alexdeucher@gmail.com>
Fri, 30 Oct 2009 19:02:34 +0000 (15:02 -0400)
This improves shadowtex since the component ordering
is at least correct now, but I'm not sure how to
deal with texturing from a depth surface yet due to
differences in depth and color tile layouts.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
src/mesa/drivers/dri/r600/r600_texstate.c

index c2f2be1d4c8dcff2e494e628b850eced28b79648..6357d52523969df75c4767ea9e4892f04495937a 100644 (file)
@@ -85,10 +85,21 @@ static GLboolean r600GetTexFormat(struct gl_texture_object *tObj, gl_format mesa
        CLEARfield(t->SQ_TEX_RESOURCE4, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask);
        CLEARfield(t->SQ_TEX_RESOURCE4, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask);
        CLEARfield(t->SQ_TEX_RESOURCE4, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask);
+       CLEARfield(t->SQ_TEX_RESOURCE4, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask);
+
+       SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_UNSIGNED,
+                FORMAT_COMP_X_shift, FORMAT_COMP_X_mask);
+       SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_UNSIGNED,
+                FORMAT_COMP_Y_shift, FORMAT_COMP_Y_mask);
+       SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_UNSIGNED,
+                FORMAT_COMP_X_shift, FORMAT_COMP_Z_mask);
+       SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_UNSIGNED,
+                FORMAT_COMP_W_shift, FORMAT_COMP_W_mask);
 
        switch (mesa_format) /* This is mesa format. */
        {
        case MESA_FORMAT_RGBA8888:
+       case MESA_FORMAT_SIGNED_RGBA8888:
                SETfield(t->SQ_TEX_RESOURCE1, FMT_8_8_8_8,
                         SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask);
 
@@ -100,8 +111,19 @@ static GLboolean r600GetTexFormat(struct gl_texture_object *tObj, gl_format mesa
                         SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask);
                SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X,
                         SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask);
+               if (mesa_format == MESA_FORMAT_SIGNED_RGBA8888) {
+                       SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_SIGNED,
+                                FORMAT_COMP_X_shift, FORMAT_COMP_X_mask);
+                       SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_SIGNED,
+                                FORMAT_COMP_Y_shift, FORMAT_COMP_Y_mask);
+                       SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_SIGNED,
+                                FORMAT_COMP_Z_shift, FORMAT_COMP_Z_mask);
+                       SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_SIGNED,
+                                FORMAT_COMP_W_shift, FORMAT_COMP_W_mask);
+               }
                break;
        case MESA_FORMAT_RGBA8888_REV:
+       case MESA_FORMAT_SIGNED_RGBA8888_REV:
                SETfield(t->SQ_TEX_RESOURCE1, FMT_8_8_8_8,
                         SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask);
 
@@ -113,6 +135,16 @@ static GLboolean r600GetTexFormat(struct gl_texture_object *tObj, gl_format mesa
                         SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask);
                SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_W,
                         SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask);
+               if (mesa_format == MESA_FORMAT_SIGNED_RGBA8888_REV) {
+                       SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_SIGNED,
+                                FORMAT_COMP_X_shift, FORMAT_COMP_X_mask);
+                       SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_SIGNED,
+                                FORMAT_COMP_Y_shift, FORMAT_COMP_Y_mask);
+                       SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_SIGNED,
+                                FORMAT_COMP_Z_shift, FORMAT_COMP_Z_mask);
+                       SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_SIGNED,
+                                FORMAT_COMP_W_shift, FORMAT_COMP_W_mask);
+               }
                break;
        case MESA_FORMAT_ARGB8888:
                SETfield(t->SQ_TEX_RESOURCE1, FMT_8_8_8_8,
@@ -479,14 +511,22 @@ static GLboolean r600GetTexFormat(struct gl_texture_object *tObj, gl_format mesa
                         SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask);
                break;
        case MESA_FORMAT_Z16:
+       case MESA_FORMAT_X8_Z24:
        case MESA_FORMAT_S8_Z24:
+       case MESA_FORMAT_Z24_S8:
        case MESA_FORMAT_Z32:
+       case MESA_FORMAT_S8:
                switch (mesa_format) {
                case MESA_FORMAT_Z16:
                        SETfield(t->SQ_TEX_RESOURCE1, FMT_16,
                                 SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask);
                        break;
+               case MESA_FORMAT_X8_Z24:
                case MESA_FORMAT_S8_Z24:
+                       SETfield(t->SQ_TEX_RESOURCE1, FMT_8_24,
+                                SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask);
+                       break;
+               case MESA_FORMAT_Z24_S8:
                        SETfield(t->SQ_TEX_RESOURCE1, FMT_24_8,
                                 SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask);
                        break;
@@ -494,6 +534,12 @@ static GLboolean r600GetTexFormat(struct gl_texture_object *tObj, gl_format mesa
                        SETfield(t->SQ_TEX_RESOURCE1, FMT_32,
                                 SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask);
                        break;
+               case MESA_FORMAT_S8:
+                       SETfield(t->SQ_TEX_RESOURCE1, FMT_8,
+                                SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask);
+                       break;
+               default:
+                       break;
                };
                switch (tObj->DepthMode) {
                case GL_LUMINANCE:  /* X, X, X, ONE */