Perf tweaks
This commit is contained in:
parent
52ff506397
commit
adce2c7538
13
GL/draw.c
13
GL/draw.c
|
@ -11,11 +11,11 @@
|
||||||
|
|
||||||
AttribPointerList ATTRIB_POINTERS;
|
AttribPointerList ATTRIB_POINTERS;
|
||||||
GLuint ENABLED_VERTEX_ATTRIBUTES = 0;
|
GLuint ENABLED_VERTEX_ATTRIBUTES = 0;
|
||||||
GLboolean FAST_PATH_ENABLED = GL_FALSE;
|
GLuint FAST_PATH_ENABLED = GL_FALSE;
|
||||||
|
|
||||||
static GLubyte ACTIVE_CLIENT_TEXTURE = 0;
|
static GLubyte ACTIVE_CLIENT_TEXTURE = 0;
|
||||||
|
|
||||||
extern inline GLboolean _glRecalcFastPath();
|
extern inline GLuint _glRecalcFastPath();
|
||||||
|
|
||||||
#define ITERATE(count) \
|
#define ITERATE(count) \
|
||||||
GLuint i = count; \
|
GLuint i = count; \
|
||||||
|
@ -1135,9 +1135,6 @@ GL_FORCE_INLINE void submitVertices(GLenum mode, GLsizei first, GLuint count, GL
|
||||||
target->extras = &extras;
|
target->extras = &extras;
|
||||||
}
|
}
|
||||||
|
|
||||||
const GLboolean doLighting = LIGHTING_ENABLED;
|
|
||||||
const GLboolean doMultitexture = TEXTURES_ENABLED[1];
|
|
||||||
|
|
||||||
/* Polygons are treated as triangle fans, the only time this would be a
|
/* Polygons are treated as triangle fans, the only time this would be a
|
||||||
* problem is if we supported glPolygonMode(..., GL_LINE) but we don't.
|
* problem is if we supported glPolygonMode(..., GL_LINE) but we don't.
|
||||||
* We optimise the triangle and quad cases.
|
* We optimise the triangle and quad cases.
|
||||||
|
@ -1175,7 +1172,7 @@ GL_FORCE_INLINE void submitVertices(GLenum mode, GLsizei first, GLuint count, GL
|
||||||
* If we're not doing lighting though we can optimise by taking
|
* If we're not doing lighting though we can optimise by taking
|
||||||
* vertices straight to clip-space */
|
* vertices straight to clip-space */
|
||||||
|
|
||||||
if(doLighting) {
|
if(LIGHTING_ENABLED) {
|
||||||
_glMatrixLoadModelView();
|
_glMatrixLoadModelView();
|
||||||
} else {
|
} else {
|
||||||
_glMatrixLoadModelViewProjection();
|
_glMatrixLoadModelViewProjection();
|
||||||
|
@ -1190,7 +1187,7 @@ GL_FORCE_INLINE void submitVertices(GLenum mode, GLsizei first, GLuint count, GL
|
||||||
transform(target);
|
transform(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doLighting){
|
if(LIGHTING_ENABLED){
|
||||||
light(target);
|
light(target);
|
||||||
|
|
||||||
/* OK eye-space work done, now move into clip space */
|
/* OK eye-space work done, now move into clip space */
|
||||||
|
@ -1241,7 +1238,7 @@ GL_FORCE_INLINE void submitVertices(GLenum mode, GLsizei first, GLuint count, GL
|
||||||
- We want to set the uv coordinates to the passed st ones
|
- We want to set the uv coordinates to the passed st ones
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(!doMultitexture) {
|
if(!TEXTURES_ENABLED[1]) {
|
||||||
/* Multitexture actively disabled */
|
/* Multitexture actively disabled */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
#include "private.h"
|
#include "private.h"
|
||||||
|
|
||||||
extern inline GLboolean _glRecalcFastPath();
|
extern inline GLuint _glRecalcFastPath();
|
||||||
|
|
||||||
GLboolean IMMEDIATE_MODE_ACTIVE = GL_FALSE;
|
GLboolean IMMEDIATE_MODE_ACTIVE = GL_FALSE;
|
||||||
static GLenum ACTIVE_POLYGON_MODE = GL_TRIANGLES;
|
static GLenum ACTIVE_POLYGON_MODE = GL_TRIANGLES;
|
||||||
|
@ -248,7 +248,7 @@ void APIENTRY glEnd() {
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
// Immediate mode should always activate the fast path
|
// Immediate mode should always activate the fast path
|
||||||
GLboolean fastPathEnabled = _glRecalcFastPath();
|
GLuint fastPathEnabled = _glRecalcFastPath();
|
||||||
assert(fastPathEnabled);
|
assert(fastPathEnabled);
|
||||||
#else
|
#else
|
||||||
/* If we're not debugging, set to true - we assume we haven't broken it! */
|
/* If we're not debugging, set to true - we assume we haven't broken it! */
|
||||||
|
|
|
@ -391,9 +391,9 @@ GLboolean _glIsNormalizeEnabled();
|
||||||
extern AttribPointerList ATTRIB_POINTERS;
|
extern AttribPointerList ATTRIB_POINTERS;
|
||||||
|
|
||||||
extern GLuint ENABLED_VERTEX_ATTRIBUTES;
|
extern GLuint ENABLED_VERTEX_ATTRIBUTES;
|
||||||
extern GLboolean FAST_PATH_ENABLED;
|
extern GLuint FAST_PATH_ENABLED;
|
||||||
|
|
||||||
GL_FORCE_INLINE GLboolean _glIsVertexDataFastPathCompatible() {
|
GL_FORCE_INLINE GLuint _glIsVertexDataFastPathCompatible() {
|
||||||
/* The fast path is enabled when all enabled elements of the vertex
|
/* The fast path is enabled when all enabled elements of the vertex
|
||||||
* match the output format. This means:
|
* match the output format. This means:
|
||||||
*
|
*
|
||||||
|
@ -443,7 +443,7 @@ GL_FORCE_INLINE GLboolean _glIsVertexDataFastPathCompatible() {
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
GL_FORCE_INLINE GLboolean _glRecalcFastPath() {
|
GL_FORCE_INLINE GLuint _glRecalcFastPath() {
|
||||||
FAST_PATH_ENABLED = _glIsVertexDataFastPathCompatible();
|
FAST_PATH_ENABLED = _glIsVertexDataFastPathCompatible();
|
||||||
return FAST_PATH_ENABLED;
|
return FAST_PATH_ENABLED;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user