]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
pcem: select Voodoo codegen by host capability
authorStefan Reinauer <stefan.reinauer@coreboot.org>
Mon, 1 Jun 2026 21:17:14 +0000 (14:17 -0700)
committerStefan Reinauer <stefan.reinauer@coreboot.org>
Mon, 1 Jun 2026 21:17:14 +0000 (14:17 -0700)
The imported Voodoo code only enabled its x86 code generators through
Windows-oriented preprocessor checks. That left Unix x86 builds with
the recompiler disabled even when the matching generator was compiled.

Derive explicit PCEM_VOODOO_CODEGEN macros from the host CPU and use
those macros for init, close, rendering, and the default recompiler
configuration.

pcem/vid_voodoo.cpp
pcem/vid_voodoo_render.cpp
pcem/vid_voodoo_render.h
x86.cpp

index 19c49fd03de4717fa61e44c9ec062b89a126eec7..f04d88723756672c57c2dec2a43b845fd5489625 100644 (file)
@@ -1085,7 +1085,7 @@ void *voodoo_card_init()
                 ai88[c].b = c & 0xff;
         }
 #ifndef NO_CODEGEN
-#if (defined WIN32 || defined WIN64) && !defined(ARM64)
+#ifdef PCEM_VOODOO_CODEGEN
         voodoo_codegen_init(voodoo);
 #endif
 #endif
@@ -1205,7 +1205,7 @@ void *voodoo_2d3d_card_init(int type)
                 ai88[c].b = c & 0xff;
         }
 #ifndef NO_CODEGEN
-#if (defined WIN32 || defined WIN64) && !defined(ARM64)
+#ifdef PCEM_VOODOO_CODEGEN
         voodoo_codegen_init(voodoo);
 #endif
 #endif
@@ -1322,7 +1322,7 @@ void voodoo_card_close(voodoo_t *voodoo)
                 free(voodoo->texture_cache[0][c].data);
         }
 #ifndef NO_CODEGEN
-#if (defined WIN32 || defined WIN64) && !defined(ARM64)
+#ifdef PCEM_VOODOO_CODEGEN
         voodoo_codegen_close(voodoo);
 #endif
 #endif
index 63d1fc1ef915e860962592a25897c9bd2fdbf504..61f5cab3090889edd037854898403c00ba17f5af 100644 (file)
@@ -646,9 +646,9 @@ static inline void voodoo_tmu_fetch_and_blend(voodoo_t *voodoo, voodoo_params_t
                 state->tex_a[0] ^= 0xff;
 }
 
-#if (defined i386 || defined __i386 || defined __i386__ || defined _X86_ || defined WIN32 || defined _WIN32 || defined _WIN32) && !defined __amd64__ && !defined ARM64
+#if defined(PCEM_VOODOO_CODEGEN_X86)
 #include "vid_voodoo_codegen_x86.h"
-#elif (defined __amd64__ && defined WIN64 && !defined ARM64)
+#elif defined(PCEM_VOODOO_CODEGEN_X86_64)
 #include "vid_voodoo_codegen_x86-64.h"
 #else
 int voodoo_recomp = 0;
@@ -778,7 +778,7 @@ static void voodoo_half_triangle(voodoo_t *voodoo, voodoo_params_t *params, vood
         }
 #ifndef NO_CODEGEN
         typedef uint8_t(__cdecl *VOODOO_DRAW)(voodoo_state_t*,voodoo_params_t*, int,int);
-#if (defined WIN32 || defined WIN64) && !defined ARM64
+#ifdef PCEM_VOODOO_CODEGEN
         if (voodoo->use_recompiler)
                 voodoo_draw = (VOODOO_DRAW)voodoo_get_block(voodoo, params, state, odd_even);
         else
index 9ba73dc635cad4db86d6228b845b7954fa4a2822..84b071d9172a67e04791c2de796e79e56ccdec53 100644 (file)
@@ -1,4 +1,16 @@
-#if !(defined i386 || defined __i386 || defined __i386__ || defined _X86_ || defined WIN32 || defined _WIN32 || defined _WIN32) && !(defined __amd64__)
+#if !defined(ARM64) && !defined(_M_ARM64) && !defined(__aarch64__)
+#if defined(__x86_64__) || defined(__amd64__) || defined(_M_X64) || defined(WIN64)
+#define PCEM_VOODOO_CODEGEN_X86_64 1
+#elif defined(i386) || defined(__i386) || defined(__i386__) || defined(_M_IX86) || defined(_X86_)
+#define PCEM_VOODOO_CODEGEN_X86 1
+#endif
+#endif
+
+#if defined(PCEM_VOODOO_CODEGEN_X86) || defined(PCEM_VOODOO_CODEGEN_X86_64)
+#ifndef PCEM_VOODOO_CODEGEN
+#define PCEM_VOODOO_CODEGEN 1
+#endif
+#else
 #define NO_CODEGEN
 #endif
 
diff --git a/x86.cpp b/x86.cpp
index eca054b32e15e51e8aef9065b54f8e7138c9d679..4156808a1031515e3d66a81af09dfc686403920a 100644 (file)
--- a/x86.cpp
+++ b/x86.cpp
@@ -3576,7 +3576,7 @@ int device_get_config_int(const char *s)
                return 1;
        }
        if (!strcmp(s, "recompiler")) {
-#ifdef _WIN32
+#if defined(_WIN32) || defined(PCEM_VOODOO_CODEGEN)
                return 1;
 #else
                return 0;