Update VulkanTexture constructor for TextureUsage.
This commit is contained in:
committed by
Mathias Agopian
parent
8298520f0a
commit
16088760c8
@@ -410,15 +410,12 @@ VulkanTexture::VulkanTexture(VulkanContext& context, SamplerType target, uint8_t
|
||||
imageInfo.usage |= VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT;
|
||||
}
|
||||
if (usage & TextureUsage::UPLOADABLE) {
|
||||
imageInfo.usage |= VK_IMAGE_USAGE_TRANSFER_DST_BIT;
|
||||
// Uploadable textures can be used as a blit source (e.g. for mipmap generation)
|
||||
// therefore we must set both the TRANSFER_DST and TRANSFER_SRC flags.
|
||||
imageInfo.usage |= VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT;
|
||||
}
|
||||
if (usage & TextureUsage::DEPTH_ATTACHMENT) {
|
||||
imageInfo.usage |= VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT;
|
||||
} else {
|
||||
// If it's a not an FBO target or a depth attachment, then it's safe to assume that it will
|
||||
// need to be uploaded or blitted to, so we should set USAGE_TRANSFER_DST. Also, since we
|
||||
// need to support GenerateMipmaps, it can be a blit source; ergo we set USAGE_TRANSFER_SRC.
|
||||
imageInfo.usage |= VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT;
|
||||
}
|
||||
|
||||
VkResult error = vkCreateImage(context.device, &imageInfo, VKALLOC, &textureImage);
|
||||
|
||||
Reference in New Issue
Block a user