mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-12-02 09:36:48 +01:00
fix(vulkan): a texture image that fails for another reason doesn't turn off host copy for its format
An image to be filled by the host which can't be made is tried again without the host transfer usage, and only when that one can be made is the format filled through staging buffers from then on. When it can't either (the memory ran out), the texture fails as before and the format keeps the host copy. The warning says the error logged before it was recovered from.
This commit is contained in:
@@ -106,8 +106,10 @@ struct job_ticket
|
||||
std::atomic<bool> 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<int>(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<int>(Format)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user