Fix performance drop when rendering translucent on PowerVR MBX

This commit is contained in:
Shinovon 2025-07-24 07:40:02 +05:00
parent 6f6eba3d2c
commit e6644af301
2 changed files with 29 additions and 0 deletions

View File

@ -42,6 +42,8 @@ typedef cc_uintptr GLpointer;
#define GL_TRIANGLES 0x0004
#define GL_QUADS 0x0007
#define GL_ZERO 0
#define GL_ONE 1
#define GL_BLEND 0x0BE2
#define GL_SRC_ALPHA 0x0302
#define GL_ONE_MINUS_SRC_ALPHA 0x0303

View File

@ -25,6 +25,8 @@
#include "../misc/opengl/GL1Funcs.h"
#if defined CC_BUILD_SYMBIAN
#include "../misc/opengl/GL2Funcs.h"
static cc_bool mbx;
#endif
#if CC_BUILD_MAXSTACK <= (64 * 1024)
@ -84,7 +86,9 @@ void Gfx_Create(void) {
#ifdef CC_BUILD_GL11_FALLBACK
GLContext_GetAll(coreFuncs, Array_Elems(coreFuncs));
#endif
#ifndef CC_BUILD_GLES
customMipmapsLevels = true;
#endif
Gfx.BackendType = CC_GFX_BACKEND_GL1;
GL_InitCommon();
@ -335,6 +339,17 @@ static void SetAlphaTest(cc_bool enabled) {
void Gfx_DepthOnlyRendering(cc_bool depthOnly) {
cc_bool enabled = !depthOnly;
#ifdef CC_BUILD_SYMBIAN
if (mbx) {
if (depthOnly) {
_glBlendFunc(GL_ZERO, GL_ONE);
Gfx_SetAlphaBlending(true);
} else {
_glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
return;
}
#endif
SetColorWrite(enabled & gfx_colorMask[0], enabled & gfx_colorMask[1],
enabled & gfx_colorMask[2], enabled & gfx_colorMask[3]);
@ -422,6 +437,18 @@ cc_bool Gfx_WarnIfNecessary(void) {
Gfx.Limitations |= GFX_LIMIT_VERTEX_ONLY_FOG;
return true;
}
#if defined CC_BUILD_SYMBIAN
if (String_ContainsConst(&renderer, "SGX")) {
} else if (String_ContainsConst(&renderer, "MBX")) {
Gfx.Limitations |= GFX_LIMIT_VERTEX_ONLY_FOG;
mbx = true;
} else if (!String_ContainsConst(&renderer, "HW")) {
Chat_AddRaw("&cSoftware rendering is being used, performance will greatly suffer.");
Gfx.Limitations |= GFX_LIMIT_MINIMAL;
return true;
}
#endif
return false;
}