]> Chaos Git - corbenik/ctrulib.git/commitdiff
GPU : GPU_SetDepthTest
authorsmea <smealum@gmail.com>
Fri, 14 Mar 2014 20:29:42 +0000 (21:29 +0100)
committersmea <smealum@gmail.com>
Fri, 14 Mar 2014 20:29:42 +0000 (21:29 +0100)
libctru/include/ctr/GPU.h
libctru/source/GPU.c

index 1e3e55bbd7b5e975c8c64e4115fe42964b9a2e88..d1eac52d025f793e9f51252abb7a6e51261b474d 100644 (file)
@@ -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
index 7302e3d760de1e090edb3eae4f8e07e3cf4fb541..558a4c7eee10528ef1d599a091b9624c65330fbe 100644 (file)
@@ -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);