diff --git a/engine/src/flutter/impeller/compiler/code_gen_template.h b/engine/src/flutter/impeller/compiler/code_gen_template.h index 61124296c9..a6e262ecb0 100644 --- a/engine/src/flutter/impeller/compiler/code_gen_template.h +++ b/engine/src/flutter/impeller/compiler/code_gen_template.h @@ -29,7 +29,6 @@ struct {{camel_case(shader_name)}}{{camel_case(shader_stage)}}Info { // =========================================================================== // Stage Uniforms ============================================================ // =========================================================================== - {% for uniform in uniform_buffers %} static constexpr auto kUniform{{camel_case(uniform.name)}} = ShaderStageIOSlot { // {{uniform.name}} diff --git a/engine/src/flutter/impeller/compiler/reflector.cc b/engine/src/flutter/impeller/compiler/reflector.cc index a2d31b3604..a84d69ff8c 100644 --- a/engine/src/flutter/impeller/compiler/reflector.cc +++ b/engine/src/flutter/impeller/compiler/reflector.cc @@ -123,6 +123,7 @@ static bool ReflectType(Writer& writer, writer.Key("columns"); writer.Uint64(type.columns); + // Member types should only be present if the base type is a struct. if (!type.member_types.empty()) { writer.Key("member"); writer.StartArray(); @@ -254,11 +255,12 @@ static std::shared_ptr ReflectTemplateArguments( writer.String(options.header_file_name); } + const auto all_shader_resources = compiler.get_shader_resources(); + { writer.Key("uniform_buffers"); writer.StartArray(); - for (const auto& uniform_buffer : - compiler.get_shader_resources().uniform_buffers) { + for (const auto& uniform_buffer : all_shader_resources.uniform_buffers) { if (!ReflectUniformBuffer(writer, ir, compiler, uniform_buffer)) { FML_LOG(ERROR) << "Could not reflect uniform buffer."; return nullptr; @@ -270,7 +272,7 @@ static std::shared_ptr ReflectTemplateArguments( { writer.Key("stage_inputs"); writer.StartArray(); - for (const auto& input : compiler.get_shader_resources().stage_inputs) { + for (const auto& input : all_shader_resources.stage_inputs) { if (!ReflectStageIO(writer, ir, compiler, input)) { FML_LOG(ERROR) << "Could not reflect stage input."; return nullptr; @@ -282,7 +284,7 @@ static std::shared_ptr ReflectTemplateArguments( { writer.Key("stage_outputs"); writer.StartArray(); - for (const auto& output : compiler.get_shader_resources().stage_outputs) { + for (const auto& output : all_shader_resources.stage_outputs) { if (!ReflectStageIO(writer, ir, compiler, output)) { FML_LOG(ERROR) << "Could not reflect stage output."; return nullptr; @@ -291,6 +293,24 @@ static std::shared_ptr ReflectTemplateArguments( writer.EndArray(); } + { + auto reflect_types = + [&](const spirv_cross::SmallVector resources) + -> bool { + for (const auto& resource : resources) { + } + return true; + }; + writer.Key("type_definitions"); + writer.StartArray(); + if (!reflect_types(all_shader_resources.uniform_buffers) || + !reflect_types(all_shader_resources.stage_inputs) || + !reflect_types(all_shader_resources.stage_outputs)) { + return nullptr; + } + writer.EndArray(); + } + writer.EndObject(); // root return std::make_shared(