N64: Still enable Z when depth write is enabled

This commit is contained in:
UnknownShadow200 2025-07-11 23:09:30 +10:00
parent 07026d593c
commit 167f501a1a
4 changed files with 15 additions and 7 deletions

View File

@ -95,7 +95,7 @@ static int gpu_stride;
#define GPU_ATTR_TEX (1 << 9)
#define GPU_ATTR_SHADE (1 << 10)
#define GPU_ATTR_EDGE (1 << 11)
static bool gpu_attr_z, gpu_attr_tex;
static uint8_t gpu_attr_z, gpu_attr_tex;
static void gpuUpdateFormat(void)
{

View File

@ -96,7 +96,7 @@ void Gfx_BeginFrame(void) {
surface_t* disp = display_get();
rdpq_attach(disp, &zbuffer);
Platform_LogConst("== BEGIN frame");
//Platform_LogConst("== BEGIN frame");
}
extern void __rdpq_autosync_change(int mode);
@ -251,14 +251,21 @@ static void SetColorWrite(cc_bool r, cc_bool g, cc_bool b, cc_bool a) {
//gpuColorMask(r, g, b, a); TODO
}
#define FLAG_Z_WRITE 0x02
void Gfx_SetDepthWrite(cc_bool enabled) {
__rdpq_mode_change_som(SOM_Z_WRITE, enabled ? SOM_Z_WRITE : 0);
gpu_attr_z &= ~FLAG_Z_WRITE;
gpu_attr_z |= enabled ? FLAG_Z_WRITE : 0;
gpuUpdateFormat();
}
#define FLAG_Z_READ 0x01
void Gfx_SetDepthTest(cc_bool enabled) {
__rdpq_mode_change_som(SOM_Z_COMPARE, enabled ? SOM_Z_COMPARE : 0);
gpu_attr_z = enabled;
gpu_attr_z &= ~FLAG_Z_READ;
gpu_attr_z |= enabled ? FLAG_Z_READ : 0;
gpuUpdateFormat();
}

View File

@ -119,7 +119,7 @@ void Gfx_UpdateTexture(GfxResourceID texId, int x, int y, struct Bitmap* part, i
CopyPixels(dst, tex->width * BITMAPCOLOR_SIZE,
part->scan0, rowWidth * BITMAPCOLOR_SIZE,
bmp->width, bmp->height);
part->width, part->height);
}
void Gfx_EnableMipmaps(void) { }

View File

@ -332,7 +332,8 @@ static CC_INLINE void CopyPixels(void* dst, int dstStride,
Mem_Copy(dst_, src_, Bitmap_DataSize(pixelsPerRow, rows));
} else {
/* Have to copy scanline by scanline */
for (y = 0; y < rows; y++) {
for (y = 0; y < rows; y++)
{
Mem_Copy(dst_, src_, pixelsPerRow * BITMAPCOLOR_SIZE);
src_ += srcStride;
dst_ += dstStride;