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 all commits
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
[Impeller] Set color attachment pixel format to RGBA on OpenGLES backend
  • Loading branch information
ColdPaleLight committed Nov 22, 2022
commit 5095a4e1d93efcaaf7fb58ae50312d41bfc19d0e
5 changes: 5 additions & 0 deletions impeller/renderer/backend/gles/context_gles.cc
Original file line number Diff line number Diff line change
Expand Up @@ -142,4 +142,9 @@ const BackendFeatures& ContextGLES::GetBackendFeatures() const {
return kLegacyBackendFeatures;
}

// |Context|
PixelFormat ContextGLES::GetColorAttachmentPixelFormat() const {
return PixelFormat::kR8G8B8A8UNormInt;
}

} // namespace impeller
3 changes: 3 additions & 0 deletions impeller/renderer/backend/gles/context_gles.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ class ContextGLES final : public Context,
// |Context|
const BackendFeatures& GetBackendFeatures() const override;

// |Context|
PixelFormat GetColorAttachmentPixelFormat() const override;

FML_DISALLOW_COPY_AND_ASSIGN(ContextGLES);
};

Expand Down
6 changes: 3 additions & 3 deletions impeller/renderer/render_target.cc
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ RenderTarget RenderTarget::CreateOffscreen(const Context& context,

TextureDescriptor color_tex0;
color_tex0.storage_mode = color_storage_mode;
color_tex0.format = PixelFormat::kDefaultColor;
color_tex0.format = context.GetColorAttachmentPixelFormat();
color_tex0.size = size;
color_tex0.usage = static_cast<uint64_t>(TextureUsage::kRenderTarget) |
static_cast<uint64_t>(TextureUsage::kShaderRead);
Expand Down Expand Up @@ -257,7 +257,7 @@ RenderTarget RenderTarget::CreateOffscreenMSAA(
color0_tex_desc.storage_mode = color_storage_mode;
color0_tex_desc.type = TextureType::kTexture2DMultisample;
color0_tex_desc.sample_count = SampleCount::kCount4;
color0_tex_desc.format = PixelFormat::kDefaultColor;
color0_tex_desc.format = context.GetColorAttachmentPixelFormat();
color0_tex_desc.size = size;
color0_tex_desc.usage = static_cast<uint64_t>(TextureUsage::kRenderTarget);

Expand All @@ -274,7 +274,7 @@ RenderTarget RenderTarget::CreateOffscreenMSAA(

TextureDescriptor color0_resolve_tex_desc;
color0_resolve_tex_desc.storage_mode = color_resolve_storage_mode;
color0_resolve_tex_desc.format = PixelFormat::kDefaultColor;
color0_resolve_tex_desc.format = context.GetColorAttachmentPixelFormat();
color0_resolve_tex_desc.size = size;
color0_resolve_tex_desc.usage =
static_cast<uint64_t>(TextureUsage::kRenderTarget) |
Expand Down