Set up input attachment descriptors the same as storage images
These work the same way; differences are in coordinate handling and
where we find the image format.
Bug: b/131171141
Change-Id: I9dccfd88e686102d6200bdba8a8ad64b7debeca3
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/29688
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Chris Forbes <chrisforbes@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
diff --git a/src/Vulkan/VkDescriptorSetLayout.cpp b/src/Vulkan/VkDescriptorSetLayout.cpp
index 0586a51..2e25012 100644
--- a/src/Vulkan/VkDescriptorSetLayout.cpp
+++ b/src/Vulkan/VkDescriptorSetLayout.cpp
@@ -245,31 +245,6 @@
return &descriptorSet->data[byteOffset];
}
-const uint8_t* DescriptorSetLayout::GetInputData(const VkWriteDescriptorSet& writeDescriptorSet)
-{
- switch(writeDescriptorSet.descriptorType)
- {
- case VK_DESCRIPTOR_TYPE_SAMPLER:
- case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER:
- case VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE:
- case VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT:
- return reinterpret_cast<const uint8_t*>(writeDescriptorSet.pImageInfo);
- case VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER:
- return reinterpret_cast<const uint8_t*>(writeDescriptorSet.pTexelBufferView);
- case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER:
- case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER:
- case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC:
- case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC:
- return reinterpret_cast<const uint8_t*>(writeDescriptorSet.pBufferInfo);
- case VK_DESCRIPTOR_TYPE_STORAGE_IMAGE:
- case VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER:
- ASSERT("descriptorType has custom handling");
- default:
- UNIMPLEMENTED("descriptorType");
- return nullptr;
- }
-}
-
void DescriptorSetLayout::WriteDescriptorSet(DescriptorSet *dstSet, VkDescriptorUpdateTemplateEntry const &entry, char const *src)
{
DescriptorSetLayout* dstLayout = dstSet->layout;
@@ -439,7 +414,8 @@
}
}
}
- else if (entry.descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_IMAGE)
+ else if (entry.descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_IMAGE ||
+ entry.descriptorType == VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT)
{
auto descriptor = reinterpret_cast<StorageImageDescriptor *>(memToWrite);
for(uint32_t i = 0; i < entry.descriptorCount; i++)
diff --git a/src/Vulkan/VkDescriptorSetLayout.hpp b/src/Vulkan/VkDescriptorSetLayout.hpp
index 131cdd4..1cffddc 100644
--- a/src/Vulkan/VkDescriptorSetLayout.hpp
+++ b/src/Vulkan/VkDescriptorSetLayout.hpp
@@ -98,7 +98,6 @@
private:
size_t getDescriptorSetDataSize() const;
uint32_t getBindingIndex(uint32_t binding) const;
- static const uint8_t* GetInputData(const VkWriteDescriptorSet& descriptorWrites);
static bool isDynamic(VkDescriptorType type);
VkDescriptorSetLayoutCreateFlags flags;