Browse Source

Quick dirty fix for element array buffer binding in VAOs.

If no DSA is available and element array buffer was bound previously
(e.g. because data were uploaded to it), after binding VAO the binding
point is apparently reset to 0. But our state tracking thinks that the
buffer is still bound and thus doesn't bind it explicitly again when
asked for it. It causes crash in the driver, because it tries to read
from zero adress in client memory instead of bound buffer.

Needs to be solved properly, when I found out an clean solution.
pull/7/head
Vladimír Vondruš 13 years ago
parent
commit
0c4d433f70
  1. 6
      src/Mesh.cpp

6
src/Mesh.cpp

@ -20,6 +20,7 @@
#include "Buffer.h"
#include "Context.h"
#include "Extensions.h"
#include "Implementation/BufferState.h"
#include "Implementation/MeshState.h"
#include "Implementation/State.h"
@ -244,6 +245,11 @@ void Mesh::bindIndexBufferImplementationDefault(Buffer* buffer) {
void Mesh::bindIndexBufferImplementationVAO(Buffer* buffer) {
bindVAO(vao);
/* Reset ElementArray binding to force explicit glBindBuffer call later */
/** @todo Do this cleaner way */
Context::current()->state()->buffer->bindings[Implementation::BufferState::indexForTarget(Buffer::Target::ElementArray)] = 0;
buffer->bind(Buffer::Target::ElementArray);
}

Loading…
Cancel
Save