mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-05-08 14:52:00 +00:00
Change 3D texture memory barrier sub-resource range to be maintenance9 compatible.
This commit is contained in:
committed by
Sam Lantinga
parent
386f198622
commit
5d63a4cad2
@@ -2739,10 +2739,17 @@ static void VULKAN_INTERNAL_TextureSubresourceMemoryBarrier(
|
||||
memoryBarrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
|
||||
memoryBarrier.image = textureSubresource->parent->image;
|
||||
memoryBarrier.subresourceRange.aspectMask = textureSubresource->parent->aspectFlags;
|
||||
memoryBarrier.subresourceRange.baseArrayLayer = textureSubresource->layer;
|
||||
memoryBarrier.subresourceRange.layerCount = 1;
|
||||
memoryBarrier.subresourceRange.baseMipLevel = textureSubresource->level;
|
||||
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) {
|
||||
srcStages = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT;
|
||||
@@ -6004,12 +6011,6 @@ static void VULKAN_INTERNAL_CycleActiveTexture(
|
||||
renderer,
|
||||
&container->header.info);
|
||||
|
||||
VULKAN_INTERNAL_TextureTransitionToDefaultUsage(
|
||||
renderer,
|
||||
commandBuffer,
|
||||
VULKAN_TEXTURE_USAGE_MODE_UNINITIALIZED,
|
||||
texture);
|
||||
|
||||
if (!texture) {
|
||||
return;
|
||||
}
|
||||
@@ -6027,6 +6028,13 @@ static void VULKAN_INTERNAL_CycleActiveTexture(
|
||||
container->textureCount += 1;
|
||||
|
||||
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(
|
||||
|
||||
Reference in New Issue
Block a user