int width, height;
VkFormat format;
- VkDisplayPropertiesWSI *display_props;
- int num_displays;
- PFN_vkGetDisplayInfoWSI fpGetDisplayInfoWSI;
PFN_vkCreateSwapChainWSI fpCreateSwapChainWSI;
PFN_vkDestroySwapChainWSI fpDestroySwapChainWSI;
PFN_vkGetSwapChainInfoWSI fpGetSwapChainInfoWSI;
err = vkCreateDevice(demo->gpu, &device, &demo->device);
assert(!err);
- demo->fpGetDisplayInfoWSI = vkGetDeviceProcAddr(demo->device, "vkGetDisplayInfoWSI");
- if (demo->fpGetDisplayInfoWSI == NULL)
- ERR_EXIT("vkGetDeviceProcAddr failed to find vkGetDisplayInfoWSI",
- "vkGetDeviceProcAddr Failure");
demo->fpCreateSwapChainWSI = vkGetDeviceProcAddr(demo->device, "vkCreateSwapChainWSI");
if (demo->fpCreateSwapChainWSI == NULL)
ERR_EXIT("vkGetDeviceProcAddr failed to find vkCreateSwapChainWSI",
0, &demo->queue);
assert(!err);
+ // for now hardcode format till get WSI support
+ demo->format = VK_FORMAT_B8G8R8A8_UNORM;
- // Get the VkDisplayWSI's associated with this physical device:
- VkDisplayWSI display;
- err = vkGetPhysicalDeviceInfo(demo->gpu, VK_PHYSICAL_DEVICE_INFO_TYPE_DISPLAY_PROPERTIES_WSI,
- &data_size, NULL);
- if (err != VK_SUCCESS) {
- printf("The Vulkan installable client driver (ICD) does not support "
- "querying\nfor the swap-chain image format. Therefore, am "
- "hardcoding this\nformat to VK_FORMAT_B8G8R8A8_UNORM.\n");
- fflush(stdout);
- demo->format = VK_FORMAT_B8G8R8A8_UNORM;
- return;
- }
- demo->display_props = (VkDisplayPropertiesWSI *) malloc(data_size);
- err = vkGetPhysicalDeviceInfo(demo->gpu, VK_PHYSICAL_DEVICE_INFO_TYPE_DISPLAY_PROPERTIES_WSI,
- &data_size, demo->display_props);
- assert(!err);
- demo->num_displays = data_size / sizeof(VkDisplayPropertiesWSI);
- // For now, simply use the first display (TODO: Enhance this for the
- // future):
- display = demo->display_props[0].display;
-
- // Get a VkFormat to use with the VkDisplayWSI we are using:
- err = demo->fpGetDisplayInfoWSI(display, VK_DISPLAY_INFO_TYPE_FORMAT_PROPERTIES_WSI,
- &data_size, NULL);
- VkDisplayFormatPropertiesWSI* display_format_props =
- (VkDisplayFormatPropertiesWSI*) malloc(data_size);
- err = demo->fpGetDisplayInfoWSI(display, VK_DISPLAY_INFO_TYPE_FORMAT_PROPERTIES_WSI,
- &data_size, display_format_props);
- // For now, simply use the first VkFormat (TODO: Enhance this for the
- // future):
- demo->format = display_format_props[0].swapChainFormat;
}
static void demo_init_connection(struct demo *demo)
int width, height;
VkFormat format;
- VkDisplayPropertiesWSI *display_props;
- int num_displays;
- PFN_vkGetDisplayInfoWSI fpGetDisplayInfoWSI;
PFN_vkCreateSwapChainWSI fpCreateSwapChainWSI;
PFN_vkDestroySwapChainWSI fpDestroySwapChainWSI;
PFN_vkGetSwapChainInfoWSI fpGetSwapChainInfoWSI;
"vkCreateInstance Failure");
}
- demo->fpGetDisplayInfoWSI = vkGetInstanceProcAddr(demo->inst, "vkGetDisplayInfoWSI");
- if (demo->fpGetDisplayInfoWSI == NULL)
- ERR_EXIT("vkGetInstanceProcAddr failed to find vkGetDisplayInfoWSI",
- "vkGetInstanceProcAddr Failure");
demo->fpCreateSwapChainWSI = vkGetInstanceProcAddr(demo->inst, "vkCreateSwapChainWSI");
if (demo->fpCreateSwapChainWSI == NULL)
ERR_EXIT("vkGetInstanceProcAddr failed to find vkCreateSwapChainWSI",
0, &demo->queue);
assert(!err);
+ // for now hardcode format till get WSI support
+ demo->format = VK_FORMAT_B8G8R8A8_UNORM;
- // Get the VkDisplayWSI's associated with this physical device:
- VkDisplayWSI display;
- err = vkGetPhysicalDeviceInfo(demo->gpu, VK_PHYSICAL_DEVICE_INFO_TYPE_DISPLAY_PROPERTIES_WSI,
- &data_size, NULL);
- if (err != VK_SUCCESS) {
- printf("The Vulkan installable client driver (ICD) does not support "
- "querying\nfor the swap-chain image format. Therefore, am "
- "hardcoding this\nformat to VK_FORMAT_B8G8R8A8_UNORM.\n");
- fflush(stdout);
- demo->format = VK_FORMAT_B8G8R8A8_UNORM;
- return;
- }
- demo->display_props = (VkDisplayPropertiesWSI *) malloc(data_size);
- err = vkGetPhysicalDeviceInfo(demo->gpu, VK_PHYSICAL_DEVICE_INFO_TYPE_DISPLAY_PROPERTIES_WSI,
- &data_size, demo->display_props);
- assert(!err);
- demo->num_displays = data_size / sizeof(VkDisplayPropertiesWSI);
- // For now, simply use the first display (TODO: Enhance this for the
- // future):
- display = demo->display_props[0].display;
-
- // Get a VkFormat to use with the VkDisplayWSI we are using:
- err = demo->fpGetDisplayInfoWSI(display, VK_DISPLAY_INFO_TYPE_FORMAT_PROPERTIES_WSI,
- &data_size, NULL);
- VkDisplayFormatPropertiesWSI* display_format_props =
- (VkDisplayFormatPropertiesWSI*) malloc(data_size);
- err = demo->fpGetDisplayInfoWSI(display, VK_DISPLAY_INFO_TYPE_FORMAT_PROPERTIES_WSI,
- &data_size, display_format_props);
- // For now, simply use the first VkFormat (TODO: Enhance this for the
- // future):
- demo->format = display_format_props[0].swapChainFormat;
}
static void demo_init_connection(struct demo *demo)
VK_FORMAT_B8G8R8A8_UNORM,
};
+#if 0
ICD_EXPORT VkResult VKAPI vkGetDisplayInfoWSI(
VkDisplayWSI display,
VkDisplayInfoTypeWSI infoType,
return ret;
}
+#endif
ICD_EXPORT VkResult VKAPI vkCreateSwapChainWSI(
VkDevice device,
/* PFN_vkGetGlobalExtensionInfo GetGlobalExtensionInfo; non-dispatchable */
PFN_vkGetPhysicalDeviceExtensionInfo GetPhysicalDeviceExtensionInfo;
PFN_vkGetMultiDeviceCompatibility GetMultiDeviceCompatibility;
- PFN_vkGetDisplayInfoWSI GetDisplayInfoWSI;
PFN_vkDbgCreateMsgCallback DbgCreateMsgCallback;
PFN_vkDbgDestroyMsgCallback DbgDestroyMsgCallback;
PFN_vkDbgStringCallback DbgStringCallback;
// ------------------------------------------------------------------------------------------------
// Enumerations
-typedef enum VkDisplayInfoTypeWSI_
-{
- // Info type for vkGetDisplayInfo()
- VK_DISPLAY_INFO_TYPE_FORMAT_PROPERTIES_WSI = 0x00000003, // Return the VkFormat(s) supported for swap chains with the display
-
- VK_ENUM_RANGE(DISPLAY_INFO_TYPE, FORMAT_PROPERTIES_WSI, FORMAT_PROPERTIES_WSI)
-} VkDisplayInfoTypeWSI;
typedef enum VkSwapChainInfoTypeWSI_
{
// ------------------------------------------------------------------------------------------------
// Function types
-typedef VkResult (VKAPI *PFN_vkGetDisplayInfoWSI)(VkDisplayWSI display, VkDisplayInfoTypeWSI infoType, size_t* pDataSize, void* pData);
typedef VkResult (VKAPI *PFN_vkCreateSwapChainWSI)(VkDevice device, const VkSwapChainCreateInfoWSI* pCreateInfo, VkSwapChainWSI* pSwapChain);
typedef VkResult (VKAPI *PFN_vkDestroySwapChainWSI)(VkSwapChainWSI swapChain);
typedef VkResult (VKAPI *PFN_vkGetSwapChainInfoWSI)(VkSwapChainWSI swapChain, VkSwapChainInfoTypeWSI infoType, size_t* pDataSize, void* pData);
#ifdef VK_PROTOTYPES
-VkResult VKAPI vkGetDisplayInfoWSI(
- VkDisplayWSI display,
- VkDisplayInfoTypeWSI infoType,
- size_t* pDataSize,
- void* pData);
VkResult VKAPI vkCreateSwapChainWSI(
VkDevice device,
debug_marker_dispatch_table(device)->DbgSetObjectName(device, objType, object, nameSize, pName);
}
-VK_LAYER_EXPORT VkResult VKAPI vkGetDisplayInfoWSI(VkDisplayWSI display, VkDisplayInfoTypeWSI infoType, size_t* pDataSize, void* pData)
-{
- VkResult result = instance_dispatch_table(display)->GetDisplayInfoWSI(display, infoType, pDataSize, pData);
- return result;
-}
-
VK_LAYER_EXPORT VkResult VKAPI vkCreateSwapChainWSI(VkDevice device, const VkSwapChainCreateInfoWSI* pCreateInfo, VkSwapChainWSI* pSwapChain)
{
VkResult result = device_dispatch_table(device)->CreateSwapChainWSI(device, pCreateInfo, pSwapChain);
return (void*) vkCmdBeginRenderPass;
if (!strcmp(name, "CmdEndRenderPass"))
return (void*) vkCmdEndRenderPass;
- if (!strcmp(name, "GetDisplayInfoWSI"))
- return (void*) vkGetDisplayInfoWSI;
if (!strcmp(name, "CreateSwapChainWSI"))
return (void*) vkCreateSwapChainWSI;
if (!strcmp(name, "DestroySwapChainWSI"))
.CreateDevice = loader_CreateDevice,
.GetPhysicalDeviceExtensionInfo = loader_GetPhysicalDeviceExtensionInfo,
.GetMultiDeviceCompatibility = loader_GetMultiDeviceCompatibility,
- .GetDisplayInfoWSI = loader_GetDisplayInfoWSI,
.DbgCreateMsgCallback = loader_DbgCreateMsgCallback,
.DbgDestroyMsgCallback = loader_DbgDestroyMsgCallback,
};
LOOKUP(CreateDevice);
LOOKUP(GetPhysicalDeviceExtensionInfo);
LOOKUP(GetMultiDeviceCompatibility);
- LOOKUP(GetDisplayInfoWSI);
LOOKUP(DbgCreateMsgCallback);
LOOKUP(DbgDestroyMsgCallback);
#undef LOOKUP
PFN_vkCreateDevice CreateDevice;
PFN_vkGetPhysicalDeviceExtensionInfo GetPhysicalDeviceExtensionInfo;
PFN_vkGetMultiDeviceCompatibility GetMultiDeviceCompatibility;
- PFN_vkGetDisplayInfoWSI GetDisplayInfoWSI;
PFN_vkDbgCreateMsgCallback DbgCreateMsgCallback;
PFN_vkDbgDestroyMsgCallback DbgDestroyMsgCallback;
/*
table->CreateDevice = (PFN_vkCreateDevice) gpa(inst, "vkCreateDevice");
table->GetPhysicalDeviceExtensionInfo = (PFN_vkGetPhysicalDeviceExtensionInfo) gpa(inst, "vkGetPhysicalDeviceExtensionInfo");
table->GetMultiDeviceCompatibility = (PFN_vkGetMultiDeviceCompatibility) gpa(inst, "vkGetMultiDeviceCompatibility");
- table->GetDisplayInfoWSI = (PFN_vkGetDisplayInfoWSI) gpa(inst, "vkGetDisplayInfoWSI");
}
static inline void loader_init_instance_extension_dispatch_table(
return (void *) table->GetPhysicalDeviceExtensionInfo;
if (!strcmp(name, "GetMultiDeviceCompatibility"))
return (void *) table->GetMultiDeviceCompatibility;
- if (!strcmp(name, "GetDisplayInfoWSI"))
- return (void *) table->GetDisplayInfoWSI;
if (!strcmp(name, "DbgCreateMsgCallback"))
return (void *) table->DbgCreateMsgCallback;
if (!strcmp(name, "DbgDestroyMsgCallback"))
/************ Trampoline entrypoints *******************/
/* since one entrypoint is instance level will make available all entrypoints */
-VkResult VKAPI wsi_lunarg_GetDisplayInfoWSI(
- VkDisplayWSI display,
- VkDisplayInfoTypeWSI infoType,
- size_t* pDataSize,
- void* pData)
-{
- const VkLayerInstanceDispatchTable *disp;
- VkResult res;
-
- disp = loader_get_instance_dispatch(display);
-
- loader_platform_thread_lock_mutex(&loader_lock);
- res = disp->GetDisplayInfoWSI(display, infoType, pDataSize, pData);
- loader_platform_thread_unlock_mutex(&loader_lock);
- return res;
-}
+/* TODO make this a device extension with NO trampoline code */
VkResult wsi_lunarg_CreateSwapChainWSI(
VkDevice device,
return disp->QueuePresentWSI(queue, pPresentInfo);
}
-/************ loader instance chain termination entrypoints ***************/
-VkResult loader_GetDisplayInfoWSI(
- VkDisplayWSI display,
- VkDisplayInfoTypeWSI infoType,
- size_t* pDataSize,
- void* pData)
-{
- /* TODO: need another way to find the icd, display is not a gpu object */
-// uint32_t gpu_index;
-// struct loader_icd *icd = loader_get_icd((VkPhysicalDevice) display, &gpu_index); //TODO fix dispaly -> PhysDev
- VkResult res = VK_ERROR_INITIALIZATION_FAILED;
-
- for (struct loader_instance *inst = loader.instances; inst; inst = inst->next) {
- for (struct loader_icd *icd = inst->icds; icd; icd = icd->next) {
- for (uint32_t i = 0; i < icd->gpu_count; i++) {
- if (icd->GetDisplayInfoWSI)
- res = icd->GetDisplayInfoWSI(display, infoType, pDataSize, pData);
- }
- }
- }
-
- return res;
-}
-
-
/************ extension enablement ***************/
#define WSI_LUNARG_EXT_ARRAY_SIZE 1
static const struct loader_extension_property wsi_lunarg_extension_info = {
if (instance == VK_NULL_HANDLE)
return NULL;
- /* since two of these entrypoints must be loader handled will report all */
- if (!strcmp(pName, "vkGetDisplayInfoWSI"))
- return (void*) wsi_lunarg_GetDisplayInfoWSI;
+ /* since one of these entrypoints must be loader handled will report all */
if (!strcmp(pName, "vkCreateSwapChainWSI"))
return (void*) wsi_lunarg_CreateSwapChainWSI;
if (!strcmp(pName, "vkDestroySwapChainWSI"))
#include "vk_wsi_lunarg.h"
-VkResult loader_GetDisplayInfoWSI(
- VkDisplayWSI display,
- VkDisplayInfoTypeWSI infoType,
- size_t* pDataSize,
- void* pData);
-
void wsi_lunarg_add_instance_extensions(
struct loader_extension_list *ext_list);
stmts.append("// GPA has to be first entry inited and uses wrapped object since it triggers init")
stmts.append("table->GetDeviceProcAddr =(PFN_vkGetDeviceProcAddr) gpa(device,\"vkGetDeviceProcAddr\");")
for proto in self.protos:
- if proto.name == "CreateInstance" or proto.name == "GetGlobalExtensionInfo" or proto.name == "GetDisplayInfoWSI" or proto.params[0].ty == "VkInstance" or proto.params[0].ty == "VkPhysicalDevice":
+ if proto.name == "CreateInstance" or proto.name == "GetGlobalExtensionInfo" or proto.params[0].ty == "VkInstance" or proto.params[0].ty == "VkPhysicalDevice":
continue
if proto.name != "GetDeviceProcAddr":
stmts.append("table->%s = (PFN_vk%s) gpa(baseDevice, \"vk%s\");" %
stmts.append("// GPA has to be first entry inited and uses wrapped object since it triggers init")
stmts.append("table->GetInstanceProcAddr =(PFN_vkGetInstanceProcAddr) gpa(instance,\"vkGetInstanceProcAddr\");")
for proto in self.protos:
- if proto.name != "CreateInstance" and proto.name != "GetDisplayInfoWSI" and proto.params[0].ty != "VkInstance" and proto.params[0].ty != "VkPhysicalDevice":
+ if proto.name != "CreateInstance" and proto.params[0].ty != "VkInstance" and proto.params[0].ty != "VkPhysicalDevice":
continue
if proto.name != "GetInstanceProcAddr":
stmts.append("table->%s = (PFN_vk%s) gpa(baseInstance, \"vk%s\");" %
import vk_helper
def proto_is_global(proto):
- if proto.params[0].ty == "VkInstance" or proto.params[0].ty == "VkPhysicalDevice" or proto.name == "CreateInstance" or proto.name == "GetGlobalExtensionInfo" or proto.name == "GetPhysicalDeviceExtensionInfo" or proto.name == "GetDisplayInfoWSI":
+ if proto.params[0].ty == "VkInstance" or proto.params[0].ty == "VkPhysicalDevice" or proto.name == "CreateInstance" or proto.name == "GetGlobalExtensionInfo" or proto.name == "GetPhysicalDeviceExtensionInfo":
return True
else:
return False
"VkDbgMsgCallback",
],
protos=[
- Proto("VkResult", "GetDisplayInfoWSI",
- [Param("VkDisplayWSI", "display"),
- Param("VkDisplayInfoTypeWSI", "infoType"),
- Param("size_t*", "pDataSize"),
- Param("void*", "pData")]),
-
Proto("VkResult", "CreateSwapChainWSI",
[Param("VkDevice", "device"),
Param("const VkSwapChainCreateInfoWSI*", "pCreateInfo"),