From b2ce268c862da404367035218f86989435ba4088 Mon Sep 17 00:00:00 2001 From: BZLZHH Date: Thu, 1 Oct 2026 09:46:46 -0400 Subject: [PATCH] [Fix] (GLState): a global buffer target asked through the indexed lookup is a warning, not an abort Only four buffer targets have per-index binding points (Uniform, TransformFeedback, AtomicCounter, ShaderStorage). A caller that asks GetBindingPoint for any other target is reading the wrong accessor, not passing a bad enum - and kwin reached exactly that right after its vertex-attrib setup, where the assertion killed the whole compositor with Trace/breakpoint trap. The answer is now a one-time warning and index 0 of the indexed array: the caller gets a valid slot, the global binding is untouched, and the mismatch stays visible in the log. --- .../MG_State/GLState/BufferState/BufferState.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/MobileGL/MG_State/GLState/BufferState/BufferState.cpp b/MobileGL/MG_State/GLState/BufferState/BufferState.cpp index ddf308cd..fbfc16c9 100644 --- a/MobileGL/MG_State/GLState/BufferState/BufferState.cpp +++ b/MobileGL/MG_State/GLState/BufferState/BufferState.cpp @@ -105,7 +105,20 @@ namespace MobileGL::MG_State::GLState { return m_bufferBindPointTargets[i][index]; } } - MOBILEGL_ASSERT(false, "Invalid BufferTarget enum value for binding point: %d", static_cast(target)); + // A GLOBAL TARGET ASKED THROUGH THE INDEXED LOOKUP. Only four targets have per-index binding + // points (Uniform, TransformFeedback, AtomicCounter, ShaderStorage); the rest - Vertex, Index, + // PixelPack/Unpack, Texture, CopyRead/Write, Query, the indirect ones - are global, and a caller + // that asks for one here is reading the wrong accessor, not passing a bad enum. + // + // This used to abort, and the compositor reached it right after its vertex-attrib setup: the + // whole session died on Trace/breakpoint trap ("Invalid BufferTarget enum value for binding + // point"). Aborting a compositor over an accessor mix-up is the wrong trade, so the answer is + // a one-time warning and index 0 of the indexed array: the caller gets a valid slot, the + // global binding is untouched, and the mismatch stays visible in the log instead of being a + // crash. The proper fix is for that caller to use the global accessor. + MGLOG_W_ONCE("BufferState::GetBindingPoint: target=%d has no per-index binding points; answering " + "index 0 of the indexed array (a global target was asked through the indexed lookup)", + static_cast(target)); return m_bufferBindPointTargets[0][index]; } } // namespace MobileGL::MG_State::GLState