This repository was archived by the owner on Feb 25, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6k
[Impeller] drawVertices uber shader. #52315
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
d083a57
[Impeller] drawVertices uber shader.
9ed61ae
[Impeller] drawVertices uber shader.
1b7f370
++
e68d7ea
Merge branch 'vertices_uber' of github.com:jonahwilliams/engine into …
ca67ace
++
60a1558
++
708e595
++
72affa1
++
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| // Copyright 2013 The Flutter Authors. All rights reserved. | ||
| // Use of this source code is governed by a BSD-style license that can be | ||
| // found in the LICENSE file. | ||
|
|
||
| #include <impeller/blending.glsl> | ||
| #include <impeller/types.glsl> | ||
| #include "blend_select.glsl" | ||
|
|
||
| uniform FragInfo { | ||
| float16_t alpha; | ||
| float16_t blend_mode; | ||
| } | ||
| frag_info; | ||
|
|
||
| uniform f16sampler2D texture_sampler; | ||
|
|
||
| in highp vec2 v_texture_coords; | ||
| in mediump f16vec4 v_color; | ||
|
|
||
| out f16vec4 frag_color; | ||
|
|
||
| // A shader that implements the required src/dst blending for drawVertices and | ||
| // drawAtlas advanced blends without requiring an offscreen render pass. This is | ||
| // done in a single shader to reduce the permutations of PSO needed at runtime | ||
| // for rarely used features. | ||
| void main() { | ||
| f16vec4 dst = IPHalfUnpremultiply(v_color); | ||
| f16vec4 src = IPHalfUnpremultiply(texture(texture_sampler, v_texture_coords)); | ||
| f16vec3 blend_result = | ||
| AdvancedBlend(dst.rgb, src.rgb, int(frag_info.blend_mode - 14.0)); | ||
| frag_color = IPApplyBlendedColor(dst, src, blend_result); | ||
| frag_color *= frag_info.alpha; | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
If this is fast enough maybe we'll just do all the advanced blends this way 😏
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.
This causes stack spills (yay malioc!) on OpenGL ES on the Mali T880 (the ancient one). Notably, I don't see the spills on the Vulkan version. Given we are focusing on Vulkan, I'm definitely not opposed to landing this. But maybe have a comment in there about the spill with an issue filed so we have that observation on record for OpenGL ES.
The bound pipeline is the arith where the spill happens which tracks I suppose. Personally, I'd say the bar for shaders being "fast enough" would be to not cause these spills on the T880.
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.
Oh, I don't see the T880 in the Vulkan malioc results. Perhaps that is too old for Vulkan? Maybe we should find an older baseline than the Mali-G78.
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.
We shrunk down the malioc to two models, a pixel and I think the moto g4 gpu
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.
Hmm, if memory serves, the reasoning was that one would capture the high end on Vulkan and the other the low one with GLES. But that was when we were still focusing on GLES. Should we have two for Vulkan (and decide what the low one should be)?
In any case, don't want to distract you. This is good. There are no spills on our current Vulkan baseline.
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.
That's a good idea , we should revisit the gpu list