On Wednesday, May 12, 2021 12:51 PM, Charlie Barto <Charles.Barto@microsoft.com> wrote:
extern “C” VkResult vkCreateInstance(const VkInstanceCreateInfo*, const VKAllocationCallbacks*, VkInstance*);
in C:
VkInstance instance = 0;
VkResult result = vkCreateInstance(&(VkInstanceCreateInfo){
.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO,
.pApplicationInfo = &(VkApplicationInfo) {
.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO,
.pApplicationName = “Hello World”,
.applicationVersion = VK_MAKE_VERSION(0, 1, 0),
.pEngineName = “No Engine”,
.apiVersion = VK_API_VERSION_1_2
}}, NULL, &instance);
This usecase isn’t supported if the semantics are (T){…} === T{…}
The following is legal given the proposal:
VkInstance instance = 0;
VkResult result = vkCreateInstance((VkInstanceCreateInfo[]) {{
.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO,
.pApplicationInfo = (VkApplicationInfo[]) {{
.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO,
.pApplicationName = "Hello World",
.applicationVersion = VK_MAKE_VERSION(0, 1, 0),
.pEngineName = "No Engine",
.apiVersion = VK_API_VERSION_1_2
}}
}}, nullptr, &instance);
Although it looks somewhat strange (GCC
forbids array-prvalue -> pointer conversion,
but the standard allows it).
Does that work for you?
--
Zhihao Yuan, ID lichray
The best way to predict the future is to invent it.
_______________________________________________