+#include "arb_shader_objects.h"
#include "buffer.h"
#include "color.h"
#include "error.h"
-#include "extension.h"
#include "matrix.h"
#include "program.h"
#include "programdata.h"
buffer(0),
changes(NO_CHANGES)
{
- static RequireExtension _ext("GL_ARB_shader_objects");
+ static Require _req(ARB_shader_objects);
}
// Blocks are intentionally left uncopied
delete i->second;
for(BlockMap::iterator i=blocks.begin(); i!=blocks.end(); ++i)
delete i->second.block;
+ delete buffer;
}
void ProgramData::uniform(const string &name, Uniform *uni)
UniformMap::iterator i = uniforms.find(name);
if(i!=uniforms.end())
{
+ /* UniformBlock does not copy the uniforms, so existing blocks will be
+ left with stale pointers. This is not a problem as long as no one stores
+ pointers to the blocks and expects them to stay valid. */
delete i->second;
i->second = uni;
changes = VALUES_CHANGED;
{
UniformBlock *block = new UniformBlock(info.data_size);
if(!buffer)
+ {
buffer = new Buffer(UNIFORM_BUFFER);
+ buffer->set_usage(STREAM_DRAW);
+ }
block->use_buffer(buffer, last_block);
last_block = block;
return block;