diff --git a/.gitignore b/.gitignore index e2a2df9f1..c35a8ce3e 100644 --- a/.gitignore +++ b/.gitignore @@ -93,6 +93,11 @@ ClassiCube* screenshots fontscache.txt +# DOS files +CWSDPMI.EXE +CWSDPMI.SWP +OPTIONS.TXT + # Android source files need to be included !android/app/src/main/java/com/classicube diff --git a/src/Graphics_Dreamcast.c b/src/Graphics_Dreamcast.c index aada72a13..523557bc2 100644 --- a/src/Graphics_Dreamcast.c +++ b/src/Graphics_Dreamcast.c @@ -321,8 +321,6 @@ static void ConvertTexture(cc_uint16* dst, struct Bitmap* bmp, int rowWidth) { } static TextureObject* FindFreeTexture(void) { - unsigned int id; - // ID 0 is reserved for default texture for (int i = 1; i < MAX_TEXTURE_COUNT; i++) { @@ -650,11 +648,27 @@ void Gfx_ClearBuffers(GfxBuffers buffers) { // no need to use glClear } +static pvr_dr_state_t dr_state; +static void SubmitList(AlignedVector* cmds) { + if (!cmds->size) return; + + pvr_list_begin(cmds->list_type); + { + pvr_dr_init(&dr_state); + SceneListSubmit(cmds->data, cmds->size); + sq_wait(); + } + pvr_list_finish(); + cmds->size = 0; +} + void Gfx_EndFrame(void) { pvr_wait_ready(); pvr_scene_begin(); - glKosSwapBuffers(); + SubmitList(&OP_LIST); + SubmitList(&PT_LIST); + SubmitList(&TR_LIST); pvr_scene_finish(); } diff --git a/third_party/gldc/src/gldc.h b/third_party/gldc/src/gldc.h index 52995c869..da381f3a3 100644 --- a/third_party/gldc/src/gldc.h +++ b/third_party/gldc/src/gldc.h @@ -76,6 +76,6 @@ GL_FORCE_INLINE AlignedVector* _glActivePolyList() { extern GLboolean STATE_DIRTY; -void SceneListSubmit(Vertex* v2, int n, int type); +void SceneListSubmit(Vertex* v2, int n); #endif // PRIVATE_H diff --git a/third_party/gldc/src/sh4.c b/third_party/gldc/src/sh4.c index ae069f7ba..786d3e0cc 100644 --- a/third_party/gldc/src/sh4.c +++ b/third_party/gldc/src/sh4.c @@ -46,9 +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 -static volatile uint32_t* PVR_LMMODE0 = (uint32_t*) 0xA05F6884; -static volatile uint32_t* PVR_LMMODE1 = (uint32_t*) 0xA05F6888; - #define V0_VIS (1 << 0) #define V1_VIS (1 << 1) #define V2_VIS (1 << 2) @@ -374,14 +371,8 @@ 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, int type) { +void SceneListSubmit(Vertex* v3, int n) { PVR_SET(SPAN_SORT_CFG, 0x0); - - //Set PVR DMA registers - *PVR_LMMODE0 = 0; - *PVR_LMMODE1 = 0; - - sq_lock((void*)PVR_TA_INPUT); sq = (uint32_t*)MEM_AREA_SQ_BASE; uint8_t visible_mask = 0; @@ -438,7 +429,4 @@ void SceneListSubmit(Vertex* v3, int n, int type) { break; } } - - sq_wait(); - sq_unlock(); } diff --git a/third_party/gldc/src/state.c b/third_party/gldc/src/state.c index f0ef0092a..9fc497f41 100644 --- a/third_party/gldc/src/state.c +++ b/third_party/gldc/src/state.c @@ -39,29 +39,6 @@ void glKosInit() { aligned_vector_reserve(&TR_LIST, 1024 * 3); } -void glKosSwapBuffers() { - if (OP_LIST.size > 2) { - pvr_list_begin(PVR_LIST_OP_POLY); - SceneListSubmit((Vertex*)OP_LIST.data, OP_LIST.size, 0); - pvr_list_finish(); - OP_LIST.size = 0; - } - - if (PT_LIST.size > 2) { - pvr_list_begin(PVR_LIST_PT_POLY); - SceneListSubmit((Vertex*)PT_LIST.data, PT_LIST.size, 1); - pvr_list_finish(); - PT_LIST.size = 0; - } - - if (TR_LIST.size > 2) { - pvr_list_begin(PVR_LIST_TR_POLY); - SceneListSubmit((Vertex*)TR_LIST.data, TR_LIST.size, 2); - pvr_list_finish(); - TR_LIST.size = 0; - } -} - static inline int DimensionFlag(int w) { switch(w) { case 16: return 1; @@ -98,8 +75,6 @@ void apply_poly_header(pvr_poly_hdr_t* dst, int list_type) { blend_dst = PVR_BLEND_ZERO; } else if (list_type == PVR_LIST_PT_POLY) { /* Punch-through polys require fixed blending and depth modes */ - blend_src = PVR_BLEND_SRCALPHA; - blend_dst = PVR_BLEND_INVSRCALPHA; depth_comp = PVR_DEPTHCMP_LEQUAL; } else if (list_type == PVR_LIST_TR_POLY && AUTOSORT_ENABLED) { /* Autosort mode requires this mode for transparent polys */