const PipelineState &self = *static_cast<const PipelineState *>(this);
for(const PipelineState::BoundResource &r: self.resources)
- if(r.type==PipelineState::STORAGE_TEXTURE)
- r.texture->change_layout(-1, VK_IMAGE_LAYOUT_GENERAL, false);
+ if(r.used)
+ {
+ if(r.type==PipelineState::STORAGE_TEXTURE)
+ r.texture->change_layout(-1, VK_IMAGE_LAYOUT_GENERAL, false);
+ else if(r.type==PipelineState::SAMPLED_TEXTURE)
+ r.texture->change_layout(-1, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, false);
+ }
}
void VulkanPipelineState::apply(const VulkanCommandRecorder &vkCmd, const VulkanPipelineState *last, unsigned frame, bool negative_viewport) const