Vulkan | HackLAB https://www.geeks3d.com/hacklab 3D Programming, Prototyping and Gamedev with GeeXLab Fri, 19 Aug 2022 15:32:21 +0000 en-US hourly 1 https://wordpress.org/?v=6.7.1 (Tested) Raspberry Pi 4 and Vulkan: It Works! https://www.geeks3d.com/hacklab/20220818/tested-raspberry-pi-4-and-vulkan-it-works/ https://www.geeks3d.com/hacklab/20220818/tested-raspberry-pi-4-and-vulkan-it-works/#respond Thu, 18 Aug 2022 09:31:50 +0000 https://www.geeks3d.com/hacklab/?p=1673 Downloads Vulkan demopack GeeXLab for Raspberry Pi OS 32-bit Feedback thread / Forum (EN) Two weeks ago, the Raspberry Pi team announced that the Vulkan driver achieved Vulkan 1.2 conformance from Khronos. I finally managed to enable Vulkan on my Raspberry Pi 4 and ran a Vulkan demo with GeeXLab. The first thing to do to enable Vulkan support on Raspberry Pi OS is to … Continue reading (Tested) Raspberry Pi 4 and Vulkan: It Works! »

The post (Tested) Raspberry Pi 4 and Vulkan: It Works! first appeared on HackLAB.]]>

Raspberry Pi and Vulkan



Downloads

Two weeks ago, the Raspberry Pi team announced that the Vulkan driver achieved Vulkan 1.2 conformance from Khronos.

I finally managed to enable Vulkan on my Raspberry Pi 4 and ran a Vulkan demo with GeeXLab.

The first thing to do to enable Vulkan support on Raspberry Pi OS is to install the Vulkan Mesa drivers. Open a terminal and type:

sudo apt install vulkan-tools mesa-vulkan-drivers

If the driver is correctly installed, you should be able to launch the vulkaninfo command line utility to get more information about the Vulkan support:

vulkaninfo

Vulkan information on Raspberry Pi OS

 
It looks like the Vulkan driver is correctly installed and enabled. Let’s do the first real test: GeeXLab (GeeXLab 0.48+ is recommended).

GeeXLab showing Vulkan support on Raspberry Pi OS

 
YES! It works!

As you can see, there are two Vulkan devices: an hardware device and a software device:
– a GPU device: V3D 4.2
– a CPU device: llvmpipe

Now let’s do a second test: running a simple real time 3D scene (a phong textured torus with an ImGui interface to display basic information).

The demo is available in the Vulkan demopack in two versions: Vulkan and OpenGL:
– Vulkan: geexlab-demopack-vulkan/vk2/05-phong-mesh/v1/main.xml
– OpenGL: geexlab-demopack-vulkan/vk2/05-phong-mesh/v1-gl/main.xml

The Vulkan demo: 126 FPS

GeeXLab Vulkan demo running on Raspberry Pi OS

 
The OpenGL demo: 93 FPS

GeeXLab Vulkan demo running on Raspberry Pi OS

 
It’s a nice result for at least two reasons:
– the Vulkan demo works. The SPIRV shaders have been compiled long time ago (in 2019 on my Windows box) and they still work in 2022 on Raspberry Pi 4.
– the Vulkan demo runs faster than the OpenGL one: more or less +30% faster!

 
I also tested the Vulkan CPU device: With the llvmpipe device, the demo runs at… 18 FPS.

GeeXLab Vulkan demo running on Raspberry Pi OS - LLvmpipe CPU device

 
And to conclude this article, here is a popular Shadertoy demo ported to Vulkan that works fine but slowly (5 FPS) on the RPi4:

GeeXLab Vulkan shadertoy demo running on Raspberry Pi OS

 
This demo is available in the Vulkan demopack:
geexlab-demopack-vulkan/vk2/09-shadertoy/seascape/main.xml

