diff options
author | Stephane Marchesin <stephane.marchesin@gmail.com> | 2010-12-29 02:01:33 -0800 |
---|---|---|
committer | Stephane Marchesin <stephane.marchesin@gmail.com> | 2010-12-29 02:01:33 -0800 |
commit | 351262962f17a662bd41f3a873028f72ded85a31 (patch) | |
tree | 936a7628a3ad768213884b340acf3698daec1eca | |
parent | 0b54940b7334ee1c25fcecab0c00f0bf5c23c0a0 (diff) |
Add preliminary array format support.
-rw-r--r-- | epilogue.c | 45 | ||||
-rw-r--r-- | gen.c | 7 | ||||
-rw-r--r-- | prologue.c | 6 |
3 files changed, 57 insertions, 1 deletions
@@ -9,6 +9,51 @@ __GLXextFuncPtr glXGetProcAddress(const GLubyte *name) return glXGetProcAddressARB(name); } +typedef struct +{ + struct + { + GLenum type; + GLint num_components; + GLint enabled; + } + attrib[16]; +} +vertex_array_format; + +static void vertex_array_get_format(vertex_array_format* f) +{ + int a; + for(a = 0 ; a < 16 ; a++) + { + glGetVertexAttribiv(a, GL_VERTEX_ATTRIB_ARRAY_ENABLED, &f->attrib[a].enabled); + if (f->attrib[a].enabled) + { + glGetVertexAttribiv(a, GL_VERTEX_ATTRIB_ARRAY_SIZE, &f->attrib[a].num_components); + glGetVertexAttribiv(a, GL_VERTEX_ATTRIB_ARRAY_TYPE, &f->attrib[a].type); + printf("attrib %d %d %x\n",a,f->attrib[a].num_components,f->attrib[a].type); + } + else + { + f->attrib[a].num_components = 0; + f->attrib[a].type = 0; + } + } +} + +static void vertex_array_add(vertex_array_format* f, int num) +{ +} + +static void add_array(int num_elements) +{ + vertex_array_format f; + vertex_array_get_format(&f); + vertex_array_add(&f, num_elements); +} + + + static void (*rtld_fini_func)(void); static int compare(const void* a, const void* b) @@ -424,6 +424,13 @@ int main() // generate the function body + if (!strcmp(func_name,"DrawArrays")) + fprintf(file_wrapped,"\tadd_array(count);\n"); + if (!strcmp(func_name,"DrawElements")) + fprintf(file_wrapped,"\tadd_array(count);\n"); + if (!strcmp(func_name,"ArrayElement")) + fprintf(file_wrapped,"\tadd_array(1);\n"); + fprintf(file_wrapped,"\tuint64_t before, after;\n"); fprintf(file_wrapped,"\tif (trace_perfunc) {\n"); fprintf(file_wrapped,"\t\tprintf(\"gl%s\\n\");\n",func_name); @@ -20,8 +20,10 @@ static PFNGLXGETPROCADDRESSPROC lib_glXGetProcAddressARB; static const int trace_perfunc = 0; // dump the total time per function static const int trace_summary = 1; -// dump the shader programs² +// dump the shader programs static const int trace_shaders = 0; +// trace vertex array performance +static const int trace_arrays = 0; static uint64_t gettime64() { @@ -30,4 +32,6 @@ static uint64_t gettime64() return ((uint64_t)tv.tv_sec * 1000000ULL + (uint64_t)tv.tv_usec); } +static void add_array(int num_elements); + |