vulkan: Stub/forwarding implementation of gpdp2 in nulldrv
Implements gpdp2 in terms of the core 1.0 functions. This is just
enough to be able to demonstrate CTS against gpdp2, and shake out
any bad loader interactions.
Where we hadn't bothered to implement the core function in nulldrv,
don't do it for gpdp2 equivalent either.
Test: dEQP-VK.api.info.get_physical_device_properties2 etc
Change-Id: I04ac05a01a67c6e03bd1a569701b046cf86877e9
diff --git a/vulkan/nulldrv/null_driver.cpp b/vulkan/nulldrv/null_driver.cpp
index 89c65af..55f7f19 100644
--- a/vulkan/nulldrv/null_driver.cpp
+++ b/vulkan/nulldrv/null_driver.cpp
@@ -269,15 +269,8 @@
layer_name);
}
-// NOTE: Change this to zero to report and extension, which can be useful
-// for testing changes to the loader.
-#if 1
- (void)properties; // unused
- *count = 0;
- return VK_SUCCESS;
-#else
const VkExtensionProperties kExtensions[] = {
- {VK_EXT_DEBUG_REPORT_EXTENSION_NAME, VK_EXT_DEBUG_REPORT_SPEC_VERSION}};
+ {VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME, VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_SPEC_VERSION}};
const uint32_t kExtensionsCount =
sizeof(kExtensions) / sizeof(kExtensions[0]);
@@ -286,7 +279,6 @@
if (properties)
std::copy(kExtensions, kExtensions + *count, properties);
return *count < kExtensionsCount ? VK_INCOMPLETE : VK_SUCCESS;
-#endif
}
VKAPI_ATTR
@@ -310,6 +302,10 @@
for (uint32_t i = 0; i < create_info->enabledExtensionCount; i++) {
if (strcmp(create_info->ppEnabledExtensionNames[i],
+ VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME) == 0) {
+ ALOGV("instance extension '%s' requested",
+ create_info->ppEnabledExtensionNames[i]);
+ } else if (strcmp(create_info->ppEnabledExtensionNames[i],
VK_EXT_DEBUG_REPORT_EXTENSION_NAME) == 0) {
ALOGV("instance extension '%s' requested",
create_info->ppEnabledExtensionNames[i]);
@@ -514,6 +510,11 @@
};
}
+void GetPhysicalDeviceProperties2KHR(VkPhysicalDevice physical_device,
+ VkPhysicalDeviceProperties2KHR* properties) {
+ GetPhysicalDeviceProperties(physical_device, &properties->properties);
+}
+
void GetPhysicalDeviceQueueFamilyProperties(
VkPhysicalDevice,
uint32_t* count,
@@ -529,6 +530,12 @@
}
}
+void GetPhysicalDeviceQueueFamilyProperties2KHR(VkPhysicalDevice physical_device, uint32_t* count, VkQueueFamilyProperties2KHR* properties) {
+ // note: even though multiple structures, this is safe to forward in this
+ // case since we only expose one queue family.
+ GetPhysicalDeviceQueueFamilyProperties(physical_device, count, properties ? &properties->queueFamilyProperties : nullptr);
+}
+
void GetPhysicalDeviceMemoryProperties(
VkPhysicalDevice,
VkPhysicalDeviceMemoryProperties* properties) {
@@ -544,6 +551,10 @@
properties->memoryHeaps[0].flags = VK_MEMORY_HEAP_DEVICE_LOCAL_BIT;
}
+void GetPhysicalDeviceMemoryProperties2KHR(VkPhysicalDevice physical_device, VkPhysicalDeviceMemoryProperties2KHR* properties) {
+ GetPhysicalDeviceMemoryProperties(physical_device, &properties->memoryProperties);
+}
+
void GetPhysicalDeviceFeatures(VkPhysicalDevice /*gpu*/,
VkPhysicalDeviceFeatures* features) {
*features = VkPhysicalDeviceFeatures{
@@ -605,6 +616,10 @@
};
}
+void GetPhysicalDeviceFeatures2KHR(VkPhysicalDevice physical_device, VkPhysicalDeviceFeatures2KHR* features) {
+ GetPhysicalDeviceFeatures(physical_device, &features->features);
+}
+
// -----------------------------------------------------------------------------
// Device
@@ -1083,11 +1098,22 @@
ALOGV("TODO: vk%s", __FUNCTION__);
}
+void GetPhysicalDeviceFormatProperties2KHR(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties2KHR* pFormatProperties) {
+ ALOGV("TODO: vk%s", __FUNCTION__);
+}
+
VkResult GetPhysicalDeviceImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, VkImageFormatProperties* pImageFormatProperties) {
ALOGV("TODO: vk%s", __FUNCTION__);
return VK_SUCCESS;
}
+VkResult GetPhysicalDeviceImageFormatProperties2KHR(VkPhysicalDevice physicalDevice,
+ const VkPhysicalDeviceImageFormatInfo2KHR* pImageFormatInfo,
+ VkImageFormatProperties2KHR* pImageFormatProperties) {
+ ALOGV("TODO: vk%s", __FUNCTION__);
+ return VK_SUCCESS;
+}
+
VkResult EnumerateInstanceLayerProperties(uint32_t* pCount, VkLayerProperties* pProperties) {
ALOGV("TODO: vk%s", __FUNCTION__);
return VK_SUCCESS;
@@ -1140,6 +1166,14 @@
ALOGV("TODO: vk%s", __FUNCTION__);
}
+void GetPhysicalDeviceSparseImageFormatProperties2KHR(VkPhysicalDevice physicalDevice,
+ VkPhysicalDeviceSparseImageFormatInfo2KHR const* pInfo,
+ unsigned int* pNumProperties,
+ VkSparseImageFormatProperties2KHR* pProperties) {
+ ALOGV("TODO: vk%s", __FUNCTION__);
+}
+
+
VkResult QueueBindSparse(VkQueue queue, uint32_t bindInfoCount, const VkBindSparseInfo* pBindInfo, VkFence fence) {
ALOGV("TODO: vk%s", __FUNCTION__);
return VK_SUCCESS;