diff options
author | José Fonseca <jfonseca@vmware.com> | 2014-02-03 19:57:18 +0000 |
---|---|---|
committer | José Fonseca <jfonseca@vmware.com> | 2014-02-03 20:10:09 +0000 |
commit | 8d1408b3a3c50cebcd8cafeca3ea363aa5f1b3fb (patch) | |
tree | 1aa2cf3647ca82038dd9bc996f606ef12605592c /wrappers/gltrace.py | |
parent | 26b0a7133940e548a46231cc8d93206787a0bed4 (diff) |
gltrace: Ensure GL_ARRAY_BUFFER is unbound before emiting fake gl*Pointer() calls.
When tracing, just before every drawcall, ApiTrace inserts gl*Pointer()
calls into the stream on attributes it detected as resident in user-mem
(instead of in a VBO).
ApiTrace wasn't inserting a glBindBuffer(GL_ARRAY_BUFFER, 0) and
glBindBuffer(GL_ARRAY_BUFFER, prevBuf) around those auto-generated
calls. Thus, it misrepresented pointers as huge offsets into the
currently bound VBO.
Thanks to idinev for spotting and diagnosing this issue. This achieves
the same result as idinev's fix in issue #222, but from the trace side.
Diffstat (limited to 'wrappers/gltrace.py')
-rw-r--r-- | wrappers/gltrace.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/wrappers/gltrace.py b/wrappers/gltrace.py index ccd5860b..9244c43d 100644 --- a/wrappers/gltrace.py +++ b/wrappers/gltrace.py @@ -944,6 +944,15 @@ class GlTracer(Tracer): print 'static void _trace_user_arrays(GLuint count)' print '{' print ' gltrace::Context *ctx = gltrace::getContext();' + print + + # Temporarily unbind the array buffer + print ' GLint _array_buffer = 0;' + print ' _glGetIntegerv(GL_ARRAY_BUFFER_BINDING, &_array_buffer);' + print ' if (_array_buffer) {' + self.fake_glBindBuffer(api, 'GL_ARRAY_BUFFER', '0') + print ' }' + print for camelcase_name, uppercase_name in self.arrays: # in which profile is the array available? @@ -1074,6 +1083,12 @@ class GlTracer(Tracer): print ' }' print + # Restore the original array_buffer + print ' if (_array_buffer) {' + self.fake_glBindBuffer(api, 'GL_ARRAY_BUFFER', '_array_buffer') + print ' }' + print + print '}' print @@ -1121,6 +1136,10 @@ class GlTracer(Tracer): self.fake_glClientActiveTexture_call(api, "client_active_texture"); print ' }' + def fake_glBindBuffer(self, api, target, buffer): + function = api.getFunctionByName('glBindBuffer') + self.fake_call(function, [target, buffer]) + def fake_glClientActiveTexture_call(self, api, texture): function = api.getFunctionByName('glClientActiveTexture') self.fake_call(function, [texture]) |