Commit 4100b733 by Alexis Hetu Committed by Alexis Hétu

Fix queries with arrays containing other structures

A few functions: - vkGetImageSparseMemoryRequirements2 - vkGetPhysicalDeviceQueueFamilyProperties2 - vkGetPhysicalDeviceSparseImageFormatProperties2 Can query properties/requirements from arrays of structures. The arrays of structure look like: struct Struct2{ .. Struct1 ... ... }; We were wrongly converting them directly into arrays of Struct1 by taking the address of the Struct1 member in the first Struct2 object, which is incorrect. This change copies the logic for vkGet* functions to vkGet*2 functions, adding a function to directly support VkQueueFamilyProperties2. Bug: b/142740524 Change-Id: Id1363f0ab82539d1bc1e3977c541602df8a618cb Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/37276 Presubmit-Ready: Alexis Hétu <sugoi@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com> Tested-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarChris Forbes <chrisforbes@google.com>
parent 26c6c4a5
......@@ -785,6 +785,20 @@ void PhysicalDevice::getQueueFamilyProperties(uint32_t pQueueFamilyPropertyCount
}
}
void PhysicalDevice::getQueueFamilyProperties(uint32_t pQueueFamilyPropertyCount,
VkQueueFamilyProperties2* pQueueFamilyProperties) const
{
for(uint32_t i = 0; i < pQueueFamilyPropertyCount; i++)
{
pQueueFamilyProperties[i].queueFamilyProperties.minImageTransferGranularity.width = 1;
pQueueFamilyProperties[i].queueFamilyProperties.minImageTransferGranularity.height = 1;
pQueueFamilyProperties[i].queueFamilyProperties.minImageTransferGranularity.depth = 1;
pQueueFamilyProperties[i].queueFamilyProperties.queueCount = 1;
pQueueFamilyProperties[i].queueFamilyProperties.queueFlags = VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_COMPUTE_BIT | VK_QUEUE_TRANSFER_BIT;
pQueueFamilyProperties[i].queueFamilyProperties.timestampValidBits = 0; // No support for time stamps
}
}
const VkPhysicalDeviceMemoryProperties& PhysicalDevice::getMemoryProperties() const
{
static const VkPhysicalDeviceMemoryProperties properties
......
......@@ -69,6 +69,8 @@ public:
uint32_t getQueueFamilyPropertyCount() const;
void getQueueFamilyProperties(uint32_t pQueueFamilyPropertyCount,
VkQueueFamilyProperties* pQueueFamilyProperties) const;
void getQueueFamilyProperties(uint32_t pQueueFamilyPropertyCount,
VkQueueFamilyProperties2* pQueueFamilyProperties) const;
const VkPhysicalDeviceMemoryProperties& getMemoryProperties() const;
private:
......
......@@ -2331,7 +2331,9 @@ VKAPI_ATTR void VKAPI_CALL vkGetImageSparseMemoryRequirements2(VkDevice device,
UNIMPLEMENTED("pInfo->pNext || pSparseMemoryRequirements->pNext");
}
vkGetImageSparseMemoryRequirements(device, pInfo->image, pSparseMemoryRequirementCount, &(pSparseMemoryRequirements->memoryRequirements));
// The 'sparseBinding' feature is not supported, so images can not be created with the VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT flag.
// "If the image was not created with VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT then pSparseMemoryRequirementCount will be set to zero and pSparseMemoryRequirements will not be written to."
*pSparseMemoryRequirementCount = 0;
}
VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFeatures2(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures2* pFeatures)
......@@ -2599,8 +2601,14 @@ VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceQueueFamilyProperties2(VkPhysicalD
UNIMPLEMENTED("pQueueFamilyProperties->pNext");
}
vkGetPhysicalDeviceQueueFamilyProperties(physicalDevice, pQueueFamilyPropertyCount,
pQueueFamilyProperties ? &(pQueueFamilyProperties->queueFamilyProperties) : nullptr);
if(!pQueueFamilyProperties)
{
*pQueueFamilyPropertyCount = vk::Cast(physicalDevice)->getQueueFamilyPropertyCount();
}
else
{
vk::Cast(physicalDevice)->getQueueFamilyProperties(*pQueueFamilyPropertyCount, pQueueFamilyProperties);
}
}
VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceMemoryProperties2(VkPhysicalDevice physicalDevice, VkPhysicalDeviceMemoryProperties2* pMemoryProperties)
......@@ -2625,9 +2633,8 @@ VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceSparseImageFormatProperties2(VkPhy
UNIMPLEMENTED("pProperties->pNext");
}
vkGetPhysicalDeviceSparseImageFormatProperties(physicalDevice, pFormatInfo->format, pFormatInfo->type,
pFormatInfo->samples, pFormatInfo->usage, pFormatInfo->tiling,
pPropertyCount, pProperties ? &(pProperties->properties) : nullptr);
// We do not support sparse images.
*pPropertyCount = 0;
}
VKAPI_ATTR void VKAPI_CALL vkTrimCommandPool(VkDevice device, VkCommandPool commandPool, VkCommandPoolTrimFlags flags)
......
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