]> git.tdb.fi Git - libs/gl.git/blobdiff - source/programdata.cpp
Add integer overload of ProgramData::uniform1_array
[libs/gl.git] / source / programdata.cpp
index 65e660f038949aa41353eb287382901a28918f25..f75a4ebda945cbadd62de17f2c6c214eca121d0c 100644 (file)
@@ -177,6 +177,11 @@ void ProgramData::uniform_matrix4(const string &name, const float *v)
        uniform(name, new UniformMatrix4x4f(v));
 }
 
+void ProgramData::uniform1_array(const string &name, unsigned n, const int *v)
+{
+       uniform(name, new UniformArray<Uniform1i>(n, v));
+}
+
 void ProgramData::uniform1_array(const string &name, unsigned n, const float *v)
 {
        uniform(name, new UniformArray<Uniform1f>(n, v));
@@ -265,14 +270,15 @@ void ProgramData::apply() const
        Program::LayoutHash layout = prog->get_uniform_layout_hash();
        ProgramUniforms &pu = programs[layout];
 
-       if((dirty&pu.used)|pu.dirty)
+       Mask force_dirty = (dirty==ALL_ONES ? ALL_ONES : 0U);
+       Mask affected = (dirty&pu.used) | force_dirty;
+       if(affected|pu.dirty)
        {
                /* If the global dirty flag affects this program, add it to per-program
                dirty flags and clear the global flag.  A previously unseen program will
                always cause this to happen. */
-               if(dirty&pu.used)
+               if(affected)
                {
-                       Mask force_dirty = (dirty==ALL_ONES ? ALL_ONES : 0U);
                        for(BlockMap::iterator i=blocks.begin(); i!=blocks.end(); ++i)
                                i->second.dirty |= (dirty&i->second.used) | force_dirty;
                        for(ProgramMap::iterator i=programs.begin(); i!=programs.end(); ++i)