Giter Site home page Giter Site logo

gpsnoopy / raytracinginvulkan Goto Github PK

View Code? Open in Web Editor NEW
1.1K 21.0 105.0 19.54 MB

Implementation of Peter Shirley's Ray Tracing In One Weekend book using Vulkan and NVIDIA's RTX extension.

License: BSD 3-Clause "New" or "Revised" License

CMake 3.21% GLSL 4.73% Shell 0.22% Batchfile 0.38% C++ 91.45%
vulkan ray-tracer rtx

raytracinginvulkan's People

Contributors

expenses avatar flakebi avatar goncalofds avatar gpsnoopy avatar mart-bogdan avatar onuralpszr avatar pmunkes avatar rplociennik avatar rumblehhh avatar xantares avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

raytracinginvulkan's Issues

Rendering Error with RDNA2

I noticed a weird rendering error in scene 2:
Metallic
Swapping the material of the affected sphere out to Material::Lambertian(vec3(1.0f),1) resolves the issue:
grafik
Switching the center Spere to Material::Metallic(vec3(1.0f), 0.0f) causes the issue to also affect this sphere:
grafik

This is on an RX 6800 on the 21.2.2 driver.

Benchmark results on RX 7900 XTX (1440p)

>RayTracer.exe --benchmark --width 2560 --height 1440 --fullscreen --scene 1 --next-scenes --present-mode 0
Vulkan SDK Header Version: 176

Vulkan Devices:
- [29772] AMD 'AMD Radeon RX 7900 XTX' (Discrete GPU: vulkan 1.3.242, driver AMD proprietary driver 23.3.2 (LLPC) - 2.0.258)
- [5710] AMD 'AMD Radeon(TM) Graphics' (Integrated GPU: vulkan 1.3.242, driver AMD proprietary driver 23.3.2 (AMD proprietary shader compiler) - 2.0.258)

Setting Device [29772]:
- loading '../assets/textures/white.png'... (1 x 1 x 3) 0.0035885s
- built acceleration structures in 3.80982s

Swap Chain:
- image count: 2
- present mode: 0


Benchmark: Start scene #1 'Ray Tracing In One Weekend'
Benchmark: 87.4205 fps
Benchmark: 80.9416 fps
Benchmark: 89.4815 fps
Benchmark: 91.6502 fps
Benchmark: 91.5253 fps
Benchmark: 91.5843 fps
Benchmark: 91.1013 fps
Benchmark: 91.1352 fps
Benchmark: 90.8025 fps
Benchmark: 91.4872 fps
Benchmark: 91.1266 fps

- loading '../assets/textures/2k_mars.jpg'... (2048 x 1024 x 3) 0.0204529s
- loading '../assets/textures/2k_moon.jpg'... (2048 x 1024 x 3) 0.0210354s
- loading '../assets/textures/land_ocean_ice_cloud_2048.png'... (2048 x 1024 x 3) 0.0458264s
- built acceleration structures in 0.0117277s

Benchmark: Start scene #2 'Planets In One Weekend'
Benchmark: 87.8838 fps
Benchmark: 88.0624 fps
Benchmark: 88.1155 fps
Benchmark: 88.6544 fps
Benchmark: 87.5483 fps
Benchmark: 87.8753 fps
Benchmark: 88.3719 fps
Benchmark: 87.7366 fps
Benchmark: 87.2728 fps
Benchmark: 88.2087 fps
Benchmark: 87.6958 fps

- loading '../assets/models/lucy.obj'... (673335 vertices, 224491 unique vertices, 1 materials) 0.774566s
- loading '../assets/textures/white.png'... (1 x 1 x 3) 0.0002391s
- built acceleration structures in 2.07657s

Benchmark: Start scene #3 'Lucy In One Weekend'
Benchmark: 37.9042 fps
Benchmark: 37.1313 fps
Benchmark: 37.0921 fps
Benchmark: 37.1622 fps
Benchmark: 37.0405 fps
Benchmark: 37.0305 fps
Benchmark: 37.162 fps
Benchmark: 37.0163 fps
Benchmark: 37.0519 fps
Benchmark: 37.0709 fps
Benchmark: 36.9782 fps

- loading '../assets/textures/white.png'... (1 x 1 x 3) 0.0001621s
- built acceleration structures in 0.225272s

Benchmark: Start scene #4 'Cornell Box'
Benchmark: 79.1766 fps
Benchmark: 79.7427 fps
Benchmark: 79.8492 fps
Benchmark: 79.679 fps
Benchmark: 80.0733 fps
Benchmark: 78.8818 fps
Benchmark: 79.2695 fps
Benchmark: 80.2017 fps
Benchmark: 79.6659 fps
Benchmark: 79.2253 fps
Benchmark: 80.0423 fps

- loading '../assets/models/lucy.obj'... (673335 vertices, 224491 unique vertices, 1 materials) 0.683207s
- loading '../assets/textures/white.png'... (1 x 1 x 3) 0.0001965s
- built acceleration structures in 0.0179536s

Benchmark: Start scene #5 'Cornell Box & Lucy'
Benchmark: 25.3381 fps
Benchmark: 25.2664 fps
Benchmark: 25.2436 fps
Benchmark: 25.1216 fps
Benchmark: 25.1891 fps
Benchmark: 25.1916 fps
Benchmark: 25.1626 fps
Benchmark: 25.1314 fps
Benchmark: 25.2212 fps
Benchmark: 25.1113 fps
Benchmark: 25.1164 fps

Failed to launch when Vulkan 1.0 GPU present

Vulkan SDK Header Version: 224

Vulkan Instance Extensions:
- VK_KHR_surface (0.0.25)
- VK_KHR_win32_surface (0.0.6)
- VK_KHR_external_memory_capabilities (0.0.1)
- VK_KHR_external_semaphore_capabilities (0.0.1)
- VK_KHR_external_fence_capabilities (0.0.1)
- VK_KHR_get_physical_device_properties2 (0.0.1)
- VK_KHR_get_surface_capabilities2 (0.0.1)
- VK_KHR_device_group_creation (0.0.1)
- VK_KHR_surface_protected_capabilities (0.0.1)
- VK_EXT_debug_report (0.0.10)
- VK_EXT_debug_utils (0.0.2)
- VK_EXT_swapchain_colorspace (0.0.4)
- VK_NV_external_memory_capabilities (0.0.1)

Vulkan Instance Layers:
- VK_LAYER_NV_optimus (1.3.205) : NVIDIA Optimus layer
- VK_LAYER_LUNARG_api_dump (1.3.224) : LunarG API dump layer
- VK_LAYER_LUNARG_gfxreconstruct (1.3.224) : GFXReconstruct Capture Layer Version 0.9.15
- VK_LAYER_KHRONOS_synchronization2 (1.3.224) : Khronos Synchronization2 layer
- VK_LAYER_KHRONOS_validation (1.3.224) : Khronos Validation Layer
- VK_LAYER_LUNARG_monitor (1.3.224) : Execution Monitoring Layer
- VK_LAYER_LUNARG_screenshot (1.3.224) : LunarG image capture layer
- VK_LAYER_KHRONOS_profiles (1.3.224) : Khronos Profiles layer

Vulkan Devices:
- [6918] NVIDIA 'NVIDIA GeForce GTX 1080 Ti' (Discrete GPU: vulkan 1.3.205, driver NVIDIA 517.40 - 517.40.0)
ERROR: VALIDATION: Validation Error: [ UNASSIGNED-API-Version-Violation ] Object 0: handle = 0x1cd6e0a7b80, type = VK_OBJECT_TYPE_INSTANCE; | MessageID = 0xc495fcb4 | Attempted to call vkGetPhysicalDeviceProperties2() with an effective API version of 1.0.66 (0x00400042), which is the minimum of version requested in pApplicationInfo (1.2.0 (0x00402000)) and supported by this physical device (1.0.66 (0x00400042)), but this API was not promoted until version 1.1.0 (0x00401000).

  Objects (1):
  - Object[0]: Type: INSTANCE, Handle: 000001CD6E0A7B80, Name: ''

FATAL: failed to load icon

Hi,

after I built the project successfully on Windows 10, with my Ryzen 5 2600, RTX 3070, 32 GB DDR4 memory PC.,
when I run the command .\build\windows\bin\RayTracer.exe --benchmark --width 1920 --height 1080 --scene 1 --present-mode 0, I get the following error:

FATAL: failed to load icon

 0# 0x00007FF6BDF01978 in RayTracer
 1# 0x00007FF6BDEF383E in RayTracer
 2# 0x00007FF6BDF24397 in RayTracer
 3# 0x00007FF6BDF399DC in RayTracer
 4# 0x00007FF6BDF3C58E in RayTracer
 5# 0x00007FF6BDF31ABE in RayTracer
 6# 0x00007FF6BDF299CF in RayTracer
 7# 0x00007FF6BE036320 in RayTracer
 8# BaseThreadInitThunk in KERNEL32
 9# RtlUserThreadStart in ntdll

How can I fix that?

Performance on Intel Arc A770 GPU

Bypassing issue #63 and running a Debug build of the latest git master leads to the following performance results:
(The configuration is the same as in the mentioned issue. Arc A770 LE with driver v31.0.101.3959 on up-to-date Windows 11.)

INFO: VALIDATION: Validation Information: [ UNASSIGNED-cache-file-error ] Object 0: handle = 0x252152bee28, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0xf0bb3995 | Cannot open shader validation cache at C:\Users\lizar\AppData\Local\Temp/shader_validation_cache.bin for reading (it may not exist yet)
- loading '../assets/textures/white.png'... (1 x 1 x 3) 8.93e-05s
- built acceleration structures in 2.89462s

Swap Chain:
- image count: 2
- present mode: 0


Benchmark: Start scene #1 'Ray Tracing In One Weekend'
Benchmark: 25.6914 fps
Benchmark: 26.0375 fps
Benchmark: 26.5622 fps
Benchmark: 26.4498 fps
Benchmark: 26.5004 fps
Benchmark: 26.461 fps
Benchmark: 26.4671 fps
Benchmark: 26.4924 fps
Benchmark: 26.5056 fps
Benchmark: 26.487 fps
Benchmark: 26.48 fps

