1 --- GlideV2/glide2x/cvg/init/sst1init.h.orig 2022-09-26 18:55:51.354408063 +0200
2 +++ GlideV2/glide2x/cvg/init/sst1init.h 2022-09-26 19:00:30.416229589 +0200
3 @@ -163,6 +163,18 @@ p6Fence(void);
4 #elif defined (__GNUC__) && defined(__i386__)
5 # define P6FENCE asm("xchg %%eax,%0" : /*outputs*/ : "m" (p6FenceVar) : \
7 +#elif defined(__ia64__)
8 +#define P6FENCE asm volatile ("mf.a" ::: "memory");
9 +#elif defined(__alpha__)
10 +# define P6FENCE asm volatile("mb" ::: "memory");
11 +#elif defined(__powerpc__)
12 +# define P6FENCE asm volatile ("sync" ::: "memory");
13 +#elif defined (__x86_64__)
14 +# define P6FENCE asm volatile("mfence" ::: "memory");
15 +#elif defined(__sparc64__)
16 +# define P6FENCE asm volatile("membar #LoadLoad | #LoadStore | #StoreStore | #StoreLoad" ::: "memory");
17 +#elif defined(__sparc__)
18 +# define P6FENCE asm volatile("" ::: "memory");
20 # error "P6 Fencing in-line assembler code needs to be added for this compiler"
22 --- GlideV2/glide2x/cvg/glide/src/cpudetect.c.orig 2000-04-20 23:26:36.000000000 +0200
23 +++ GlideV2/glide2x/cvg/glide/src/cpudetect.c 2013-09-21 08:28:32.804847399 +0200
27 void single_precision_asm() {
28 +#if defined(__x86_64__)
29 + asm("push %rax \n fnclex \n fstcw (%rsp) \n movl (%rsp), %eax \n "
30 + "and $0x0000fcff, %eax \n movl %eax, (%rsp) \n fldcw (%rsp) \n pop %rax");
31 +#elif defined(__i386__)
32 asm("push %eax \n fnclex \n fstcw (%esp) \n movl (%esp), %eax \n "
33 "and $0x0000fcff, %eax \n movl %eax, (%esp) \n fldcw (%esp) \n pop %eax");
38 void double_precision_asm() {
39 - asm("push %eax \n fnclex \n fstcw (%esp) \n movw (%esp), %eax \n "
40 +#if defined(__x86_64__)
41 + asm("push %rax \n fnclex \n fstcw (%rsp) \n movl (%rsp), %eax \n "
42 + "and $0x0000fcff, %eax \n or $0x000002ff, %eax \n mov %eax, (%rsp) \n "
43 + "fldcw (%rsp) \n pop %rax");
44 +#elif defined(__i386__)
45 + asm("push %eax \n fnclex \n fstcw (%esp) \n movl (%esp), %eax \n "
46 "and $0x0000fcff, %eax \n or $0x000002ff, %eax \n mov %eax, (%esp) \n "
47 "fldcw (%esp) \n pop %eax");
51 --- GlideV2/glide2x/cvg/init/makefile.linux.orig 2000-04-20 23:26:36.000000000 +0200
52 +++ GlideV2/glide2x/cvg/init/makefile.linux 2013-09-21 10:33:25.196185785 +0200
54 # for some strange reason
57 -CFLAGS = -g $(GCFLAGS) $(LCFLAGS) $(VCFLAGS)
58 +CFLAGS = -g $(GCFLAGS) $(LCFLAGS) $(VCFLAGS) -fPIC
60 --- GlideV2/glide3x/cvg/init/sst1init.h.orig 2022-09-26 18:55:51.354408063 +0200
61 +++ GlideV2/glide3x/cvg/init/sst1init.h 2022-09-26 19:00:56.486088357 +0200
62 @@ -163,6 +163,18 @@ p6Fence(void);
63 #elif defined (__GNUC__) && defined(__i386__)
64 # define P6FENCE asm("xchg %%eax,%0" : /*outputs*/ : "m" (p6FenceVar) : \
66 +#elif defined(__ia64__)
67 +#define P6FENCE asm volatile ("mf.a" ::: "memory");
68 +#elif defined(__alpha__)
69 +# define P6FENCE asm volatile("mb" ::: "memory");
70 +#elif defined(__powerpc__)
71 +# define P6FENCE asm volatile ("sync" ::: "memory");
72 +#elif defined (__x86_64__)
73 +# define P6FENCE asm volatile("mfence" ::: "memory");
74 +#elif defined(__sparc64__)
75 +# define P6FENCE asm volatile("membar #LoadLoad | #LoadStore | #StoreStore | #StoreLoad" ::: "memory");
76 +#elif defined(__sparc__)
77 +# define P6FENCE asm volatile("" ::: "memory");
79 # error "P6 Fencing in-line assembler code needs to be added for this compiler"
81 --- GlideV2/glide3x/cvg/glide3/src/makefile.linux.orig 2000-04-20 23:26:39.000000000 +0200
82 +++ GlideV2/glide3x/cvg/glide3/src/makefile.linux 2013-09-21 14:30:15.403246286 +0200
87 -ASMTRISETUP = xdraw2.S xdraw3.S
88 +ASMTRISETUP = xdraw2.S xdraw3.S cpudtect.S
89 DSPOPTS += -DGLIDE_PACKED_RGB=0 -DGLIDE_TRI_CULLING=1
93 LAINCS = -I$(BUILD_ROOT)/$(FX_GLIDE_HW)/include
94 LAOPTS = $(DBGOPTS) $(DSPOPTS) $(OPTOPTS)
96 -AFILES = $(ASMTRISETUP) cpudtect.S
97 +AFILES = $(ASMTRISETUP)
100 HEADERS = glide.h glidesys.h glideutl.h
101 --- GlideV2/glide3x/cvg/init/makefile.linux.orig 2000-04-20 23:26:36.000000000 +0200
102 +++ GlideV2/glide3x/cvg/init/makefile.linux 2013-09-21 10:33:25.196185785 +0200
104 # for some strange reason
107 -CFLAGS = -g $(GCFLAGS) $(LCFLAGS) $(VCFLAGS)
108 +CFLAGS = -g $(GCFLAGS) $(LCFLAGS) $(VCFLAGS) -fPIC
110 --- GlideV2/glide3x/cvg/glide3/src/gdraw.c.orig 2013-09-22 19:48:44.822836076 +0200
111 +++ GlideV2/glide3x/cvg/glide3/src/gdraw.c 2013-09-23 19:53:38.014765302 +0200
113 vlist[0] = (float *)a;
114 vlist[1] = (float *)b;
115 vlist[2] = (float *)c;
116 - _grDrawTriangles(GR_VTX_PTR_ARRAY, 3, vlist);
117 + _grDrawTriangles_Default(GR_VTX_PTR_ARRAY, 3, vlist);
120 ** draw a simple triangle
121 --- GlideV2/glide3x/cvg/glide3/src/gpci.c.orig 2000-04-20 23:26:39.000000000 +0200
122 +++ GlideV2/glide3x/cvg/glide3/src/gpci.c 2013-09-23 20:33:53.300359679 +0200
124 /* Collection of all of the known procs for a given system */
125 static GrTriSetupProc _triSetupProcs[][2][2] =
127 +#ifdef GLIDE_USE_C_TRISETUP
130 + { NULL, _vptrisetup_cull }
134 + { NULL, _vptrisetup_cull }
139 { _trisetup_Default_Default, _trisetup_Default_cull }, /* GR_WINDOW_COORDS */
140 @@ -233,10 +243,20 @@
141 { _trisetup_clip_coor_thunk, _trisetup_clip_coor_thunk }, /* GR_CLIP_COORDS */
143 #endif /* GL_AMD3D */
147 +#ifdef GLIDE_USE_C_TRISETUP
149 +_grDrawVertexList(FxU32 pktype, FxU32 type, FxI32 mode, FxI32 count, void *pointers);
152 static GrVertexListProc _vertexListProcs[][2] = {
153 +#ifdef GLIDE_USE_C_TRISETUP
154 + { _grDrawVertexList, _grDrawVertexList },
156 { _drawvertexlist, _vpdrawvertexlist },
159 { _grDrawVertexList_3DNow_Window, _grDrawVertexList_3DNow_Clip }
160 #endif /* GL_AMD3D */
163 /* Setup the basic proc tables based on the cpu type. */
165 - _GlideRoot.CPUType = _cpu_detect_asm();
166 + _GlideRoot.CPUType =
172 if (GETENV("FX_CPU")) _GlideRoot.CPUType = atoi(GETENV("FX_CPU"));