fix texture copy memory barrier + optimize RT memory barrier

anisotropy
cosmonaut 2022-09-22 12:44:28 -07:00
parent 8f0ba8ffb2
commit f8bdf6fe1a
1 changed files with 13 additions and 3 deletions

View File

@ -7255,13 +7255,23 @@ REFRESHAPI void VULKAN_CopyTextureToTexture(
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer*) commandBuffer; VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer*) commandBuffer;
VulkanTexture *sourceTexture = (VulkanTexture*) sourceTextureSlice->texture; VulkanTexture *sourceTexture = (VulkanTexture*) sourceTextureSlice->texture;
VulkanTexture *destinationTexture = (VulkanTexture*) destinationTextureSlice->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->commandBuffer,
sourceTextureSlice, sourceTextureSlice,
destinationTextureSlice, destinationTextureSlice,
destinationTexture->resourceAccessType, destinationAccessType,
RefreshToVK_Filter[filter] RefreshToVK_Filter[filter]
); );
@ -8386,7 +8396,7 @@ static void VULKAN_BeginRenderPass(
VULKAN_INTERNAL_ImageMemoryBarrier( VULKAN_INTERNAL_ImageMemoryBarrier(
renderer, renderer,
vulkanCommandBuffer->commandBuffer, vulkanCommandBuffer->commandBuffer,
RESOURCE_ACCESS_COLOR_ATTACHMENT_READ_WRITE, RESOURCE_ACCESS_COLOR_ATTACHMENT_WRITE,
VK_IMAGE_ASPECT_COLOR_BIT, VK_IMAGE_ASPECT_COLOR_BIT,
0, 0,
texture->layerCount, texture->layerCount,
@ -8414,7 +8424,7 @@ static void VULKAN_BeginRenderPass(
VULKAN_INTERNAL_ImageMemoryBarrier( VULKAN_INTERNAL_ImageMemoryBarrier(
renderer, renderer,
vulkanCommandBuffer->commandBuffer, vulkanCommandBuffer->commandBuffer,
RESOURCE_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_WRITE, RESOURCE_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE,
depthAspectFlags, depthAspectFlags,
0, 0,
texture->layerCount, texture->layerCount,