Only dump block size for blocks which have a physical size.

I/O variables can also be blocks, but they have no physical size.
This commit is contained in:
Hans-Kristian Arntzen 2016-11-29 09:04:28 +01:00
parent 740fce8ebd
commit b9600aa8d3

View File

@ -196,10 +196,12 @@ static void print_resources(const Compiler &compiler, const char *tag, const vec
bool is_push_constant = compiler.get_storage_class(res.id) == StorageClassPushConstant;
bool is_block = (compiler.get_decoration_mask(type.self) &
((1ull << DecorationBlock) | (1ull << DecorationBufferBlock))) != 0;
bool is_sized_block = is_block && (compiler.get_storage_class(res.id) == StorageClassUniform ||
compiler.get_storage_class(res.id) == StorageClassUniformConstant);
uint32_t fallback_id = !is_push_constant && is_block ? res.base_type_id : res.id;
uint32_t block_size = 0;
if (is_block)
if (is_sized_block)
block_size = compiler.get_declared_struct_size(compiler.get_type(res.base_type_id));
string array;
@ -217,7 +219,7 @@ static void print_resources(const Compiler &compiler, const char *tag, const vec
fprintf(stderr, " (Binding : %u)", compiler.get_decoration(res.id, DecorationBinding));
if (mask & (1ull << DecorationInputAttachmentIndex))
fprintf(stderr, " (Attachment : %u)", compiler.get_decoration(res.id, DecorationInputAttachmentIndex));
if (is_block)
if (is_sized_block)
fprintf(stderr, " (BlockSize : %u bytes)", block_size);
fprintf(stderr, "\n");
}