Fixed PSP rendering
This commit is contained in:
@@ -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, °enerate[0]);
|
||||
errorChain(errorGLCheck());
|
||||
glTexCoordPointer(2, GL_FLOAT, stride, °enerate[3]);
|
||||
errorChain(errorGLCheck());
|
||||
glDrawArrays(GL_TRIANGLES, 0, 3);
|
||||
errorChain(errorGLCheck());
|
||||
|
||||
// 1 is mandatory?
|
||||
ret = sceUtilityNetconfUpdate(1);
|
||||
if(ret != 0) {
|
||||
|
||||
Reference in New Issue
Block a user