mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-12 22:28:32 +09:00
[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:
@@ -372,6 +372,14 @@ namespace MobileGL::MG_State {
|
||||
return m_renderState.GetPolygonModeBack();
|
||||
}
|
||||
|
||||
void GLContext::SetPrimitiveRestartIndex(Uint32 index) {
|
||||
m_renderState.SetPrimitiveRestartIndex(index);
|
||||
}
|
||||
|
||||
Uint32 GLContext::GetPrimitiveRestartIndex() const {
|
||||
return m_renderState.GetPrimitiveRestartIndex();
|
||||
}
|
||||
|
||||
void GLContext::SetPointSize(Float size) {
|
||||
m_renderState.SetPointSize(size);
|
||||
}
|
||||
|
||||
@@ -136,6 +136,8 @@ namespace MobileGL {
|
||||
void SetPolygonMode(GLenum front, GLenum back);
|
||||
GLenum GetPolygonModeFront() const;
|
||||
GLenum GetPolygonModeBack() const;
|
||||
void SetPrimitiveRestartIndex(Uint32 index);
|
||||
Uint32 GetPrimitiveRestartIndex() const;
|
||||
void SetCapability(CapabilityInput cap, Bool enabled);
|
||||
Bool IsCapabilityEnabled(CapabilityInput cap) const;
|
||||
void SetCapabilityIndexed(CapabilityInput cap, Uint index, Bool enabled);
|
||||
|
||||
@@ -133,6 +133,16 @@ namespace MobileGL {
|
||||
return m_parameters.PolygonModeBack;
|
||||
}
|
||||
|
||||
void RenderState::SetPrimitiveRestartIndex(Uint32 index) {
|
||||
if (m_parameters.PrimitiveRestartIndex == index) return;
|
||||
m_parameters.PrimitiveRestartIndex = index;
|
||||
++m_version;
|
||||
}
|
||||
|
||||
Uint32 RenderState::GetPrimitiveRestartIndex() const {
|
||||
return m_parameters.PrimitiveRestartIndex;
|
||||
}
|
||||
|
||||
void RenderState::SetPointSize(Float size) {
|
||||
if (m_parameters.PointSize == size) return;
|
||||
|
||||
|
||||
@@ -269,6 +269,10 @@ namespace MobileGL {
|
||||
GLenum PolygonModeFront = GL_FILL;
|
||||
GLenum PolygonModeBack = GL_FILL;
|
||||
|
||||
// Primitive restart index (glPrimitiveRestartIndex); consumed when GL_PRIMITIVE_RESTART is
|
||||
// enabled during an indexed draw. Default 0.
|
||||
Uint32 PrimitiveRestartIndex = 0;
|
||||
|
||||
// Scissor
|
||||
Bool ColorLogicOpEnabled = false;
|
||||
Bool DebugOutputEnabled = false;
|
||||
@@ -326,6 +330,8 @@ namespace MobileGL {
|
||||
void SetPolygonMode(GLenum front, GLenum back);
|
||||
GLenum GetPolygonModeFront() const;
|
||||
GLenum GetPolygonModeBack() const;
|
||||
void SetPrimitiveRestartIndex(Uint32 index);
|
||||
Uint32 GetPrimitiveRestartIndex() const;
|
||||
|
||||
// Capabilities
|
||||
void SetCapability(CapabilityInput cap, Bool enabled);
|
||||
|
||||
Reference in New Issue
Block a user