The post (Tested) Raspberry Pi 4 and Vulkan: It Works! first appeared on HackLAB.]]>
https://www.geeks3d.com/hacklab/20220818/tested-raspberry-pi-4-and-vulkan-it-works/feed/ 0
More Vulkan Raytracing in GeeXLab https://www.geeks3d.com/hacklab/20210115/more-vulkan-raytracing-in-geexlab/ https://www.geeks3d.com/hacklab/20210115/more-vulkan-raytracing-in-geexlab/#respond Fri, 15 Jan 2021 10:43:38 +0000 https://www.geeks3d.com/hacklab/?p=1588   I worked hard on Vulkan raytracing in GeeXLab these last days, and results are there! Most of the demos work on NVIDIA GeForce RTX (tested on RTX 2070 and RTX 3060 Ti) and AMD Radeon RX 6800 XT. On the Radeon RX 6800 XT I have crashes on some demos. Vulkan validation layers don’t show any error. There is just a crash of GeeXLab. … Continue reading More Vulkan Raytracing in GeeXLab »

The post More Vulkan Raytracing in GeeXLab first appeared on HackLAB.]]>

GeeXLab - Vulkan raytracing demo on NVIDIA GeForce RTX 2070 - Cornell Box

 
I worked hard on Vulkan raytracing in GeeXLab these last days, and results are there!

Most of the demos work on NVIDIA GeForce RTX (tested on RTX 2070 and RTX 3060 Ti) and AMD Radeon RX 6800 XT. On the Radeon RX 6800 XT I have crashes on some demos. Vulkan validation layers don’t show any error. There is just a crash of GeeXLab. Before diving into real debugging, I’m waiting for new Adrenalin drivers, maybe they will fix the crash. On NVIDIA RTX, all demos work!

The magic of raytracing in this screenshot: shadows and reflections are a… side effect of the raytracing. The raytracing shader implements a simple lighthing effect and shadows and reflections come for free!

GeeXLab - Vulkan raytracing demo on NVIDIA GeForce RTX 2070 - Cornell Box

 
All demos are pure raytracing demos. No hybrid rendering here, only raytracing.

Other cool screenshots:

GeeXLab - Vulkan raytracing demo on NVIDIA GeForce RTX 2070

GeeXLab - Vulkan raytracing demo on NVIDIA GeForce RTX 2070

 
As soon as the crash on Radeon is fixed, I release the new GeeXLab with raytracing support.

The post More Vulkan Raytracing in GeeXLab first appeared on HackLAB.]]>
https://www.geeks3d.com/hacklab/20210115/more-vulkan-raytracing-in-geexlab/feed/ 0
Vulkan Raytracing is Coming into GeeXLab (Updated 2021.01.15) https://www.geeks3d.com/hacklab/20201224/vulkan-raytracing-is-coming-into-geexlab/ https://www.geeks3d.com/hacklab/20201224/vulkan-raytracing-is-coming-into-geexlab/#respond Thu, 24 Dec 2020 13:08:14 +0000 https://www.geeks3d.com/hacklab/?p=1584 Raytracing is coming to GeeXLab. After a bunch of hours of coding and debugging (thanks to the latest Vulkan SDK!), I finally managed to see my first ray traced RGB triangle! The Hello World of Vulkan raytracing, in a word. The raytracing code is based on the latest Vulkan official extensions (VK_KHR_acceleration_structure and VK_KHR_ray_tracing_pipeline). The post header screenshot shows the ray traced triangle rendered on … Continue reading Vulkan Raytracing is Coming into GeeXLab (Updated 2021.01.15) »

The post Vulkan Raytracing is Coming into GeeXLab (Updated 2021.01.15) first appeared on HackLAB.]]>

GeeXLab - Vulkan raytracing on NVIDIA GeForce RTX 2070

Raytracing is coming to GeeXLab. After a bunch of hours of coding and debugging (thanks to the latest Vulkan SDK!), I finally managed to see my first ray traced RGB triangle! The Hello World of Vulkan raytracing, in a word. The raytracing code is based on the latest Vulkan official extensions (VK_KHR_acceleration_structure and VK_KHR_ray_tracing_pipeline).

The post header screenshot shows the ray traced triangle rendered on a GeForce RTX 2070 with GeForce 457.44 driver (the triangle is rendered on a 512×512 image).

The following screenshot shows the same demo rendered on a Radeon RX 6800 XT (XMas Edition!) with latest Adrenalin 20.12.2:

GeeXLab - Vulkan raytracing on AMD Radeon RX 6800 XT

 
As you can see, there is still a lot work to do before releasing GeeXLab 0.40…

 

