aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Elliott <ianelliott@google.com>2015-11-20 13:08:34 -0700
committerJon Ashburn <jon@lunarg.com>2015-12-01 10:18:23 -0700
commitd3f7dcc6abb811167332db2c5797d9e78ddb4e23 (patch)
tree14a95e7cd82a7089c109dce6794248adafc7d141
parentb08e0d9d182645d8fa48ade8620de6d46a6b26f7 (diff)
downloadusermoji-d3f7dcc6abb811167332db2c5797d9e78ddb4e23.tar.xz
demos: Enabled the appropriate platform-specific WSI extension.
-rw-r--r--demos/cube.c36
-rw-r--r--demos/tri.c32
2 files changed, 58 insertions, 10 deletions
diff --git a/demos/cube.c b/demos/cube.c
index 49591ff2..66e7245e 100644
--- a/demos/cube.c
+++ b/demos/cube.c
@@ -2162,16 +2162,28 @@ static void demo_init_vk(struct demo *demo)
err = vkEnumerateInstanceExtensionProperties(NULL, &instance_extension_count, NULL);
assert(!err);
- VkBool32 swapchainExtFound = 0;
+ VkBool32 surfaceExtFound = 0;
+ VkBool32 platformSurfaceExtFound = 0;
memset(extension_names, 0, sizeof(extension_names));
instance_extensions = malloc(sizeof(VkExtensionProperties) * instance_extension_count);
err = vkEnumerateInstanceExtensionProperties(NULL, &instance_extension_count, instance_extensions);
assert(!err);
for (uint32_t i = 0; i < instance_extension_count; i++) {
if (!strcmp(VK_KHR_SURFACE_EXTENSION_NAME, instance_extensions[i].extensionName)) {
- swapchainExtFound = 1;
+ surfaceExtFound = 1;
extension_names[enabled_extension_count++] = VK_KHR_SURFACE_EXTENSION_NAME;
}
+#ifdef _WIN32
+ if (!strcmp(VK_KHR_WIN32_SURFACE_EXTENSION_NAME, instance_extensions[i].extensionName)) {
+ platformSurfaceExtFound = 1;
+ extension_names[enabled_extension_count++] = VK_KHR_WIN32_SURFACE_EXTENSION_NAME;
+ }
+#else // _WIN32
+ if (!strcmp(VK_KHR_XCB_SURFACE_EXTENSION_NAME, instance_extensions[i].extensionName)) {
+ platformSurfaceExtFound = 1;
+ extension_names[enabled_extension_count++] = VK_KHR_XCB_SURFACE_EXTENSION_NAME;
+ }
+#endif // _WIN32
if (!strcmp(VK_DEBUG_REPORT_EXTENSION_NAME, instance_extensions[i].extensionName)) {
if (demo->validate) {
extension_names[enabled_extension_count++] = VK_DEBUG_REPORT_EXTENSION_NAME;
@@ -2179,7 +2191,7 @@ static void demo_init_vk(struct demo *demo)
}
assert(enabled_extension_count < 64);
}
- if (!swapchainExtFound) {
+ if (!surfaceExtFound) {
ERR_EXIT("vkEnumerateInstanceExtensionProperties failed to find the "
VK_KHR_SURFACE_EXTENSION_NAME" extension.\n\nDo you have a compatible "
"Vulkan installable client driver (ICD) installed?\nPlease "
@@ -2187,6 +2199,18 @@ static void demo_init_vk(struct demo *demo)
"information.\n",
"vkCreateInstance Failure");
}
+ if (!platformSurfaceExtFound) {
+ ERR_EXIT("vkEnumerateInstanceExtensionProperties failed to find the "
+#ifdef _WIN32
+ VK_KHR_WIN32_SURFACE_EXTENSION_NAME" extension.\n\nDo you have a compatible "
+#else // _WIN32
+ VK_KHR_XCB_SURFACE_EXTENSION_NAME" extension.\n\nDo you have a compatible "
+#endif // _WIN32
+ "Vulkan installable client driver (ICD) installed?\nPlease "
+ "look at the Getting Started guide for additional "
+ "information.\n",
+ "vkCreateInstance Failure");
+ }
const VkApplicationInfo app = {
.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO,
.pNext = NULL,
@@ -2268,7 +2292,7 @@ static void demo_init_vk(struct demo *demo)
demo->gpu, NULL, &device_extension_count, NULL);
assert(!err);
- swapchainExtFound = 0;
+ VkBool32 swapchainExtFound = 0;
enabled_extension_count = 0;
memset(extension_names, 0, sizeof(extension_names));
device_extensions = malloc(sizeof(VkExtensionProperties) * device_extension_count);
@@ -2465,13 +2489,13 @@ static void demo_init_vk_swapchain(struct demo *demo)
// Get the list of VkFormat's that are supported:
uint32_t formatCount;
- err = demo->fpGetPhysicalDeviceSurfaceFormatsKHR(demo->device,
+ err = demo->fpGetPhysicalDeviceSurfaceFormatsKHR(demo->gpu,
demo->surface,
&formatCount, NULL);
assert(!err);
VkSurfaceFormatKHR *surfFormats =
(VkSurfaceFormatKHR *)malloc(formatCount * sizeof(VkSurfaceFormatKHR));
- err = demo->fpGetPhysicalDeviceSurfaceFormatsKHR(demo->device,
+ err = demo->fpGetPhysicalDeviceSurfaceFormatsKHR(demo->gpu,
demo->surface,
&formatCount, surfFormats);
assert(!err);
diff --git a/demos/tri.c b/demos/tri.c
index 67cfdd55..b9aeaabf 100644
--- a/demos/tri.c
+++ b/demos/tri.c
@@ -1757,16 +1757,28 @@ static void demo_init_vk(struct demo *demo)
err = vkEnumerateInstanceExtensionProperties(NULL, &instance_extension_count, NULL);
assert(!err);
- VkBool32 swapchainExtFound = 0;
+ VkBool32 surfaceExtFound = 0;
+ VkBool32 platformSurfaceExtFound = 0;
memset(extension_names, 0, sizeof(extension_names));
instance_extensions = malloc(sizeof(VkExtensionProperties) * instance_extension_count);
err = vkEnumerateInstanceExtensionProperties(NULL, &instance_extension_count, instance_extensions);
assert(!err);
for (uint32_t i = 0; i < instance_extension_count; i++) {
if (!strcmp(VK_KHR_SURFACE_EXTENSION_NAME, instance_extensions[i].extensionName)) {
- swapchainExtFound = 1;
+ surfaceExtFound = 1;
extension_names[enabled_extension_count++] = VK_KHR_SURFACE_EXTENSION_NAME;
}
+#ifdef _WIN32
+ if (!strcmp(VK_KHR_WIN32_SURFACE_EXTENSION_NAME, instance_extensions[i].extensionName)) {
+ platformSurfaceExtFound = 1;
+ extension_names[enabled_extension_count++] = VK_KHR_WIN32_SURFACE_EXTENSION_NAME;
+ }
+#else // _WIN32
+ if (!strcmp(VK_KHR_XCB_SURFACE_EXTENSION_NAME, instance_extensions[i].extensionName)) {
+ platformSurfaceExtFound = 1;
+ extension_names[enabled_extension_count++] = VK_KHR_XCB_SURFACE_EXTENSION_NAME;
+ }
+#endif // _WIN32
if (!strcmp(VK_DEBUG_REPORT_EXTENSION_NAME, instance_extensions[i].extensionName)) {
if (demo->validate) {
extension_names[enabled_extension_count++] = VK_DEBUG_REPORT_EXTENSION_NAME;
@@ -1774,7 +1786,7 @@ static void demo_init_vk(struct demo *demo)
}
assert(enabled_extension_count < 64);
}
- if (!swapchainExtFound) {
+ if (!surfaceExtFound) {
ERR_EXIT("vkEnumerateInstanceExtensionProperties failed to find the "
VK_KHR_SURFACE_EXTENSION_NAME" extension.\n\nDo you have a compatible "
"Vulkan installable client driver (ICD) installed?\nPlease "
@@ -1782,6 +1794,18 @@ static void demo_init_vk(struct demo *demo)
"information.\n",
"vkCreateInstance Failure");
}
+ if (!platformSurfaceExtFound) {
+ ERR_EXIT("vkEnumerateInstanceExtensionProperties failed to find the "
+#ifdef _WIN32
+ VK_KHR_WIN32_SURFACE_EXTENSION_NAME" extension.\n\nDo you have a compatible "
+#else // _WIN32
+ VK_KHR_XCB_SURFACE_EXTENSION_NAME" extension.\n\nDo you have a compatible "
+#endif // _WIN32
+ "Vulkan installable client driver (ICD) installed?\nPlease "
+ "look at the Getting Started guide for additional "
+ "information.\n",
+ "vkCreateInstance Failure");
+ }
const VkApplicationInfo app = {
.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO,
.pNext = NULL,
@@ -1873,7 +1897,7 @@ static void demo_init_vk(struct demo *demo)
demo->gpu, NULL, &device_extension_count, NULL);
assert(!err);
- swapchainExtFound = 0;
+ VkBool32 swapchainExtFound = 0;
enabled_extension_count = 0;
memset(extension_names, 0, sizeof(extension_names));
device_extensions = malloc(sizeof(VkExtensionProperties) * device_extension_count);