mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-13 22:58:30 +09:00
[Feat] (MG_Impl/GLImpl, MG_State, MG_Backend): implement glColorMaski
Promote the color writemask to per-draw-buffer state and implement the indexed glColorMaski entry point (previously a stub), plus its read-back through glGetBooleani_v. - RenderState: replace the single BoolVec4 ColorMask with an array of MAX_DRAW_BUFFERS masks, all initialized to true. SetColorMask now broadcasts to every draw buffer (glColorMask semantics); GetColorMask returns draw buffer 0. Add indexed set/get accessors + GLContext wrappers. - glColorMaski sets only the addressed draw buffer; out-of-range index raises GL_INVALID_VALUE (buf is a GLuint, so no GL_INVALID_ENUM path), mirroring the indexed blend entry points' MAX_DRAW_BUFFERS bound. - glGetBooleani_v(GL_COLOR_WRITEMASK, i) reports draw buffer i's four booleans; the non-indexed glGetBooleanv still reports draw buffer 0. - Fix GLboolean coercion in the color-mask path: any nonzero value enables the component (was == GL_TRUE, which wrongly rejected e.g. 2). - DirectGLES sync reads ColorMasks[0] (GLES core has only non-indexed glColorMask). Tests: ColorMaskIndexedStoresAndReadsBack covers the per-buffer vs broadcast semantics, buffer-0 read-back, out-of-range INVALID_VALUE, and the GLboolean coercion (mutation-verified: == GL_TRUE fails it). Full SanityTest sweep green (30/30).
This commit is contained in:
@@ -493,6 +493,14 @@ namespace MobileGL::MG_State {
|
||||
return m_renderState.GetColorMask();
|
||||
}
|
||||
|
||||
void GLContext::SetColorMaskIndexed(Uint index, BoolVec4 mask) {
|
||||
m_renderState.SetColorMaskIndexed(index, mask);
|
||||
}
|
||||
|
||||
BoolVec4 GLContext::GetColorMaskIndexed(Uint index) const {
|
||||
return m_renderState.GetColorMaskIndexed(index);
|
||||
}
|
||||
|
||||
void GLContext::SetClearColor(FloatVec4 color) {
|
||||
m_renderState.SetClearColor(color);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user