X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fbackends%2Fvulkan%2Fpipelinestate_backend.cpp;h=d8e4d4a1978504373e5614aad6e59555d358e955;hp=5d1139b8762ad8bee543f6aebe2039fce890282a;hb=4369f481b06d28056deceecbfcb69550a65c92dc;hpb=24b76abad71996cb241b56ded239335fd26273cc diff --git a/source/backends/vulkan/pipelinestate_backend.cpp b/source/backends/vulkan/pipelinestate_backend.cpp index 5d1139b8..d8e4d4a1 100644 --- a/source/backends/vulkan/pipelinestate_backend.cpp +++ b/source/backends/vulkan/pipelinestate_backend.cpp @@ -460,8 +460,13 @@ void VulkanPipelineState::synchronize_resources() const const PipelineState &self = *static_cast(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