partially revert memory barrier change
continuous-integration/drone/push Build is passing Details

pull/14/head
cosmonaut 2022-02-24 13:02:05 -08:00
parent 2db60e5ab0
commit 3741a95cb3
1 changed files with 39 additions and 29 deletions

View File

@ -1356,6 +1356,9 @@ typedef struct VulkanCommandBuffer
VulkanComputePipeline *currentComputePipeline;
VulkanGraphicsPipeline *currentGraphicsPipeline;
VulkanRenderTarget *renderPassColorTargets[MAX_COLOR_TARGET_BINDINGS];
uint32_t renderPassColorTargetCount;
VulkanUniformBuffer *vertexUniformBuffer;
VulkanUniformBuffer *fragmentUniformBuffer;
VulkanUniformBuffer *computeUniformBuffer;
@ -7034,20 +7037,6 @@ static void VULKAN_BindVertexSamplers(
descriptorImageInfos[i].imageView = currentTexture->view;
descriptorImageInfos[i].sampler = (VkSampler) pSamplers[i];
descriptorImageInfos[i].imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
VULKAN_INTERNAL_ImageMemoryBarrier(
renderer,
vulkanCommandBuffer->commandBuffer,
RESOURCE_ACCESS_VERTEX_SHADER_READ_SAMPLED_IMAGE,
VK_IMAGE_ASPECT_COLOR_BIT,
0,
currentTexture->layerCount,
0,
currentTexture->levelCount,
0,
currentTexture->image,
&currentTexture->resourceAccessType
);
}
vulkanCommandBuffer->vertexSamplerDescriptorSet = VULKAN_INTERNAL_FetchDescriptorSet(
@ -7086,20 +7075,6 @@ static void VULKAN_BindFragmentSamplers(
descriptorImageInfos[i].imageView = currentTexture->view;
descriptorImageInfos[i].sampler = (VkSampler) pSamplers[i];
descriptorImageInfos[i].imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
VULKAN_INTERNAL_ImageMemoryBarrier(
renderer,
vulkanCommandBuffer->commandBuffer,
RESOURCE_ACCESS_FRAGMENT_SHADER_READ_SAMPLED_IMAGE,
VK_IMAGE_ASPECT_COLOR_BIT,
0,
currentTexture->layerCount,
0,
currentTexture->levelCount,
0,
currentTexture->image,
&currentTexture->resourceAccessType
);
}
vulkanCommandBuffer->fragmentSamplerDescriptorSet = VULKAN_INTERNAL_FetchDescriptorSet(
@ -7682,6 +7657,13 @@ static void VULKAN_BeginRenderPass(
vulkanCommandBuffer->renderPassInProgress = 1;
SDL_stack_free(clearValues);
for (i = 0; i < colorAttachmentCount; i += 1)
{
vulkanCommandBuffer->renderPassColorTargets[i] =
(VulkanRenderTarget*) colorAttachmentInfos[i].pRenderTarget;
}
vulkanCommandBuffer->renderPassColorTargetCount = colorAttachmentCount;
}
static void VULKAN_EndRenderPass(
@ -7690,6 +7672,8 @@ static void VULKAN_EndRenderPass(
) {
VulkanRenderer* renderer = (VulkanRenderer*) driverData;
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer*) commandBuffer;
VulkanTexture *currentTexture;
uint32_t i;
renderer->vkCmdEndRenderPass(
vulkanCommandBuffer->commandBuffer
@ -7713,8 +7697,32 @@ static void VULKAN_EndRenderPass(
vulkanCommandBuffer->fragmentUniformBuffer
);
}
vulkanCommandBuffer->fragmentUniformBuffer = NULL;
/* If the render targets can be sampled, transition them to sample layout */
for (i = 0; i < vulkanCommandBuffer->renderPassColorTargetCount; i += 1)
{
currentTexture = vulkanCommandBuffer->renderPassColorTargets[i]->texture;
if (currentTexture->usageFlags & VK_IMAGE_USAGE_SAMPLED_BIT)
{
VULKAN_INTERNAL_ImageMemoryBarrier(
renderer,
vulkanCommandBuffer->commandBuffer,
RESOURCE_ACCESS_ANY_SHADER_READ_SAMPLED_IMAGE,
VK_IMAGE_ASPECT_COLOR_BIT,
0,
currentTexture->layerCount,
0,
currentTexture->levelCount,
0,
currentTexture->image,
&currentTexture->resourceAccessType
);
}
}
vulkanCommandBuffer->renderPassColorTargetCount = 0;
vulkanCommandBuffer->currentGraphicsPipeline = NULL;
vulkanCommandBuffer->renderPassInProgress = 0;
}
@ -8251,7 +8259,9 @@ static Refresh_CommandBuffer* VULKAN_AcquireCommandBuffer(
commandBuffer->fixed = fixed;
commandBuffer->submitted = 0;
commandBuffer->present = 0;
commandBuffer->renderPassInProgress = 0;
commandBuffer->renderPassColorTargetCount = 0;
VULKAN_INTERNAL_BeginCommandBuffer(renderer, commandBuffer);