diff --git a/HANDOFF_DILIGENT.md b/HANDOFF_DILIGENT.md index 48d12e82..992870d0 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 is now 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` remains a no-op. - 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 cbc17781..a8b2a751 100644 --- a/MobileGL/MG_Backend/Diligent/BackendObject_Diligent.cpp +++ b/MobileGL/MG_Backend/Diligent/BackendObject_Diligent.cpp @@ -841,6 +841,17 @@ namespace MobileGL::MG_Backend::DiligentBackend { BackendObject::ReleaseEGLResources(); } + Bool BackendObject_Diligent::ResizeEGLWindowSurface(EGLSurface surface, Uint32 width, Uint32 height) { + const std::lock_guard lock(m_eglStateMutex); + if (!BackendObject::ResizeEGLWindowSurface(surface, width, height)) { + return false; + } + if (m_eglSurface == surface && m_pRenderer != nullptr) { + return m_pRenderer->ResizeSwapChain(width, height); + } + return true; + } + const RendererInfo& BackendObject_Diligent::GetRendererInfo() const { return m_rendererInfo; } diff --git a/MobileGL/MG_Backend/Diligent/BackendObject_Diligent.h b/MobileGL/MG_Backend/Diligent/BackendObject_Diligent.h index e00e29b9..e863c668 100644 --- a/MobileGL/MG_Backend/Diligent/BackendObject_Diligent.h +++ b/MobileGL/MG_Backend/Diligent/BackendObject_Diligent.h @@ -43,6 +43,7 @@ namespace MobileGL::MG_Backend::DiligentBackend { Bool InitCapabilities() override; Bool InitWindowSurface() override; Bool InitPbufferSurface(EGLint width, EGLint height) override; + Bool ResizeEGLWindowSurface(EGLSurface surface, Uint32 width, Uint32 height) override; const RendererInfo& GetRendererInfo() const override; String GetBackendAPIVersionString() const override; diff --git a/MobileGL/MG_Backend/Diligent/Renderer/DiligentRenderer.cpp b/MobileGL/MG_Backend/Diligent/Renderer/DiligentRenderer.cpp index 38a08019..98bf19ad 100644 --- a/MobileGL/MG_Backend/Diligent/Renderer/DiligentRenderer.cpp +++ b/MobileGL/MG_Backend/Diligent/Renderer/DiligentRenderer.cpp @@ -420,6 +420,16 @@ void main() return true; } + Bool DiligentRenderer::ResizeSwapChain(Uint32 width, Uint32 height) { + if (m_pSwapChain == nullptr) { + return false; + } + m_pSwapChain->Resize(width > 0 ? width : 1, height > 0 ? height : 1); + m_width = width > 0 ? width : m_width; + m_height = height > 0 ? height : m_height; + return true; + } + Bool DiligentRenderer::CreateOffscreenTargets() { ::Diligent::TextureDesc texDesc; texDesc.Name = "MobileGL Diligent offscreen color target"; diff --git a/MobileGL/MG_Backend/Diligent/Renderer/DiligentRenderer.h b/MobileGL/MG_Backend/Diligent/Renderer/DiligentRenderer.h index 12bf5c37..50f36afd 100644 --- a/MobileGL/MG_Backend/Diligent/Renderer/DiligentRenderer.h +++ b/MobileGL/MG_Backend/Diligent/Renderer/DiligentRenderer.h @@ -64,6 +64,7 @@ namespace MobileGL::MG_Backend::DiligentBackend { // Creates a real Diligent swap chain for a native EGL window surface. Bool CreateSwapChain(::Diligent::IEngineFactoryVk* factory, const WindowHandle& handle, Uint32 width, Uint32 height); + Bool ResizeSwapChain(Uint32 width, Uint32 height); // 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);