forked from MoonsideGames/Refresh
vulkan: Fix 3D texture creation (#35)
The image type getting passed to imageCreateInfo was always VK_IMAGE_TYPE_2D, even for 3D textures. This fixes that bug, allowing Vulkan to successfully create 3D textures. Co-authored-by: Caleb Cornett <caleb.cornett@outlook.com> Reviewed-on: MoonsideGames/Refresh#35 Co-authored-by: TheSpydog <thespydog@noreply.example.org> Co-committed-by: TheSpydog <thespydog@noreply.example.org>samplecount
parent
05900bee14
commit
e3ab5fadf8
|
@ -5221,7 +5221,6 @@ static VulkanTexture* VULKAN_INTERNAL_CreateTexture(
|
||||||
uint32_t levelCount,
|
uint32_t levelCount,
|
||||||
VkFormat format,
|
VkFormat format,
|
||||||
VkImageAspectFlags aspectMask,
|
VkImageAspectFlags aspectMask,
|
||||||
VkImageType imageType,
|
|
||||||
VkImageUsageFlags imageUsageFlags
|
VkImageUsageFlags imageUsageFlags
|
||||||
) {
|
) {
|
||||||
VkResult vulkanResult;
|
VkResult vulkanResult;
|
||||||
|
@ -5255,7 +5254,7 @@ static VulkanTexture* VULKAN_INTERNAL_CreateTexture(
|
||||||
imageCreateInfo.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO;
|
imageCreateInfo.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO;
|
||||||
imageCreateInfo.pNext = NULL;
|
imageCreateInfo.pNext = NULL;
|
||||||
imageCreateInfo.flags = imageCreateFlags;
|
imageCreateInfo.flags = imageCreateFlags;
|
||||||
imageCreateInfo.imageType = imageType;
|
imageCreateInfo.imageType = is3D ? VK_IMAGE_TYPE_3D : VK_IMAGE_TYPE_2D;
|
||||||
imageCreateInfo.format = format;
|
imageCreateInfo.format = format;
|
||||||
imageCreateInfo.extent.width = width;
|
imageCreateInfo.extent.width = width;
|
||||||
imageCreateInfo.extent.height = height;
|
imageCreateInfo.extent.height = height;
|
||||||
|
@ -5360,17 +5359,13 @@ static VulkanTexture* VULKAN_INTERNAL_CreateTexture(
|
||||||
{
|
{
|
||||||
imageViewCreateInfo.viewType = VK_IMAGE_VIEW_TYPE_CUBE;
|
imageViewCreateInfo.viewType = VK_IMAGE_VIEW_TYPE_CUBE;
|
||||||
}
|
}
|
||||||
else if (imageType == VK_IMAGE_TYPE_2D)
|
else if (is3D)
|
||||||
{
|
|
||||||
imageViewCreateInfo.viewType = VK_IMAGE_VIEW_TYPE_2D;
|
|
||||||
}
|
|
||||||
else if (imageType == VK_IMAGE_TYPE_3D)
|
|
||||||
{
|
{
|
||||||
imageViewCreateInfo.viewType = VK_IMAGE_VIEW_TYPE_3D;
|
imageViewCreateInfo.viewType = VK_IMAGE_VIEW_TYPE_3D;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Refresh_LogError("invalid image type: %u", imageType);
|
imageViewCreateInfo.viewType = VK_IMAGE_VIEW_TYPE_2D;
|
||||||
}
|
}
|
||||||
|
|
||||||
vulkanResult = renderer->vkCreateImageView(
|
vulkanResult = renderer->vkCreateImageView(
|
||||||
|
@ -5454,7 +5449,6 @@ static VulkanRenderTarget* VULKAN_INTERNAL_CreateRenderTarget(
|
||||||
1,
|
1,
|
||||||
vulkanTexture->format,
|
vulkanTexture->format,
|
||||||
aspectFlags,
|
aspectFlags,
|
||||||
VK_IMAGE_TYPE_2D,
|
|
||||||
VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT
|
VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -6661,7 +6655,6 @@ static Refresh_Texture* VULKAN_CreateTexture(
|
||||||
textureCreateInfo->levelCount,
|
textureCreateInfo->levelCount,
|
||||||
format,
|
format,
|
||||||
imageAspectFlags,
|
imageAspectFlags,
|
||||||
VK_IMAGE_TYPE_2D,
|
|
||||||
imageUsageFlags
|
imageUsageFlags
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue