From b3109b8ad004d7439329fc6dcbecd6394b96a0db Mon Sep 17 00:00:00 2001 From: Panagiotis Christopoulos Charitos Date: Sat, 18 Apr 2020 22:00:36 +0200 Subject: [PATCH] Reflection: Add specialization constant name Fixes #1311 --- .../comp/workgroup-size-spec-constant.comp.json | 3 +++ .../shaders-reflection/frag/spec-constant.vk.frag.json | 8 ++++++++ .../vert/array-size-reflection.vert.json | 1 + spirv_reflect.cpp | 1 + 4 files changed, 13 insertions(+) diff --git a/reference/shaders-reflection/comp/workgroup-size-spec-constant.comp.json b/reference/shaders-reflection/comp/workgroup-size-spec-constant.comp.json index 7483f050..c67d7230 100644 --- a/reference/shaders-reflection/comp/workgroup-size-spec-constant.comp.json +++ b/reference/shaders-reflection/comp/workgroup-size-spec-constant.comp.json @@ -38,18 +38,21 @@ ], "specialization_constants" : [ { + "name" : "", "id" : 10, "type" : "uint", "variable_id" : 18, "default_value" : 1 }, { + "name" : "", "id" : 40, "type" : "uint", "variable_id" : 19, "default_value" : 1 }, { + "name" : "", "id" : 60, "type" : "uint", "variable_id" : 20, diff --git a/reference/shaders-reflection/frag/spec-constant.vk.frag.json b/reference/shaders-reflection/frag/spec-constant.vk.frag.json index 42b199c9..dd876dde 100644 --- a/reference/shaders-reflection/frag/spec-constant.vk.frag.json +++ b/reference/shaders-reflection/frag/spec-constant.vk.frag.json @@ -31,48 +31,56 @@ ], "specialization_constants" : [ { + "name" : "a", "id" : 1, "type" : "float", "variable_id" : 9, "default_value" : 1.5 }, { + "name" : "b", "id" : 2, "type" : "float", "variable_id" : 11, "default_value" : 2.5 }, { + "name" : "c", "id" : 3, "type" : "int", "variable_id" : 16, "default_value" : 3 }, { + "name" : "d", "id" : 4, "type" : "int", "variable_id" : 25, "default_value" : 4 }, { + "name" : "e", "id" : 5, "type" : "uint", "variable_id" : 34, "default_value" : 5 }, { + "name" : "f", "id" : 6, "type" : "uint", "variable_id" : 35, "default_value" : 6 }, { + "name" : "g", "id" : 7, "type" : "bool", "variable_id" : 56, "default_value" : false }, { + "name" : "h", "id" : 8, "type" : "bool", "variable_id" : 57, diff --git a/reference/shaders-reflection/vert/array-size-reflection.vert.json b/reference/shaders-reflection/vert/array-size-reflection.vert.json index dc363226..87b6cb06 100644 --- a/reference/shaders-reflection/vert/array-size-reflection.vert.json +++ b/reference/shaders-reflection/vert/array-size-reflection.vert.json @@ -68,6 +68,7 @@ ], "specialization_constants" : [ { + "name" : "ARR_SIZE", "id" : 0, "type" : "int", "variable_id" : 16, diff --git a/spirv_reflect.cpp b/spirv_reflect.cpp index f40c08a7..97d640c5 100644 --- a/spirv_reflect.cpp +++ b/spirv_reflect.cpp @@ -601,6 +601,7 @@ void CompilerReflection::emit_specialization_constants() auto &c = get(spec_const.id); auto type = get(c.constant_type); json_stream->begin_json_object(); + json_stream->emit_json_key_value("name", get_name(spec_const.id)); json_stream->emit_json_key_value("id", spec_const.constant_id); json_stream->emit_json_key_value("type", type_to_glsl(type)); json_stream->emit_json_key_value("variable_id", spec_const.id);