vramMemAlign for buffers and fixed indent

This commit is contained in:
Lectem 2015-06-18 07:04:10 +02:00
parent e1baf131d1
commit 20397232b8

View File

@ -64,10 +64,9 @@ typedef struct {
#define GPU_CMD_SIZE 0x40000 #define GPU_CMD_SIZE 0x40000
//GPU framebuffer address //GPU framebuffer address
u32* gpuFBuffer =(u32*)0x1F119400; u32* gpuFBuffer = NULL;
//GPU depth buffer address //GPU depth buffer address
u32* gpuDBuffer =(u32*)0x1F370800; u32* gpuDBuffer = NULL;
//GPU command buffers //GPU command buffers
u32* gpuCmd = NULL; u32* gpuCmd = NULL;
@ -108,8 +107,12 @@ void gpuInit()
res = shaderProgramSetVsh(&shader, &shader_dvlb->DVLE[0]); res = shaderProgramSetVsh(&shader, &shader_dvlb->DVLE[0]);
my_assert(res >=0); // check for errors my_assert(res >=0); // check for errors
//Allocate the GPU render buffers
gpuFBuffer = vramMemAlign(400*240*8, 0x100);
gpuDBuffer = vramMemAlign(400*240*8, 0x100);
//In this example we are only rendering in "2D mode", so we don't need one command buffer per eye //In this example we are only rendering in "2D mode", so we don't need one command buffer per eye
gpuCmd=(u32*)linearAlloc(GPU_CMD_SIZE * (sizeof *gpuCmd) ); //Don't forget that commands size is 4 (hence the sizeof) gpuCmd = linearAlloc(GPU_CMD_SIZE * (sizeof *gpuCmd) ); //Don't forget that commands size is 4 (hence the sizeof)
my_assert(gpuCmd != NULL); my_assert(gpuCmd != NULL);
//Reset the gpu //Reset the gpu
@ -132,6 +135,8 @@ void gpuExit()
{ {
//do things properly //do things properly
linearFree(gpuCmd); linearFree(gpuCmd);
vramFree(gpuDBuffer);
vramFree(gpuFBuffer);
shaderProgramFree(&shader); shaderProgramFree(&shader);
DVLB_Free(shader_dvlb); DVLB_Free(shader_dvlb);
GPU_Reset(NULL, gpuCmd, GPU_CMD_SIZE); // Not really needed, but safer for the next applications ? GPU_Reset(NULL, gpuCmd, GPU_CMD_SIZE); // Not really needed, but safer for the next applications ?