|
@@ -3641,7 +3641,7 @@ static bool VULKAN_INTERNAL_AllocateDescriptorsFromPool(
|
|
|
}
|
|
|
|
|
|
for (Uint32 i = descriptorSetLayout->samplerCount; i < descriptorSetLayout->samplerCount + descriptorSetLayout->storageTextureCount; i += 1) {
|
|
|
- descriptorPoolSizes[i].type = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE;
|
|
|
+ descriptorPoolSizes[i].type = VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE; // Yes, we are declaring the storage image as a sampled image, because shaders are stupid.
|
|
|
descriptorPoolSizes[i].descriptorCount = DESCRIPTOR_POOL_SIZE;
|
|
|
}
|
|
|
|
|
@@ -3771,7 +3771,7 @@ static DescriptorSetLayout *VULKAN_INTERNAL_FetchDescriptorSetLayout(
|
|
|
for (Uint32 i = samplerCount; i < samplerCount + storageTextureCount; i += 1) {
|
|
|
descriptorSetLayoutBindings[i].binding = i;
|
|
|
descriptorSetLayoutBindings[i].descriptorCount = 1;
|
|
|
- descriptorSetLayoutBindings[i].descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE;
|
|
|
+ descriptorSetLayoutBindings[i].descriptorType = VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE; // Yes, we are declaring the storage image as a sampled image, because shaders are stupid.
|
|
|
descriptorSetLayoutBindings[i].stageFlags = shaderStage;
|
|
|
descriptorSetLayoutBindings[i].pImmutableSamplers = NULL;
|
|
|
}
|
|
@@ -5093,7 +5093,7 @@ static void VULKAN_INTERNAL_BindGraphicsDescriptorSets(
|
|
|
currentWriteDescriptorSet->sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
|
|
|
currentWriteDescriptorSet->pNext = NULL;
|
|
|
currentWriteDescriptorSet->descriptorCount = 1;
|
|
|
- currentWriteDescriptorSet->descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE;
|
|
|
+ currentWriteDescriptorSet->descriptorType = VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE; // Yes, we are declaring a storage image as a sampled image, because shaders are stupid.
|
|
|
currentWriteDescriptorSet->dstArrayElement = 0;
|
|
|
currentWriteDescriptorSet->dstBinding = resourceLayout->vertexSamplerCount + i;
|
|
|
currentWriteDescriptorSet->dstSet = commandBuffer->vertexResourceDescriptorSet;
|
|
@@ -5212,7 +5212,7 @@ static void VULKAN_INTERNAL_BindGraphicsDescriptorSets(
|
|
|
currentWriteDescriptorSet->sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
|
|
|
currentWriteDescriptorSet->pNext = NULL;
|
|
|
currentWriteDescriptorSet->descriptorCount = 1;
|
|
|
- currentWriteDescriptorSet->descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE;
|
|
|
+ currentWriteDescriptorSet->descriptorType = VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE; // Yes, we are declaring a storage image as a sampled image, because shaders are stupid.
|
|
|
currentWriteDescriptorSet->dstArrayElement = 0;
|
|
|
currentWriteDescriptorSet->dstBinding = resourceLayout->fragmentSamplerCount + i;
|
|
|
currentWriteDescriptorSet->dstSet = commandBuffer->fragmentResourceDescriptorSet;
|
|
@@ -5619,7 +5619,9 @@ static VulkanTexture *VULKAN_INTERNAL_CreateTexture(
|
|
|
imageCreateFlags |= VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT;
|
|
|
}
|
|
|
|
|
|
- if (createinfo->usage & SDL_GPU_TEXTUREUSAGE_SAMPLER) {
|
|
|
+ if (createinfo->usage & (SDL_GPU_TEXTUREUSAGE_SAMPLER |
|
|
|
+ SDL_GPU_TEXTUREUSAGE_GRAPHICS_STORAGE_READ |
|
|
|
+ SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_READ)) {
|
|
|
vkUsageFlags |= VK_IMAGE_USAGE_SAMPLED_BIT;
|
|
|
}
|
|
|
if (createinfo->usage & SDL_GPU_TEXTUREUSAGE_COLOR_TARGET) {
|
|
@@ -5628,9 +5630,7 @@ static VulkanTexture *VULKAN_INTERNAL_CreateTexture(
|
|
|
if (createinfo->usage & SDL_GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET) {
|
|
|
vkUsageFlags |= VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT;
|
|
|
}
|
|
|
- if (createinfo->usage & (SDL_GPU_TEXTUREUSAGE_GRAPHICS_STORAGE_READ |
|
|
|
- SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_READ |
|
|
|
- SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_WRITE |
|
|
|
+ if (createinfo->usage & (SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_WRITE |
|
|
|
SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_SIMULTANEOUS_READ_WRITE)) {
|
|
|
vkUsageFlags |= VK_IMAGE_USAGE_STORAGE_BIT;
|
|
|
}
|
|
@@ -8362,7 +8362,7 @@ static void VULKAN_INTERNAL_BindComputeDescriptorSets(
|
|
|
currentWriteDescriptorSet->sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
|
|
|
currentWriteDescriptorSet->pNext = NULL;
|
|
|
currentWriteDescriptorSet->descriptorCount = 1;
|
|
|
- currentWriteDescriptorSet->descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE;
|
|
|
+ currentWriteDescriptorSet->descriptorType = VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE; // Yes, we are declaring the readonly storage texture as a sampled image, because shaders are stupid.
|
|
|
currentWriteDescriptorSet->dstArrayElement = 0;
|
|
|
currentWriteDescriptorSet->dstBinding = resourceLayout->numSamplers + i;
|
|
|
currentWriteDescriptorSet->dstSet = commandBuffer->computeReadOnlyDescriptorSet;
|