Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 8d3c718

Browse files
author
Jonah Williams
authored
[Impeller] remove extra validation checks in GLES backend. (#56944)
We're already doing a check if the pipeline is valid in RenderPass::AddCommand. The index checks are validated during binding, and the check for instancing is unecessary given that we don't expose. While I'm at it do some minor cleanups.
1 parent e623b2b commit 8d3c718

File tree

1 file changed

+8
-21
lines changed

1 file changed

+8
-21
lines changed

impeller/renderer/backend/gles/render_pass_gles.cc

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66

77
#include <cstdint>
88

9-
#include "GLES3/gl3.h"
109
#include "flutter/fml/trace_event.h"
1110
#include "fml/closure.h"
1211
#include "fml/logging.h"
1312
#include "impeller/base/validation.h"
1413
#include "impeller/core/formats.h"
14+
#include "impeller/renderer/backend/gles/buffer_bindings_gles.h"
1515
#include "impeller/renderer/backend/gles/context_gles.h"
1616
#include "impeller/renderer/backend/gles/device_buffer_gles.h"
1717
#include "impeller/renderer/backend/gles/formats_gles.h"
@@ -218,7 +218,7 @@ void RenderPassGLES::ResetGLState(const ProcTableGLES& gl) {
218218
}
219219
} else {
220220
// Create and bind an offscreen FBO.
221-
auto cached_fbo = color_gles.GetCachedFBO();
221+
GLuint cached_fbo = color_gles.GetCachedFBO();
222222
if (cached_fbo != GL_NONE) {
223223
fbo = cached_fbo;
224224
gl.BindFramebuffer(GL_FRAMEBUFFER, fbo);
@@ -289,7 +289,7 @@ void RenderPassGLES::ResetGLState(const ProcTableGLES& gl) {
289289
// Both the viewport and scissor are specified in framebuffer coordinates.
290290
// Impeller's framebuffer coordinate system is top left origin, but OpenGL's
291291
// is bottom left origin, so we convert the coordinates here.
292-
auto target_size = pass_data.color_attachment->GetSize();
292+
ISize target_size = pass_data.color_attachment->GetSize();
293293

294294
//--------------------------------------------------------------------------
295295
/// Setup the viewport.
@@ -310,16 +310,6 @@ void RenderPassGLES::ResetGLState(const ProcTableGLES& gl) {
310310
}
311311

312312
for (const auto& command : commands) {
313-
if (command.instance_count != 1u) {
314-
VALIDATION_LOG << "GLES backend does not support instanced rendering.";
315-
return false;
316-
}
317-
318-
if (!command.pipeline) {
319-
VALIDATION_LOG << "Command has no pipeline specified.";
320-
return false;
321-
}
322-
323313
#ifdef IMPELLER_DEBUG
324314
fml::ScopedCleanupClosure pop_cmd_debug_marker(
325315
[&gl]() { gl.PopDebugGroup(); });
@@ -426,11 +416,7 @@ void RenderPassGLES::ResetGLState(const ProcTableGLES& gl) {
426416
break;
427417
}
428418

429-
auto vertex_desc_gles = pipeline.GetBufferBindings();
430-
431-
if (command.index_type == IndexType::kUnknown) {
432-
return false;
433-
}
419+
BufferBindingsGLES* vertex_desc_gles = pipeline.GetBufferBindings();
434420

435421
//--------------------------------------------------------------------------
436422
/// Bind vertex buffers.
@@ -471,9 +457,10 @@ void RenderPassGLES::ResetGLState(const ProcTableGLES& gl) {
471457
// correct; full triangle outlines won't be drawn and disconnected
472458
// geometry may appear connected. However this can still be useful for
473459
// wireframe debug views.
474-
auto mode = pipeline.GetDescriptor().GetPolygonMode() == PolygonMode::kLine
475-
? GL_LINE_STRIP
476-
: ToMode(pipeline.GetDescriptor().GetPrimitiveType());
460+
GLenum mode =
461+
pipeline.GetDescriptor().GetPolygonMode() == PolygonMode::kLine
462+
? GL_LINE_STRIP
463+
: ToMode(pipeline.GetDescriptor().GetPrimitiveType());
477464

478465
//--------------------------------------------------------------------------
479466
/// Finally! Invoke the draw call.

0 commit comments

Comments
 (0)