Fixed PSP rendering

This commit is contained in:
2026-07-16 21:20:49 -05:00
parent ef5adf8274
commit f16c80aa0f
2 changed files with 45 additions and 1 deletions
+1 -1
View File
@@ -142,7 +142,7 @@ errorret_t shaderDisposeGL(shadergl_t *shader);
/**
* During mesh rendering, this is requesting the legacy system to push all
* shaders necessary to render the currently bound shader's matrices.
*
*
* @return Any error state.
*/
errorret_t shaderLegacyMatrixUpdate();
+44
View File
@@ -10,6 +10,7 @@
#include "util/string.h"
#include "assert/assert.h"
#include "display/displaysdl2.h"
#include "display/shader/shadergl.h"
errorret_t networkPSPInit() {
// Requests the PSP to load the network modules.
@@ -65,6 +66,49 @@ errorret_t networkPSPUpdate() {
break;
case PSP_UTILITY_DIALOG_VISIBLE:
// The dialog renders using whatever GL state we leave lying
// around, immediately before it draws - it doesn't set up its
// own blend/cull/depth/texture state from scratch. Match exactly
// what our own text rendering uses (displaySetState's
// BLEND-only flags, plus shaderUnlitSetMaterial's texture/color
// setup), otherwise its text/icons render missing while its
// untextured chrome still appears fine.
glDisable(GL_CULL_FACE);
errorChain(errorGLCheck());
glDisable(GL_DEPTH_TEST);
errorChain(errorGLCheck());
glEnable(GL_BLEND);
errorChain(errorGLCheck());
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
errorChain(errorGLCheck());
glEnable(GL_TEXTURE_2D);
errorChain(errorGLCheck());
glBindTexture(GL_TEXTURE_2D, TEXTURE_WHITE.id);
errorChain(errorGLCheck());
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
errorChain(errorGLCheck());
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
errorChain(errorGLCheck());
SHADER_LEGACY.boundTextureId = TEXTURE_WHITE.id;
// pspGL defers actually applying state to the GPU until the
// next real draw call - the calls above alone may be no-ops
// on hardware. Force a flush with a degenerate (zero-area, so
// nothing actually rasterizes) triangle.
const float_t degenerate[3 * 5] = {
0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
};
const GLsizei stride = sizeof(float_t) * 5;
glVertexPointer(3, GL_FLOAT, stride, &degenerate[0]);
errorChain(errorGLCheck());
glTexCoordPointer(2, GL_FLOAT, stride, &degenerate[3]);
errorChain(errorGLCheck());
glDrawArrays(GL_TRIANGLES, 0, 3);
errorChain(errorGLCheck());
// 1 is mandatory?
ret = sceUtilityNetconfUpdate(1);
if(ret != 0) {