diff options
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/slang-reflection-test/main.cpp | 68 |
1 files changed, 36 insertions, 32 deletions
diff --git a/tools/slang-reflection-test/main.cpp b/tools/slang-reflection-test/main.cpp index 057bcd127..2b5477b4a 100644 --- a/tools/slang-reflection-test/main.cpp +++ b/tools/slang-reflection-test/main.cpp @@ -116,6 +116,7 @@ static void emitReflectionVarBindingInfoJSON( CASE(DESCRIPTOR_TABLE_SLOT, descriptorTableSlot); CASE(SPECIALIZATION_CONSTANT, specializationConstant); CASE(MIXED, mixed); + CASE(REGISTER_SPACE, registerSpace); #undef CASE default: @@ -124,7 +125,7 @@ static void emitReflectionVarBindingInfoJSON( break; } write(writer, "\""); - if( space ) + if( space && category != SLANG_PARAMETER_CATEGORY_REGISTER_SPACE) { write(writer, ", "); write(writer, "\"space\": "); @@ -149,6 +150,7 @@ static void emitReflectionVarBindingInfoJSON( auto stage = var->getStage(); if (stage != SLANG_STAGE_NONE) { + write(writer, ",\n"); char const* stageName = "UNKNOWN"; switch (stage) { @@ -165,45 +167,49 @@ static void emitReflectionVarBindingInfoJSON( write(writer, "\"stage\": \""); write(writer, stageName); - write(writer, "\",\n"); + write(writer, "\""); } auto typeLayout = var->getTypeLayout(); auto categoryCount = var->getCategoryCount(); - if( categoryCount != 1 ) + if (categoryCount) { - write(writer,"\"bindings\": [\n"); - } - else - { - write(writer,"\"binding\": "); - } - indent(writer); + write(writer, ",\n"); + if( categoryCount != 1 ) + { + write(writer,"\"bindings\": [\n"); + } + else + { + write(writer,"\"binding\": "); + } + indent(writer); - for(uint32_t cc = 0; cc < categoryCount; ++cc ) - { - auto category = var->getCategoryByIndex(cc); - auto index = var->getOffset(category); - auto space = var->getBindingSpace(category); - auto count = typeLayout->getSize(category); + for(uint32_t cc = 0; cc < categoryCount; ++cc ) + { + auto category = var->getCategoryByIndex(cc); + auto index = var->getOffset(category); + auto space = var->getBindingSpace(category); + auto count = typeLayout->getSize(category); - if (cc != 0) write(writer, ",\n"); + if (cc != 0) write(writer, ",\n"); - write(writer,"{"); - emitReflectionVarBindingInfoJSON( - writer, - category, - index, - count, - space); - write(writer,"}"); - } + write(writer,"{"); + emitReflectionVarBindingInfoJSON( + writer, + category, + index, + count, + space); + write(writer,"}"); + } - dedent(writer); - if( categoryCount != 1 ) - { - write(writer,"\n]"); + dedent(writer); + if( categoryCount != 1 ) + { + write(writer,"\n]"); + } } if (auto semanticName = var->getSemanticName()) @@ -244,7 +250,6 @@ static void emitReflectionVarLayoutJSON( write(writer, "\"type\": "); emitReflectionTypeLayoutJSON(writer, var->getTypeLayout()); - write(writer, ",\n"); emitReflectionVarBindingInfoJSON(writer, var); @@ -596,7 +601,6 @@ static void emitReflectionParamJSON( indent(writer); emitReflectionNameInfoJSON(writer, param->getName()); - write(writer, ",\n"); emitReflectionVarBindingInfoJSON(writer, param); write(writer, ",\n"); |
