Merge pull request #1329 from godlikepanos/master

Reflection: Add specialization constant name
This commit is contained in:
Hans-Kristian Arntzen 2020-04-18 23:34:22 +02:00 committed by GitHub
commit aa5fbc004b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 0 deletions

View File

@ -38,18 +38,21 @@
], ],
"specialization_constants" : [ "specialization_constants" : [
{ {
"name" : "",
"id" : 10, "id" : 10,
"type" : "uint", "type" : "uint",
"variable_id" : 18, "variable_id" : 18,
"default_value" : 1 "default_value" : 1
}, },
{ {
"name" : "",
"id" : 40, "id" : 40,
"type" : "uint", "type" : "uint",
"variable_id" : 19, "variable_id" : 19,
"default_value" : 1 "default_value" : 1
}, },
{ {
"name" : "",
"id" : 60, "id" : 60,
"type" : "uint", "type" : "uint",
"variable_id" : 20, "variable_id" : 20,

View File

@ -31,48 +31,56 @@
], ],
"specialization_constants" : [ "specialization_constants" : [
{ {
"name" : "a",
"id" : 1, "id" : 1,
"type" : "float", "type" : "float",
"variable_id" : 9, "variable_id" : 9,
"default_value" : 1.5 "default_value" : 1.5
}, },
{ {
"name" : "b",
"id" : 2, "id" : 2,
"type" : "float", "type" : "float",
"variable_id" : 11, "variable_id" : 11,
"default_value" : 2.5 "default_value" : 2.5
}, },
{ {
"name" : "c",
"id" : 3, "id" : 3,
"type" : "int", "type" : "int",
"variable_id" : 16, "variable_id" : 16,
"default_value" : 3 "default_value" : 3
}, },
{ {
"name" : "d",
"id" : 4, "id" : 4,
"type" : "int", "type" : "int",
"variable_id" : 25, "variable_id" : 25,
"default_value" : 4 "default_value" : 4
}, },
{ {
"name" : "e",
"id" : 5, "id" : 5,
"type" : "uint", "type" : "uint",
"variable_id" : 34, "variable_id" : 34,
"default_value" : 5 "default_value" : 5
}, },
{ {
"name" : "f",
"id" : 6, "id" : 6,
"type" : "uint", "type" : "uint",
"variable_id" : 35, "variable_id" : 35,
"default_value" : 6 "default_value" : 6
}, },
{ {
"name" : "g",
"id" : 7, "id" : 7,
"type" : "bool", "type" : "bool",
"variable_id" : 56, "variable_id" : 56,
"default_value" : false "default_value" : false
}, },
{ {
"name" : "h",
"id" : 8, "id" : 8,
"type" : "bool", "type" : "bool",
"variable_id" : 57, "variable_id" : 57,

View File

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

View File

@ -601,6 +601,7 @@ void CompilerReflection::emit_specialization_constants()
auto &c = get<SPIRConstant>(spec_const.id); auto &c = get<SPIRConstant>(spec_const.id);
auto type = get<SPIRType>(c.constant_type); auto type = get<SPIRType>(c.constant_type);
json_stream->begin_json_object(); 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("id", spec_const.constant_id);
json_stream->emit_json_key_value("type", type_to_glsl(type)); json_stream->emit_json_key_value("type", type_to_glsl(type));
json_stream->emit_json_key_value("variable_id", spec_const.id); json_stream->emit_json_key_value("variable_id", spec_const.id);