Reflection: Add specialization constant name

Fixes #1311
This commit is contained in:
Panagiotis Christopoulos Charitos 2020-04-18 22:00:36 +02:00
parent 90198199df
commit b3109b8ad0
4 changed files with 13 additions and 0 deletions

View File

@ -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,

View File

@ -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,

View File

@ -68,6 +68,7 @@
],
"specialization_constants" : [
{
"name" : "ARR_SIZE",
"id" : 0,
"type" : "int",
"variable_id" : 16,

View File

@ -601,6 +601,7 @@ void CompilerReflection::emit_specialization_constants()
auto &c = get<SPIRConstant>(spec_const.id);
auto type = get<SPIRType>(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);