[Fix] (Getter): answer the GL 4.6 limit surface honestly - tess/cull/subroutine pnames, TBuiltInResource drift, 84 UBO binding points, 64-bit GL_MAX_ELEMENT_INDEX, per-category sample truth

This commit is contained in:
2026-08-27 03:47:16 -04:00
parent 07669aacd4
commit 7168f2ef77
24 changed files with 905 additions and 120 deletions
@@ -19,7 +19,14 @@ namespace MobileGL::MG_State::GLState {
BufferTarget::DrawIndirect, BufferTarget::Parameter, BufferTarget::ShaderStorage);
constexpr const auto BufferBindPointTargets = ToArray(BufferTarget::Uniform, BufferTarget::TransformFeedback,
BufferTarget::AtomicCounter, BufferTarget::ShaderStorage);
constexpr SizeT BufferBindingPointCount = 36;
// How many indexed binding points each of BufferBindPointTargets gets. 84 is the GL 4.5 core
// minimum for GL_MAX_UNIFORM_BUFFER_BINDINGS (table 23.64) and this array is the capacity
// that limit is clamped against - at 36 the clamp in GL_Getter was degenerate (lo == hi) and
// no application could ever be told about, or bind to, a binding point past the 36th. The
// other three targets advertise their own, smaller ceilings out of
// GetIndexedBufferQueryPointCount, so widening this does not widen what they promise; it only
// costs the unused tail of three arrays.
constexpr SizeT BufferBindingPointCount = 84;
class BufferState {
public:
@@ -29,13 +29,11 @@ namespace {
// capacity, which is also the width of the Uint32 masks backends build from it.
static MobileGL::Int GetReflectionVertexAttribLimit(
const MobileGL::MG_Util::ShaderTranspiler::CompileEnv& env) {
constexpr MobileGL::Int capacity =
static_cast<MobileGL::Int>(MobileGL::MG_State::GLState::VertexArrayObject::MAX_VERTEX_ATTRIBS);
if (!env.HasBackend()) return capacity;
const MobileGL::Int backendLimit = env.params.MaxVertexAttribs;
if (backendLimit <= 0) return capacity;
return std::min(backendLimit, capacity);
// One shared definition with glGetIntegerv(GL_MAX_VERTEX_ATTRIBS) and with
// BuildTBuiltInResource's gl_MaxVertexAttribs - the three used to carry three copies of
// this formula and glslang's copy was a hardcoded 64.
return MobileGL::MG_Util::ShaderTranspiler::ResolveMaxVertexAttribs(env.HasBackend(),
env.params.MaxVertexAttribs);
}
// Everything the post-link query surface ever asks a glslang::TType, flattened into a