BeRo1985 / pasvulkan

Vulkan header generator, OOP-style API wrapper, framework and prospective Vulkan-based game engine for Object Pascal
zlib License
185 stars 28 forks source link

Vulkan.Pas compile issues #20

Closed johnhutch111 closed 2 years ago

johnhutch111 commented 2 years ago

I am testing the PasVulkan.Framework and Vulkan.pas with Delphi XE8. The header for this project suggests the code should be good for Delphi 2009 and above and Android is supported/tested.

As Windows the Vulkan.pas unit won't compile as the HMONITOR type is defined in unit MultiMon not unit Windows. If I include MultiMon unit it compiles OK.

As Android the Vulkan.Pas won't compile as there is a reference to PANSICHAR in Vulkan.pas. I have not tried to fix this yet.

I have not tested iOS yet.

You you like me to fix these items via a pull request? Do you have any thoughts on the Android issue?

BeRo1985 commented 2 years ago

For the Android support you do need the lastest dev version of the FreePascal compiler, because Delphi sadly doesn't support the for ARM needed special calling calling convention for Vulkan, but which FPC does it, on my request some years ago. I've also requested it on the EMB bug tracker, but without luck so far. And the second reason, Delphi XE8 had still the old nextgen compiler without PANSICHAR. I've never supported this nextgen compiler, due to its silly design decisions at the time (ARC, no ansistrings, etc.), which fortunately have all been withdrawn in the latest Delphi versions, at least the most of them.

The minimum by me official supported Delphi version is currently 10.4.x, and in later future 11.0. But here only for the Windows Win32 x86-32 and Win64 x86-64 targets. All other targets are FreePascal-only.

And the Apple targets in connection with MoltenVK are completely untested so far.

tothpaul commented 2 years ago

Hello, I'm curious, what is this special calling convention you're talking about ?

Thanks Paul

BeRo1985 commented 2 years ago

See:

{$ifdef Windows}stdcall;{$else}{$ifdef Android}{$ifdef cpuarm}hardfloat;{$else}cdecl;{$endif}{$else}cdecl;{$endif}{$endif} in the Vulkan.pas

So forced hardfloat ABI even on otherwise non-hardfloat ABI targets. And here a quote from the Vulkan specs:

On Android 32-bit ARM targets, Vulkan functions use the "hardfloat" calling convention, i.e. float parameters are passed in registers. This is true even if the rest of the application passes floats on the stack, as it does by default when compiling for the armeabi-v7a NDK ABI.

tothpaul commented 2 years ago

voted ;) https://quality.embarcadero.com/browse/RSP-19548