Skip to content

Commit

Permalink
Add impellerc options to compile OpenGL Desktop and ES variant shader…
Browse files Browse the repository at this point in the history
…s. (flutter#139)

Also parameterize all unit-tests so all backends are automatically tested.
  • Loading branch information
chinmaygarde authored and dnfield committed Apr 27, 2022
1 parent a08cb8b commit a4599bf
Show file tree
Hide file tree
Showing 22 changed files with 1,041 additions and 455 deletions.
14 changes: 13 additions & 1 deletion impeller/compiler/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,20 @@ impeller_component("compiler_lib") {
"code_gen_template.h",
"compiler.cc",
"compiler.h",
"compiler_backend.cc",
"compiler_backend.h",
"include_dir.h",
"includer.cc",
"includer.h",
"logger.h",
"reflector.cc",
"reflector.h",
"source_options.cc",
"source_options.h",
"switches.cc",
"switches.h",
"types.cc",
"types.h",
"utilities.cc",
"utilities.h",
]
Expand Down Expand Up @@ -52,7 +60,11 @@ impeller_component("compiler_unittests") {

output_name = "impellerc_unittests"

sources = [ "compiler_unittests.cc" ]
sources = [
"compiler_test.cc",
"compiler_test.h",
"compiler_unittests.cc",
]

deps = [
":compiler_lib",
Expand Down
6 changes: 3 additions & 3 deletions impeller/compiler/code_gen_template.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ struct {{camel_case(shader_name)}}{{camel_case(shader_stage)}}Shader {
static constexpr auto kResource{{camel_case(buffer.name)}} = ShaderUniformSlot<{{buffer.name}}> { // {{buffer.name}}
"{{buffer.name}}", // name
{{buffer.msl_res_0}}u, // binding
{{buffer.ext_res_0}}u, // binding
};
{% endfor %}
{% endif %}
Expand Down Expand Up @@ -91,8 +91,8 @@ struct {{camel_case(shader_name)}}{{camel_case(shader_stage)}}Shader {
static constexpr auto kResource{{camel_case(sampled_image.name)}} = SampledImageSlot { // {{sampled_image.name}}
"{{sampled_image.name}}", // name
{{sampled_image.msl_res_0}}u, // texture
{{sampled_image.msl_res_1}}u, // sampler
{{sampled_image.ext_res_0}}u, // texture
{{sampled_image.ext_res_1}}u, // sampler
};
{% endfor %}
{% endif %}
Expand Down
Loading

0 comments on commit a4599bf

Please sign in to comment.