Update (2020.12.31)

For this last day of the covid-19 year, here are some new screenshots. In a word, basic ray tracing iis now operational in GeeXLab: you can create raygen, miss and closest hit shaders and trace rays. It’s amazing to see how it’s simple to add shadows in a ray traced scene!

In this scene, we have a ground plane, two animated donuts and shadows. The ray traced scene is rendered in a 512×512 texture.

GeeXLab - Vulkan raytracing on NVIDIA GeForce RTX 2070
Vulkan ray tracing on a GeForce RTX 2070 + R460.89

 
On the Radeon RX 6800 XT, it’s another story. Currently the texture resolution is limited to 128×128 pixels otherwise there are some glitches. Here is a simple example: a donut and a triangle are rendered in red color on a green background.

– BAD: Radeon RX 6800 XT – 512×512 render texture:
GeeXLab - Vulkan raytracing on AMD Radeon RX 6800 XT

 
– GOOD: Radeon RX 6800 XT – 128×128 render texture:
GeeXLab - Vulkan raytracing on AMD Radeon RX 6800 XT

 
And shadows can not be rendered otherwise there is a serious crash + reboot!

GeeXLab - Vulkan raytracing on AMD Radeon RX 6800 XT
Vulkan ray tracing on a Radeon RX 6800 XT + Adrenalin 20.12.2

 
No error is reported by the Vulkan SDK. The crash on the Radeon RX 6800 XT is likely caused by the launch of a second ray (needed for the shadow). More tests (and new driver?? are needed…

 

Update (2021.01.15)

– Raytracing with texturing and shadows (hard shadows). One ray per pixel.

GeeXLab - Vulkan raytracing on NVIDIA GeForce RTX 2070

 
– First tests of raytracing with several rays per pixel.

GeeXLab - Vulkan raytracing on NVIDIA GeForce RTX 2070

GeeXLab - Vulkan raytracing on NVIDIA GeForce RTX 2070

GeeXLab - Vulkan raytracing on NVIDIA GeForce RTX 2070

The post Vulkan Raytracing is Coming into GeeXLab (Updated 2021.01.15) first appeared on HackLAB.]]>
https://www.geeks3d.com/hacklab/20201224/vulkan-raytracing-is-coming-into-geexlab/feed/ 0
Vulkan on Raspberry Pi 4 https://www.geeks3d.com/hacklab/20191104/vulkan-on-raspberry-pi-4/ https://www.geeks3d.com/hacklab/20191104/vulkan-on-raspberry-pi-4/#respond Mon, 04 Nov 2019 15:11:55 +0000 https://www.geeks3d.com/hacklab/?p=1450 During the last update of GeeXLab on Raspberry Pi, I noticed the presence of some Vulkan files in the /usr/lib/arm-linux-gnueabihf/ folder: – libvulkan.so.1 – libvulkan.so.1.1.97   libvulkan.so.1 is a symbolic link that points on the real library libvulkan.so.1.1.97. According to the name of this shared object, it looks like Raspbian Buster is shipped with Vulkan 1.1.97 support. So far, the Vulkan support in GeeXLab was … Continue reading Vulkan on Raspberry Pi 4 »

The post Vulkan on Raspberry Pi 4 first appeared on HackLAB.]]>

Raspberry Pi + Vulkan logo

During the last update of GeeXLab on Raspberry Pi, I noticed the presence of some Vulkan files in the /usr/lib/arm-linux-gnueabihf/ folder:

– libvulkan.so.1
– libvulkan.so.1.1.97

Vulkan on Raspberry Pi 4

 
libvulkan.so.1 is a symbolic link that points on the real library libvulkan.so.1.1.97. According to the name of this shared object, it looks like Raspbian Buster is shipped with Vulkan 1.1.97 support.

So far, the Vulkan support in GeeXLab was limited to Windows and Linux platforms. I brought some minor changes in GeeXlab and now Vulkan demos can be played on Raspberry Pi too.

Result?

Not terrible. The Vulkan instance creation failed with the following error code:
VK_ERROR_INCOMPATIBLE_DRIVER

La messe est dite!

No operational Vulkan support in Raspbian Buster. Not yet. But Vulkan embryo is there and that’s the good point.

