[Mesa-dev] [PATCH 3/4] radv: reduce vk_format_descriptions memory usage.
Dave Airlie
airlied at gmail.com
Tue Jan 30 23:41:58 UTC 2018
From: Dave Airlie <airlied at redhat.com>
This repacks to reduce the usage from 72->64 bytes, but also
makes the descriptions static const so they don't just stay in
the same unit.
Signed-off-by: Dave Airlie <airlied at redhat.com>
---
src/amd/vulkan/vk_format.h | 3 ++-
src/amd/vulkan/vk_format_table.py | 4 ++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/amd/vulkan/vk_format.h b/src/amd/vulkan/vk_format.h
index 43265ed3d97..7e2c1e8ae3f 100644
--- a/src/amd/vulkan/vk_format.h
+++ b/src/amd/vulkan/vk_format.h
@@ -117,11 +117,12 @@ struct vk_format_channel_description {
struct vk_format_description
{
VkFormat format;
+ enum vk_format_layout layout;
+
const char *name;
const char *short_name;
struct vk_format_block block;
- enum vk_format_layout layout;
unsigned nr_channels:3;
unsigned is_array:1;
diff --git a/src/amd/vulkan/vk_format_table.py b/src/amd/vulkan/vk_format_table.py
index 36352b108d0..df08ab17970 100644
--- a/src/amd/vulkan/vk_format_table.py
+++ b/src/amd/vulkan/vk_format_table.py
@@ -125,13 +125,13 @@ def write_format_table(formats):
print " },"
for format in formats:
- print 'const struct vk_format_description'
+ print 'static const struct vk_format_description'
print 'vk_format_%s_description = {' % (format.short_name(),)
print " %s," % (format.name,)
+ print " %s," % (layout_map(format.layout),)
print " \"%s\"," % (format.name,)
print " \"%s\"," % (format.short_name(),)
print " {%u, %u, %u},\t/* block */" % (format.block_width, format.block_height, format.block_size())
- print " %s," % (layout_map(format.layout),)
print " %u,\t/* nr_channels */" % (format.nr_channels(),)
print " %s,\t/* is_array */" % (bool_map(format.is_array()),)
print " %s,\t/* is_bitmask */" % (bool_map(format.is_bitmask()),)
--
2.14.3
More information about the mesa-dev
mailing list