PS2SDK
PS2 Homebrew Libraries
Loading...
Searching...
No Matches
Zbuffer.c
1/*
2# _____ ___ ____ ___ ____
3# ____| | ____| | | |____|
4# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
5#-----------------------------------------------------------------------
6# (c) 2009 Lion
7# Licenced under Academic Free License version 2.0
8# Review ps2sdk README & LICENSE files for further details.
9*/
10
11#include <errno.h>
12#include <stdio.h>
13#include <kernel.h>
14#include <libgs.h>
15
16#include "internal.h"
17
18extern QWORD GsPrimWorkArea[];
19
20void GsSetDefaultZBufferEnv(GS_ZENV *zenv, u8 update_mask)
21{
22 zenv->update_mask = update_mask;
23}
24
25void GsSetDefaultZBufferEnvAddress(GS_ZENV *zenv, unsigned short vram_addr, unsigned char psm)
26{
27 zenv->vram_addr=vram_addr;
28 zenv->psm=psm;
29}
30
31void GsPutZBufferEnv1(GS_ZENV *zenv)
32{
33 QWORD *p;
34 p=UNCACHED_SEG(GsPrimWorkArea);
35 gs_setGIF_TAG(((GS_GIF_TAG *)&p[0]), 1,1,0,0,GS_GIF_PACKED,1,gif_rd_ad);
36 gs_setR_ZBUF_1(((GS_R_ZBUF *)&p[1]), zenv->vram_addr, zenv->psm, zenv->update_mask);
37
38 GsDmaSend(GsPrimWorkArea, 2);
39 GsDmaWait();
40}
41
42void GsPutZBufferEnv2(GS_ZENV *zenv)
43{
44 QWORD *p;
45 p=UNCACHED_SEG(GsPrimWorkArea);
46 gs_setGIF_TAG(((GS_GIF_TAG *)&p[0]), 4,1,0,0,GS_GIF_PACKED,1,gif_rd_ad);
47 gs_setR_ZBUF_2(((GS_R_ZBUF *)&p[1]), zenv->vram_addr, zenv->psm, zenv->update_mask);
48
49 GsDmaSend(GsPrimWorkArea, 2);
50 GsDmaWait();
51}
#define gif_rd_ad
Definition libgs.h:326
Definition libgs.h:333