author | Don Pellegrino <don@drexel.edu> | 2009-07-07 20:26:59 (GMT) |
---|---|---|
committer | Don Pellegrino <don@drexel.edu> | 2009-07-07 20:26:59 (GMT) |
commit | 5fb9b85f6043f985de3397b724553a830f0393e4 (patch) (side-by-side diff) | |
tree | f0bd53a770c4ae66358fbf35c2549af895555cf6 | |
parent | 4d1d3121118c90206445542c48c7c7c6dffa8772 (diff) | |
download | exp005-5fb9b85f6043f985de3397b724553a830f0393e4.zip exp005-5fb9b85f6043f985de3397b724553a830f0393e4.tar.gz exp005-5fb9b85f6043f985de3397b724553a830f0393e4.tar.bz2 |
Code to test the use of the AMD Performance Monitor OpenGL
Extensions. This test failed as it seems that the non-free Linux
driver from AMD does not include an implementation of the extension
functions.
3 files changed, 62 insertions, 0 deletions
diff --git a/src/util/amd_performance_monitor/ati_counter_info.h b/src/util/amd_performance_monitor/ati_counter_info.h new file mode 100644 index 0000000..36fdfdc --- a/dev/null +++ b/src/util/amd_performance_monitor/ati_counter_info.h @@ -0,0 +1,13 @@ +#ifndef ATI_COUNTER_INFO_H +#define ATI_COUNTER_INFO_H + +#include <GL/glut.h> + +typedef struct +{ + GLuint *counterList; + int numCounters; + int maxActiveCounters; +} ATI_Counter_Info; + +#endif // ATI_COUNTER_INFO_H diff --git a/src/util/amd_performance_monitor/ati_get_group_and_counter_list.c b/src/util/amd_performance_monitor/ati_get_group_and_counter_list.c new file mode 100644 index 0000000..cb6419b --- a/dev/null +++ b/src/util/amd_performance_monitor/ati_get_group_and_counter_list.c @@ -0,0 +1,36 @@ +#include "ati_get_group_and_counter_list.h" +#include <stdlib.h> + +extern void glGetPerfMonitorGroupsAMD (int* numGroups, int groupsSize, + void *groups); + +void +ati_get_group_and_counter_list (GLuint ** groupsList, int *numGroups, + ATI_Counter_Info ** counterInfo) +{ + GLint n; + GLuint *groups; + ATI_Counter_Info *counters; + + glGetPerfMonitorGroupsAMD (&n, 0, NULL); + groups = (GLuint *) malloc (n * sizeof (GLuint)); + glGetPerfMonitorGroupsAMD (NULL, n, groups); + *numGroups = n; + + *groupsList = groups; + counters = (ATI_Counter_Info *) malloc (sizeof (ATI_Counter_Info) * n); + for (int i = 0; i < n; i++) + { + glGetPerfMonitorCountersAMD (groups[i], &counters[i].numCounters, + &counters[i].maxActiveCounters, 0, NULL); + counters[i].counterList = (GLuint *) malloc (counters[i].numCounters * + sizeof (int)); + glGetPerfMonitorCountersAMD (groups[i], NULL, NULL, + counters[i].numCounters, + counters[i].counterList); + } + + *counterInfo = counters; + + return; +} diff --git a/src/util/amd_performance_monitor/ati_get_group_and_counter_list.h b/src/util/amd_performance_monitor/ati_get_group_and_counter_list.h new file mode 100644 index 0000000..e30096e --- a/dev/null +++ b/src/util/amd_performance_monitor/ati_get_group_and_counter_list.h @@ -0,0 +1,13 @@ +#ifndef ATI_GET_GROUP_AND_COUNTER_LIST_H +#define ATI_GET_GROUP_AND_COUNTER_LIST_H + +#include "ati_counter_info.h" + +/* + * Code from + * http://www.opengl.org/registry/specs/AMD/performance_monitor.txt + */ +void ati_get_group_and_counter_list (GLuint ** groupsList, int *numGroups, + ATI_Counter_Info ** counterInfo); + +#endif // ATI_GET_GROUP_AND_COUNTER_LIST_H |