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 dd4990ba023605be51100f21c4feffcab2396237..f9a5ecef96cbdf2ab369c237f62c9e3345c3281f 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 */