Fix glTF build & settings issues for macOS, fix triangle example resizing, update macOS examples.h file

(cherry picked from commit 47061ff99446d8826ebe7fe187467ba638236a70)
This commit is contained in:
Stephen Saunders 2022-05-09 14:09:47 -04:00
parent b1f10d7393
commit 2810087752
7 changed files with 39 additions and 21 deletions

View file

@ -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

View file

@ -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

View file

@ -27,7 +27,7 @@
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>
//#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

View file

@ -335,7 +335,10 @@ public:
void draw()
{
// Get next image in the swap chain (back/front buffer)
VK_CHECK_RESULT(swapChain.acquireNextImage(presentCompleteSemaphore, &currentBuffer));
VkResult acquire = swapChain.acquireNextImage(presentCompleteSemaphore, &currentBuffer);
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));

View file

@ -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

View file

@ -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"

View file

@ -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 */,