diff --git a/README.md b/README.md index 4a6e96f4..6635dca3 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,10 @@ Note that you need [assimp](https://github.com/assimp/assimp) in order to compil Building on Android is done using the [Android NDK](http://developer.android.com/tools/sdk/ndk/index.html) and requires a device that supports Vulkan. Please see the [Android readme](./android/README.md) on how to build and deploy the examples. +## [iOS and macOS](xcode/) + +Building for *iOS* and *macOS* is done using the [examples](xcode/examples.xcodeproj) *Xcode* project found in the [xcode](xcode) directory. These examples use the [**MoltenVK**](https://moltengl.com/moltenvk) Vulkan driver to provide Vulkan support on *iOS* and *macOS*, and require an *iOS* or *macOS* device that supports *Metal*. Please see the [MoltenVK Examples readme](xcode/README_MoltenVK_Examples.md) for more info on acquiring **MoltenVK** and building and deploying the examples on *iOS* and *macOS*. + ## Additional asset pack **Note:** Binary assets (textures, models) will no longer be added directly to the repository to keep it's size down, so newer examples will require the download of an [additional asset pack](data/README.md). diff --git a/base/keycodes.hpp b/base/keycodes.hpp index e3527b89..52181109 100644 --- a/base/keycodes.hpp +++ b/base/keycodes.hpp @@ -55,6 +55,7 @@ #elif defined(VK_USE_PLATFORM_IOS_MVK) // Use numeric keys instead of function keys. +// Use main keyboard plus/minus instead of keypad plus/minus // Use Delete key instead of Escape key. #define KEY_ESCAPE 0x33 #define KEY_F1 '1' @@ -77,8 +78,9 @@ #define KEY_T 't' #elif defined(VK_USE_PLATFORM_MACOS_MVK) -// For iOS UX compatibility: +// For compatibility with iOS UX and absent keypad on MacBook: // - Use numeric keys instead of function keys +// - Use main keyboard plus/minus instead of keypad plus/minus // - Use Delete key instead of Escape key #define KEY_ESCAPE 0x33 #define KEY_F1 0x12 @@ -91,8 +93,8 @@ #define KEY_D 0x02 #define KEY_P 0x23 #define KEY_SPACE 0x31 -#define KEY_KPADD 0x45 -#define KEY_KPSUB 0x4E +#define KEY_KPADD 0x18 +#define KEY_KPSUB 0x1B #define KEY_B 0x0B #define KEY_F 0x03 #define KEY_L 0x25 diff --git a/hdr/hdr.cpp b/hdr/hdr.cpp index c9133e07..3ad6f538 100644 --- a/hdr/hdr.cpp +++ b/hdr/hdr.cpp @@ -606,7 +606,7 @@ public: std::vector filenames = { "geosphere.obj", "teapot.dae", "torusknot.obj", "venus.fbx" }; for (auto file : filenames) { vks::Model model; - model.loadFromFile(ASSET_PATH "models/" + file, vertexLayout, 0.05f * (file == "venus.fbx" ? 3.0f : 1.0f), vulkanDevice, queue); + model.loadFromFile(getAssetPath() + "models/" + file, vertexLayout, 0.05f * (file == "venus.fbx" ? 3.0f : 1.0f), vulkanDevice, queue); models.objects.push_back(model); } // Load HDR cube map diff --git a/images/applelogo.png b/images/applelogo.png new file mode 100644 index 00000000..31f83b04 Binary files /dev/null and b/images/applelogo.png differ diff --git a/images/vulkanlogo.png b/images/vulkanlogo.png index c31b340c..09bbb868 100644 Binary files a/images/vulkanlogo.png and b/images/vulkanlogo.png differ diff --git a/libs/assimp/ios/libassimp.a b/libs/assimp/ios/libassimp.a deleted file mode 100644 index 33933f1d..00000000 Binary files a/libs/assimp/ios/libassimp.a and /dev/null differ diff --git a/libs/assimp/ios/libzlibstatic.a b/libs/assimp/ios/libzlibstatic.a deleted file mode 100644 index 49d2cf30..00000000 Binary files a/libs/assimp/ios/libzlibstatic.a and /dev/null differ diff --git a/libs/assimp/macos/libassimp.dylib b/libs/assimp/macos/libassimp.dylib deleted file mode 100755 index 308054fe..00000000 Binary files a/libs/assimp/macos/libassimp.dylib and /dev/null differ diff --git a/multisampling/multisampling.cpp b/multisampling/multisampling.cpp index aa6978d2..34851d2c 100644 --- a/multisampling/multisampling.cpp +++ b/multisampling/multisampling.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #define GLM_FORCE_RADIANS #define GLM_FORCE_DEPTH_ZERO_TO_ONE @@ -25,7 +26,6 @@ #define VERTEX_BUFFER_BIND_ID 0 #define ENABLE_VALIDATION false -#define SAMPLE_COUNT VK_SAMPLE_COUNT_8_BIT struct { struct { @@ -44,6 +44,7 @@ class VulkanExample : public VulkanExampleBase { public: bool useSampleShading = false; + VkSampleCountFlagBits sampleCount = VK_SAMPLE_COUNT_1_BIT; struct { vks::Texture2D colorMap; @@ -123,7 +124,7 @@ public: void setupMultisampleTarget() { // Check if device supports requested sample count for color and depth frame buffer - assert((deviceProperties.limits.framebufferColorSampleCounts >= SAMPLE_COUNT) && (deviceProperties.limits.framebufferDepthSampleCounts >= SAMPLE_COUNT)); + assert((deviceProperties.limits.framebufferColorSampleCounts >= sampleCount) && (deviceProperties.limits.framebufferDepthSampleCounts >= sampleCount)); // Color target VkImageCreateInfo info = vks::initializers::imageCreateInfo(); @@ -136,7 +137,7 @@ public: info.arrayLayers = 1; info.sharingMode = VK_SHARING_MODE_EXCLUSIVE; info.tiling = VK_IMAGE_TILING_OPTIMAL; - info.samples = SAMPLE_COUNT; + info.samples = sampleCount; // Image will only be used as a transient target info.usage = VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT | VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT; info.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED; @@ -184,7 +185,7 @@ public: info.arrayLayers = 1; info.sharingMode = VK_SHARING_MODE_EXCLUSIVE; info.tiling = VK_IMAGE_TILING_OPTIMAL; - info.samples = SAMPLE_COUNT; + info.samples = sampleCount; // Image will only be used as a transient target info.usage = VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT | VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT; info.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED; @@ -230,7 +231,7 @@ public: // Multisampled attachment that we render to attachments[0].format = swapChain.colorFormat; - attachments[0].samples = SAMPLE_COUNT; + attachments[0].samples = sampleCount; attachments[0].loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR; // No longer required after resolve, this may save some bandwidth on certain GPUs attachments[0].storeOp = VK_ATTACHMENT_STORE_OP_DONT_CARE; @@ -252,7 +253,7 @@ public: // Multisampled depth attachment we render to attachments[2].format = depthFormat; - attachments[2].samples = SAMPLE_COUNT; + attachments[2].samples = sampleCount; attachments[2].loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR; attachments[2].storeOp = VK_ATTACHMENT_STORE_OP_DONT_CARE; attachments[2].stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE; @@ -630,7 +631,7 @@ public: shaderStages[0] = loadShader(getAssetPath() + "shaders/mesh/mesh.vert.spv", VK_SHADER_STAGE_VERTEX_BIT); shaderStages[1] = loadShader(getAssetPath() + "shaders/mesh/mesh.frag.spv", VK_SHADER_STAGE_FRAGMENT_BIT); // Setup multi sampling - multisampleState.rasterizationSamples = SAMPLE_COUNT; // Number of samples to use for rasterization + multisampleState.rasterizationSamples = sampleCount; // Number of samples to use for rasterization VK_CHECK_RESULT(vkCreateGraphicsPipelines(device, pipelineCache, 1, &pipelineCreateInfo, nullptr, &pipelines.MSAA)); @@ -693,6 +694,7 @@ public: void prepare() { + setSampleCount(); VulkanExampleBase::prepare(); loadAssets(); setupVertexDescriptions(); @@ -733,6 +735,16 @@ public: break; } } + + // Determine the maximum sample count usable by the platform + void setSampleCount() + { + VkSampleCountFlags flags = std::min(deviceProperties.limits.framebufferColorSampleCounts, + deviceProperties.limits.framebufferDepthSampleCounts); + // Extract the value of the high-order bit of the flags + sampleCount = (VkSampleCountFlagBits)(flags ? (1 << (fls(flags) - 1)) : 0); + } + }; -VULKAN_EXAMPLE_MAIN() \ No newline at end of file +VULKAN_EXAMPLE_MAIN() diff --git a/texture/texture.cpp b/texture/texture.cpp index ffafd5b5..3e6e4d2f 100644 --- a/texture/texture.cpp +++ b/texture/texture.cpp @@ -179,7 +179,7 @@ public: void loadTexture() { // We use the Khronos texture format (https://www.khronos.org/opengles/sdk/tools/KTX/file_format_spec/) - std::string filename = ASSET_PATH "textures/metalplate01_rgba.ktx"; + std::string filename = getAssetPath() + "textures/metalplate01_rgba.ktx"; // Texture data contains 4 channels (RGBA) with unnormalized 8-bit values, this is the most commonly supported format VkFormat format = VK_FORMAT_R8G8B8A8_UNORM; diff --git a/xcode/MVKExample.cpp b/xcode/MVKExample.cpp new file mode 100644 index 00000000..6db1c1cd --- /dev/null +++ b/xcode/MVKExample.cpp @@ -0,0 +1,30 @@ +/* + * MVKExample.cpp + * + * Copyright (c) 2016-2017 The Brenwill Workshop Ltd. + * This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) + */ + + +#include "MVKExample.h" +#include "examples.h" + +void MVKExample::renderFrame() { + _vulkanExample->renderFrame(); +} + +void MVKExample::keyPressed(uint32_t keyCode) { + _vulkanExample->keyPressed(keyCode); +} + +MVKExample::MVKExample(void* view) { + _vulkanExample = new VulkanExample(); + _vulkanExample->initVulkan(); + _vulkanExample->setupWindow(view); + _vulkanExample->initSwapchain(); + _vulkanExample->prepare(); +} + +MVKExample::~MVKExample() { + delete _vulkanExample; +} diff --git a/xcode/MVKExample.h b/xcode/MVKExample.h new file mode 100644 index 00000000..93d921ec --- /dev/null +++ b/xcode/MVKExample.h @@ -0,0 +1,27 @@ +/* + * MVKExample.h + * + * Copyright (c) 2016-2017 The Brenwill Workshop Ltd. + * This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) + */ + +#pragma once + +#include "vulkanexamplebase.h" + +// Wrapper class for the SW VulkanExample instance. +class MVKExample { + +public: + void renderFrame(); + void keyPressed(uint32_t keyCode); + + MVKExample(void* view); + ~MVKExample(); + +protected: + VulkanExampleBase* _vulkanExample; +}; + + + diff --git a/xcode/README_MoltenVK_Examples.md b/xcode/README_MoltenVK_Examples.md index 6ce5d8dd..39d0f416 100755 --- a/xcode/README_MoltenVK_Examples.md +++ b/xcode/README_MoltenVK_Examples.md @@ -4,7 +4,8 @@ #MoltenVK Vulkan Examples -Copyright (c) 2014-2017 [The Brenwill Workshop Ltd.](http://www.brenwill.com) All rights reserved. +Copyright (c) 2016-2017 [The Brenwill Workshop Ltd.](http://www.brenwill.com). +This document is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) *This document is written in [Markdown](http://en.wikipedia.org/wiki/Markdown) format. For best results, use a Markdown reader.* @@ -27,6 +28,9 @@ Installing MoltenVK The examples in this repository can be run on *iOS* and *macOS* by using the [**MoltenVK**](http://www.moltengl.com/moltenvk/) *Vulkan* driver. + +These examples require **MoltenVK 0.18.0** or greater. + Follow these instructions to install **MoltenVK**: 1. [Download](https://moltengl.com/free-trial/) the **Molten** free evaluation trial. @@ -45,6 +49,72 @@ Follow these instructions to install **MoltenVK**: ln -s path-to-Molten-package/MoltenVK + + + +Installing AssImp +----------------- + +The examples in this repository make use of the [*AssImp*](http://assimp.sourceforge.net) +library to load resource assets from files. To run the examples you must download and +install *AssImp* library as follows. + +>***Note:*** Due to the way that *AssImp* makes use of the *CMake* utility, an installation +of *AssImp* can only be built for a single platform. To create *AssImp* libraries for both +*iOS* and *macOS*, download a separate copy of the *AssImp* directory for each platform +(or create a copy of the downloaded *AssImp* directory for each platform before building). + + +####iOS + +1. Download [AssImp 3.3.1](https://github.com/assimp/assimp/releases/tag/v3.3.1/). + +2. Unzip and rename the directory to `assimp-3.3.1-ios`. + +3. Open the file `assimp-3.3.1-ios/port/iOS/IPHONEOS_ARM64_TOOLCHAIN.cmake` file and comment + out the following lines: + + #SET (CC "${DEVROOT}/usr/bin/llvm-gcc") + #SET (CXX "${DEVROOT}/usr/bin/llvm-g++") + #CMAKE_FORCE_C_COMPILER (${CC} LLVM) + #CMAKE_FORCE_CXX_COMPILER (${CXX} LLVM) + +4. Open a *Terminal* session and navigate to the `assimp-3.3.1-ios/port/iOS` directory, + and run the following build command: + + cd path-to-assimp-3.3.1-ios/port/iOS + ./build.sh --stdlib=libc++ --archs="arm64" --no-fat + +5. In the `assimp` directory within this directory, remove the existing `assimp-ios` + symbolic link, and create a new symbolic link pointing to the `assimp-3.3.1-ios` directory: + + cd path-to-this-directory/assimp + rm assimp-ios + ln -s path-to-assimp-3.3.1-ios assimp-ios + + +####macOS + +1. Download [AssImp 3.3.1](https://github.com/assimp/assimp/releases/tag/v3.3.1/). + +2. Unzip and rename the directory to `assimp-3.3.1-macos`. + +3. Open a *Terminal* session and navigate to the `assimp-3.3.1-ios/port/macOS` directory, + and run the following build commands: + + cd path-to-assimp-3.3.1-macos + cmake CMakeLists.txt -G 'Unix Makefiles' + make + +4. In the `assimp` directory within this directory, remove the existing `assimp-macos` + symbolic link, and create a new symbolic link pointing to the `assimp-3.3.1-macos` directory: + + cd path-to-this-directory/assimp + rm assimp-macos + ln -s path-to-assimp-3.3.1-macos assimp-macos + + + Running the Vulkan Examples @@ -67,5 +137,6 @@ in this repository on either *iOS* or *macOS*. To do so, follow these instructio - On *iOS*, tap on the scene to display the keyboard. Tap again on the scene to hide the keyboard. - On both *iOS* and *macOS*, use the numeric keys (*1, 2, 3...*) instead of function keys (*F1, F2, F3...*). + - On both *iOS* and *macOS*, use the regular keyboard *+* and *-* keys instead of the numpad *+* and *-* keys. - On both *iOS* and *macOS*, use the *delete* key instead of the *escape* key. diff --git a/xcode/assimp/assimp-ios b/xcode/assimp/assimp-ios new file mode 120000 index 00000000..42d78e11 --- /dev/null +++ b/xcode/assimp/assimp-ios @@ -0,0 +1 @@ +../../../assimp-3.3.1-ios \ No newline at end of file diff --git a/xcode/assimp/assimp-macos b/xcode/assimp/assimp-macos new file mode 120000 index 00000000..2807a1f9 --- /dev/null +++ b/xcode/assimp/assimp-macos @@ -0,0 +1 @@ +../../../assimp-3.3.1-macos \ No newline at end of file diff --git a/xcode/examples.h b/xcode/examples.h index 325f159c..82d2494d 100644 --- a/xcode/examples.h +++ b/xcode/examples.h @@ -1,12 +1,10 @@ /* - * examples.h + * examples.h + * + * Copyright (c) 2016-2017 The Brenwill Workshop Ltd. + * This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) + * * - * Copyright (c) 2014-2017 The Brenwill Workshop Ltd. All rights reserved. - * http://www.brenwill.com - */ - - -/** * Loads the appropriate example code, as indicated by the appropriate compiler build setting below. * * To select an example to run, define one (and only one) of the macros below, either by @@ -26,9 +24,8 @@ */ -// In the list below, the comments indicate entries that do not currently run correctly on -// one or both of iOS and macOS, and the comment indicates the problem that is encountered. -// Fixes are on the way. +// In the list below, the comments indicate entries that, +// under certain conditions, that may not run as expected. // BASICS @@ -37,15 +34,18 @@ # include "../pipelines/pipelines.cpp" #endif -#ifdef MVK_texture // Bad access +#ifdef MVK_texture # include "../texture/texture.cpp" #endif -#ifdef MVK_texturecubemap // mat4 passed as input +// Does not run. Metal does not support passing matrices between shader stages. +#ifdef MVK_texturecubemap # include "../texturecubemap/texturecubemap.cpp" #endif -#ifdef MVK_texturearray // Buffer binding error +// Runs in Release mode. Does not run in Debug mode, as Metal validation will +// assert that UBO buffer length is too short for UBO size declared in shader. +#ifdef MVK_texturearray # include "../texturearray/texturearray.cpp" #endif @@ -53,19 +53,20 @@ # include "../mesh/mesh.cpp" #endif -#ifdef MVK_dynamicuniformbuffer // Bad access +#ifdef MVK_dynamicuniformbuffer # include "../dynamicuniformbuffer/dynamicuniformbuffer.cpp" #endif -#ifdef MVK_pushconstants // Array in shader stage_in breaks shader +// Does not run. Metal does not support passing arrays between shader stages. +#ifdef MVK_pushconstants # include "../pushconstants/pushconstants.cpp" #endif -#ifdef MVK_specializationconstants // Specialization constants not recognized in shader +#ifdef MVK_specializationconstants # include "../specializationconstants/specializationconstants.cpp" #endif -#ifdef MVK_offscreen // Bad access on iOS after 'd' key is pressed +#ifdef MVK_offscreen # include "../offscreen/offscreen.cpp" #endif @@ -88,7 +89,7 @@ # include "../multithreading/multithreading.cpp" #endif -#ifdef MVK_scenerendering // Bad access on macOS +#ifdef MVK_scenerendering # include "../scenerendering/scenerendering.cpp" #endif @@ -100,47 +101,54 @@ # include "../indirectdraw/indirectdraw.cpp" #endif -#ifdef MVK_hdr // mat4 passed as input +// Does not run. Metal does not support passing matrices between shader stages. +#ifdef MVK_hdr # include "../hdr/hdr.cpp" #endif -#ifdef MVK_occlusionquery // Runs but exhausts 4096 capacity dynamic buffer +#ifdef MVK_occlusionquery # include "../occlusionquery/occlusionquery.cpp" #endif -#ifdef MVK_texturemipmapgen // SPIRV->GLSL conversion error +// Does not run. Sampler arrays require Metal 2. +#ifdef MVK_texturemipmapgen # include "../texturemipmapgen/texturemipmapgen.cpp" #endif -#ifdef MVK_multisampling // Multisampling too low on iOS +#ifdef MVK_multisampling # include "../multisampling/multisampling.cpp" #endif -#ifdef MVK_shadowmapping // Bad access on iOS +#ifdef MVK_shadowmapping # include "../shadowmapping/shadowmapping.cpp" #endif -#ifdef MVK_shadowmappingomni // Bad access on iOS +#ifdef MVK_shadowmappingomni # include "../shadowmappingomni/shadowmappingomni.cpp" #endif -#ifdef MVK_skeletalanimation // Bad access on macOS +#ifdef MVK_skeletalanimation # include "../skeletalanimation/skeletalanimation.cpp" #endif -#ifdef MVK_bloom // Bad access on iOS +#ifdef MVK_bloom # include "../bloom/bloom.cpp" #endif -#ifdef MVK_deferred // buffer overload +// Runs in Release mode. Debug mode Metal validation will assert +// UBO buffer length is too short for UBO size declared in shader. +#ifdef MVK_deferred # include "../deferred/deferred.cpp" #endif -#ifdef MVK_deferredshadows // Geometry shaders not available in Metal +// Does not run. Metal does not support geometry shaders. +#ifdef MVK_deferredshadows # include "../deferredshadows/deferredshadows.cpp" #endif -#ifdef MVK_ssao // SPIRV->MSL conversion error +// Runs in Release mode, but does not display content. +// Metal does not support the use of specialization constants to set array lengths, +#ifdef MVK_ssao # include "../ssao/ssao.cpp" #endif @@ -171,7 +179,7 @@ # include "../gears/gears.cpp" #endif -#ifdef MVK_distancefieldfonts // Endless loop during loading on macOS +#ifdef MVK_distancefieldfonts # include "../distancefieldfonts/distancefieldfonts.cpp" #endif diff --git a/xcode/examples.xcodeproj/project.pbxproj b/xcode/examples.xcodeproj/project.pbxproj index 008a1fad..800d846e 100644 --- a/xcode/examples.xcodeproj/project.pbxproj +++ b/xcode/examples.xcodeproj/project.pbxproj @@ -7,11 +7,6 @@ objects = { /* Begin PBXBuildFile section */ - A91227C31E9D5F5100108018 /* libMoltenVK.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = A91227C21E9D5F5100108018 /* libMoltenVK.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; - A91227C41E9D5F8200108018 /* libMoltenVK.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = A91227C21E9D5F5100108018 /* libMoltenVK.dylib */; }; - A91227C71E9D5FE500108018 /* libassimp.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = A91227C61E9D5FE500108018 /* libassimp.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; - A91227C81E9D601900108018 /* libassimp.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = A91227C61E9D5FE500108018 /* libassimp.dylib */; }; - A945BCFC1E9D4E8700BA3EE2 /* MoltenVK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A945BCFB1E9D4E8700BA3EE2 /* MoltenVK.framework */; }; A94C8D601EA047B400B3CE07 /* vulkangear.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A94C8D5E1EA047B400B3CE07 /* vulkangear.cpp */; }; A94C8D611EA047B400B3CE07 /* vulkangear.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A94C8D5E1EA047B400B3CE07 /* vulkangear.cpp */; }; A951FF171E9C349000FA9144 /* VulkanDebug.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A951FF071E9C349000FA9144 /* VulkanDebug.cpp */; }; @@ -20,8 +15,14 @@ A951FF1A1E9C349000FA9144 /* vulkanexamplebase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A951FF0A1E9C349000FA9144 /* vulkanexamplebase.cpp */; }; A951FF1B1E9C349000FA9144 /* VulkanTools.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A951FF131E9C349000FA9144 /* VulkanTools.cpp */; }; A951FF1C1E9C349000FA9144 /* VulkanTools.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A951FF131E9C349000FA9144 /* VulkanTools.cpp */; }; - A951FF271E9C891A00FA9144 /* libassimp.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A951FF261E9C891A00FA9144 /* libassimp.a */; }; - A98703D71E9D33990066959C /* libzlibstatic.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A98703D61E9D33990066959C /* libzlibstatic.a */; }; + A9532B761EF99894000A09E2 /* libMoltenVK.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = A9532B751EF99894000A09E2 /* libMoltenVK.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + A9532B771EF9991A000A09E2 /* libMoltenVK.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = A9532B751EF99894000A09E2 /* libMoltenVK.dylib */; }; + A9532B781EF99937000A09E2 /* libMoltenVK.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = A9581BAB1EEB64EC00247309 /* libMoltenVK.dylib */; }; + A9581BA61EEB648800247309 /* libassimp.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A9581BA51EEB648800247309 /* libassimp.a */; }; + A9581BA81EEB648C00247309 /* libzlibstatic.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A9581BA71EEB648C00247309 /* libzlibstatic.a */; }; + A9581BAC1EEB64EC00247309 /* libMoltenVK.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = A9581BAB1EEB64EC00247309 /* libMoltenVK.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + A9581BAE1EEB651100247309 /* libassimp.3.3.1.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = A9581BAD1EEB651100247309 /* libassimp.3.3.1.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + A9581BAF1EEB651500247309 /* libassimp.3.3.1.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = A9581BAD1EEB651100247309 /* libassimp.3.3.1.dylib */; }; A98703D91E9D382A0066959C /* data in Resources */ = {isa = PBXBuildFile; fileRef = A98703D81E9D382A0066959C /* data */; }; A98703DA1E9D382A0066959C /* data in Resources */ = {isa = PBXBuildFile; fileRef = A98703D81E9D382A0066959C /* data */; }; A9B67B781C3AAE9800373FFD /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = A9B67B6C1C3AAE9800373FFD /* AppDelegate.m */; }; @@ -36,6 +37,8 @@ A9B67B8F1C3AAEA200373FFD /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = A9B67B871C3AAEA200373FFD /* main.m */; }; A9B67B901C3AAEA200373FFD /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A9B67B8A1C3AAEA200373FFD /* Main.storyboard */; }; A9B67B911C3AAEA200373FFD /* macOS.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A9B67B8B1C3AAEA200373FFD /* macOS.xcassets */; }; + A9BC9B1C1EE8421F00384233 /* MVKExample.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A9BC9B1A1EE8421F00384233 /* MVKExample.cpp */; }; + A9BC9B1D1EE8421F00384233 /* MVKExample.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A9BC9B1A1EE8421F00384233 /* MVKExample.cpp */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -45,8 +48,18 @@ dstPath = ""; dstSubfolderSpec = 6; files = ( - A91227C71E9D5FE500108018 /* libassimp.dylib in CopyFiles */, - A91227C31E9D5F5100108018 /* libMoltenVK.dylib in CopyFiles */, + A9581BAC1EEB64EC00247309 /* libMoltenVK.dylib in CopyFiles */, + A9581BAE1EEB651100247309 /* libassimp.3.3.1.dylib in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A9532B741EF9987C000A09E2 /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 6; + files = ( + A9532B761EF99894000A09E2 /* libMoltenVK.dylib in CopyFiles */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -57,10 +70,7 @@ 1D3623EB0D0F72F000981E51 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 1D6058910D05DD3D006BFB54 /* examples.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = examples.app; sourceTree = BUILT_PRODUCTS_DIR; }; 2D500B990D5A79CF00DBA0E3 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; - A91227C21E9D5F5100108018 /* libMoltenVK.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libMoltenVK.dylib; path = MoltenVK/macOS/libMoltenVK.dylib; sourceTree = ""; }; - A91227C61E9D5FE500108018 /* libassimp.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libassimp.dylib; path = ../libs/assimp/macos/libassimp.dylib; sourceTree = ""; }; A92F37071C7E1B2B008F8BC9 /* examples.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = examples.h; sourceTree = ""; }; - A945BCFB1E9D4E8700BA3EE2 /* MoltenVK.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MoltenVK.framework; path = MoltenVK/iOS/MoltenVK.framework; sourceTree = ""; }; A94A67231B7BDE9B00F6D7C4 /* MetalGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MetalGL.framework; path = ../../MetalGL/macOS/MetalGL.framework; sourceTree = ""; }; A94A67241B7BDE9B00F6D7C4 /* MetalGLShaderConverter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MetalGLShaderConverter.framework; path = ../../MetalGLShaderConverter/macOS/MetalGLShaderConverter.framework; sourceTree = ""; }; A94C8D5E1EA047B400B3CE07 /* vulkangear.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = vulkangear.cpp; path = ../gears/vulkangear.cpp; sourceTree = ""; }; @@ -84,15 +94,17 @@ A951FF121E9C349000FA9144 /* VulkanTexture.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = VulkanTexture.hpp; sourceTree = ""; }; A951FF131E9C349000FA9144 /* VulkanTools.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VulkanTools.cpp; sourceTree = ""; }; A951FF141E9C349000FA9144 /* VulkanTools.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VulkanTools.h; sourceTree = ""; }; - A951FF241E9C7D2B00FA9144 /* libassimp.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libassimp.a; path = "../libs/assimp/armeabi-v7a/libassimp.a"; sourceTree = ""; }; - A951FF261E9C891A00FA9144 /* libassimp.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libassimp.a; path = ../libs/assimp/ios/arm64/libassimp.a; sourceTree = ""; }; + A9532B751EF99894000A09E2 /* libMoltenVK.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libMoltenVK.dylib; path = MoltenVK/iOS/libMoltenVK.dylib; sourceTree = ""; }; + A9581BA51EEB648800247309 /* libassimp.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libassimp.a; path = "assimp/assimp-ios/lib/iOS/arm64/libassimp.a"; sourceTree = ""; }; + A9581BA71EEB648C00247309 /* libzlibstatic.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libzlibstatic.a; path = "assimp/assimp-ios/lib/libzlibstatic.a"; sourceTree = ""; }; + A9581BAB1EEB64EC00247309 /* libMoltenVK.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libMoltenVK.dylib; path = MoltenVK/macOS/libMoltenVK.dylib; sourceTree = ""; }; + A9581BAD1EEB651100247309 /* libassimp.3.3.1.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libassimp.3.3.1.dylib; path = "assimp/assimp-macos/lib/libassimp.3.3.1.dylib"; sourceTree = ""; }; A977BCFE1B66BB010067E5BF /* examples.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = examples.app; sourceTree = BUILT_PRODUCTS_DIR; }; A977BD211B67186B0067E5BF /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/AppKit.framework; sourceTree = DEVELOPER_DIR; }; A977BD221B67186B0067E5BF /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/CoreGraphics.framework; sourceTree = DEVELOPER_DIR; }; A977BD231B67186B0067E5BF /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; }; A977BD251B67186B0067E5BF /* Metal.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Metal.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/Metal.framework; sourceTree = DEVELOPER_DIR; }; A977BD261B67186B0067E5BF /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/QuartzCore.framework; sourceTree = DEVELOPER_DIR; }; - A98703D61E9D33990066959C /* libzlibstatic.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libzlibstatic.a; path = ../libs/assimp/ios/arm64/libzlibstatic.a; sourceTree = ""; }; A98703D81E9D382A0066959C /* data */ = {isa = PBXFileReference; lastKnownFileType = folder; name = data; path = ../data; sourceTree = ""; }; A9A222171B5D69F40050A5F9 /* Metal.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Metal.framework; path = System/Library/Frameworks/Metal.framework; sourceTree = SDKROOT; }; A9B5D09B1CF8830B00D7CBDD /* libc++.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = "libc++.tbd"; path = "usr/lib/libc++.tbd"; sourceTree = SDKROOT; }; @@ -117,10 +129,10 @@ A9B67B8A1C3AAEA200373FFD /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = ""; }; A9B67B8B1C3AAEA200373FFD /* macOS.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = macOS.xcassets; sourceTree = ""; }; A9B6B7641C0F795D00A9E33A /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = System/Library/Frameworks/CoreAudio.framework; sourceTree = SDKROOT; }; + A9BC9B1A1EE8421F00384233 /* MVKExample.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MVKExample.cpp; sourceTree = ""; }; + A9BC9B1B1EE8421F00384233 /* MVKExample.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MVKExample.h; sourceTree = ""; }; A9CDEA271B6A782C00F7B008 /* GLKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GLKit.framework; path = System/Library/Frameworks/GLKit.framework; sourceTree = SDKROOT; }; A9E264761B671B0A00FE691A /* libc++.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = "libc++.dylib"; path = "Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/lib/libc++.dylib"; sourceTree = DEVELOPER_DIR; }; - A9EFB8381E9D566000223542 /* libassimp.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libassimp.a; path = ../libs/assimp/macos/libassimp.a; sourceTree = ""; }; - A9EFB8391E9D566000223542 /* libzlibstatic.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libzlibstatic.a; path = ../libs/assimp/macos/libzlibstatic.a; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -128,9 +140,9 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - A945BCFC1E9D4E8700BA3EE2 /* MoltenVK.framework in Frameworks */, - A98703D71E9D33990066959C /* libzlibstatic.a in Frameworks */, - A951FF271E9C891A00FA9144 /* libassimp.a in Frameworks */, + A9532B771EF9991A000A09E2 /* libMoltenVK.dylib in Frameworks */, + A9581BA61EEB648800247309 /* libassimp.a in Frameworks */, + A9581BA81EEB648C00247309 /* libzlibstatic.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -138,8 +150,8 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - A91227C41E9D5F8200108018 /* libMoltenVK.dylib in Frameworks */, - A91227C81E9D601900108018 /* libassimp.dylib in Frameworks */, + A9532B781EF99937000A09E2 /* libMoltenVK.dylib in Frameworks */, + A9581BAF1EEB651500247309 /* libassimp.3.3.1.dylib in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -159,6 +171,8 @@ isa = PBXGroup; children = ( A92F37071C7E1B2B008F8BC9 /* examples.h */, + A9BC9B1B1EE8421F00384233 /* MVKExample.h */, + A9BC9B1A1EE8421F00384233 /* MVKExample.cpp */, A951FEFF1E9C349000FA9144 /* base */, A94C8D5D1EA047A300B3CE07 /* extras */, A98703D81E9D382A0066959C /* data */, @@ -173,14 +187,11 @@ 29B97323FDCFA39411CA2CEA /* Frameworks */ = { isa = PBXGroup; children = ( - A91227C61E9D5FE500108018 /* libassimp.dylib */, - A91227C21E9D5F5100108018 /* libMoltenVK.dylib */, - A9EFB8381E9D566000223542 /* libassimp.a */, - A9EFB8391E9D566000223542 /* libzlibstatic.a */, - A945BCFB1E9D4E8700BA3EE2 /* MoltenVK.framework */, - A98703D61E9D33990066959C /* libzlibstatic.a */, - A951FF261E9C891A00FA9144 /* libassimp.a */, - A951FF241E9C7D2B00FA9144 /* libassimp.a */, + A9581BAD1EEB651100247309 /* libassimp.3.3.1.dylib */, + A9581BAB1EEB64EC00247309 /* libMoltenVK.dylib */, + A9532B751EF99894000A09E2 /* libMoltenVK.dylib */, + A9581BA71EEB648C00247309 /* libzlibstatic.a */, + A9581BA51EEB648800247309 /* libassimp.a */, A9B5D09B1CF8830B00D7CBDD /* libc++.tbd */, A9B6B7641C0F795D00A9E33A /* CoreAudio.framework */, A9ADEC601B6EC2EB00DBA48C /* iOS */, @@ -312,6 +323,7 @@ 1D60588D0D05DD3D006BFB54 /* Resources */, 1D60588E0D05DD3D006BFB54 /* Sources */, 1D60588F0D05DD3D006BFB54 /* Frameworks */, + A9532B741EF9987C000A09E2 /* CopyFiles */, ); buildRules = ( ); @@ -407,6 +419,7 @@ buildActionMask = 2147483647; files = ( A951FF171E9C349000FA9144 /* VulkanDebug.cpp in Sources */, + A9BC9B1C1EE8421F00384233 /* MVKExample.cpp in Sources */, A9B67B7A1C3AAE9800373FFD /* DemoViewController.mm in Sources */, A9B67B781C3AAE9800373FFD /* AppDelegate.m in Sources */, A951FF1B1E9C349000FA9144 /* VulkanTools.cpp in Sources */, @@ -421,6 +434,7 @@ buildActionMask = 2147483647; files = ( A951FF181E9C349000FA9144 /* VulkanDebug.cpp in Sources */, + A9BC9B1D1EE8421F00384233 /* MVKExample.cpp in Sources */, A9B67B8C1C3AAEA200373FFD /* AppDelegate.m in Sources */, A9B67B8F1C3AAEA200373FFD /* main.m in Sources */, A951FF1C1E9C349000FA9144 /* VulkanTools.cpp in Sources */, @@ -438,7 +452,6 @@ buildSettings = { CODE_SIGN_IDENTITY = "iPhone Developer"; DEVELOPMENT_TEAM = VU3TCKU48B; - FRAMEWORK_SEARCH_PATHS = "\"$(SRCROOT)/MoltenVK/iOS\""; GCC_PREFIX_HEADER = "$(SRCROOT)/iOS/Prefix.pch"; GCC_PREPROCESSOR_DEFINITIONS = ( "$(inherited)", @@ -449,7 +462,12 @@ GCC_WARN_64_TO_32_BIT_CONVERSION = NO; INFOPLIST_FILE = "$(SRCROOT)/iOS/Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 9.0; - LIBRARY_SEARCH_PATHS = "\"$(SRCROOT)/../libs/assimp/ios\""; + LD_RUNPATH_SEARCH_PATHS = "@executable_path"; + LIBRARY_SEARCH_PATHS = ( + "\"$(SRCROOT)/MoltenVK/iOS\"", + "\"$(SRCROOT)/assimp/assimp-ios/lib/iOS/arm64\"", + "\"$(SRCROOT)/assimp/assimp-ios/lib\"", + ); SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; VALID_ARCHS = arm64; @@ -461,7 +479,6 @@ buildSettings = { CODE_SIGN_IDENTITY = "iPhone Developer"; DEVELOPMENT_TEAM = VU3TCKU48B; - FRAMEWORK_SEARCH_PATHS = "\"$(SRCROOT)/MoltenVK/iOS\""; GCC_PREFIX_HEADER = "$(SRCROOT)/iOS/Prefix.pch"; GCC_PREPROCESSOR_DEFINITIONS = ( "$(inherited)", @@ -470,7 +487,12 @@ GCC_WARN_64_TO_32_BIT_CONVERSION = NO; INFOPLIST_FILE = "$(SRCROOT)/iOS/Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 9.0; - LIBRARY_SEARCH_PATHS = "\"$(SRCROOT)/../libs/assimp/ios\""; + LD_RUNPATH_SEARCH_PATHS = "@executable_path"; + LIBRARY_SEARCH_PATHS = ( + "\"$(SRCROOT)/MoltenVK/iOS\"", + "\"$(SRCROOT)/assimp/assimp-ios/lib/iOS/arm64\"", + "\"$(SRCROOT)/assimp/assimp-ios/lib\"", + ); SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; VALID_ARCHS = arm64; @@ -493,7 +515,8 @@ LD_RUNPATH_SEARCH_PATHS = "@executable_path"; LIBRARY_SEARCH_PATHS = ( "\"$(SRCROOT)/MoltenVK/macOS\"", - "\"$(SRCROOT)/../libs/assimp/macos\"", + "\"$(SRCROOT)/assimp/assimp-macos/lib\"", + "$(PROJECT_DIR)/MoltenVK/macOS", ); MACOSX_DEPLOYMENT_TARGET = 10.11; SDKROOT = macosx; @@ -514,7 +537,8 @@ LD_RUNPATH_SEARCH_PATHS = "@executable_path"; LIBRARY_SEARCH_PATHS = ( "\"$(SRCROOT)/MoltenVK/macOS\"", - "\"$(SRCROOT)/../libs/assimp/macos\"", + "\"$(SRCROOT)/assimp/assimp-macos/lib\"", + "$(PROJECT_DIR)/MoltenVK/macOS", ); MACOSX_DEPLOYMENT_TARGET = 10.11; SDKROOT = macosx; diff --git a/xcode/ios/AppDelegate.h b/xcode/ios/AppDelegate.h index 0c274761..5023d3dd 100644 --- a/xcode/ios/AppDelegate.h +++ b/xcode/ios/AppDelegate.h @@ -1,9 +1,9 @@ -// -// AppDelegate.h -// -// Created by Bill Hollings on 2015/06/03. -// Copyright (c) 2015 The Brenwill Workshop Ltd. All rights reserved. -// +/* + * AppDelegate.h + * + * Copyright (c) 2016-2017 The Brenwill Workshop Ltd. + * This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) + */ #import diff --git a/xcode/ios/AppDelegate.m b/xcode/ios/AppDelegate.m index 2062839b..8d69ac3b 100644 --- a/xcode/ios/AppDelegate.m +++ b/xcode/ios/AppDelegate.m @@ -1,9 +1,9 @@ -// -// AppDelegate.m -// -// Created by Bill Hollings on 2015/06/03. -// Copyright (c) 2015 The Brenwill Workshop Ltd. All rights reserved. -// +/* + * AppDelegate.m + * + * Copyright (c) 2016-2017 The Brenwill Workshop Ltd. + * This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) + */ #import "AppDelegate.h" diff --git a/xcode/ios/DemoViewController.h b/xcode/ios/DemoViewController.h index dbea6c5c..81d04021 100644 --- a/xcode/ios/DemoViewController.h +++ b/xcode/ios/DemoViewController.h @@ -1,15 +1,8 @@ /* - * DemoViewController.h + * DemoViewController.h * - * Copyright (c) 2014-2017 The Brenwill Workshop Ltd. All rights reserved. - * http://www.brenwill.com - * - * Use of this document is governed by the Molten License Agreement, as included - * in the Molten distribution package. CAREFULLY READ THAT LICENSE AGREEMENT BEFORE - * READING AND USING THIS DOCUMENT. BY READING OR OTHERWISE USING THIS DOCUMENT, - * YOU ACCEPT AND AGREE TO BE BOUND BY THE TERMS AND CONDITIONS OF THAT LICENSE - * AGREEMENT. IF YOU DO NOT ACCEPT THE TERMS AND CONDITIONS OF THAT LICENSE AGREEMENT, - * DO NOT READ OR USE THIS DOCUMENT. + * Copyright (c) 2016-2017 The Brenwill Workshop Ltd. + * This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) */ #import diff --git a/xcode/ios/DemoViewController.mm b/xcode/ios/DemoViewController.mm index 386a6c75..2629623f 100644 --- a/xcode/ios/DemoViewController.mm +++ b/xcode/ios/DemoViewController.mm @@ -1,13 +1,13 @@ /* - * DemoViewController.mm + * DemoViewController.mm * - * Copyright (c) 2014-2017 The Brenwill Workshop Ltd. All rights reserved. - * http://www.brenwill.com + * Copyright (c) 2016-2017 The Brenwill Workshop Ltd. + * This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) */ #import "DemoViewController.h" -#include "examples.h" +#include "MVKExample.h" const std::string VulkanExampleBase::getAssetPath() { @@ -19,7 +19,7 @@ const std::string VulkanExampleBase::getAssetPath() { #pragma mark DemoViewController @implementation DemoViewController { - VulkanExample* _vulkanExample; + MVKExample* _mvkExample; CADisplayLink* _displayLink; BOOL _viewHasAppeared; } @@ -30,11 +30,7 @@ const std::string VulkanExampleBase::getAssetPath() { self.view.contentScaleFactor = UIScreen.mainScreen.nativeScale; - _vulkanExample = new VulkanExample(); - _vulkanExample->initVulkan(); - _vulkanExample->setupWindow(self.view); - _vulkanExample->initSwapchain(); - _vulkanExample->prepare(); + _mvkExample = new MVKExample(self.view); uint32_t fps = 60; _displayLink = [CADisplayLink displayLinkWithTarget: self selector: @selector(renderFrame)]; @@ -59,11 +55,11 @@ const std::string VulkanExampleBase::getAssetPath() { -(BOOL) canBecomeFirstResponder { return _viewHasAppeared; } -(void) renderFrame { - _vulkanExample->renderFrame(); + _mvkExample->renderFrame(); } -(void) dealloc { - delete(_vulkanExample); + delete _mvkExample; [super dealloc]; } @@ -85,7 +81,7 @@ const std::string VulkanExampleBase::getAssetPath() { // Handle keyboard input -(void) handleKeyboardInput: (unichar) keycode { - _vulkanExample->keyPressed(keycode); + _mvkExample->keyPressed(keycode); } diff --git a/xcode/macos/AppDelegate.h b/xcode/macos/AppDelegate.h index b9a711ea..3eb638e9 100644 --- a/xcode/macos/AppDelegate.h +++ b/xcode/macos/AppDelegate.h @@ -1,12 +1,12 @@ -// -// AppDelegate.h -// -// Created by Bill Hollings on 2015/07/30. -// Copyright (c) 2015 The Brenwill Workshop Ltd. All rights reserved. -// +/* + * AppDelegate.h + * + * Copyright (c) 2016-2017 The Brenwill Workshop Ltd. + * This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) + */ #import @interface AppDelegate : NSObject -@end \ No newline at end of file +@end diff --git a/xcode/macos/AppDelegate.m b/xcode/macos/AppDelegate.m index c5c25a63..c3ce3b24 100644 --- a/xcode/macos/AppDelegate.m +++ b/xcode/macos/AppDelegate.m @@ -1,9 +1,9 @@ -// -// AppDelegate.m -// -// Created by Bill Hollings on 2015/07/30. -// Copyright (c) 2015 The Brenwill Workshop Ltd. All rights reserved. -// +/* + * AppDelegate.m + * + * Copyright (c) 2016-2017 The Brenwill Workshop Ltd. + * This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) + */ #import "AppDelegate.h" diff --git a/xcode/macos/DemoViewController.h b/xcode/macos/DemoViewController.h index 5ae97de2..3cbedc48 100644 --- a/xcode/macos/DemoViewController.h +++ b/xcode/macos/DemoViewController.h @@ -1,15 +1,8 @@ /* - * DemoViewController.h + * DemoViewController.h * - * Copyright (c) 2014-2017 The Brenwill Workshop Ltd. All rights reserved. - * http://www.brenwill.com - * - * Use of this document is governed by the Molten License Agreement, as included - * in the Molten distribution package. CAREFULLY READ THAT LICENSE AGREEMENT BEFORE - * READING AND USING THIS DOCUMENT. BY READING OR OTHERWISE USING THIS DOCUMENT, - * YOU ACCEPT AND AGREE TO BE BOUND BY THE TERMS AND CONDITIONS OF THAT LICENSE - * AGREEMENT. IF YOU DO NOT ACCEPT THE TERMS AND CONDITIONS OF THAT LICENSE AGREEMENT, - * DO NOT READ OR USE THIS DOCUMENT. + * Copyright (c) 2016-2017 The Brenwill Workshop Ltd. + * This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) */ #import diff --git a/xcode/macos/DemoViewController.mm b/xcode/macos/DemoViewController.mm index 373a4979..657f0b5f 100644 --- a/xcode/macos/DemoViewController.mm +++ b/xcode/macos/DemoViewController.mm @@ -1,14 +1,14 @@ /* - * DemoViewController.mm + * DemoViewController.mm * - * Copyright (c) 2014-2017 The Brenwill Workshop Ltd. All rights reserved. - * http://www.brenwill.com + * Copyright (c) 2016-2017 The Brenwill Workshop Ltd. + * This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) */ #import "DemoViewController.h" #import -#include "examples.h" +#include "MVKExample.h" const std::string VulkanExampleBase::getAssetPath() { @@ -22,7 +22,7 @@ static CVReturn DisplayLinkCallback(CVDisplayLinkRef displayLink, CVOptionFlags flagsIn, CVOptionFlags* flagsOut, void* target) { - ((VulkanExample*)target)->renderFrame(); + ((MVKExample*)target)->renderFrame(); return kCVReturnSuccess; } @@ -31,7 +31,7 @@ static CVReturn DisplayLinkCallback(CVDisplayLinkRef displayLink, #pragma mark DemoViewController @implementation DemoViewController { - VulkanExample* _vulkanExample; + MVKExample* _mvkExample; CVDisplayLinkRef _displayLink; } @@ -41,26 +41,22 @@ static CVReturn DisplayLinkCallback(CVDisplayLinkRef displayLink, self.view.wantsLayer = YES; // Back the view with a layer created by the makeBackingLayer method. - _vulkanExample = new VulkanExample(); - _vulkanExample->initVulkan(); - _vulkanExample->setupWindow(self.view); - _vulkanExample->initSwapchain(); - _vulkanExample->prepare(); + _mvkExample = new MVKExample(self.view); CVDisplayLinkCreateWithActiveCGDisplays(&_displayLink); - CVDisplayLinkSetOutputCallback(_displayLink, &DisplayLinkCallback, _vulkanExample); + CVDisplayLinkSetOutputCallback(_displayLink, &DisplayLinkCallback, _mvkExample); CVDisplayLinkStart(_displayLink); } -(void) dealloc { CVDisplayLinkRelease(_displayLink); - delete(_vulkanExample); + delete _mvkExample; [super dealloc]; } // Handle keyboard input -(void) keyDown:(NSEvent*) theEvent { - _vulkanExample->keyPressed(theEvent.keyCode); + _mvkExample->keyPressed(theEvent.keyCode); } @end diff --git a/xcode/macos/Info.plist b/xcode/macos/Info.plist index d690fdab..e921bd0e 100644 --- a/xcode/macos/Info.plist +++ b/xcode/macos/Info.plist @@ -25,7 +25,7 @@ LSMinimumSystemVersion ${MACOSX_DEPLOYMENT_TARGET} NSHumanReadableCopyright - Copyright (c) 2015 The Brenwill Workshop Ltd. All rights reserved. + Copyright (c) 2016-2017 The Brenwill Workshop Ltd. NSMainStoryboardFile Main NSPrincipalClass diff --git a/xcode/macos/main.m b/xcode/macos/main.m index c98463af..01b929e1 100644 --- a/xcode/macos/main.m +++ b/xcode/macos/main.m @@ -1,9 +1,9 @@ -// -// main.m -// -// Created by Bill Hollings on 2015/07/30. -// Copyright © 2015 The Brenwill Workshop Ltd. All rights reserved. -// +/* + * main.m + * + * Copyright (c) 2016-2017 The Brenwill Workshop Ltd. + * This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) + */ #import