Fixes for new handle types (opaque pointers). Note, 32-bit is broken.

This commit is contained in:
baldurk
2015-12-09 23:15:16 +01:00
parent 0e75bafdb1
commit 95a64071fb
+7 -8
View File
@@ -120,7 +120,7 @@ struct TypedRealHandle
struct WrappedVkNonDispRes : public WrappedVkRes
{
template<typename T> WrappedVkNonDispRes(T obj, ResourceId objId) : real(obj.handle), id(objId), record(NULL) {}
template<typename T> WrappedVkNonDispRes(T obj, ResourceId objId) : real(obj), id(objId), record(NULL) {}
RealVkRes real;
ResourceId id;
@@ -384,10 +384,14 @@ template<typename inner> struct UnwrapHelper {};
typedef WrappedVkNonDispRes ParentType; \
typedef CONCAT(Wrapped, vulkantype) Outer; \
static TypedRealHandle ToTypedHandle(vulkantype real) \
{ TypedRealHandle h; h.type = (VkResourceType)Outer::TypeEnum; h.real = RealVkRes(real.handle); return h; } \
static Outer *FromHandle(vulkantype wrapped) { return (Outer *) (uintptr_t)wrapped.handle; } \
{ TypedRealHandle h; h.type = (VkResourceType)Outer::TypeEnum; h.real = RealVkRes(real); return h; } \
static Outer *FromHandle(vulkantype wrapped) { return (Outer *) (uintptr_t)wrapped; } \
};
// VKTODOHIGH this no longer works on 32-bit since handles are no longer strongly typed.
// solution will *probably* be to modify vulkan.h to use a C++ class with appropriate overrides,
// constructors and operators to still be a 64-bit element but be strongly typed.
UNWRAP_HELPER(VkInstance)
UNWRAP_HELPER(VkPhysicalDevice)
UNWRAP_HELPER(VkDevice)
@@ -538,11 +542,6 @@ struct ImageRegionState
VkImageLayout newLayout;
};
inline bool operator <(const VkDescriptorSet a, const VkDescriptorSet b)
{
return a.handle < b.handle;
}
struct SwapchainInfo
{
VkFormat format;