mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-11 21:58:31 +09:00
[Feat] (Diligent, MG_State): add state-driven draw path (VAO/buffer/program to Diligent)
DiligentRenderer now has DrawFromState() that: - reads the current MobileGL program SPIR-V and creates Diligent shaders - reads the current VAO enabled attributes and packs bound buffer data into an interleaved vertex buffer - creates a PSO with the matching input layout and primitive topology - supports DrawArrays, DrawElements, triangle-fan and line-loop expansion This is the first real front-end state wiring; it compiles and is used by GLFunctionsTable DrawArrays/DrawElements, but is not yet covered by a runtime state-driven test.
This commit is contained in:
@@ -43,6 +43,9 @@ namespace MobileGL::MG_Backend::DiligentBackend {
|
||||
void Clear(Float r, Float g, Float b, Float a);
|
||||
void DrawTriangle();
|
||||
void DrawVertices(const Float* vertices, Uint32 vertexCount);
|
||||
// Draws using the live MG_State GL context: current program, VAO and
|
||||
// bound buffers. This is the front-end emulation entry point.
|
||||
void DrawFromState(GLenum mode, GLint first, GLsizei count, GLenum type, const void* indices);
|
||||
void ReadPixels(Uint32 x, Uint32 y, Uint32 width, Uint32 height, void* pixels);
|
||||
void Present();
|
||||
|
||||
@@ -53,6 +56,8 @@ namespace MobileGL::MG_Backend::DiligentBackend {
|
||||
Bool CreateOffscreenTargets();
|
||||
Bool CreatePipeline();
|
||||
Bool CreateVertexBuffer();
|
||||
Bool CreatePipelineFromState(GLenum mode);
|
||||
Bool UploadVertexDataFromState(GLenum mode, GLint first, GLsizei count, GLenum type, const void* indices);
|
||||
|
||||
::Diligent::IRenderDevice* m_pDevice = nullptr;
|
||||
::Diligent::IDeviceContext* m_pContext = nullptr;
|
||||
@@ -62,6 +67,7 @@ namespace MobileGL::MG_Backend::DiligentBackend {
|
||||
::Diligent::RefCntAutoPtr<::Diligent::IBuffer> m_pVertexBuffer;
|
||||
Uint32 m_width = 256;
|
||||
Uint32 m_height = 256;
|
||||
Uint32 m_lastDrawVertexCount = 0;
|
||||
Bool m_initialized = false;
|
||||
};
|
||||
} // namespace MobileGL::MG_Backend::DiligentBackend
|
||||
|
||||
Reference in New Issue
Block a user