r300g: add tx depth support in register.
authorDave Airlie <airlied@redhat.com>
Sat, 26 Sep 2009 09:32:46 +0000 (19:32 +1000)
committerDave Airlie <airlied@redhat.com>
Sat, 26 Sep 2009 09:32:46 +0000 (19:32 +1000)
also enable cube/3d bits in txformat reg

src/gallium/drivers/r300/r300_reg.h
src/gallium/drivers/r300/r300_texture.c

index 03cd219cde91ace20ac4eeb8e16a223511bc892b..3abff5db6222d039b925c67f3ea514803ccb3fdd 100644 (file)
@@ -1478,6 +1478,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #       define R300_TX_PITCH_EN                  (1 << 31)
 #       define R300_TX_WIDTH(x)                  ((x) << 0)
 #       define R300_TX_HEIGHT(x)                 ((x) << 11)
+#       define R300_TX_DEPTH(x)                  ((x) << 22)
 #       define R300_TX_NUM_LEVELS(x)             ((x) << 26)
 
 #define R300_TX_FORMAT1_0                   0x44C0
index 2ec07b453dbf2e81672321037e1f10ab49acc984..ce60ded7caf929db182207dc1833476653ec1b07 100644 (file)
@@ -29,11 +29,18 @@ static void r300_setup_texture_state(struct r300_texture* tex)
 
     state->format0 = R300_TX_WIDTH((pt->width[0] - 1) & 0x7ff) |
         R300_TX_HEIGHT((pt->height[0] - 1) & 0x7ff) |
+        R300_TX_DEPTH(util_logbase2(pt->depth[0]) & 0xf) |
         R300_TX_NUM_LEVELS(pt->last_level) |
         R300_TX_PITCH_EN;
 
     /* XXX */
     state->format1 = r300_translate_texformat(pt->format);
+    if (pt->target == PIPE_TEXTURE_CUBE) {
+       state->format1 |= R300_TX_FORMAT_CUBIC_MAP;
+    }
+    if (pt->target == PIPE_TEXTURE_3D) {
+       state->format1 |= R300_TX_FORMAT_3D;
+    }
 
     state->format2 = (r300_texture_get_stride(tex, 0) / pt->block.size) - 1;