I will follow the evolution of Vulkan support in the next updates of Raspbian. I hope we’ll see a working implementation of Vulkan in Raspbian in a near future.

Links:

The post Vulkan on Raspberry Pi 4 first appeared on HackLAB.]]>
https://www.geeks3d.com/hacklab/20191104/vulkan-on-raspberry-pi-4/feed/ 0
How to Run a Vulkan or Direct3D 12 Demo on a Particular GPU https://www.geeks3d.com/hacklab/20160511/how-to-run-a-vulkan-or-direct3d-12-demo-on-a-particular-gpu/ https://www.geeks3d.com/hacklab/20160511/how-to-run-a-vulkan-or-direct3d-12-demo-on-a-particular-gpu/#respond Wed, 11 May 2016 19:19:23 +0000 http://www.geeks3d.com/hacklab/?p=1103 Both Vulkan and Direct3D 12, the new low level graphics APIs, offer a nice feature so far reserved to computing APIs (OpenCL or CUDA): the ability to run graphics tasks on a particular GPU. If you have more than one GPU in your system (for example two or three single GPU graphics cards, or one dual-GPU card like a Radeon R9 295X or a GeForce … Continue reading How to Run a Vulkan or Direct3D 12 Demo on a Particular GPU »

The post How to Run a Vulkan or Direct3D 12 Demo on a Particular GPU first appeared on HackLAB.]]>


Both Vulkan and Direct3D 12, the new low level graphics APIs, offer a nice feature so far reserved to computing APIs (OpenCL or CUDA): the ability to run graphics tasks on a particular GPU.

If you have more than one GPU in your system (for example two or three single GPU graphics cards, or one dual-GPU card like a Radeon R9 295X or a GeForce GTX Titan Z), you can select a specific GPU and run a Vulkan or Direct3D 12 demo on this GPU.

With OpenGL, this is not possible on Windows. OpenGL has one renderer (usually the first GPU) and the only way to use the second GPU is to enable SLI or CrossFire. But even with SLI / CrossFire, OpenGL sees only one renderer which is a logical GPU. On a system with one physical GPU, OpenGL sees one logical GPU made up of one physical GPU and on a system with two GPUs (and with SLI or CrossFire enabled), OpenGL still sees one logical GPU made up of two physical GPUs.

As a programmer, you can not assign graphics / compute task to a particular GPU in OpenGL on Windows. This limitation has been removed by Vulkan and Direct3D 12.

On Linux and OS X, you run an OpenGL demo on a particular GPU. On Linux you have to create a context on the proper display, while virtual screens do the job on OS X.

You can easily test this feature with the latest GeeXLab. Just take any Vulkan demo of the code sample pack (in the vk/ folder), and change the value of the gpu_index attribute of the window XML node. The following code snippet show how to run the demo on the first GPU (index = 0):

  

 
To run the demo on the second GPU (index = 1):

  

 
GeeXLab allows to create several 3D windows in the same demo (each window running its own set of scripts: INIT, FRAME, etc.). I prepared a Vulkan demo that creates two 3D windows, each window being assigned to a particular GPU. On my dev system, I have two cards: GeForce GTX 960 + GeForce GTX 750. The first window will run on the GTX 960 and the second will run on the GTX 750:

  
          
  
  

 
The demo is available here: vk/02-triangle-of-death-multiple-windows.xml


Vulkan multi-GPU demo

 
Remark: at the time of writing, the multiple windows feature works only on Windows. There is a bug that prevent to run it on Linux. I hope to fix it for the next release…

The post How to Run a Vulkan or Direct3D 12 Demo on a Particular GPU first appeared on HackLAB.]]>
https://www.geeks3d.com/hacklab/20160511/how-to-run-a-vulkan-or-direct3d-12-demo-on-a-particular-gpu/feed/ 0
GeeXLab 0.10.1.1 Released for Windows https://www.geeks3d.com/hacklab/20160421/geexlab-0-10-1-1-released-for-windows/ https://www.geeks3d.com/hacklab/20160421/geexlab-0-10-1-1-released-for-windows/#respond Thu, 21 Apr 2016 15:36:57 +0000 http://www.geeks3d.com/hacklab/?p=1091 A bugfix release of GeeXLab is available for Windows 64-bit only. GeeXLab 0.10.1.1 fixes a bug in the Vulkan plugin related to the default depth-stencil buffer format. In the previous version, the depth-stencil buffer was created with the VK_FORMAT_D24_UNORM_S8_UINT format which was not yet supported on AMD Radeon GPUs. The new default value is now VK_FORMAT_D32_SFLOAT_S8_UINT. According to the Vulkan specification, at least VK_FORMAT_D24_UNORM_S8_UINT or … Continue reading GeeXLab 0.10.1.1 Released for Windows »

