cli: display missing memory qualifiers for reflect and dump-resources

This commit is contained in:
Stefan Lienhard 2022-04-21 15:18:56 +02:00
parent d7cae5e7cd
commit 05c9a14422
2 changed files with 18 additions and 12 deletions

View File

@ -400,6 +400,12 @@ static void print_resources(const Compiler &compiler, const char *tag, const Sma
fprintf(stderr, " writeonly");
if (mask.get(DecorationNonWritable))
fprintf(stderr, " readonly");
if (mask.get(DecorationRestrict))
fprintf(stderr, " restrict");
if (mask.get(DecorationCoherent))
fprintf(stderr, " coherent");
if (mask.get(DecorationVolatile))
fprintf(stderr, " volatile");
if (is_sized_block)
{
fprintf(stderr, " (BlockSize : %u bytes)", block_size);

View File

@ -587,18 +587,18 @@ void CompilerReflection::emit_resources(const char *tag, const SmallVector<Resou
{
bool ssbo_block = type.storage == StorageClassStorageBuffer ||
(type.storage == StorageClassUniform && typeflags.get(DecorationBufferBlock));
if (ssbo_block)
{
auto buffer_flags = get_buffer_block_flags(res.id);
if (buffer_flags.get(DecorationNonReadable))
json_stream->emit_json_key_value("writeonly", true);
if (buffer_flags.get(DecorationNonWritable))
json_stream->emit_json_key_value("readonly", true);
if (buffer_flags.get(DecorationRestrict))
json_stream->emit_json_key_value("restrict", true);
if (buffer_flags.get(DecorationCoherent))
json_stream->emit_json_key_value("coherent", true);
}
Bitset qualifier_mask = ssbo_block ? get_buffer_block_flags(res.id) : mask;
if (qualifier_mask.get(DecorationNonReadable))
json_stream->emit_json_key_value("writeonly", true);
if (qualifier_mask.get(DecorationNonWritable))
json_stream->emit_json_key_value("readonly", true);
if (qualifier_mask.get(DecorationRestrict))
json_stream->emit_json_key_value("restrict", true);
if (qualifier_mask.get(DecorationCoherent))
json_stream->emit_json_key_value("coherent", true);
if (qualifier_mask.get(DecorationVolatile))
json_stream->emit_json_key_value("volatile", true);
}
emit_type_array(type);