Dreamcast: Fix not compiling

This commit is contained in:
UnknownShadow200 2024-10-04 19:16:50 +10:00
parent 1c61512e64
commit 1bfc86b9c3
5 changed files with 15 additions and 21 deletions

View File

@ -523,7 +523,7 @@ _ProcessVertexList:
bra SUBMIT_LOOP
add #-64,r15
! Submits a PowerVR GPU command
! Submits a PVR2 TA GPU command
DO_CMD:
PushVertex REG_V0
bra NEXT_ITER
@ -543,7 +543,6 @@ SUBMIT_LOOP:
bf.s DO_CMD ! if (!T) goto DO_CMD
! PVR_CMD_VERTEX_EOL case
extu.b r0,r1 ! EX, MASK = FLAGS & 0xFF (branch delay slot)
mov.l r11,@r13 ! LS, CUR->flags = PVR_CMD_VERTEX_EOL
! Prepare and then jump to quad drawing function, based on quad clipflags
mova .CASES,r0 ! LS, r0 = CASES

View File

@ -60,7 +60,8 @@ static void InitGPU(void) {
static void InitGLState(void) {
pvr_set_zclip(0.0f);
PVR_SET(PT_ALPHA_REF, 127); // define missing from KOS
PVR_SET(PT_ALPHA_REF, 127); // define missing from KOS
//PVR_SET(PVR_SPANSORT_CFG, 0x0);
ALPHA_TEST_ENABLED = false;
CULLING_ENABLED = false;
@ -70,7 +71,7 @@ static void InitGLState(void) {
TEXTURES_ENABLED = false;
FOG_ENABLED = false;
stateDirty = true;
stateDirty = true;
listOP.list_type = PVR_LIST_OP_POLY;
listPT.list_type = PVR_LIST_PT_POLY;
listTR.list_type = PVR_LIST_TR_POLY;
@ -683,7 +684,7 @@ static void SubmitList(AlignedVector* cmds) {
pvr_list_begin(cmds->list_type);
{
pvr_dr_init(&dr_state);
SceneListSubmit(cmds->data, cmds->size);
SceneListSubmit((Vertex*)cmds->data, cmds->size);
sq_wait();
}
pvr_list_finish();

View File

@ -66,9 +66,6 @@ typedef struct {
float w;
} __attribute__ ((aligned (32))) Vertex;
#define GL_FORCE_INLINE static __attribute__((always_inline)) inline
typedef struct {
uint32_t color; /* This is the PVR texture format */
void *data;

View File

@ -5,9 +5,10 @@
#define PREFETCH(addr) __builtin_prefetch((addr))
static volatile uint32_t* sq;
#define GL_FORCE_INLINE __attribute__((always_inline)) inline
// calculates 1/sqrt(x)
GL_FORCE_INLINE float sh4_fsrra(float x) {
static GL_FORCE_INLINE float sh4_fsrra(float x) {
asm volatile ("fsrra %[value]\n"
: [value] "+f" (x) // outputs (r/w to FPU register)
: // no inputs
@ -16,11 +17,11 @@ GL_FORCE_INLINE float sh4_fsrra(float x) {
return x;
}
GL_FORCE_INLINE float _glFastInvert(float x) {
static GL_FORCE_INLINE float _glFastInvert(float x) {
return sh4_fsrra(x * x);
}
GL_FORCE_INLINE void _glPerspectiveDivideVertex(Vertex* vertex) {
static GL_FORCE_INLINE void _glPerspectiveDivideVertex(Vertex* vertex) {
const float f = _glFastInvert(vertex->w);
/* Convert to NDC (viewport already applied) */
@ -45,7 +46,6 @@ static inline void _glPushHeaderOrVertex(Vertex* v) {
extern void ClipEdge(const Vertex* const v1, const Vertex* const v2, Vertex* vout);
#define SPAN_SORT_CFG 0x005F8030
#define V0_VIS (1 << 0)
#define V1_VIS (1 << 1)
#define V2_VIS (1 << 2)
@ -371,11 +371,9 @@ static void SubmitClipped(Vertex* v0, Vertex* v1, Vertex* v2, Vertex* v3, uint8_
}
extern void ProcessVertexList(Vertex* v3, int n, void* sq_addr);
void SceneListSubmit(Vertex* v3, int n) {
PVR_SET(SPAN_SORT_CFG, 0x0);
void SceneListSubmit(Vertex* v3, int n) {
sq = (uint32_t*)MEM_AREA_SQ_BASE;
uint8_t visible_mask = 0;
for(int i = 0; i < n; ++i, ++v3)
{
@ -395,8 +393,7 @@ void SceneListSubmit(Vertex* v3, int n) {
Vertex* const v1 = v3 - 2;
Vertex* const v2 = v3 - 1;
visible_mask = v3->flags & 0xFF;
v3->flags &= ~0xFF;
uint8_t visible_mask = v3->flags & 0xFF;
// Stats gathering found that when testing a 64x64x64 sized world, at most
// ~400-500 triangles needed clipping

View File

@ -88,10 +88,10 @@ void apply_poly_header(pvr_poly_hdr_t* dst, int list_type) {
dst->mode1 |= (depth_write << PVR_TA_PM1_DEPTHWRITE_SHIFT) & PVR_TA_PM1_DEPTHWRITE_MASK;
dst->mode1 |= (txr_enable << PVR_TA_PM1_TXRENABLE_SHIFT) & PVR_TA_PM1_TXRENABLE_MASK;
dst->mode2 = (blend_src << PVR_TA_PM2_SRCBLEND_SHIFT) & PVR_TA_PM2_SRCBLEND_MASK;
dst->mode2 |= (blend_dst << PVR_TA_PM2_DSTBLEND_SHIFT) & PVR_TA_PM2_DSTBLEND_MASK;
dst->mode2 |= (gen_fog_type << PVR_TA_PM2_FOG_SHIFT) & PVR_TA_PM2_FOG_MASK;
dst->mode2 |= (gen_alpha << PVR_TA_PM2_ALPHA_SHIFT) & PVR_TA_PM2_ALPHA_MASK;
dst->mode2 = (blend_src << PVR_TA_PM2_SRCBLEND_SHIFT) & PVR_TA_PM2_SRCBLEND_MASK;
dst->mode2 |= (blend_dst << PVR_TA_PM2_DSTBLEND_SHIFT) & PVR_TA_PM2_DSTBLEND_MASK;
dst->mode2 |= (gen_fog_type << PVR_TA_PM2_FOG_SHIFT) & PVR_TA_PM2_FOG_MASK;
dst->mode2 |= (gen_alpha << PVR_TA_PM2_ALPHA_SHIFT) & PVR_TA_PM2_ALPHA_MASK;
if (txr_enable == PVR_TEXTURE_DISABLE) {
dst->mode3 = 0;