Fixes out of bounds during GL buffer binding.

There was an out of bounds access during binding a uniform buffer on
GL. Fixes #7567, #7598.

(cherry picked from commit bce6e2c238)
Signed-off-by: Itms <itms@wildfiregames.com>
This commit is contained in:
Vladislav Belov
2025-04-12 16:27:52 +02:00
committed by Itms
parent ef9ea478ec
commit 85cc968be0
2 changed files with 5 additions and 1 deletions
@@ -246,6 +246,9 @@ CDeviceCommandContext::CDeviceCommandContext(CDevice* device)
for (size_t index = 0; index < m_BoundBuffers.size(); ++index)
{
const CBuffer::Type type = static_cast<CBuffer::Type>(index);
// Currently we don't support upload buffers for GL.
if (type == CBuffer::Type::UPLOAD)
continue;
const GLenum target = BufferTypeToGLTarget(type);
const GLuint handle = 0;
m_BoundBuffers[index].first = target;
@@ -1456,6 +1459,7 @@ CDeviceCommandContext::ScopedBufferBind::ScopedBufferBind(
{
ENSURE(buffer);
m_CacheIndex = static_cast<size_t>(buffer->GetType());
ENSURE(m_CacheIndex < m_DeviceCommandContext->m_BoundBuffers.size());
const GLenum target = BufferTypeToGLTarget(buffer->GetType());
const GLuint handle = buffer->GetHandle();
if (m_DeviceCommandContext->m_BoundBuffers[m_CacheIndex].first == target &&