[Feat] (Diligent): add offscreen depth target and depth clear

The renderer now creates a D32_FLOAT depth target and binds it as DSV for all
render passes, so depth-test state wired earlier can actually work. Add
ClearDepth for depth clears. All Diligent local tests still pass.
This commit is contained in:
BZLZHH
2026-08-18 13:34:37 +08:00
parent 821c0e0d4e
commit cedc257566
2 changed files with 42 additions and 4 deletions
@@ -41,6 +41,7 @@ namespace MobileGL::MG_Backend::DiligentBackend {
Bool Initialize(Uint32 width, Uint32 height);
void Clear(Float r, Float g, Float b, Float a);
void ClearDepth(Float depth);
void DrawTriangle();
void DrawVertices(const Float* vertices, Uint32 vertexCount);
// Draws using the live MG_State GL context: current program, VAO and
@@ -63,6 +64,8 @@ namespace MobileGL::MG_Backend::DiligentBackend {
::Diligent::IDeviceContext* m_pContext = nullptr;
::Diligent::RefCntAutoPtr<::Diligent::ITexture> m_pColorTarget;
::Diligent::RefCntAutoPtr<::Diligent::ITextureView> m_pColorRTV;
::Diligent::RefCntAutoPtr<::Diligent::ITexture> m_pDepthTarget;
::Diligent::RefCntAutoPtr<::Diligent::ITextureView> m_pDepthDSV;
::Diligent::RefCntAutoPtr<::Diligent::IPipelineState> m_pPSO;
::Diligent::RefCntAutoPtr<::Diligent::IBuffer> m_pVertexBuffer;
Uint32 m_width = 256;