From fe36154ff3b2c095cf21462dd7ed6b5ae374fccc Mon Sep 17 00:00:00 2001 From: Paul Berry Date: Wed, 23 Oct 2013 13:36:25 -0700 Subject: [PATCH] i965: Fix gl_MaxCombinedTextureImageUnits. We've always overriden ctx->Const.{Vertex,Fragment}Program.MaxTextureImageUnits to reflect the number of texture image units supported by the hardware (rather than using the default values assigned by Mesa core) so it seems sensible to do that for GeometryProgram.MaxTextureImageUnits too. We set it to 0 if geometry shaders aren't supported. Once that is done, we can just unconditionally add GeometryProgram.MaxTextureImageUnits to MaxCombinedTextureImageUnits. Fixes piglit test "spec/glsl-1.50/built-in constants/gl_MaxCombinedTextureImageUnits". Reviewed-by: Kenneth Graunke Reviewed-by: Ian Romanick Reviewed-by: Matt Turner --- src/mesa/drivers/dri/i965/brw_context.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index cb82fb042ef..44fcfa9cad6 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -279,9 +279,14 @@ brw_initialize_context_constants(struct brw_context *brw) MIN2(ctx->Const.MaxTextureCoordUnits, ctx->Const.FragmentProgram.MaxTextureImageUnits); ctx->Const.VertexProgram.MaxTextureImageUnits = BRW_MAX_TEX_UNIT; + if (brw->gen >= 7) + ctx->Const.GeometryProgram.MaxTextureImageUnits = BRW_MAX_TEX_UNIT; + else + ctx->Const.GeometryProgram.MaxTextureImageUnits = 0; ctx->Const.MaxCombinedTextureImageUnits = ctx->Const.VertexProgram.MaxTextureImageUnits + - ctx->Const.FragmentProgram.MaxTextureImageUnits; + ctx->Const.FragmentProgram.MaxTextureImageUnits + + ctx->Const.GeometryProgram.MaxTextureImageUnits; ctx->Const.MaxTextureLevels = 14; /* 8192 */ if (ctx->Const.MaxTextureLevels > MAX_TEXTURE_LEVELS) -- 2.30.2