From dfe9da43dab6c933bc1024f992383f08e01386de Mon Sep 17 00:00:00 2001 From: hachem Date: Tue, 18 Aug 2026 15:00:34 +0200 Subject: [fix]: macos compatibility --- src/Engine/Engine.h | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'src/Engine/Engine.h') diff --git a/src/Engine/Engine.h b/src/Engine/Engine.h index c3cfdd0..f8ef628 100644 --- a/src/Engine/Engine.h +++ b/src/Engine/Engine.h @@ -89,7 +89,16 @@ namespace Donut void SetTargetFPS(int fps) { m_TargetFPS = fps; } int GetTargetFPS() const { return m_TargetFPS; } float GetCurrentFPS() const { return m_CurrentFPS; } - void SetComputeHeight(int height) { m_ComputeHeight = height; } + void SetComputeHeight(int height) + { +#ifdef __APPLE__ + // Without compute shaders the geodesic pass runs as a tiled + // fragment shader (see DrawGeodesicPass), so very high working + // resolutions make each frame take many seconds. Cap it on macOS. + if (height > 256) height = 256; +#endif + m_ComputeHeight = height; + } int GetComputeHeight() const { return m_ComputeHeight; } int GetComputeWidth() const { return (m_Width * m_ComputeHeight) / m_Height; } void UpdateComputeDimensions(); @@ -125,6 +134,11 @@ namespace Donut private: Ref CreateComputeProgram(const char* path); std::pair, Ref> QuadVAO(); + + // Draws the bound geodesic shader over a cw x ch target. On macOS this + // is split into scissored tiles (with a flush each) so no single GPU + // submission trips the OS watchdog; elsewhere it is one fast draw. + void DrawGeodesicPass(int cw, int ch); private: Ref m_QuadVAO; Ref m_Texture; @@ -137,6 +151,11 @@ namespace Donut Ref m_ObjectsUBO; Ref m_SimulationUBO; + // FBO used to render the geodesic pass into m_Texture. The geodesic + // shader is a fragment shader (macOS has no compute), so it draws a + // fullscreen quad into this framebuffer instead of dispatching compute. + uint32_t m_GeodesicFBO = 0; + int m_Width; int m_Height; float m_Width_f = 100.0f*1e10f; -- cgit v1.3