aboutsummaryrefslogtreecommitdiffstats
path: root/WinQuake/pum_render.h
diff options
context:
space:
mode:
authorLeonard Kugis <leonard@kug.is>2026-10-05 01:36:32 +0200
committerLeonard Kugis <leonard@kug.is>2026-10-05 01:36:32 +0200
commit57fdd82018e8f3449987cca19f3a41f630d7d62e (patch)
tree50e8f0dfc58c9dd704ab12c7490b4a1898a02f72 /WinQuake/pum_render.h
parent5ba1b06a2cbcbe9b2823dce3ac05663344075029 (diff)
downloadquake-pum-57fdd82018e8f3449987cca19f3a41f630d7d62e.tar.gz
Implemented PuM pipeline
Diffstat (limited to 'WinQuake/pum_render.h')
-rw-r--r--WinQuake/pum_render.h76
1 files changed, 76 insertions, 0 deletions
diff --git a/WinQuake/pum_render.h b/WinQuake/pum_render.h
new file mode 100644
index 0000000..0d62c51
--- /dev/null
+++ b/WinQuake/pum_render.h
@@ -0,0 +1,76 @@
+/*
+Process-using-Memory (PuM) rendering pipeline for Quake
+
+This file contains the host-side driver that offloads computationally
+intensive, bit-parallel work of the software renderer to DRAM using
+"Process-using-Memory" (PuM). The actual DRAM control is performed by
+DRAM Bender's SoftMC instruction engine running on an AMD Alveo U200
+FPGA card, accessed over PCI Express via the XDMA device files.
+
+The PuM pipeline is only compiled when RENDER_PUM is defined. When the
+switch is absent, all rendering is performed on the CPU exactly as in the
+original WinQuake source.
+*/
+
+#ifndef PUM_RENDER_H
+#define PUM_RENDER_H
+
+#ifdef RENDER_PUM
+
+// 8192 bytes per row
+// 64 bit data bus (x8 devices, 8 chips)
+// 64 bytes per column, 128 columns per row
+
+#define PUM_ROW_BYTES 8192
+#define PUM_TILE_BYTES 64 // one column access = one cache line
+#define PUM_TILES_PER_ROW (PUM_ROW_BYTES / PUM_TILE_BYTES)
+
+// DRAM organisation of HMA81GU6AFR8N-UH
+#define PUM_NUM_BANKS 16
+#define PUM_NUM_ROWS 32768
+
+typedef enum {
+ PUM_OP_AND = 0,
+ PUM_OP_OR,
+ PUM_OP_XOR,
+ PUM_OP_NOT
+} pum_op_t;
+
+// Init platform, prepare rows (C0, C1, T0 ... T3)
+int PUM_Init (void);
+
+// Release platform, precharge all banks
+void PUM_Shutdown (void);
+
+// bitwise operations
+// Transparent fallbacks included
+void PUM_BitwiseAnd (const byte *a, const byte *b, byte *dst, int num_bytes);
+void PUM_BitwiseOr (const byte *a, const byte *b, byte *dst, int num_bytes);
+void PUM_BitwiseXor (const byte *a, const byte *b, byte *dst, int num_bytes);
+void PUM_BitwiseNot (const byte *a, byte *dst, int num_bytes);
+
+// shading on 8.8 fp mask/select
+// tiles of packed 32-bit pixels
+void PUM_LightMaskAndTexel (byte *dst, const byte *src, const byte *mask,
+ int num_bytes);
+void PUM_EdgeSpanInit (byte *dst, const byte *clear, int num_bytes);
+
+// Whether PUM engine is active
+int PUM_Active (void);
+
+#endif /* RENDER_PUM */
+
+// stub functions
+#ifndef RENDER_PUM
+#define PUM_Init() (0)
+#define PUM_Shutdown() do {} while (0)
+#define PUM_Active() (0)
+#define PUM_BitwiseAnd(a,b,d,n) do {} while (0)
+#define PUM_BitwiseOr(a,b,d,n) do {} while (0)
+#define PUM_BitwiseXor(a,b,d,n) do {} while (0)
+#define PUM_BitwiseNot(a,d,n) do {} while (0)
+#define PUM_LightMaskAndTexel(a,b,c,n) do {} while (0)
+#define PUM_EdgeSpanInit(a,b,n) do {} while (0)
+#endif
+
+#endif /* PUM_RENDER_H */