Commit 1cef4e69 by Alexis Hetu Committed by Alexis Hétu

Allow null dispatchable objects

Because we need to dereference dispatchable objects in order to get the underlying object, we need to first check for VK_NULL_HANDLE to avoid crashing. Bug b/116336664 Change-Id: Ia903dcc6142d5e7f283da8fbef0f43bae3ca243f Tests: dEQP-VK.api.null_handle.free_command_buffers Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/27388Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Tested-by: 's avatarAlexis Hétu <sugoi@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
parent 036614c8
......@@ -144,7 +144,8 @@ public:
static inline T* Cast(VkT vkObject)
{
return &(reinterpret_cast<DispatchableObject<T, VkT>*>(vkObject)->object);
return (vkObject == VK_NULL_HANDLE) ? nullptr :
&(reinterpret_cast<DispatchableObject<T, VkT>*>(vkObject)->object);
}
operator VkT()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment