From 57b6f1e55a74d3a4b7d3a73f5743fbc1eda12f5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Mon, 1 Apr 2024 17:47:07 +0200 Subject: [PATCH] GL: add a repro case for base/range buffer unbind state mismatch. Expands the test added in 789c52fd8af309b98801b4ced74260cef3d272de, for which a fix was done in 8f6f4053fcd7893511a748df35e9cda881d390bf but which forgot to handle the case where a buffer is unbound. The test now fails with an invalid error. --- src/Magnum/GL/Test/BufferGLTest.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/Magnum/GL/Test/BufferGLTest.cpp b/src/Magnum/GL/Test/BufferGLTest.cpp index 1ff024c41..4e438c596 100644 --- a/src/Magnum/GL/Test/BufferGLTest.cpp +++ b/src/Magnum/GL/Test/BufferGLTest.cpp @@ -352,6 +352,19 @@ void BufferGLTest::bindBaseRangeUpdateRegularBinding() { large.setSubData(0, zeros); MAGNUM_VERIFY_NO_GL_ERROR(); + + /* Conversely, unbinding the indexed target then resets the regular binding + point as a side effect. Again verify that the state tracker accounts for + that by trying to upload data to the same buffer again -- it should + rebind it instead of assuming it's still there. */ + if(data.multi) + Buffer::unbind(Buffer::Target::Uniform, 0, 1); + else + Buffer::unbind(Buffer::Target::Uniform, 0); + + large.setSubData(0, zeros); + + MAGNUM_VERIFY_NO_GL_ERROR(); } #ifndef MAGNUM_TARGET_WEBGL