summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/r600/r600_texture.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2011-02-11 13:42:52 +1000
committerDave Airlie <airlied@redhat.com>2011-02-15 14:44:09 +1000
commit8e0437914bb786d0b05be8f95e4ff37bf5a19f44 (patch)
tree8335b15a46c75f560f602003750a4855b6d3bb99 /src/gallium/drivers/r600/r600_texture.c
parenta661dacf143d7187abc2360ac945db75296f7e23 (diff)
r600g: add support for s3tc formats.
On r600, s3tc formats require a 1D tiled texture format, so we have to do uploads using a blit, via the 64-bit and 128-bit formats Based on the r600c code we use a 64 and 128-bit type to do the blits. Still requires R600_ENABLE_S3TC until the kernel fixes are in, this has only been tested on evergreen where the kernel doesn't yet get in the way.
Diffstat (limited to 'src/gallium/drivers/r600/r600_texture.c')
-rw-r--r--src/gallium/drivers/r600/r600_texture.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c
index db39383e30..dd14143c2c 100644
--- a/src/gallium/drivers/r600/r600_texture.c
+++ b/src/gallium/drivers/r600/r600_texture.c
@@ -27,6 +27,7 @@
#include <errno.h>
#include <pipe/p_screen.h>
#include <util/u_format.h>
+#include <util/u_format_s3tc.h>
#include <util/u_math.h>
#include <util/u_inlines.h>
#include <util/u_memory.h>
@@ -289,6 +290,10 @@ static boolean permit_hardware_blit(struct pipe_screen *screen,
else
bind = PIPE_BIND_RENDER_TARGET;
+ /* hackaround for S3TC */
+ if (util_format_is_s3tc(res->format))
+ return TRUE;
+
if (!screen->is_format_supported(screen,
res->format,
res->target,
@@ -417,6 +422,10 @@ struct pipe_resource *r600_texture_create(struct pipe_screen *screen,
}
}
+ if (!(templ->flags & R600_RESOURCE_FLAG_TRANSFER) &&
+ util_format_is_s3tc(templ->format))
+ array_mode = V_038000_ARRAY_1D_TILED_THIN1;
+
return (struct pipe_resource *)r600_texture_create_object(screen, templ, array_mode,
0, 0, NULL);
@@ -869,6 +878,10 @@ uint32_t r600_translate_texformat(enum pipe_format format,
if (!r600_enable_s3tc)
goto out_unknown;
+ if (!util_format_s3tc_enabled) {
+ goto out_unknown;
+ }
+
switch (format) {
case PIPE_FORMAT_DXT1_RGB:
case PIPE_FORMAT_DXT1_RGBA: