diff options
| author | Mark Young <marky@lunarg.com> | 2016-11-07 13:27:02 -0700 |
|---|---|---|
| committer | Mark Young <marky@lunarg.com> | 2016-11-14 11:02:40 -0700 |
| commit | e7bf86e164e88409324fa2c8b41e0775f9d48501 (patch) | |
| tree | 10ebbd2988ad6537ee5977b11ef3814ac628bc52 /loader/table_ops.h | |
| parent | 1731acbd8ce5cdadf879117f92cd0b1d1388e440 (diff) | |
| download | usermoji-e7bf86e164e88409324fa2c8b41e0775f9d48501.tar.xz | |
loader: gh1120/gh1134 - Object wrapping issues
First issue was that we needed to override vkGetDeviceProcAddr. Instead
of allowing this to always go directly to the ICD, we needed to intercept
a few commands because they require a loader trampoline and terminator
call. Most commands still return a pointer directly to ICD command.
GH1120 - Unwrap both the physical device handles and the
KHR_surface handles in the loader during both the trampoline and
terminator calls for DebugMarker commands. This has to be done since the
values given to an application are the loader trampoline versions, and the
values given to the last layer is the loader terminator versions.
GH1134 - We were passing down the wrong device object to the ICD functions
when querying the ICD command function address and comparing it in the
override functions.
Thanks to Baldur (Mr. Renderdoc) for discovering this, testing my
fixes, and resolving several bugs.
Change-Id: I7618d71ffee6c53d9842758210a9261f6b3a1797
Diffstat (limited to 'loader/table_ops.h')
| -rw-r--r-- | loader/table_ops.h | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/loader/table_ops.h b/loader/table_ops.h index f8f72259..0e42d0ca 100644 --- a/loader/table_ops.h +++ b/loader/table_ops.h @@ -31,6 +31,7 @@ static VkResult vkDevExtError(VkDevice dev) { struct loader_device *found_dev; + // The device going in is a trampoline device struct loader_icd_term *icd_term = loader_get_icd_and_device(dev, &found_dev, NULL); @@ -541,11 +542,6 @@ loader_lookup_device_dispatch_table(const VkLayerDispatchTable *table, if (!strcmp(name, "CmdExecuteCommands")) return (void *)table->CmdExecuteCommands; - if (!strcmp(name, "CreateSwapchainKHR")) { - // For CreateSwapChainKHR we need to use trampoline and terminator - // functions to properly unwrap the SurfaceKHR object. - return (void *)vkCreateSwapchainKHR; - } if (!strcmp(name, "DestroySwapchainKHR")) return (void *)table->DestroySwapchainKHR; if (!strcmp(name, "GetSwapchainImagesKHR")) @@ -555,6 +551,20 @@ loader_lookup_device_dispatch_table(const VkLayerDispatchTable *table, if (!strcmp(name, "QueuePresentKHR")) return (void *)table->QueuePresentKHR; + // NOTE: Device Funcs needing Trampoline/Terminator. + // Overrides for device functions needing a trampoline and + // a terminator because certain device entry-points still need to go + // through a terminator before hitting the ICD. This could be for + // several reasons, but the main one is currently unwrapping an + // object before passing the appropriate info along to the ICD. + if (!strcmp(name, "CreateSwapchainKHR")) { + return (void *)vkCreateSwapchainKHR; + } else if (!strcmp(name, "DebugMarkerSetObjectTagEXT")) { + return (void *)vkDebugMarkerSetObjectTagEXT; + } else if (!strcmp(name, "DebugMarkerSetObjectNameEXT")) { + return (void *)vkDebugMarkerSetObjectNameEXT; + } + return NULL; } |