The post GeeXLab 0.10.1.1 Released for Windows first appeared on HackLAB.]]>
A bugfix release of GeeXLab is available for Windows 64-bit only.

GeeXLab 0.10.1.1 fixes a bug in the Vulkan plugin related to the default depth-stencil buffer format. In the previous version, the depth-stencil buffer was created with the VK_FORMAT_D24_UNORM_S8_UINT format which was not yet supported on AMD Radeon GPUs. The new default value is now VK_FORMAT_D32_SFLOAT_S8_UINT. According to the Vulkan specification, at least VK_FORMAT_D24_UNORM_S8_UINT or VK_FORMAT_D32_SFLOAT_S8_UINT should be supported. The plugin does some tests to select the right value.

GeeXLab has an useful command line option that allows to quickly benchmark a demo: /benchmark_duration_ms. For example, the following command:

GeexLab /benchmark_duration_ms=10000 demofile="..." /display_score_box

will run a demo during 10 seconds and will display a score box. The /benchmark_duration_ms has been broken during the transition from GLSL Hacker to GeeXLab. It’s fixed now.

And the last bugfix is related to the online check for new versions. This feature has been broken in GeeXLab 0.9.6.0…

As usual, you can download GeeXLab and the code sample pack from THIS PAGE.

The post GeeXLab 0.10.1.1 Released for Windows first appeared on HackLAB.]]>
https://www.geeks3d.com/hacklab/20160421/geexlab-0-10-1-1-released-for-windows/feed/ 0
GeeXLab 0.10.0 with Vulkan support released for Windows and Linux https://www.geeks3d.com/hacklab/20160414/geexlab-0-10-0-with-vulkan-support-released-for-windows-and-linux/ https://www.geeks3d.com/hacklab/20160414/geexlab-0-10-0-with-vulkan-support-released-for-windows-and-linux/#respond Thu, 14 Apr 2016 15:41:05 +0000 http://www.geeks3d.com/hacklab/?p=1070   A new version of GeeXLab is available for Windows 64-bit and Linux 64-bit. The branch 0.10.x comes with new features, improvements and bugfixes. You can download GeeXLab 0.10.0.0 from THIS PAGE. 1 – Release Highlights 1.1 – New startup scene The first change you will notice is the startup scene. It has been re-coded from scratch and uses some of the new functions (true … Continue reading GeeXLab 0.10.0 with Vulkan support released for Windows and Linux »

The post GeeXLab 0.10.0 with Vulkan support released for Windows and Linux first appeared on HackLAB.]]>
 

A new version of GeeXLab is available for Windows 64-bit and Linux 64-bit. The branch 0.10.x comes with new features, improvements and bugfixes.

You can download GeeXLab 0.10.0.0 from THIS PAGE.

1 – Release Highlights

1.1 – New startup scene

The first change you will notice is the startup scene. It has been re-coded from scratch and uses some of the new functions (true type fonts, Vulkan):


GeeXLab

The startup scene is nothing more than a regular GeeXLab demo that has been embedded in GeeXLab. You can access to its source code with live coding tools.

1.2 – Vulkan support

Ok, even if Vulkan support comes in second position in the release highlights, Vulkan is the big thing of GeeXLab 0.10.0.x. I will detail in another post how to play with Vulkan in GeeXLab. Now, all you need to know is that Vulkan support is far from complete, only basic functionalities have been added: you can load SPIR-V shaders and textures (2D + array), create pipeline objects, descriptor sets and GPU buffers. Other functionalities such as render targets (for post processing) will be added later. Check this WIP thread for updates.

