[Feat] (MG_State, MG_Impl, DirectGLES): implement glPatchParameteri

GL_PATCH_VERTICES decides how many vertices one tessellation patch consumes, and
glPatchParameteri was a stub - so the value stayed at the driver's default of 3 no
matter what the application asked for. KHR-GL40.texture_gather.gather-tesselation-shader
sets it to 1 and then draws a single patch: with the request dropped the draw had too
few vertices for one patch, produced nothing at all, and the case read back the clear
colour.

The value is context state on both sides and ES 3.2 spells the entry point exactly the
same way, so it is stored in the render state (where glGetIntegerv(GL_PATCH_VERTICES)
now finds it) and forwarded. Validation needs the real bound, so GL_MAX_PATCH_VERTICES
and GL_MAX_TESS_GEN_LEVEL are probed off the host driver alongside the other limits and
answered from there too; the defaults are the GL 4.0 core minimums.

KHR-GL40.texture_gather is now 75/75.
This commit is contained in:
BZLZHH
2026-08-04 10:58:14 -04:00
parent 5fce287de5
commit b95fcb7bca
14 changed files with 82 additions and 1 deletions
@@ -1034,6 +1034,7 @@ namespace MobileGL::MG_Backend::DirectGLES {
// Transform feedback is captured by the real ES driver rather than
// reconstructed from the draw recording, so the frontend has to hand the
// span boundaries over.
funcsTable.GL.PatchParameteri = DirectGLES::PatchParameteri;
funcsTable.GL.BeginTransformFeedback = XfbImpl::BeginTransformFeedback;
funcsTable.GL.EndTransformFeedback = XfbImpl::EndTransformFeedback;
funcsTable.GL.PauseTransformFeedback = XfbImpl::PauseTransformFeedback;
@@ -1080,6 +1081,8 @@ namespace MobileGL::MG_Backend::DirectGLES {
m_dynamicParameters.MaxIntegerSamples = m_GLESCapabilities.MaxIntegerSamples;
m_dynamicParameters.MaxSamples = m_GLESCapabilities.MaxSamples;
m_dynamicParameters.MaxSampleMaskWords = m_GLESCapabilities.MaxSampleMaskWords;
m_dynamicParameters.MaxPatchVertices = m_GLESCapabilities.MaxPatchVertices;
m_dynamicParameters.MaxTessGenLevel = m_GLESCapabilities.MaxTessGenLevel;
m_dynamicParameters.MinProgramTextureGatherOffset = m_GLESCapabilities.MinProgramTextureGatherOffset;
m_dynamicParameters.MaxProgramTextureGatherOffset = m_GLESCapabilities.MaxProgramTextureGatherOffset;
// Clamp the advertised sampler limits the same way the DirectVulkan backend does: per-stage