Scissor test.

(if calling SetScissorTest right after SetViewport, call FinishDrawing inbetween)
This commit is contained in:
StapleButter 2014-11-11 00:12:31 +01:00
parent bb1bb0f554
commit 6e9cd355a5
2 changed files with 21 additions and 0 deletions

View File

@ -65,6 +65,15 @@ typedef enum
GPU_GEQUAL = 7 GPU_GEQUAL = 7
}GPU_TESTFUNC; }GPU_TESTFUNC;
typedef enum
{
GPU_SCISSOR_DISABLE = 0, // disable scissor test
GPU_SCISSOR_INVERT = 1, // exclude pixels inside the scissor box
// 2 is the same as 0
GPU_SCISSOR_NORMAL = 3, // exclude pixels outside of the scissor box
} GPU_SCISSORMODE;
typedef enum typedef enum
{ {
GPU_KEEP = 0, // keep destination value GPU_KEEP = 0, // keep destination value
@ -183,6 +192,8 @@ void GPU_SetUniform(u32 startreg, u32* data, u32 numreg);
void GPU_SetViewport(u32* depthBuffer, u32* colorBuffer, u32 x, u32 y, u32 w, u32 h); void GPU_SetViewport(u32* depthBuffer, u32* colorBuffer, u32 x, u32 y, u32 w, u32 h);
void GPU_SetScissorTest(GPU_SCISSORMODE mode, u32 x, u32 y, u32 w, u32 h);
void GPU_DepthRange(float nearVal, float farVal); void GPU_DepthRange(float nearVal, float farVal);
void GPU_SetAlphaTest(bool enable, GPU_TESTFUNC function, u8 ref); void GPU_SetAlphaTest(bool enable, GPU_TESTFUNC function, u8 ref);
void GPU_SetDepthTestAndWriteMask(bool enable, GPU_TESTFUNC function, GPU_WRITEMASK writemask); // GPU_WRITEMASK values can be ORed together void GPU_SetDepthTestAndWriteMask(bool enable, GPU_TESTFUNC function, GPU_WRITEMASK writemask); // GPU_WRITEMASK values can be ORed together

View File

@ -304,6 +304,16 @@ void GPU_SetViewport(u32* depthBuffer, u32* colorBuffer, u32 x, u32 y, u32 w, u3
GPUCMD_Add(0x800F0112, param, 0x00000004); GPUCMD_Add(0x800F0112, param, 0x00000004);
} }
void GPU_SetScissorTest(GPU_SCISSORMODE mode, u32 x, u32 y, u32 w, u32 h)
{
u32 param[3];
param[0x0] = mode;
param[0x1] = (y<<16)|(x&0xFFFF);
param[0x2] = ((h-1)<<16)|((w-1)&0xFFFF);
GPUCMD_Add(0x800F0065, param, 0x00000003);
}
void GPU_DepthRange(float nearVal, float farVal) void GPU_DepthRange(float nearVal, float farVal)
{ {
GPUCMD_AddSingleParam(0x000F006D, 0x00000001); //? GPUCMD_AddSingleParam(0x000F006D, 0x00000001); //?