ProgramData may recreate the buffer when creating new blocks, but existing
block objects will be retained. As such, the block object alone isn't
enough to determine whether the binding has changed.
- glBindBufferRange(GL_UNIFORM_BUFFER, u.binding, u.block->get_buffer()->id, u.block->get_offset(), u.block->get_data_size());
+ glBindBufferRange(GL_UNIFORM_BUFFER, u.binding, u.buffer->id, u.block->get_offset(), u.block->get_data_size());
dev_state.bound_uniform_blocks[u.binding] = 1;
}
else if(u.binding==ReflectData::DEFAULT_BLOCK && self.shprog)
dev_state.bound_uniform_blocks[u.binding] = 1;
}
else if(u.binding==ReflectData::DEFAULT_BLOCK && self.shprog)
{
result = hash_update<64>(result, b.binding);
result = hash_update<64>(result, reinterpret_cast<uintptr_t>(b.block));
{
result = hash_update<64>(result, b.binding);
result = hash_update<64>(result, reinterpret_cast<uintptr_t>(b.block));
+ result = hash_update<64>(result, reinterpret_cast<uintptr_t>(b.buffer));
}
for(const PipelineState::BoundTexture &t: self.textures)
if(t.used && (t.binding>>20)==index)
}
for(const PipelineState::BoundTexture &t: self.textures)
if(t.used && (t.binding>>20)==index)
for(const PipelineState::BoundUniformBlock &u: self.uniform_blocks)
if(u.used && u.binding>=0 && static_cast<unsigned>(u.binding>>20)==index)
{
for(const PipelineState::BoundUniformBlock &u: self.uniform_blocks)
if(u.used && u.binding>=0 && static_cast<unsigned>(u.binding>>20)==index)
{
- buffer_ptr->buffer = handle_cast<::VkBuffer>(u.block->get_buffer()->handle);
+ buffer_ptr->buffer = handle_cast<::VkBuffer>(u.buffer->handle);
buffer_ptr->offset = u.block->get_offset();
buffer_ptr->range = u.block->get_data_size();
buffer_ptr->offset = u.block->get_offset();
buffer_ptr->range = u.block->get_data_size();
#include <msp/core/algorithm.h>
#include "error.h"
#include "pipelinestate.h"
#include <msp/core/algorithm.h>
#include "error.h"
#include "pipelinestate.h"
+#include "uniformblock.h"
if(i==uniform_blocks.end() || i->binding!=binding)
i = uniform_blocks.insert(i, BoundUniformBlock(binding));
i->used = block;
if(i==uniform_blocks.end() || i->binding!=binding)
i = uniform_blocks.insert(i, BoundUniformBlock(binding));
i->used = block;
- if(block!=i->block || binding<0)
+ const Buffer *buffer = (block ? block->get_buffer() : 0);
+ if(block!=i->block || buffer!=i->buffer || binding<0)
i->changed = true;
changes |= UNIFORMS;
}
i->changed = true;
changes |= UNIFORMS;
}
namespace GL {
class Blend;
namespace GL {
class Blend;
class DepthTest;
class Framebuffer;
class Program;
class DepthTest;
class Framebuffer;
class Program;
mutable bool changed = false;
mutable bool used = false;
const UniformBlock *block = 0;
mutable bool changed = false;
mutable bool used = false;
const UniformBlock *block = 0;
+ const Buffer *buffer = 0;
BoundUniformBlock(int b): binding(b) { }
};
BoundUniformBlock(int b): binding(b) { }
};