From 917ee542ec53e422b189023c681478780761af81 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Tue, 22 Oct 2013 10:46:04 -0700 Subject: [PATCH] fips-dispatch: Add support for AMD_performance_monitor extension Soon, fips will be using this extension internally, so the dispatch layer needs this support to be able to resolve these functions appropriately. --- fips-dispatch-gl.c | 150 +++++++++++++++++++++++++++++++++++++++++++++ fips-dispatch-gl.h | 74 ++++++++++++++++++++++ 2 files changed, 224 insertions(+) diff --git a/fips-dispatch-gl.c b/fips-dispatch-gl.c index 8b02b6a..192b2bc 100644 --- a/fips-dispatch-gl.c +++ b/fips-dispatch-gl.c @@ -107,3 +107,153 @@ stub_glGetQueryObjectuiv (GLuint id, GLenum pname, GLuint * params) PFNGLGETQUERYOBJECTUIVPROC fips_dispatch_glGetQueryObjectuiv = stub_glGetQueryObjectuiv; + +static void +stub_glGetPerfMonitorGroupsAMD (GLint *numGroups, GLsizei groupsSize, + GLuint *groups) +{ + check_initialized (); + resolve (fips_dispatch_glGetPerfMonitorGroupsAMD, + "glGetPerfMonitorGroupsAMD"); + fips_dispatch_glGetPerfMonitorGroupsAMD (numGroups, groupsSize, groups); +} + +PFNGLGETPERFMONITORGROUPSAMDPROC fips_dispatch_glGetPerfMonitorGroupsAMD = + stub_glGetPerfMonitorGroupsAMD; + +static void +stub_glGetPerfMonitorCountersAMD (GLuint group, GLint *numCounters, + GLint *maxActiveCounters, + GLsizei counterSize, GLuint *counters) +{ + check_initialized (); + resolve (fips_dispatch_glGetPerfMonitorCountersAMD, + "glGetPerfMonitorCountersAMD"); + fips_dispatch_glGetPerfMonitorCountersAMD (group, numCounters, + maxActiveCounters, + counterSize, counters); +} + +PFNGLGETPERFMONITORCOUNTERSAMDPROC fips_dispatch_glGetPerfMonitorCountersAMD = + stub_glGetPerfMonitorCountersAMD; + +static void +stub_glGetPerfMonitorGroupsStringAMD (GLuint group, GLsizei bufSize, + GLsizei *length, GLchar *groupString) +{ + check_initialized (); + resolve (fips_dispatch_glGetPerfMonitorGroupsStringAMD, + "glGetPerfMonitorGroupsStringAMD"); + fips_dispatch_glGetPerfMonitorGroupsStringAMD (group, bufSize, length, + groupString); +} + +PFNGLGETPERFMONITORGROUPSTRINGAMDPROC +fips_dispatch_glGetPerfMonitorGroupsStringAMD = + stub_glGetPerfMonitorGroupsStringAMD; + +static void +stub_glGetPerfMonitorCounterStringAMD (GLuint group, GLuint counter, + GLsizei bufSize, GLsizei *length, + GLchar *counterString) +{ + check_initialized (); + resolve (fips_dispatch_glGetPerfMonitorCounterStringAMD, + "glGetPerfMonitorCounterStringAMD"); + fips_dispatch_glGetPerfMonitorCounterStringAMD (group, counter, + bufSize, length, + counterString); +} + +PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC +fips_dispatch_glGetPerfMonitorCounterStringAMD = + stub_glGetPerfMonitorCounterStringAMD; + +static void +stub_glGetPerfMonitorCounterInfoAMD (GLuint group, GLuint counter, GLenum pname, GLvoid *data) +{ + check_initialized (); + resolve (fips_dispatch_glGetPerfMonitorCounterInfoAMD, + "glGetPerfMonitorCounterInfoAMD"); + fips_dispatch_glGetPerfMonitorCounterInfoAMD (group, counter, + pname, data); +} + +PFNGLGETPERFMONITORCOUNTERINFOAMDPROC +fips_dispatch_glGetPerfMonitorCounterInfoAMD = + stub_glGetPerfMonitorCounterInfoAMD; + +static void +stub_glGenPerfMonitorsAMD (GLsizei n, GLuint *monitors) +{ + check_initialized (); + resolve (fips_dispatch_glGenPerfMonitorsAMD, "glGenPerfMonitorsAMD"); + fips_dispatch_glGenPerfMonitorsAMD (n, monitors); +} + +PFNGLGENPERFMONITORSAMDPROC fips_dispatch_glGenPerfMonitorsAMD = + stub_glGenPerfMonitorsAMD; + +static void +stub_glDeletePerfMonitorsAMD (GLsizei n, GLuint *monitors) +{ + check_initialized (); + resolve (fips_dispatch_glDeletePerfMonitorsAMD, + "glDeletePerfMonitorsAMD"); + fips_dispatch_glDeletePerfMonitorsAMD (n, monitors); +} + +PFNGLDELETEPERFMONITORSAMDPROC fips_dispatch_glDeletePerfMonitorsAMD = + stub_glDeletePerfMonitorsAMD; + +static void +stub_glSelectPerfMonitorCountersAMD (GLuint monitor, GLboolean enable, + GLuint group, GLint numCounters, + GLuint *counterList) +{ + check_initialized (); + resolve (fips_dispatch_glSelectPerfMonitorCountersAMD, + "glSelectPerfMonitorCountersAMD"); + fips_dispatch_glSelectPerfMonitorCountersAMD (monitor, enable, group, + numCounters, counterList); +} + +PFNGLSELECTPERFMONITORCOUNTERSAMDPROC +fips_dispatch_glSelectPerfMonitorCountersAMD = + stub_glSelectPerfMonitorCountersAMD; + +static void +stub_glBeginPerfMonitorAMD (GLuint monitor) +{ + check_initialized (); + resolve (fips_dispatch_glBeginPerfMonitorAMD, "glBeginPerfMonitorAMD"); + fips_dispatch_glBeginPerfMonitorAMD (monitor); +} + +PFNGLBEGINPERFMONITORAMDPROC fips_dispatch_glBeginPerfMonitorAMD = + stub_glBeginPerfMonitorAMD; + +static void +stub_glEndPerfMonitorAMD (GLuint monitor) +{ + check_initialized (); + resolve (fips_dispatch_glEndPerfMonitorAMD, "glEndPerfMonitorAMD"); + fips_dispatch_glEndPerfMonitorAMD (monitor); +} + +PFNGLENDPERFMONITORAMDPROC fips_dispatch_glEndPerfMonitorAMD = + stub_glEndPerfMonitorAMD; + +static void +stub_glGetPerfMonitorCounterDataAMD (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten) +{ + check_initialized (); + resolve (fips_dispatch_glGetPerfMonitorCounterDataAMD, + "glGetPerfMonitorCounterDataAMD"); + fips_dispatch_glGetPerfMonitorCounterDataAMD (monitor, pname, dataSize, + data, bytesWritten); +} + +PFNGLGETPERFMONITORCOUNTERDATAAMDPROC +fips_dispatch_glGetPerfMonitorCounterDataAMD = + stub_glGetPerfMonitorCounterDataAMD; diff --git a/fips-dispatch-gl.h b/fips-dispatch-gl.h index f70f4b8..eaa23d6 100644 --- a/fips-dispatch-gl.h +++ b/fips-dispatch-gl.h @@ -35,6 +35,21 @@ #include #include +#define GL_FALSE 0 +#define GL_TRUE 1 + +#define GL_BYTE 0x1400 +#define GL_UNSIGNED_BYTE 0x1401 +#define GL_SHORT 0x1402 +#define GL_UNSIGNED_SHORT 0x1403 +#define GL_INT 0x1404 +#define GL_UNSIGNED_INT 0x1405 +#define GL_FLOAT 0x1406 +#define GL_2_BYTES 0x1407 +#define GL_3_BYTES 0x1408 +#define GL_4_BYTES 0x1409 +#define GL_DOUBLE 0x140A + typedef unsigned int GLenum; typedef unsigned int GLbitfield; typedef unsigned int GLuint; @@ -69,6 +84,24 @@ typedef void (*PFNGLBEGINQUERYPROC)(GLenum, GLuint); typedef void (*PFNGLENDQUERYPROC)(GLenum); typedef void (*PFNGLGETQUERYOBJECTUIVPROC)(GLuint, GLenum, GLuint *); +typedef void (*PFNGLGETPERFMONITORGROUPSAMDPROC)(GLint *, GLsizei, GLuint *); +typedef void (*PFNGLGETPERFMONITORCOUNTERSAMDPROC)(GLuint, GLint *, GLint *, + GLsizei, GLuint *); +typedef void (*PFNGLGETPERFMONITORGROUPSTRINGAMDPROC)(GLuint, GLsizei, + GLsizei *, GLchar *); +typedef void (*PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC)(GLuint, GLuint, + GLsizei, GLsizei *, GLchar *); +typedef void (*PFNGLGETPERFMONITORCOUNTERINFOAMDPROC)(GLuint, GLuint, + GLenum, GLvoid *); +typedef void (*PFNGLGENPERFMONITORSAMDPROC)(GLsizei, GLuint *); +typedef void (*PFNGLDELETEPERFMONITORSAMDPROC)(GLsizei, GLuint *); +typedef void (*PFNGLSELECTPERFMONITORCOUNTERSAMDPROC)(GLuint, GLboolean, + GLuint, GLint, GLuint *); +typedef void (*PFNGLBEGINPERFMONITORAMDPROC)(GLuint); +typedef void (*PFNGLENDPERFMONITORAMDPROC)(GLuint); +typedef void (*PFNGLGETPERFMONITORCOUNTERDATAAMDPROC)(GLuint, GLenum, + GLsizei, GLuint *, GLint *); + #define GL_QUERY_RESULT 0x8866 #define GL_QUERY_RESULT_AVAILABLE 0x8867 #define GL_TIME_ELAPSED 0x88BF @@ -88,4 +121,45 @@ extern PFNGLENDQUERYPROC fips_dispatch_glEndQuery; extern PFNGLGETQUERYOBJECTUIVPROC fips_dispatch_glGetQueryObjectuiv; #define glGetQueryObjectuiv fips_dispatch_glGetQueryObjectuiv +#define GL_COUNTER_TYPE_AMD 0x8BC0 +#define GL_COUNTER_RANGE_AMD 0x8BC1 +#define GL_UNSIGNED_INT64_AMD 0x8BC2 +#define GL_PERCENTAGE_AMD 0x8BC3 +#define GL_PERFMON_RESULT_AVAILABLE_AMD 0x8BC4 +#define GL_PERFMON_RESULT_SIZE_AMD 0x8BC5 +#define GL_PERFMON_RESULT_AMD 0x8BC6 + +extern PFNGLGETPERFMONITORGROUPSAMDPROC fips_dispatch_glGetPerfMonitorGroupsAMD; +#define glGetPerfMonitorGroupsAMD fips_dispatch_glGetPerfMonitorGroupsAMD + +extern PFNGLGETPERFMONITORCOUNTERSAMDPROC fips_dispatch_glGetPerfMonitorCountersAMD; +#define glGetPerfMonitorCountersAMD fips_dispatch_glGetPerfMonitorCountersAMD + +extern PFNGLGETPERFMONITORGROUPSTRINGAMDPROC fips_dispatch_glGetPerfMonitorGroupsStringAMD; +#define glGetPerfMonitorGroupsStringAMD fips_dispatch_glGetPerfMonitorGroupsStringAMD + +extern PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC fips_dispatch_glGetPerfMonitorCounterStringAMD; +#define glGetPerfMonitorCounterStringAMD fips_dispatch_glGetPerfMonitorCounterStringAMD + +extern PFNGLGETPERFMONITORCOUNTERINFOAMDPROC fips_dispatch_glGetPerfMonitorCounterInfoAMD; +#define glGetPerfMonitorCounterInfoAMD fips_dispatch_glGetPerfMonitorCounterInfoAMD + +extern PFNGLGENPERFMONITORSAMDPROC fips_dispatch_glGenPerfMonitorsAMD; +#define glGenPerfMonitorsAMD fips_dispatch_glGenPerfMonitorsAMD + +extern PFNGLDELETEPERFMONITORSAMDPROC fips_dispatch_glDeletePerfMonitorsAMD; +#define glDeletePerfMonitorsAMD fips_dispatch_glDeletePerfMonitorsAMD + +extern PFNGLSELECTPERFMONITORCOUNTERSAMDPROC fips_dispatch_glSelectPerfMonitorCountersAMD; +#define glSelectPerfMonitorCountersAMD fips_dispatch_glSelectPerfMonitorCountersAMD + +extern PFNGLBEGINPERFMONITORAMDPROC fips_dispatch_glBeginPerfMonitorAMD; +#define glBeginPerfMonitorAMD fips_dispatch_glBeginPerfMonitorAMD + +extern PFNGLENDPERFMONITORAMDPROC fips_dispatch_glEndPerfMonitorAMD; +#define glEndPerfMonitorAMD fips_dispatch_glEndPerfMonitorAMD + +extern PFNGLGETPERFMONITORCOUNTERDATAAMDPROC fips_dispatch_glGetPerfMonitorCounterDataAMD; +#define glGetPerfMonitorCounterDataAMD fips_dispatch_glGetPerfMonitorCounterDataAMD + #endif /* FIPS_DISPATCH_GL_H */ -- 2.43.0