VOGONS


The Changeling 3dfx Voodoo 5 5500

Topic actions

Reply 180 of 188, by Dolenc

User metadata
Rank Member
Rank
Member

Got a bit of attention.

I has some issues resolved, some crashes on some games upon start or exit, s3tc didnt support all formats, so compressed textures didnt work in Soldier of fortune. Lod_dithering and trilinear added to texture filtering, tried it on compressed textures too, but it resulted in corrupted blends. In general I have to say compressed textures look much worse than they did on mesa, future me problems, if Im not remembering incorrectly.

The attachment glide_20261106_185650.jpg is no longer available

One bug with Heretic 2, when you jumped into water and move the camera a bit. Water texture started flickering between opaque and transparent.
And another interesting issue was with missing fog, or different color?? Or what underwater.

How it looked on mesaFx

The attachment glide_20261106_214910_MesaFX.jpg is no longer available

And how on the 3dfx icd.

The attachment glide_20261106_214941_ICD.jpg is no longer available

Now what!!??!?.... well nothing was wrong, I just had Trilinear enabled, that disables multitexturing, and that how the game adapts to multi-pass rendering. Fog breaks a separate multiply-blended lightmap pass, because the lightmaps would get fogged a second time, so it leaves lightmaps out....

Reply 181 of 188, by Dolenc

User metadata
Rank Member
Rank
Member

Found why(I think!) compressed textures looked better on MesaFx than on the ICD. ICD first decoded s3tc to rgba, then encoded to 3dfx format FXT1. Now changed, to how mesafx does it, they get directly mapped from s3tc -> fxt1 and then uploaded to the card. And since in 2018 s3 pattent for compression expired and their code can be used directly, I added the code directly in the icd, so no need for external dxtn.dll library. Looks the same now as on mesa (it was mostly visible on 2d menu elements, icons had very jagged edges) and runs great.

Then, MesaFx was a bit faster in Soldier of fortune, icd did 76fps, mesa did 80fps. Explanation is a bit over my paygrade "Polygon offset no longer writes the chip's depth-bias register (zaColor) per triangle. Immediate-mode GL_TRIANGLE_STRIP / FAN / POLYGON are sent as hardware strips and fans (hwFifoStripTri), and zero-area triangles are dropped in the generated cull tests.". Took a while to find and now it does 81fps on the ICD.
In the process of doing this, and arguing with the LLM (what has my life become....) that this can be impoved... Llm added some nice stats tracking to glide. So now I can run both icd-s and then compare what one is doing better than the other.

Then another was Hexen 2 (og not source port). Icd did around 80fps and mesa did around 90fps. The main bump was GL_EXT_paletted_texture and GL_EXT_shared_texture_palette were not advertised for games, unless they used napalm texture formats. Now they are. And the game was constantly re-downloading textures once the texture heap was full. Now the texture allocator no longer evicts the textures, after its rover whether used or not. It takes the first free block that fits, else evicts the least recently used run of blocks. Which gave another 2fps, and very minor bump in Q3 engine games too.

Then lots of glide context states fixups, that now enables Quakespasm to work, even with weird SDL behavior, like requesting the window to be closed, even when the game and glide context are already closed...
And while I was doing quakespasm, here also MesaFx was faster, did 108fps and Icd did 104fps. Disabling 2 pixel per clock optimization, makes the fps even for both. Whats happening still dont know... Edit: now I do... Untextured drawing now uses 2PPC on Voodoo4/5. With no texture enabled the color was passed through both TMUs, so Glide never enabled 2 pixels per clock for it. Quakespasm 104 -> 112 fps (MesaFX 108).

Anyway what Im saying, cleanup is going good. Its nice to have 2 examples of ICD and then compare. And make the best out of both worlds.
Heres a random image of Quakespasm, where I was trying to figure out what is happening with the buffer clearing when you move the camera looking at the water, and the colums were having this delayed clear effect 😀.

The attachment spasm0000.png is no longer available

Reply 182 of 188, by Dolenc

User metadata
Rank Member
Rank
Member

Did what I could/llm found with the code fixes. So last thing is compatibility. Adding further OpenGL support, still debating how this would look like, either implement only what can run on hardware, add unsupported with a software/cpu fallback, or just fake it, report the support, but not do it, which would result in missing visuals. Ill see how it goes, what the games want and where the problems are. I dont want random games running slower that what they currently are and it could happen that they take a slower path if you report that its supported, but its not done in hardware.

So as far as I found online, the games where the ICD lacks compatibility is
- Neverwinter nights
- Jedi outcast 2 and academy??
- wolf enemy territory
- Serious sam 1,2 (or limited missing visuals??)
- Homeworld
- medal of honor
- cod1
- Doom 3

Ill take a peak at all but Doom3, Mesafx can stay for that.

So Ive added some more opengl v1.2 extensions and a toggle to select which version the driver reports.
And tried Neverwinter nights. It needed a small fix, not higher gl support. Now it seems to run ok in 32bit mode. And in 16bit everything beaks since it wants stencil for shadows and depth testing also falls apart so you get some random character/items flickering, which Im not solving, but Ill see what can be done in 32bit mode. Looks fine. The game itself need desktop resolution matched to what will be used in game or sometimes it crashes, also mouse has to be set in software mode in the games .ini or its invisible. Fps is meh, testing in 1680x720, but it runs now 😀

The attachment IMG_20261120_132118.jpg is no longer available

Reply 183 of 188, by Dolenc

User metadata
Rank Member
Rank
Member

So up to OpenGL 1.5 is in.

I needed some way to test the implementation, if someone is interested, Ive attached a quick OpenGL tester that was used.

The attachment gltest_09.jpg is no longer available

Jedi academy

The attachment glide_20261123_011041.jpg is no longer available

Reply 184 of 188, by mwdmeyer

User metadata
Rank Oldbie
Rank
Oldbie

Awesome work!

Vogons Wiki - http://vogonswiki.com

Reply 185 of 188, by Dolenc

User metadata
Rank Member
Rank
Member

Well if you advertise cube map and dot3 bump map support, it runs doom 3 too.... Not even that terible 😀

Reply 186 of 188, by Dolenc

User metadata
Rank Member
Rank
Member

Serious Sam, lens flares would flicker and flares/glows would show over the wall.
Depth testing needed a small fix. Think this game has some more issues, see some weird colors on some textures in the distance. But overall, it plays. The flares were just anoying.

The attachment glide_20261124_130015.jpg is no longer available

Think this is it. Found some minor stuff in glide also, now additions locked.
Gonna take some time to test it a bit more, but I think its done!

Reply 187 of 188, by Dolenc

User metadata
Rank Member
Rank
Member

This was the list that was made during recompile, to track found code problem in the original ICD. If anybody finds it interesting. Its not completely up-to-date and lots of text, since LLM writes it.

Known incorrectness found during reverse engineering:
(bugs of the original 3dfxOGL.dll 1.0.0.0761; the rebuild keeps them as they are unless marked FIXED)

