Ensure Vulkan loader magic number persists in objects pooled by MoltenVK.
MVKDispatchableVulkanAPIObject::getVkHandle() re-establishes the loader magic number before returning, in case the loader overwrote it before returning the object.
This commit is contained in:
parent
355e200a29
commit
c857014bb3
@ -19,6 +19,7 @@ MoltenVK 1.0.37
|
|||||||
Released TBD
|
Released TBD
|
||||||
|
|
||||||
- Revert to supporting host-coherent memory for linear images on macOS.
|
- Revert to supporting host-coherent memory for linear images on macOS.
|
||||||
|
- Ensure Vulkan loader magic number is set every time before returning any dispatchable Vulkan handle.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -122,21 +122,30 @@ class MVKDispatchableVulkanAPIObject : public MVKVulkanAPIObject {
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a reference to this object suitable for use as a Vulkan API handle.
|
* Returns a reference to this object suitable for use as a dispatchable Vulkan API handle.
|
||||||
* This is the compliment of the getDispatchableObject() method.
|
*
|
||||||
|
* Establishes the loader magic number every time, in case the loader
|
||||||
|
* overwrote it for some reason before passing the object back,
|
||||||
|
* particularly in pooled objects that the loader might consider freed.
|
||||||
|
*
|
||||||
|
* This is the compliment of the getDispatchableObject() function.
|
||||||
*/
|
*/
|
||||||
void* getVkHandle() override { return &_icdRef; }
|
void* getVkHandle() override {
|
||||||
|
set_loader_magic_value(&_icdRef);
|
||||||
|
return &_icdRef;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the MVKDispatchableVulkanAPIObject instance referenced by the dispatchable Vulkan handle.
|
* Retrieves the MVKDispatchableVulkanAPIObject instance referenced by the dispatchable Vulkan handle.
|
||||||
* This is the compliment of the getVkHandle() method.
|
*
|
||||||
|
* This is the compliment of the getVkHandle() function.
|
||||||
*/
|
*/
|
||||||
static inline MVKDispatchableVulkanAPIObject* getDispatchableObject(void* vkHandle) {
|
static inline MVKDispatchableVulkanAPIObject* getDispatchableObject(void* vkHandle) {
|
||||||
return vkHandle ? ((MVKDispatchableObjectICDRef*)vkHandle)->mvkObject : nullptr;
|
return vkHandle ? ((MVKDispatchableObjectICDRef*)vkHandle)->mvkObject : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
MVKDispatchableObjectICDRef _icdRef = { ICD_LOADER_MAGIC, this };
|
MVKDispatchableObjectICDRef _icdRef = { VK_NULL_HANDLE, this };
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user