diff --git a/tools/spec.py b/tools/spec.py index 8540d70..ca2a1d8 100644 --- a/tools/spec.py +++ b/tools/spec.py @@ -866,7 +866,7 @@ def write_dispatch(dst: TextIO, q: List[Type], reg: Registry): implementations = { 'vkCreateInstance': """ auto res = std::make_unique> (); - auto ptr = (decltype(vkCreateInstance)*) (cruft::vk::load::v_table->vk_icdGetInstanceProcAddr (nullptr, "vkCreateInstance")); + auto ptr = reinterpret_cast (cruft::vk::load::v_table->vk_icdGetInstanceProcAddr (nullptr, "vkCreateInstance")); auto err = (*ptr) (pCreateInfo, pAllocator, &res->handle); if (err != VK_SUCCESS) return err; @@ -879,7 +879,7 @@ def write_dispatch(dst: TextIO, q: List[Type], reg: Registry): MAP_INSTANCE_COMMANDS(GET) #undef GET - *pInstance = (VkInstance)res.release (); + *pInstance = reinterpret_cast (res.release ()); return err; """, @@ -935,8 +935,8 @@ def write_dispatch(dst: TextIO, q: List[Type], reg: Registry): MAP_INSTANCE_COMMANDS(GET) #undef GET - std::clog << "physical_device[" << i << "]; wrapped: " << wrapped.get() << ", native: " << (void*)wrapped->handle << '\\n'; - pPhysicalDevices[i] = (VkPhysicalDevice)wrapped.release (); + std::clog << "physical_device[" << i << "]; wrapped: " << wrapped.get() << ", native: " << reinterpret_cast (wrapped->handle) << '\\n'; + pPhysicalDevices[i] = reinterpret_cast (wrapped.release ()); } return err; @@ -963,7 +963,7 @@ def write_dispatch(dst: TextIO, q: List[Type], reg: Registry): if obj.is_instance(reg) and obj.params[0].type not in ['VkInstance', 'VkPhysicalDevice']: forwarding = f""" auto ptr= cruft::vk::load::v_table->vk_icdGetInstanceProcAddr (nullptr, "{obj.name}"); - return ((decltype({obj.name})*) (ptr)) ({', '.join (i.name for i in obj.params)}); + return (reinterpret_cast (ptr)) ({', '.join (i.name for i in obj.params)}); """ else: forwarding = f""" @@ -971,7 +971,7 @@ def write_dispatch(dst: TextIO, q: List[Type], reg: Registry): std::is_same_v<{obj.params[0].type}, VkPhysicalDevice>) {{ if ({obj.params[0].name} == VK_NULL_HANDLE) {{ auto ptr= cruft::vk::load::v_table->vk_icdGetInstanceProcAddr (nullptr, "{obj.name}"); - return ((decltype({obj.name})*) (ptr)) ({', '.join (i.name for i in obj.params)}); + return (reinterpret_cast (ptr)) ({', '.join (i.name for i in obj.params)}); }} }} @@ -1022,7 +1022,7 @@ def write_trace(dst: TextIO, q: List[Type], reg: Registry): #define FWD(NAME) \\ if (!strcmp(#NAME,pName)) { \\ if (fn (nullptr, #NAME)) \\ - return (PFN_vkVoidFunction)NAME; \\ + return reinterpret_cast (NAME); \\ else \\ return nullptr;\\ }