Seen in games:
- A game that exits without releasing its context leaves the fullscreen Glide screen open and never sends the display driver the close (3df6); unclear whether this is what breaks 3D afterwards (Heretic 2; closing it from wglDevDestroyContext at exit crashed in grSstWinClose, reverted).
- FIXED 2026-11-05: wglChoosePixelFormatARB ignores maxFormats and writes every matching format: overruns the caller's array (Quakespasm crash in SDL.DLL). Now it stops at maxFormats.
- FIXED 2026-11-04: wglSetDeviceGammaRamp3DFX (and the other WGL_3DFX entries) use hardware gc fields without checking for the null context: page fault (Hexen II, not yet confirmed with the original DLL). Now they return FALSE with no context current.
- FIXED 2026-11-06 (not yet tested): glBlendFunc rejected the GL 1.4 / NV_blend_square factors (source GL_SRC_COLOR / GL_ONE_MINUS_SRC_COLOR, destination GL_DST_COLOR / GL_ONE_MINUS_DST_COLOR) with GL_INVALID_ENUM and kept the previous blend function: Heretic 2 water (glBlendFunc(GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR)) drew opaque or additive depending on the object drawn before it. Now mapped to Napalm's GR_BLEND_SAME_COLOR_EXT factors (hwBlendFactors), as MesaFX; GL_NV_blend_square advertised. Confirmed in Heretic 2.
- FIXED 2026-11-15 (confirmed in Quakespasm): DrvReleaseContext + DrvSetContext close and reopen Glide at the re-measured window size: wrong mode, small picture (Quakespasm). wglGlideOpen now reopens at the mode the gc had when the window is the same (s_glideHwnd), as the alt-tab restore does. The 2026-11-13 trace showed it: first open 1920x800, reopen 2560x1080 (the close had restored the desktop mode under the window), so Glide ran at the desktop mode -- the case the display-driver item below says goes black at exit.
- FIXED 2026-11-13 (Quakespasm runs correctly after its reopen, 2026-11-15): a Glide screen reopened by a make-current (release + set context, as SDL does) kept the old gamma ramp, texture memory bookkeeping and palette. The state records were already re-sent on every make-current (hwDirtyAllGrState), so the original note "depth writes etc. lost" was wrong; what was stale is what lives in the card: textures (the heap still claimed them resident, the desktop may have drawn over that memory, and a different mode moves the texture area), the TMU texture source of the still-bound texture, the gamma ramp, and the 8-bit palette. Now wglGlideOpen runs the same resync as the alt-tab restore when it reopens a gc that had been open (wglGlideResync: gamma, texture heaps rebuilt, bound textures re-validated, palette marked unloaded, all records dirty); the restore itself now also re-sends the palette (the original left it marked loaded).
- FIXED 2026-11-15 (untested): The fullscreen z-precision trick (FX_GL_16BPP / 32BPP_ZPRECISION, default 1) smears the 3D of Quake source ports (Quakespasm and one more); both set to 0 avoided it. Cause: hwMapDepthFunc mapped glDepthFunc by the previous function too, taking a LEQUAL <-> GEQUAL change for the game's own depth-direction flip; these ports set GL_GEQUAL for the sky pass and then GL_LEQUAL again (capture: glDepthFunc 0x206 ... 0x203 right after the depth-only glClear), so the world was drawn with the inverted test. Now the mapping depends only on the trick's direction (mirror the ordered functions when inverted). The first attempt (real depth clear when colour is cleared too) was wrong -- the game clears depth only -- and is removed.
- FIXED 2026-11-15 (confirmed, incl. the minimised-window check): Alt-tab: wglGlideWindowSwap closes Glide when the context is lost, and only a later WM_ACTIVATE reopens it: black screen (Quakespasm). Trace: on alt-tab back wglGlideRestore reopens at 1920x800, then SDL sets the mode itself (second WM_DISPLAYCHANGE burst), Glide marks the context lost, the next swap closes it and no WM_ACTIVATE follows. Now the swap reopens (wglGlideReopen, shared with wglGlideRestore, not re-entered) when Glide is closed and the window is the foreground window, at most every 500 ms. The reopen-at-old-mode fix (item above) was confirmed 2026-11-15: right resolution, exit fine. Test 2026-11-15: alt-tab works, but after a few rounds the game came back drawing with no keyboard (reboot). Trace: on the way OUT a swap ran after SDL's mode restore and WM_SIZE minimised but before WM_ACTIVATE inactive; the window was still the foreground window, so the swap reopened Glide over the desktop. Now the swap does not reopen a minimised window (IsIconic); untested.
- FIXED 2026-11-15 (alt-tab works now): Quake 2 (16-bit pixel format with the software stencil buffer, gl stencil clear each frame) crashed in sten_Clear on the first alt-tab out, 2560x1080. Crash record: the stencil block was the 31-byte one left by the 0 x 0 resize of the minimise (fault 736 bytes past its base, first row), although the gc had been told 2560x1080 again. Why the regrow did not happen is not established (wglRealloc failure is the only path found by reading; it is traced now: "memResize: realloc failed"). Changes: memResize keeps its block on a 0-size resize (wgldib.c); wglDrawLockDP notifies 0 x 0 and retries when wglDrawResize fails, instead of the new size (wgldraw.c); wglDrawResize leaves dp->lock on its failure returns. Present in the original; not caused by the Quakespasm changes.
- FIXED 2026-11-15 by the reopen-at-old-mode item above (exits correctly; the cause was Glide open at the desktop mode itself, not the lost-path close -- the history below is kept for the record): Quakespasm exit leaves the desktop black with only the hardware cursor until a reboot. Traced: SDL restores the desktop mode before hiding the window, so Glide's lost flag is set at the exit close and grSstWinClose takes its lost path (hwcResetVideo only: no SLI/AA video disable, no PCI video-config reset, no HWCRLSEXCLUSIVE to the display driver); the startup probe context closes on the normal path and is fine. Ruled out: the close order (a MesaFX-style deferred close gave the same result, reverted), the 3df5/3df6 escapes (FX_GL_DISPLAY_ESCAPES_OFF=1, same). Untested: FX_GL_CLOSE_DDRAW_OFF=1 (the DirectDraw primary created after the close; its run did not get the variable), FX_GL_CLOSE_FORCE_RESTORE=1 (clears the lost flag so the full close runs; may hang at exit). The three switches were getenv tests in wglglide.c (wglDisplayNotify, wglGlideClose, wglGlideWinClose); the file is back at HEAD, the recipe is in RE-NOTES. Same mechanism likely for the alt-tab item above. See also the display-driver section below (candidate 3).
Result 2026-11-13: trace shows the lost path ran with the Glide change below (lost flag 1, close result 1) and the screen was still black, so the missing SLI / video-config release is not the cause; the Glide change is kept or reverted. Next suspect: Glide open at the desktop mode itself (see the reopen item above, fixed 2026-11-15).
Fix attempt 2026-11-13 (Glide; REVERTED 2026-11-15, Glide tree clean, clean glide3x.dll on the stick): the lost-path close now releases the video properly. minihwc.c: hwcRestoreVideo split -- the new hwcReleaseVideo does everything after the command-FIFO idle / disable (SLI / AA scan-out off through the MiniVDD on 9x or the PCI-config escapes, cfgSliLfbCtrl / AA / cfgVideoCtrl0-2 zeroed on every chip, HWCEXT_HWCRLSEXCLUSIVE, then hwcResetVideo; an exclusive-release failure no longer skips the video reset). gsst.c grSstWinClose calls hwcReleaseVideo instead of hwcResetVideo when the context was lost. The ICD is unchanged: forcing Glide's full close from the ICD would also idle / disable the command FIFO the display driver owns again by then.
- wglGlideChooseResolution: without an exact match it takes the first mode in Glide's order that contains the window, not the smallest.

- FIX ATTEMPT 2026-11-17 (untested): with FX_GL_FORCE_16BPP_PIX=1 a game that only accepts a 32 bpp pixel format (quake3v.exe, the Q3 1.32 vogons build) found no ICD format it liked and took Microsoft's software one. The 16 bpp formats are now listed a second time described as 32 bpp; a context made on one of those gets the 16 bpp format behind it (wglGlideRealPixelFormat), as MesaFX's force does.

