-
Notifications
You must be signed in to change notification settings - Fork 6k
[Impeller] Allow metal shaders to compile through SPIR-V with openGL semantics. #40616
Changes from 4 commits
36955f7
726fbc9
ccfdf31
a2aaaca
19ed6f3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -305,6 +305,10 @@ template("impellerc") { | |
| args += [ "--metal-version=$metal_version" ] | ||
| } | ||
|
|
||
| if (defined(invoker.use_half_textures) && invoker.use_half_textures) { | ||
| args += [ "--use-half-textures" ] | ||
| } | ||
|
|
||
| if (json) { | ||
| args += [ "--json" ] | ||
| } | ||
|
|
@@ -403,6 +407,11 @@ template("_impeller_shaders_metal") { | |
| metal_version = invoker.metal_version | ||
| } | ||
|
|
||
| use_half_textures = false | ||
| if (defined(invoker.use_half_textures) && invoker.use_half_textures) { | ||
| use_half_textures = invoker.use_half_textures | ||
| } | ||
|
|
||
| shaders_base_name = string_join("", | ||
| [ | ||
| invoker.name, | ||
|
|
@@ -413,6 +422,7 @@ template("_impeller_shaders_metal") { | |
| shaders = invoker.shaders | ||
| metal_version = metal_version | ||
| sl_file_extension = "metal" | ||
| use_half_textures = use_half_textures | ||
| shader_target_flag = "" | ||
| defines = [ "IMPELLER_TARGET_METAL" ] | ||
| if (is_ios) { | ||
|
|
@@ -666,12 +676,26 @@ template("_impeller_shaders_vk") { | |
| # | ||
| # The SPIR-V version required by the shaders. | ||
| # | ||
| # @param[options] use_half_textures | ||
| # | ||
| # Whether the metal shader is using half-precision textures and requires | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can this be the default for Metal? Or is this because it interferes with the other features like framebuffer fetch? Perhaps we can detect that instead of tuning flags? Not sure. I bet this is fine too. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It interferes with framebuffer fetch specifically. I think there is a way to make that work but I haven't found it yet. I was planning to handle this as a follow up. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's not really a great way to detect it automatically, since we only really get the chance to inspect the shader after its in a SPIR-V ast and at that point the validation that rejects the f16sampler2d has already run. |
||
| # openGL semantics when compilig SPIR-V. | ||
| # | ||
| template("impeller_shaders") { | ||
| metal_version = "1.2" | ||
| if (defined(invoker.metal_version)) { | ||
| metal_version = invoker.metal_version | ||
| } | ||
| not_needed([ "metal_version" ]) | ||
|
|
||
| use_half_textures = false | ||
| if (defined(invoker.use_half_textures) && invoker.use_half_textures) { | ||
| use_half_textures = true | ||
| } | ||
|
|
||
| not_needed([ | ||
| "metal_version", | ||
| "use_half_textures", | ||
| ]) | ||
|
|
||
| enable_opengles = impeller_enable_opengles | ||
| if (defined(invoker.enable_opengles)) { | ||
|
|
@@ -685,6 +709,7 @@ template("impeller_shaders") { | |
| name = invoker.name | ||
| shaders = invoker.shaders | ||
| metal_version = metal_version | ||
| use_half_textures = use_half_textures | ||
| } | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Default initialize all members. This and (if you are in the mood for drive-by changes) the other members in the struct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done