Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apple compatibility #7

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@ Or by running scripts only:
- Clone project and init submodules
- Generate and build project using **cmake**

### MacOS (aarch64)
- Install **VulkanSDK**
- Setup environment variables using `setup-env.sh` from VulkanSDK (e.x. `source ~/VulkanSDK/1.3.283.0/setup-env.sh`)
- Clone project and init submodules
- Generate and build project using **cmake**

Or by running scripts only:
- Run `./1-Deploy.sh`
- Run `./2-Build.sh`

### CMake options
`-DUSE_MINIMAL_DATA=ON` - download minimal resource package (90MB)

Expand Down
2 changes: 1 addition & 1 deletion Source/Clear.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ void Sample::RenderFrame(uint32_t frameIndex)
NRI.CmdClearAttachments(commandBuffer, &clearDesc, 1, &rect2, 1);

clearDesc.value.color32f = {0.0f, 0.0f, 1.0f, 1.0f};
nri::Rect rect3 = { 0, y * 2, w, h3 };
nri::Rect rect3 = { 0, (int16_t)(y * 2), w, h3 };
NRI.CmdClearAttachments(commandBuffer, &clearDesc, 1, &rect3, 1);
}
NRI.CmdEndRendering(commandBuffer);
Expand Down
2 changes: 1 addition & 1 deletion Source/DeviceInfo.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// © 2021 NVIDIA Corporation

#include <stdio.h>
#include <malloc.h>
#include <stdlib.h>

#define NRI_FORCE_C

Expand Down
2 changes: 1 addition & 1 deletion Source/Readback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ void Sample::RenderFrame(uint32_t frameIndex)
NRI.CmdClearAttachments(commandBuffer, &clearDesc, 1, &rect2, 1);

clearDesc.value.color32f = {0.0f, 0.0f, 1.0f, 1.0f};
nri::Rect rect3 = { 0, y * 2, w, h3 };
nri::Rect rect3 = { 0, (int16_t)(y * 2), w, h3 };
NRI.CmdClearAttachments(commandBuffer, &clearDesc, 1, &rect3, 1);

RenderUI(NRI, NRI, *m_Streamer, commandBuffer, 1.0f, true);
Expand Down
7 changes: 6 additions & 1 deletion Source/Wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@

#define VK_USE_PLATFORM_WIN32_KHR 1
const char* VULKAN_LOADER_NAME = "vulkan-1.dll";
#elif __APPLE__
#define VK_USE_PLATFORM_METAL_EXT 1
const char* VULKAN_LOADER_NAME = "libvulkan.dylib";
#else
#define VK_USE_PLATFORM_XLIB_KHR 1
const char* VULKAN_LOADER_NAME = "libvulkan.so";
Expand Down Expand Up @@ -227,6 +230,8 @@ void Sample::CreateVulkanDevice()

#ifdef _WIN32
const char* instanceExtensions[] = { VK_KHR_WIN32_SURFACE_EXTENSION_NAME, VK_KHR_SURFACE_EXTENSION_NAME };
#elif __APPLE__
const char* instanceExtensions[] = { VK_EXT_METAL_SURFACE_EXTENSION_NAME };
#else
const char* instanceExtensions[] = { VK_KHR_XLIB_SURFACE_EXTENSION_NAME };
#endif
Expand Down Expand Up @@ -778,7 +783,7 @@ void Sample::RenderFrame(uint32_t frameIndex)
FreeLibrary((HMODULE)&library);
}

#elif defined(__linux__)
#elif defined(__linux__) || defined(__APPLE__)

#include <dlfcn.h>

Expand Down