aboutsummaryrefslogtreecommitdiffstats
path: root/src/freedreno
diff options
context:
space:
mode:
authorBas Nieuwenhuizen <[email protected]>2019-03-13 00:07:02 +0100
committerBas Nieuwenhuizen <[email protected]>2019-03-16 14:38:51 +0000
commite1161d2ea7b47fc8d13114216ed02ac00b6caeba (patch)
tree2ee96322dc258a0d578a1768c0f1a9a892f9eec3 /src/freedreno
parentd3386e73c5976ecec84821d17f05c2fd4b823880 (diff)
turnip: Fix GCC compiles.
Apparently GCC does not consider static const variables to be integer constants, and hence the array size and the static assert result in compile failures. Fixes: 4b9f967cd1a "turnip: add a more complete format table" Reviewed-by: Eric Engestrom <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]>
Diffstat (limited to 'src/freedreno')
-rw-r--r--src/freedreno/vulkan/tu_formats.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/freedreno/vulkan/tu_formats.c b/src/freedreno/vulkan/tu_formats.c
index 8df568b476c..537b59d25e1 100644
--- a/src/freedreno/vulkan/tu_formats.c
+++ b/src/freedreno/vulkan/tu_formats.c
@@ -45,9 +45,7 @@
#define TU_FORMAT_TABLE(var) \
static const VkFormat var##_first = TU_FORMAT_TABLE_FIRST; \
static const VkFormat var##_last = TU_FORMAT_TABLE_LAST; \
- static const size_t var##_count = \
- TU_FORMAT_TABLE_LAST - TU_FORMAT_TABLE_FIRST + 1; \
- static const struct tu_native_format var[var##_count]
+ static const struct tu_native_format var[TU_FORMAT_TABLE_LAST - TU_FORMAT_TABLE_FIRST + 1]
#undef TU_FORMAT_TABLE_FIRST
#undef TU_FORMAT_TABLE_LAST
@@ -321,9 +319,8 @@ tu6_get_native_format(VkFormat format)
{
const struct tu_native_format *fmt = NULL;
- static_assert(tu6_format_table0_first == 0, "");
- if (format <= tu6_format_table0_last)
- fmt = &tu6_format_table0[format];
+ if (format >= tu6_format_table0_first && format <= tu6_format_table0_last)
+ fmt = &tu6_format_table0[format - tu6_format_table0_first];
return (fmt && fmt->present) ? fmt : NULL;
}