diff --git a/GL/draw.c b/GL/draw.c index b580854..3170e01 100644 --- a/GL/draw.c +++ b/GL/draw.c @@ -849,11 +849,18 @@ static void generate(SubmissionTarget* target, const GLenum mode, const GLsizei const Vertex* end; if(!indices) { - _readPositionData(first, count, _glSubmissionTargetStart(target)); + profiler_push(__func__); + + _readPositionData(first, count, _glSubmissionTargetStart(target)); + profiler_checkpoint("positions"); + _readDiffuseData(first, count, _glSubmissionTargetStart(target)); + profiler_checkpoint("diffuse"); + if(doTexture) _readUVData(first, count, _glSubmissionTargetStart(target)); if(doLighting) _readNormalData(first, count, target); if(doTexture && doMultitexture) _readSTData(first, count, target); + profiler_checkpoint("others"); it = _glSubmissionTargetStart(target); end = _glSubmissionTargetEnd(target); @@ -862,6 +869,8 @@ static void generate(SubmissionTarget* target, const GLenum mode, const GLsizei (it++)->flags = PVR_CMD_VERTEX; } + profiler_checkpoint("flags"); + // Drawing arrays switch(mode) { case GL_TRIANGLES: @@ -879,6 +888,9 @@ static void generate(SubmissionTarget* target, const GLenum mode, const GLsizei default: assert(0 && "Not Implemented"); } + + profiler_checkpoint("quads"); + profiler_pop(); } else { const IndexParseFunc indexFunc = _calcParseIndexFunc(type); it = _glSubmissionTargetStart(target); diff --git a/GL/immediate.c b/GL/immediate.c index ccd8a5e..1ea573a 100644 --- a/GL/immediate.c +++ b/GL/immediate.c @@ -9,6 +9,7 @@ #include "../include/gl.h" #include "../include/glext.h" +#include "profiler.h" #include "private.h" @@ -174,6 +175,8 @@ void APIENTRY glNormal3fv(const GLfloat* v) { } void APIENTRY glEnd() { + profiler_push(__func__); + IMMEDIATE_MODE_ACTIVE = GL_FALSE; GLboolean vertexArrayEnabled, colorArrayEnabled, normalArrayEnabled; @@ -189,6 +192,8 @@ void APIENTRY glEnd() { AttribPointer uvptr = *_glGetUVAttribPointer(); AttribPointer stptr = *_glGetSTAttribPointer(); + profiler_checkpoint("prep"); + glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_COLOR_ARRAY); glEnableClientState(GL_NORMAL_ARRAY); @@ -210,14 +215,20 @@ void APIENTRY glEnd() { glEnableClientState(GL_TEXTURE_COORD_ARRAY); glTexCoordPointer(2, GL_FLOAT, 0, ST_COORDS.data); + profiler_checkpoint("client_state"); + glDrawArrays(ACTIVE_POLYGON_MODE, 0, VERTICES.size / 3); + profiler_checkpoint("draw_arrays"); + aligned_vector_clear(&VERTICES); aligned_vector_clear(&COLOURS); aligned_vector_clear(&UV_COORDS); aligned_vector_clear(&ST_COORDS); aligned_vector_clear(&NORMALS); + profiler_checkpoint("clear"); + *_glGetVertexAttribPointer() = vptr; *_glGetDiffuseAttribPointer() = dptr; *_glGetNormalAttribPointer() = nptr; @@ -248,6 +259,8 @@ void APIENTRY glEnd() { glClientActiveTextureARB((GLuint) activeTexture); + profiler_checkpoint("restore"); + profiler_pop(); } void APIENTRY glRectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2) {