fix CopyTextureToTexture
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
c3d2b17c4d
commit
45b71bd63d
|
@ -7480,10 +7480,9 @@ static void VULKAN_SetTextureDataYUV(
|
|||
|
||||
static void VULKAN_INTERNAL_BlitImage(
|
||||
VulkanRenderer *renderer,
|
||||
VkCommandBuffer commandBuffer,
|
||||
VulkanCommandBuffer *commandBuffer,
|
||||
Refresh_TextureSlice *sourceTextureSlice,
|
||||
Refresh_TextureSlice *destinationTextureSlice,
|
||||
VulkanResourceAccessType newDestinationAccessType,
|
||||
VkFilter filter
|
||||
) {
|
||||
VkImageBlit blit;
|
||||
|
@ -7491,11 +7490,17 @@ static void VULKAN_INTERNAL_BlitImage(
|
|||
VulkanTexture *destinationTexture = ((VulkanTextureContainer*) destinationTextureSlice->texture)->vulkanTexture;
|
||||
|
||||
VulkanResourceAccessType originalSourceAccessType = sourceTexture->resourceAccessType;
|
||||
VulkanResourceAccessType originalDestinationAccessType = destinationTexture->resourceAccessType;
|
||||
|
||||
if (originalDestinationAccessType == RESOURCE_ACCESS_NONE)
|
||||
{
|
||||
originalDestinationAccessType = RESOURCE_ACCESS_ANY_SHADER_READ_SAMPLED_IMAGE;
|
||||
}
|
||||
|
||||
/* TODO: is it worth it to only transition the specific subresource? */
|
||||
VULKAN_INTERNAL_ImageMemoryBarrier(
|
||||
renderer,
|
||||
commandBuffer,
|
||||
commandBuffer->commandBuffer,
|
||||
RESOURCE_ACCESS_TRANSFER_READ,
|
||||
VK_IMAGE_ASPECT_COLOR_BIT,
|
||||
0,
|
||||
|
@ -7509,7 +7514,7 @@ static void VULKAN_INTERNAL_BlitImage(
|
|||
|
||||
VULKAN_INTERNAL_ImageMemoryBarrier(
|
||||
renderer,
|
||||
commandBuffer,
|
||||
commandBuffer->commandBuffer,
|
||||
RESOURCE_ACCESS_TRANSFER_WRITE,
|
||||
VK_IMAGE_ASPECT_COLOR_BIT,
|
||||
0,
|
||||
|
@ -7546,7 +7551,7 @@ static void VULKAN_INTERNAL_BlitImage(
|
|||
blit.dstSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
|
||||
|
||||
renderer->vkCmdBlitImage(
|
||||
commandBuffer,
|
||||
commandBuffer->commandBuffer,
|
||||
sourceTexture->image,
|
||||
VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
|
||||
destinationTexture->image,
|
||||
|
@ -7559,7 +7564,7 @@ static void VULKAN_INTERNAL_BlitImage(
|
|||
/* TODO: is it worth it to only transition the specific subresource? */
|
||||
VULKAN_INTERNAL_ImageMemoryBarrier(
|
||||
renderer,
|
||||
commandBuffer,
|
||||
commandBuffer->commandBuffer,
|
||||
originalSourceAccessType,
|
||||
VK_IMAGE_ASPECT_COLOR_BIT,
|
||||
0,
|
||||
|
@ -7573,8 +7578,8 @@ static void VULKAN_INTERNAL_BlitImage(
|
|||
|
||||
VULKAN_INTERNAL_ImageMemoryBarrier(
|
||||
renderer,
|
||||
commandBuffer,
|
||||
newDestinationAccessType,
|
||||
commandBuffer->commandBuffer,
|
||||
originalDestinationAccessType,
|
||||
VK_IMAGE_ASPECT_COLOR_BIT,
|
||||
0,
|
||||
destinationTexture->layerCount,
|
||||
|
@ -7584,6 +7589,9 @@ static void VULKAN_INTERNAL_BlitImage(
|
|||
destinationTexture->image,
|
||||
&destinationTexture->resourceAccessType
|
||||
);
|
||||
|
||||
VULKAN_INTERNAL_TrackTexture(renderer, commandBuffer, sourceTexture);
|
||||
VULKAN_INTERNAL_TrackTexture(renderer, commandBuffer, destinationTexture);
|
||||
}
|
||||
|
||||
REFRESHAPI void VULKAN_CopyTextureToTexture(
|
||||
|
@ -7595,30 +7603,14 @@ REFRESHAPI void VULKAN_CopyTextureToTexture(
|
|||
) {
|
||||
VulkanRenderer *renderer = (VulkanRenderer*)driverData;
|
||||
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer*) commandBuffer;
|
||||
VulkanTexture *sourceTexture = (VulkanTexture*) sourceTextureSlice->texture;
|
||||
VulkanTexture *destinationTexture = (VulkanTexture*) destinationTextureSlice->texture;
|
||||
VulkanResourceAccessType destinationAccessType = destinationTexture->resourceAccessType;
|
||||
|
||||
if (destinationTexture->usageFlags & VK_IMAGE_USAGE_SAMPLED_BIT)
|
||||
{
|
||||
destinationAccessType = RESOURCE_ACCESS_ANY_SHADER_READ_SAMPLED_IMAGE;
|
||||
}
|
||||
else if (destinationTexture->usageFlags & VK_IMAGE_USAGE_STORAGE_BIT)
|
||||
{
|
||||
destinationAccessType = RESOURCE_ACCESS_COMPUTE_SHADER_STORAGE_IMAGE_READ_WRITE;
|
||||
}
|
||||
|
||||
VULKAN_INTERNAL_BlitImage(
|
||||
renderer,
|
||||
vulkanCommandBuffer->commandBuffer,
|
||||
vulkanCommandBuffer,
|
||||
sourceTextureSlice,
|
||||
destinationTextureSlice,
|
||||
destinationAccessType,
|
||||
RefreshToVK_Filter[filter]
|
||||
);
|
||||
|
||||
VULKAN_INTERNAL_TrackTexture(renderer, vulkanCommandBuffer, sourceTexture);
|
||||
VULKAN_INTERNAL_TrackTexture(renderer, vulkanCommandBuffer, destinationTexture);
|
||||
}
|
||||
|
||||
static void VULKAN_INTERNAL_SetBufferData(
|
||||
|
|
Loading…
Reference in New Issue