From e7574bca1d2d9c35880ff640471931ef9188655d Mon Sep 17 00:00:00 2001 From: Luke Benstead Date: Wed, 31 May 2023 18:27:17 +0100 Subject: [PATCH 1/3] Fix issues with GL_QUADS --- GL/draw.c | 14 ++++++-------- GL/draw_fastpath.inc | 24 ++++++++++++------------ 2 files changed, 18 insertions(+), 20 deletions(-) diff --git a/GL/draw.c b/GL/draw.c index 3c722e3..2fa6d88 100644 --- a/GL/draw.c +++ b/GL/draw.c @@ -815,17 +815,15 @@ static void generateElementsFastPath( #define POLYMODE QUADS #define PROCESS_VERTEX_FLAGS(it, i) { \ - if((i + 1) % 4 == 0) { \ - Vertex* prev = ((it) - 1); \ - Vertex t = (*prev); \ - *(prev) = *((it)); \ - *((it)) = t; \ - prev->flags = GPU_CMD_VERTEX; \ + it->flags = GPU_CMD_VERTEX; \ + if(((i + 1) % 4) == 0) { \ + Vertex t = *it; \ + *it = *(it - 1); \ + *(it - 1) = t; \ it->flags = GPU_CMD_VERTEX_EOL; \ - } else { \ - it->flags = GPU_CMD_VERTEX; \ } \ } + #include "draw_fastpath.inc" #undef PROCESS_VERTEX_FLAGS #undef POLYMODE diff --git a/GL/draw_fastpath.inc b/GL/draw_fastpath.inc index d483b9d..8ea3514 100644 --- a/GL/draw_fastpath.inc +++ b/GL/draw_fastpath.inc @@ -29,18 +29,6 @@ MAKE_FUNC(POLYMODE) const int_fast32_t loop = ((min + BATCH_SIZE) > count) ? count - min : BATCH_SIZE; const int offset = (first + min); - stride = ATTRIB_POINTERS.vertex.stride; - ptr = ATTRIB_POINTERS.vertex.ptr + (offset * stride); - it = (Vertex*) start; - - PREFETCH(ptr); - for(int_fast32_t i = 0; i < loop; ++i, ++it) { - PREFETCH(ptr + stride); - TransformVertex((const float*) ptr, &w, it->xyz, &it->w); - PROCESS_VERTEX_FLAGS(it, min + i); - ptr += stride; - } - stride = ATTRIB_POINTERS.uv.stride; ptr = (ENABLED_VERTEX_ATTRIBUTES & UV_ENABLED_FLAG) ? ATTRIB_POINTERS.uv.ptr + ((first + min) * stride) : NULL; it = (Vertex*) start; @@ -80,6 +68,18 @@ MAKE_FUNC(POLYMODE) } } + stride = ATTRIB_POINTERS.vertex.stride; + ptr = ATTRIB_POINTERS.vertex.ptr + (offset * stride); + it = (Vertex*) start; + + PREFETCH(ptr); + for(int_fast32_t i = 0; i < loop; ++i, ++it) { + PREFETCH(ptr + stride); + TransformVertex((const float*) ptr, &w, it->xyz, &it->w); + PROCESS_VERTEX_FLAGS(it, min + i); + ptr += stride; + } + start = aligned_vector_at(target->extras, min); stride = ATTRIB_POINTERS.st.stride; From 92ee4f616dd62211ac63c89aeb9e68227ef18db2 Mon Sep 17 00:00:00 2001 From: Luke Benstead Date: Tue, 6 Jun 2023 21:05:28 +0100 Subject: [PATCH 2/3] Set mode to PAL@50 if it's a European console without VGA --- GL/platforms/sh4.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/GL/platforms/sh4.c b/GL/platforms/sh4.c index e375772..ca78170 100644 --- a/GL/platforms/sh4.c +++ b/GL/platforms/sh4.c @@ -31,6 +31,17 @@ void InitGPU(_Bool autosort, _Bool fsaa) { }; pvr_init(¶ms); + + /* If we're PAL and we're NOT VGA, then use 50hz by default. This is the safest + thing to do. If someone wants to force 60hz then they can call vid_set_mode later and hopefully + that'll work... */ + + int cable = vid_check_cable(); + int region = flashrom_get_region(); + + if(region == FLASHROM_REGION_EUROPE && cable != CT_VGA) { + vid_set_mode(DM_640x480_PAL_IL, PM_RGB565); + } } void SceneBegin() { From 3dcbbdbde6a19fa8bd321793416d10a0dc096a4a Mon Sep 17 00:00:00 2001 From: Luke Benstead Date: Fri, 9 Jun 2023 20:35:00 +0100 Subject: [PATCH 3/3] Add logging --- GL/platforms/sh4.c | 1 + 1 file changed, 1 insertion(+) diff --git a/GL/platforms/sh4.c b/GL/platforms/sh4.c index ca78170..acaf692 100644 --- a/GL/platforms/sh4.c +++ b/GL/platforms/sh4.c @@ -40,6 +40,7 @@ void InitGPU(_Bool autosort, _Bool fsaa) { int region = flashrom_get_region(); if(region == FLASHROM_REGION_EUROPE && cable != CT_VGA) { + printf("PAL region without VGA - enabling 50hz"); vid_set_mode(DM_640x480_PAL_IL, PM_RGB565); } }