mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-11 21:58:31 +09:00
[Feat] (Diligent, MG_Impl): wire ClearBufferfi and stencil clears through ClearBufferiv/uiv
- ClearBufferfi clears depth+stencil on the current draw framebuffer - ClearBufferiv/uiv now support GL_STENCIL via ClearStencil - Update handoff; 16 Diligent tests pass
This commit is contained in:
+1
-1
@@ -154,7 +154,7 @@ Verified locally on Turnip Adreno 750:
|
|||||||
- `MultiDrawArrays` / `MultiDrawElements` / `MultiDrawElementsBaseVertex`
|
- `MultiDrawArrays` / `MultiDrawElements` / `MultiDrawElementsBaseVertex`
|
||||||
- `DrawArraysInstanced` / `DrawElementsInstanced` family
|
- `DrawArraysInstanced` / `DrawElementsInstanced` family
|
||||||
- Indirect draw CPU fallback: `DrawArraysIndirect`, `DrawElementsIndirect`, `MultiDraw*Indirect`, `*IndirectCount`
|
- 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)
|
- `BlitFramebuffer` (same-size color copy between current read/draw FBOs)
|
||||||
- `CopyTexImage2D` / `CopyTexSubImage2D` (whole-color copy fallback)
|
- `CopyTexImage2D` / `CopyTexSubImage2D` (whole-color copy fallback)
|
||||||
- `GetTexImage` / `GetTextureImage` (RGBA8 readback)
|
- `GetTexImage` / `GetTextureImage` (RGBA8 readback)
|
||||||
|
|||||||
@@ -376,7 +376,14 @@ namespace MobileGL::MG_Backend::DiligentBackend {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint* value) {
|
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<Uint32>(value[0]));
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Float color[4] = {
|
Float color[4] = {
|
||||||
@@ -389,7 +396,14 @@ namespace MobileGL::MG_Backend::DiligentBackend {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint* value) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
Float color[4] = {
|
Float color[4] = {
|
||||||
@@ -401,6 +415,16 @@ namespace MobileGL::MG_Backend::DiligentBackend {
|
|||||||
ClearBufferfv(buffer, drawbuffer, color);
|
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<Uint32>(stencil));
|
||||||
|
}
|
||||||
|
|
||||||
void ReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void* pixels) {
|
void ReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void* pixels) {
|
||||||
auto* renderer = GetActiveRenderer();
|
auto* renderer = GetActiveRenderer();
|
||||||
if (renderer == nullptr || pixels == nullptr) {
|
if (renderer == nullptr || pixels == nullptr) {
|
||||||
@@ -598,6 +622,7 @@ namespace MobileGL::MG_Backend::DiligentBackend {
|
|||||||
m_functions.GL.MultiDrawArraysIndirectCount = MultiDrawArraysIndirectCount;
|
m_functions.GL.MultiDrawArraysIndirectCount = MultiDrawArraysIndirectCount;
|
||||||
m_functions.GL.MultiDrawElementsIndirectCount = MultiDrawElementsIndirectCount;
|
m_functions.GL.MultiDrawElementsIndirectCount = MultiDrawElementsIndirectCount;
|
||||||
m_functions.GL.ClearBufferfv = ClearBufferfv;
|
m_functions.GL.ClearBufferfv = ClearBufferfv;
|
||||||
|
m_functions.GL.ClearBufferfi = ClearBufferfi;
|
||||||
m_functions.GL.ClearBufferiv = ClearBufferiv;
|
m_functions.GL.ClearBufferiv = ClearBufferiv;
|
||||||
m_functions.GL.ClearBufferuiv = ClearBufferuiv;
|
m_functions.GL.ClearBufferuiv = ClearBufferuiv;
|
||||||
m_functions.GL.BlitFramebuffer = BlitFramebuffer;
|
m_functions.GL.BlitFramebuffer = BlitFramebuffer;
|
||||||
|
|||||||
Reference in New Issue
Block a user