mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-11 21:58:31 +09:00
[Feat] (DirectVulkan): emulate GL_LINE_LOOP with closed indexed line strips
Vulkan has no LINE_LOOP topology and the frontend used to reject the mode with GL_INVALID_OPERATION, which is itself non-conformant (several KHR-GL33 transform_feedback tests draw line loops and expect no error). DrawArrays, DrawElements and DrawElementsBaseVertex now rewrite the draw into an indexed GL_LINE_STRIP whose synthesized uint32 index list revisits the first vertex, delivered through the client-memory index path (a new forceClientMemory flag keeps a bound element-array buffer from hijacking the synthesized pointer). Entry points without the rewrite degrade to an open line strip instead of a triangle list.
This commit is contained in:
@@ -25,6 +25,11 @@ namespace MobileGL {
|
||||
case GL_TRIANGLE_FAN:
|
||||
return VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN;
|
||||
case GL_LINE_LOOP:
|
||||
// DrawArrays/DrawElements rewrite line loops into closed indexed
|
||||
// strips; entry points without that rewrite (instanced/indirect)
|
||||
// degrade to an open strip, which only misses the closing segment.
|
||||
MGLOG_W("GL_LINE_LOOP without index rewrite; drawing as LINE_STRIP");
|
||||
return VK_PRIMITIVE_TOPOLOGY_LINE_STRIP;
|
||||
default:
|
||||
MGLOG_W("Unrecognized primitive topology");
|
||||
return VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST;
|
||||
|
||||
Reference in New Issue
Block a user