diff options
author | Jose Fonseca <jfonseca@vmware.com> | 2016-05-08 20:07:26 +0100 |
---|---|---|
committer | Jose Fonseca <jfonseca@vmware.com> | 2016-05-10 03:25:25 -0700 |
commit | dd5b4b38a7d2bc3cf729d4f14d1a987869685077 (patch) | |
tree | cb3a808116115073c57c6b3dbe83b60b3c8ad5d1 /wrappers | |
parent | 73a1a09bf7f6ea553cf1e9cbffac9211617a4997 (diff) |
gltrace: Don't track GLES buffer contents.
Basically revert d493737765bed0fcbba908024d2314778c26b5c9.
Diffstat (limited to 'wrappers')
-rw-r--r-- | wrappers/gltrace.hpp | 58 | ||||
-rw-r--r-- | wrappers/gltrace.py | 49 |
2 files changed, 0 insertions, 107 deletions
diff --git a/wrappers/gltrace.hpp b/wrappers/gltrace.hpp index e8f6f7e4..d55d8a39 100644 --- a/wrappers/gltrace.hpp +++ b/wrappers/gltrace.hpp @@ -26,10 +26,6 @@ #pragma once -#include <string.h> -#include <stdlib.h> -#include <map> - #include "glimports.hpp" #include "glfeatures.hpp" @@ -38,51 +34,6 @@ namespace gltrace { -/** - * OpenGL ES buffers cannot be read. This class is used to track index buffer - * contents. - */ -class Buffer { -public: - GLsizeiptr size; - GLvoid *data; - - Buffer() : - size(0), - data(0) - {} - - ~Buffer() { - free(data); - } - - void - bufferData(GLsizeiptr new_size, const void *new_data) { - if (new_size < 0) { - new_size = 0; - } - size = new_size; - data = realloc(data, new_size); - if (new_size && new_data) { - memcpy(data, new_data, size); - } - } - - void - bufferSubData(GLsizeiptr offset, GLsizeiptr length, const void *new_data) { - if (offset >= 0 && offset < size && length > 0 && offset + length <= size && new_data) { - memcpy((GLubyte *)data + offset, new_data, length); - } - } - - void - getSubData(GLsizeiptr offset, GLsizeiptr length, void *out_data) { - if (offset >= 0 && offset < size && length > 0 && offset + length <= size && out_data) { - memcpy(out_data, (GLubyte *)data + offset, length); - } - } -}; - class Context { public: glfeatures::Profile profile; @@ -99,18 +50,9 @@ public: // Whether it has been bound to a drawable bool boundDrawable = false; - // TODO: This will fail for buffers shared by multiple contexts. - std::map <GLuint, Buffer> buffers; - Context(void) : profile(glfeatures::API_GL, 1, 0) { } - - inline bool - needsShadowBuffers(void) - { - return profile.es(); - } }; void diff --git a/wrappers/gltrace.py b/wrappers/gltrace.py index 38f1516a..2786ed48 100644 --- a/wrappers/gltrace.py +++ b/wrappers/gltrace.py @@ -143,8 +143,6 @@ class GlTracer(Tracer): print '}' print - self.defineShadowBufferHelper() - # Whether we need user arrays print 'static inline bool _need_user_arrays(void)' print '{' @@ -334,50 +332,6 @@ class GlTracer(Tracer): else: Tracer.traceApi(self, api) - def defineShadowBufferHelper(self): - print 'void _shadow_glGetBufferSubData(GLenum target, GLintptr offset,' - print ' GLsizeiptr size, GLvoid *data)' - print '{' - print ' gltrace::Context *_ctx = gltrace::getContext();' - print ' if (!_ctx->needsShadowBuffers() || target != GL_ELEMENT_ARRAY_BUFFER) {' - print ' _glGetBufferSubData(target, offset, size, data);' - print ' return;' - print ' }' - print - print ' GLint buffer_binding = _glGetInteger(GL_ELEMENT_ARRAY_BUFFER_BINDING);' - print ' if (buffer_binding > 0) {' - print ' gltrace::Buffer & buf = _ctx->buffers[buffer_binding];' - print ' buf.getSubData(offset, size, data);' - print ' }' - print '}' - - def shadowBufferMethod(self, method): - # Emit code to fetch the shadow buffer, and invoke a method - print ' gltrace::Context *_ctx = gltrace::getContext();' - print ' if (_ctx->needsShadowBuffers() && target == GL_ELEMENT_ARRAY_BUFFER) {' - print ' GLint buffer_binding = _glGetInteger(GL_ELEMENT_ARRAY_BUFFER_BINDING);' - print ' if (buffer_binding > 0) {' - print ' gltrace::Buffer & buf = _ctx->buffers[buffer_binding];' - print ' buf.' + method + ';' - print ' }' - print ' }' - print - - def shadowBufferProlog(self, function): - if function.name == 'glBufferData': - self.shadowBufferMethod('bufferData(size, data)') - - if function.name == 'glBufferSubData': - self.shadowBufferMethod('bufferSubData(offset, size, data)') - - if function.name == 'glDeleteBuffers': - print ' gltrace::Context *_ctx = gltrace::getContext();' - print ' if (_ctx->needsShadowBuffers()) {' - print ' for (GLsizei i = 0; i < n; i++) {' - print ' _ctx->buffers.erase(buffer[i]);' - print ' }' - print ' }' - array_pointer_function_names = set(( "glVertexPointer", "glNormalPointer", @@ -617,7 +571,6 @@ class GlTracer(Tracer): print ' }' print ' if (flush && length > 0) {' self.emit_memcpy('map', 'length') - self.shadowBufferMethod('bufferSubData(offset, length, map)') print ' }' print ' }' print ' }' @@ -762,8 +715,6 @@ class GlTracer(Tracer): print ' }' print ' }' - self.shadowBufferProlog(function) - Tracer.traceFunctionImplBody(self, function) # These entrypoints are only expected to be implemented by tools; |