Mesa (master): r600g: port r300g fix for X* formats in texformat code
Dave Airlie
airlied at kemper.freedesktop.org
Wed Sep 29 23:05:39 UTC 2010
Module: Mesa
Branch: master
Commit: 534f7d5749e34003fc9a0a4c83e6cd6f86a1c2cb
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=534f7d5749e34003fc9a0a4c83e6cd6f86a1c2cb
Author: Dave Airlie <airlied at redhat.com>
Date: Thu Sep 30 08:56:37 2010 +1000
r600g: port r300g fix for X* formats in texformat code
---
src/gallium/drivers/r600/r600_texture.c | 18 ++++++++++++++----
1 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c
index 7979f85..f03d6fc 100644
--- a/src/gallium/drivers/r600/r600_texture.c
+++ b/src/gallium/drivers/r600/r600_texture.c
@@ -586,16 +586,26 @@ uint32_t r600_translate_texformat(enum pipe_format format,
goto out_unknown;
}
+ /* Find the first non-VOID channel. */
+ for (i = 0; i < 4; i++) {
+ if (desc->channel[i].type != UTIL_FORMAT_TYPE_VOID) {
+ break;
+ }
+ }
+
+ if (i == 4)
+ goto out_unknown;
+
/* uniform formats */
- switch (desc->channel[0].type) {
+ switch (desc->channel[i].type) {
case UTIL_FORMAT_TYPE_UNSIGNED:
case UTIL_FORMAT_TYPE_SIGNED:
- if (!desc->channel[0].normalized &&
+ if (!desc->channel[i].normalized &&
desc->colorspace != UTIL_FORMAT_COLORSPACE_SRGB) {
goto out_unknown;
}
- switch (desc->channel[0].size) {
+ switch (desc->channel[i].size) {
case 4:
switch (desc->nr_channels) {
case 2:
@@ -635,7 +645,7 @@ uint32_t r600_translate_texformat(enum pipe_format format,
goto out_unknown;
case UTIL_FORMAT_TYPE_FLOAT:
- switch (desc->channel[0].size) {
+ switch (desc->channel[i].size) {
case 16:
switch (desc->nr_channels) {
case 1:
More information about the mesa-commit
mailing list