const PipelineState &self = *static_cast<const PipelineState *>(this);
uint64_t result = hash<64>(0, 0);
+ bool empty = true;
auto i = lower_bound_member(self.uniform_blocks, static_cast<int>(index)<<20, &PipelineState::BoundUniformBlock::binding);
for(; (i!=self.uniform_blocks.end() && static_cast<unsigned>(i->binding)>>20==index); ++i)
result = hash_update<64>(result, i->binding);
result = hash_update<64>(result, reinterpret_cast<uintptr_t>(i->block));
result = hash_update<64>(result, reinterpret_cast<uintptr_t>(i->buffer->handle));
+ empty = false;
}
auto j = lower_bound_member(self.textures, index<<20, &PipelineState::BoundTexture::binding);
result = hash_update<64>(result, reinterpret_cast<uintptr_t>(j->texture->handle));
result = hash_update<64>(result, reinterpret_cast<uintptr_t>(j->sampler->handle));
result = hash_update<64>(result, j->level);
+ empty = false;
}
+ if(!empty)
+ result = hash_update<64>(result, self.shprog->stage_flags);
+
return result;
}
{
const PipelineState &last_ps = *static_cast<const PipelineState *>(last);
if(handle!=last->handle)
+ {
unapplied |= PipelineState::SHPROG;
+ if(self.shprog->stage_flags!=last_ps.shprog->stage_flags)
+ {
+ unapplied |= PipelineState::UNIFORMS;
+ first_changed_desc_set = 0;
+ }
+ }
if(self.vertex_setup!=last_ps.vertex_setup)
unapplied |= PipelineState::VERTEX_SETUP;
for(unsigned i=0; i<descriptor_set_slots.size(); ++i)
binding.binding = b.bind_point&0xFFFFF;
binding.descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER;
binding.descriptorCount = 1;
- binding.stageFlags = VK_SHADER_STAGE_ALL;
+ binding.stageFlags = stage_flags;
binding.pImmutableSamplers = 0;
}
binding.binding = u.binding&0xFFFFF;
binding.descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER;
binding.descriptorCount = 1;
- binding.stageFlags = VK_SHADER_STAGE_ALL;
+ binding.stageFlags = stage_flags;
binding.pImmutableSamplers = 0;
}