diff --git a/examples/gltfloading/gltfloading.cpp b/examples/gltfloading/gltfloading.cpp index b71a3edf..c2144ded 100644 --- a/examples/gltfloading/gltfloading.cpp +++ b/examples/gltfloading/gltfloading.cpp @@ -17,7 +17,7 @@ * If you are looking for a complete glTF implementation, check out https://github.com/SaschaWillems/Vulkan-glTF-PBR/ */ -//#define TINYGLTF_IMPLEMENTATION // SRS - Already defined in VulkanglTFModel.cpp +#define TINYGLTF_IMPLEMENTATION #define STB_IMAGE_IMPLEMENTATION #define TINYGLTF_NO_STB_IMAGE_WRITE #ifdef VK_USE_PLATFORM_ANDROID_KHR diff --git a/examples/gltfscenerendering/gltfscenerendering.h b/examples/gltfscenerendering/gltfscenerendering.h index 357463fc..e02abfe6 100644 --- a/examples/gltfscenerendering/gltfscenerendering.h +++ b/examples/gltfscenerendering/gltfscenerendering.h @@ -12,10 +12,10 @@ * This sample comes with a tutorial, see the README.md in this folder */ -//#define TINYGLTF_IMPLEMENTATION // SRS - Already defined in VulkanglTFModel.cpp +#define TINYGLTF_IMPLEMENTATION #define STB_IMAGE_IMPLEMENTATION #define TINYGLTF_NO_STB_IMAGE_WRITE -#define TINYGLTF_NO_STB_IMAGE +//#define TINYGLTF_NO_STB_IMAGE // SRS - Comment out to enable default image loader, otherwise LoadImageData() is undefined #define TINYGLTF_NO_EXTERNAL_IMAGE #ifdef VK_USE_PLATFORM_ANDROID_KHR #define TINYGLTF_ANDROID_LOAD_FROM_ASSETS diff --git a/examples/gltfskinning/gltfskinning.h b/examples/gltfskinning/gltfskinning.h index e60317fc..9423c01c 100644 --- a/examples/gltfskinning/gltfskinning.h +++ b/examples/gltfskinning/gltfskinning.h @@ -27,7 +27,7 @@ #include #include -//#define TINYGLTF_IMPLEMENTATION // SRS - Already defined in VulkanglTFModel.cpp +#define TINYGLTF_IMPLEMENTATION #define STB_IMAGE_IMPLEMENTATION #define TINYGLTF_NO_STB_IMAGE_WRITE #ifdef VK_USE_PLATFORM_ANDROID_KHR diff --git a/examples/triangle/triangle.cpp b/examples/triangle/triangle.cpp index 77e4df8f..4a6336f7 100644 --- a/examples/triangle/triangle.cpp +++ b/examples/triangle/triangle.cpp @@ -335,7 +335,10 @@ public: void draw() { // Get next image in the swap chain (back/front buffer) - VK_CHECK_RESULT(swapChain.acquireNextImage(presentCompleteSemaphore, ¤tBuffer)); + VkResult acquire = swapChain.acquireNextImage(presentCompleteSemaphore, ¤tBuffer); + if (!((acquire == VK_SUCCESS) || (acquire == VK_SUBOPTIMAL_KHR))) { + VK_CHECK_RESULT(acquire); + } // Use a fence to wait until the command buffer has finished execution before using it again VK_CHECK_RESULT(vkWaitForFences(device, 1, &waitFences[currentBuffer], VK_TRUE, UINT64_MAX)); diff --git a/examples/vertexattributes/vertexattributes.h b/examples/vertexattributes/vertexattributes.h index af480ab0..97abf1b3 100644 --- a/examples/vertexattributes/vertexattributes.h +++ b/examples/vertexattributes/vertexattributes.h @@ -9,7 +9,7 @@ #define TINYGLTF_IMPLEMENTATION #define STB_IMAGE_IMPLEMENTATION #define TINYGLTF_NO_STB_IMAGE_WRITE -#define TINYGLTF_NO_STB_IMAGE +//#define TINYGLTF_NO_STB_IMAGE // SRS - Comment out to enable default image loader, otherwise LoadImageData() is undefined #define TINYGLTF_NO_EXTERNAL_IMAGE #ifdef VK_USE_PLATFORM_ANDROID_KHR #define TINYGLTF_ANDROID_LOAD_FROM_ASSETS @@ -140,4 +140,4 @@ public: void drawSceneNode(VkCommandBuffer commandBuffer, Node node); virtual void render(); virtual void OnUpdateUIOverlay(vks::UIOverlay* overlay); -}; \ No newline at end of file +}; diff --git a/xcode/examples.h b/xcode/examples.h index 5ae4ca77..68182c49 100644 --- a/xcode/examples.h +++ b/xcode/examples.h @@ -27,7 +27,13 @@ // In the list below, the comments indicate entries that, // under certain conditions, that may not run as expected. -#define MVK_gltfskinning +#define MVK_vulkanscene + +// COMMON - Include VulkanglTFModel.cpp in all examples other than ones that already include/customize tiny_gltf.h directly +#if !defined(MVK_gltfloading) && !defined(MVK_gltfskinning) && !defined(MVK_gltfscenerendering) && !defined(MVK_vertexattributes) +#include "../base/VulkanglTFModel.cpp" +#endif + // BASICS @@ -107,7 +113,7 @@ # include "../examples/particlefire/particlefire.cpp" #endif -// Does not run - build issue on macOS. +// Build issue when using this xcode examples project, builds/runs fine using vulkanExamples project. #ifdef MVK_renderheadless # include "../examples/renderheadless/renderheadless.cpp" #endif @@ -119,7 +125,6 @@ # include "../examples/multithreading/multithreading.cpp" #endif -// Runs but cannot load gltf file from asset pack. #ifdef MVK_gltfscenerendering # include "../examples/gltfscenerendering/gltfscenerendering.cpp" #endif @@ -181,7 +186,11 @@ # include "../examples/bloom/bloom.cpp" #endif -// Runs but nothing displays. +#ifdef MVK_vertexattributes +# include "../examples/vertexattributes/vertexattributes.cpp" +#endif + +// Runs but nothing displays. MoltenVK format VK_FORMAT_R32_UINT doesn't contain VK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT #ifdef MVK_oit # include "../examples/oit/oit.cpp" #endif @@ -193,11 +202,6 @@ # include "../examples/deferred/deferred.cpp" #endif -// Does not run. Metal does not support geometry shaders. -#ifdef MVK_deferredshadows -# include "../examples/deferredshadows/deferredshadows.cpp" -#endif - #ifdef MVK_deferredmultisampling # include "../examples/deferredmultisampling/deferredmultisampling.cpp" #endif @@ -292,7 +296,7 @@ # include "../examples/computecloth/computecloth.cpp" #endif -// Does not run - build issue on macOS. +// Build issue when using this xcode examples project, builds/runs fine using vulkanExamples project. #ifdef MVK_computeheadless # include "../examples/computeheadless/computeheadless.cpp" #endif @@ -320,6 +324,11 @@ # include "../examples/geometryshader/geometryshader.cpp" #endif +// Does not run. Metal does not support geometry shaders. +#ifdef MVK_deferredshadows +# include "../examples/deferredshadows/deferredshadows.cpp" +#endif + // Does not run. Metal does not support geometry shaders. #ifdef MVK_viewportarray # include "../examples/viewportarray/viewportarray.cpp" @@ -343,6 +352,16 @@ # include "../examples/variablerateshading/variablerateshading.cpp" #endif +// Does not run. Requires VK_KHR_pipeline_library and VK_EXT_graphics_pipeline_library. +#ifdef MVK_graphicspipelinelibrary +# include "../examples/graphicspipelinelibrary/graphicspipelinelibrary.cpp" +#endif + +// Does not run yet. Requires VK_KHR_dynamic_rendering (under development in MoltenVK) +#ifdef MVK_dynamicrendering +# include "../examples/dynamicrendering/dynamicrendering.cpp" +#endif + // Runs. Requires VK_EXT_debug_marker. #ifdef MVK_debugmarker # include "../examples/debugmarker/debugmarker.cpp" diff --git a/xcode/examples.xcodeproj/project.pbxproj b/xcode/examples.xcodeproj/project.pbxproj index 501c306e..173ea0da 100644 --- a/xcode/examples.xcodeproj/project.pbxproj +++ b/xcode/examples.xcodeproj/project.pbxproj @@ -38,8 +38,6 @@ AA54A1B526E5274500485C4A /* VulkanBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AA54A1B226E5274500485C4A /* VulkanBuffer.cpp */; }; AA54A1B826E5275300485C4A /* VulkanDevice.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AA54A1B626E5275300485C4A /* VulkanDevice.cpp */; }; AA54A1B926E5275300485C4A /* VulkanDevice.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AA54A1B626E5275300485C4A /* VulkanDevice.cpp */; }; - AA54A1BC26E5276000485C4A /* VulkanglTFModel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AA54A1BA26E5276000485C4A /* VulkanglTFModel.cpp */; }; - AA54A1BD26E5276000485C4A /* VulkanglTFModel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AA54A1BA26E5276000485C4A /* VulkanglTFModel.cpp */; }; AA54A1C026E5276C00485C4A /* VulkanSwapChain.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AA54A1BF26E5276C00485C4A /* VulkanSwapChain.cpp */; }; AA54A1C126E5276C00485C4A /* VulkanSwapChain.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AA54A1BF26E5276C00485C4A /* VulkanSwapChain.cpp */; }; AA54A1C426E5277600485C4A /* VulkanTexture.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AA54A1C326E5277600485C4A /* VulkanTexture.cpp */; }; @@ -574,7 +572,6 @@ AAB0D0BF26F24001005DC611 /* VulkanRaytracingSample.cpp in Sources */, C9788FD52044D78D00AB0892 /* VulkanAndroid.cpp in Sources */, A951FF1B1E9C349000FA9144 /* VulkanTools.cpp in Sources */, - AA54A1BC26E5276000485C4A /* VulkanglTFModel.cpp in Sources */, AA54A6CC26E52CE300485C4A /* hashlist.c in Sources */, A951FF191E9C349000FA9144 /* vulkanexamplebase.cpp in Sources */, AA54A1B426E5274500485C4A /* VulkanBuffer.cpp in Sources */, @@ -605,7 +602,6 @@ AA54A6C326E52CE300485C4A /* writer.c in Sources */, AA54A1B926E5275300485C4A /* VulkanDevice.cpp in Sources */, AA54A6DF26E52CE400485C4A /* imgui_widgets.cpp in Sources */, - AA54A1BD26E5276000485C4A /* VulkanglTFModel.cpp in Sources */, A951FF181E9C349000FA9144 /* VulkanDebug.cpp in Sources */, AA54A6CB26E52CE300485C4A /* texture.c in Sources */, AAB0D0C026F24001005DC611 /* VulkanRaytracingSample.cpp in Sources */,