mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-13 09:35:23 -04:00
Dreamcast: Use direct rendering API to be compatible with KOS past 2.1.0 release
This commit is contained in:
parent
447d4060d5
commit
b1deff231e
5
.gitignore
vendored
5
.gitignore
vendored
@ -93,6 +93,11 @@ ClassiCube*
|
|||||||
screenshots
|
screenshots
|
||||||
fontscache.txt
|
fontscache.txt
|
||||||
|
|
||||||
|
# DOS files
|
||||||
|
CWSDPMI.EXE
|
||||||
|
CWSDPMI.SWP
|
||||||
|
OPTIONS.TXT
|
||||||
|
|
||||||
# Android source files need to be included
|
# Android source files need to be included
|
||||||
!android/app/src/main/java/com/classicube
|
!android/app/src/main/java/com/classicube
|
||||||
|
|
||||||
|
@ -321,8 +321,6 @@ static void ConvertTexture(cc_uint16* dst, struct Bitmap* bmp, int rowWidth) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static TextureObject* FindFreeTexture(void) {
|
static TextureObject* FindFreeTexture(void) {
|
||||||
unsigned int id;
|
|
||||||
|
|
||||||
// ID 0 is reserved for default texture
|
// ID 0 is reserved for default texture
|
||||||
for (int i = 1; i < MAX_TEXTURE_COUNT; i++)
|
for (int i = 1; i < MAX_TEXTURE_COUNT; i++)
|
||||||
{
|
{
|
||||||
@ -650,11 +648,27 @@ void Gfx_ClearBuffers(GfxBuffers buffers) {
|
|||||||
// no need to use glClear
|
// 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) {
|
void Gfx_EndFrame(void) {
|
||||||
pvr_wait_ready();
|
pvr_wait_ready();
|
||||||
|
|
||||||
pvr_scene_begin();
|
pvr_scene_begin();
|
||||||
glKosSwapBuffers();
|
SubmitList(&OP_LIST);
|
||||||
|
SubmitList(&PT_LIST);
|
||||||
|
SubmitList(&TR_LIST);
|
||||||
pvr_scene_finish();
|
pvr_scene_finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
third_party/gldc/src/gldc.h
vendored
2
third_party/gldc/src/gldc.h
vendored
@ -76,6 +76,6 @@ GL_FORCE_INLINE AlignedVector* _glActivePolyList() {
|
|||||||
|
|
||||||
extern GLboolean STATE_DIRTY;
|
extern GLboolean STATE_DIRTY;
|
||||||
|
|
||||||
void SceneListSubmit(Vertex* v2, int n, int type);
|
void SceneListSubmit(Vertex* v2, int n);
|
||||||
|
|
||||||
#endif // PRIVATE_H
|
#endif // PRIVATE_H
|
||||||
|
14
third_party/gldc/src/sh4.c
vendored
14
third_party/gldc/src/sh4.c
vendored
@ -46,9 +46,6 @@ static inline void _glPushHeaderOrVertex(Vertex* v) {
|
|||||||
extern void ClipEdge(const Vertex* const v1, const Vertex* const v2, Vertex* vout);
|
extern void ClipEdge(const Vertex* const v1, const Vertex* const v2, Vertex* vout);
|
||||||
|
|
||||||
#define SPAN_SORT_CFG 0x005F8030
|
#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 V0_VIS (1 << 0)
|
||||||
#define V1_VIS (1 << 1)
|
#define V1_VIS (1 << 1)
|
||||||
#define V2_VIS (1 << 2)
|
#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);
|
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);
|
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;
|
sq = (uint32_t*)MEM_AREA_SQ_BASE;
|
||||||
uint8_t visible_mask = 0;
|
uint8_t visible_mask = 0;
|
||||||
|
|
||||||
@ -438,7 +429,4 @@ void SceneListSubmit(Vertex* v3, int n, int type) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sq_wait();
|
|
||||||
sq_unlock();
|
|
||||||
}
|
}
|
||||||
|
25
third_party/gldc/src/state.c
vendored
25
third_party/gldc/src/state.c
vendored
@ -39,29 +39,6 @@ void glKosInit() {
|
|||||||
aligned_vector_reserve(&TR_LIST, 1024 * 3);
|
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) {
|
static inline int DimensionFlag(int w) {
|
||||||
switch(w) {
|
switch(w) {
|
||||||
case 16: return 1;
|
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;
|
blend_dst = PVR_BLEND_ZERO;
|
||||||
} else if (list_type == PVR_LIST_PT_POLY) {
|
} else if (list_type == PVR_LIST_PT_POLY) {
|
||||||
/* Punch-through polys require fixed blending and depth modes */
|
/* Punch-through polys require fixed blending and depth modes */
|
||||||
blend_src = PVR_BLEND_SRCALPHA;
|
|
||||||
blend_dst = PVR_BLEND_INVSRCALPHA;
|
|
||||||
depth_comp = PVR_DEPTHCMP_LEQUAL;
|
depth_comp = PVR_DEPTHCMP_LEQUAL;
|
||||||
} else if (list_type == PVR_LIST_TR_POLY && AUTOSORT_ENABLED) {
|
} else if (list_type == PVR_LIST_TR_POLY && AUTOSORT_ENABLED) {
|
||||||
/* Autosort mode requires this mode for transparent polys */
|
/* Autosort mode requires this mode for transparent polys */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user