I'd rather find out I need to make the mask wider than have a program
unexplainably slow down.
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;
#define MSP_GL_PROGRAMDATA_H_
#include <map>
+#include <stdexcept>
#include <msp/datafile/objectloader.h>
#include "datatype.h"
#include "matrix.h"
namespace Msp {
namespace GL {
+class too_many_uniforms: public std::runtime_error
+{
+public:
+ too_many_uniforms(const std::string &w): std::runtime_error(w) { }
+ virtual ~too_many_uniforms() throw() { }
+};
+
class Buffer;
class Uniform;
class UniformBlock;