diff --git a/HANDOFF_DILIGENT.md b/HANDOFF_DILIGENT.md index 992870d0..5f85fe1a 100644 --- a/HANDOFF_DILIGENT.md +++ b/HANDOFF_DILIGENT.md @@ -220,7 +220,7 @@ Notes: - User framebuffers now support texture color attachments, renderbuffer color readback, multiple simultaneous color targets, and depth/stencil texture or renderbuffer attachments. - Textures auto-sync `ITextureObject` → Diligent resources, including mip levels and sampler state; compressed textures and integer/3-channel formats that Diligent lacks are still skipped. - Global UBO (default-block `glUniform*`) and named application UBO blocks (through `glBindBufferBase`/`glUniformBlockBinding`) now upload and bind; SSBOs are still not fed from frontend buffer bindings. -- Swapchain creation and resize are wired for native EGL window surfaces via `Diligent::ISwapChain`; `Present()` presents the active swap chain when present and otherwise flushes the offscreen target. Actual on-screen EGL presentation is still untested in this headless environment, and the X11 display/connection fields are not yet plumbed through `WindowHandle`. `SetSwapInterval` remains a no-op. +- Swapchain creation and resize are wired for native EGL window surfaces via `Diligent::ISwapChain`; `Present()` presents the active swap chain when present and otherwise flushes the offscreen target. Actual on-screen EGL presentation is still untested in this headless environment, and the X11 display/connection fields are not yet plumbed through `WindowHandle`. `SetSwapInterval` now forwards the requested sync interval to `ISwapChain::Present()`. - No transform feedback / GPU-accelerated queries / non-color readback; fence sync and timer queries use CPU fallbacks. - Draw range, multi-draw, instanced-draw wrappers, clear-buffer, blit, read-pixels, CopyTexImage*, CopyImageSubData, GenerateMipmap, GetTexImage/GetTextureImage and indirect draws are now wired; buffer subdata paths still remain. - A last-PSO cache now avoids recreating the pipeline when program/render-state/topology/VAO layout is unchanged; texture/UBO resources are still rebound dynamically per draw. diff --git a/MobileGL/MG_Backend/Diligent/BackendObject_Diligent.cpp b/MobileGL/MG_Backend/Diligent/BackendObject_Diligent.cpp index f8d3790f..1e0b9d19 100644 --- a/MobileGL/MG_Backend/Diligent/BackendObject_Diligent.cpp +++ b/MobileGL/MG_Backend/Diligent/BackendObject_Diligent.cpp @@ -659,8 +659,10 @@ namespace MobileGL::MG_Backend::DiligentBackend { } void SetSwapInterval(Int interval) { - // No native swapchain yet; the offscreen renderer ignores the interval. - (void)interval; + auto* renderer = GetActiveRenderer(); + if (renderer != nullptr) { + renderer->SetSwapInterval(interval > 0 ? static_cast(interval) : 0); + } } void Present() { diff --git a/MobileGL/MG_Backend/Diligent/Renderer/DiligentRenderer.cpp b/MobileGL/MG_Backend/Diligent/Renderer/DiligentRenderer.cpp index 98bf19ad..5f019232 100644 --- a/MobileGL/MG_Backend/Diligent/Renderer/DiligentRenderer.cpp +++ b/MobileGL/MG_Backend/Diligent/Renderer/DiligentRenderer.cpp @@ -2040,13 +2040,17 @@ void main() return true; } + void DiligentRenderer::SetSwapInterval(Uint32 interval) { + m_swapInterval = interval; + } + void DiligentRenderer::ReleaseSwapChain() { m_pSwapChain.Release(); } void DiligentRenderer::Present() { if (m_pSwapChain) { - m_pSwapChain->Present(0); + m_pSwapChain->Present(m_swapInterval); } else if (m_pContext) { // Offscreen renderer: nothing to present yet. m_pContext->Flush(); diff --git a/MobileGL/MG_Backend/Diligent/Renderer/DiligentRenderer.h b/MobileGL/MG_Backend/Diligent/Renderer/DiligentRenderer.h index 50f36afd..765262c0 100644 --- a/MobileGL/MG_Backend/Diligent/Renderer/DiligentRenderer.h +++ b/MobileGL/MG_Backend/Diligent/Renderer/DiligentRenderer.h @@ -65,6 +65,7 @@ namespace MobileGL::MG_Backend::DiligentBackend { Bool CreateSwapChain(::Diligent::IEngineFactoryVk* factory, const WindowHandle& handle, Uint32 width, Uint32 height); Bool ResizeSwapChain(Uint32 width, Uint32 height); + void SetSwapInterval(Uint32 interval); // Creates a simple 2D RGBA8 texture from CPU data and makes it available // to state PSOs under the shader variable name "g_Texture". Bool CreateTestTexture(const void* data, Uint32 width, Uint32 height); @@ -143,6 +144,7 @@ namespace MobileGL::MG_Backend::DiligentBackend { UnorderedMap> m_namedUboCache; Uint32 m_width = 256; Uint32 m_height = 256; + Uint32 m_swapInterval = 0; Uint32 m_lastDrawVertexCount = 0; Uint64 m_lastPSOKey = 0; Bool m_hasCachedPSO = false;