Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixup flutter gpu.
  • Loading branch information
jonahwilliams committed Dec 2, 2024
commit 132748a81ae9dd0a3a1e83d8b8e8542d41f734e3
2 changes: 1 addition & 1 deletion impeller/renderer/backend/metal/render_pass_mtl.mm
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ static bool ConfigureStencilAttachment(
auto result = [MTLRenderPassDescriptor renderPassDescriptor];

const ColorAttachment& color0 = desc.GetColor0();
if (!ConfigureColorAttachment(color0, result.colorAttachments[0u])) {
if (!ConfigureColorAttachment(color0, result.colorAttachments[0])) {
VALIDATION_LOG << "Could not configure color attachment at index 0";
return nil;
}
Expand Down
4 changes: 4 additions & 0 deletions impeller/renderer/render_target.cc
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,10 @@ ColorAttachment RenderTarget::GetColor0() const {
return ColorAttachment{};
}

bool RenderTarget::HasColor0() const {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing here. Let's just make HasColorAttachment(0) look into this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

return color0_.has_value();
}

const std::map<size_t, ColorAttachment>& RenderTarget::GetColorAttachments()
const {
return colors_;
Expand Down
2 changes: 2 additions & 0 deletions impeller/renderer/render_target.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ class RenderTarget final {

ColorAttachment GetColor0() const;

bool HasColor0() const;

const std::map<size_t, ColorAttachment>& GetColorAttachments() const;

const std::optional<DepthAttachment>& GetDepthAttachment() const;
Expand Down
4 changes: 4 additions & 0 deletions lib/gpu/render_pass.cc
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ RenderPass::GetOrCreatePipeline() {

pipeline_desc.SetSampleCount(render_target_.GetSampleCount());

if (render_target_.HasColor0()) {
auto& color = GetColorAttachmentDescriptor(0);
color.format = render_target_.GetRenderTargetPixelFormat();
}
for (const auto& it : render_target_.GetColorAttachments()) {
auto& color = GetColorAttachmentDescriptor(it.first);
color.format = render_target_.GetRenderTargetPixelFormat();
Expand Down
Loading