aboutsummaryrefslogtreecommitdiff
path: root/cube/cube.cpp
diff options
context:
space:
mode:
authorMike Schuchardt <mikes@lunarg.com>2019-07-26 07:56:30 -0700
committerjeremyk-lunarg <jeremyk@lunarg.com>2019-07-26 10:24:37 -0600
commitaed62466ff5bb38ae39010888bc4859afbe1cf94 (patch)
treee9ab692c5f741e01b3ce237255c264d776a8a1d0 /cube/cube.cpp
parentaf4a7aec2deff253495b5e87c90ed07de44a6c3d (diff)
downloadusermoji-aed62466ff5bb38ae39010888bc4859afbe1cf94.tar.xz
cube: Workaround macOS cube issue
Latest version of MoltenVK behaves in an apparently non-conformant way by not allowing some linear images to be mapped to memory with VK_MEMORY_PROPERTY_HOST_COHERENT_BIT. This change sidesteps the issue by forcing the use of staging buffer for loading textures.
Diffstat (limited to 'cube/cube.cpp')
-rw-r--r--cube/cube.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/cube/cube.cpp b/cube/cube.cpp
index 04447fcd..a6f600c0 100644
--- a/cube/cube.cpp
+++ b/cube/cube.cpp
@@ -899,6 +899,12 @@ void Demo::init(int argc, char **argv) {
presentMode = vk::PresentModeKHR::eFifo;
frameCount = UINT32_MAX;
use_xlib = false;
+
+#if defined(VK_USE_PLATFORM_MACOS_MVK)
+ // MoltenVK may not allow host coherent mapping to linear tiled images
+ // Force the use of a staging buffer to be safe
+ use_staging_buffer = true;
+#endif
for (int i = 1; i < argc; i++) {
if (strcmp(argv[i], "--use_staging") == 0) {