mirror of
https://github.com/love2d/love.git
synced 2026-08-17 19:23:38 +02:00
vulkan: clean up texture creation flags
This commit is contained in:
@@ -48,11 +48,11 @@ bool Texture::loadVolatile()
|
|||||||
allocator = vgfx->getVmaAllocator();
|
allocator = vgfx->getVmaAllocator();
|
||||||
device = vgfx->getDevice();
|
device = vgfx->getDevice();
|
||||||
|
|
||||||
if (isPixelFormatDepthStencil(format))
|
if (isPixelFormatDepth(format))
|
||||||
imageAspect |= VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT;
|
|
||||||
else if (isPixelFormatDepth(format))
|
|
||||||
imageAspect |= VK_IMAGE_ASPECT_DEPTH_BIT;
|
imageAspect |= VK_IMAGE_ASPECT_DEPTH_BIT;
|
||||||
else
|
if (isPixelFormatStencil(format))
|
||||||
|
imageAspect |= VK_IMAGE_ASPECT_STENCIL_BIT;
|
||||||
|
if (isPixelFormatColor(format))
|
||||||
imageAspect |= VK_IMAGE_ASPECT_COLOR_BIT;
|
imageAspect |= VK_IMAGE_ASPECT_COLOR_BIT;
|
||||||
|
|
||||||
auto vulkanFormat = Vulkan::getTextureFormat(format, sRGB);
|
auto vulkanFormat = Vulkan::getTextureFormat(format, sRGB);
|
||||||
@@ -62,13 +62,10 @@ bool Texture::loadVolatile()
|
|||||||
VK_IMAGE_USAGE_TRANSFER_DST_BIT;
|
VK_IMAGE_USAGE_TRANSFER_DST_BIT;
|
||||||
|
|
||||||
if (readable)
|
if (readable)
|
||||||
{
|
usageFlags |= VK_IMAGE_USAGE_SAMPLED_BIT;
|
||||||
if (!isPixelFormatDepthStencil(format))
|
|
||||||
usageFlags |= VK_IMAGE_USAGE_SAMPLED_BIT;
|
|
||||||
|
|
||||||
if (!isPixelFormatCompressed(format) && !isPixelFormatDepthStencil(format))
|
if (computeWrite)
|
||||||
usageFlags |= VK_IMAGE_USAGE_STORAGE_BIT;
|
usageFlags |= VK_IMAGE_USAGE_STORAGE_BIT;
|
||||||
}
|
|
||||||
|
|
||||||
if (renderTarget)
|
if (renderTarget)
|
||||||
{
|
{
|
||||||
@@ -133,6 +130,7 @@ bool Texture::loadVolatile()
|
|||||||
bool hasdata = slices.get(0, 0) != nullptr;
|
bool hasdata = slices.get(0, 0) != nullptr;
|
||||||
|
|
||||||
if (hasdata)
|
if (hasdata)
|
||||||
|
{
|
||||||
for (int mip = 0; mip < getMipmapCount(); mip++)
|
for (int mip = 0; mip < getMipmapCount(); mip++)
|
||||||
{
|
{
|
||||||
int sliceCount;
|
int sliceCount;
|
||||||
@@ -148,6 +146,7 @@ bool Texture::loadVolatile()
|
|||||||
uploadImageData(id, mip, slice, 0, 0);
|
uploadImageData(id, mip, slice, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
clear();
|
clear();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user