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

Add support for Mac OS #87

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open

Conversation

LucaZulberti
Copy link

@LucaZulberti LucaZulberti commented Sep 8, 2023

Dear all, I appreciate your work here and would like to try porting vkDT to Mac OS.

I'm not an experienced Mac OS developer; I want to give it a try to use the software on my MacBook.

My setup:

  • MacBook Pro M1
  • macOS Ventura 13.5 Sequoia 15.1

Dependency (to improve the list):

  • Install the MoltenVK SDK for vulkan by LunarG: Lunar VulkanSDK.
  • Install any missing package with brew.
  • Using brew, install llvm and libomp for custom compilation of the rawspeed library.

ToDo:

  • Update dependency with upstream versions
    • rawspeed: add controls for Apple target in 4894513
    • imgui: cherry-picked modifications from @hanatos fork to upstream in c57af75
    • glfw: use submodule to compile it with ImGui
    • Add preliminary checks for Apple target in Makefiles and source code
    • Customise compilation for the rawspeed library
    • Try to understand why it is not working

Up to now, the commits are just a fast try to make it work.
I know there is a lot of rubbish from many points of view of programmers 😄

Thank you again for this software!

@LucaZulberti LucaZulberti marked this pull request as draft September 8, 2023 19:10
@LucaZulberti LucaZulberti changed the title WIP: Add support for Mac OS Add support for Mac OS Sep 8, 2023
@hanatos
Copy link
Owner

hanatos commented Sep 10, 2023

heya,

nice, thanks for jumping onto this. as a general comment, the code with these patches applied will probably not run on my machine any more (or on macintosh with intel cpu?). also i want to limit platform specific code to very few places to make our life easier in the future. let me leave a few comments interleaved in the patch.

ext/Makefile Outdated Show resolved Hide resolved
src/Makefile Outdated Show resolved Hide resolved
src/db/db.c Outdated
@@ -454,7 +478,7 @@ int dt_db_read(dt_db_t *db, const char *filename)
lno++;

// scan filename:rating|labels:number
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, macintosh thinks 32-bit are long? then probably better to use %"PRIu64" here so it will work on all platforms.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just followed compiler warnings, I will see what is going on here, in case ok to switch to PRIu64

src/db/db.h Outdated
@@ -4,6 +4,12 @@
#include <string.h>
#include <strings.h>

#ifndef __APPLE__
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this argument swap issue is terrifying. there has got to be a better way (not involving the ifdef around all compare functions above).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I know, I want just to reach a working/compiling solution and then beutify. 😄

src/db/thumbnails.c Outdated Show resolved Hide resolved
snprintf(cfgfilename, sizeof(cfgfilename), "%s", filename);
snprintf(deffilename, sizeof(deffilename), "default.%"PRItkn, dt_token_str(input_module));
struct stat statbuf = {0};
time_t tcfg = 0, tbc1 = 0;

if(!stat(cfgfilename, &statbuf))
#ifndef __APPLE__
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay we probably want to factor this out in something like time_t t = dt_stat(filename) defined in core.h or similar, so the platform specific code is only in one place.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I will do something like that to put together all plat-spec code. Thank you for the tip 😉

