Page 1 of 1

GU doesn't do anything.

Posted: Sun Dec 30, 2018 5:05 pm
by Axiom
I've been pounding my head against my desk for 3 weeks now trying to figure out why I can't seem to get the GU to do anything, not even clear the screen. Initially, this was part of a bigger project but i've now broken it down into these calls in hopes of getting the screen to clear red.

Code: Select all

#define GYRO_PSP_BUFFER_WIDTH 512
#define GYRO_PSP_SCREEN_WIDTH 480
#define GYRO_PSP_SCREEN_HEIGHT 272

static unsigned int __attribute__((aligned(16))) displayList[262144];

int main(int argc, char const *argv[])
{
  void* fb0 = getStaticVramBuffer(GYRO_PSP_BUFFER_WIDTH, GYRO_PSP_SCREEN_HEIGHT, GU_PSM_8888);
  void* fb1 = getStaticVramBuffer(GYRO_PSP_BUFFER_WIDTH, GYRO_PSP_SCREEN_HEIGHT, GU_PSM_8888);
  void* zb = getStaticVramBuffer(GYRO_PSP_BUFFER_WIDTH, GYRO_PSP_SCREEN_HEIGHT, GU_PSM_4444);

  sceGuInit();
  sceGuStart(GU_DIRECT, displayList);
  gyPrintf("Memory Locations\nFB0: %p\nFB1: %p\nZB: %p\n\n", fb0, fb1, zb);
  sceGuDrawBuffer(GU_PSM_8888, fb0, GYRO_PSP_BUFFER_WIDTH);
  sceGuDispBuffer(GYRO_PSP_SCREEN_WIDTH, GYRO_PSP_SCREEN_HEIGHT, fb1, GYRO_PSP_BUFFER_WIDTH);
  sceGuDepthBuffer(zb, GYRO_PSP_BUFFER_WIDTH);
  while(running)
  {
    sceGuStart(GU_DIRECT, displayList);
    sceGuClearColor(GU_COLOR(1.0f, 0.0f, 0.0f, 1.0f));
    sceGuClearDepth(0);
    sceGuClear(GU_COLOR_BUFFER_BIT);
    sceGuFinish();
    sceGuSync(0, 0);
    sceGuDisplay(GU_TRUE);
    sceDisplayWaitVblankStart();
    fb0 = sceGuSwapBuffers();
  }
  sceGuTerm();
  return 0;
}
I'm then compiling the code against the latest PSPSDK from GitHub inside of an Ubuntu virtual machine. Afterward, I've run this example on real hardware and PPSSPP and neither will show a red screen. What am I missing here? This code is basically ripped straight from the examples with the exception of it not actually drawing anything. Yet, I can't even get it to clear the screen red.

Result:
Image