mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-11 05:38:31 +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:
@@ -860,7 +860,7 @@ DECLARE_GL_FUNCTION_HEAD(void, VertexAttrib4sv, GLuint index, const GLshort* v)
|
||||
DECLARE_GL_FUNCTION_HEAD(void, VertexAttrib4ubv, GLuint index, const GLubyte* v) DECLARE_GL_FUNCTION_END_NO_RETURN(void, VertexAttrib4ubv, index, v)
|
||||
DECLARE_GL_FUNCTION_HEAD(void, VertexAttrib4uiv, GLuint index, const GLuint* v) DECLARE_GL_FUNCTION_END_NO_RETURN(void, VertexAttrib4uiv, index, v)
|
||||
DECLARE_GL_FUNCTION_HEAD(void, VertexAttrib4usv, GLuint index, const GLushort* v) DECLARE_GL_FUNCTION_END_NO_RETURN(void, VertexAttrib4usv, index, v)
|
||||
DECLARE_GL_FUNCTION_STUB_HEAD(void, PrimitiveRestartIndex, GLuint index) DECLARE_GL_FUNCTION_STUB_END_NO_RETURN(void, PrimitiveRestartIndex, index)
|
||||
DECLARE_GL_FUNCTION_HEAD(void, PrimitiveRestartIndex, GLuint index) DECLARE_GL_FUNCTION_END_NO_RETURN(void, PrimitiveRestartIndex, index)
|
||||
DECLARE_GL_FUNCTION_HEAD(void, GetActiveUniformName, GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei* length, GLchar* uniformName) DECLARE_GL_FUNCTION_END_NO_RETURN(void, GetActiveUniformName, program, uniformIndex, bufSize, length, uniformName)
|
||||
DECLARE_GL_FUNCTION_HEAD(void, MultiDrawElementsBaseVertex, GLenum mode, const GLsizei* count, GLenum type, const void* const* indices, GLsizei drawcount, const GLint* basevertex) DECLARE_GL_FUNCTION_END_NO_RETURN(void, MultiDrawElementsBaseVertex, mode, count, type, indices, drawcount, basevertex)
|
||||
DECLARE_GL_FUNCTION_HEAD(void, ProvokingVertex, GLenum mode) DECLARE_GL_FUNCTION_END_NO_RETURN(void, ProvokingVertex, mode)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -561,6 +561,11 @@ namespace MobileGL::MG_Impl::GLImpl {
|
||||
buf, BoolVec4(red != GL_FALSE, green != GL_FALSE, blue != GL_FALSE, alpha != GL_FALSE));
|
||||
}
|
||||
|
||||
void PrimitiveRestartIndex_State(GLuint index) {
|
||||
// glPrimitiveRestartIndex accepts any GLuint and generates no error.
|
||||
MG_State::pGLContext->SetPrimitiveRestartIndex(index);
|
||||
}
|
||||
|
||||
void ClampColor_State(GLenum target, GLenum clamp) {
|
||||
// GL 3.3 core: the only legal target is GL_CLAMP_READ_COLOR. The compatibility-only
|
||||
// GL_CLAMP_VERTEX_COLOR / GL_CLAMP_FRAGMENT_COLOR were removed from the core profile and
|
||||
@@ -924,6 +929,10 @@ namespace MobileGL::MG_Impl::GLImpl {
|
||||
ClampColor_State(target, clamp);
|
||||
}
|
||||
|
||||
void PrimitiveRestartIndex(GLuint index) {
|
||||
PrimitiveRestartIndex_State(index);
|
||||
}
|
||||
|
||||
void BlendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha) {
|
||||
BlendFuncSeparate_State(sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha);
|
||||
}
|
||||
|
||||
@@ -53,6 +53,7 @@ namespace MobileGL::MG_Impl::GLImpl {
|
||||
void ColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
|
||||
void ColorMaski(GLuint index, GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
|
||||
void ClampColor(GLenum target, GLenum clamp);
|
||||
void PrimitiveRestartIndex(GLuint index);
|
||||
void BlendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
|
||||
void BlendEquation(GLenum mode);
|
||||
void BlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha);
|
||||
|
||||
Reference in New Issue
Block a user