From: Charles Giessen Date: Sat, 12 Feb 2022 03:49:57 +0000 (-0700) Subject: Fix Win32 Unknown Device function handling X-Git-Tag: upstream/v1.3.207~28 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=451076dcbe94d585e5eb58c6073287d94edfc21e;p=platform%2Fupstream%2FVulkan-Loader.git Fix Win32 Unknown Device function handling 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`. --- diff --git a/loader/unknown_ext_chain_masm.asm b/loader/unknown_ext_chain_masm.asm index 52441fae..f1323bde 100644 --- a/loader/unknown_ext_chain_masm.asm +++ b/loader/unknown_ext_chain_masm.asm @@ -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