Perf tweaks

This commit is contained in:
Luke Benstead 2021-05-08 14:38:55 +01:00
parent cfefce44a6
commit 06529d4fe7
3 changed files with 29 additions and 26 deletions

View File

@ -2,9 +2,9 @@
#include "../containers/aligned_vector.h"
#include "private.h"
static PolyList OP_LIST;
static PolyList PT_LIST;
static PolyList TR_LIST;
PolyList OP_LIST;
PolyList PT_LIST;
PolyList TR_LIST;
/** Don't fully comply to the GL standard to make some performance
* gains. Specifically glDepthRange will be ignored, and the final
@ -15,16 +15,6 @@ static PolyList TR_LIST;
#define FAST_MODE GL_TRUE
PolyList* _glActivePolyList() {
if(_glIsBlendingEnabled()) {
return &TR_LIST;
} else if(_glIsAlphaTestEnabled()) {
return &PT_LIST;
} else {
return &OP_LIST;
}
}
PolyList* _glOpaquePolyList() {
return &OP_LIST;
}

View File

@ -277,7 +277,6 @@ struct SubmissionTarget;
float _glClipLineToNearZ(const Vertex* v1, const Vertex* v2, Vertex* vout);
void _glClipTriangleStrip(SubmissionTarget* target, uint8_t fladeShade);
PolyList *_glActivePolyList();
PolyList* _glOpaquePolyList();
PolyList* _glPunchThruPolyList();
PolyList *_glTransparentPolyList();
@ -338,8 +337,30 @@ void _glSetInternalPaletteFormat(GLenum val);
GLboolean _glIsSharedTexturePaletteEnabled();
void _glApplyColorTable(TexturePalette *palette);
GLboolean _glIsBlendingEnabled();
GLboolean _glIsAlphaTestEnabled();
extern GLboolean BLEND_ENABLED;
extern GLboolean ALPHA_TEST_ENABLED;
GL_FORCE_INLINE GLboolean _glIsBlendingEnabled() {
return BLEND_ENABLED;
}
GL_FORCE_INLINE GLboolean _glIsAlphaTestEnabled() {
return ALPHA_TEST_ENABLED;
}
extern PolyList OP_LIST;
extern PolyList PT_LIST;
extern PolyList TR_LIST;
GL_FORCE_INLINE PolyList* _glActivePolyList() {
if(BLEND_ENABLED) {
return &TR_LIST;
} else if(ALPHA_TEST_ENABLED) {
return &PT_LIST;
} else {
return &OP_LIST;
}
}
GLboolean _glIsMipmapComplete(const TextureObject* obj);
GLubyte* _glGetMipmapLocation(const TextureObject* obj, GLuint level);

View File

@ -23,7 +23,7 @@ static GLboolean LIGHTING_ENABLED = GL_FALSE;
/* Is the shared texture palette enabled? */
static GLboolean SHARED_PALETTE_ENABLED = GL_FALSE;
static GLboolean ALPHA_TEST_ENABLED = GL_FALSE;
GLboolean ALPHA_TEST_ENABLED = GL_FALSE;
static GLboolean POLYGON_OFFSET_ENABLED = GL_FALSE;
@ -89,7 +89,7 @@ static int _calc_pvr_depth_test() {
static GLenum BLEND_SFACTOR = GL_ONE;
static GLenum BLEND_DFACTOR = GL_ZERO;
static GLboolean BLEND_ENABLED = GL_FALSE;
GLboolean BLEND_ENABLED = GL_FALSE;
static GLfloat OFFSET_FACTOR = 0.0f;
static GLfloat OFFSET_UNITS = 0.0f;
@ -98,14 +98,6 @@ GLboolean _glIsNormalizeEnabled() {
return NORMALIZE_ENABLED;
}
GLboolean _glIsBlendingEnabled() {
return BLEND_ENABLED;
}
GLboolean _glIsAlphaTestEnabled() {
return ALPHA_TEST_ENABLED;
}
static int _calcPVRBlendFactor(GLenum factor) {
switch(factor) {
case GL_ZERO: