mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-07-12 05:56:15 +00:00
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:
@@ -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 &&
|
||||
|
||||
Reference in New Issue
Block a user