i965: Fix gl_MaxCombinedTextureImageUnits.
authorPaul Berry <stereotype441@gmail.com>
Wed, 23 Oct 2013 20:36:25 +0000 (13:36 -0700)
committerPaul Berry <stereotype441@gmail.com>
Fri, 25 Oct 2013 04:14:26 +0000 (21:14 -0700)
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 <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
src/mesa/drivers/dri/i965/brw_context.c

index cb82fb042ef39411f99c9097b4f278c25997fbd0..44fcfa9cad6f48cc7ee25fe77b1d08265a934157 100644 (file)
@@ -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)