- FIX ATTEMPT 2026-11-17 (untested): Quake 3 floor decals near the screen edge showed thin see-through horizontal lines. Regression of the 2026-11-12 polygon-offset-in-vertex-z change (the build before it is clean): in the vertex-array loops a triangle that needs clipping was staged for the clipper while the previous triangle's offset was still in the shared vertices, so only some corners carried it. The pending offset is now undone before the clip branch (sst_lockedtri.c clipTri, sst_tribuild.c hwBuildIndexedTriangles). not enough, lines still on blood marks and blob shadows while moving. Second attempt (untested): the slope part of the offset was truncated where the original's generated code rounded it, so a surface seen nearly face-on got -2 units instead of -3; it is rounded up now (hwOffsetSlopeBias). Still there. Third attempt (untested): the indexed (locked-array) path uses the chip's depth-bias register again, as the clean build did, written only when the bias changes from one triangle to the next. Why the vertex-z offset fails on that path is not understood; the immediate-mode path keeps it. 2026-11-17 bisect: lines appear from 14e45e9, the commit that added FX_GL_FORCE_16BPP_PIX. The trace log shows the display at 32 bpp when Quake 3 lists the formats, so every build before it (v1 too) rendered 32-bit whatever the in-game setting; 32-bit is clean today as well. The lines belong to real 16-bit rendering (16-bit depth), not to a code change. Test asked: v1 / original DLL with the desktop at 16-bit. Blinking stacked blood layers: in v1 too, left for now. 2026-11-18: Retested all commits: it is cebc440 after all (the 14e45e9 note above was a misread). Split builds S1 (no zero-area drop), S2 (no immediate strips / fans), S3 (offset in vertex z only) on the stick to name the part. 2026-11-19: the same cebc440 binary showed no lines in one run and lines in the next, so the bisect results are not reliable (lines come and go with position / run). A fixed scene (setviewpos + own blob shadow) is needed before builds are compared again. 2026-11-19 FIX (untested): split builds named the part: offset through the register = clean, offset in the vertices' z on the pointer path (immediate mode, clipper, unlocked arrays) = lines. All direct-FIFO paths use the depth-bias register again, written only when the bias changes and reset late (validation, glClear), so SoF should keep its fps -> test Quake 3 lines and the SoF benchmark. 2026-11-19 FIXED (register + emms build confirmed; the reduced build is to be confirmed): the cause was the MMX state. The offset stubs added in cebc440 call C helpers that use x87; the stub cleared the MMX state only on 3DNow CPUs, so on an SSE CPU the helpers at times computed NaNs and the triangle got no offset. Fix: emms in the stub (sst_offsetgen.c og_offsetStub), nothing else changed. Open from the reading: pending offset when an array-loop triangle goes to the clipper; non-FIFO indexed path draws after the next offset call.
- FIX 2026-11-20 (not yet tested): Neverwinter Nights crashed to the desktop after the intro video (16 bpp forced, shadows on). The 16 bpp formats offer an 8-bit stencil that is software, so stencil drawing runs in the software rasteriser, which needs the colour buffer locked for read and write and the depth buffer for read; Glide gives one read lock and one write lock at a time, so the depth buffer (or the colour buffer) stayed without an address: NULL pointer in the depth test. The depth buffer's frame buffer address is now kept from a short lock and used when its lock is refused, and the colour buffer goes on with its write lock when the read lock is taken (wglglide.c). still crashed. Second cause (fix 2026-11-20, not yet tested): glDrawElements on locked arrays drew software triangles without locking the render buffers at all (the generic path does lock); the lock is now taken there too (sst_varray.c). 2026-11-20: no crash any more, but models / doors / some textures flicker in and out in 16 bpp. An attempt (software depth test mirrored with the z-precision trick's inverted frames) changed nothing and was taken out again; with the Z hack off the flicker was worse, with "fast" it showed only while the camera zoomed. 2026-11-20: a build without stencil in the 16 bpp formats was tried (no flicker) and taken back decision: the original's behaviour stays (16 bpp offers a software stencil), 3dfx set it that way. State: Neverwinter Nights runs in 16 bpp with shadows, slow and with flickering models (open; depends on the Z hack setting and camera distance); in 32 bpp it runs well. The 32 bpp crash after the intro logos was the test set-up (game resolution different from the desktop), in the game's own code.
- OPEN 2026-11-20 (found with tests/gltest on the Voodoo5): in 32 bpp, glReadPixels right after drawing does not return what was just drawn; it returns an older image of that spot (three frames old in the test). 16 bpp is right. The frame itself is drawn correctly (bitmaps saved after glFinish show it), but a large textured quad drawn last was missing from them on most pages. Cause not found; not known whether the original driver or MesaFX do the same. gltest page 2 tests exactly this. 2026-11-21: in the run with FX_GL_VERSION 1.4 it did not happen (32 bpp 108 / 108, panel present on all pages); what was different from the failing runs is not known.
- NOTE 2026-11-20: a texture with a mipmap filter and missing levels is drawn textured (its level 0) on the hardware path; OpenGL says untextured. Original behaviour (the hardware path does not run the completeness test); games rely on drivers being lenient here.
- FIXED 2026-11-23 (confirmed): Jedi Academy: the intro and in-game videos do not show, the screen blinks, when 32-bit textures are in use (16-bit textures play; the display depth does not matter). Same with the original ICD; MesaFX plays them. Cause: with 32-bit textures on, a sized RGB format (GL_RGB8 / 10 / 12 / 16) was stored as ARGB8888 with base format RGBA, so the alpha bytes of the application's RGBA pixels were kept and used; an RGB texture must have alpha 1. The game draws the video quad with blending (SRC_ALPHA, ONE_MINUS_SRC_ALPHA) and no clear, so the quad blended away and the three stale buffers showed in turn. Unsized GL_RGB was already right. Fix: hwTexelFormat (sst_tex.c) gives the sized RGB formats base RGB + XRGB8888, as unsized GL_RGB. Changed from the original on purpose. gltest has a check for it (read-back page). Ruled out on the way: the upload size, grFinish per frame, the Glide version. (The invisible characters seen at first were a broken game install.)
- FIXED 2026-11-24 in Glide, not the ICD (rebuilt glide3x.dll; alt-tab not yet re-tested): Jedi Academy crashes on alt-tab. The alt-tab closes Glide, the game goes on drawing, and its glDrawArrays reaches grDrawTriangle through __glSSTRenderTriangle (sst_render.c). Glide's grDrawTriangle (h5 gdraw.c) is a naked function whose lost-context exits jump to a label with no ret after it, so they ran into the int3 padding behind the function (breakpoint exception; the page fault reported with the trace DLL was its crash logger). Inherited from the open-source Glide tree; h3 has the same text (not changed). Other games do not get there because the generated FIFO routines test the lost flag themselves. Fix: `__asm ret 12;` after the lostContext label.
- FIXED 2026-11-24 (confirmed): Serious Sam at 32 bpp: lens flares and glows flicker and show through walls. The game decides a flare's visibility by reading one depth pixel per flare (glReadPixels GL_DEPTH_COMPONENT, GL_FLOAT) at the start of each frame. Cause: the fullscreen 24-bit depth buffer was addressed with 3 bytes per pixel (elementSize from the 24 depth bits); the buffer has 4 (24 depth + 8 stencil), so every CPU access to it hit the wrong pixel, drifting per row: depth and stencil reads, glDrawPixels / glCopyPixels of depth, software depth / stencil tests. Original bug. Fix: wglGlideInitLFBDepth (wglglide.c) uses 4 bytes for a 24-bit depth buffer. Changed from the original on purpose. gltest page 12 (depth read-back): 4/27 before, 26/28 after, in 16 and 32 bpp. 16 bpp and windowed mode were not affected. To recheck some time: Neverwinter Nights stencil shadows at 32 bpp (the software depth / stencil path).
- OPEN 2026-11-24 (gltest page 12, both depths; original behaviour): the first frame in which an application reads depth returns values in the z-precision mode's encoding (1 - z/2 on an inverted frame). hwReadPixels switches the mode off for good at that first read, but that frame's buffer is still encoded until the next depth clear. One wrong frame per run in a game.
- OPEN 2026-11-24 (gltest page 12; not looked at): glReadPixels of depth as GL_UNSIGNED_INT returns 0 in 16 bpp and 0.0039 in 32 bpp for a depth of 0.5; GL_FLOAT and GL_UNSIGNED_SHORT are right.
- NOT A BUG 2026-11-23: Doom 3 does not start: the stock game requires GL_ARB_texture_env_combine, GL_ARB_texture_cube_map and GL_ARB_texture_env_dot3. The card has no cube maps and no dot3 (MesaFX does not offer them either). With the community Doom3_Voodoo2_Patch_V1_0 (rewritten materials, smaller textures; install Doom 3, the 1.3.1 patch, then the Voodoo patch) it runs on the ICD and on MesaFX (tested). There are reports of it running unpatched on a Voodoo 5; how is not known.
Test switch for that: FX_GL_FAKE_EXTENSIONS=1 (environment or Glide registry key, needs FX_GL_VERSION 1.3+) adds the three names to the extension string. Nothing new behind them: the 1.3 code already accepts cube maps without drawing them and takes DOT3 as MODULATE; the EXT combine code lacks GL_SUBTRACT (drawn as REPLACE) and takes only GL_SRC_ALPHA as the third RGB operand. Off by default; untested.

