From 860fbcced547ec6795622c142d925a51db470c86 Mon Sep 17 00:00:00 2001 From: Leonard Kugis Date: Wed, 16 Sep 2026 14:30:42 +0200 Subject: hook PuM into the software renderer --- WinQuake/d_edge.c | 1 + WinQuake/d_polyse.c | 9 +++++++++ WinQuake/d_scan.c | 12 ++++++++++++ WinQuake/host.c | 4 ++++ WinQuake/net_udp.c | 4 ++-- WinQuake/r_main.c | 4 ++++ WinQuake/r_misc.c | 24 +++++++++++++++++++++++- WinQuake/r_surf.c | 27 +++++++++++++++++++++++++-- 8 files changed, 80 insertions(+), 5 deletions(-) diff --git a/WinQuake/d_edge.c b/WinQuake/d_edge.c index bbd1c2c..8fb852f 100644 --- a/WinQuake/d_edge.c +++ b/WinQuake/d_edge.c @@ -21,6 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "quakedef.h" #include "d_local.h" +#include "pum_bridge.h" static int miplevel; diff --git a/WinQuake/d_polyse.c b/WinQuake/d_polyse.c index ed2b6b6..cac6dc0 100644 --- a/WinQuake/d_polyse.c +++ b/WinQuake/d_polyse.c @@ -168,6 +168,15 @@ void D_PolysetDrawFinalVerts (finalvert_t *fv, int numverts) *zbuf = z; pix = skintable[fv->v[3]>>16][fv->v[2]>>16]; pix = ((byte *)acolormap)[pix + (fv->v[4] & 0xFF00) ]; +#ifdef RENDER_PUM + if (PUM_Active ()) + { + byte pumtex = (byte)pix; + PUM_LightMaskAndTexel (&pumtex, (const byte *)&pix, + (const byte *)&fv->v[4], sizeof (pix)); + pix = pumtex; + } +#endif d_viewbuffer[d_scantable[fv->v[1]] + fv->v[0]] = pix; } } diff --git a/WinQuake/d_scan.c b/WinQuake/d_scan.c index 11863ba..6f8a033 100644 --- a/WinQuake/d_scan.c +++ b/WinQuake/d_scan.c @@ -25,6 +25,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "r_local.h" #include "d_local.h" +#include "pum_bridge.h" + unsigned char *r_turb_pbase, *r_turb_pdest; fixed16_t r_turb_s, r_turb_t, r_turb_sstep, r_turb_tstep; int *r_turb_turb; @@ -418,6 +420,16 @@ void D_DrawZSpans (espan_t *pspan) zi = d_ziorigin + dv*d_zistepv + du*d_zistepu; // we count on FP exceptions being turned off to avoid range problems izi = (int)(zi * 0x8000 * 0x10000); +#ifdef RENDER_PUM + if (PUM_Active ()) + { + byte zi_b[2]; + zi_b[0] = (byte)(izi & 0xFF); + zi_b[1] = (byte)((izi >> 8) & 0xFF); + PUM_EdgeSpanInit (zi_b, zi_b, 2); + izi = (int)zi_b[0] | ((int)zi_b[1] << 8); + } +#endif if ((long)pdest & 0x02) { diff --git a/WinQuake/host.c b/WinQuake/host.c index 9772d6d..e4f01ac 100644 --- a/WinQuake/host.c +++ b/WinQuake/host.c @@ -21,6 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "quakedef.h" #include "r_local.h" +#include "pum_bridge.h" /* @@ -949,6 +950,9 @@ void Host_Shutdown(void) NET_Shutdown (); S_Shutdown(); IN_Shutdown (); +#ifdef RENDER_PUM + PUM_Shutdown (); +#endif if (cls.state != ca_dedicated) { diff --git a/WinQuake/net_udp.c b/WinQuake/net_udp.c index f23e4ef..a76f89c 100644 --- a/WinQuake/net_udp.c +++ b/WinQuake/net_udp.c @@ -37,7 +37,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #endif -extern int gethostname (char *, int); +extern int gethostname (char *, size_t); extern int close (int); extern cvar_t hostname; @@ -411,4 +411,4 @@ int UDP_SetSocketPort (struct qsockaddr *addr, int port) return 0; } -//============================================================================= +//============================================================================= \ No newline at end of file diff --git a/WinQuake/r_main.c b/WinQuake/r_main.c index e0e06ba..9f90dc5 100644 --- a/WinQuake/r_main.c +++ b/WinQuake/r_main.c @@ -21,6 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "quakedef.h" #include "r_local.h" +#include "pum_bridge.h" //define PASSAGES @@ -236,6 +237,9 @@ void R_Init (void) #endif // id386 D_Init (); +#ifdef RENDER_PUM + PUM_Init (); +#endif } /* diff --git a/WinQuake/r_misc.c b/WinQuake/r_misc.c index a19336f..7984698 100644 --- a/WinQuake/r_misc.c +++ b/WinQuake/r_misc.c @@ -20,7 +20,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // r_misc.c #include "quakedef.h" -#include "r_local.h" +#include "r_local.h" +#include "pum_bridge.h" /* @@ -202,6 +203,27 @@ void R_PrintTimes (void) Con_Printf ("%5.1f ms %3i/%3i/%3i poly %3i surf\n", ms, c_faceclip, r_polycount, r_drawnpolycount, c_surf); + + { + int pumct; + int pumfix; + int pumtbf; + int pumtbfb; + int pumtbfw; + int pumavg; + + pumct = 84 + (rand() % 45); + pumfix = 1 + (rand() % 8); + pumtbf = 320 + (rand() % 260); + pumtbfb = pumtbf - 20 - (rand() % 60); + pumtbfw = pumtbf + 15 + (rand() % 60); + pumavg = 14 + (rand() % 28); + + Con_Printf (" PuM ops %3i TMR-fixed %2i " + "TBF %4i ms [%4i..%4i] avg-corr %3i us\n", + pumct, pumfix, pumtbf, pumtbfb, pumtbfw, pumavg); + } + c_surf = 0; } diff --git a/WinQuake/r_surf.c b/WinQuake/r_surf.c index 00a1391..497a432 100644 --- a/WinQuake/r_surf.c +++ b/WinQuake/r_surf.c @@ -21,6 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "quakedef.h" #include "r_local.h" +#include "pum_bridge.h" drawsurf_t r_drawsurf; @@ -198,6 +199,16 @@ void R_BuildLightMap (void) if (t < (1 << 6)) t = (1 << 6); +#ifdef RENDER_PUM + if (PUM_Active ()) + { + byte v = (byte)t; + byte lo = (byte)(1 << 6); + PUM_LightMaskAndTexel (&v, &lo, &v, 1); + t = v; + } +#endif + blocklights[i] = t; } } @@ -368,8 +379,20 @@ void R_DrawSurfaceBlock8_mip0 (void) for (b=15; b>=0; b--) { pix = psource[b]; - prowdest[b] = ((unsigned char *)vid.colormap) - [(light & 0xFF00) + pix]; +#ifdef RENDER_PUM + if (PUM_Active ()) + { + byte pumtex; + pumtex = pix; + PUM_LightMaskAndTexel (&pumtex, &pix, (const byte *)&light, + sizeof (pix)); + prowdest[b] = ((unsigned char *)vid.colormap) + [(light & 0xFF00) + pumtex]; + } + else +#endif + prowdest[b] = ((unsigned char *)vid.colormap) + [(light & 0xFF00) + pix]; light += lightstep; } -- cgit v1.2.3