Pass image usage flags to texture loader (2D image)

This commit is contained in:
saschawillems 2016-03-16 20:27:33 +01:00
parent 76d41fcd6d
commit 62717ea021

View file

@ -60,6 +60,12 @@ namespace vkTools
// Load a 2D texture
void loadTexture(const char* filename, VkFormat format, VulkanTexture *texture, bool forceLinear)
{
loadTexture(filename, format, texture, false, VK_IMAGE_USAGE_SAMPLED_BIT);
}
// Load a 2D texture
void loadTexture(const char* filename, VkFormat format, VulkanTexture *texture, bool forceLinear, VkImageUsageFlags imageUsageFlags)
{
gli::texture2D tex2D(gli::load(filename));
assert(!tex2D.empty());
@ -155,7 +161,7 @@ namespace vkTools
// Setup texture as blit target with optimal tiling
imageCreateInfo.tiling = VK_IMAGE_TILING_OPTIMAL;
imageCreateInfo.usage = VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_SAMPLED_BIT;
imageCreateInfo.usage = VK_IMAGE_USAGE_TRANSFER_DST_BIT | imageUsageFlags;
imageCreateInfo.mipLevels = texture->mipLevels;
imageCreateInfo.extent = { texture->width, texture->height, 1 };