aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Elliott <ian@LunarG.com>2015-04-28 11:35:02 -0600
committerCourtney Goeltzenleuchter <courtney@LunarG.com>2015-04-29 11:25:22 -0600
commit0726413b1b04a1a2a83c5f4c490b8277be4b0bc0 (patch)
treed1f44a563e76f04743b1e65ded7b9701c0521092
parent44e33f7731d2e810e4d6c57f836f4fd2cfc296f2 (diff)
downloadusermoji-0726413b1b04a1a2a83c5f4c490b8277be4b0bc0.tar.xz
demos: Improve tri/cube error if incompatible driver found.
-rw-r--r--demos/cube.c46
-rw-r--r--demos/tri.c40
2 files changed, 62 insertions, 24 deletions
diff --git a/demos/cube.c b/demos/cube.c
index 645de5e2..b126a7a0 100644
--- a/demos/cube.c
+++ b/demos/cube.c
@@ -33,6 +33,28 @@
#define U_ASSERT_ONLY
#endif
+#ifdef _WIN32
+#define ERR_EXIT(err_msg, err_class) \
+ do { \
+ MessageBox(NULL, err_msg, err_class, MB_OK); \
+ exit(1); \
+ } while (0)
+
+// NOTE: If the following values (copied from "loader_platform.h") change, they
+// need to change here as well:
+#define LAYER_NAMES_ENV "VK_LAYER_NAMES"
+#define LAYER_NAMES_REGISTRY_VALUE "VK_LAYER_NAMES"
+
+#else // _WIN32
+
+#define ERR_EXIT(err_msg, err_class) \
+ do { \
+ printf(err_msg); \
+ fflush(stdout); \
+ exit(1); \
+ } while (0)
+#endif // _WIN32
+
/*
* structure to track all objects related to a texture.
*/
@@ -1632,13 +1654,9 @@ LRESULT CALLBACK WndProc(HWND hWnd,
WPARAM wParam,
LPARAM lParam)
{
-<<<<<<< HEAD
- char tmp_str[] = "Test Vulkan Cube Program";
-=======
PAINTSTRUCT paint_struct;
HDC hDC; // Device context
char tmp_str[] = APP_LONG_NAME;
->>>>>>> 7224550... demos: Use macros for the app name, and window name.
switch(uMsg)
{
@@ -1864,16 +1882,16 @@ static void demo_init_vk(struct demo *demo)
uint32_t queue_count;
err = vkCreateInstance(&inst_info, &demo->inst);
- if (err) {
-#ifdef _WIN32
- MessageBox(NULL, "vkCreateInstance failed - do you have a Vulkan graphics driver installed?",
- "vkCreateInstance Failure", MB_OK);
-#else
- printf("vkCreateInstance failed - Do you have a Vulkan graphics driver installed?"
- "(\nExiting ...\n");
- fflush(stdout);
-#endif
- exit(1);
+ if (err == VK_ERROR_INCOMPATIBLE_DRIVER) {
+ ERR_EXIT("Cannot find a compatible Vulkan installable client driver "
+ "(ICD).\nPlease look at the Getting Started guide for "
+ "additional information.\n",
+ "vkCreateInstance Failure");
+ } else if (err) {
+ ERR_EXIT("vkCreateInstance failed. Do you have a compatible Vulkan "
+ "installable client driver (ICD) installed. Please look at "
+ "the Getting Started guide for additional information.\n",
+ "vkCreateInstance Failure");
}
gpu_count = 1;
diff --git a/demos/tri.c b/demos/tri.c
index 9611a34c..00392613 100644
--- a/demos/tri.c
+++ b/demos/tri.c
@@ -59,6 +59,26 @@
#define U_ASSERT_ONLY
#endif
+#ifdef _WIN32
+#define ERR_EXIT(err_msg, err_class) \
+ do { \
+ MessageBox(NULL, err_msg, err_class, MB_OK); \
+ exit(1); \
+ } while (0)
+
+// NOTE: If the following values (copied from "loader_platform.h") change, they
+// need to change here as well:
+#define LAYER_NAMES_ENV "VK_LAYER_NAMES"
+#define LAYER_NAMES_REGISTRY_VALUE "VK_LAYER_NAMES"
+#else // _WIN32
+
+#define ERR_EXIT(err_msg, err_class) \
+ do { \
+ printf(err_msg); \
+ fflush(stdout); \
+ exit(1); \
+ } while (0)
+#endif // _WIN32
struct texture_object {
VkSampler sampler;
@@ -1407,16 +1427,16 @@ static void demo_init_vk(struct demo *demo)
uint32_t queue_count;
err = vkCreateInstance(&inst_info, &demo->inst);
- if (err) {
-#ifdef _WIN32
- MessageBox(NULL, "vkCreateInstance failed - do you have a Vulkan graphics driver installed?",
- "vkCreateInstance Failure", MB_OK);
-#else
- printf("vkCreateInstance failed - Do you have a Vulkan graphics driver installed?"
- "(\nExiting ...\n");
- fflush(stdout);
-#endif
- exit(1);
+ if (err == VK_ERROR_INCOMPATIBLE_DRIVER) {
+ ERR_EXIT("Cannot find a compatible Vulkan installable client driver "
+ "(ICD).\nPlease look at the Getting Started guide for "
+ "additional information.\n",
+ "vkCreateInstance Failure");
+ } else if (err) {
+ ERR_EXIT("vkCreateInstance failed. Do you have a compatible Vulkan "
+ "installable client driver (ICD) installed. Please look at "
+ "the Getting Started guide for additional information.\n",
+ "vkCreateInstance Failure");
}
gpu_count = 1;