void gfxSwapBuffers() { currentBuffer[0]^=doubleBuf[0]; currentBuffer[1]^=doubleBuf[1]; gfxSetFramebufferInfo(GFX_TOP, currentBuffer[0]); gfxSetFramebufferInfo(GFX_BOTTOM, currentBuffer[1]); GSPGPU_SetBufferSwap(NULL, GFX_TOP, &topFramebufferInfo); GSPGPU_SetBufferSwap(NULL, GFX_BOTTOM, &bottomFramebufferInfo); }
void gfxSwapBuffersGpu() { currentBuffer[0]^=doubleBuf[0]; currentBuffer[1]^=doubleBuf[1]; gfxSetFramebufferInfo(GFX_TOP, currentBuffer[0]); gfxSetFramebufferInfo(GFX_BOTTOM, currentBuffer[1]); gfxWriteFramebufferInfo(GFX_TOP); gfxWriteFramebufferInfo(GFX_BOTTOM); }
void gfxInit() { gspInit(); gfxSharedMemory=(u8*)0x10002000; GSPGPU_AcquireRight(NULL, 0x0); //setup our gsp shared mem section svcCreateEvent(&gspEvent, 0x0); GSPGPU_RegisterInterruptRelayQueue(NULL, gspEvent, 0x1, &gspSharedMemHandle, &gfxThreadID); svcMapMemoryBlock(gspSharedMemHandle, (u32)gfxSharedMemory, 0x3, 0x10000000); // default gspHeap configuration : // topleft1 0x00000000-0x00046500 // topleft2 0x00046500-0x0008CA00 // bottom1 0x0008CA00-0x000C4E00 // bottom2 0x000C4E00-0x000FD200 // if 3d enabled : // topright1 0x000FD200-0x00143700 // topright2 0x00143700-0x00189C00 gfxTopLeftFramebuffers[0]=linearAlloc(0x46500); gfxTopLeftFramebuffers[1]=linearAlloc(0x46500); gfxBottomFramebuffers[0]=linearAlloc(0x38400); gfxBottomFramebuffers[1]=linearAlloc(0x38400); gfxTopRightFramebuffers[0]=linearAlloc(0x46500); gfxTopRightFramebuffers[1]=linearAlloc(0x46500); enable3d=false; //initialize framebuffer info structures gfxSetFramebufferInfo(GFX_TOP, 0); gfxSetFramebufferInfo(GFX_BOTTOM, 0); //GSP shared mem : 0x2779F000 gxCmdBuf=(u32*)(gfxSharedMemory+0x800+gfxThreadID*0x200); currentBuffer[0]=0; currentBuffer[1]=0; // Initialize event handler and wait for VBlank gspInitEventHandler(gspEvent, (vu8*)gfxSharedMemory, gfxThreadID); gspWaitForVBlank(); GSPGPU_SetLcdForceBlack(NULL, 0x0); }
void gfxInit(GSPGPU_FramebufferFormats topFormat, GSPGPU_FramebufferFormats bottomFormat, bool vrambuffers) { void *(*screenAlloc)(size_t); if (vrambuffers) { screenAlloc=vramAlloc; screenFree=vramFree; } else { screenAlloc=linearAlloc; screenFree=linearFree; } gspInit(); gfxSharedMemory=(u8*)mappableAlloc(0x1000); GSPGPU_AcquireRight(0x0); //setup our gsp shared mem section svcCreateEvent(&gspEvent, 0x0); GSPGPU_RegisterInterruptRelayQueue(gspEvent, 0x1, &gspSharedMemHandle, &gfxThreadID); svcMapMemoryBlock(gspSharedMemHandle, (u32)gfxSharedMemory, 0x3, 0x10000000); // default gspHeap configuration : // topleft1 0x00000000-0x00046500 // topleft2 0x00046500-0x0008CA00 // bottom1 0x0008CA00-0x000C4E00 // bottom2 0x000C4E00-0x000FD200 // if 3d enabled : // topright1 0x000FD200-0x00143700 // topright2 0x00143700-0x00189C00 u32 topSize = 400 * 240 * __get_bytes_per_pixel(topFormat); u32 bottomSize = 320 * 240 * __get_bytes_per_pixel(bottomFormat); gfxTopLeftFramebuffers[0]=screenAlloc(topSize); gfxTopLeftFramebuffers[1]=screenAlloc(topSize); gfxBottomFramebuffers[0]=screenAlloc(bottomSize); gfxBottomFramebuffers[1]=screenAlloc(bottomSize); gfxTopRightFramebuffers[0]=screenAlloc(topSize); gfxTopRightFramebuffers[1]=screenAlloc(topSize); enable3d=false; //set requested modes gfxSetScreenFormat(GFX_TOP,topFormat); gfxSetScreenFormat(GFX_BOTTOM,bottomFormat); //initialize framebuffer info structures gfxSetFramebufferInfo(GFX_TOP, 0); gfxSetFramebufferInfo(GFX_BOTTOM, 0); //GSP shared mem : 0x2779F000 gxCmdBuf=(u32*)(gfxSharedMemory+0x800+gfxThreadID*0x200); currentBuffer[0]=0; currentBuffer[1]=0; // Initialize event handler and wait for VBlank gspInitEventHandler(gspEvent, (vu8*) gfxSharedMemory, gfxThreadID); gspWaitForVBlank(); GSPGPU_SetLcdForceBlack(0x0); }