diff --git a/HANDOFF_DILIGENT.md b/HANDOFF_DILIGENT.md index f2a6eae1..e053042f 100644 --- a/HANDOFF_DILIGENT.md +++ b/HANDOFF_DILIGENT.md @@ -154,7 +154,7 @@ Verified locally on Turnip Adreno 750: - `MultiDrawArrays` / `MultiDrawElements` / `MultiDrawElementsBaseVertex` - `DrawArraysInstanced` / `DrawElementsInstanced` family - Indirect draw CPU fallback: `DrawArraysIndirect`, `DrawElementsIndirect`, `MultiDraw*Indirect`, `*IndirectCount` - - `ClearBufferfv` / `ClearBufferiv` / `ClearBufferuiv` + - `ClearBufferfv` / `ClearBufferfi` / `ClearBufferiv` / `ClearBufferuiv` (incl. stencil clear) - `BlitFramebuffer` (same-size color copy between current read/draw FBOs) - `CopyTexImage2D` / `CopyTexSubImage2D` (whole-color copy fallback) - `GetTexImage` / `GetTextureImage` (RGBA8 readback) diff --git a/MobileGL/MG_Backend/Diligent/BackendObject_Diligent.cpp b/MobileGL/MG_Backend/Diligent/BackendObject_Diligent.cpp index 3ab3bc4d..931d5d45 100644 --- a/MobileGL/MG_Backend/Diligent/BackendObject_Diligent.cpp +++ b/MobileGL/MG_Backend/Diligent/BackendObject_Diligent.cpp @@ -376,7 +376,14 @@ namespace MobileGL::MG_Backend::DiligentBackend { } void ClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint* value) { - if (buffer == GL_STENCIL || value == nullptr) { + if (value == nullptr) { + return; + } + if (buffer == GL_STENCIL) { + auto* renderer = GetActiveRenderer(); + if (renderer != nullptr) { + renderer->ClearStencil(static_cast(value[0])); + } return; } Float color[4] = { @@ -389,7 +396,14 @@ namespace MobileGL::MG_Backend::DiligentBackend { } void ClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint* value) { - if (buffer == GL_STENCIL || value == nullptr) { + if (value == nullptr) { + return; + } + if (buffer == GL_STENCIL) { + auto* renderer = GetActiveRenderer(); + if (renderer != nullptr) { + renderer->ClearStencil(value[0]); + } return; } Float color[4] = { @@ -401,6 +415,16 @@ namespace MobileGL::MG_Backend::DiligentBackend { ClearBufferfv(buffer, drawbuffer, color); } + void ClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil) { + auto* renderer = GetActiveRenderer(); + if (renderer == nullptr || buffer != GL_DEPTH_STENCIL) { + return; + } + (void)drawbuffer; + renderer->ClearDepth(depth); + renderer->ClearStencil(static_cast(stencil)); + } + void ReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void* pixels) { auto* renderer = GetActiveRenderer(); if (renderer == nullptr || pixels == nullptr) { @@ -598,6 +622,7 @@ namespace MobileGL::MG_Backend::DiligentBackend { m_functions.GL.MultiDrawArraysIndirectCount = MultiDrawArraysIndirectCount; m_functions.GL.MultiDrawElementsIndirectCount = MultiDrawElementsIndirectCount; m_functions.GL.ClearBufferfv = ClearBufferfv; + m_functions.GL.ClearBufferfi = ClearBufferfi; m_functions.GL.ClearBufferiv = ClearBufferiv; m_functions.GL.ClearBufferuiv = ClearBufferuiv; m_functions.GL.BlitFramebuffer = BlitFramebuffer;