mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-09 12:48:32 +09:00
[Feat] (Diligent, EGL): route EGL window resize to Diligent swap chain
- Add renderer->ResizeSwapChain and override BackendObject_Diligent::ResizeEGLWindowSurface - Update handoff; 16 Diligent tests pass
This commit is contained in:
+1
-1
@@ -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.
|
||||
|
||||
@@ -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<std::recursive_mutex> 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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user