diff --git a/rendering/vulkan14/vulkan14texture.cpp b/rendering/vulkan14/vulkan14texture.cpp index 7b395a09f..df85f9a3e 100644 --- a/rendering/vulkan14/vulkan14texture.cpp +++ b/rendering/vulkan14/vulkan14texture.cpp @@ -106,8 +106,10 @@ struct job_ticket std::atomic taken{false}; }; -// the image of a texture. one to be filled by the host (HostCopy) which the driver can't make after all is made to be filled through -// a staging buffer, HostCopy cleared, and so are the next ones of its format +// the image of a texture. one to be filled by the host (HostCopy) which can't be made is tried again to be filled through a staging +// buffer, HostCopy cleared. only when that one can be made is it the host transfer the driver can't do, and the next images of the +// format are filled through staging buffers too; when it can't either, it's something else (the memory ran out) and the format keeps +// the host copy bool createTextureImage(image &Target, allocator const &Memory, uploader &Uploads, image_desc &Desc, std::string const &Name, bool &HostCopy) { if (Target.create(Memory, Desc, Name)) @@ -118,10 +120,14 @@ bool createTextureImage(image &Target, allocator const &Memory, uploader &Upload { return false; } - Uploads.RefuseHostCopy(Desc.format); - HostCopy = false; Desc.usage &= ~VkImageUsageFlags{VK_IMAGE_USAGE_HOST_TRANSFER_BIT}; - return Target.create(Memory, Desc, Name); + if (false == Target.create(Memory, Desc, Name)) + { + return false; + } + HostCopy = false; + Uploads.RefuseHostCopy(Desc.format); + return true; } } // namespace @@ -190,7 +196,7 @@ void uploader::RefuseHostCopy(VkFormat Format) } if (refused) { - log_warning(std::format("the textures of format {} are filled through staging buffers: the driver can't make their images to be filled by the host, although it says it can", static_cast(Format))); + log_warning(std::format("the textures of format {} are filled through staging buffers: the driver can't make their images to be filled by the host, although it says it can (the error above, recovered from)", static_cast(Format))); } } diff --git a/rendering/vulkan14/vulkan14texture.h b/rendering/vulkan14/vulkan14texture.h index 3f4aeeab8..ec1144ce1 100644 --- a/rendering/vulkan14/vulkan14texture.h +++ b/rendering/vulkan14/vulkan14texture.h @@ -96,8 +96,8 @@ class uploader // whether an image of the format, of Extent and Mips levels is: the format allows it, the device has memory of its own for such // images (asked once a format) and the image is within the limits of the format for that use bool can_host_copy(VkFormat Format, VkExtent3D const &Extent, std::uint32_t Mips) const; - // an image of the format which can_host_copy() allowed couldn't be made: the images of the format are filled through staging - // buffers from now on + // an image of the format which can_host_copy() allowed couldn't be made, and the same one without the host transfer could: the + // images of the format are filled through staging buffers from now on void RefuseHostCopy(VkFormat Format); private: