Commit 60da1580 by Alexis Hetu Committed by Alexis Hétu

Support pNext chain entries in vkCreateImageView

Added support for these structures in vkCreateImageView: VK_STRUCTURE_TYPE_IMAGE_VIEW_USAGE_CREATE_INFO_KHR VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_INFO These only add validation without modifying imageView behavior. This should affect a few thousand tests, which now hit the next UNIMPLEMENTED() call, inside the SPIR-V compiler. Bug b/119620767 Change-Id: Icd2f9608d6b9ca1500ada8e51621c8d54ff9cd8d Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/28429Tested-by: 's avatarAlexis Hétu <sugoi@google.com> Presubmit-Ready: Alexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent d6fae389
...@@ -50,7 +50,8 @@ Image::Image(const Image::CreateInfo* pCreateInfo, void* mem) : ...@@ -50,7 +50,8 @@ Image::Image(const Image::CreateInfo* pCreateInfo, void* mem) :
mipLevels(pCreateInfo->pCreateInfo->mipLevels), mipLevels(pCreateInfo->pCreateInfo->mipLevels),
arrayLayers(pCreateInfo->pCreateInfo->arrayLayers), arrayLayers(pCreateInfo->pCreateInfo->arrayLayers),
samples(pCreateInfo->pCreateInfo->samples), samples(pCreateInfo->pCreateInfo->samples),
tiling(pCreateInfo->pCreateInfo->tiling) tiling(pCreateInfo->pCreateInfo->tiling),
usage(pCreateInfo->pCreateInfo->usage)
{ {
} }
......
...@@ -56,6 +56,7 @@ public: ...@@ -56,6 +56,7 @@ public:
Format getFormat(VkImageAspectFlagBits aspect) const; Format getFormat(VkImageAspectFlagBits aspect) const;
uint32_t getArrayLayers() const { return arrayLayers; } uint32_t getArrayLayers() const { return arrayLayers; }
uint32_t getMipLevels() const { return mipLevels; } uint32_t getMipLevels() const { return mipLevels; }
VkImageUsageFlags getUsage() const { return usage; }
uint32_t getLastLayerIndex(const VkImageSubresourceRange& subresourceRange) const; uint32_t getLastLayerIndex(const VkImageSubresourceRange& subresourceRange) const;
uint32_t getLastMipLevel(const VkImageSubresourceRange& subresourceRange) const; uint32_t getLastMipLevel(const VkImageSubresourceRange& subresourceRange) const;
VkSampleCountFlagBits getSampleCountFlagBits() const { return samples; } VkSampleCountFlagBits getSampleCountFlagBits() const { return samples; }
...@@ -94,6 +95,7 @@ private: ...@@ -94,6 +95,7 @@ private:
uint32_t arrayLayers = 0; uint32_t arrayLayers = 0;
VkSampleCountFlagBits samples = VK_SAMPLE_COUNT_1_BIT; VkSampleCountFlagBits samples = VK_SAMPLE_COUNT_1_BIT;
VkImageTiling tiling = VK_IMAGE_TILING_OPTIMAL; VkImageTiling tiling = VK_IMAGE_TILING_OPTIMAL;
VkImageUsageFlags usage = (VkImageUsageFlags)0;
}; };
static inline Image* Cast(VkImage object) static inline Image* Cast(VkImage object)
......
...@@ -928,9 +928,41 @@ VKAPI_ATTR VkResult VKAPI_CALL vkCreateImageView(VkDevice device, const VkImageV ...@@ -928,9 +928,41 @@ VKAPI_ATTR VkResult VKAPI_CALL vkCreateImageView(VkDevice device, const VkImageV
TRACE("(VkDevice device = 0x%X, const VkImageViewCreateInfo* pCreateInfo = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X, VkImageView* pView = 0x%X)", TRACE("(VkDevice device = 0x%X, const VkImageViewCreateInfo* pCreateInfo = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X, VkImageView* pView = 0x%X)",
device, pCreateInfo, pAllocator, pView); device, pCreateInfo, pAllocator, pView);
if(pCreateInfo->pNext || pCreateInfo->flags) if(pCreateInfo->flags)
{ {
UNIMPLEMENTED("pCreateInfo->pNext || pCreateInfo->flags"); UNIMPLEMENTED("pCreateInfo->flags");
}
const VkBaseInStructure* extensionCreateInfo = reinterpret_cast<const VkBaseInStructure*>(pCreateInfo->pNext);
while(extensionCreateInfo)
{
switch(extensionCreateInfo->sType)
{
case VK_STRUCTURE_TYPE_IMAGE_VIEW_USAGE_CREATE_INFO_KHR:
{
const VkImageViewUsageCreateInfo* multiviewCreateInfo = reinterpret_cast<const VkImageViewUsageCreateInfo*>(extensionCreateInfo);
ASSERT(!(~vk::Cast(pCreateInfo->image)->getUsage() & multiviewCreateInfo->usage));
}
break;
case VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_INFO:
{
const VkSamplerYcbcrConversionInfo* ycbcrConversionInfo = reinterpret_cast<const VkSamplerYcbcrConversionInfo*>(extensionCreateInfo);
if(ycbcrConversionInfo->conversion != VK_NULL_HANDLE)
{
ASSERT((pCreateInfo->components.r == VK_COMPONENT_SWIZZLE_IDENTITY) &&
(pCreateInfo->components.g == VK_COMPONENT_SWIZZLE_IDENTITY) &&
(pCreateInfo->components.b == VK_COMPONENT_SWIZZLE_IDENTITY) &&
(pCreateInfo->components.a == VK_COMPONENT_SWIZZLE_IDENTITY));
}
}
break;
default:
UNIMPLEMENTED("extensionCreateInfo->sType");
break;
}
extensionCreateInfo = extensionCreateInfo->pNext;
} }
return vk::ImageView::Create(pAllocator, pCreateInfo, pView); return vk::ImageView::Create(pAllocator, pCreateInfo, pView);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment