radv: Allow physical device interfaces to be included in device extensions
PATCH 1/1 radv: Allow physical device interfaces to be included in device extensions
According to the Vulkan spec:
"Vulkan 1.0 initially required all new physical-device-level extension
functionality to be structured within an instance extension. In order to avoid using an instance extension, which often requires loader support, physical-device-level extension functionality may be implemented within device extensions"
The code that checks for enabled extension APIs currently only passes functions with VkDevice or VkCommandBuffer as their first argument. This patch extends that to also allow functions with VkPhysicalDevice parameters, in support of the above quote from the Vulkan spec.
--- src/amd/vulkan/radv_entrypoints_gen.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
src/amd/vulkan/radv_entrypoints_gen.py +1 -1
@@ -352,7 +352,7 @@ class Entrypoint(EntrypointBase): self.return_type = return_type 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.device_command = len(params) > 0 and (params[0].type == 'VkPhysicalDevice' or params[0].type == 'VkDevice' or params[0].type == 'VkQueue' or params[0].type == 'VkCommandBuffer') def prefixed_name(self, prefix): assert self.name.startswith('vk')
Signature · 6 lines
2.19.1 _______________________________________________ mesa-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Quoted 9 lines · Keith Packard
According to the Vulkan spec:
"Vulkan 1.0 initially required all new physical-device-level extension
functionality to be structured within an instance extension. In order to avoid using an instance extension, which often requires loader support, physical-device-level extension functionality may be implemented within device extensions"
Quoted 6 lines
The code that checks for enabled extension APIs currently only passes functions with VkDevice or VkCommandBuffer as their first argument. This patch extends that to also allow functions with VkPhysicalDevice parameters, in support of the above quote from the Vulkan spec.
Also "To obtain a function pointer for a physical-device-level command from a device extension, an application can use vkGetInstanceProcAddr. "
As far as I can tell the device_command member is only to make sure we return NULL from vkGetDeviceProcAddr, and per the spec (3.1 table 2) we still have to return NULL there for functions which take VkPhysicalDevice? So the old behavior seems correct to me.
Quoted 21 lines
Signed-off-by Keith Packard <[email protected]>--- src/amd/vulkan/radv_entrypoints_gen.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)src/amd/vulkan/radv_entrypoints_gen.py +1
-2@@ -352,7 +352,7 @@ class Entrypoint(EntrypointBase): self.return_type = return_type 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.device_command = len(params) > 0 and (params[0].type == 'VkPhysicalDevice' or params[0].type == 'VkDevice' or params[0].type == 'VkQueue' or params[0].type == 'VkCommandBuffer') def prefixed_name(self, prefix): assert self.name.startswith('vk') --2.19.1
Quoted 4 lines
_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev
_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Quoted 17 lines · Bas Nieuwenhuizen
Quoted 9 lines · Keith Packard
According to the Vulkan spec:
"Vulkan 1.0 initially required all new physical-device-level extension
functionality to be structured within an instance extension. In order to avoid using an instance extension, which often requires loader support, physical-device-level extension functionality may be implemented within device extensions"Quoted 6 lines
The code that checks for enabled extension APIs currently only passes functions with VkDevice or VkCommandBuffer as their first argument. This patch extends that to also allow functions with VkPhysicalDevice parameters, in support of the above quote from the Vulkan spec.
Quoted 9 lines
Also "To obtain a function pointer for a physical-device-level command from a device extension, an application can use vkGetInstanceProcAddr. "
As far as I can tell the
device_commandmember is only to make sure we return NULL from vkGetDeviceProcAddr, and per the spec (3.1 table 2) we still have to return NULL there for functions which take VkPhysicalDevice? So the old behavior seems correct to me.
I think anv is ignoring that line in the table which is why it works for us. If only someone wrote tests for these things...
I think the correct interpretation would be that any physical device functions that are part of a core version or instance extension should yield NULL but any physical device functions from a device extension should return a valid function pointer. Sadly, that behavior is kind-of a pain to implement. :-(
Quoted 26 lines
Review
Quoted 6 lines
Signed-off-by Keith Packard <[email protected]>--- src/amd/vulkan/radv_entrypoints_gen.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)(quoted diff) +0
-0
b/src/amd/vulkan/radv_entrypoints_gen.pysrc/amd/vulkan/radv_entrypoints_gen.py class Entrypoint(EntrypointBase): · line 355
Quoted 8 lines
index
377b544c2aa..69e6fc3e0eb100644src/amd/vulkan/radv_entrypoints_gen.py +0
-1@@ -352,7 +352,7 @@ class Entrypoint(EntrypointBase): self.return_type = return_type 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')
src/amd/vulkan/radv_entrypoints_gen.py class Entrypoint(EntrypointBase): · line 355
Quoted 1 line
src/amd/vulkan/radv_entrypoints_gen.py +1
-0+ self.device_command = len(params) > 0 and (params[0].type =='VkPhysicalDevice' or params[0].type == 'VkDevice' or params[0].type == 'VkQueue' or params[0].type == 'VkCommandBuffer')
Quoted 6 lines
src/amd/vulkan/radv_entrypoints_gen.py +0
-1def prefixed_name(self, prefix): assert self.name.startswith('vk') --2.19.1
Quoted 9 lines
Quoted 4 lines
_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 30 lines · Jason Ekstrand
Quoted 18 lines · Bas Nieuwenhuizen
Quoted 9 lines · Keith Packard
According to the Vulkan spec:
"Vulkan 1.0 initially required all new physical-device-level extension
functionality to be structured within an instance extension. In order to avoid using an instance extension, which often requires loader support, physical-device-level extension functionality may be implemented within device extensions"Quoted 6 lines
The code that checks for enabled extension APIs currently only passes functions with VkDevice or VkCommandBuffer as their first argument. This patch extends that to also allow functions with VkPhysicalDevice parameters, in support of the above quote from the Vulkan spec.
Quoted 8 lines
Also "To obtain a function pointer for a physical-device-level command from a device extension, an application can use vkGetInstanceProcAddr. "
As far as I can tell the
device_commandmember is only to make sure we return NULL from vkGetDeviceProcAddr, and per the spec (3.1 table 2) we still have to return NULL there for functions which take VkPhysicalDevice? So the old behavior seems correct to me.
Quoted 3 lines
I think anv is ignoring that line in the table which is why it works for us. If only someone wrote tests for these things...
I think the correct interpretation would be that any physical device functions that are part of a core version or instance extension should yield NULL but any physical device functions from a device extension should return a valid function pointer. Sadly, that behavior is kind-of a pain to implement. :-(
How would you read that into the spec? As quoted above it explicitly tells you to use vkGetInstanceProcAddr for VkPhysicalDevice functions, even if they are based on a device extension. (And you cannot really use vkGetDeviceProcAddr anyway as the typical usecase is before you've created a device).
Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
Signed-off-by Keith Packard <[email protected]>--- src/amd/vulkan/radv_entrypoints_gen.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)src/amd/vulkan/radv_entrypoints_gen.py +1
-2@@ -352,7 +352,7 @@ class Entrypoint(EntrypointBase): self.return_type = return_type 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.device_command = len(params) > 0 and (params[0].type == 'VkPhysicalDevice' or params[0].type == 'VkDevice' or params[0].type == 'VkQueue' or params[0].type == 'VkCommandBuffer') def prefixed_name(self, prefix): assert self.name.startswith('vk') --2.19.1
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev
_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Quoted 43 lines · Bas Nieuwenhuizen
Quoted 2 lines · Jason Ekstrand
On Sat, Oct 13, 2018 at 10:58 AM Bas Nieuwenhuizen <
Quoted 2 lines · [email protected]> wrote:
Quoted 2 lines
On Fri, Oct 12, 2018 at 10:38 PM Keith Packard <[email protected]>
Quoted 20 lines · wrote:
Quoted 20 lines
Quoted 9 lines
According to the Vulkan spec:
"Vulkan 1.0 initially required all new physical-device-level extension
functionality to be structured within an instance extension. In order to avoid using an instance extension, which often requires loader support, physical-device-level extension functionality may be implemented within device extensions"Quoted 6 lines
The code that checks for enabled extension APIs currently only passes functions with VkDevice or VkCommandBuffer as their first argument. This patch extends that to also allow functions with VkPhysicalDevice parameters, in support of the above quote from the Vulkan spec.
Also "To obtain a function pointer for a physical-device-level command from a device extension, an application can use vkGetInstanceProcAddr. "
Quoted 7 lines
Quoted 4 lines
As far as I can tell the
device_commandmember is only to make sure we return NULL from vkGetDeviceProcAddr, and per the spec (3.1 table 2) we still have to return NULL there for functions which take VkPhysicalDevice? So the old behavior seems correct to me.I think anv is ignoring that line in the table which is why it works for
us. If only someone wrote tests for these things...
Quoted 2 lines
I think the correct interpretation would be that any physical device
functions that are part of a core version or instance extension should yield NULL but any physical device functions from a device extension should return a valid function pointer. Sadly, that behavior is kind-of a pain to implement. :-(
Quoted 6 lines
How would you read that into the spec? As quoted above it explicitly tells you to use vkGetInstanceProcAddr for VkPhysicalDevice functions, even if they are based on a device extension. (And you cannot really use vkGetDeviceProcAddr anyway as the typical usecase is before you've created a device).
Because I was reading the wrong chunk of spec. :-( You are correct and radv is like doing the right thing and anv is doing the wrong thing.
--Jason
Quoted 19 lines
Quoted 8 lines
Quoted 8 lines
Review
Quoted 8 lines
Signed-off-by Keith Packard <[email protected]>--- src/amd/vulkan/radv_entrypoints_gen.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)(quoted diff) +0
-0
b/src/amd/vulkan/radv_entrypoints_gen.pyQuoted 8 lines
Quoted 8 lines
src/amd/vulkan/radv_entrypoints_gen.py class Entrypoint(EntrypointBase): · line 355
Quoted 8 lines
index
377b544c2aa..69e6fc3e0eb100644src/amd/vulkan/radv_entrypoints_gen.py +0
-1@@ -352,7 +352,7 @@ class Entrypoint(EntrypointBase): self.return_type = return_type 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')
Quoted 18 lines
Quoted 1 line
Quoted 1 line
src/amd/vulkan/radv_entrypoints_gen.py class Entrypoint(EntrypointBase): · line 355
Quoted 1 line
src/amd/vulkan/radv_entrypoints_gen.py +1
-0+ self.device_command = len(params) > 0 and (params[0].type =='VkPhysicalDevice' or params[0].type == 'VkDevice' or params[0].type == 'VkQueue' or params[0].type == 'VkCommandBuffer')
Quoted 14 lines
Quoted 14 lines
Quoted 10 lines
src/amd/vulkan/radv_entrypoints_gen.py +0
-1def prefixed_name(self, prefix): assert self.name.startswith('vk') --2.19.1
_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev
_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Quoted 55 lines · Jason Ekstrand
Quoted 45 lines · Bas Nieuwenhuizen
Quoted 2 lines · Jason Ekstrand
On Sat, Oct 13, 2018 at 10:58 AM Bas Nieuwenhuizen <
Quoted 2 lines · [email protected]> wrote:
Quoted 2 lines
On Fri, Oct 12, 2018 at 10:38 PM Keith Packard <[email protected]>
Quoted 4 lines · wrote:
Quoted 4 lines
Quoted 4 lines
According to the Vulkan spec:
"Vulkan 1.0 initially required all new physical-device-level
extension
Quoted 1 line
Quoted 1 line
Quoted 1 line
functionality to be structured within an instance extension. In
order
Quoted 15 lines
Quoted 15 lines
Quoted 10 lines
to avoid using an instance extension, which often requires loader support, physical-device-level extension functionality may be implemented within device extensions"
The code that checks for enabled extension APIs currently only passes functions with VkDevice or VkCommandBuffer as their first argument. This patch extends that to also allow functions with VkPhysicalDevice parameters, in support of the above quote from the Vulkan spec.
Also "To obtain a function pointer for a physical-device-level command from a device extension, an application can use vkGetInstanceProcAddr. "
Quoted 7 lines
Quoted 4 lines
As far as I can tell the
device_commandmember is only to make sure we return NULL from vkGetDeviceProcAddr, and per the spec (3.1 table 2) we still have to return NULL there for functions which take VkPhysicalDevice? So the old behavior seems correct to me.I think anv is ignoring that line in the table which is why it works
for us. If only someone wrote tests for these things...
Quoted 2 lines
I think the correct interpretation would be that any physical device
functions that are part of a core version or instance extension should yield NULL but any physical device functions from a device extension should return a valid function pointer. Sadly, that behavior is kind-of a pain to implement. :-(
Quoted 6 lines
How would you read that into the spec? As quoted above it explicitly tells you to use vkGetInstanceProcAddr for VkPhysicalDevice functions, even if they are based on a device extension. (And you cannot really use vkGetDeviceProcAddr anyway as the typical usecase is before you've created a device).
Quoted 3 lines
Because I was reading the wrong chunk of spec. :-( You are correct and radv is like doing the right thing and anv is doing the wrong thing.
Actually, I think anv is doing the right thing too. Now I have no idea why Keith was having problems.
--Jason
Quoted 34 lines
Quoted 34 lines
Quoted 10 lines
Quoted 10 lines
Review
Quoted 10 lines
Signed-off-by Keith Packard <[email protected]>--- src/amd/vulkan/radv_entrypoints_gen.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)(quoted diff) +0
-0
b/src/amd/vulkan/radv_entrypoints_gen.pyQuoted 8 lines
Quoted 8 lines
src/amd/vulkan/radv_entrypoints_gen.py class Entrypoint(EntrypointBase): · line 355
Quoted 8 lines
index
377b544c2aa..69e6fc3e0eb100644src/amd/vulkan/radv_entrypoints_gen.py +0
-1@@ -352,7 +352,7 @@ class Entrypoint(EntrypointBase): self.return_type = return_type 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')
Quoted 1 line
Quoted 1 line
src/amd/vulkan/radv_entrypoints_gen.py class Entrypoint(EntrypointBase): · line 355
Quoted 1 line
src/amd/vulkan/radv_entrypoints_gen.py +1
-0+ self.device_command = len(params) > 0 and (params[0].type== 'VkPhysicalDevice' or params[0].type == 'VkDevice' or params[0].type == 'VkQueue' or params[0].type == 'VkCommandBuffer')
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
src/amd/vulkan/radv_entrypoints_gen.py +0
-1def prefixed_name(self, prefix): assert self.name.startswith('vk') --2.19.1
_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Quoted 6 lines
Quoted 5 lines
Quoted 4 lines
Quoted 4 lines
_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev
_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Quoted 2 lines · Jason Ekstrand
Actually, I think anv is doing the right thing too. Now I have no idea why Keith was having problems.
anv is happily returning a valid pointer and radv is not?
In any case, I've switched to using vkGetInstanceProcAddr for the VkPhysicalDevice function and it works fine with both drivers.
Signature · 1 line
-keith
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 9 lines · On October 13, 2018 19:50:00 "Keith Packard" <[email protected]> wrote:
Quoted 2 lines · Jason Ekstrand
Actually, I think anv is doing the right thing too. Now I have no idea why Keith was having problems.
anv is happily returning a valid pointer and radv is not?
In any case, I've switched to using vkGetInstanceProcAddr for the VkPhysicalDevice function and it works fine with both drivers.
Using vkGetInstanceProcAddr is the right thing to do. The fact that anv allows you to is a bug which should be investigated and fixed. I looked at it a bit today and I'm still not sure how it's happening.
--Jason
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel