]> git.tdb.fi Git - libs/gl.git/blobdiff - source/programdata.cpp
Throw an exception if there's too many uniforms in a ProgramData
[libs/gl.git] / source / programdata.cpp
index 4a6c262a37a646bfd128f3cda4143ae5007e2a70..4d8ca4dd1adabc338967ab91bc2e817091d18a49 100644 (file)
@@ -109,15 +109,16 @@ void ProgramData::uniform(const string &name, Uniform *uni)
        if(i>=0)
        {
                uniforms[i].replace_value(uni);
-
-               if(static_cast<unsigned>(i)<MASK_BITS)
-                       dirty |= 1<<i;
-               else  // Force a full update if the mask isn't wide enough
-                       dirty = ALL_ONES;
-
+               dirty |= 1<<i;
                return;
        }
 
+       if(uniforms.size()>=MASK_BITS)
+       {
+               delete uni;
+               throw too_many_uniforms(name);
+       }
+
        vector<NamedUniform>::iterator j = lower_bound(uniforms.begin(), uniforms.end(), name, uniform_name_compare);
 
        NamedUniform nu;