- loading '../assets/textures/2k_mars.jpg'... (2048 x 1024 x 3) 0.0314502s
- loading '../assets/textures/2k_moon.jpg'... (2048 x 1024 x 3) 0.0354696s
- loading '../assets/textures/land_ocean_ice_cloud_2048.png'... (2048 x 1024 x 3) 0.0531558s
- built acceleration structures in 0.01571s

Benchmark: Start scene #2 'Planets In One Weekend'
Benchmark: 26.8934 fps
Benchmark: 26.82 fps
Benchmark: 26.7829 fps
Benchmark: 26.8111 fps
Benchmark: 26.7925 fps
Benchmark: 26.6509 fps
Benchmark: 26.7732 fps
Benchmark: 26.7719 fps
Benchmark: 26.6495 fps
Benchmark: 26.8057 fps
Benchmark: 26.7682 fps

- loading '../assets/models/lucy.obj'... (673335 vertices, 224491 unique vertices, 1 materials) 2.24408s
- loading '../assets/textures/white.png'... (1 x 1 x 3) 9.51e-05s
- built acceleration structures in 0.0527806s

Benchmark: Start scene #3 'Lucy In One Weekend'
Benchmark: 20.666 fps
Benchmark: 20.4847 fps
Benchmark: 20.5037 fps
Benchmark: 20.4868 fps
Benchmark: 20.3801 fps
Benchmark: 20.5365 fps
Benchmark: 20.4466 fps
Benchmark: 20.3426 fps
Benchmark: 20.5574 fps
Benchmark: 20.4737 fps
Benchmark: 20.3764 fps

- loading '../assets/textures/white.png'... (1 x 1 x 3) 8.67e-05s
- built acceleration structures in 0.0012437s

Benchmark: Start scene #4 'Cornell Box'
Benchmark: 36.4469 fps
Benchmark: 36.2765 fps
Benchmark: 36.174 fps
Benchmark: 36.3179 fps
Benchmark: 36.2652 fps
Benchmark: 36.2614 fps
Benchmark: 36.2781 fps
Benchmark: 36.2546 fps
Benchmark: 36.2643 fps
Benchmark: 36.2721 fps
Benchmark: 36.1838 fps

- loading '../assets/models/lucy.obj'... (673335 vertices, 224491 unique vertices, 1 materials) 2.25068s
- loading '../assets/textures/white.png'... (1 x 1 x 3) 0.0001027s
- built acceleration structures in 0.0205295s

Benchmark: Start scene #5 'Cornell Box & Lucy'
Benchmark: 17.4216 fps
Benchmark: 17.7213 fps
Benchmark: 17.683 fps
Benchmark: 17.7028 fps
Benchmark: 17.6965 fps
Benchmark: 17.6816 fps
Benchmark: 17.7045 fps
Benchmark: 17.7249 fps
Benchmark: 17.7292 fps
Benchmark: 17.71 fps
Benchmark: 17.7308 fps

VK_BUFFER_USAGE_VERTEX_BUFFER_BIT and VK_BUFFER_USAGE_INDEX_BUFFER_BIT

Vertex and Index buffers are created with the usage types mentioned in the title.
However, these are in fact storage buffers used by shaders of the RayTracing pipeline.
The VK_BUFFER_USAGE_VERTEX_BUFFER_BIT and VK_BUFFER_USAGE_INDEX_BUFFER_BIT usage specs are related to the graphics pipeline (vertex shader).
Could you please elaborate on your choice of these usage specs in a ray tracing pipeline?

Rebuild after Vulkan SDK Upgrade

In a windows 10 with VS 2022 environment, what would be the most efficient way to rebuild the solution after a Vulkan SDK Upgrade (hence VULKAN_SDK and VK_SDK_PATH environment variables are changed)?

failed to enumerate when trying to execute on Manjaro (Linux)

After finally building it I can't execute it.
I cloned the git and installed glslang and libbacktrace-git to build it.

> ./RayTracer --benchmark --width 2560 --height 1440 --fullscreen --scene 1 --next-scenes --present-mode 0 
FATAL: failed to enumerate (ERROR_INITIALIZATION_FAILED)

 0# void Throw<std::runtime_error>(std::runtime_error const&) in ./RayTracer
 1# Vulkan::Check(VkResult, char const*) [clone .cold] in ./RayTracer
 2# Vulkan::Instance::GetVulkanPhysicalDevices() in ./RayTracer
 3# Vulkan::Instance::Instance(Vulkan::Window const&, std::vector<char const*, std::allocator<char const*> > const&, unsigned int) in ./RayTracer
 4# Vulkan::Application::Application(Vulkan::WindowConfig const&, VkPresentModeKHR, bool) in ./RayTracer
 5# Vulkan::RayTracing::Application::Application(Vulkan::WindowConfig const&, VkPresentModeKHR, bool) in ./RayTracer
 6# RayTracer::RayTracer(UserSettings const&, Vulkan::WindowConfig const&, VkPresentModeKHR) in ./RayTracer
 7# main in ./RayTracer
 8# __libc_start_main in /usr/lib/libc.so.6
 9# _start in ./RayTracer

I am having a gtx 1060 6gb with Nvidia-driver 460.32.03

Benchmark results on RTX 3060 Ti (1440p)

Latest git release built on arch linux

Vulkan Devices:
- [9353] NVIDIA 'NVIDIA GeForce RTX 3060 Ti' (Discrete GPU: vulkan 1.3.205, driver NVIDIA 515.57 - 515.57.0)

Benchmark: Start scene #1 'Ray Tracing In One Weekend'
Benchmark: 23.7642 fps
Benchmark: 23.7458 fps
Benchmark: 23.9378 fps
Benchmark: 23.942 fps
Benchmark: 23.9334 fps
Benchmark: 23.9423 fps
Benchmark: 23.8359 fps
Benchmark: 23.8132 fps
Benchmark: 23.814 fps
Benchmark: 23.8044 fps
Benchmark: 23.7998 fps

Benchmark: Start scene #2 'Planets In One Weekend'
Benchmark: 24.438 fps
Benchmark: 24.373 fps
Benchmark: 24.3735 fps
Benchmark: 24.3788 fps
Benchmark: 24.3785 fps
Benchmark: 24.3722 fps
Benchmark: 24.3781 fps
Benchmark: 24.3789 fps
Benchmark: 24.2965 fps
Benchmark: 24.2627 fps
Benchmark: 24.2647 fps

Benchmark: Start scene #3 'Lucy In One Weekend'
Benchmark: 22.2492 fps
Benchmark: 22.1447 fps
Benchmark: 22.0661 fps
Benchmark: 22.0605 fps
Benchmark: 22.0465 fps
Benchmark: 22.0372 fps
Benchmark: 22.0194 fps
Benchmark: 21.9202 fps
Benchmark: 21.9153 fps
Benchmark: 21.9042 fps
Benchmark: 21.904 fps

Benchmark: Start scene #4 'Cornell Box'
Benchmark: 41.3036 fps
Benchmark: 41.371 fps
Benchmark: 41.362 fps
Benchmark: 41.3704 fps
Benchmark: 41.3556 fps
Benchmark: 41.3669 fps
Benchmark: 41.3814 fps
Benchmark: 41.2616 fps
Benchmark: 41.1941 fps
Benchmark: 41.1909 fps
Benchmark: 41.2028 fps

Benchmark: Start scene #5 'Cornell Box & Lucy'
Benchmark: 20.8899 fps
Benchmark: 20.8103 fps
Benchmark: 20.7644 fps
Benchmark: 20.7334 fps
Benchmark: 20.7224 fps
Benchmark: 20.7049 fps
Benchmark: 20.6921 fps
Benchmark: 20.679 fps
Benchmark: 20.649 fps
Benchmark: 20.625 fps
Benchmark: 20.6671 fps

CPU: Ryzen 7 3700x
RAM: 32gb 3200mhz
GPU: RTX 3060 Ti
Display: 2560x1440

Validation Errors

- loading '../assets/textures/white.png'... (1 x 1 x 3) 0.0003277s
- built acceleration structures in 0.0429433s
ERROR: VALIDATION: Validation Error: [ UNASSIGNED-spirv-shaderClock-shaderSubgroupClock ] Object 0: handle = 0x19450f759e8, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0xa73ec9c2 | VkShaderModule 0x57fea6000000023e[]: OpReadClockKHR is used with a Subgroup scope but shaderSubgroupClock was not enabled.

  Objects (1):
  - Object[0]: Type: DEVICE, Handle: 0000019450F759E8, Name: ''

ERROR: VALIDATION: Validation Error: [ UNASSIGNED-spirv-shaderClock-shaderSubgroupClock ] Object 0: handle = 0x19450f759e8, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0xa73ec9c2 | VkShaderModule 0x57fea6000000023e[]: OpReadClockKHR is used with a Subgroup scope but shaderSubgroupClock was not enabled.

  Objects (1):
  - Object[0]: Type: DEVICE, Handle: 0000019450F759E8, Name: ''


Swap Chain:
- image count: 2
- present mode: 2

ERROR: VALIDATION: Validation Error: [ VUID-VkMappedMemoryRange-size-01389 ] Object 0: handle = 0x1a4aac0000000255, type = VK_OBJECT_TYPE_DEVICE_MEMORY; | MessageID = 0xee4872d | vkFlushMappedMemoryRanges: Size in pMemRanges[0] is VK_WHOLE_SIZE and the mapping end (0x8638 = 0x0 + 0x8638) not a multiple of VkPhysicalDeviceLimits::nonCoherentAtomSize (0x40) and not equal to the end of the memory object (0x8700). The Vulkan spec states: If size is equal to VK_WHOLE_SIZE, the end of the current mapping of memory must either be a multiple of VkPhysicalDeviceLimits::nonCoherentAtomSize bytes from the beginning of the memory object, or be equal to the end of the memory object (https://vulkan.lunarg.com/doc/view/1.2.176.1/windows/1.2-extensions/vkspec.html#VUID-VkMappedMemoryRange-size-01389)

  Objects (1):
  - Object[0]: Type: DEVICE_MEMORY, Handle: 1A4AAC0000000255, Name: ''

Black screen on GeForce 1000 series (Linux)

Hi,
recently I am learning raytracing, and find your awesome git, I think your git is what I need for raytracing learning, but when I try to build it on my ubuntu system, TITAN X (Pascal), I find the screen is black , nothing rendered, and I can see the frame is around 12 fps, which I think is calculating, and I turn off the enable ray tracing check box, it's still show nothing, I already build nvidia lessons about vulkan and raytracing example, and pretty sure it can run on my card, so is there any hint that I can check? Thank you.

-Best
Wy

Does not start, "found no matching transfer queue"

$ export RADV_PERFTEST=rt
$ ./RayTracer

Vulkan SDK Header Version: 204

Vulkan Instance Extensions: 
- VK_KHR_device_group_creation (0.0.1)
- VK_KHR_display (0.0.23)
- VK_KHR_external_fence_capabilities (0.0.1)
- VK_KHR_external_memory_capabilities (0.0.1)
- VK_KHR_external_semaphore_capabilities (0.0.1)
- VK_KHR_get_display_properties2 (0.0.1)
- VK_KHR_get_physical_device_properties2 (0.0.2)
- VK_KHR_get_surface_capabilities2 (0.0.1)
- VK_KHR_surface (0.0.25)
- VK_KHR_surface_protected_capabilities (0.0.1)
- VK_KHR_wayland_surface (0.0.6)
- VK_KHR_xcb_surface (0.0.6)
- VK_KHR_xlib_surface (0.0.6)
- VK_EXT_acquire_drm_display (0.0.1)
- VK_EXT_acquire_xlib_display (0.0.1)
- VK_EXT_debug_report (0.0.10)
- VK_EXT_direct_mode_display (0.0.1)
- VK_EXT_display_surface_counter (0.0.1)
- VK_EXT_debug_utils (0.0.2)

Vulkan Instance Layers: 
- VK_LAYER_MESA_device_select (1.2.73) : Linux device selection layer

Vulkan Devices: 
- [29631] AMD 'AMD RADV SIENNA_CICHLID' (Discrete GPU: vulkan 1.3.204, driver radv Mesa 22.0.1 - 22.0.1)
- [0] UnknownVendor 'llvmpipe (LLVM 13.0.1, 256 bits)' (CPU: vulkan 1.2.204, driver llvmpipe Mesa 22.0.1 (LLVM 13.0.1) - 0.0.1)

Setting Device [29631]:
FATAL: found no matching transfer queue

 0# 0x000000000040D282 in ./RayTracer
 1# 0x000000000040E46C in ./RayTracer
 2# 0x000000000044DA1A in ./RayTracer
 3# 0x0000000000446322 in ./RayTracer
 4# 0x00000000004588C9 in ./RayTracer
 5# 0x00000000004669E1 in ./RayTracer
 6# 0x000000000044726A in ./RayTracer
 7# 0x0000000000418497 in ./RayTracer
 8# 0x00007FAD6A76D590 in /lib64/libc.so.6
 9# __libc_start_main in /lib64/libc.so.6
10# 0x0000000000418FC5 in ./RayTracer

STB not found

I've installed stb 20210910, but it is not found by raytracinginvulkan's CMake:

  Could not find a package configuration file provided by "Stb" with any of
  the following names:

    StbConfig.cmake
    stb-config.cmake

Option to select GPU

Currently when I run it I recieve following output:

Vulkan Devices: 
- [9373] NVIDIA 'NVIDIA GeForce RTX 3070 Laptop GPU' (Discrete GPU: vulkan 1.3.236, driver NVIDIA 530.41.03 - 530.41.12)
- [5688] AMD 'AMD Radeon Graphics (RADV RENOIR)' (Integrated GPU: vulkan 1.3.238, driver radv Mesa 23.0.1 - 23.0.1)

Setting Device [9373]:

Is there way to select device?
Running with --help option don't show this as option

Performance investigations on RDNA2 cards.

I ran the Raytracer through AMDs GPU profiler to check out how it runs on my RX6800. (I will upload the results in a different issue.)
It reported that the RT shader is limited by it's LDS usage of 4 KB to half occupancy, and that it uses 80 vector registers.
Decreasing LDS usage to 3072B could increase the occupancy up to 12 parallel wavefronts (warps on nVidia Hardware) the maximum for 80 Vector registers. This should improve performance as less time is spent idle.

Reducing LDS usage to 2048B would allow further optimizations to VGPR (Vector General Purpose Register) usage. Reducing VGPRS to 64 would allow full occupancy and presumably maximum performance.

Edit: I believe LDS is AMDs name for Workgroup Memory.

Can not compile on Ubuntu 22.04

Can not compile, my hardware is AMD Radeon RX 6800 XT on Ubuntu 22.04 LTS using native amdgpu driver:

$ gcc -v;
...
gcc version 11.2.0 (Ubuntu 11.2.0-19ubuntu1)
$ git clone https://github.com/GPSnoopy/RayTracingInVulkan; cd RayTracingInVulkan/;
$ apt -y install curl unzip tar libxi-dev libxinerama-dev libxcursor-dev xorg-dev;
$ ./vcpkg_linux.sh
$ ./build_linux.sh
...
CMake Warning at /usr/share/cmake-3.22/Modules/FindBoost.cmake:1369 (message):
  New Boost version may have incorrect or missing dependencies and imported
  targets
Call Stack (most recent call first):
  /usr/share/cmake-3.22/Modules/FindBoost.cmake:1492 (_Boost_COMPONENT_DEPENDENCIES)
  /usr/share/cmake-3.22/Modules/FindBoost.cmake:2102 (_Boost_MISSING_DEPENDENCIES)
  build/vcpkg.linux/installed/x64-linux/share/boost/vcpkg-cmake-wrapper.cmake:11 (_find_package)
  build/vcpkg.linux/scripts/buildsystems/vcpkg.cmake:778 (include)
  CMakeLists.txt:50 (find_package)

CMake Warning at /usr/share/cmake-3.22/Modules/FindBoost.cmake:1369 (message):
  New Boost version may have incorrect or missing dependencies and imported
  targets
Call Stack (most recent call first):
  /usr/share/cmake-3.22/Modules/FindBoost.cmake:1492 (_Boost_COMPONENT_DEPENDENCIES)
  /usr/share/cmake-3.22/Modules/FindBoost.cmake:2102 (_Boost_MISSING_DEPENDENCIES)
  build/vcpkg.linux/installed/x64-linux/share/boost/vcpkg-cmake-wrapper.cmake:11 (_find_package)
  build/vcpkg.linux/scripts/buildsystems/vcpkg.cmake:778 (include)
  CMakeLists.txt:50 (find_package)

CMake Error at /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find Vulkan (missing: Vulkan_LIBRARY Vulkan_INCLUDE_DIR)
Call Stack (most recent call first):
  /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake-3.22/Modules/FindVulkan.cmake:129 (find_package_handle_standard_args)
  build/vcpkg.linux/scripts/buildsystems/vcpkg.cmake:824 (_find_package)
  CMakeLists.txt:56 (find_package)

-- Configuring incomplete, errors occurred!
See also "/home/.../Descargas/RayTracingInVulkan/build/linux/CMakeFiles/CMakeOutput.log".

Output log: CMakeOutput.log

validation-error: acceleration-structure-buffer is missing 'VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT'

running the application with validation-layers enabled I'm seeing the following error:

VUID-vkGetAccelerationStructureDeviceAddressKHR-pInfo-09542(ERROR / SPEC): msgNum: -457819186 - Validation Error: [ VUID-vkGetAccelerationStructureDeviceAddressKHR-pInfo-09542 ] | MessageID = 0xe4b63bce | vkGetAccelerationStructureDeviceAddressKHR(): pInfo->accelerationStructure.buffer was created with usage flag(s) VK_BUFFER_USAGE_ACCELERATION_STRUCTURE_STORAGE_BIT_KHR. The Vulkan spec states: The buffer on which pInfo->accelerationStructure was placed must have been created with the VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT usage flag (https://vulkan.lunarg.com/doc/view/1.3.280.0/linux/1.3-extensions/vkspec.html#VUID-vkGetAccelerationStructureDeviceAddressKHR-pInfo-09542)

using: ubuntu 22.04, nvidia 550.67, vulkan SDK 1.3.280.1

where to find the imguiConfig.cmake ,imgui-config.cmake, and tinyobjloaderConfig.cmake, and tinyobjloader-config.cmake?

Hi,
I read the code for several days and I can run the program by following the readme.
But I still want do debug the program using some IDE, e.g. CLion, QT Creator and Visual Studio, so I tried to compile the source code using the CMakeLists.txt file, and I've fixed some errors yet, but 2 libs left, imgui and tinyobjloader,
the error log in Jetbrains Clion is like:

CMake Error at CMakeLists.txt:57 (find_package):
  Could not find a package configuration file provided by "imgui" with any of
  the following names:

    imguiConfig.cmake
    imgui-config.cmake

  Add the installation prefix of "imgui" to CMAKE_PREFIX_PATH or set
  "imgui_DIR" to a directory containing one of the above files.  If "imgui"
  provides a separate development package or SDK, be sure it has been
  installed.


-- Configuring incomplete, errors occurred!

I download several defferent versions of imgui and tinyobjloader lib, but I can't find any .cmake file in them,

so,

where to find the imguiConfig.cmake ,imgui-config.cmake, and tinyobjloaderConfig.cmake, and tinyobjloader-config.cmake?

Much Appreciated!

Building Fails on Linux (backtrace.h is missing)

Trying to build this package following the instructions in the README on Arch Linux fails during build_linux.sh because of a bunch of CMake errors, all having to do with backtrace.h: No such file or directory. Seems a couple dozen of the vcpkg.linux files are trying to include backtrace.h but there's no backtrace.h to be found. I have all the dependencies including the Vulkan SDK.

In file included from /home/matt/dev/raytracing/build/vcpkg.linux/installed/x64-linux/include/boost/stacktrace/detail/frame_unwind.ipp:25,
                 from /home/matt/dev/raytracing/build/vcpkg.linux/installed/x64-linux/include/boost/stacktrace/frame.hpp:61,
                 from /home/matt/dev/raytracing/build/vcpkg.linux/installed/x64-linux/include/boost/stacktrace.hpp:15,
                 from /home/matt/dev/raytracing/src/./Utilities/Exception.hpp:7,
                 from /home/matt/dev/raytracing/src/Vulkan/DebugUtils.cpp:2:
/home/matt/dev/raytracing/build/vcpkg.linux/installed/x64-linux/include/boost/stacktrace/detail/libbacktrace_impls.hpp:23:13: fatal error: backtrace.h: No such file or directory
   23 | #   include <backtrace.h>
      |             ^~~~~~~~~~~~~
compilation terminated.
In file included from /home/matt/dev/raytracing/build/vcpkg.linux/installed/x64-linux/include/boost/stacktrace/detail/frame_unwind.ipp:25,
                 from /home/matt/dev/raytracing/build/vcpkg.linux/installed/x64-linux/include/boost/stacktrace/frame.hpp:61,
                 from /home/matt/dev/raytracing/build/vcpkg.linux/installed/x64-linux/include/boost/stacktrace.hpp:15,
                 from /home/matt/dev/raytracing/src/./Utilities/Exception.hpp:7,
                 from /home/matt/dev/raytracing/src/Assets/Texture.cpp:3:
/home/matt/dev/raytracing/build/vcpkg.linux/installed/x64-linux/include/boost/stacktrace/detail/libbacktrace_impls.hpp:23:13: fatal error: backtrace.h: No such file or directory
   23 | #   include <backtrace.h>
      |             ^~~~~~~~~~~~~
compilation terminated.
[ 59%] Building CXX object src/CMakeFiles/RayTracer.dir/Vulkan/FrameBuffer.cpp.o
[ 60%] Building CXX object src/CMakeFiles/RayTracer.dir/Vulkan/GraphicsPipeline.cpp.o
make[2]: *** [src/CMakeFiles/RayTracer.dir/build.make:121: src/CMakeFiles/RayTracer.dir/Assets/Texture.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: *** [src/CMakeFiles/RayTracer.dir/build.make:264: src/CMakeFiles/RayTracer.dir/Vulkan/DebugUtils.cpp.o] Error 1
[ 62%] Building CXX object src/CMakeFiles/RayTracer.dir/Vulkan/Image.cpp.o
In file included from /home/matt/dev/raytracing/build/vcpkg.linux/installed/x64-linux/include/boost/stacktrace/detail/frame_unwind.ipp:25,
                 from /home/matt/dev/raytracing/build/vcpkg.linux/installed/x64-linux/include/boost/stacktrace/frame.hpp:61,
                 from /home/matt/dev/raytracing/build/vcpkg.linux/installed/x64-linux/include/boost/stacktrace.hpp:15,
                 from /home/matt/dev/raytracing/src/./Utilities/Exception.hpp:7,
                 from /home/matt/dev/raytracing/src/Assets/Scene.cpp:9:
/home/matt/dev/raytracing/build/vcpkg.linux/installed/x64-linux/include/boost/stacktrace/detail/libbacktrace_impls.hpp:23:13: fatal error: backtrace.h: No such file or directory
   23 | #   include <backtrace.h>
      |             ^~~~~~~~~~~~~
compilation terminated.
make[2]: *** [src/CMakeFiles/RayTracer.dir/build.make:108: src/CMakeFiles/RayTracer.dir/Assets/Scene.cpp.o] Error 1
In file included from /home/matt/dev/raytracing/build/vcpkg.linux/installed/x64-linux/include/boost/stacktrace/detail/frame_unwind.ipp:25,
                 from /home/matt/dev/raytracing/build/vcpkg.linux/installed/x64-linux/include/boost/stacktrace/frame.hpp:61,
                 from /home/matt/dev/raytracing/build/vcpkg.linux/installed/x64-linux/include/boost/stacktrace.hpp:15,
                 from /home/matt/dev/raytracing/src/./Utilities/Exception.hpp:7,
                 from /home/matt/dev/raytracing/src/Assets/Model.cpp:5:
/home/matt/dev/raytracing/build/vcpkg.linux/installed/x64-linux/include/boost/stacktrace/detail/libbacktrace_impls.hpp:23:13: fatal error: backtrace.h: No such file or directory
   23 | #   include <backtrace.h>
      |             ^~~~~~~~~~~~~
compilation terminated.
make[2]: *** [src/CMakeFiles/RayTracer.dir/build.make:95: src/CMakeFiles/RayTracer.dir/Assets/Model.cpp.o] Error 1
In file included from /home/matt/dev/raytracing/build/vcpkg.linux/installed/x64-linux/include/boost/stacktrace/detail/frame_unwind.ipp:25,
                 from /home/matt/dev/raytracing/build/vcpkg.linux/installed/x64-linux/include/boost/stacktrace/frame.hpp:61,
                 from /home/matt/dev/raytracing/build/vcpkg.linux/installed/x64-linux/include/boost/stacktrace.hpp:15,
                 from /home/matt/dev/raytracing/src/./Utilities/Exception.hpp:7,
                 from /home/matt/dev/raytracing/src/Vulkan/DepthBuffer.cpp:7:
/home/matt/dev/raytracing/build/vcpkg.linux/installed/x64-linux/include/boost/stacktrace/detail/libbacktrace_impls.hpp:23:13: fatal error: backtrace.h: No such file or directory
   23 | #   include <backtrace.h>
      |             ^~~~~~~~~~~~~
compilation terminated.
In file included from /home/matt/dev/raytracing/build/vcpkg.linux/installed/x64-linux/include/boost/stacktrace/detail/frame_unwind.ipp:25,
                 from /home/matt/dev/raytracing/build/vcpkg.linux/installed/x64-linux/include/boost/stacktrace/frame.hpp:61,
                 from /home/matt/dev/raytracing/build/vcpkg.linux/installed/x64-linux/include/boost/stacktrace.hpp:15,
                 from /home/matt/dev/raytracing/src/./Utilities/Exception.hpp:7,
                 from /home/matt/dev/raytracing/src/Vulkan/DebugUtilsMessenger.cpp:4:
/home/matt/dev/raytracing/build/vcpkg.linux/installed/x64-linux/include/boost/stacktrace/detail/libbacktrace_impls.hpp:23:13: fatal error: backtrace.h: No such file or directory
   23 | #   include <backtrace.h>
      |             ^~~~~~~~~~~~~
compilation terminated.
make[2]: *** [src/CMakeFiles/RayTracer.dir/build.make:290: src/CMakeFiles/RayTracer.dir/Vulkan/DepthBuffer.cpp.o] Error 1
make[2]: *** [src/CMakeFiles/RayTracer.dir/build.make:277: src/CMakeFiles/RayTracer.dir/Vulkan/DebugUtilsMessenger.cpp.o] Error 1
In file included from /home/matt/dev/raytracing/build/vcpkg.linux/installed/x64-linux/include/boost/stacktrace/detail/frame_unwind.ipp:25,
                 from /home/matt/dev/raytracing/build/vcpkg.linux/installed/x64-linux/include/boost/stacktrace/frame.hpp:61,
                 from /home/matt/dev/raytracing/build/vcpkg.linux/installed/x64-linux/include/boost/stacktrace.hpp:15,
                 from /home/matt/dev/raytracing/src/./Utilities/Exception.hpp:7,
                 from /home/matt/dev/raytracing/src/Vulkan/DescriptorSets.cpp:5:
/home/matt/dev/raytracing/build/vcpkg.linux/installed/x64-linux/include/boost/stacktrace/detail/libbacktrace_impls.hpp:23:13: fatal error: backtrace.h: No such file or directory
   23 | #   include <backtrace.h>
      |             ^~~~~~~~~~~~~
compilation terminated.
make[2]: *** [src/CMakeFiles/RayTracer.dir/build.make:342: src/CMakeFiles/RayTracer.dir/Vulkan/DescriptorSets.cpp.o] Error 1
In file included from /home/matt/dev/raytracing/build/vcpkg.linux/installed/x64-linux/include/boost/stacktrace/detail/frame_unwind.ipp:25,
                 from /home/matt/dev/raytracing/build/vcpkg.linux/installed/x64-linux/include/boost/stacktrace/frame.hpp:61,
                 from /home/matt/dev/raytracing/build/vcpkg.linux/installed/x64-linux/include/boost/stacktrace.hpp:15,
                 from /home/matt/dev/raytracing/src/./Utilities/Exception.hpp:7,
                 from /home/matt/dev/raytracing/src/Vulkan/Device.cpp:5:
/home/matt/dev/raytracing/build/vcpkg.linux/installed/x64-linux/include/boost/stacktrace/detail/libbacktrace_impls.hpp:23:13: fatal error: backtrace.h: No such file or directory
   23 | #   include <backtrace.h>
      |             ^~~~~~~~~~~~~
compilation terminated.
make[2]: *** [src/CMakeFiles/RayTracer.dir/build.make:355: src/CMakeFiles/RayTracer.dir/Vulkan/Device.cpp.o] Error 1
In file included from /home/matt/dev/raytracing/build/vcpkg.linux/installed/x64-linux/include/boost/stacktrace/detail/frame_unwind.ipp:25,
                 from /home/matt/dev/raytracing/build/vcpkg.linux/installed/x64-linux/include/boost/stacktrace/frame.hpp:61,
                 from /home/matt/dev/raytracing/build/vcpkg.linux/installed/x64-linux/include/boost/stacktrace.hpp:15,
                 from /home/matt/dev/raytracing/src/./Utilities/Exception.hpp:7,
                 from /home/matt/dev/raytracing/src/Vulkan/Application.cpp:21:
/home/matt/dev/raytracing/build/vcpkg.linux/installed/x64-linux/include/boost/stacktrace/detail/libbacktrace_impls.hpp:23:13: fatal error: backtrace.h: No such file or directory
   23 | #   include <backtrace.h>
      |             ^~~~~~~~~~~~~
compilation terminated.
make[2]: *** [src/CMakeFiles/RayTracer.dir/build.make:212: src/CMakeFiles/RayTracer.dir/Vulkan/Application.cpp.o] Error 1
In file included from /home/matt/dev/raytracing/build/vcpkg.linux/installed/x64-linux/include/boost/stacktrace/detail/frame_unwind.ipp:25,
                 from /home/matt/dev/raytracing/build/vcpkg.linux/installed/x64-linux/include/boost/stacktrace/frame.hpp:61,
                 from /home/matt/dev/raytracing/build/vcpkg.linux/installed/x64-linux/include/boost/stacktrace.hpp:15,
                 from /home/matt/dev/raytracing/src/./Utilities/Exception.hpp:7,
                 from /home/matt/dev/raytracing/src/Vulkan/DescriptorSetManager.cpp:6:
/home/matt/dev/raytracing/build/vcpkg.linux/installed/x64-linux/include/boost/stacktrace/detail/libbacktrace_impls.hpp:23:13: fatal error: backtrace.h: No such file or directory
   23 | #   include <backtrace.h>
      |             ^~~~~~~~~~~~~
compilation terminated.
make[2]: *** [src/CMakeFiles/RayTracer.dir/build.make:329: src/CMakeFiles/RayTracer.dir/Vulkan/DescriptorSetManager.cpp.o] Error 1
In file included from /home/matt/dev/raytracing/build/vcpkg.linux/installed/x64-linux/include/boost/stacktrace/detail/frame_unwind.ipp:25,
                 from /home/matt/dev/raytracing/build/vcpkg.linux/installed/x64-linux/include/boost/stacktrace/frame.hpp:61,
                 from /home/matt/dev/raytracing/build/vcpkg.linux/installed/x64-linux/include/boost/stacktrace.hpp:15,
                 from /home/matt/dev/raytracing/src/./Utilities/Exception.hpp:7,
                 from /home/matt/dev/raytracing/src/Vulkan/DeviceMemory.cpp:3:
/home/matt/dev/raytracing/build/vcpkg.linux/installed/x64-linux/include/boost/stacktrace/detail/libbacktrace_impls.hpp:23:13: fatal error: backtrace.h: No such file or directory
   23 | #   include <backtrace.h>
      |             ^~~~~~~~~~~~~
compilation terminated.
make[2]: *** [src/CMakeFiles/RayTracer.dir/build.make:368: src/CMakeFiles/RayTracer.dir/Vulkan/DeviceMemory.cpp.o] Error 1
In file included from /home/matt/dev/raytracing/build/vcpkg.linux/installed/x64-linux/include/boost/stacktrace/detail/frame_unwind.ipp:25,
                 from /home/matt/dev/raytracing/build/vcpkg.linux/installed/x64-linux/include/boost/stacktrace/frame.hpp:61,
                 from /home/matt/dev/raytracing/build/vcpkg.linux/installed/x64-linux/include/boost/stacktrace.hpp:15,
                 from /home/matt/dev/raytracing/src/./Utilities/Exception.hpp:7,
                 from /home/matt/dev/raytracing/src/Vulkan/Image.cpp:6:
/home/matt/dev/raytracing/build/vcpkg.linux/installed/x64-linux/include/boost/stacktrace/detail/libbacktrace_impls.hpp:23:13: fatal error: backtrace.h: No such file or directory
   23 | #   include <backtrace.h>
      |             ^~~~~~~~~~~~~
compilation terminated.
make[2]: *** [src/CMakeFiles/RayTracer.dir/build.make:420: src/CMakeFiles/RayTracer.dir/Vulkan/Image.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:161: src/CMakeFiles/RayTracer.dir/all] Error 2
make: *** [Makefile:103: all] Error 2

I'm happy to provide any information you might need to get this working. Vulkan SDK version is 1.2.162.1, GCC 10.2.0.

Build Problem

Followed the prescribed build method for Windows:

vcpkg_windows.bat
build_windows.bat
No .sln file for the solution produced.
What is the correct and complete way to build this?

Light?

Hello there,
How do you handle the global light? In Graphics.frag I see you have a fixed vector but I cannot find something similar in the path tracing code. Thanks.

Benchmark Results on AMD Radeon RX6600XT

$ uname -ar
Linux shrimp-paste 6.8.5-301.fc40.ppc64le #1 SMP Thu Apr 11 19:52:51 UTC 2024 ppc64le GNU/Linux
# RayTracer at commit SHA 10794239fb070600a8698dd6bfc92de5417300c4
$ ./RayTracer --benchmark --width 2560 --height 1440 --fullscreen --scene 1 --next-scenes --present-mode 0
Vulkan SDK Header Version: 280

Vulkan Devices:
- [29695] AMD 'AMD Radeon RX 6600 XT (RADV NAVI23)' (Discrete GPU: vulkan 1.3.274, driver radv Mesa 24.0.5 - 24.0.5)
- [0] UnknownVendor 'llvmpipe (LLVM 18.1.1, 128 bits)' (CPU: vulkan 1.3.274, driver llvmpipe Mesa 24.0.5 (LLVM 18.1.1) - 0.0.1)

Setting Device [29695]:
- loading '../assets/textures/white.png'... (1 x 1 x 3) 4.8446e-05s
- built acceleration structures in 0.0228474s

Swap Chain:
- image count: 5
- present mode: 0

Benchmark: Start scene #1 'Ray Tracing In One Weekend'
Benchmark: 23.9831 fps
Benchmark: 23.3478 fps
Benchmark: 23.3563 fps
Benchmark: 23.3206 fps
Benchmark: 23.3 fps
Benchmark: 23.1904 fps
Benchmark: 22.8472 fps
Benchmark: 22.9988 fps
Benchmark: 22.8318 fps
Benchmark: 22.7934 fps
Benchmark: 23.1483 fps

- loading '../assets/textures/2k_mars.jpg'... (2048 x 1024 x 3) 0.0621568s
- loading '../assets/textures/2k_moon.jpg'... (2048 x 1024 x 3) 0.0512641s
- loading '../assets/textures/land_ocean_ice_cloud_2048.png'... (2048 x 1024 x 3) 0.0713926s
- built acceleration structures in 0.0222923s

Benchmark: Start scene #2 'Planets In One Weekend'
Benchmark: 23.5372 fps
Benchmark: 22.9298 fps
Benchmark: 22.93 fps
Benchmark: 22.9306 fps
Benchmark: 22.9134 fps
Benchmark: 22.9047 fps
Benchmark: 22.9861 fps
Benchmark: 22.9277 fps
Benchmark: 22.9606 fps
Benchmark: 22.9801 fps
Benchmark: 22.9329 fps

- loading '../assets/models/lucy.obj'... (673335 vertices, 224491 unique vertices, 1 materials) 0.886134s
- loading '../assets/textures/white.png'... (1 x 1 x 3) 5.9257e-05s
- built acceleration structures in 0.0343484s

Benchmark: Start scene #3 'Lucy In One Weekend'
Benchmark: 9.18755 fps
Benchmark: 8.57667 fps
Benchmark: 8.58261 fps
Benchmark: 8.57972 fps
Benchmark: 8.57509 fps
Benchmark: 8.57915 fps
Benchmark: 8.5752 fps
Benchmark: 8.57344 fps
Benchmark: 8.57644 fps
Benchmark: 8.57955 fps
Benchmark: 8.57244 fps

- loading '../assets/textures/white.png'... (1 x 1 x 3) 8.9619e-05s
- built acceleration structures in 0.00102045s

Benchmark: Start scene #4 'Cornell Box'
Benchmark: 18.431 fps
Benchmark: 17.8472 fps
Benchmark: 17.8256 fps
Benchmark: 17.8586 fps
Benchmark: 17.8143 fps
Benchmark: 17.8247 fps
Benchmark: 17.8217 fps
Benchmark: 17.8167 fps
Benchmark: 17.8012 fps
Benchmark: 17.847 fps
Benchmark: 17.8088 fps

- loading '../assets/models/lucy.obj'... (673335 vertices, 224491 unique vertices, 1 materials) 0.887745s
- loading '../assets/textures/white.png'... (1 x 1 x 3) 5.6918e-05s
- built acceleration structures in 0.00424686s

Benchmark: Start scene #5 'Cornell Box & Lucy'
Benchmark: 6.04618 fps
Benchmark: 5.46885 fps
Benchmark: 5.45597 fps
Benchmark: 5.45801 fps
Benchmark: 5.46154 fps
Benchmark: 5.45658 fps
Benchmark: 5.45792 fps
Benchmark: 5.45688 fps
Benchmark: 5.45561 fps
Benchmark: 5.45671 fps

undeclared identifiers with Vulkan SDK 1.2.135.0

Thanks for writing this. It works very nicely. Using VulkanSDK-1.2.135.0, I get errors on RayTracingInVulkan\src\Vulkan\DebugUtilsMessenger.cpp lines 48 & 49.

error C2065: 'VK_OBJECT_TYPE_OBJECT_TABLE_NVX': undeclared identifier
error C2065: 'VK_OBJECT_TYPE_INDIRECT_COMMANDS_LAYOUT_NVX': undeclared identifier

Commenting out these lines allowed my compile to finish & I was able to run the program.

Translucent Glass

Hey I have another question about experimenting with the material library you've made. It's such an awesome library I was hoping you had some advice on how to extend it to new materials. What I was trying to do was create a semi-opaque glass...

Sort of a mix of ScatterLambertian & ScatterDieletric in Scatter.glsl

I tried a bunch of different approaches to doing this but they all ended up looking really plastic and bad. The closest I came to it working was using RandomFloat to generate a value and blending between 2 RayPayloads like this:

float rSeed = RandomFloat(seed);
if( rSeed > .5){
	const bool isScattered = dot(direction, normal) < 0;
	const vec4 colorAndDistance = vec4(m.Diffuse.rgb * texColor.rgb, t);
	const vec4 scatter = vec4(normal + RandomInUnitSphere(seed), isScattered ? 1 : 0);
	return RayPayload(colorAndDistance, scatter, seed);
}
else{
	return RayPayload(vec4(texColor.rgb, t), vec4(reflect(direction, normal), 1), seed);
}

Do you have any ideas on how this could be done better?
Anyways thanks again for this great project.

Failed to load icon

I'm trying to get this working in Linux to test out AMDs (admittedly borked) ray tracing. Every time I do, I get this output.

FATAL: failed to load icon

0# 0x0000557A586C76BE in /opt/raytracinginvulkan/bin/RayTracer
1# 0x0000557A586C95D8 in /opt/raytracinginvulkan/bin/RayTracer
2# 0x0000557A586FE91E in /opt/raytracinginvulkan/bin/RayTracer
3# 0x0000557A587105E1 in /opt/raytracinginvulkan/bin/RayTracer
4# 0x0000557A58721FC1 in /opt/raytracinginvulkan/bin/RayTracer
5# 0x0000557A586CC63E in /opt/raytracinginvulkan/bin/RayTracer
6# 0x00007FCC38A75310 in /usr/lib/libc.so.6
7# __libc_start_main in /usr/lib/libc.so.6
8# 0x0000557A586CD555 in /opt/raytracinginvulkan/bin/RayTracer

Is this something to do with that borked implementation, or is this something else?

Benchmark comparison between the RTX 3060 and RX 5600 XT

Tested Resolution: 720p

Drivers

AMD: Mesa (Radeon Vulkan) ver 24.0.3.
NVIDIA: 550.54.14

Environment variables

RADV_PERFTEST=rt,emulate_rt,rtwave64

Command line

/RayTracer --benchmark --scene X --present-mode 0

Note: Scenes 2 and 5 were omitted

Platform Scene 1 Scene 3 Scene 4
AMD Radeon RX 5600 XT 34.8 fps 9.3 fps 6.8 fps
NVIDIA GeForce RTX 3060 56.9 fps 50.8 fps 89.9 fps

Test logs

3060_scene1.txt
3060_scene3.txt
3060_scene4.txt
5600xt_scene1.txt
5600xt_scene3.txt
5600xt_scene4.txt

VK_KHR_ray_tracing on RTX2080

Thanks for your very cool port of Peter Shirley's ray tracing demo. I have learnt a lot from it.

Should the VK_KHR_ray_tracing branch work on an Nvidia GeForce RTX2080 card?
When I run it I get: FATAL: missing required extensions: VK_KHR_deferred_host_operations, VK_KHR_pipeline_library, VK_KHR_ray_tracing.

Clearly the missing extensions are the reason it isn't working. What I don't understand is why those extensions are missing.
I have the latest Nvidia graphics driver (451.48), and the latest Vulkan SDK (1.2.141.2).
Do I need to install something else to get those extensions (I would have thought the graphics driver is enough), or is it simply that VK_KHR_ray_tracing is not supported on the RTX2080? (but that seems a bit odd. It is a ray tracing card after all)

My results on RTX 3080 FE

NOTE: not full screen (crashes on my machine)
RayTracer.exe --benchmark --width 2560 --height 1440 --scene 1 --next-scenes --present-mode 0

Specs:

  • RTX 3080 FE
  • RayTracingInVulkan Release 5
  • NVIDIA drivers 460.89
D:\Downloads\RayTracingInVulkan.r5\bin>RayTracer.exe --benchmark --width 2560 --height 1440 --scene 1 --next-scenes --present-mode 0
Vulkan SDK Header Version: 162

Vulkan Devices:
- [8710] NVIDIA 'GeForce RTX 3080' (Discrete GPU: vulkan 1.2.155, driver NVIDIA 460.89 - 460.89.0)

Setting Device [8710]:
- loading '../assets/textures/white.png'... (1 x 1 x 3) 0.0001234s
- built acceleration structures in 0.0123187s

Swap Chain:
- image count: 2
- present mode: 0


Benchmark: Start scene #1 'Ray Tracing In One Weekend'
Benchmark: 34.4038 fps
Benchmark: 34.2602 fps
Benchmark: 34.3447 fps
Benchmark: 34.5718 fps
Benchmark: 34.3343 fps
Benchmark: 34.4565 fps
Benchmark: 33.7983 fps
Benchmark: 34.0588 fps
Benchmark: 34.2802 fps
Benchmark: 34.2869 fps
Benchmark: 34.2682 fps

- loading '../assets/textures/2k_mars.jpg'... (2048 x 1024 x 3) 0.0168429s
- loading '../assets/textures/2k_moon.jpg'... (2048 x 1024 x 3) 0.0203872s
- loading '../assets/textures/land_ocean_ice_cloud_2048.png'... (2048 x 1024 x 3) 0.0400099s
- built acceleration structures in 0.0055702s

Benchmark: Start scene #2 'Planets In One Weekend'
Benchmark: 35.2622 fps
Benchmark: 34.9984 fps
Benchmark: 35.0736 fps
Benchmark: 35.0907 fps
Benchmark: 34.889 fps
Benchmark: 35.0536 fps
Benchmark: 34.6886 fps
Benchmark: 34.7241 fps
Benchmark: 34.862 fps
Benchmark: 34.8795 fps
Benchmark: 34.8743 fps

- loading '../assets/models/lucy.obj'... (673335 vertices, 224491 unique vertices, 1 materials) 0.74346s
- loading '../assets/textures/white.png'... (1 x 1 x 3) 7.38e-05s
- built acceleration structures in 0.0143666s

Benchmark: Start scene #3 'Lucy In One Weekend'
Benchmark: 31.4728 fps
Benchmark: 31.2735 fps
Benchmark: 30.8583 fps
Benchmark: 29.235 fps
Benchmark: 28.9423 fps
Benchmark: 30.3904 fps
Benchmark: 29.6292 fps
Benchmark: 30.3859 fps
Benchmark: 29.1617 fps
Benchmark: 30.1331 fps
Benchmark: 30.2394 fps

- loading '../assets/textures/white.png'... (1 x 1 x 3) 8.31e-05s
- built acceleration structures in 0.0043072s

Benchmark: Start scene #4 'Cornell Box'
Benchmark: 63.6078 fps
Benchmark: 64.0872 fps
Benchmark: 64.0832 fps
Benchmark: 64.2333 fps
Benchmark: 64.2624 fps
Benchmark: 64.2137 fps
Benchmark: 64.199 fps
Benchmark: 63.8647 fps
Benchmark: 64.0884 fps
Benchmark: 64.1607 fps
Benchmark: 63.8504 fps

- loading '../assets/models/lucy.obj'... (673335 vertices, 224491 unique vertices, 1 materials) 0.761364s
- loading '../assets/textures/white.png'... (1 x 1 x 3) 9.88e-05s
- built acceleration structures in 0.0046298s

Benchmark: Start scene #5 'Cornell Box & Lucy'
Benchmark: 32.6618 fps
Benchmark: 32.7937 fps
Benchmark: 32.4127 fps
Benchmark: 32.7677 fps
Benchmark: 32.7943 fps
Benchmark: 32.4073 fps
Benchmark: 32.7291 fps
Benchmark: 32.5482 fps
Benchmark: 32.465 fps
Benchmark: 32.4995 fps
Benchmark: 32.0525 fps

avg: 1/2/3/4/5: 34.3/34.9/30.2/64.1/32.6

Can not build the last 1.2.162 Vulkan SDK.

The build bat report error like these:

  AccelerationStructure.cpp
G:\git\RayTracingInVulkan\src\Vulkan\RayTracing\AccelerationStructure.hpp(47,22): error C2065: 'VkAccelerationStructureCreateGeometryTypeInfoKHR': undeclared identifie
r (compiling source file G:\git\RayTracingInVulkan\src\Vulkan\RayTracing\AccelerationStructure.cpp) [G:\git\RayTracingInVulkan\build\windows\src\RayTracer.vcxproj]
  BottomLevelAccelerationStructure.cpp
G:\git\RayTracingInVulkan\src\Vulkan\RayTracing\AccelerationStructure.hpp(47,15): error C2923: 'std::vector': 'VkAccelerationStructureCreateGeometryTypeInfoKHR' is not
 a valid template type argument for parameter '_Ty' (compiling source file G:\git\RayTracingInVulkan\src\Vulkan\RayTracing\AccelerationStructure.cpp) [G:\git\RayTracin
gInVulkan\build\windows\src\RayTracer.vcxproj]
G:\git\RayTracingInVulkan\src\Vulkan\RayTracing\AccelerationStructure.hpp(47,15): error C2976: 'std::vector': too few template arguments (compiling source file G:\git\
RayTracingInVulkan\src\Vulkan\RayTracing\AccelerationStructure.cpp) [G:\git\RayTracingInVulkan\build\windows\src\RayTracer.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.28.29333\include\vector(413): message : see declaration of 'std::vector' (compiling s
ource file G:\git\RayTracingInVulkan\src\Vulkan\RayTracing\AccelerationStructure.cpp) [G:\git\RayTracingInVulkan\build\windows\src\RayTracer.vcxproj]

Idea to improve camera controls

I've been experimenting with this project... I think it's great!
Really nice code and organization of Vulkan and 3D concepts.
One thing I noticed is the camera navigation is much nicer if you reverse the up vector order.

In RayTracer::GetUniformBufferObject, I changed the code to:

const auto model =
	glm::rotate(glm::mat4(1.0f), cameraRotX * glm::radians(90.0f), glm::vec3(1.0f, 0.0f, 0.0f)) *
	glm::rotate(glm::mat4(1.0f), cameraRotY * glm::radians(90.0f), glm::vec3(0.0f, 1.0f, 0.0f));

I tried to get it more like a camera in a 3D app... feels a bit easier to navigate.

Benchmark results on RTX 4090 (1440p)

Vulkan Devices:
- [9860] NVIDIA 'NVIDIA GeForce RTX 4090' (Discrete GPU: vulkan 1.3.224, driver NVIDIA 526.47 - 526.47.0)

Benchmark: Start scene #1 'Ray Tracing In One Weekend'
Benchmark: 119.199 fps
Benchmark: 120.925 fps
Benchmark: 121.187 fps
Benchmark: 121.096 fps
Benchmark: 120.987 fps
Benchmark: 120.737 fps
Benchmark: 121.068 fps
Benchmark: 121.106 fps
Benchmark: 121.055 fps
Benchmark: 121.184 fps
Benchmark: 121.162 fps

Benchmark: Start scene #2 'Planets In One Weekend'
Benchmark: 121.093 fps
Benchmark: 123.184 fps
Benchmark: 123.208 fps
Benchmark: 123.386 fps
Benchmark: 123.344 fps
Benchmark: 123.083 fps
Benchmark: 122.987 fps
Benchmark: 123.078 fps
Benchmark: 122.956 fps
Benchmark: 123.088 fps
Benchmark: 123.182 fps

Benchmark: Start scene #3 'Lucy In One Weekend'
Benchmark: 111.436 fps
Benchmark: 112.293 fps
Benchmark: 112.554 fps
Benchmark: 112.479 fps
Benchmark: 112.766 fps
Benchmark: 112.907 fps
Benchmark: 112.982 fps
Benchmark: 112.678 fps
Benchmark: 112.775 fps
Benchmark: 112.455 fps
Benchmark: 112.537 fps

Benchmark: Start scene #4 'Cornell Box'
Benchmark: 184.472 fps
Benchmark: 190.338 fps
Benchmark: 190.216 fps
Benchmark: 190.471 fps
Benchmark: 190.408 fps
Benchmark: 190.327 fps
Benchmark: 190.522 fps
Benchmark: 190.621 fps

Benchmark: Start scene #5 'Cornell Box & Lucy'
Benchmark: 109.241 fps
Benchmark: 110.57 fps
Benchmark: 110.41 fps
Benchmark: 110.357 fps
Benchmark: 110.479 fps
Benchmark: 110.368 fps
Benchmark: 110.194 fps
Benchmark: 110.743 fps
Benchmark: 110.736 fps
Benchmark: 110.731 fps
Benchmark: 110.431 fps

Didn't work on RTX 3080 and driver 461.40 (Windows 20H2)

Hello.
I tried to use this application and it finished with this error message after third benchmark:

F:\Fabiano\Downloads\Compressed\RayTracingInVulkan.r6\bin>RayTracer.exe --benchmark --width 2560 --height 1440 --fullscreen --scene 1 --next-scenes --present-mode 0
Vulkan SDK Header Version: 162

Vulkan Devices:

  • [8710] NVIDIA 'GeForce RTX 3080' (Discrete GPU: vulkan 1.2.155, driver NVIDIA 461.40 - 461.40.0)

Setting Device [8710]:

  • loading '../assets/textures/white.png'... (1 x 1 x 3) 0.0001756s
  • built acceleration structures in 0.0121975s

Swap Chain:

  • image count: 2
  • present mode: 0

Benchmark: Start scene #1 'Ray Tracing In One Weekend'
Benchmark: 33.2256 fps
Benchmark: 33.2382 fps
Benchmark: 33.4103 fps
Benchmark: 33.6559 fps
Benchmark: 33.6253 fps
Benchmark: 33.6682 fps
Benchmark: 33.599 fps
Benchmark: 33.6263 fps
Benchmark: 33.5912 fps
Benchmark: 33.6179 fps
Benchmark: 33.6377 fps

  • loading '../assets/textures/2k_mars.jpg'... (2048 x 1024 x 3) 0.0217313s
  • loading '../assets/textures/2k_moon.jpg'... (2048 x 1024 x 3) 0.0260922s
  • loading '../assets/textures/land_ocean_ice_cloud_2048.png'... (2048 x 1024 x 3) 0.0508782s
  • built acceleration structures in 0.0060612s

Benchmark: Start scene #2 'Planets In One Weekend'
Benchmark: 34.1146 fps
Benchmark: 34.4023 fps
Benchmark: 34.452 fps
Benchmark: 34.7287 fps
Benchmark: 34.7495 fps
Benchmark: 34.6925 fps
Benchmark: 34.7214 fps
Benchmark: 34.7081 fps
Benchmark: 34.7529 fps
Benchmark: 34.6944 fps
Benchmark: 34.7123 fps

  • loading '../assets/models/lucy.obj'... (673335 vertices, 224491 unique vertices, 1 materials) 0.9469s
  • loading '../assets/textures/white.png'... (1 x 1 x 3) 0.0002194s
  • built acceleration structures in 0.0131662s

Benchmark: Start scene #3 'Lucy In One Weekend'
Benchmark: 31.8791 fps
Benchmark: 32.3293 fps
Benchmark: 32.3589 fps
Benchmark: 32.3509 fps
Benchmark: 32.2871 fps
Benchmark: 32.298 fps
Benchmark: 32.3041 fps
Benchmark: 32.3221 fps
Benchmark: 32.3612 fps
Benchmark: 32.3561 fps
FATAL: failed to submit draw command buffer (ERROR_DEVICE_LOST)

0# 0x00007FF6BFDC6C32 in RayTracer
1# 0x00007FF6BFDB559E in RayTracer
2# 0x00007FF6BFDF18A9 in RayTracer
3# 0x00007FF6BFE0F441 in RayTracer
4# 0x00007FF6BFDF25E5 in RayTracer
5# 0x00007FF6BFE0FB1F in RayTracer
6# 0x00007FF6BFDF9183 in RayTracer
7# 0x00007FF6BFF30404 in RayTracer
8# BaseThreadInitThunk in KERNEL32
9# RtlUserThreadStart in ntdll

F:\Fabiano\Downloads\Compressed\RayTracingInVulkan.r6\bin>

Benchmark results on RTX 3070 mobile. iGPU -- AMD

My results.
I have RTX 3070 mobile chip as dedicated card, and Ryzen 5700H as integrated GPU ( i guess transfer from DGPU to actual display also counts on FPS)
Version: r7

Drivers:
Linux: NVIDIA 'NVIDIA GeForce RTX 3070 Laptop GPU' (Discrete GPU: vulkan 1.3.236, driver NVIDIA 530.41.03 - 530.41.12)
Windows: NVIDIA 'NVIDIA GeForce RTX 3070 Laptop GPU' (Discrete GPU: vulkan 1.3.236, driver NVIDIA 531.61 - 531.61.0)

Results are following:

Platform Scene 1 Scene 2 Scene 3 Scene 4 Scene 5
2560x1440 windowed          
Windows 10 19.81125 20.29255455 16.7621 33.05075455 16.8051
wayland KDE 20.74765 20.7448 16.77139091 33.43001818 15.2561
xorg KDE 20.46249 20.60636364 16.69015455 33.23800909 15.19974545
1280x720 windowed          
Windows 10 84.50992727 85.15620909 67.91347273 143.447 69.28483636
wayland KDE 80.69128182 80.24908182 62.28076364 132.0846364 59.51896364
xorg KDE 78.79826364 79.42588182 61.90973636 131.135 59.18895455
1280x720 full screen          
Windows 10 83.61339091 85.04447273 68.83577273 143.0369091 69.10759091
wayland KDE N/A N/A N/A N/A N/A
xorg KDE 80.06907273 79.95273636 62.13876364 130.9039091 59.13491818
1920x1080 fullscreen          
Windows 10 N/T N/T N/T N/T N/T
wayland KDE 36.84700909 36.75032727 29.77262727 59.70822727 26.86884545
xorg KDE 36.6726 36.49953636 29.63862727 59.25172727 26.75796364

Raw results:
vk_raytrace_bench_windows.txt
vk_rt_becnh_wayland.txt
vk_rt_becnh.txt

Excel spreadsheet:
vk_reytracing.xlsx

I've provided tests on resolution used in other benchmarks, but in window mode, as can't test in full-screen, I belive it should be comparable, given that 720p results of full-screen and windowed didn't differ a lot.

Also I didn't test on windows with native resolution of 1080p.

I thought just measure at 720p and 1440p, but wayland rejected to go full-screen on 720p, so had to do measurement on 1080p.

How I set window size to 2560x1440, when my native screen is smaller

Linux

Run in separate terminal, before starting bench:
watch 'wmctrl -i -r $(xdotool search --name "Vulkan Window") -e 20,-710,0,2560,1440 '

Windows

Use PowerShell.

  1. create function:
code
Function Set-Window {
<#
.SYNOPSIS
Retrieve/Set the window size and coordinates of a process window.

.DESCRIPTION
Retrieve/Set the size (height,width) and coordinates (x,y) 
of a process window.

.PARAMETER ProcessName
Name of the process to determine the window characteristics. 
(All processes if omitted).

.PARAMETER Id
Id of the process to determine the window characteristics. 

.PARAMETER X
Set the position of the window in pixels from the left.

.PARAMETER Y
Set the position of the window in pixels from the top.

.PARAMETER Width
Set the width of the window.

.PARAMETER Height
Set the height of the window.

.PARAMETER Passthru
Returns the output object of the window.

.NOTES
Name:   Set-Window
Author: Boe Prox
Version History:
    1.0//Boe Prox - 11/24/2015 - Initial build
    1.1//JosefZ   - 19.05.2018 - Treats more process instances 
                                 of supplied process name properly
    1.2//JosefZ   - 21.02.2019 - Parameter Id

.OUTPUTS
None
System.Management.Automation.PSCustomObject
System.Object

.EXAMPLE
Get-Process powershell | Set-Window -X 20 -Y 40 -Passthru -Verbose
VERBOSE: powershell (Id=11140, Handle=132410)

Id          : 11140
ProcessName : powershell
Size        : 1134,781
TopLeft     : 20,40
BottomRight : 1154,821

Description: Set the coordinates on the window for the process PowerShell.exe

.EXAMPLE
$windowArray = Set-Window -Passthru
WARNING: cmd (1096) is minimized! Coordinates will not be accurate.

    PS C:\>$windowArray | Format-Table -AutoSize

  Id ProcessName    Size     TopLeft       BottomRight  
  -- -----------    ----     -------       -----------  
1096 cmd            199,34   -32000,-32000 -31801,-31966
4088 explorer       1280,50  0,974         1280,1024    
6880 powershell     1280,974 0,0           1280,974     

Description: Get the coordinates of all visible windows and save them into the
             $windowArray variable. Then, display them in a table view.

.EXAMPLE
Set-Window -Id $PID -Passthru | Format-Table
​‌‍
  Id ProcessName Size     TopLeft BottomRight
  -- ----------- ----     ------- -----------
7840 pwsh        1024,638 0,0     1024,638

Description: Display the coordinates of the window for the current 
             PowerShell session in a table view.



#>
[cmdletbinding(DefaultParameterSetName='Name')]
Param (
    [parameter(Mandatory=$False,
        ValueFromPipelineByPropertyName=$True, ParameterSetName='Name')]
    [string]$ProcessName='*',
    [parameter(Mandatory=$True,
        ValueFromPipeline=$False,              ParameterSetName='Id')]
    [int]$Id,
    [int]$X,
    [int]$Y,
    [int]$Width,
    [int]$Height,
    [switch]$Passthru
)
Begin {
    Try { 
        [void][Window]
    } Catch {
    Add-Type @"
        using System;
        using System.Runtime.InteropServices;
        public class Window {
        [DllImport("user32.dll")]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool GetWindowRect(
            IntPtr hWnd, out RECT lpRect);

        [DllImport("user32.dll")]
        [return: MarshalAs(UnmanagedType.Bool)]
        public extern static bool MoveWindow( 
            IntPtr handle, int x, int y, int width, int height, bool redraw);

        [DllImport("user32.dll")] 
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool ShowWindow(
            IntPtr handle, int state);
        }
        public struct RECT
        {
        public int Left;        // x position of upper-left corner
        public int Top;         // y position of upper-left corner
        public int Right;       // x position of lower-right corner
        public int Bottom;      // y position of lower-right corner
        }
"@
    }
}
Process {
    $Rectangle = New-Object RECT
    If ( $PSBoundParameters.ContainsKey('Id') ) {
        $Processes = Get-Process -Id $Id -ErrorAction SilentlyContinue
    } else {
        $Processes = Get-Process -Name "$ProcessName" -ErrorAction SilentlyContinue
    }
    if ( $null -eq $Processes ) {
        If ( $PSBoundParameters['Passthru'] ) {
            Write-Warning 'No process match criteria specified'
        }
    } else {
        $Processes | ForEach-Object {
            $Handle = $_.MainWindowHandle
            Write-Verbose "$($_.ProcessName) `(Id=$($_.Id), Handle=$Handle`)"
            if ( $Handle -eq [System.IntPtr]::Zero ) { return }
            $Return = [Window]::GetWindowRect($Handle,[ref]$Rectangle)
            If (-NOT $PSBoundParameters.ContainsKey('X')) {
                $X = $Rectangle.Left            
            }
            If (-NOT $PSBoundParameters.ContainsKey('Y')) {
                $Y = $Rectangle.Top
            }
            If (-NOT $PSBoundParameters.ContainsKey('Width')) {
                $Width = $Rectangle.Right - $Rectangle.Left
            }
            If (-NOT $PSBoundParameters.ContainsKey('Height')) {
                $Height = $Rectangle.Bottom - $Rectangle.Top
            }
            If ( $Return ) {
                $Return = [Window]::MoveWindow($Handle, $x, $y, $Width, $Height,$True)
            }
            If ( $PSBoundParameters['Passthru'] ) {
                $Rectangle = New-Object RECT
                $Return = [Window]::GetWindowRect($Handle,[ref]$Rectangle)
                If ( $Return ) {
                    $Height      = $Rectangle.Bottom - $Rectangle.Top
                    $Width       = $Rectangle.Right  - $Rectangle.Left
                    $Size        = New-Object System.Management.Automation.Host.Size        -ArgumentList $Width, $Height
                    $TopLeft     = New-Object System.Management.Automation.Host.Coordinates -ArgumentList $Rectangle.Left , $Rectangle.Top
                    $BottomRight = New-Object System.Management.Automation.Host.Coordinates -ArgumentList $Rectangle.Right, $Rectangle.Bottom
                    If ($Rectangle.Top    -lt 0 -AND 
                        $Rectangle.Bottom -lt 0 -AND
                        $Rectangle.Left   -lt 0 -AND
                        $Rectangle.Right  -lt 0) {
                        Write-Warning "$($_.ProcessName) `($($_.Id)`) is minimized! Coordinates will not be accurate."
                    }
                    $Object = [PSCustomObject]@{
                        Id          = $_.Id
                        ProcessName = $_.ProcessName
                        Size        = $Size
                        TopLeft     = $TopLeft
                        BottomRight = $BottomRight
                    }
                    $Object
                }
            }
        }
    }
}
}
  1. in same terminal, execute command get-process RayTracer | Set-Window -X -20 -Y -40 -Width 2560 -Height 1440, when app is started

I didn't bother to run it in loop, as in Linux, due to lack of power-shell experience. So you have to remove first couple measurements from Scene 1

Currently not running on Intel Arc GPUs

A fellow member in a discord server I'm in tried to run the latest released version on an A770, but it didn't start. With a debug build using the current master commit 164e530, it produced the following log:
Crashlog.txt
Here is the vulkaninfo report for his card:
vulkaninfo.txt
He is using the currently latest driver v31.0.101.3959 on Windows 11.

Benchmark results on RX 6800

Benchmark results on an RX 6800. (Factory overclocked card, XFX Radeon RX 6800 Merc 319)

>RayTracer.exe --benchmark --width 2560 --height 1440 --fullscreen --scene 1 --next-scenes --present-mode 0
Vulkan SDK Header Version: 162

Vulkan Devices:
- [29631] AMD 'AMD Radeon RX 6800' (Discrete GPU: vulkan 1.2.162, driver AMD proprietary driver 21.2.1 - 2.0.168)

Setting Device [29631]:
- loading '../assets/textures/white.png'... (1 x 1 x 3) 9.95e-05s
- built acceleration structures in 0.61692s

Swap Chain:
- image count: 2
- present mode: 0


Benchmark: Start scene #1 'Ray Tracing In One Weekend'
Benchmark: 36.4546 fps
Benchmark: 38.187 fps
Benchmark: 38.4277 fps
Benchmark: 38.42 fps
Benchmark: 38.4267 fps
Benchmark: 38.2521 fps
Benchmark: 38.3118 fps
Benchmark: 38.1563 fps
Benchmark: 38.2656 fps
Benchmark: 38.2639 fps
Benchmark: 38.2549 fps

- loading '../assets/textures/2k_mars.jpg'... (2048 x 1024 x 3) 0.0121911s
- loading '../assets/textures/2k_moon.jpg'... (2048 x 1024 x 3) 0.0153581s
- loading '../assets/textures/land_ocean_ice_cloud_2048.png'... (2048 x 1024 x 3) 0.0336177s
- built acceleration structures in 0.0452977s

Benchmark: Start scene #2 'Planets In One Weekend'
Benchmark: 37.7558 fps
Benchmark: 37.8853 fps
Benchmark: 37.8919 fps
Benchmark: 37.898 fps
Benchmark: 37.8914 fps
Benchmark: 37.9078 fps
Benchmark: 37.8933 fps
Benchmark: 37.9053 fps
Benchmark: 37.8514 fps
Benchmark: 37.8988 fps
Benchmark: 37.8933 fps

- loading '../assets/models/lucy.obj'... (673335 vertices, 224491 unique vertices, 1 materials) 0.500333s
- loading '../assets/textures/white.png'... (1 x 1 x 3) 0.0001151s
- built acceleration structures in 0.165016s

Benchmark: Start scene #3 'Lucy In One Weekend'
Benchmark: 17.8088 fps
Benchmark: 17.7328 fps
Benchmark: 17.7293 fps
Benchmark: 17.7325 fps
Benchmark: 17.7297 fps
Benchmark: 17.7258 fps
Benchmark: 17.7261 fps
Benchmark: 17.7295 fps
Benchmark: 17.7279 fps
Benchmark: 17.7199 fps
Benchmark: 17.729 fps

- loading '../assets/textures/white.png'... (1 x 1 x 3) 0.0001041s
- built acceleration structures in 0.01684s

Benchmark: Start scene #4 'Cornell Box'
Benchmark: 29.4045 fps
Benchmark: 29.4496 fps
Benchmark: 29.4501 fps
Benchmark: 29.447 fps
Benchmark: 29.4532 fps
Benchmark: 29.4538 fps
Benchmark: 29.4533 fps
Benchmark: 29.4428 fps
Benchmark: 29.4484 fps
Benchmark: 29.4588 fps
Benchmark: 29.4578 fps

- loading '../assets/models/lucy.obj'... (673335 vertices, 224491 unique vertices, 1 materials) 0.497563s
- loading '../assets/textures/white.png'... (1 x 1 x 3) 0.0001102s
- built acceleration structures in 0.020672s

Benchmark: Start scene #5 'Cornell Box & Lucy'
Benchmark: 10.6335 fps
Benchmark: 10.4963 fps
Benchmark: 10.4933 fps
Benchmark: 10.4873 fps
Benchmark: 10.4925 fps
Benchmark: 10.4897 fps
Benchmark: 10.4967 fps
Benchmark: 10.4911 fps
Benchmark: 10.4942 fps
Benchmark: 10.4941 fps
Benchmark: 10.4952 fps

Add a denoiser

Please add some kind of a denoiser with at least on/off toggle support.

This way we could estimate RDNA2 ray tracing performance impact for procedural geometry scenes where denoiser should consume some of the compute units while Turing/Ampere could rely more on tensor cores.

Thank you!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.