From: smea Date: Fri, 14 Mar 2014 20:29:42 +0000 (+0100) Subject: GPU : GPU_SetDepthTest X-Git-Tag: v0.2.0~161 X-Git-Url: https://chaos.moe/g/?a=commitdiff_plain;h=f3eb629d49794016c59269118408bccb453f3a21;p=corbenik%2Fctrulib.git GPU : GPU_SetDepthTest --- diff --git a/libctru/include/ctr/GPU.h b/libctru/include/ctr/GPU.h index 1e3e55b..d1eac52 100644 --- a/libctru/include/ctr/GPU.h +++ b/libctru/include/ctr/GPU.h @@ -26,9 +26,22 @@ typedef enum{ GPU_ETC1A4=0xC }GPU_TEXCOLOR; +typedef enum +{ + GL_NEVER = 0, + GL_ALWAYS = 1, + GL_EQUAL = 2, + GL_NOTEQUAL = 3, + GL_LESS = 4, + GL_LEQUAL = 5, + GL_GREATER = 6, + GL_GEQUAL = 7 +}GPU_TestFunction; + 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_DepthRange(float nearVal, float farVal); +void GPU_SetDepthTest(bool enable, GPU_TestFunction function, u8 ref); void GPU_SetTexture(u32* data, u16 width, u16 height, u32 param, GPU_TEXCOLOR colorType); #endif diff --git a/libctru/source/GPU.c b/libctru/source/GPU.c index 7302e3d..558a4c7 100644 --- a/libctru/source/GPU.c +++ b/libctru/source/GPU.c @@ -276,6 +276,11 @@ void GPU_DepthRange(float nearVal, float farVal) GPUCMD_AddSingleParam(0x000F004E, f32tof24(farVal)); } +void GPU_SetDepthTest(bool enable, GPU_TestFunction function, u8 ref) +{ + GPUCMD_AddSingleParam(0x000F0107, (enable&1)|((function&7)<<4)|(ref<<8)); +} + void GPU_SetTexture(u32* data, u16 width, u16 height, u32 param, GPU_TEXCOLOR colorType) { GPUCMD_AddSingleParam(0x000F008E, colorType);