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

feat: modififcations to compile on macosx #8

Merged
Merged
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
2 changes: 1 addition & 1 deletion Source/Clear.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ void Sample::RenderFrame(uint32_t frameIndex) {
NRI.CmdClearAttachments(commandBuffer, &clearDesc, 1, &rect2, 1);

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

#include <malloc.h>
#include <stdio.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 @@ -259,7 +259,7 @@ void Sample::RenderFrame(uint32_t frameIndex) {
NRI.CmdClearAttachments(commandBuffer, &clearDesc, 1, &rect2, 1);

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

RenderUI(NRI, NRI, *m_Streamer, commandBuffer, 1.0f, true);
Expand Down
13 changes: 9 additions & 4 deletions 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 defined(__APPLE__)
#define VK_USE_PLATFORM_METAL_EXT
const char* VULKAN_LOADER_NAME = "libvulkan.dynlib";
#else
# define VK_USE_PLATFORM_XLIB_KHR 1
const char* VULKAN_LOADER_NAME = "libvulkan.so";
Expand Down Expand Up @@ -211,6 +214,8 @@ void Sample::CreateVulkanDevice() {

#ifdef _WIN32
const char* instanceExtensions[] = {VK_KHR_WIN32_SURFACE_EXTENSION_NAME, VK_KHR_SURFACE_EXTENSION_NAME};
#elif defined(__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 @@ -738,8 +743,8 @@ void Sample::RenderFrame(uint32_t frameIndex) {

#ifdef _WIN32

# include <windows.h>
# undef LoadLibrary
#include <windows.h>
#undef LoadLibrary

Library* LoadSharedLibrary(const char* path) {
return (Library*)LoadLibraryA(path);
Expand All @@ -753,9 +758,9 @@ void UnloadSharedLibrary(Library& library) {
FreeLibrary((HMODULE)&library);
}

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

# include <dlfcn.h>
#include <dlfcn.h>

Library* LoadSharedLibrary(const char* path) {
return (Library*)dlopen(path, RTLD_NOW);
Expand Down