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
[Flutter GPU] Runtime shader import. #48875
Merged
Merged
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
2e2cd70
Compiler
bdero ea36c73
Naming
bdero e3f8cbf
[Flutter GPU] Add shader bundle format.
bdero f8e4703
Split compiler frontend code for readability
bdero 91cfa25
Move bundle parser into its own file
bdero cf61483
Bundle parsing routine
bdero 5243eff
Compile the shaders
bdero 7f45044
Write flatbuffer
bdero 35614d4
Runtime crash fix
bdero 34e063a
impellerc GN rules
bdero fea9317
Reflect stage data
bdero d639c2a
Runtime shader lib import
bdero fe51086
Fix entrypoint naming mismatch
bdero b475d35
Implement asset loading
bdero 0f12626
Asset dependency
bdero 1da673e
Hold on to dart-side refs for shader libraries
bdero 98f3cf5
Remove excess runtime classes that didn't end up getting used
bdero ce7ee8d
Licenses
bdero e57b927
Start of tests
bdero c9176dc
Error message tests
bdero cd5ba50
Remainder of parser tests
bdero ce28f95
Full bundle->flatbuffer test
bdero 2146d31
Licenses
bdero 9e3fccc
Jonah review
bdero 1919922
Zach review
bdero d7ef71d
Jonah review
bdero be1078c
zach review
bdero 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
Reflect stage data
- Loading branch information
commit fea9317407aa2d583a908a12f08fe30e0c87c0be
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,12 +11,10 @@ | |
| #include <set> | ||
| #include <sstream> | ||
|
|
||
| #include "flutter/fml/closure.h" | ||
| #include "flutter/fml/logging.h" | ||
| #include "impeller/base/strings.h" | ||
| #include "impeller/base/validation.h" | ||
| #include "impeller/compiler/code_gen_template.h" | ||
| #include "impeller/compiler/types.h" | ||
| #include "impeller/compiler/uniform_sorter.h" | ||
| #include "impeller/compiler/utilities.h" | ||
| #include "impeller/geometry/half.h" | ||
|
|
@@ -353,6 +351,35 @@ std::shared_ptr<RuntimeStageData> Reflector::GenerateRuntimeStageData() const { | |
| uniform_description.array_elements = GetArrayElements(spir_type); | ||
| data->AddUniformDescription(std::move(uniform_description)); | ||
| } | ||
|
|
||
| // We only need to worry about reflecting vertex attributes. | ||
| if (entrypoints.front().execution_model == spv::ExecutionModelVertex) { | ||
| const auto inputs = compiler_->get_shader_resources().stage_inputs; | ||
| auto input_offsets = ComputeOffsets(inputs); | ||
| for (const auto& input : inputs) { | ||
| auto location = compiler_->get_decoration( | ||
| input.id, spv::Decoration::DecorationLocation); | ||
| std::optional<size_t> offset = input_offsets[location]; | ||
|
|
||
| const auto type = compiler_->get_type(input.type_id); | ||
|
|
||
| InputDescription input_description; | ||
| input_description.name = input.name; | ||
| input_description.location = compiler_->get_decoration( | ||
| input.id, spv::Decoration::DecorationLocation); | ||
| input_description.set = compiler_->get_decoration( | ||
| input.id, spv::Decoration::DecorationDescriptorSet); | ||
|
Comment on lines
+370
to
+371
Contributor
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. FYI the vulkan backend can't support specifying different descriptor sets right now
Member
Author
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. Good to know. I just tried to replicate the way we pack the header template for now. My guess is that we can probably get away with removing a couple of these fields everywhere. |
||
| input_description.binding = compiler_->get_decoration( | ||
| input.id, spv::Decoration::DecorationBinding); | ||
| input_description.type = type.basetype; | ||
| input_description.bit_width = type.width; | ||
| input_description.vec_size = type.vecsize; | ||
| input_description.columns = type.columns; | ||
| input_description.offset = offset.value_or(0u); | ||
| data->AddInputDescription(std::move(input_description)); | ||
| } | ||
| } | ||
|
|
||
| return data; | ||
| } | ||
|
|
||
|
|
||
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
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.
don't we already reflect over the vertex attributes somewhere in compiler.cc?
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.
Yeah, for the reflection C header. We pack the same data here.