|
@@ -2691,10 +2691,17 @@ static void VULKAN_INTERNAL_TextureSubresourceMemoryBarrier(
|
|
|
memoryBarrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
|
|
memoryBarrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
|
|
|
memoryBarrier.image = textureSubresource->parent->image;
|
|
memoryBarrier.image = textureSubresource->parent->image;
|
|
|
memoryBarrier.subresourceRange.aspectMask = textureSubresource->parent->aspectFlags;
|
|
memoryBarrier.subresourceRange.aspectMask = textureSubresource->parent->aspectFlags;
|
|
|
- memoryBarrier.subresourceRange.baseArrayLayer = textureSubresource->layer;
|
|
|
|
|
- memoryBarrier.subresourceRange.layerCount = 1;
|
|
|
|
|
memoryBarrier.subresourceRange.baseMipLevel = textureSubresource->level;
|
|
memoryBarrier.subresourceRange.baseMipLevel = textureSubresource->level;
|
|
|
memoryBarrier.subresourceRange.levelCount = 1;
|
|
memoryBarrier.subresourceRange.levelCount = 1;
|
|
|
|
|
+ memoryBarrier.subresourceRange.baseArrayLayer = textureSubresource->layer;
|
|
|
|
|
+ memoryBarrier.subresourceRange.layerCount = 1;
|
|
|
|
|
+
|
|
|
|
|
+ // VK_KHR_maintenance9 adds the ability to independently transition arbitrary subsets of slices in a 3D texture,
|
|
|
|
|
+ // we need to extend the barrier layer count in order to preserve intended behaviour when that extension is enabled.
|
|
|
|
|
+ // See https://docs.vulkan.org/features/latest/features/proposals/VK_KHR_maintenance9.html#_barriers_with_2d_array_compatible_3d_images
|
|
|
|
|
+ if (textureSubresource->parent->container->header.info.type == SDL_GPU_TEXTURETYPE_3D) {
|
|
|
|
|
+ memoryBarrier.subresourceRange.layerCount = VK_REMAINING_ARRAY_LAYERS;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
if (sourceUsageMode == VULKAN_TEXTURE_USAGE_MODE_UNINITIALIZED) {
|
|
if (sourceUsageMode == VULKAN_TEXTURE_USAGE_MODE_UNINITIALIZED) {
|
|
|
srcStages = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT;
|
|
srcStages = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT;
|
|
@@ -5955,12 +5962,6 @@ static void VULKAN_INTERNAL_CycleActiveTexture(
|
|
|
renderer,
|
|
renderer,
|
|
|
&container->header.info);
|
|
&container->header.info);
|
|
|
|
|
|
|
|
- VULKAN_INTERNAL_TextureTransitionToDefaultUsage(
|
|
|
|
|
- renderer,
|
|
|
|
|
- commandBuffer,
|
|
|
|
|
- VULKAN_TEXTURE_USAGE_MODE_UNINITIALIZED,
|
|
|
|
|
- texture);
|
|
|
|
|
-
|
|
|
|
|
if (!texture) {
|
|
if (!texture) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
@@ -5978,6 +5979,13 @@ static void VULKAN_INTERNAL_CycleActiveTexture(
|
|
|
container->textureCount += 1;
|
|
container->textureCount += 1;
|
|
|
|
|
|
|
|
container->activeTexture = texture;
|
|
container->activeTexture = texture;
|
|
|
|
|
+
|
|
|
|
|
+ // Transition texture after storing it as the memory barrier might need to read the texture's container info
|
|
|
|
|
+ VULKAN_INTERNAL_TextureTransitionToDefaultUsage(
|
|
|
|
|
+ renderer,
|
|
|
|
|
+ commandBuffer,
|
|
|
|
|
+ VULKAN_TEXTURE_USAGE_MODE_UNINITIALIZED,
|
|
|
|
|
+ texture);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
static VulkanBuffer *VULKAN_INTERNAL_PrepareBufferForWrite(
|
|
static VulkanBuffer *VULKAN_INTERNAL_PrepareBufferForWrite(
|