mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-10 05:08:31 +09:00
[Feat] (DirectGLES): implement transform feedback capture
Transform feedback was frontend-only on DirectGLES: glBeginTransformFeedback just flipped MobileGL's own capture state and the real ES driver was never told to capture anything, so every capture buffer read back as whatever it held before the draw (zeros for a fresh glBufferData(NULL)). DirectVulkan drives its capture from its own draw recording, so the shared GLFunctionsTable had no entries for the span at all. Capture now runs on the real driver: - The backend program declares the capture set with glTransformFeedbackVaryings before it links. SPIRV-Cross keeps user output names verbatim in the transpiled ESSL, so the frontend's requested names carry over unchanged. - New GLFunctionsTable Begin/EndTransformFeedback entries hand the span boundaries to the backend (null for DirectVulkan, which is unaffected). - The driver-side begin is deferred to the first draw of the span: ES needs the capturing program current and the capture buffers bound, and both only become true once PrepareForDraw has run. A span that never draws never touches the driver, which is what the GL semantics amount to anyway. - The end mirrors the captured ranges back into the frontend buffer shadows - the GPU wrote them behind the frontend's back, so MapBuffer/GetBufferSubData would otherwise still return the pre-draw bytes. Takes KHR-GL32.transform_feedback from 13/21 to 19/21; the two remaining failures are the geometry-amplified primitive queries, which still go through the frontend's CPU accounting.
This commit is contained in:
@@ -229,6 +229,13 @@ namespace MobileGL {
|
||||
// (optional; null = frontend falls back to CPU accounting).
|
||||
BackendQueryHandle (*BeginXfbPrimitivesQuery)(Bool generated);
|
||||
void (*EndXfbPrimitivesQuery)(BackendQueryHandle query);
|
||||
// Transform feedback capture spans, for backends whose own GL/ES driver
|
||||
// performs the capture (DirectGLES). Both optional; null means the backend
|
||||
// drives capture from its draw recording instead (DirectVulkan). End is
|
||||
// called while the frontend capture state is still active, so the backend
|
||||
// can still see the capture program and buffer bindings.
|
||||
void (*BeginTransformFeedback)(GLenum primitiveMode);
|
||||
void (*EndTransformFeedback)();
|
||||
Int64 (*GetGpuTimestampNs)(); // glGetInteger64v(GL_TIMESTAMP); 0 if unsupported
|
||||
};
|
||||
struct GlobalBackendFunctionsTable {
|
||||
|
||||
Reference in New Issue
Block a user