From 527e229ac80c5f59c7a272ffcc8dc98011528cb0 Mon Sep 17 00:00:00 2001 From: Swung0x48 Date: Sun, 12 Jul 2026 04:04:12 -0400 Subject: [PATCH] [Perf] (MG_Backend/DirectGLES): drop redundant per-draw UBO binding-point sync; BindCurrentProgramWithResources already rebinds them --- MobileGL/MG_Backend/DirectGLES/DirectGLES.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/MobileGL/MG_Backend/DirectGLES/DirectGLES.cpp b/MobileGL/MG_Backend/DirectGLES/DirectGLES.cpp index e88c32b5..d58ddb31 100644 --- a/MobileGL/MG_Backend/DirectGLES/DirectGLES.cpp +++ b/MobileGL/MG_Backend/DirectGLES/DirectGLES.cpp @@ -291,10 +291,16 @@ namespace MobileGL::MG_Backend::DirectGLES { } } - SyncBufferBindingPoints(BufferTarget::Uniform, GL_UNIFORM_BUFFER); - // Graphics shaders may also read SSBOs (e.g. Flywheel's indirect vertex shaders pull - // instance data from storage buffers), so keep those binding points in sync for draws - // and not just for compute dispatches. + // UBO binding points are (re)established per draw by BindCurrentProgramWithResources at + // their compacted link-time points: CacheResourceLocations glUniformBlockBinding's the + // transpiled ESSL blocks to points 0,1,2,... (layout(binding=N) is stripped from the + // ESSL), so those compacted points are the only ones the shader reads. A frontend-indexed + // sync here would bind points the shader never reads and is unconditionally overwritten by + // the program rebind that always follows in PrepareForDraw - i.e. redundant for draws - so + // it is intentionally omitted (see SyncComputeBuffers for the compute path, which needs it). + // SSBOs are different: their block bindings are baked into the ESSL at compile time and + // BindCurrentProgramWithResources binds no SSBO points, so this is their sole draw-path + // binder (e.g. Flywheel's indirect vertex shaders pull instance data from storage buffers). SyncBufferBindingPoints(BufferTarget::ShaderStorage, GL_SHADER_STORAGE_BUFFER); }