summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2015-01-26 22:46:13 +0000
committerJosé Fonseca <jfonseca@vmware.com>2015-03-04 22:43:41 +0000
commite0c55fd7217451278a27b3df0d5f1c75784827c5 (patch)
tree216c832edd0838f2af19fee1aa9260b0ec02c36a
parentb5df658e06f01b9f4d2d47362fa584cdee07b0f6 (diff)
gltrace: Disable ARB_get_program_binary.
In order to prevent issue #316.
-rw-r--r--wrappers/glcaps.cpp22
-rw-r--r--wrappers/gltrace.py19
2 files changed, 39 insertions, 2 deletions
diff --git a/wrappers/glcaps.cpp b/wrappers/glcaps.cpp
index 7ffff2d6..350f123b 100644
--- a/wrappers/glcaps.cpp
+++ b/wrappers/glcaps.cpp
@@ -42,6 +42,7 @@
#include "glproc.hpp"
#include "gltrace.hpp"
+#include "os.hpp"
#include "config.hpp"
@@ -200,6 +201,22 @@ static void
getInteger(const configuration *config,
GLenum pname, GLint *params)
{
+ // Disable ARB_get_program_binary
+ switch (pname) {
+ case GL_NUM_PROGRAM_BINARY_FORMATS:
+ if (params) {
+ if (params[0] > 0) {
+ os::log("apitrace: warning: hiding program binary formats (https://github.com/apitrace/apitrace/issues/316)\n");
+ params[0] = 0;
+ }
+ }
+ return;
+ case GL_PROGRAM_BINARY_FORMATS:
+ // params might be NULL here, as we returned 0 for
+ // GL_NUM_PROGRAM_BINARY_FORMATS.
+ return;
+ }
+
if (params) {
*params = getConfigInteger(config, pname);
if (*params != 0) {
@@ -212,6 +229,9 @@ getInteger(const configuration *config,
}
+/**
+ * TODO: To be thorough, we should override all glGet*v.
+ */
void
_glGetIntegerv_override(GLenum pname, GLint *params)
{
@@ -246,8 +266,6 @@ _glGetIntegerv_override(GLenum pname, GLint *params)
params[0] = 256;
}
break;
- default:
- break;
}
}
}
diff --git a/wrappers/gltrace.py b/wrappers/gltrace.py
index 799894cd..5839c696 100644
--- a/wrappers/gltrace.py
+++ b/wrappers/gltrace.py
@@ -792,6 +792,13 @@ class GlTracer(Tracer):
# These functions have been dispatched already
return
+ # Force glProgramBinary to fail. Per ARB_get_program_binary this
+ # should signal the app that it needs to recompile.
+ if function.name in ('glProgramBinary', 'glProgramBinaryOES'):
+ print r' binaryFormat = 0xDEADDEAD;'
+ print r' binary = &binaryFormat;'
+ print r' length = sizeof binaryFormat;'
+
Tracer.invokeFunction(self, function)
def doInvokeFunction(self, function):
@@ -838,8 +845,20 @@ class GlTracer(Tracer):
print ' }'
return
+ if function.name in ('glGetProgramBinary', 'glGetProgramBinaryOES'):
+ print r' bufSize = 0;'
+
Tracer.doInvokeFunction(self, function)
+ if function.name == 'glGetProgramiv':
+ print r' if (params && pname == GL_PROGRAM_BINARY_LENGTH) {'
+ print r' *params = 0;'
+ print r' }'
+ if function.name in ('glGetProgramBinary', 'glGetProgramBinaryOES'):
+ print r' if (length) {'
+ print r' *length = 0;'
+ print r' }'
+
buffer_targets = [
'ARRAY_BUFFER',
'ELEMENT_ARRAY_BUFFER',