From 3d20acbf442e4f05c9265bdd28dcedec44da55d1 Mon Sep 17 00:00:00 2001 From: jonahwilliams Date: Fri, 22 Nov 2024 10:55:13 -0800 Subject: [PATCH] [Impeller] dont create temp vec for discard. --- .../renderer/backend/gles/render_pass_gles.cc | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/impeller/renderer/backend/gles/render_pass_gles.cc b/impeller/renderer/backend/gles/render_pass_gles.cc index de308954075c0..594fcfab0732f 100644 --- a/impeller/renderer/backend/gles/render_pass_gles.cc +++ b/impeller/renderer/backend/gles/render_pass_gles.cc @@ -492,7 +492,8 @@ void RenderPassGLES::ResetGLState(const ProcTableGLES& gl) { } if (gl.DiscardFramebufferEXT.IsAvailable()) { - std::vector attachments; + std::array 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 @@ -500,21 +501,21 @@ void RenderPassGLES::ResetGLState(const ProcTableGLES& gl) { 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 ); }