summaryrefslogtreecommitdiff
path: root/retrace
diff options
context:
space:
mode:
authorMark Janes <mark.a.janes@intel.com>2017-10-30 15:00:04 -0700
committerMark Janes <mark.a.janes@intel.com>2017-10-30 15:00:04 -0700
commit84ce12907199d0a7eb581b06de1d47e716fbd68b (patch)
tree1e5a59f3c2c88f164c8ec2a79d23bd4b5085e1fd /retrace
parent67a9ce7dd92ee8c648cdc60b2371163869f5d735 (diff)
State: track glGetProgramResourceName
Used by gfxbench5 aztec benchmark to identify uniform locations.
Diffstat (limited to 'retrace')
-rw-r--r--retrace/daemon/gldispatch/glframe_glhelper.cpp18
-rw-r--r--retrace/daemon/gldispatch/glframe_glhelper.hpp3
-rw-r--r--retrace/daemon/glframe_state.cpp21
-rw-r--r--retrace/daemon/glframe_state.hpp1
4 files changed, 43 insertions, 0 deletions
diff --git a/retrace/daemon/gldispatch/glframe_glhelper.cpp b/retrace/daemon/gldispatch/glframe_glhelper.cpp
index 09b5c01b..74b728b8 100644
--- a/retrace/daemon/gldispatch/glframe_glhelper.cpp
+++ b/retrace/daemon/gldispatch/glframe_glhelper.cpp
@@ -81,6 +81,7 @@ static void *pEndPerfQueryINTEL = NULL;
static void *pGetPerfQueryDataINTEL = NULL;
static void *pGetProgramiv = NULL;
static void *pGetProgramInfoLog = NULL;
+static void *pGetProgramResourceName = NULL;
static void *pGetBooleanv = NULL;
static void *pGetFloatv = NULL;
static void *pBlendColor = NULL;
@@ -251,6 +252,8 @@ GlFunctions::Init(void *lookup_fn) {
assert(pGetProgramiv);
pGetProgramInfoLog = _GetProcAddress("glGetProgramInfoLog");
assert(pGetProgramInfoLog);
+ pGetProgramResourceName = _GetProcAddress("glGetProgramResourceName");
+ assert(pGetProgramResourceName);
pGetBooleanv = _GetProcAddress("glGetBooleanv");
assert(pGetBooleanv);
pGetFloatv = _GetProcAddress("glGetFloatv");
@@ -646,6 +649,21 @@ GlFunctions::GetProgramInfoLog(GLuint program, GLsizei bufSize,
}
void
+GlFunctions::GetProgramResourceName(GLuint program, GLenum programInterface,
+ GLuint index, GLsizei bufSize,
+ GLsizei *length, GLchar *name) {
+ typedef void (*GETPROGRAMRESOURCENAME)(GLuint program,
+ GLenum programInterface,
+ GLuint index, GLsizei bufSize,
+ GLsizei *length, GLchar *name);
+ ((GETPROGRAMRESOURCENAME) pGetProgramResourceName)(program,
+ programInterface,
+ index, bufSize,
+ length, name);
+}
+
+
+void
GlFunctions::GetBooleanv(GLenum pname, GLboolean *params) {
typedef void (*GETBOOLEANV)(GLenum pname, GLboolean *params);
((GETBOOLEANV) pGetBooleanv)(pname, params);
diff --git a/retrace/daemon/gldispatch/glframe_glhelper.hpp b/retrace/daemon/gldispatch/glframe_glhelper.hpp
index ad9d2aa8..ec441266 100644
--- a/retrace/daemon/gldispatch/glframe_glhelper.hpp
+++ b/retrace/daemon/gldispatch/glframe_glhelper.hpp
@@ -112,6 +112,9 @@ class GlFunctions {
static void GetProgramiv(GLuint program, GLenum pname, GLint *params);
static void GetProgramInfoLog(GLuint program, GLsizei bufSize,
GLsizei *length, GLchar *infoLog);
+ static void GetProgramResourceName(GLuint program, GLenum programInterface,
+ GLuint index, GLsizei bufSize,
+ GLsizei *length, GLchar *name);
static void GetBooleanv(GLenum pname, GLboolean *params);
static void GetFloatv(GLenum pname, GLfloat *params);
diff --git a/retrace/daemon/glframe_state.cpp b/retrace/daemon/glframe_state.cpp
index 93d5c5b9..3176a2ee 100644
--- a/retrace/daemon/glframe_state.cpp
+++ b/retrace/daemon/glframe_state.cpp
@@ -32,6 +32,7 @@
#include <map>
#include <sstream>
#include <string>
+#include <vector>
#include "GL/gl.h"
#include "GL/glext.h"
@@ -74,6 +75,7 @@ StateTrack::TrackMap::TrackMap() {
lookup["glBindAttribLocation"] = &StateTrack::trackBindAttribLocation;
lookup["glGetAttribLocation"] = &StateTrack::trackGetAttribLocation;
lookup["glGetUniformLocation"] = &StateTrack::trackGetUniformLocation;
+ lookup["glGetProgramResourceName"] = &StateTrack::trackGetProgramResourceName;
lookup["glGetUniformBlockIndex"] = &StateTrack::trackGetUniformBlockIndex;
lookup["glUniformBlockBinding"] = &StateTrack::trackUniformBlockBinding;
lookup["glBindFragDataLocation"] = &StateTrack::trackBindFragDataLocation;
@@ -774,6 +776,25 @@ StateTrack::trackGetUniformLocation(const Call &call) {
}
void
+StateTrack::trackGetProgramResourceName(const Call &call) {
+ const int call_program = call.args[0].value->toDouble();
+ const int program = glretrace::getRetracedProgram(call_program);
+ const int programInterface = call.args[1].value->toDouble();
+ const int index = call.args[2].value->toDouble();
+ const int bufSize = call.args[3].value->toDouble();
+
+ GLsizei length;
+ std::vector<char> name(bufSize);
+ GlFunctions::GetProgramResourceName(program,
+ programInterface,
+ index,
+ bufSize,
+ &length,
+ name.data());
+ m_program_to_uniform_name[program][index] = name.data();
+}
+
+void
StateTrack::trackGetUniformBlockIndex(const trace::Call &call) {
const int call_index = call.ret->toDouble();
if (call_index == -1)
diff --git a/retrace/daemon/glframe_state.hpp b/retrace/daemon/glframe_state.hpp
index 993b897a..456723d0 100644
--- a/retrace/daemon/glframe_state.hpp
+++ b/retrace/daemon/glframe_state.hpp
@@ -145,6 +145,7 @@ class StateTrack {
void trackBindAttribLocation(const trace::Call &);
void trackGetAttribLocation(const trace::Call &);
void trackGetUniformLocation(const trace::Call &);
+ void trackGetProgramResourceName(const trace::Call &);
void trackGetUniformBlockIndex(const trace::Call &);
void trackUniformBlockBinding(const trace::Call &);
void trackBindFragDataLocation(const trace::Call &);