Mesa (master): Revert "translate_generic: return NULL instead of assert(0) if format not supported"
Luca Barbieri
lb at kemper.freedesktop.org
Wed Aug 11 15:01:00 UTC 2010
Module: Mesa
Branch: master
Commit: 5266bc3c60033ccc3515b3a6d02f7219f981cbb1
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=5266bc3c60033ccc3515b3a6d02f7219f981cbb1
Author: Luca Barbieri <luca at luca-barbieri.com>
Date: Wed Aug 11 16:59:25 2010 +0200
Revert "translate_generic: return NULL instead of assert(0) if format not supported"
This reverts commit 16b45ca7cefb3432b4133fe9d0b1dbfe3f286131.
José Fonseca asked for a revert.
Note that the testsuite will now segfault since it attempts to test
all possible formats.
---
.../auxiliary/translate/translate_generic.c | 15 +++++++++------
1 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/src/gallium/auxiliary/translate/translate_generic.c b/src/gallium/auxiliary/translate/translate_generic.c
index 021099a..0baa49a 100644
--- a/src/gallium/auxiliary/translate/translate_generic.c
+++ b/src/gallium/auxiliary/translate/translate_generic.c
@@ -207,6 +207,12 @@ emit_B8G8R8A8_UNORM( const float *attrib, void *ptr)
out[3] = TO_8_UNORM(attrib[3]);
}
+static void
+emit_NULL( const float *attrib, void *ptr )
+{
+ /* do nothing is the only sensible option */
+}
+
static emit_func get_emit_func( enum pipe_format format )
{
switch (format) {
@@ -343,7 +349,8 @@ static emit_func get_emit_func( enum pipe_format format )
return &emit_A8R8G8B8_UNORM;
default:
- return NULL;
+ assert(0);
+ return &emit_NULL;
}
}
@@ -538,12 +545,8 @@ struct translate *translate_generic_create( const struct translate_key *key )
tg->attrib[i].instance_divisor = key->element[i].instance_divisor;
tg->attrib[i].emit = get_emit_func(key->element[i].output_format);
- if(!tg->attrib[i].emit)
- {
- FREE(tg);
- return NULL;
- }
tg->attrib[i].output_offset = key->element[i].output_offset;
+
}
tg->nr_attrib = key->nr_elements;
More information about the mesa-commit
mailing list