Vulkan is available in a plugin that is dynamically loaded when a Vulkan demo is started. The Vulkan plugin is available on Windows 64-bit and Linux 64-bit. I will release the Windows 32-bit version with the full release of GeeXLab (windows, linux, osx and rpi).


GeeXLab + Vulkan

1.3 – Code Sample Pack

The code sample pack has been entirely re-organized. There are now separate folders for each 3D API supported by GeeXLab: OpenGL (2.1, 3.2, 4.0, etc), OpenGL ES 2.0 (essentially for the Raspberry Pi), Direct3D 12 and of course Vulkan!


GeeXLab code sample pack

1.4 – New TrueType Font Library

The support of TrueType fonts is an important feature and any serious demo tool. So far the only way to display texts with TTF fonts was to use use functions of the FTGL plugin. These functions work fine and are fast but there are two drawbacks: a plugin is required (plugin_gxc_ftgl_x64.{dll|so|dylib}) and only OpenGL is supported. No way to use this plugin in Direct3D 12 and Vulkan scenes. Not cool 🙁

To display text in Direct3D 12 demos, I recently added the support of fonts via Direct2D. This support works but it is very slow and is limited to D3D12!

It was time to have an unified TrueType fonts management that works across all 3D APIs and platforms. For that I used that nice library: stb_truetype.h. Now I have a decent font management that works everywhere: on all platforms (Windows, Linux, OSX and Raspberry Pi) and with all 3D APIs (OpenGL, Vulkan and Direct3D 12). What’s more, the new font lib is embedded in GeeXLab, a plugin is no longer required.

All new functions are available via the new Lua/Python library: gh_font. I will explain how to use it in an upcoming post. If you’re impatient, just look at the code sample pack (gl-21/font-truetype/ or d3d12/11-truetype_font.xml or vk/06-truetype-font.xml).


GeeXLab + truetype fonts management

1.5 – New 3D Loader for STL objects

GeeXLab supports now the STL binary (StereoLithography) format. More information about the STL format can be found HERE. STL files are available in two formats: text or binary. GeeXLab only supports binary formats because they are simpler and faster to load.

A demo that load a STL object is available in the code sample pack: gl-32/loader-object-stl/


GeeXLab + STL 3D format

2 – Changelog

Version 0.10.0.0 - 2015.04.12
-----------------------------
+ [WINDOWS / LINUX] added Vulkan support with basic functionalities: meshes, 
  GPU programs, 2D textures + 2D arrays, uniform buffers, pipeline
  state objects. New functions have been added in gh_renderer and 
  gh_gpu_program lib (lua / python).
+ [WINDOWS / LINUX] added gpu_index attribute in XML window node to select 
  a particular GPU with Vulkan renderer.
+ added new gh_font lib to render texts using True Type fonts (lua and python). 
+ added three functions in gh_renderer lib (OpenGL, Vulkan and Direct3D 12) to 
  draw very simple primitives without vertex buffer: draw_points(), draw_lines() 
  and draw_triangles(). Vertices must be defined in the vertex shader. 
+ added update_vertices_position() and update_vertices_color() to 
  gh_vertex_pool lib (lua / python).
+ added create_from_file_loader_stl() in gh_model lib for the loading of 3D meshes
  in STL binary format.
+ added set_num_patch_vertices() to gh_renderer lib (lua).
! [WINDOWS] updated the internal flip framebuffer function of the Direct3D 12 plugin
  to improve stability.
* fixed bug in gh_renderer.blending().
* fixed bitmap font rendering (gh_utils.font_bm_xxxx()) bug in OpenGL 2.1 
  (code sample pack: /gl-21/bitmap-fonts/).
* fixed a memory leak in the FreeImage plugin.
* [WINDOWS / OSX] bugfix: the log file is now correctly opened (Tools > Show log file).
! updated gh_nvg lib with latest version of NanoVG.
! updated gh_utils.get_host_app_dir().
! gh_utils.hex_color_to_rgb() updated to support the # character of the
  HTML color (ex: "#ff8844").
The post GeeXLab 0.10.0 with Vulkan support released for Windows and Linux first appeared on HackLAB.]]>
https://www.geeks3d.com/hacklab/20160414/geexlab-0-10-0-with-vulkan-support-released-for-windows-and-linux/feed/ 0