for(const PipelineState::BoundUniformBlock &u: self.uniform_blocks)
if(u.changed || changed_sets==~0U)
{
- u.used = self.shprog->uses_binding(u.binding);
+ u.used = self.shprog->uses_uniform_block_binding(u.binding);
if(u.binding>=0)
changed_sets |= 1<<(u.binding>>20);
u.changed = false;
for(const PipelineState::BoundTexture &t: self.textures)
if(t.changed || changed_sets==~0U)
{
- t.used = self.shprog->uses_binding(t.binding);
+ t.used = self.shprog->uses_texture_binding(t.binding);
changed_sets |= 1<<(t.binding>>20);
if(t.sampler)
t.sampler->refresh();
int get_uniform_location(const std::string &) const;
int get_uniform_location(Tag) const;
int get_uniform_binding(Tag) const;
+ bool uses_uniform_block_binding(int b) const { return uses_binding(b|ReflectData::UNIFORM_BLOCK_BINDING); }
+ bool uses_texture_binding(unsigned b) const { return uses_binding(b|ReflectData::TEXTURE_BINDING); }
+private:
bool uses_binding(int) const;
+public:
const std::vector<ReflectData::AttributeInfo> &get_attributes() const { return reflect_data.attributes; }
const ReflectData::AttributeInfo &get_attribute_info(const std::string &) const;
int get_attribute_location(const std::string &) const;
void ReflectData::update_used_bindings()
{
for(const UniformInfo &u: uniforms)
- if(u.binding>=0)
- used_bindings.push_back(u.binding);
+ if(u.binding>=0 && is_image(u.type))
+ used_bindings.push_back(u.binding|TEXTURE_BINDING);
for(const UniformBlockInfo &b: uniform_blocks)
- used_bindings.push_back(b.bind_point);
+ used_bindings.push_back(b.bind_point|UNIFORM_BLOCK_BINDING);
sort(used_bindings);
}
enum
{
DEFAULT_BLOCK = -1,
- PUSH_CONSTANT = -2
+ PUSH_CONSTANT = -2,
+ UNIFORM_BLOCK_BINDING = 0,
+ TEXTURE_BINDING = 0x1000000
};
typedef unsigned LayoutHash;