[Feat] (MG_Impl/GLImpl, MG_State): implement glPrimitiveRestartIndex

Store the primitive restart index as render state and report it through
glGetIntegerv(GL_PRIMITIVE_RESTART_INDEX), replacing the stub and the
hardcoded 0 in the getter.

- RenderState gains a PrimitiveRestartIndex field (default 0) with
  set/get accessors and GLContext wrappers.
- glPrimitiveRestartIndex accepts any GLuint and generates no error.
- glGetIntegerv(GL_PRIMITIVE_RESTART_INDEX) now reads the stored value.

This is the state layer only. The backends do not yet honor an arbitrary
restart index at draw time -- Vulkan and GLES support only the fixed
all-ones restart value (GL_PRIMITIVE_RESTART_FIXED_INDEX) -- so a non-
default index is tracked and queryable but not yet applied to indexed
draws.

Tests: RenderStateSanity round-trip (default 0, mid value, and the full
32-bit range). Full SanityTest sweep green (31/31).
This commit is contained in:
2026-07-11 00:43:45 -04:00
parent 22ac8a8c10
commit e18d369adf
9 changed files with 63 additions and 2 deletions
+1 -1
View File
@@ -1351,7 +1351,7 @@ namespace MobileGL::MG_Impl::GLImpl {
: GL_FALSE;
return;
case GL_PRIMITIVE_RESTART_INDEX:
*params = 0; // fixed default; PrimitiveRestartIndex entrypoints are stubbed
*params = static_cast<GLint>(MG_State::pGLContext->GetPrimitiveRestartIndex());
return;
case GL_PROGRAM_BINARY_FORMATS:
*params = 0; // program-binary entrypoints are stubbed