Recent

Author Topic: Lazarus + Vulkan?  (Read 9017 times)

Imants

  • Full Member
  • ***
  • Posts: 196
Lazarus + Vulkan?
« on: March 25, 2017, 10:41:29 am »
Is there any Lazarus + Vulkan examples available?

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11383
  • FPC developer.
Re: Lazarus + Vulkan?
« Reply #1 on: March 25, 2017, 11:29:47 am »
This is uncharted territory. I'm not even aware of Delphi vulkan efforts atm.

Thaddy

  • Hero Member
  • *****
  • Posts: 14200
  • Probably until I exterminate Putin.
Specialize a type, not a var.

Imants

  • Full Member
  • ***
  • Posts: 196
Re: Lazarus + Vulkan?
« Reply #3 on: March 25, 2017, 02:01:03 pm »
It looks like I have problems with vulkan drivers. I get a External:SIGFPE exception wile trying to create vulkan instance.

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: Lazarus + Vulkan?
« Reply #4 on: March 25, 2017, 03:17:40 pm »
32-bit? you might need to disable Float point exception.
(the same way is done for OpenGL applications)

This is uncharted territory. I'm not even aware of Delphi vulkan efforts atm.
Actually, there's plenty of:
https://github.com/MaksymTymkovych/Delphi-Vulkan
https://github.com/BeRo1985/pasvulkan
http://git.ccs-baumann.de/bitspace/Vulkan/tree/master/projects

I presume that demonstrated the popularity of Pascal language :)

But alas, no official Kronos reference.
I wish it were, as well as OpenGL, OpenGLES, OpenCL headers could be moved there and removed from RTL packages and moved to the official site.
« Last Edit: March 25, 2017, 03:23:49 pm by skalogryz »

Imants

  • Full Member
  • ***
  • Posts: 196
Re: Lazarus + Vulkan?
« Reply #5 on: March 25, 2017, 06:51:28 pm »
No 64-bit Ubuntu 16.10 Amd RX 480

For now all pascal examples gave me External:SIGFPE while creating instance. C++ example worked fine on my computer so I can't blame drivers ;(

Akira1364

  • Hero Member
  • *****
  • Posts: 561
Re: Lazarus + Vulkan?
« Reply #6 on: March 26, 2017, 03:02:31 am »
I am. User BeRo has this: https://forums.khronos.org/showthread.php/13078-PasVulkan-Vulkan-header-for-Object-Pascal-supporting-all-Vulkan-OS-targets

Side note: I am legitimately convinced that BeRo has got to be like one of the top 10 or top 5 Pascal programmers alive today. No idea how that guy manages to continuously write such gigantic libraries (Kraft Physics, e.t.c) that always work perfectly the first time you try them, at such a rapid pace.

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: Lazarus + Vulkan?
« Reply #7 on: March 26, 2017, 03:35:22 am »
No 64-bit Ubuntu 16.10 Amd RX 480
try to call SetExceptionMask (pass empty mask there) prior to the initialization.

Imants

  • Full Member
  • ***
  • Posts: 196
Re: Lazarus + Vulkan?
« Reply #8 on: March 26, 2017, 09:17:15 am »
No 64-bit Ubuntu 16.10 Amd RX 480
try to call SetExceptionMask (pass empty mask there) prior to the initialization.

This actually helped  :o

SetExceptionMask([exInvalidOp, exDenormalized, exPrecision]);   
Did the trick
« Last Edit: March 26, 2017, 09:21:14 am by Imants »

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: Lazarus + Vulkan?
« Reply #9 on: March 26, 2017, 03:17:43 pm »
This actually helped  :o

SetExceptionMask([exInvalidOp, exDenormalized, exPrecision]);   
Did the trick
not surprising, to be honest.

wikified! feel free to add links to your published examples to the wiki page.

creaothceann

  • Full Member
  • ***
  • Posts: 117
Re: Lazarus + Vulkan?
« Reply #10 on: March 26, 2017, 08:50:56 pm »
wikified!

Should mention that it's defined in the Math unit. Also, SetExceptionMask isn't mentioned in relation to OpenGL anywhere else in the wiki.

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: Lazarus + Vulkan?
« Reply #11 on: March 26, 2017, 11:14:47 pm »
Should mention that it's defined in the Math unit.
I personally believe that as soon as a developer gets 'Error: Identifier not found "SetExceptionMask"' they'll start googling for the function and eventually find out that's in Math unit.

But i'm ok if anyone updates the wiki to explicitly mention that ;)

Also, SetExceptionMask isn't mentioned in relation to OpenGL anywhere else in the wiki.

That's because gl.pp handles the issue for you. If you check "initialization" section you might find the code like this
Code: Pascal  [Select][+][-]
  1. {$if defined(cpui386) or defined(cpux86_64)}
  2. uses
  3.   math;
  4. {$endif}
  5.  
  6. ...
  7.   { according to bug 7570, this is necessary on all x86 platforms,
  8.     maybe we've to fix the sse control word as well }
  9.   { Yes, at least for darwin/x86_64 (JM) }
  10.   {$if defined(cpui386) or defined(cpux86_64)}
  11.   SetExceptionMask([exInvalidOp, exDenormalized, exZeroDivide,exOverflow, exUnderflow, exPrecision]);
  12.   {$endif}
  13.  

If you ask me, is using Math unit by any OpenGL units good or bad - I'll say, it is bad.

Because adding "Math" to a uses section also drags "SysUtils", that eventually adds up to 70Kb to the produced executable (fpc 2.6.4, later versions of fpc, probably adds even more).
Demoscene developers would NOT appreciate that :)
Also, a low-level api unit should not depend on high-level unit.

Back in the (i386 only) days Set8087CW() function was used (declared in System unit).
But it's not compatible (enough?) with x64, thus it was replaced with SetExceptionMask from Math unit.
The function was called by gl.pp as well.

Ultimately, only developers who would not rely on OpenGL RTL package would encounter the problem.
The reason not to use RTL package is simple (as it is right now to Vulkan) - the need of most up-to-date APIs.

One could easily verify the implementation of SetExceptionMask for either i386 as well as x86_64 and make the proper Math-independent solution.
« Last Edit: March 26, 2017, 11:22:14 pm by skalogryz »

BeRo

  • New Member
  • *
  • Posts: 45
    • My site
Re: Lazarus + Vulkan?
« Reply #12 on: May 07, 2017, 07:53:39 am »
I do want to say here, that PasVulkan is working target-complete now (Windows, Linux-X11, Linux-Mir, Linux-Wayland, MoltenVK, Android), including Android since few days, see https://www.youtube.com/watch?v=BIi4CcMHCe0

 

TinyPortal © 2005-2018