generate a link error if the vertex shader references too many textures
authorBrian Paul <brian.paul@tungstengraphics.com>
Wed, 2 Jul 2008 15:16:10 +0000 (09:16 -0600)
committerBrian Paul <brian.paul@tungstengraphics.com>
Wed, 2 Jul 2008 15:16:10 +0000 (09:16 -0600)
src/mesa/shader/slang/slang_link.c

index dd4990b..f9a5ece 100644 (file)
@@ -474,6 +474,12 @@ _slang_link(GLcontext *ctx,
       }         
    }
 
+   /* Check that the vertex program doesn't use too many sampler units */
+   if (shProg->VertexProgram &&
+       _mesa_bitcount(shProg->VertexProgram->Base.SamplersUsed) > ctx->Const.MaxVertexTextureImageUnits) {
+      link_error(shProg, "Vertex program uses too many samplers.\n");
+      return;
+   }
 
    if (fragProg && shProg->FragmentProgram) {
       /* notify driver that a new fragment program has been compiled/linked */