summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBas Nieuwenhuizen <[email protected]>2019-01-05 13:46:53 +0100
committerBas Nieuwenhuizen <[email protected]>2019-05-13 00:41:31 +0200
commitd6dfb2cf5029ae1601eb6792aabd971b1459899f (patch)
treee8a414c36545c897bea62af9823f3de6a5c1f37c /src
parent726f0263e14d219153088b018624710d20f3a124 (diff)
radv: Add support for icd loader interface v4.
Adds support for physical device functions unknown to the loader. Acked-by: Samuel Pitoiset <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/amd/vulkan/radv_device.c19
-rw-r--r--src/amd/vulkan/radv_entrypoints_gen.py46
-rw-r--r--src/amd/vulkan/radv_private.h3
3 files changed, 66 insertions, 2 deletions
diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index 10956ded66f..ebca4f5c454 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -3127,6 +3127,23 @@ VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vk_icdGetInstanceProcAddr(
return radv_GetInstanceProcAddr(instance, pName);
}
+PUBLIC
+VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vk_icdGetPhysicalDeviceProcAddr(
+ VkInstance _instance,
+ const char* pName);
+
+PUBLIC
+VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vk_icdGetPhysicalDeviceProcAddr(
+ VkInstance _instance,
+ const char* pName)
+{
+ RADV_FROM_HANDLE(radv_instance, instance, _instance);
+
+ return radv_lookup_physical_device_entrypoint_checked(pName,
+ instance ? instance->apiVersion : 0,
+ instance ? &instance->enabled_extensions : NULL);
+}
+
PFN_vkVoidFunction radv_GetDeviceProcAddr(
VkDevice _device,
const char* pName)
@@ -4920,7 +4937,7 @@ vk_icdNegotiateLoaderICDInterfaceVersion(uint32_t *pSupportedVersion)
* vkDestroySurfaceKHR(), and other API which uses VKSurfaceKHR,
* because the loader no longer does so.
*/
- *pSupportedVersion = MIN2(*pSupportedVersion, 3u);
+ *pSupportedVersion = MIN2(*pSupportedVersion, 4u);
return VK_SUCCESS;
}
diff --git a/src/amd/vulkan/radv_entrypoints_gen.py b/src/amd/vulkan/radv_entrypoints_gen.py
index 946b10910c6..b64f2d93e8a 100644
--- a/src/amd/vulkan/radv_entrypoints_gen.py
+++ b/src/amd/vulkan/radv_entrypoints_gen.py
@@ -227,6 +227,35 @@ radv_entrypoint_is_enabled(int index, uint32_t core_version,
}
}
+static bool
+radv_entrypoint_is_enabled_physical_device(int index, uint32_t core_version,
+ const struct radv_instance_extension_table *instance)
+{
+ switch (index) {
+% for e in entrypoints:
+ %if e.physical_device_command:
+ case ${e.num}:
+ % if e.core_version:
+ return instance && ${e.core_version.c_vk_version()} <= core_version;
+ % elif e.extensions:
+ % for ext in e.extensions:
+ % if ext.type == 'instance':
+ if (instance && instance->${ext.name[3:]}) return true;
+ % else:
+ return true;
+ % endif
+ %endfor
+ return false;
+ % else:
+ return instance;
+ % endif
+ %endif
+% endfor
+ default:
+ return false;
+ }
+}
+
static int
radv_lookup_entrypoint(const char *name)
{
@@ -274,7 +303,20 @@ radv_lookup_entrypoint_checked(const char *name,
if (index < 0 || !radv_entrypoint_is_enabled(index, core_version, instance, device))
return NULL;
return radv_resolve_entrypoint(index);
-}""", output_encoding='utf-8')
+}
+
+void *
+radv_lookup_physical_device_entrypoint_checked(const char *name,
+ uint32_t core_version,
+ const struct radv_instance_extension_table *instance)
+{
+ int index = radv_lookup_entrypoint(name);
+ if (index < 0 || !radv_entrypoint_is_enabled_physical_device(index, core_version, instance))
+ return NULL;
+ return radv_resolve_entrypoint(index);
+}
+
+""", output_encoding='utf-8')
U32_MASK = 2**32 - 1
@@ -353,6 +395,7 @@ class Entrypoint(EntrypointBase):
self.params = params
self.guard = guard
self.device_command = len(params) > 0 and (params[0].type == 'VkDevice' or params[0].type == 'VkQueue' or params[0].type == 'VkCommandBuffer')
+ self.physical_device_command = len(params) > 0 and params[0].type == 'VkPhysicalDevice'
def prefixed_name(self, prefix):
assert self.name.startswith('vk')
@@ -369,6 +412,7 @@ class EntrypointAlias(EntrypointBase):
super(EntrypointAlias, self).__init__(name)
self.alias = entrypoint
self.device_command = entrypoint.device_command
+ self.physical_device_command = entrypoint.physical_device_command
def prefixed_name(self, prefix):
return self.alias.prefixed_name(prefix)
diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h
index 7fa0b39f2b0..55c34d204b3 100644
--- a/src/amd/vulkan/radv_private.h
+++ b/src/amd/vulkan/radv_private.h
@@ -280,6 +280,9 @@ void *radv_lookup_entrypoint_checked(const char *name,
uint32_t core_version,
const struct radv_instance_extension_table *instance,
const struct radv_device_extension_table *device);
+void *radv_lookup_physical_device_entrypoint_checked(const char *name,
+ uint32_t core_version,
+ const struct radv_instance_extension_table *instance);
struct radv_physical_device {
VK_LOADER_DATA _loader_data;