Lighting and colour:
- FIXED 2026-11-17 (builds clean, not yet tested on hardware): __glCalcRGBColor tests position.w the wrong way round: positional lights are never attenuated, directional ones are. Found while fixing: the assembly also computed (1 + k0) / ((k1 + k2 d) d) instead of 1 / (k0 + k1 d + k2 d^2). The attenuation block is now C, as the SI (gl_light.c); the rest of the routine is still the original assembly.
- FIXED 2026-11-17 (builds clean, not yet tested on hardware): __glCalcRGBColor takes the 1/k0 shortcut by testing only k1 and k2. The test itself is right (the SI's); what was wrong is that the stored 1/k0 was left stale when k0 is 0. It is now 1 in that case (light setup, gl_light.c).
- FIXED 2026-11-17 (builds clean, not yet tested on hardware): __glCalcRGBColorSI / __glCalcCIColor: no zero test on the attenuation denominator. A zero denominator now means no attenuation, in those two and in hwCalcColorFront (sst_light.c, the hardware path's routine, which had the same code) and __glCalcRGBColor.
- FIXED 2026-11-17 (builds clean, not yet tested on hardware): ComputeLightMaterialState: an emission-only front change sets baseColor without the lights' ambient terms. They are now added after an ambient or an emission change.
- FIXED 2026-11-17 (builds clean, not yet tested on hardware): og_genColor4f (SSE without 3DNow): the generated glColor4f stores r, g into userColor.b / .a, so glGet(GL_CURRENT_COLOR) returns (r, g, r, g). b and a are loaded before their stores now. (This is the path Core 2 Duo runs.)
- FIXED 2026-11-17 (builds clean, not yet tested on hardware): hwBuildTriangleProc: two-sided lighting picks the face from a vertex pointer instead of the signed area: always the same face. The generated code now reloads the area it left at [esp-4].
- NOT A BUG (checked 2026-11-17): __glSpanPackUbyte uses an old SI formula: unsigned-byte read-back (glReadPixels) is halved. The function is only installed for GL_BYTE (gl_pxpick.c), where floor(127.5 c) is the right signed-byte value; GL_UNSIGNED_BYTE uses __glSpanPackUbyteRound. Renamed __glSpanPackByte.
- FIXED 2026-11-17 (builds clean, not yet tested on hardware): ci_ClearRect switches the RGBA logic-op enable instead of the index one: an index clear with GL_INDEX_LOGIC_OP still applies the logic op. It switches the index enable now.

Geometry and the generated (og) code:
- FIXED 2026-11-17 (builds clean, not yet tested on hardware): Candidate (code read, not seen in a game): og_genRenderPrim (sst_primgen.c:273-280), the generated glBegin/glVertex point code, sends every point of size != 1 (sst_immed.c:38) to __glSSTRenderBigPoint fullscreen / __glSSTRenderWideAAPoint windowed, without checking GL_POINT_SMOOTH, texturing or the alpha test: large non-smooth or textured points come out as the round alpha disc. (hwPickRenderProcs does check them.) The generated code now calls hwOgBigPoint, which uses the point proc hwPickRenderProcs chose (when that is a hardware proc).
- FIXED 2026-11-17 (builds clean, not yet tested on hardware): doMatrix (x87, 2D matrix, 2- / 3-component vertex): pops once too often, clip.w becomes NaN and window.w 1/NaN. The extra pop is gone.
- FIXED 2026-11-17 (builds clean, not yet tested on hardware): doMatrix: 2-component vertices on some matrix paths never write z (stale clip.z). The 2DNR paths (3DNow, SSE, x87) now store z' = m32.
- FIXED 2026-11-17 (builds clean, not yet tested on hardware): og_windowTransform (x87, near-clipped vertex): leaves an extra x87 value, the caller then pops an empty register (NaN). The near-clipped path now leaves z, y, x, 1/w like the others.
- FIXED 2026-11-17 (builds clean, not yet tested on hardware): og_windowTransform (x87, texture unit 1): q is divided by w even without a non-unit q. Unit 1 alone now divides q only with a non-unit q. (The SSE path multiplies the whole coordinate including q for both units; harmless, left.)
- PARTLY FIXED 2026-11-17 (builds clean, not yet tested on hardware): The clip interpolation procs compute 1/clip.w without the SI's zero guard. Guard added in the C procs (gl_clip.c, gl_lnclip.c, gl_pgclip.c, sst_clip.c): window.w = 0 when clip.w is 0. NOT done: the generated clip-edge code (od_clipinterp.c).
- FIXED 2026-11-17 (builds clean, not yet tested on hardware): hwGenVertexArrayFill passes an immediate as CopyNormal / CopyFogCoord's scratch: GL_BYTE / GL_SHORT normal arrays give garbage / NaN normals. Now a memory operand, as for CopyColor.
- FIXED 2026-11-17 (builds clean, not yet tested on hardware): CopyColor: 3-component unsigned colour arrays with blending or alpha test get alpha = the bit pattern of integer 255 (about 0.0). Now the float bits of alphaScale.
- FIXED 2026-11-17 (builds clean, not yet tested on hardware): make_key: the code-cache key lacks the blend / alpha-test state: a routine made with blending off is reused after glEnable(GL_BLEND). __GL_SHADE_NEEDS_ALPHA is bit 1 of key word 18 (the key size is unchanged).
- FIXED 2026-11-06 (not yet tested): hwGenVertexArrayFill (SSE, FX_GL_GUARDBAND_ENABLED=1): movaps to an address that is 4 mod 16: alignment fault on every call. Now movups.
- FIXED 2026-11-06 (not yet tested): hwReadGuardBandTweaks wrote FX_GL_GBBOTTOM's default into gbLeft, leaving gbBottom unset (wrong guard band without custom FX_GL_GB* values). Now into gbBottom.
- FIXED 2026-11-17 (builds clean, not yet tested on hardware): hwGenVertexArrayFill: its key lacks the texture target, so a unit switching 1D / 2D reuses code with the wrong texture scale. The target index of each enabled unit is in key word 0 (bits 2..5).
- FIXED 2026-11-17 (builds clean, not yet tested on hardware): hwBuildImmProc (3DNow, 2-component vertices): eye z adds m22 unmultiplied (point attenuation with glVertex2*). m22 is no longer added.
- FIXED 2026-11-17 (builds clean, not yet tested on hardware): og_genMatrixRow (x87, all-zero matrix row): loads the generator's own stack slot (garbage) instead of 0.0. Loads a 0.0 constant.
- FIXED 2026-11-17 (builds clean, not yet tested on hardware): hwBuildIndexedTriangles allocates an unused 24,000-byte block per cached routine. The allocation is gone.
- PARTLY FIXED 2026-11-17: hwGenLockedTriangles (SSE): steps a fixed 16 bytes per vertex whatever the stride, reads up to 3 vertices past the end, ignores lockFirst. Correction 2026-11-06: this is the default locked-array path, not FX_GL_HSR -- see the section "HSR and the locked-array path" below (D2, D4, D9). 2026-11-17: the stride part (D2) is fixed -- the loop steps four strides (lea esi, [esi + eax*4]) and the prefetch uses esi; untested. Still open: reading up to 3 vertices past the end (D9) and lockFirst (D4), see the section below.
- FIXED 2026-11-17 (builds clean, not yet tested on hardware): hwCanDrawLockedTriangles compares an address with 3 / 4 / 5, so that test never fails (D10 below). The three comparisons are removed (no change in behaviour: they never failed).
…Show last 89 lines
- ALREADY RIGHT IN THE SOURCE (checked 2026-11-17): hwBeginSpritePoints calls grColorCombineExt (10 arguments) with 7: it survives only because the caller restores ESP from EBP.  The current source already passes all 10 / 11 arguments to the four combine-extension calls (sst_render.c).
- FIXED 2026-11-17 (builds clean, not yet tested on hardware): DrawVerticesPolygon: a rejected fan triangle skips restoring the edge flags. The reject case now falls through to the restore.
- FIXED 2026-11-17 (builds clean, not yet tested on hardware): CopyEdgeFlag ORs the edge bit where the SI assigns it. Assigns now.
- FIXED 2026-11-17 (builds clean, not yet tested on hardware): ApplyScissor is ApplyViewport without __glUpdateViewport. Added (software path's applyScissor; the hardware path uses wglDevClipWindow).
- FIXED 2026-11-17 (builds clean, not yet tested on hardware): Feedback reads texture coordinates before validating a vertex without texture. Read after the validation now.

Textures and arrays:
- FIXED 2026-11-05 (not yet tested): glTexSubImage2D on a compressed (FXT1, and since the S3TC fix any S3TC) texture uploaded rows of the uncompressed copy in the FXT1 format: garbage in that texture on the card until the next full upload. Now the whole level is uploaded from the compressed image (all 4-row blocks), as the full download does. The whole level is still re-encoded on the CPU per update.
- FIXED 2026-11-05 (not yet tested): GL_S3_s3tc is advertised but only GL_RGB4_S3TC was accepted; GL_RGB_S3TC / GL_RGBA_S3TC / GL_RGBA4_S3TC gave GL_INVALID_ENUM (Soldier of Fortune: "Unsupported format"). All four are now stored as FXT1 (RGB / RGBA). Also GL_RGB4_S3TC was RGBA in the software path and colour tables, RGB in the hardware path; now RGB everywhere.
- FIXED 2026-11-19 (not yet tested): glCompressedTexImage1DARB / glCompressedTexSubImage1DARB pointed at __glCalcMixedTexture: calling them crashed or corrupted the stack. Both now set GL_INVALID_ENUM (__glim_CompressedTex1DARB): no compressed format here has 1D images.
- FIXED 2026-11-06 (not yet tested): glGetTexParameteriv(GL_TEXTURE_RESIDENT) returns the flag's address instead of its value (never 0: always "resident"); the fv version indexed hwHandle by the unit, not its TMU slot (wrong with TEXUMA). Both now return GL_TRUE / GL_FALSE from hwHandle[__GL_TMU_SLOT(activeTexture)].
- FIXED 2026-11-19 (not yet tested): __glExtractTexelA8_B / I8_B used the wrong stride for bordered alpha / intensity textures (same in the SI): row << widthLog2, now row * width as the other bordered formats (software path only).
- FIXED 2026-11-19 (not yet tested): __glTextureFragmentUVScale scaled t by the width (same in 3dfx's older source); now by the height (software path, non-square textures).
- FIXED 2026-11-19 (not yet tested): computeModeFlags took the mipmap flag from unit 0's min filter only (enabled or not); now from every enabled unit.
- FIXED 2026-11-19 (not yet tested, medium confidence): CopyFogCoordf / d stored the array value as is, glFogCoord and the generated array copy store 1 - c; both now store 1 - c. current.fogCoord started at 0 so glGet reported 1; it now starts at 1 (c = 0, as EXT_fog_coord says).
- FIXED 2026-11-19 (not yet tested): glInterleavedArrays: the IUI formats got the core format of the same row number (now their own rows, after the 14 core ones); GL_T2F_IUI_V2F_EXT had its index offset in the normal field.

WGL and window layer:
- NOT CHANGED (checked 2026-11-17): WGL_CHECK_RESIZE tests (!flags & 0x10), which is always 0: the resize after DrvSetContext never runs. Left as it is on purpose: the pending resize (flag 1) is done properly at the next drawable lock (wglDrawLockDP: wglDrawResize + notifyResize with the window size). Making the macro's test work would clear the flag and call notifyResize with the clip box and without resizing the drawable's buffers.
- FIXED 2026-11-17 (builds clean, untested): DrvCreateLayerContext: a layer other than 0 copies an unfilled descriptor; the gc is always for layer 0; the "other DC" path frees the rc but not its gc. A layer plane other than the main one is refused now (and DrvDescribeLayerPlane always fails: there are none); the other-DC path destroys the gc; wglRcCreateGC frees the modes when the gc cannot be made.
- PARTLY FIXED 2026-11-17 (builds clean, untested): DrvSetContext: GetClientRect on a NULL hwnd for a memory DC; the screen-size clamp also moves the window to 0,0; dhrc == 0 goes through a NULL rc. Fixed: the client-rect clamp is skipped without a window. Not changed: the clamp still moves an oversized window to 0,0 (looks intended for fullscreen windows; changing it risks games). Stale: dhrc 0 finds the sentinel rc (wglRcFromHandle), not NULL.
- FIXED 2026-11-17 (builds clean, untested): DrvReleaseContext uses the unchecked dhrc's rc. NULL-checked now.
- FIXED 2026-11-17 (builds clean, untested): DrvGet / SetLayerPaletteEntries report errors as "wglDescribeLayerPlane". Own names now.
- ALREADY RIGHT IN THE SOURCE (checked 2026-11-17): Stand-alone mode: g_hStandAloneGL is never assigned, so the GL / WGL entry points are never bound. dllmain.c assigns it (LoadLibrary of OPENGL32.DLL) in the current source.
- FIXED 2026-11-17 (builds clean, untested): wglSAMakeCurrent: the release path clears hwnd / hdc on the new rc instead of the current one; failure sets a NULL gc, not the null context. The released rc is the one cleared; a failed makeCurrent installs the null context and dispatch. Also: the DC made by wglCreateContext is released when the first make-current replaces it.
- FIXED 2026-11-17 (builds clean, untested): wglSADescribePixelFormat: memcpy to a NULL descriptor. Checked.
- FIXED 2026-11-17 (builds clean, untested): wglSACreateContext leaks the gc and modes on a rejected DC, never releases its DC, and says "wglCreateContex". The gc is destroyed on a rejected DC, the name is right, and wglDeleteContext releases the DC of an rc that was never current.
- FIXED 2026-11-17 (builds clean, untested): wglSAShareLists returns with the wgl lock held. Unlocks.
- FIXED 2026-11-17 (builds clean, untested): __glDescribePixelFormat (unused) returns with the wgl lock held when out of memory. Unlocks.
- FIXED 2026-11-17 (builds clean, untested): wglGetExtensionsStringARB / wglGetPixelFormatAttrib* pass ERROR_DC_NOT_FOUND to __glSetError (a Win32 code as a GL error). SetLastError now.
- FIXED 2026-11-17 (builds clean, untested): wglSAUseFontOutlinesA never deletes its em-square font, writes gmf[] without a NULL check, and passes g_emScale + deviation. Rewritten with one cleanup path: font restored and deleted, gmf optional, deviation 0 = one design unit.
- FIXED 2026-11-17 (builds clean, untested): wglCreateEmFont leaks its OUTLINETEXTMETRIC on failure. Freed.
- FIXED 2026-11-17 (builds clean, untested): wglSAUseFontBitmapsA: the failure path deletes the wrong list range. Deletes listBase .. the failing glyph.
- FIXED 2026-11-17 (builds clean, untested): wglSAUseFontBitmapsW calls the A version. Uses GetGlyphOutlineW (the outlines W entry too).
- PARTLY FIXED 2026-11-17 (builds clean, untested): tessCombine hands GLU a stale vertex when its 4000-float buffer is full. A full buffer no longer stores part of a vertex; GLU then gets the last complete one and GL_OUT_OF_MEMORY is recorded (the buffer cannot grow: GLU keeps pointers into it).
- FIXED 2026-11-17 (builds clean, untested): wglDCIOpen keeps its reference when LoadLibrary fails. Dropped.
- FIXED 2026-11-17 (builds clean, untested): wglOutlinePush raises the capacity before a realloc that can fail. After.
- FIXED 2026-11-17 (builds clean, untested): lfbLock: with neither lock it reads an uninitialised GrLfbInfo_t; when the write lock fails it keeps the read lock. Returns without a lock; a failed write lock releases the read lock.
- FIXED 2026-11-17 (builds clean, untested): lfbDepthFree also frees buf->base. No longer.
- FIXED 2026-11-17 (builds clean, untested): wglCreateWindow: no allocation checks; for a memory DC the message hook is system-wide (thread 0). Allocations checked (NULL result; DrvSetPixelFormat checks it); no message hook for a memory DC.
- FIXED 2026-11-17 (builds clean, untested): wglDetachMessageHook runs whenever any window is freed. Only when the last window with an hwnd is freed.
- NOT CHANGED (checked 2026-11-17): impGetDrawablePrivate does not check for a NULL window. Left: there is no usable value to return; the callers would fault the same way.
- FIXED 2026-11-17 (builds clean, untested): wglDDrawClose does not clear g_ddraw. wglDDrawFree clears it with the last reference.
- FIXED 2026-11-17 (builds clean, untested): wglGlideValidateSW copies the dispatch state onto itself. The no-op copy is removed.
- FIXED 2026-11-17 (builds clean, untested): wglDevNotifyResize writes dp->windowRect without a NULL check (freed, or a DIB drawable): writes linear address 0x10. Checked.
- FIXED 2026-11-17 (builds clean, untested): wglGlideWindowSwap uses g_glideOwnerGC without a NULL check. Checked.
- FIXED 2026-11-17 (builds clean, untested): wglDevSwapBuffers uses cmdTransportInfo->ptrLostContext without a NULL check. Checked.
- OPEN (looked at 2026-11-17): After wglGlideLose, buffer swaps and rendering are not gated on glideOpen. Still open. Since 2026-11-15 the swap reopens Glide when the window is in front; rendering between the lose and that swap still goes to a closed Glide.
- FIXED 2026-11-17 (builds clean, untested): A failed loseCurrent followed by destroy leaves g_glideOwnerGC dangling for the next WM_ACTIVATE. wglDevDestroyContext clears the owner when it is the destroyed gc (it does not close Glide there: that crashed at exit, see the Heretic 2 item).
- FIXED 2026-11-17 (builds clean, untested): winPresent / winReadBack return on a failed SetClipper without leaving the critical section (lock leak). They leave the lock.
- FIXED 2026-11-17 (builds clean, untested): winOpenDDraw gives up only when all six Glide SURFACE entries are missing, then calls the missing ones. Gives up when any is missing.
- ALREADY RIGHT IN THE BUILD (checked 2026-11-17): fprintf(stderr, ...) passes a pointer into the import table (the CRT is linked without /MD). The GL core is built with /MD now (makefile.vc6), so stderr is msvcrt's.

In unused code (cannot show):
- hwFifoDrawTriFlat: no FIFO room check and no fifoRoom update.
- hwDrawIndexedTrianglesLazyFill: no bounds check on its growth buffer.
- The FIFO packet routines send q to both TMUs with two TMUs and non-unit q, even when only one is textured.
- hwLogShadingStateChange prints some flags inverted (compiled-out debug print).

Texus2 (3dfx's source):
- FIXED 2026-11-08 (works): FXT1 alpha encoding: vqChromaAlpha never initialised the palette's alpha, so the result depended on stack garbage. The four seed colours now take their alpha from the input.
- FIXED 2026-11-08 (works): the FXT1 encoder (vqChroma / vqChromaAlpha) and the NCC trainer's sample shuffle called the CRT's rand(): output depended on the application's random state, and texture uploads advanced the game's own rand() sequence. Now a private LCG (txRand, util.c) seeded per block / per shuffle; the shuffle is a Fisher-Yates instead of qsort with a random comparator.
- FIXED 2026-11-08: txFloorPow2 / txCeilPow2 doubled an int until it overflowed above 2^30 (floor hung, ceil wrapped). Now unsigned; ceil caps at 2^30.
- FIXED 2026-11-08 (confirmed: Q3 71.8 -> 75.8 fps with compression, SoF 76.9 -> 78.5, the same gain MesaFX gets): S3TC / compressed texture upload was much slower than MesaFX's. Now S3TC is stored as Napalm's native DXT1 / DXT3 / DXT5 (texcmp.h, sst_dxt.c): glCompressedTexImage2D data is copied as is, uncompressed input goes through the libtxc_dxtn encoder ported into sst_dxt.c (the code MesaFX runs via dxtn.dll; MIT, 2018 Mesa source), far cheaper than the FXT1 quantiser, glCompressedTexSubImage2D replaces blocks; GL_EXT_texture_compression_s3tc advertised. Background: The ICD stores every S3TC format (GL_RGB_S3TC, GL_RGB4_S3TC, GL_RGBA_S3TC, GL_RGBA4_S3TC, and GL_COMPRESSED_*_S3TC_DXT*) by decoding to RGBA and re-encoding the whole level with the Texus2 FXT1 vector quantiser on the CPU (vqChroma / vqChromaAlpha: up to 10 x 50 k-means passes per 8x4 block, plus the four FXT1 modes tried per block); glTexSubImage2D on a compressed texture re-encodes the whole level. MesaFX (fxddtex.c:1174-1230) maps GL_COMPRESSED_*_S3TC_DXT1/3/5 straight to Napalm's native GR_TEXFMT_ARGB_CMP_DXT1 / DXT3 / DXT5 and uploads the DXT blocks as they are: no decode, no encode. The ICD's sst code never uses the CMP_DXT formats (only g3ext.h names them). Plan: on Napalm, store S3TC / DXT input as DXT blocks in the native format (glCompressedTexImage2D as is; glTexImage2D with an S3TC internal format needs a DXT encoder, where a fast one or MesaFX's compressor is the model), keep FXT1 re-encoding only for the FXT1 internal formats; sub-image updates then replace blocks instead of re-encoding the level. Also compare upload sizes (DXT1 = FXT1 = 4 bpp, DXT3/5 = 8 bpp) against TMU memory.

HSR and the locked-array path -- open, to discuss (analysed 2026-11-06, code read only; D1 checked by hand, the rest not verified on hardware):
- Removed this text since I didnt do it, but it has a bunch of issues

Display driver (3dfx_DX_miniVdd, not the ICD) -- FIXED in the display driver (2026-11-15: "we already fixed this in the display driver", together with its support for widths over 2048). Which of the candidates below it was, and what the fix does, is not recorded here. The 2026-11-05 analysis is kept as history (code read only at the time):
- Desktop wider than 2048 (2560x1080x32): after ANY fullscreen game exits (Glide, Direct3D, OpenGL) the desktop comes back incomplete -- taskbar icons and other parts missing until repainted (e.g. resize the taskbar). OpenGL Quakespasm, whose Glide mode was the desktop mode itself, left the whole desktop black except the hardware cursor. (That Quakespasm case was the ICD reopening Glide at the desktop size; fixed in the ICD 2026-11-15, see "Seen in games".) Fine at widths <= 2048; Glide games themselves run fine at 2560x1080.
- Why the width matters: at 32 bpp a 2560 row is 10240 bytes, so the tiled pitch rounds to 16384 (DD16/H3.C:3461-3465); up to 2048 wide it stays 8192. The 2D engine copes (stride in tiles, 80 fits); CPU drawing (the DIB engine, deDeltaScan = ddTilePitch, H3.C:1715) goes through the tiled LFB view, where the span is 1.6x the real size. ddNumColorBuff also changes at the 2048 boundary (1 instead of 2, H3.C:2518-2520).
- Candidate 1 (most likely): at exit the desktop mode is restored while the game still has DirectDraw registered, so Enable1 -> DDCreateDriverObject(TRUE) -> EnableTiledHeap moves the tile mark down to ddTiledHeapStart (DDDRV16.C:900-923, H3.C:3482-3485). With a 16 KB pitch the desktop's bottom rows then pass 32 MB in the CPU view (~ the last 120 lines at 2560x1080 = the taskbar): software-drawn pixels (icons) land elsewhere, 2D-engine fills / text stay right. After DirectDraw unloads, DisableTiledHeap restores it, so a later repaint works. 1920/2048x1080x32 stay under 32 MB. (The 32 MB tiled-window size is a hypothesis.)
- Candidate 2 (the 8 KB aperture itself is still how Glide works, see the Glide section below): Glide always writes an 8 KB aperture into lfbMemoryConfig (minihwc HWC_RAW_LFB_STRIDE); EnableTiledHeap / DisableTiledHeap / MoveTileMark (DDDRV16.C:914-918, 946-950, DD32/DDFXS32.C:2135-2139) update it read-modify-write and keep the old pitch / stride bits. Harmless up to 2048, wrong at 2560 (scrambled CPU drawing after Glide); does not explain Direct3D.
- Candidate 3 (the all-black case): hwcSetExclusive (DD16/HWCEXT.C:609-635) sets HWC_EXCLUSIVE, and while it is set hardware GDI drawing is silently skipped (BITBLT16.ASM:1202, TEXT16.ASM:540). The KoolSmoky-style minihwc (_work/3dfx_glide/h5) never sends HWCRLSEXCLUSIVE; the sourceforge one does (minihwc.c:5663). Without a full mode reset at exit (Enable1 clears the flag, H3.C:3507) the desktop stays black except the cursor. Which Glide build the test machine runs is not known.
- Also: the driver never requests a repaint after a mode set; RepaintScreen is only called from ToForeground (H3.C:3777).
- Tests (no build): (1) taskbar at the top, exit a game -- icons survive = candidate 1, still missing = candidate 2; (2) 2560x1080x16 and 1280x1024x32 -- candidate 1 predicts failures there too (worse at 16 bpp), candidate 2 predicts fine; (3) diagnostic only: DWORD memSize = 16 under ...\Display\000N\DEFAULT (H3.C:2062) gives ddNumColorBuff 0, the tile mark never moves -- if the bug goes away, candidate 1 is confirmed (games then see 16 MB).
- Fix ideas: (A, cand. 1) in setupOffscreenMemory compute ddTilePitch before choosing the buffer count and reduce ddNumColorBuff until the desktop's CPU span stays <= 32 MB (0 at 2560x1080x32). (B, cand. 2) write lfbMemoryConfig in full with the desktop's aperture / stride (encoding as HARDWARE.C:646-660 / GetStrideAndAperature) in those three places and in hwcRlsExclusive. (C, cand. 3) Glide's hwcRestoreVideo sends HWCEXT_HWCRLSEXCLUSIVE; safety net: clear HWC_EXCLUSIVE in DDDestroyDriverObject. (D, optional) request a repaint after DisableTiledHeap, as ToForeground does (maybe posted, the DestroyDriver calling context is a risk).
- Test result 2026-11-05: taskbar moved to the TOP, then Quake 2 and Quake 3 exited -- the icons no longer disappear. Supports candidate 1 (only the bottom band is hit); still to check what goes missing at the bottom now, and the 16 bpp / 1280x1024 test.
- Not determined: the real Napalm tiled-window size; when DirectDraw calls DestroyDriver relative to repaint; whether Win98 repaints after a same-mode CDS_RESET.

Glide (minihwc, Glide; not the ICD) -- framebuffer reads above 2048 pixels at 32 bpp:
- Cause: Glide addresses the framebuffer (LFB) with a fixed 8 KB line stride (minihwc.c HWC_LFB_STRIDE 0x2000, HWC_RAW_LFB_STRIDE = SST_RAW_LFB_ADDR_STRIDE_8K, written to lfbMemoryConfig at mode set; buffInfo.bufLfbStride). 8 KB is 2048 pixels of a 32 bpp line; a 2560-wide line is 10 KB, so any read or write past x = 2047 lands at the start of the next line. 16 bpp is fine up to 4096 wide.
- FIXED 2026-11-15 (confirmed): Glide's screenshot key at 2560x1080x32 repeated the left 512 pixels on the right (glide_20261115_233032.png, Quake 3). hwcAAReadRegion16 now reads such modes through its per-chip path with lfbMemoryConfig switched to a 16 KB stride (SST_RAW_LFB_ADDR_STRIDE_16K) for the read only.
- OPEN (from reading the code, not yet seen in a test): everything else that goes through grLfbLock still gets the 8 KB stride at 2560x32: glReadPixels in the ICD and in MesaFX (the games' own screenshot commands), glDrawPixels / glCopyPixels and the ICD's LFB-backed software fallbacks. Expected symptom: the same wrap at x >= 2048, or drawing in the wrong place. A real fix is a 16 KB stride at mode set, which doubles the LFB address range of every buffer (hwcBufferLfbAddr, HWC_TILED_BUFFER_Y_ALIGN) and changes the buffer addresses Glide hands to the display driver for SLI / AA; the aperture size has to be checked first.

Parked performance work:
- PARKED 2026-11-13: texture download pipeline flushes. Glide h5 wraps every texture download (grTexDownloadMipMapLevel / Partial, packet 5 through the 2D engine) in two flush packets: before it GR_TEX_FLUSH_PRE (a 2D "nop|go": the chip must stop reading the old texels first), after it GR_TEX_FLUSH_POST (texBaseAddr written as ~addr, nopCMD = 3D pipeline drain, texBaseAddr back, 2D nop|go: the TMU texture cache must not keep the old texels). Glide's flushCount only drops them between the levels of one multi-level download. Quake 2 engine games update lightmaps with glTexSubImage2D right before each draw that uses them (Sin: 18-158 per frame, every one immediately followed by a draw, so nothing can be batched; the ICD issues one download per call), and each download pays both flushes; MesaFX pays the same through the same Glide. Measured with a Glide test build that skips the packets (FX_GLIDE_TEXFLUSH=0, build in _3dfx_icd_RE_archive/glide_texflush_test/, sources reverted): Sin 87.3 -> 89.1 fps (paletted textures on in both runs), but with incorrect lightmaps (stale texels), so abandoned for now. The split test (1 = skip only the pre packet, 2 = only the post) was built but not run. Ideas for a later attempt: (a) Glide side, keep the post packet (cache invalidation) and skip the pre packet only when the texture's memory has not been read since the last flush -- needs the hardware's rule for the 2D-engine download against in-flight 3D reads; (b) ICD side, write an updated level into a block the chip cannot be reading (freed at least two frames ago: with swapPendingCount <= 1 the chip has finished frame N-2 when the CPU is in frame N) through a flush-free download extension and rebind at the new texBaseAddr, retiring the old block; costs a whole-level download (32 KB) per update instead of the rows, so for 100+ updates per frame the FIFO traffic (~3 MB/frame) may eat the 2 % gain; a row-only variant needs per-block dirty tracking across the rotation. Ceiling of any scheme: the 1.8 fps measured.
- DROPPED 2026-11-19: reading "RefreshRate" in the ICD as MesaFX does and passing it to grSstWinOpen. No effect: the display driver's mode set (di_FindMode) takes the rate from DEFAULT\RefreshRate itself (0 default, -1 optimal up to TIMINGS\OptimalRefreshLimit, else the closest timing) whatever Glide asks for. A resolution only reaches the rates its TIMINGS entries have (1280x960: 60 / 75 / 85).

Reply 188 of 188, by Dolenc

User metadata
Rank Member
Rank
Member

And this is how OpenGL support was extended.

OpenGL versions above 1.1 -- plan and state

Gate: FX_GL_VERSION ("1.1" default, "1.2", "1.3", "1.4"; g_glVersion in sst_settings.c) sets GL_VERSION, the new extension names and which new entry points wglGetProcAddress hands out (s_newerProcs in wglstand.c).  3dfx Tools combo "OpenGL Version" (reg files + INF in the driver package).  With 1.1 nothing below is visible to a game.
Marks: [done] in the tree, not yet tested on hardware; [todo] not started. "Faked" = accepted and stored so a game's checks pass, but drawn the 1.1 way. Lists made from the code and the Glide headers.

OpenGL 1.2:
Supported OG
- BGR / BGRA pixel formats (EXT_bgra)
- The five packed pixel types of EXT_packed_pixels (3_3_2, 4_4_4_4, 5_5_5_1, 8_8_8_8, 10_10_10_2)
- GL_CLAMP_TO_EDGE (SGIS_texture_edge_clamp)
- GL_SMOOTH_POINT_SIZE_RANGE / GRANULARITY and the line ones (the same enums as the 1.1 queries)

Added with hardware support
- [done 2026-11-19] glDrawRangeElements / EXT, GL_MAX_ELEMENTS_VERTICES / INDICES, GL_EXT_draw_range_elements (forwards to glDrawElements) TESTED 2026-11-20 with gltest: passes in 16 bpp, picture right in 32 bpp.
- [done 2026-11-20] GL_TEXTURE_BASE_LEVEL / GL_TEXTURE_MAX_LEVEL: only the levels base..max are sized, downloaded and given to Glide as its LOD range; one level left = resident as base level only, no split trilinear; the mipmap-complete test runs over that range. Limits: level 0 must exist (format and aspect come from it); a base level so small that the aspect ratio changes (one side already 1) is not handled; glPushAttrib(GL_TEXTURE_BIT) does not save the two values TESTED 2026-11-20 with gltest: passes in 16 bpp, picture right in 32 bpp.
- [done 2026-11-20] GL_LIGHT_MODEL_COLOR_CONTROL with GL_SINGLE_COLOR (state, glGet, attribute stack; what the driver draws anyway)
- [done 2026-11-20] GL_ALIASED_POINT_SIZE_RANGE / GL_ALIASED_LINE_WIDTH_RANGE queries

Added but faked
- [done 2026-11-20] GL_TEXTURE_MIN_LOD / GL_TEXTURE_MAX_LOD: accepted, not stored (glGet gives -1000 / 1000), no effect
- [done 2026-11-20] GL_SEPARATE_SPECULAR_COLOR: accepted and reported back, drawn as single colour (the chip cannot add specular after texturing in one pass; a second pass per lit textured polygon would do it)
- [done 2026-11-20] 3D textures: glTexImage3D, glTexSubImage3D, glCopyTexSubImage3D, GL_TEXTURE_3D enable / bind / parameters, the proxy target, the image glPixelStore modes. Accepted, nothing stored, nothing drawn. GL_MAX_3D_TEXTURE_SIZE is 16 (the specification's minimum) and a larger proxy reports failure, so a game that asks first finds them unusable; a game that does not ask draws without the 3D texture. Sizes are kept once for the whole process, glGetTexImage / glGetTexParameter of the 3D target still fail
- The software rasteriser (fallback path) ignores the level range: it still samples from level 0 and may touch levels above MAX_LEVEL

Added emulated (on the CPU)
- [done 2026-11-20] Packed pixel types GL_UNSIGNED_SHORT_5_6_5, _5_6_5_REV, _4_4_4_4_REV, _1_5_5_5_REV, GL_UNSIGNED_INT_8_8_8_8_REV, _2_10_10_10_REV, GL_UNSIGNED_BYTE_2_3_3_REV: glTexImage1D/2D, glTexSubImage1D/2D and glDrawPixels convert the image to GL_UNSIGNED_BYTE first, glReadPixels and glGetTexImage fetch bytes and pack them (si_px_api.c __glPacked12*; the glPixelStore modes are applied there). The conversion was checked on this machine with the project compiler (known values, every value round-trips); the calls around it are untested. Costs a temporary copy per call. Not in display lists, glColorTable or glBitmap TESTED 2026-11-20 on the Voodoo5 with gltest: all types right in 16 bpp (texels, drawing, padded sub-image, read-back as 5_6_5); in 32 bpp the texels and the picture are right.
- [done 2026-11-20] GL_RESCALE_NORMAL: done as GL_NORMALIZE, which the specification allows and which gives the same normals for unit-length input (two new enable bits keep what the game set; the lighting code sees one "normalise" bit) TESTED 2026-11-20 with gltest: passes in 16 bpp, picture right in 32 bpp.

Left out
- The imaging subset (optional in 1.2: colour tables, convolution, histogram, blend colour)
- Not conformant where marked faked: the driver accepts every 1.2 call and query, it does not draw all of them

OpenGL 1.3 (done 2026-11-21 in gl_newer.c; TESTED 2026-11-21 with gltest page 8 on the Voodoo5: all checks pass in 16 and 32 bpp):
Supported OG
- Multitexture (ARB_multitexture, two units on two-TMU boards)
- Compressed textures (ARB_texture_compression entry points; FXT1; S3TC / DXT natively on Voodoo4/5), the generic GL_COMPRESSED_RGB / RGBA internal formats
- Texture env add (EXT_texture_env_add)
- Texture env combine (EXT_texture_env_combine, where Glide's combine extension is there)
- FSAA through 3DFX_multisample

Added with hardware support
- [done] Core names of the above: glActiveTexture, glClientActiveTexture, glMultiTexCoord*, glCompressedTexImage1D/2D, glCompressedTexSubImage1D/2D, glGetCompressedTexImage (wglGetProcAddress finds the ARB entry)
- [done] GL_MULTISAMPLE enable (passed to the T-buffer enable), GL_SAMPLE_BUFFERS / GL_SAMPLES queries

Added but faked
- [done] glSampleCoverage, GL_SAMPLE_COVERAGE, GL_SAMPLE_ALPHA_TO_COVERAGE / _TO_ONE: kept for glGet, no effect (the T-buffer has no per-fragment coverage mask)
- [done] GL_CLAMP_TO_BORDER: accepted, drawn as clamp to edge (no border colour in the TMU); a border colour with it no longer sends the texture to the software path
- [done] Cube maps: GL_TEXTURE_CUBE_MAP enable / bind / parameters, glTexImage2D / glTexSubImage2D on the faces and the proxy accepted and dropped, not drawn; GL_MAX_CUBE_MAP_TEXTURE_SIZE 16 and proxy level sizes read 0, so a game that asks first finds them unusable. glCopyTexImage2D / compressed uploads to a face still give GL_INVALID_ENUM. Texgen GL_NORMAL_MAP / GL_REFLECTION_MAP are taken as GL_EYE_LINEAR
- [done] Combine modes GL_SUBTRACT and GL_DOT3_RGB / RGBA: accepted, stored as GL_REPLACE / GL_MODULATE (the combine unit has neither); glGet reads the stored mode. A game doing bump mapping with DOT3 looks wrong
- [done] glCompressedTexImage3D / SubImage3D: GL_INVALID_ENUM

Added emulated (on the CPU)
- [done] glLoadTransposeMatrixf/d, glMultTransposeMatrixf/d, GL_TRANSPOSE_MODELVIEW / PROJECTION / TEXTURE_MATRIX queries

Left out
- GL_TRANSPOSE_COLOR_MATRIX (no colour matrix), glGetTexEnv of the faked combine modes, the cube map targets in glGetTexParameter

OpenGL 1.4 (done 2026-11-21 in gl_newer.c; TESTED 2026-11-21 with gltest page 9 on the Voodoo5: all checks pass in 16 and 32 bpp):
Supported OG
- Fog coordinates (EXT_fog_coord, where Glide has it)
- Point parameters (EXT_point_parameters)
- Stencil wrap (EXT_stencil_wrap)
…Show last 45 lines
- Blend subtract (EXT_blend_subtract, with Glide's blend extension)
- Squared blend factors (NV_blend_square)

Added with hardware support
- [done] Core names: glFogCoordf/d/fv/dv, glFogCoordPointer, glPointParameterf/fv, glBlendEquation (wglGetProcAddress finds the EXT entry); glPointParameteri/iv call the float one
- [done] glBlendFuncSeparate: the alpha factors go to grAlphaBlendFunctionExt (Voodoo4/5 with the blend extension; without it the colour factors are used for alpha)
- [done] GL_MIRRORED_REPEAT: Glide's mirror clamp mode when the TEXMIRROR extension is there, else drawn as repeat. The texture state key (hwKey) does not tell mirror from repeat
- [done] GL_TEXTURE_LOD_BIAS (glTexEnv GL_TEXTURE_FILTER_CONTROL): grTexLodBiasValue of the unit's TMU, clamped to +-4; set again when Glide is reopened after alt-tab (2026-11-22)

Added but faked
- [done] glSecondaryColor3*, glSecondaryColorPointer, GL_COLOR_SUM: kept for glGet / glIsEnabled, not added (same limit as separate specular)
- [done] glBlendColor and the constant blend factors: the factor becomes ONE or ZERO, whichever is nearer to the constant; wrong for fades
- [done] GL_MIN / GL_MAX blend equations: drawn as GL_FUNC_ADD
- [done] Depth textures and shadow compare: GL_DEPTH_COMPONENT images are stored as luminance, GL_TEXTURE_COMPARE_MODE / _FUNC and GL_DEPTH_TEXTURE_MODE accepted and ignored (shadows missing)
- [done 2026-11-22] Texture env crossbar (GL_TEXTUREn as a combine source): the unit's own texture is GL_TEXTURE; unit 1 asking for unit 0's texture gets GL_PREVIOUS (the same thing while unit 0 passes its texture on unchanged); unit 0 asking for unit 1's gets its own (the TMUs are chained one way)
- [done 2026-11-22] glEnableClientState / glDisableClientState(GL_SECONDARY_COLOR_ARRAY): kept for glIsEnabled, the array is not read
- [done 2026-11-22] glHint(GL_GENERATE_MIPMAP_HINT): kept (there is one filter)

Added emulated (on the CPU)
- [done] GL_GENERATE_MIPMAP: after level 0 of a 2D or 1D texture is loaded or changed (glTexImage, glTexSubImage, and since 2026-11-22 glCopyTexImage / glCopyTexSubImage and the 1D calls), the smaller levels are box-filtered and loaded (read back as RGBA bytes, so compressed textures are compressed again per level; a sub-image rebuilds the whole chain)
- [done] glMultiDrawArrays / glMultiDrawElements: a loop over the single calls
- [done] glWindowPos2/3 d f i s (v): glRasterPos under an identity modelview and an orthographic projection of the viewport; a position outside the viewport becomes invalid (the specification keeps it valid)

Notes for 1.3 / 1.4
- The state kept for the faked features (and the 3D texture sizes of 1.2) is one set for the whole process, not per context, and not saved by glPushAttrib
- New entry points have no dispatch slots: they cannot be compiled into display lists as themselves (they act at once, through the calls they make)
- The extension string grows by up to ~250 characters in 1.4 mode (buffer 1024; 1.1 mode is unchanged, for games that copy it into a small buffer)

OpenGL 1.5 (done 2026-11-22 in gl_newer.c, FX_GL_VERSION=1.5; builds clean; gltest page 10 passes on the NVIDIA host; NOT yet run on the Voodoo5):
Supported OG
- Nothing of its own (the shadow-function and fog-coordinate token renames come with 1.4)

Added with hardware support
- Nothing: the card has no vertex memory and no query hardware path worth its cost

Added but faked
- [done] Occlusion queries (glGenQueries, glDeleteQueries, glIsQuery, glBeginQuery / glEndQuery, glGetQueryiv, glGetQueryObjectiv / uiv): nothing is counted; a finished query returns the viewport's pixel count, so whatever a game tests is "visible" (a flare behind a wall shows). GL_QUERY_COUNTER_BITS 32, result always available. GL_ARB_occlusion_query is NOT in the extension string (only a game that goes by the 1.5 version uses them). Why not the chip's pixel counters: Glide's grGet(GR_STATS_PIXELS_*) reads the first chip only, in SLI that is every other band of lines, so a small object could read 0 and vanish.
- [done] The remaining shadow compare functions: GL_TEXTURE_COMPARE_FUNC takes any value (depth textures are luminance, never compared -- as in 1.4)

Added emulated (on the CPU)
- [done] Buffer objects (glGenBuffers, glDeleteBuffers, glIsBuffer, glBindBuffer, glBufferData / SubData, glGetBufferSubData, glMapBuffer / glUnmapBuffer, glGetBufferParameteriv, glGetBufferPointerv; also under their ARB names, GL_ARB_vertex_buffer_object listed): plain malloc memory, no speed gain over client arrays. gl*Pointer with a buffer bound stores buffer address + offset (one call in each of the seven gl*Pointer functions: __glBufArrayPointer), glDrawElements adds the element buffer's address (__glBufElements in the generic, the hardware and the display-list one). Each array remembers buffer + offset, so glBufferData that has to move the storage sets the pointers again; a refill of the same or smaller size stays in place. A deleted buffer's memory lives until no array points into it. glGetPointerv gives the offset; glGet has the ten binding queries.
Not done: glPushClientAttrib / glPopClientAttrib do not save the bindings; the state is one set for the process (as the rest of gl_newer.c); glSecondaryColorPointer is still a no-op; glInterleavedArrays works (it goes through the gl*Pointer calls).
With no buffer object ever created (1.1 .. 1.4, or a 1.5 game on client arrays) the hooks return at their first test.

Note: 1.5 is the last version this hardware can reasonably claim; 2.0 needs shaders.