simplify VULKAN_INTERNAL_CreateTexture
parent
a39b49ee9b
commit
76217adc40
|
@ -5705,8 +5705,7 @@ static Refresh_ShaderModule* VULKAN_CreateShaderModule(
|
|||
return (Refresh_ShaderModule*) shaderModule;
|
||||
}
|
||||
|
||||
/* texture should be an alloc'd but uninitialized VulkanTexture */
|
||||
static uint8_t VULKAN_INTERNAL_CreateTexture(
|
||||
static VulkanTexture* VULKAN_INTERNAL_CreateTexture(
|
||||
VulkanRenderer *renderer,
|
||||
uint32_t width,
|
||||
uint32_t height,
|
||||
|
@ -5717,8 +5716,7 @@ static uint8_t VULKAN_INTERNAL_CreateTexture(
|
|||
VkFormat format,
|
||||
VkImageAspectFlags aspectMask,
|
||||
VkImageType imageType,
|
||||
VkImageUsageFlags imageUsageFlags,
|
||||
VulkanTexture *texture
|
||||
VkImageUsageFlags imageUsageFlags
|
||||
) {
|
||||
VkResult vulkanResult;
|
||||
VkImageCreateInfo imageCreateInfo;
|
||||
|
@ -5732,6 +5730,8 @@ static uint8_t VULKAN_INTERNAL_CreateTexture(
|
|||
((imageUsageFlags & VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT) != 0);
|
||||
VkComponentMapping swizzle = IDENTITY_SWIZZLE;
|
||||
|
||||
VulkanTexture *texture = SDL_malloc(sizeof(VulkanTexture));
|
||||
|
||||
texture->isCube = 0;
|
||||
texture->is3D = 0;
|
||||
|
||||
|
@ -5891,7 +5891,7 @@ static uint8_t VULKAN_INTERNAL_CreateTexture(
|
|||
texture->queueFamilyIndex = renderer->queueFamilyIndices.graphicsFamily;
|
||||
texture->usageFlags = imageUsageFlags;
|
||||
|
||||
return 1;
|
||||
return texture;
|
||||
}
|
||||
|
||||
static Refresh_Texture* VULKAN_CreateTexture(
|
||||
|
@ -5899,7 +5899,6 @@ static Refresh_Texture* VULKAN_CreateTexture(
|
|||
Refresh_TextureCreateInfo *textureCreateInfo
|
||||
) {
|
||||
VulkanRenderer *renderer = (VulkanRenderer*) driverData;
|
||||
VulkanTexture *result;
|
||||
VkImageUsageFlags imageUsageFlags = (
|
||||
VK_IMAGE_USAGE_TRANSFER_DST_BIT |
|
||||
VK_IMAGE_USAGE_TRANSFER_SRC_BIT
|
||||
|
@ -5936,9 +5935,7 @@ static Refresh_Texture* VULKAN_CreateTexture(
|
|||
imageAspectFlags = VK_IMAGE_ASPECT_COLOR_BIT;
|
||||
}
|
||||
|
||||
result = (VulkanTexture*) SDL_malloc(sizeof(VulkanTexture));
|
||||
|
||||
VULKAN_INTERNAL_CreateTexture(
|
||||
return (Refresh_Texture*) VULKAN_INTERNAL_CreateTexture(
|
||||
renderer,
|
||||
textureCreateInfo->width,
|
||||
textureCreateInfo->height,
|
||||
|
@ -5949,11 +5946,8 @@ static Refresh_Texture* VULKAN_CreateTexture(
|
|||
format,
|
||||
imageAspectFlags,
|
||||
VK_IMAGE_TYPE_2D,
|
||||
imageUsageFlags,
|
||||
result
|
||||
imageUsageFlags
|
||||
);
|
||||
|
||||
return (Refresh_Texture*) result;
|
||||
}
|
||||
|
||||
static Refresh_RenderTarget* VULKAN_CreateRenderTarget(
|
||||
|
@ -5992,8 +5986,6 @@ static Refresh_RenderTarget* VULKAN_CreateRenderTarget(
|
|||
if (multisampleCount > REFRESH_SAMPLECOUNT_1)
|
||||
{
|
||||
renderTarget->multisampleTexture =
|
||||
(VulkanTexture*) SDL_malloc(sizeof(VulkanTexture));
|
||||
|
||||
VULKAN_INTERNAL_CreateTexture(
|
||||
renderer,
|
||||
renderTarget->texture->dimensions.width,
|
||||
|
@ -6005,9 +5997,9 @@ static Refresh_RenderTarget* VULKAN_CreateRenderTarget(
|
|||
renderTarget->texture->format,
|
||||
aspectFlags,
|
||||
VK_IMAGE_TYPE_2D,
|
||||
VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT,
|
||||
renderTarget->multisampleTexture
|
||||
VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT
|
||||
);
|
||||
|
||||
renderTarget->multisampleCount = multisampleCount;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue