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] Encode directly to command buffer for Vulkan. #49780
Merged
auto-submit
merged 15 commits into
flutter:main
from
jonahwilliams:direct_encoding_vulkan
Jan 16, 2024
Merged
Changes from 14 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
9a84921
merge desc set changes.
6285909
[Impeller] encode commands to Vulkan command buffer.
6341c9e
Merge branch 'main' of github.com:flutter/engine into direct_encoding…
58b35b9
Set layout on producer side, codegen descriptor type.
c554219
fix gpu tracer maybe
3bb9e52
fix gpu tracer maybe
2b2a748
Merge branch 'direct_encoding_vulkan' of github.com:jonahwilliams/eng…
2a67711
capture drawing commands in debug mode.
9964586
use more recording pass.
e7ff38a
move recording render pass to contents.
e0a962e
Update context_vk.cc
dbaf4e4
fix last test.
de10720
remove extra trace events.
b220e91
strong ptr.
3413743
++
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,116 @@ | ||||||||
| // 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/entity/contents/test/recording_render_pass.h" | ||||||||
|
|
||||||||
| #include <utility> | ||||||||
|
|
||||||||
| namespace impeller { | ||||||||
|
|
||||||||
| RecordingRenderPass::RecordingRenderPass( | ||||||||
|
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. This is a test only class that lets us inspect individual commands. |
||||||||
| std::shared_ptr<RenderPass> delegate, | ||||||||
| const std::shared_ptr<Context>& context, | ||||||||
| const RenderTarget& render_target) | ||||||||
| : RenderPass(context, render_target), delegate_(std::move(delegate)) {} | ||||||||
|
|
||||||||
| // |RenderPass| | ||||||||
| void RecordingRenderPass::SetPipeline( | ||||||||
| const std::shared_ptr<Pipeline<PipelineDescriptor>>& pipeline) { | ||||||||
| pending_.pipeline = pipeline; | ||||||||
| delegate_->SetPipeline(pipeline); | ||||||||
| } | ||||||||
|
|
||||||||
| void RecordingRenderPass::SetCommandLabel(std::string_view label) { | ||||||||
| #ifdef IMPELLER_DEBUG | ||||||||
| pending_.label = std::string(label); | ||||||||
| #endif // IMPELLER_DEBUG | ||||||||
| delegate_->SetCommandLabel(label); | ||||||||
| } | ||||||||
|
|
||||||||
| // |RenderPass| | ||||||||
| void RecordingRenderPass::SetStencilReference(uint32_t value) { | ||||||||
| pending_.stencil_reference = value; | ||||||||
| delegate_->SetStencilReference(value); | ||||||||
| } | ||||||||
|
|
||||||||
| // |RenderPass| | ||||||||
| void RecordingRenderPass::SetBaseVertex(uint64_t value) { | ||||||||
| pending_.base_vertex = value; | ||||||||
| delegate_->SetBaseVertex(value); | ||||||||
| } | ||||||||
|
|
||||||||
| // |RenderPass| | ||||||||
| void RecordingRenderPass::SetViewport(Viewport viewport) { | ||||||||
| pending_.viewport = viewport; | ||||||||
| delegate_->SetViewport(viewport); | ||||||||
| } | ||||||||
|
|
||||||||
| // |RenderPass| | ||||||||
| void RecordingRenderPass::SetScissor(IRect scissor) { | ||||||||
| pending_.scissor = scissor; | ||||||||
| delegate_->SetScissor(scissor); | ||||||||
| } | ||||||||
|
|
||||||||
| // |RenderPass| | ||||||||
| void RecordingRenderPass::SetInstanceCount(size_t count) { | ||||||||
| pending_.instance_count = count; | ||||||||
| delegate_->SetInstanceCount(count); | ||||||||
| } | ||||||||
|
|
||||||||
| // |RenderPass| | ||||||||
| bool RecordingRenderPass::SetVertexBuffer(VertexBuffer buffer) { | ||||||||
| pending_.vertex_buffer = buffer; | ||||||||
| return delegate_->SetVertexBuffer(buffer); | ||||||||
| } | ||||||||
|
|
||||||||
| // |RenderPass| | ||||||||
| fml::Status RecordingRenderPass::Draw() { | ||||||||
| commands_.emplace_back(std::move(pending_)); | ||||||||
| pending_ = {}; | ||||||||
| return delegate_->Draw(); | ||||||||
| } | ||||||||
|
|
||||||||
| // |RenderPass| | ||||||||
| void RecordingRenderPass::OnSetLabel(std::string label) { | ||||||||
| return; | ||||||||
| } | ||||||||
|
|
||||||||
| // |RenderPass| | ||||||||
| bool RecordingRenderPass::OnEncodeCommands(const Context& context) const { | ||||||||
| return true; | ||||||||
| } | ||||||||
|
|
||||||||
| // |RenderPass| | ||||||||
| bool RecordingRenderPass::BindResource(ShaderStage stage, | ||||||||
| DescriptorType type, | ||||||||
| const ShaderUniformSlot& slot, | ||||||||
| const ShaderMetadata& metadata, | ||||||||
| BufferView view) { | ||||||||
| pending_.BindResource(stage, type, slot, metadata, view); | ||||||||
| return delegate_->BindResource(stage, type, slot, metadata, view); | ||||||||
| } | ||||||||
|
|
||||||||
| // |RenderPass| | ||||||||
| bool RecordingRenderPass::BindResource( | ||||||||
| ShaderStage stage, | ||||||||
| DescriptorType type, | ||||||||
| const ShaderUniformSlot& slot, | ||||||||
| const std::shared_ptr<const ShaderMetadata>& metadata, | ||||||||
| BufferView view) { | ||||||||
| pending_.BindResource(stage, type, slot, metadata, view); | ||||||||
| return delegate_->BindResource(stage, type, slot, metadata, view); | ||||||||
| } | ||||||||
|
|
||||||||
| // |RenderPass| | ||||||||
| bool RecordingRenderPass::BindResource(ShaderStage stage, | ||||||||
| DescriptorType type, | ||||||||
| const SampledImageSlot& slot, | ||||||||
| const ShaderMetadata& metadata, | ||||||||
| std::shared_ptr<const Texture> texture, | ||||||||
| std::shared_ptr<const Sampler> sampler) { | ||||||||
| pending_.BindResource(stage, type, slot, metadata, texture, sampler); | ||||||||
| return delegate_->BindResource(stage, type, slot, metadata, texture, sampler); | ||||||||
| } | ||||||||
|
|
||||||||
| } // namespace impeller | ||||||||
|
||||||||
| } // namespace impeller | |
| } // namespace impeller | |
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
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.
Add the descriptor type so that bind calls don't need to look up the layout information to determine if a BufferView is a uniform buffer or storage buffer.