From 05c9a144229fb6bbfdb0bc462ec65e3d7d96ee6d Mon Sep 17 00:00:00 2001 From: Stefan Lienhard Date: Thu, 21 Apr 2022 15:18:56 +0200 Subject: [PATCH] cli: display missing memory qualifiers for reflect and dump-resources --- main.cpp | 6 ++++++ spirv_reflect.cpp | 24 ++++++++++++------------ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/main.cpp b/main.cpp index 9124ecaf..c4ff4c4e 100644 --- a/main.cpp +++ b/main.cpp @@ -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); diff --git a/spirv_reflect.cpp b/spirv_reflect.cpp index ee2fe930..0bd224e6 100644 --- a/spirv_reflect.cpp +++ b/spirv_reflect.cpp @@ -587,18 +587,18 @@ void CompilerReflection::emit_resources(const char *tag, const SmallVectoremit_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);