Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
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
21 changes: 11 additions & 10 deletions impeller/renderer/backend/gles/render_pass_gles.cc
Original file line number Diff line number Diff line change
Expand Up @@ -492,29 +492,30 @@ void RenderPassGLES::ResetGLState(const ProcTableGLES& gl) {
}

if (gl.DiscardFramebufferEXT.IsAvailable()) {
std::vector<GLenum> attachments;
std::array<GLenum, 3> attachments;
size_t attachment_count = 0;

// TODO(130048): discarding stencil or depth on the default fbo causes Angle
// to discard the entire render target. Until we know the reason, default to
// storing.
bool angle_safe = gl.GetCapabilities()->IsANGLE() ? !is_default_fbo : true;

if (pass_data.discard_color_attachment) {
attachments.push_back(is_default_fbo ? GL_COLOR_EXT
: GL_COLOR_ATTACHMENT0);
attachments[attachment_count++] =
(is_default_fbo ? GL_COLOR_EXT : GL_COLOR_ATTACHMENT0);
}
if (pass_data.discard_depth_attachment && angle_safe) {
attachments.push_back(is_default_fbo ? GL_DEPTH_EXT
: GL_DEPTH_ATTACHMENT);
attachments[attachment_count++] =
(is_default_fbo ? GL_DEPTH_EXT : GL_DEPTH_ATTACHMENT);
}

if (pass_data.discard_stencil_attachment && angle_safe) {
attachments.push_back(is_default_fbo ? GL_STENCIL_EXT
: GL_STENCIL_ATTACHMENT);
attachments[attachment_count++] =
(is_default_fbo ? GL_STENCIL_EXT : GL_STENCIL_ATTACHMENT);
}
gl.DiscardFramebufferEXT(GL_FRAMEBUFFER, // target
attachments.size(), // attachments to discard
attachments.data() // size
gl.DiscardFramebufferEXT(GL_FRAMEBUFFER, // target
attachment_count, // attachments to discard
attachments.data() // size
);
}

Expand Down