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:
@@ -159,6 +159,18 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
||||
void SetGLESCapabilities(const MG_External::GLESCapabilities& capabilities);
|
||||
void DestroyEGLContext();
|
||||
|
||||
// Transform feedback capture spans, performed by the real ES driver. The
|
||||
// capture set is declared on the backend program at link time; 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 the end also mirrors the
|
||||
// captured bytes back into the frontend buffer shadows.
|
||||
namespace XfbImpl {
|
||||
Bool AreTransformFeedbacksSupported();
|
||||
void BeginTransformFeedback(GLenum primitiveMode);
|
||||
void EndTransformFeedback();
|
||||
void OnBackendContextDestroyed();
|
||||
} // namespace XfbImpl
|
||||
|
||||
extern MG_External::EGLFunctionsTable g_EGLFuncs;
|
||||
extern MG_External::GLESFunctionsTable g_GLESFuncs;
|
||||
extern MG_External::GLESCapabilities g_GLESCapabilities;
|
||||
|
||||
Reference in New Issue
Block a user