Fix Win32 Unknown Device function handling
authorCharles Giessen <charles@lunarg.com>
Sat, 12 Feb 2022 03:49:57 +0000 (20:49 -0700)
committerCharles Giessen <46324611+charles-lunarg@users.noreply.github.com>
Tue, 15 Feb 2022 17:48:53 +0000 (10:48 -0700)
The handling of unknown device functions queried with vkGetInstanceProcAddr
required an additional pointer dereference to get the dispatch table.

The VkDevice handle is a pointer to the `chain_device` member of
`loader_device`. This member is actually a pointer to `loader_dispatch`, or
put another way, the "start" of `loader_device`. Thus, to get access to the
dispatch table, we need to dereference the VkDevice passed into the function
then dereference the chain_device to get loader_dispatch`.

loader/unknown_ext_chain_masm.asm

index 52441fa..f1323bd 100644 (file)
@@ -108,7 +108,8 @@ endm
 DevExtTramp macro num
 public _vkdev_ext&num&@4
 _vkdev_ext&num&@4:
-    mov     eax, dword ptr [esp + 4]                                           ; Dereference the handle to get the dispatch table
+    mov     eax, dword ptr [esp + 4]                                           ; Dereference the handle to get VkDevice chain_device
+    mov     eax, dword ptr [eax]                                               ; Dereference the chain_device to get the loader_dispatch
     jmp     dword ptr [eax + (EXT_OFFSET_DEVICE_DISPATCH + (PTR_SIZE * num))]  ; Jump to the appropriate call chain
 endm