st/mesa: Zero MaxTextureImageUnits for unsupported stages

Mesa core pre-seeds VS/TCS/TES/GS/FS in _mesa_init_constants(..) with
MAX_TEXTURE_IMAGE_UNITS. When a driver does not expose a stage, this
seed leaks into the GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS sum. Drivers
that only expose VS+FS (like etnaviv) overcounted by 96. Zero the
field so the sum reflects only the stages the driver advertises.

Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Marek Olšák <maraeo@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41746>
This commit is contained in:
Christian Gmeiner 2026-05-22 09:53:11 +02:00 committed by Marge Bot
parent 165a0105d3
commit adad1a7318

View file

@ -206,8 +206,10 @@ void st_init_limits(struct pipe_screen *screen,
for (sh = 0; sh < MESA_SHADER_MESH_STAGES; ++sh) {
struct gl_program_constants *pc = &c->Program[sh];
if (!screen->shader_caps[sh].max_instructions)
if (!screen->shader_caps[sh].max_instructions) {
pc->MaxTextureImageUnits = 0;
continue;
}
pc->MaxTextureImageUnits =
_min(screen->shader_caps[sh].max_texture_samplers,