From 8630660a2a44d362ecd95415a8334f260a935a77 Mon Sep 17 00:00:00 2001 From: "Nasir W." <116527368+nasiratif@users.noreply.github.com> Date: Thu, 14 May 2026 21:34:42 -0400 Subject: [PATCH 1/3] Document some HWA stuff --- DarkEdif/Inc/Windows/WindowsSurface.hpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/DarkEdif/Inc/Windows/WindowsSurface.hpp b/DarkEdif/Inc/Windows/WindowsSurface.hpp index 0afda7af..89c7ae28 100644 --- a/DarkEdif/Inc/Windows/WindowsSurface.hpp +++ b/DarkEdif/Inc/Windows/WindowsSurface.hpp @@ -655,12 +655,13 @@ class FusionAPIImport cSurface // Sets this cSurface as the current one in a double-buffer... in what context? How are surfaces paired, and how do we know what the pairs target? void SetCurrentDevice(); - // TODO: YQ: Rendering to GetRenderTargetSurface()? Where and why do we need to call BeginRendering()? // Implemented in Direct3D 9 and 11 on CF2.5+. Not available in Direct3D 8. + // Use if you plan to do your own HWA rendering (i.e, doing rendering with DirectX driver info) onto the surface; if the surface is an HWA render target this function binds the render target as the current one in Fusion's D3D device state. int BeginRendering(BOOL clear, RGBAREF rgba); - // TODO: YQ: Rendering to GetRenderTargetSurface()? + // Call after you've finished rendering after a previous BeginRendering() call. int EndRendering(); - // TODO: YQ: update how? + // Only works on frame surface; redraws Fusion's window. + // Note that on D3D9 this usually can't be called in a Display/DisplayRunObject() routine, my assumption being that it's due to the fact you'd be in a BeginScene()/EndScene() pair at that point (which D3D9 usually does not allow). BOOL UpdateScreen(); #ifdef HWABETA @@ -670,7 +671,7 @@ class FusionAPIImport cSurface void ReleaseRenderTargetSurface(cSurface* psf); // TODO: YQ: What does this do, how does Max affect it ? void Flush(BOOL bMax); - // TODO: YQ: I would guess this is the Z position of the buffer, but a float makes no sense here. + // Frame-surface only. In D3D9, this enables Z-buffering similar to how you can also enable it in shaders, but I still have no idea what the z2D parameter does.. void SetZBuffer(float z2D); #endif From 63ef52f6a72cebe926d895bcab7d5a3b0549aac8 Mon Sep 17 00:00:00 2001 From: "Nasir W." <116527368+nasiratif@users.noreply.github.com> Date: Thu, 14 May 2026 22:37:08 -0400 Subject: [PATCH 2/3] Add clarity --- DarkEdif/Inc/Windows/WindowsSurface.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DarkEdif/Inc/Windows/WindowsSurface.hpp b/DarkEdif/Inc/Windows/WindowsSurface.hpp index 89c7ae28..6e5580f2 100644 --- a/DarkEdif/Inc/Windows/WindowsSurface.hpp +++ b/DarkEdif/Inc/Windows/WindowsSurface.hpp @@ -661,7 +661,7 @@ class FusionAPIImport cSurface // Call after you've finished rendering after a previous BeginRendering() call. int EndRendering(); // Only works on frame surface; redraws Fusion's window. - // Note that on D3D9 this usually can't be called in a Display/DisplayRunObject() routine, my assumption being that it's due to the fact you'd be in a BeginScene()/EndScene() pair at that point (which D3D9 usually does not allow). + // Note that on D3D9 this usually can't be called in a Display/DisplayRunObject() routine, my assumption being that it's due to the fact you'd be in a BeginScene()/EndScene() pair at that point (which, D3D9 usually does not allow screen updates in that case). BOOL UpdateScreen(); #ifdef HWABETA From 76c0df922e89a039e55e6061c3feee620c6372b9 Mon Sep 17 00:00:00 2001 From: "Nasir W." <116527368+nasiratif@users.noreply.github.com> Date: Sun, 17 May 2026 14:25:10 -0400 Subject: [PATCH 3/3] Even more documentation Clickteam should have been doing this, not me.. --- DarkEdif/Inc/Windows/WindowsSurface.hpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/DarkEdif/Inc/Windows/WindowsSurface.hpp b/DarkEdif/Inc/Windows/WindowsSurface.hpp index 6e5580f2..6c823550 100644 --- a/DarkEdif/Inc/Windows/WindowsSurface.hpp +++ b/DarkEdif/Inc/Windows/WindowsSurface.hpp @@ -1057,7 +1057,11 @@ class FusionAPIImport cSurface // Lost device callback #ifdef HWABETA + // TODO: This apparently must be called inside of a lost-device callback.. void OnLostDevice(); + // Adds a lost device callback to the surface. + // Such callback is executed right when the D3D device is lost, in which case you must free all custom D3D resources you may have created as part of this surface. + // NB: There's no callbacks to recover from device loss, only when it occurs, so you'll need to figure out yourself when to recreate your custom D3D resources had you created any. void AddLostDeviceCallBack(LOSTDEVICECALLBACKPROC pCallback, LPARAM lUserParam); void RemoveLostDeviceCallBack(LOSTDEVICECALLBACKPROC pCallback, LPARAM lUserParam);