]> git.tdb.fi Git - libs/gl.git/blobdiff - source/backends/vulkan/pipelinestate_backend.cpp
Synchronize sampled images in addition to storage images
[libs/gl.git] / source / backends / vulkan / pipelinestate_backend.cpp
index 5d1139b8762ad8bee543f6aebe2039fce890282a..d8e4d4a1978504373e5614aad6e59555d358e955 100644 (file)
@@ -460,8 +460,13 @@ void VulkanPipelineState::synchronize_resources() const
        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