mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-11 21:58:31 +09:00
[Fix] (MG_State, MG_Impl): GL-order capture for geometry triangle strips
Vulkan transform feedback captures odd strip triangles as (i, i+2, i+1) while GL table 10.1 decomposes them as (i+1, i, i+2). When the capture stage is a triangle-strip geometry shader whose EmitVertex/EndPrimitive sequence is statically knowable (no emission under control flow), link time extracts the per-invocation strip lengths from the glslang AST, and EndTransformFeedback rotates each odd triangle's captured vertex records into GL order in place (bounded by the binding ranges' whole-triangle capacity; raw input primitives tracked per Begin/End). KHR-GL33.transform_feedback.geometry passes - the family is 21/21.
This commit is contained in:
@@ -218,6 +218,7 @@ namespace MobileGL {
|
||||
m_transformFeedbackProgram = program;
|
||||
++m_transformFeedbackGeneration;
|
||||
m_transformFeedbackCapturedVertices = 0;
|
||||
m_transformFeedbackInputPrimitives = 0;
|
||||
}
|
||||
void EndTransformFeedback() {
|
||||
m_transformFeedbackActive = false;
|
||||
@@ -244,6 +245,12 @@ namespace MobileGL {
|
||||
m_transformFeedbackCapturedVertices += vertices;
|
||||
}
|
||||
Uint64 GetTransformFeedbackCapturedVertices() const { return m_transformFeedbackCapturedVertices; }
|
||||
// Raw assembled input primitives fed to the capture stage since Begin
|
||||
// (pre-clamp; drives the GS strip capture-order fixup at EndTF).
|
||||
void AddTransformFeedbackInputPrimitives(Uint64 primitives) {
|
||||
m_transformFeedbackInputPrimitives += primitives;
|
||||
}
|
||||
Uint64 GetTransformFeedbackInputPrimitives() const { return m_transformFeedbackInputPrimitives; }
|
||||
|
||||
// Framebuffer
|
||||
void GenFramebufferNames(Uint number, Vector<Uint>& framebuffers);
|
||||
@@ -283,6 +290,7 @@ namespace MobileGL {
|
||||
Uint64 m_transformFeedbackGeneration = 0;
|
||||
Uint64 m_transformFeedbackPrimitiveCounter = 0;
|
||||
Uint64 m_transformFeedbackCapturedVertices = 0;
|
||||
Uint64 m_transformFeedbackInputPrimitives = 0;
|
||||
TextureState m_textureState;
|
||||
ProgramState m_programState;
|
||||
RenderState m_renderState;
|
||||
|
||||
Reference in New Issue
Block a user