tools/spec: avoid c-style casts
This commit is contained in:
parent
222b662995
commit
80c13529bd
@ -866,7 +866,7 @@ def write_dispatch(dst: TextIO, q: List[Type], reg: Registry):
|
|||||||
implementations = {
|
implementations = {
|
||||||
'vkCreateInstance': """
|
'vkCreateInstance': """
|
||||||
auto res = std::make_unique<indirect<VkInstance,cruft::vk::load::instance_table>> ();
|
auto res = std::make_unique<indirect<VkInstance,cruft::vk::load::instance_table>> ();
|
||||||
auto ptr = (decltype(vkCreateInstance)*) (cruft::vk::load::v_table->vk_icdGetInstanceProcAddr (nullptr, "vkCreateInstance"));
|
auto ptr = reinterpret_cast<decltype(vkCreateInstance)*> (cruft::vk::load::v_table->vk_icdGetInstanceProcAddr (nullptr, "vkCreateInstance"));
|
||||||
auto err = (*ptr) (pCreateInfo, pAllocator, &res->handle);
|
auto err = (*ptr) (pCreateInfo, pAllocator, &res->handle);
|
||||||
if (err != VK_SUCCESS)
|
if (err != VK_SUCCESS)
|
||||||
return err;
|
return err;
|
||||||
@ -879,7 +879,7 @@ def write_dispatch(dst: TextIO, q: List[Type], reg: Registry):
|
|||||||
MAP_INSTANCE_COMMANDS(GET)
|
MAP_INSTANCE_COMMANDS(GET)
|
||||||
#undef GET
|
#undef GET
|
||||||
|
|
||||||
*pInstance = (VkInstance)res.release ();
|
*pInstance = reinterpret_cast<VkInstance> (res.release ());
|
||||||
return err;
|
return err;
|
||||||
""",
|
""",
|
||||||
|
|
||||||
@ -935,8 +935,8 @@ def write_dispatch(dst: TextIO, q: List[Type], reg: Registry):
|
|||||||
MAP_INSTANCE_COMMANDS(GET)
|
MAP_INSTANCE_COMMANDS(GET)
|
||||||
#undef GET
|
#undef GET
|
||||||
|
|
||||||
std::clog << "physical_device[" << i << "]; wrapped: " << wrapped.get() << ", native: " << (void*)wrapped->handle << '\\n';
|
std::clog << "physical_device[" << i << "]; wrapped: " << wrapped.get() << ", native: " << reinterpret_cast<void const*> (wrapped->handle) << '\\n';
|
||||||
pPhysicalDevices[i] = (VkPhysicalDevice)wrapped.release ();
|
pPhysicalDevices[i] = reinterpret_cast<VkPhysicalDevice> (wrapped.release ());
|
||||||
}
|
}
|
||||||
|
|
||||||
return err;
|
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']:
|
if obj.is_instance(reg) and obj.params[0].type not in ['VkInstance', 'VkPhysicalDevice']:
|
||||||
forwarding = f"""
|
forwarding = f"""
|
||||||
auto ptr= cruft::vk::load::v_table->vk_icdGetInstanceProcAddr (nullptr, "{obj.name}");
|
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<decltype({obj.name})*> (ptr)) ({', '.join (i.name for i in obj.params)});
|
||||||
"""
|
"""
|
||||||
else:
|
else:
|
||||||
forwarding = f"""
|
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>) {{
|
std::is_same_v<{obj.params[0].type}, VkPhysicalDevice>) {{
|
||||||
if ({obj.params[0].name} == VK_NULL_HANDLE) {{
|
if ({obj.params[0].name} == VK_NULL_HANDLE) {{
|
||||||
auto ptr= cruft::vk::load::v_table->vk_icdGetInstanceProcAddr (nullptr, "{obj.name}");
|
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<decltype({obj.name})*> (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) \\
|
#define FWD(NAME) \\
|
||||||
if (!strcmp(#NAME,pName)) { \\
|
if (!strcmp(#NAME,pName)) { \\
|
||||||
if (fn (nullptr, #NAME)) \\
|
if (fn (nullptr, #NAME)) \\
|
||||||
return (PFN_vkVoidFunction)NAME; \\
|
return reinterpret_cast<PFN_vkVoidFunction> (NAME); \\
|
||||||
else \\
|
else \\
|
||||||
return nullptr;\\
|
return nullptr;\\
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user