Add bIsZBuffer parameter to C3D_DepthMap

This commit is contained in:
fincs 2017-02-09 19:59:31 +01:00
parent 7a55e4554a
commit 73aea35120
4 changed files with 6 additions and 4 deletions

View File

@ -1,7 +1,7 @@
#pragma once
#include "types.h"
void C3D_DepthMap(float zScale, float zOffset);
void C3D_DepthMap(bool bIsZBuffer, float zScale, float zOffset);
void C3D_CullFace(GPU_CULLMODE mode);
void C3D_StencilTest(bool enable, GPU_TESTFUNC function, int ref, int inputMask, int writeMask);
void C3D_StencilOp(GPU_STENCILOP sfail, GPU_STENCILOP dfail, GPU_STENCILOP pass);

View File

@ -90,7 +90,7 @@ bool C3D_Init(size_t cmdBufSize)
ctx->renderQueueExit = NULL;
// TODO: replace with direct struct access
C3D_DepthMap(-1.0f, 0.0f);
C3D_DepthMap(true, -1.0f, 0.0f);
C3D_CullFace(GPU_CULL_BACK_CCW);
C3D_StencilTest(false, GPU_ALWAYS, 0x00, 0xFF, 0x00);
C3D_StencilOp(GPU_STENCIL_KEEP, GPU_STENCIL_KEEP, GPU_STENCIL_KEEP);

View File

@ -7,9 +7,10 @@ static inline C3D_Effect* getEffect()
return &ctx->effect;
}
void C3D_DepthMap(float zScale, float zOffset)
void C3D_DepthMap(bool bIsZBuffer, float zScale, float zOffset)
{
C3D_Effect* e = getEffect();
e->zBuffer = bIsZBuffer;
e->zScale = f32tof24(zScale);
e->zOffset = f32tof24(zOffset);
}
@ -74,7 +75,7 @@ void C3D_FragOpMode(GPU_FRAGOPMODE mode)
void C3Di_EffectBind(C3D_Effect* e)
{
GPUCMD_AddWrite(GPUREG_DEPTHMAP_ENABLE, 1);
GPUCMD_AddWrite(GPUREG_DEPTHMAP_ENABLE, e->zBuffer ? 1 : 0);
GPUCMD_AddWrite(GPUREG_FACECULLING_CONFIG, e->cullMode & 0x3);
GPUCMD_AddIncrementalWrites(GPUREG_DEPTHMAP_SCALE, (u32*)&e->zScale, 2);
GPUCMD_AddIncrementalWrites(GPUREG_FRAGOP_ALPHA_TEST, (u32*)&e->alphaTest, 4);

View File

@ -12,6 +12,7 @@ typedef struct
u32 fragOpMode;
u32 zScale, zOffset;
GPU_CULLMODE cullMode;
bool zBuffer;
u32 alphaTest;
u32 stencilMode, stencilOp;