From c09a8fb6ae7026a73171388ba9789ad6f86b7e29 Mon Sep 17 00:00:00 2001 From: rokuz Date: Thu, 28 Dec 2023 08:35:07 +0000 Subject: [PATCH] Fix TinyMesh_Large demo for macOS --- samples/Tiny_MeshLarge.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/samples/Tiny_MeshLarge.cpp b/samples/Tiny_MeshLarge.cpp index 29cbc32f2f4..7d8aadcb38b 100644 --- a/samples/Tiny_MeshLarge.cpp +++ b/samples/Tiny_MeshLarge.cpp @@ -51,18 +51,17 @@ #include -#ifdef __APPLE__ -#warning Not supported. Currently Vulkan 1.2 + extensions are available in MoltenVK. -// Known issues: https://github.com/KhronosGroup/MoltenVK/issues/2011 -#endif - constexpr uint32_t kMeshCacheVersion = 0xC0DE0009; #ifndef __APPLE__ constexpr int kNumSamplesMSAA = 8; #else constexpr int kNumSamplesMSAA = 4; #endif +#ifdef __APPLE__ +constexpr bool kEnableCompression = false; +#else constexpr bool kEnableCompression = true; +#endif constexpr bool kPreferIntegratedGPU = false; #if defined(NDEBUG) constexpr bool kEnableValidationLayers = false; @@ -95,8 +94,10 @@ double timestampEndRendering = 0; const char* kCodeComputeTest = R"( layout(local_size_x = 16, local_size_y = 16, local_size_z = 1) in; -layout (set = 0, binding = 2, rgba8) uniform readonly image2D kTextures2Din[]; -layout (set = 0, binding = 2, rgba8) uniform writeonly image2D kTextures2Dout[]; +// https://github.com/KhronosGroup/MoltenVK/issues/2106 +// TODO: set binding = 2 to be compatible with Vulkan image layout on other platforms. +layout (set = 0, binding = 0, rgba8) uniform readonly image2D kTextures2Din[]; +layout (set = 1, binding = 0, rgba8) uniform writeonly image2D kTextures2Dout[]; layout(push_constant) uniform constants { uint tex; @@ -1729,9 +1730,7 @@ lvk::TextureHandle createTexture(const LoadedImage& img) { }, nullptr); - if (!hasCompressedTexture) { - ctx_->generateMipmap(tex); - } + ctx_->generateMipmap(tex); lvk::TextureHandle handle = tex;