aboutsummaryrefslogtreecommitdiffstats
path: root/examples/pugl_vulkan_cpp_demo.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2022-05-20 10:41:34 -0400
committerDavid Robillard <d@drobilla.net>2022-05-20 13:17:45 -0400
commit1118da579607bac768ae953fecadb6153818488d (patch)
tree67ff1ae9f7400be070ee30284b5d0bcdbb834b22 /examples/pugl_vulkan_cpp_demo.cpp
parentd6ad1b79b97974ad3e3bd2a1b2c7474f0dd797b0 (diff)
downloadpugl-1118da579607bac768ae953fecadb6153818488d.tar.gz
pugl-1118da579607bac768ae953fecadb6153818488d.tar.bz2
pugl-1118da579607bac768ae953fecadb6153818488d.zip
MacOS: Build examples as application bundles
This is required on MacOS to make the examples usable. When run as bare programs, they don't show up as normal windows or receive keyboard input.
Diffstat (limited to 'examples/pugl_vulkan_cpp_demo.cpp')
-rw-r--r--examples/pugl_vulkan_cpp_demo.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/examples/pugl_vulkan_cpp_demo.cpp b/examples/pugl_vulkan_cpp_demo.cpp
index 0b34c81..6ed3885 100644
--- a/examples/pugl_vulkan_cpp_demo.cpp
+++ b/examples/pugl_vulkan_cpp_demo.cpp
@@ -42,6 +42,12 @@
#include <string>
#include <vector>
+#ifdef __APPLE__
+# define SHADER_DIR "../"
+#else
+# define SHADER_DIR "shaders/"
+#endif
+
namespace {
constexpr uintptr_t resizeTimerId = 1u;
@@ -712,9 +718,11 @@ RectShaders::init(const sk::VulkanApi& vk,
const GraphicsDevice& gpu,
const std::string& programPath)
{
- auto vertShaderCode = readFile(programPath.c_str(), "shaders/rect.vert.spv");
+ auto vertShaderCode =
+ readFile(programPath.c_str(), SHADER_DIR "rect.vert.spv");
- auto fragShaderCode = readFile(programPath.c_str(), "shaders/rect.frag.spv");
+ auto fragShaderCode =
+ readFile(programPath.c_str(), SHADER_DIR "rect.frag.spv");
if (vertShaderCode.empty() || fragShaderCode.empty()) {
return VK_ERROR_INITIALIZATION_FAILED;