GPU : added buffer setup commands to GPU_SetViewport
This commit is contained in:
parent
21dbf5aa75
commit
bffbc975e2
@ -114,7 +114,13 @@ int main()
|
||||
GSPGPU_WriteHWRegs(NULL, 0x202A04, ®Data, 4);
|
||||
|
||||
GPUCMD_SetBuffer(gpuCmd, gpuCmdSize, 0);
|
||||
GPUCMD_AddSingleParam(0x0008025E, 0x00000000);
|
||||
|
||||
//depth buffer in VRAM, color buffer in FCRAM (gspHeap)
|
||||
//(no real reasoning behind this configuration)
|
||||
GPU_SetViewport((u32*)0x18000000,(u32*)0x20000000,0,0,240*2,400);
|
||||
SHDR_UseProgram(shader, 0);
|
||||
GPUCMD_AddSingleParam(0x0008025E, 0x00000000);
|
||||
|
||||
GPUCMD_Finalize();
|
||||
GPUCMD_Run(gxCmdBuf);
|
||||
|
||||
|
@ -11,6 +11,6 @@ void GPUCMD_AddSingleParam(u32 cmd, u32 param);
|
||||
void GPUCMD_Finalize();
|
||||
|
||||
void GPU_SetUniform(u32 startreg, u32* data, u32 numreg);
|
||||
void GPU_SetViewport(u32 x, u32 y, float w, float h);
|
||||
void GPU_SetViewport(u32* depthBuffer, u32* colorBuffer, u32 x, u32 y, u32 w, u32 h);
|
||||
|
||||
#endif
|
||||
|
@ -222,7 +222,7 @@ u32 computeInvValue(u32 val)
|
||||
u32 tmp3=*((u32*)&fval);
|
||||
tmp1=(tmp3<<9)>>9;
|
||||
tmp2=tmp3&(~0x80000000);
|
||||
if(tmp3&(~0x80000000))
|
||||
if(tmp2)
|
||||
{
|
||||
tmp1=(tmp3<<9)>>9;
|
||||
int tmp=((tmp3<<1)>>24)-0x40;
|
||||
@ -233,15 +233,38 @@ u32 computeInvValue(u32 val)
|
||||
return (tmp1|(tmp2<<23)|(tmp3<<30))<<1;
|
||||
}
|
||||
|
||||
void GPU_SetViewport(u32 x, u32 y, float w, float h)
|
||||
//takes PAs as arguments
|
||||
void GPU_SetViewport(u32* depthBuffer, u32* colorBuffer, u32 x, u32 y, u32 w, u32 h)
|
||||
{
|
||||
u32 param[0x4];
|
||||
float fw=(float)w;
|
||||
float fh=(float)h;
|
||||
|
||||
param[0x0]=f32tof24(w/2);
|
||||
param[0x1]=computeInvValue(w);
|
||||
param[0x2]=f32tof24(h/2);
|
||||
param[0x3]=computeInvValue(h);
|
||||
GPUCMD_AddSingleParam(0x000F0111, 0x00000001);
|
||||
GPUCMD_AddSingleParam(0x000F0110, 0x00000001);
|
||||
|
||||
u32 f116e=0x01000000|(((h-1)&0xFFF)<<12)|(w&0xFFF);
|
||||
|
||||
param[0x0]=((u32)depthBuffer)>>3;
|
||||
param[0x1]=((u32)colorBuffer)>>3;
|
||||
param[0x2]=f116e;
|
||||
GPUCMD_Add(0x800F011C, param, 0x00000003);
|
||||
|
||||
GPUCMD_AddSingleParam(0x000F006E, f116e);
|
||||
GPUCMD_AddSingleParam(0x000F0116, 0x00000003); //?
|
||||
GPUCMD_AddSingleParam(0x000F0117, 0x00000002); //?
|
||||
GPUCMD_AddSingleParam(0x000F011B, 0x00000000); //?
|
||||
|
||||
param[0x0]=f32tof24(fw/2);
|
||||
param[0x1]=computeInvValue(fw);
|
||||
param[0x2]=f32tof24(fh/2);
|
||||
param[0x3]=computeInvValue(fh);
|
||||
GPUCMD_Add(0x800F0041, param, 0x00000004);
|
||||
|
||||
GPUCMD_AddSingleParam(0x000F0068, (y<<16)|(x&0xFFFF));
|
||||
|
||||
param[0x0]=0x00000000;
|
||||
param[0x1]=0x00000000;
|
||||
param[0x2]=((h-1)<<16)|((w-1)&0xFFFF);
|
||||
GPUCMD_Add(0x800F0065, param, 0x00000003);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user