Pass image usage flags to texture loader (2D image)
This commit is contained in:
parent
76d41fcd6d
commit
62717ea021
1 changed files with 7 additions and 1 deletions
|
|
@ -60,6 +60,12 @@ namespace vkTools
|
||||||
|
|
||||||
// Load a 2D texture
|
// Load a 2D texture
|
||||||
void loadTexture(const char* filename, VkFormat format, VulkanTexture *texture, bool forceLinear)
|
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));
|
gli::texture2D tex2D(gli::load(filename));
|
||||||
assert(!tex2D.empty());
|
assert(!tex2D.empty());
|
||||||
|
|
@ -155,7 +161,7 @@ namespace vkTools
|
||||||
|
|
||||||
// Setup texture as blit target with optimal tiling
|
// Setup texture as blit target with optimal tiling
|
||||||
imageCreateInfo.tiling = VK_IMAGE_TILING_OPTIMAL;
|
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.mipLevels = texture->mipLevels;
|
||||||
imageCreateInfo.extent = { texture->width, texture->height, 1 };
|
imageCreateInfo.extent = { texture->width, texture->height, 1 };
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue