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(
|
static void VULKAN_INTERNAL_BlitImage(
|
||||||
VulkanRenderer *renderer,
|
VulkanRenderer *renderer,
|
||||||
VkCommandBuffer commandBuffer,
|
VulkanCommandBuffer *commandBuffer,
|
||||||
Refresh_TextureSlice *sourceTextureSlice,
|
Refresh_TextureSlice *sourceTextureSlice,
|
||||||
Refresh_TextureSlice *destinationTextureSlice,
|
Refresh_TextureSlice *destinationTextureSlice,
|
||||||
VulkanResourceAccessType newDestinationAccessType,
|
|
||||||
VkFilter filter
|
VkFilter filter
|
||||||
) {
|
) {
|
||||||
VkImageBlit blit;
|
VkImageBlit blit;
|
||||||
|
@ -7491,11 +7490,17 @@ static void VULKAN_INTERNAL_BlitImage(
|
||||||
VulkanTexture *destinationTexture = ((VulkanTextureContainer*) destinationTextureSlice->texture)->vulkanTexture;
|
VulkanTexture *destinationTexture = ((VulkanTextureContainer*) destinationTextureSlice->texture)->vulkanTexture;
|
||||||
|
|
||||||
VulkanResourceAccessType originalSourceAccessType = sourceTexture->resourceAccessType;
|
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? */
|
/* TODO: is it worth it to only transition the specific subresource? */
|
||||||
VULKAN_INTERNAL_ImageMemoryBarrier(
|
VULKAN_INTERNAL_ImageMemoryBarrier(
|
||||||
renderer,
|
renderer,
|
||||||
commandBuffer,
|
commandBuffer->commandBuffer,
|
||||||
RESOURCE_ACCESS_TRANSFER_READ,
|
RESOURCE_ACCESS_TRANSFER_READ,
|
||||||
VK_IMAGE_ASPECT_COLOR_BIT,
|
VK_IMAGE_ASPECT_COLOR_BIT,
|
||||||
0,
|
0,
|
||||||
|
@ -7509,7 +7514,7 @@ static void VULKAN_INTERNAL_BlitImage(
|
||||||
|
|
||||||
VULKAN_INTERNAL_ImageMemoryBarrier(
|
VULKAN_INTERNAL_ImageMemoryBarrier(
|
||||||
renderer,
|
renderer,
|
||||||
commandBuffer,
|
commandBuffer->commandBuffer,
|
||||||
RESOURCE_ACCESS_TRANSFER_WRITE,
|
RESOURCE_ACCESS_TRANSFER_WRITE,
|
||||||
VK_IMAGE_ASPECT_COLOR_BIT,
|
VK_IMAGE_ASPECT_COLOR_BIT,
|
||||||
0,
|
0,
|
||||||
|
@ -7546,7 +7551,7 @@ static void VULKAN_INTERNAL_BlitImage(
|
||||||
blit.dstSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
|
blit.dstSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
|
||||||
|
|
||||||
renderer->vkCmdBlitImage(
|
renderer->vkCmdBlitImage(
|
||||||
commandBuffer,
|
commandBuffer->commandBuffer,
|
||||||
sourceTexture->image,
|
sourceTexture->image,
|
||||||
VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
|
VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
|
||||||
destinationTexture->image,
|
destinationTexture->image,
|
||||||
|
@ -7559,7 +7564,7 @@ static void VULKAN_INTERNAL_BlitImage(
|
||||||
/* TODO: is it worth it to only transition the specific subresource? */
|
/* TODO: is it worth it to only transition the specific subresource? */
|
||||||
VULKAN_INTERNAL_ImageMemoryBarrier(
|
VULKAN_INTERNAL_ImageMemoryBarrier(
|
||||||
renderer,
|
renderer,
|
||||||
commandBuffer,
|
commandBuffer->commandBuffer,
|
||||||
originalSourceAccessType,
|
originalSourceAccessType,
|
||||||
VK_IMAGE_ASPECT_COLOR_BIT,
|
VK_IMAGE_ASPECT_COLOR_BIT,
|
||||||
0,
|
0,
|
||||||
|
@ -7573,8 +7578,8 @@ static void VULKAN_INTERNAL_BlitImage(
|
||||||
|
|
||||||
VULKAN_INTERNAL_ImageMemoryBarrier(
|
VULKAN_INTERNAL_ImageMemoryBarrier(
|
||||||
renderer,
|
renderer,
|
||||||
commandBuffer,
|
commandBuffer->commandBuffer,
|
||||||
newDestinationAccessType,
|
originalDestinationAccessType,
|
||||||
VK_IMAGE_ASPECT_COLOR_BIT,
|
VK_IMAGE_ASPECT_COLOR_BIT,
|
||||||
0,
|
0,
|
||||||
destinationTexture->layerCount,
|
destinationTexture->layerCount,
|
||||||
|
@ -7584,6 +7589,9 @@ static void VULKAN_INTERNAL_BlitImage(
|
||||||
destinationTexture->image,
|
destinationTexture->image,
|
||||||
&destinationTexture->resourceAccessType
|
&destinationTexture->resourceAccessType
|
||||||
);
|
);
|
||||||
|
|
||||||
|
VULKAN_INTERNAL_TrackTexture(renderer, commandBuffer, sourceTexture);
|
||||||
|
VULKAN_INTERNAL_TrackTexture(renderer, commandBuffer, destinationTexture);
|
||||||
}
|
}
|
||||||
|
|
||||||
REFRESHAPI void VULKAN_CopyTextureToTexture(
|
REFRESHAPI void VULKAN_CopyTextureToTexture(
|
||||||
|
@ -7595,30 +7603,14 @@ REFRESHAPI void VULKAN_CopyTextureToTexture(
|
||||||
) {
|
) {
|
||||||
VulkanRenderer *renderer = (VulkanRenderer*)driverData;
|
VulkanRenderer *renderer = (VulkanRenderer*)driverData;
|
||||||
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer*) commandBuffer;
|
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(
|
VULKAN_INTERNAL_BlitImage(
|
||||||
renderer,
|
renderer,
|
||||||
vulkanCommandBuffer->commandBuffer,
|
vulkanCommandBuffer,
|
||||||
sourceTextureSlice,
|
sourceTextureSlice,
|
||||||
destinationTextureSlice,
|
destinationTextureSlice,
|
||||||
destinationAccessType,
|
|
||||||
RefreshToVK_Filter[filter]
|
RefreshToVK_Filter[filter]
|
||||||
);
|
);
|
||||||
|
|
||||||
VULKAN_INTERNAL_TrackTexture(renderer, vulkanCommandBuffer, sourceTexture);
|
|
||||||
VULKAN_INTERNAL_TrackTexture(renderer, vulkanCommandBuffer, destinationTexture);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void VULKAN_INTERNAL_SetBufferData(
|
static void VULKAN_INTERNAL_SetBufferData(
|
||||||
|
|
Loading…
Reference in New Issue