@@ -314,7 +314,11 @@ void modify_roi_out(
mod->img_param.whitebalance[3] /= mod->img_param.whitebalance[1];
mod->img_param.whitebalance[1] = 1.0f;

#ifndef __APPLE__
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

really that doesn't exist? then maybe another wrapper in core.h like dt_isnan

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes... Too many things are not in Macos... Painful work..

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think this patch is obsolete, the test==test performs nan testing without api call.

@hanatos
Copy link
Owner

hanatos commented Sep 10, 2023

.. about rawspeed. does the vanilla rawspeed git build on M1? i would be surprised if not. anyways it's probably better to use upstream rawspeed for changes.

about the blank screen. did you run vkdt -d all and does it give any useful hints? maybe it fails to detect paths to dsos for dynamic loading?

@LucaZulberti
Copy link
Author

LucaZulberti commented Sep 10, 2023

Here I am!

If you appreciate it, I'm working to make it compile with CMake, which does more platform-specific controls.
Next, I wanted to play with ImGUI to build the GUI and integrate it in Ansel in the long (very long?) run.

I also updated ImGUI dependency (I cherry-picked your modifications) to check for the blank screen problem.
As before, I'm going to investigate more and then make the changes more solid.

Thank you for your feedback!

@LucaZulberti
Copy link
Author

With the new imgui this is the error:

$ mkdir build
$ cd build
$ cmake .. && Make
$ cd ../bin
$ cp ../build/vkdt* ../build/libvkdt.* ./
$ ln -s ../build/modules ./
$ ./vkdt-gui -d err -d all -D perf ~/Pictures/Temp/ProvaDT/AND_092.dng 
[gui] glfwGetVersionString() : 3.3.8 Cocoa NSGL EGL OSMesa
[gui] monitor [0] DELL U2721DE at 0 0
[gui] vk extension required by GLFW:
[gui]   VK_KHR_surface
[gui]   VK_EXT_metal_surface
[qvk] dev 0: vendorid 0x106b
[qvk] dev 0: Apple M1
[qvk] max number of allocations 1073741824
[qvk] max image allocation size 16384 x 16384
[qvk] max uniform buffer range 4294967295
[qvk] num queue families: 4
[qvk] picked device 0 without ray tracing and without float atomics support
[qvk] available surface formats:
[qvk] B8G8R8A8_UNORM
[qvk] B8G8R8A8_SRGB
[qvk] R16G16B16A16_SFLOAT
[qvk] A2B10G10R10_UNORM_PACK32
[qvk] A2R10G10B10_UNORM_PACK32
[qvk] B8G8R8A8_UNORM
[qvk] B8G8R8A8_SRGB
[qvk] R16G16B16A16_SFLOAT
[qvk] A2B10G10R10_UNORM_PACK32
[qvk] A2R10G10B10_UNORM_PACK32
[qvk] B8G8R8A8_UNORM
[qvk] B8G8R8A8_SRGB
[qvk] R16G16B16A16_SFLOAT
[qvk] A2B10G10R10_UNORM_PACK32
[qvk] A2R10G10B10_UNORM_PACK32
[qvk] B8G8R8A8_UNORM
[qvk] B8G8R8A8_SRGB
[qvk] R16G16B16A16_SFLOAT
[qvk] A2B10G10R10_UNORM_PACK32
[qvk] A2R10G10B10_UNORM_PACK32
[qvk] B8G8R8A8_UNORM
[qvk] B8G8R8A8_SRGB
[qvk] R16G16B16A16_SFLOAT
[qvk] A2B10G10R10_UNORM_PACK32
[qvk] A2R10G10B10_UNORM_PACK32
[qvk] B8G8R8A8_UNORM
[qvk] B8G8R8A8_SRGB
[qvk] R16G16B16A16_SFLOAT
[qvk] A2B10G10R10_UNORM_PACK32
[qvk] A2R10G10B10_UNORM_PACK32
[qvk] B8G8R8A8_UNORM
[qvk] B8G8R8A8_SRGB
[qvk] R16G16B16A16_SFLOAT
[qvk] A2B10G10R10_UNORM_PACK32
[qvk] A2R10G10B10_UNORM_PACK32
[qvk] B8G8R8A8_UNORM
[qvk] B8G8R8A8_SRGB
[qvk] R16G16B16A16_SFLOAT
[qvk] A2B10G10R10_UNORM_PACK32
[qvk] A2R10G10B10_UNORM_PACK32
[qvk] B8G8R8A8_UNORM
[qvk] B8G8R8A8_SRGB
[qvk] R16G16B16A16_SFLOAT
[qvk] A2B10G10R10_UNORM_PACK32
[qvk] A2R10G10B10_UNORM_PACK32
[qvk] B8G8R8A8_UNORM
[qvk] B8G8R8A8_SRGB
[qvk] R16G16B16A16_SFLOAT
[qvk] A2B10G10R10_UNORM_PACK32
[qvk] A2R10G10B10_UNORM_PACK32
[qvk] B8G8R8A8_UNORM
[qvk] B8G8R8A8_SRGB
[qvk] R16G16B16A16_SFLOAT
[qvk] A2B10G10R10_UNORM_PACK32
[qvk] A2R10G10B10_UNORM_PACK32
[qvk] B8G8R8A8_UNORM
[qvk] B8G8R8A8_SRGB
[qvk] R16G16B16A16_SFLOAT
[qvk] A2B10G10R10_UNORM_PACK32
[qvk] A2R10G10B10_UNORM_PACK32
[qvk] colour space: 0
[gui] no joysticks found
[gui] no display profile file display.DELL U2721DE, using sRGB!
[gui] no display profile file display.DELL U2721DE, using sRGB!
[qvk] available surface formats:
[qvk] B8G8R8A8_UNORM
[qvk] B8G8R8A8_SRGB
[qvk] R16G16B16A16_SFLOAT
[qvk] A2B10G10R10_UNORM_PACK32
[qvk] A2R10G10B10_UNORM_PACK32
[qvk] B8G8R8A8_UNORM
[qvk] B8G8R8A8_SRGB
[qvk] R16G16B16A16_SFLOAT
[qvk] A2B10G10R10_UNORM_PACK32
[qvk] A2R10G10B10_UNORM_PACK32
[qvk] B8G8R8A8_UNORM
[qvk] B8G8R8A8_SRGB
[qvk] R16G16B16A16_SFLOAT
[qvk] A2B10G10R10_UNORM_PACK32
[qvk] A2R10G10B10_UNORM_PACK32
[qvk] B8G8R8A8_UNORM
[qvk] B8G8R8A8_SRGB
[qvk] R16G16B16A16_SFLOAT
[qvk] A2B10G10R10_UNORM_PACK32
[qvk] A2R10G10B10_UNORM_PACK32
[qvk] B8G8R8A8_UNORM
[qvk] B8G8R8A8_SRGB
[qvk] R16G16B16A16_SFLOAT
[qvk] A2B10G10R10_UNORM_PACK32
[qvk] A2R10G10B10_UNORM_PACK32
[qvk] B8G8R8A8_UNORM
[qvk] B8G8R8A8_SRGB
[qvk] R16G16B16A16_SFLOAT
[qvk] A2B10G10R10_UNORM_PACK32
[qvk] A2R10G10B10_UNORM_PACK32
[qvk] B8G8R8A8_UNORM
[qvk] B8G8R8A8_SRGB
[qvk] R16G16B16A16_SFLOAT
[qvk] A2B10G10R10_UNORM_PACK32
[qvk] A2R10G10B10_UNORM_PACK32
[qvk] B8G8R8A8_UNORM
[qvk] B8G8R8A8_SRGB
[qvk] R16G16B16A16_SFLOAT
[qvk] A2B10G10R10_UNORM_PACK32
[qvk] A2R10G10B10_UNORM_PACK32
[qvk] B8G8R8A8_UNORM
[qvk] B8G8R8A8_SRGB
[qvk] R16G16B16A16_SFLOAT
[qvk] A2B10G10R10_UNORM_PACK32
[qvk] A2R10G10B10_UNORM_PACK32
[qvk] B8G8R8A8_UNORM
[qvk] B8G8R8A8_SRGB
[qvk] R16G16B16A16_SFLOAT
[qvk] A2B10G10R10_UNORM_PACK32
[qvk] A2R10G10B10_UNORM_PACK32
[qvk] B8G8R8A8_UNORM
[qvk] B8G8R8A8_SRGB
[qvk] R16G16B16A16_SFLOAT
[qvk] A2B10G10R10_UNORM_PACK32
[qvk] A2R10G10B10_UNORM_PACK32
[qvk] B8G8R8A8_UNORM
[qvk] B8G8R8A8_SRGB
[qvk] R16G16B16A16_SFLOAT
[qvk] A2B10G10R10_UNORM_PACK32
[qvk] A2R10G10B10_UNORM_PACK32
[qvk] colour space: 0
Assertion failed: (font_cfg->SizePixels > 0.0f), function AddFont, file imgui_draw.cpp, line 2131.
an error occurred while trying to execute gdb.please check if gdb is installed on your system.
backtrace written to /tmp/vkdt-bt-95883.txt
recovery data written to /tmp/vkdt-crash-recovery.*

Apparently, it cannot set the WindowSize properly... I saw you modified imgui backends for that.
In my plans I would like to use ImGui:: instead of lower level functions from glfw. It will be a longer process, but I think it could help in having something portable in the long run.

@LucaZulberti
Copy link
Author

Updates on error state.

I set the font size to 16.0 with a literal to go on.

Now blocked at:

$ ./vkdt-gui -d err -d all -D qvk -D perf ~/Pictures/Temp/ProvaDT/AND_092.dng
[gui] glfwGetVersionString() : 3.3.8 Cocoa NSGL EGL OSMesa
[gui] monitor [0] DELL U2721DE at 0 0
[gui] vk extension required by GLFW:
[gui]   VK_KHR_surface
[gui]   VK_EXT_metal_surface
[gui] no joysticks found
[gui] no display profile file display.DELL U2721DE, using sRGB!
[gui] no display profile file display.DELL U2721DE, using sRGB!
[db] allocating 1024.0 MB for thumbnails
[i-bc1] (null): can't open file!
[i-bc1] (null): wrong magic number or version!
[i-bc1] (null): can't open file!
[i-bc1] (null): wrong magic number or version!
[ERR] [thm] failed to run first half of graph!
[ERR] could not load required thumbnail symbols!
[ERR] image could not be loaded!

I think this is related to how the dynamic libraries of the modules are compiled.
I will check compilation flags and other differences with Linux .so files.

@hanatos
Copy link
Owner

hanatos commented Sep 10, 2023

okay is that error any different to the older imgui at all?

not sure i understand how you would put imgui into a gtk3/cairo application. as additional dependency?

maybe a saner approach is to use libvkdt.so in an external application, if you want to backport the processing to legacy gui library stacks? or do you want to rewrite ansel in imgui?

about dynamic libraries. i saw you link -lvkdt in the makefile. why? normally the library is not even built.

there may also be an issue about setting file paths to discover additional data/config files/dsos.

i'm highly unlikely to merge cmake build system patches. cmake doesn't do anything for me (it generates makefiles, i have makefiles already), i'm unconvinced it does much for platform independence except mostly a big if around stuff. all variables related to local build environments should go in config.mk and config.mk.defaults instead.

re:imgui vs glfw functions: some code is c, some is c++ (as minimal as possible, only gui related and interfacing with rawspeed/exiv2). glfw is c, so there are some constraints as to when you can swap things around.

@LucaZulberti
Copy link
Author

okay is that error any different to the older imgui at all?

I'm going to investigate the cause in the following days.

not sure i understand how you would put imgui into a gtk3/cairo application. as additional dependency?
maybe a saner approach is to use libvkdt.so in an external application, if you want to backport the processing to legacy gui library stacks? or do you want to rewrite ansel in imgui?

I would like essential ImGui components to control the processing on a single image, then extend for library management like in Ansel. Yes, I would like to get rid of GTK. For sure I will link with libvkdt to keep QVK stuff as it is.

about dynamic libraries. i saw you link -lvkdt in the makefile. why? normally the library is not even built.

Bad patch due to ramp up on the compilation flow of the project; I will force push the next days.

there may also be an issue about setting file paths to discover additional data/config files/dsos.

Thank you for the hint, I will investigate also this.

i'm highly unlikely to merge cmake build system patches. cmake doesn't do anything for me (it generates makefiles, i have makefiles already), i'm unconvinced it does much for platform independence except mostly a big if around stuff. all variables related to local build environments should go in config.mk and config.mk.defaults instead.

I will keep it separated. I found it more convenient than hand-written Makefiles for the long-term, but it could be optional for this work. For example, in shared libraries, it automatically handles all the different flags for other OSes.
I will continue to modify the Makefile-based compilation flow too.

re:imgui vs glfw functions: some code is c, some is c++ (as minimal as possible, only gui related and interfacing with rawspeed/exiv2). glfw is c, so there are some constraints as to when you can swap things around.

Here, I need more experience in ImGui development to be helpful. I noticed the patch about setDisplayProfile() that I assume is very important for the workflow. This should be considered in any GUI-based application using the libvkdt, right?
I will postpone these long-term decisions until I can run this tool on macOS.

@LucaZulberti
Copy link
Author

Updated with only Makefile modifications.
Cleaned ext compilation with brew llvm.
Fixed some flat.mk in src/pipe/modules; @hanatos can you check these? I need those dependencies with .o files.

Now the error is:

$ ./vkdt -d err -d all -D qvk -D perf ~/Pictures/Temp/ProvaDT/AND_092.dng
[gui] glfwGetVersionString() : 3.3.8 Cocoa NSGL EGL OSMesa dynamic
[gui] monitor [0] DELL U2721DE at 0 0
[gui] vk extension required by GLFW:
[gui]   VK_KHR_surface
[gui]   VK_EXT_metal_surface
[gui] no joysticks found
[gui] no display profile file display.DELL U2721DE, using sRGB!
[gui] no display profile file display.DELL U2721DE, using sRGB!
[db] allocating 1024.0 MB for thumbnails
[ERR] [thm] failed to run first half of graph!
[ERR] could not load required thumbnail symbols!
[ERR] image could not be loaded!

Same error with updated ImGui (HEAD) and old version (HEAD~2).

@hanatos
Copy link
Owner

hanatos commented Sep 10, 2023

looks like you're lacking -rdynamic or the equivalent?

@LucaZulberti
Copy link
Author

Now Makefiles are more clean.

Next error:

$ ./vkdt -d err -d all -D qvk -D perf ~/Pictures/Temp/ProvaDT/AND_092.dng
[gui] glfwGetVersionString() : 3.3.8 Cocoa NSGL EGL OSMesa dynamic
[gui] monitor [0] DELL U2721DE at 0 0
[gui] vk extension required by GLFW:
[gui]   VK_KHR_surface
[gui]   VK_EXT_metal_surface
[gui] no joysticks found
[gui] no display profile file display.DELL U2721DE, using sRGB!
[gui] no display profile file display.DELL U2721DE, using sRGB!
[db] allocating 1024.0 MB for thumbnails
[mem] images : peak rss 0.00012207 MB vmsize 0.00012207 MB
[mem] buffers: peak rss 0 MB vmsize 0 MB
[mem] staging: peak rss 0.000244141 MB vmsize 0.000244141 MB
[mem] images : peak rss 0.00012207 MB vmsize 0.00012207 MB
[mem] buffers: peak rss 0 MB vmsize 0 MB
[mem] staging: peak rss 0.000244141 MB vmsize 0.000244141 MB
[mvk-error] VK_ERROR_INITIALIZATION_FAILED: Shader library compile failed (Error code 3):
program_source:104:14: error: expected unqualified-id
float kernel(thread const float3& ci, thread const float3& p)
             ^
program_source:104:14: error: expected ')'
program_source:104:13: note: to match this '('
float kernel(thread const float3& ci, thread const float3& p)
            ^
program_source:285:42: error: expected expression
            co += (params.rbf_c[i].xyz * kernel(param_8, param_9));
                                         ^
.
[mvk-error] VK_ERROR_INVALID_SHADER_NV: Compute shader function could not be compiled into pipeline. See previous logged error.
[mvk-error] VK_ERROR_INITIALIZATION_FAILED: Shader library compile failed (Error code 3):
program_source:104:14: error: expected unqualified-id
float kernel(thread const float3& ci, thread const float3& p)
             ^
program_source:104:14: error: expected ')'
program_source:104:13: note: to match this '('
float kernel(thread const float3& ci, thread const float3& p)
            ^
program_source:285:42: error: expected expression
            co += (params.rbf_c[i].xyz * kernel(param_8, param_9));
                                         ^
.
[mvk-error] VK_ERROR_INVALID_SHADER_NV: Compute shader function could not be compiled into pipeline. See previous logged error.
[db] [thm] running the thumbnail graph failed on image '/Users/luca/Pictures/Temp/ProvaDT/AND_092.dng.cfg'!

Same error for old and new ImGui+GLFW. Maybe is related to MoltenVK implementation of Vulkan on macOS?

@LucaZulberti
Copy link
Author

LucaZulberti commented Nov 21, 2024

Running only ./vkdt -d all opens the GUI! I will do more tests next days.

Screenshot 2024-11-21 alle 09 59 27

@LucaZulberti
Copy link
Author

I rebased on master, GUI is working, vkdit-cli generates JPEG, but the output differs from GUI visualization.
Anyway, I think this PR could be discussed for finally merge it.

@@ -6,6 +6,8 @@
.PHONY:all src clean distclean bin install release cli
ifeq ($(OS),Windows_NT)
include bin/config.mk.defaults.w64
else ifeq ($(OS),Darwin)
include bin/config.mk.defaults.darwin
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

master has config.mk.defaults.osx instead. probably makes sense to merge these.

@@ -53,7 +55,7 @@ endif

install-mod: bin Makefile
mkdir -p $(VKDTDIR)/modules
rsync -avP --include='**/params' --include='**/connectors' --include='**/*.ui' --include='**/ptooltips' --include='**/ctooltips' --include='**/readme.md' --include='**.spv' --include='**.so' --include '*/' --exclude='**' bin/modules/ ${VKDTDIR}/modules/
rsync -avP --include='**/params' --include='**/connectors' --include='**/*.ui' --include='**/ptooltips' --include='**/ctooltips' --include='**/readme.md' --include='**.spv' --include='**.$(SEXT)' --include '*/' --exclude='**' bin/modules/ ${VKDTDIR}/modules/
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

meh. don't really care about macintosh specific file endings. .so works on windows (and macintosh) just fine. i'm manually opening the file / dlopening the symbols anyways.

endif
ifeq ($(VKDT_USE_QUAKE), 1)
RELEASE_FILES+=$(shell cd src/pipe/modules/quake/quakespasm; git ls-files | sed -e 's#^#src/pipe/modules/quake/quakespasm/#')
RELEASE_FILES+=$(shell cd src/pipe/modules/quake/quakespasm; git ls-files | sed -e 's\#^\#src/pipe/modules/quake/quakespasm/\#')
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh does that not work on osx? i need to test this change on linux/windows/my old macos

@@ -101,9 +101,16 @@ VKDT_VULKAN_CFLAGS=$(eval VKDT_VULKAN_CFLAGS := $$(shell pkg-config --cflags vul
VKDT_VULKAN_LDFLAGS=$(eval VKDT_VULKAN_LDFLAGS := $$(shell pkg-config --libs vulkan))$(VKDT_VULKAN_LDFLAGS)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this one isn't even loaded on macintosh?

@@ -0,0 +1,144 @@
# build time configuration.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see above, please merge with config.mk.defaults.osx

@@ -59,7 +59,7 @@ export VKDT_USE_ALSA

# build the i-mcraw loader module to load raw video from the motioncam app.
# it has no additional dependencies but comes with several ten thousand lines of c++ code
VKDT_USE_MCRAW=1
VKDT_USE_MCRAW=0
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does that not work? newer master should have removed the SSE/x86 code in this module. i don't see a reason why it wouldn't work on arm now.

@@ -103,26 +103,25 @@ gui/%.o: gui/%.c Makefile $(GUI_H) gui/flat.mk
# main application
# ======================
../bin/vkdt: $(GUI_O) $(QVK_O) $(CORE_O) $(SND_O) $(PIPE_O) $(DB_O) Makefile
$(CC) $(GUI_O) $(QVK_O) $(CORE_O) $(SND_O) $(PIPE_O) $(DB_O) -pie -o $@ \
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably needs some mechanism to put it back on none-macintosh systems.

@@ -52,7 +68,7 @@ fs_copy(
if(sb.st_mode & S_IFDIR) { len = 0; goto copy_error; } // don't copy directories
if(-1 == (fd1 = open(dst, O_CREAT | O_WRONLY | O_TRUNC, 0644))) goto copy_error;
do {
ret = sendfile(fd1, fd0, 0, len); // works on linux >= 2.6.33, else fd1 would need to be a socket
ret = os_sendfile(fd1, fd0, 0, len); // works on linux >= 2.6.33, else fd1 would need to be a socket
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this code path is not called any more on macintosh.

@@ -206,8 +222,8 @@ fs_basedir(
snprintf(basedir, maxlen, "%s", path);
fs_dirname(basedir);
#elif defined(__APPLE__)
pid_t pid = getpid();
proc_pidpath (pid, basedir, maxlen);
uint32_t len = maxlen;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is probably equivalent?

@@ -471,8 +487,12 @@ fs_createtime(
#else
struct stat statbuf = {0};
stat(filename, &statbuf);
#ifdef __APPLE__
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think this is obsolete now, the ifdef is in the else path of another ifdef APPLE, no?

#endif
else
{
char tmp[PATH_MAX];
if(snprintf(tmp, sizeof(tmp), "%s/%s", dt_pipe.basedir, deffilename) >= PATH_MAX)
return VK_INCOMPLETE;
if(!stat(tmp, &statbuf))
#ifdef __APPLE__
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think all these are fine in master already.

@@ -156,6 +159,9 @@ qvk_init(const char *preferred_device_name, int preferred_device_id, int window)
VkInstanceCreateInfo inst_create_info = {
.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO,
.pApplicationInfo = &vk_app_info,
#ifdef __APPLE__
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

master has this portability extension already, patch is probably obsolete.

@LucaZulberti
Copy link
Author

Thank you @hanatos for checking everything, I will revise everything singularly next days 👍🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants