Coder Social home page Coder Social logo

williamlewww / vulkan_ray_tracing_minimal_abstraction Goto Github PK

View Code? Open in Web Editor NEW
74.0 5.0 7.0 3.34 MB

A minimal implementation of Vulkan ray tracing.

Home Page: http://williamlewww.com/showcase_website/vk_khr_ray_tracing_tutorial/index.html

License: GNU General Public License v3.0

GLSL 3.61% C++ 86.30% CMake 0.46% C 9.64%
raytracing vulkan rtx ray-pipeline ray-query example tutorial gpu graphics

vulkan_ray_tracing_minimal_abstraction's Introduction

Vulkan Ray Tracing Minimal Abstraction

ray_pipeline uses the ray tracing pipeline to generate the final image.

ray_query uses the graphics pipeline along with ray querying to generate the final image.

headless generates a ray traced image without creating a window or needing a surface.

Important Note

Make sure the VK_KHR_ray_query and VK_KHR_ray_tracing_pipeline extensions are available on your device!

Even if you have a compatible RTX / RX graphics card, your drivers may not have the extension available.

To see if the extension is available, you can use the vulkaninfo binary.

vulkaninfo

Build Steps

Navigate to a subproject:

cd vulkan_ray_tracing_minimal_abstraction/ray_pipeline
# or cd vulkan_ray_tracing_minimal_abstraction/ray_query
# or cd vulkan_ray_tracing_minimal_abstraction/headless

Create a build directory and navigate to the new directory.

mkdir build
cd build

Run cmake with the root of the repository as the argument. You can now use the make file generated by CMake.

cmake ..
make

Image generated from headless example:

headless

vulkan_ray_tracing_minimal_abstraction's People

Contributors

ahcox avatar williamlewww 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

Watchers

 avatar  avatar  avatar  avatar  avatar

vulkan_ray_tracing_minimal_abstraction's Issues

terminate called after throwing an instance of 'std::length_error'

After compiling vulkan_ray_tracing_minimal_abstraction/ray_pipeline and running the app via ./application, I get this error:

$./application
NVIDIA GeForce RTX 2080
terminate called after throwing an instance of 'std::length_error'
  what(): cannot create std::vector larger than max_size()
Aborted  (core dumped)

FYI: I'm running the Vulkan version 1.3

Validation layer errors

When I build and run the raytracing pipeline project on Void Linux, using the GNU 10.2 compiler, I get this output:

created Vulkan instance
created debug messenger
created window surface
picked physical device
validation layer: Validation Error: [ VUID-VkDeviceCreateInfo-queueFamilyIndex-00372 ] Object 0: handle = 0x5624f6dbbe40, type = VK_OBJECT_TYPE_PHYSICAL_DEVICE; | MessageID = 0xde3cbaf | vkCreateDevice: pCreateInfo->pQueueCreateInfos[1].queueFamilyIndex (=0) is not unique within pCreateInfo->pQueueCreateInfos array. The Vulkan spec states: The queueFamilyIndex member of each element of pQueueCreateInfos must be unique within pQueueCreateInfos (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#VUID-VkDeviceCreateInfo-queueFamilyIndex-00372)
validation layer: Validation Error: [ VUID-VkDeviceCreateInfo-queueFamilyIndex-00372 ] Object 0: handle = 0x5624f6dbbe40, type = VK_OBJECT_TYPE_PHYSICAL_DEVICE; | MessageID = 0xde3cbaf | vkCreateDevice: pCreateInfo->pQueueCreateInfos[2].queueFamilyIndex (=0) is not unique within pCreateInfo->pQueueCreateInfos array. The Vulkan spec states: The queueFamilyIndex member of each element of pQueueCreateInfos must be unique within pQueueCreateInfos (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#VUID-VkDeviceCreateInfo-queueFamilyIndex-00372)
validation layer: Validation Error: [ VUID-VkDeviceCreateInfo-queueFamilyIndex-00372 ] Object 0: handle = 0x5624f6dbbe40, type = VK_OBJECT_TYPE_PHYSICAL_DEVICE; | MessageID = 0xde3cbaf | CreateDevice(): pCreateInfo->pQueueCreateInfos[1].queueFamilyIndex (=0) is not unique within pQueueCreateInfos. The Vulkan spec states: The queueFamilyIndex member of each element of pQueueCreateInfos must be unique within pQueueCreateInfos (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#VUID-VkDeviceCreateInfo-queueFamilyIndex-00372)
validation layer: Validation Error: [ VUID-VkDeviceCreateInfo-queueFamilyIndex-00372 ] Object 0: handle = 0x5624f6dbbe40, type = VK_OBJECT_TYPE_PHYSICAL_DEVICE; | MessageID = 0xde3cbaf | CreateDevice(): pCreateInfo->pQueueCreateInfos[2].queueFamilyIndex (=0) is not unique within pQueueCreateInfos. The Vulkan spec states: The queueFamilyIndex member of each element of pQueueCreateInfos must be unique within pQueueCreateInfos (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#VUID-VkDeviceCreateInfo-queueFamilyIndex-00372)
created logical connection to device
created swapchain
created command pool
created buffer with size 528
allocated buffer memory
created buffer with size 528
allocated buffer memory
created buffer with size 504
allocated buffer memory
created buffer with size 504
allocated buffer memory
created buffer with size 168
allocated buffer memory
created buffer with size 168
allocated buffer memory
created buffer with size 512
allocated buffer memory
created buffer with size 512
allocated buffer memory
created image
created image view
created buffer with size 1792
allocated buffer memory
created buffer with size 256
allocated buffer memory
created buffer with size 64
allocated buffer memory
created buffer with size 64
allocated buffer memory
created buffer with size 1920
allocated buffer memory
created buffer with size 768
allocated buffer memory
created buffer with size 68
allocated buffer memory
created descriptor pool
created descriptor set layout
allocated descriptor sets
created descriptor set layout
allocated descriptor sets
fish: Job 1, './build/application' terminated by signal SIGSEGV (Address boundary error)

The only modification I made to main.c was changing the hard-coded app->physicalDevice = devices[0]; line to index with 1 instead of 0, which is my discrete graphics card on this machine. I get this output when I query for the raytracing extension:

$ vulkaninfo | grep VK_KHR_ray_tracing
MESA-INTEL: warning: Performance support disabled, consider sysctl dev.i915.perf_stream_paranoid=0

	VK_KHR_ray_tracing_pipeline               : extension revision 1

This may also be relevant:

$ nvidia-debugdump -l -z
nvmlInit succeeded
Listing all GPUs.
Found 1 NVIDIA devices
Warning: nvmlDeviceGetSerial: Not Supported
	Device ID:              0
	Device name:            Quadro P5200
	Device handle:          0x178ae58
	GPU internal ID:        GPU-337ba78d-68ef-3dee-13f7-2d675f1ce2eb

Do you have any idea what might be causing the validation errors on my end, or how I can fix it?

strange view

Hello.
I compiled ray_query example and see this
image
how to fix it?
windows 10, rtx 3060, minGW

gliched image / crash with larger meshes

Hi, first thanks for this repo, it is very helpful to have code to look at for this new vulkan raytracing stuff!

I experimented with replacing the cube_scene.obj with my own test meshes and it looks like meshes larger than ~100verts have problems. For testing, I modified the cube_scene .obj to have meshes with varying amounts of geometry for testing:

  • cube_scene_pile.obj: 306 triangles, 220 vertices
  • cube_scene_large_pile.obj: 1482 triangles, 1004 vertices
  • cube_scene_larger_pile.obj: 9798 triangles, 6548 vertices
    for comparison, the old cube_scene.obj only has 42 triangles and 44 vertices.

Both cube_scene_pile.obj and cube_scene_large_pile.obj produce visual glitches when loading (see below).

With the largest mesh, however, the application crashes in createBottomLevelAccelerationStructure() at vkQueueWaitIdle() with VK_ERROR_DEVICE_LOST.

system information:

  • Intel Core i7-9750H
  • GeForce RTX 2070 Max-Q (nvidia driver: 460.32.03)
  • x64 LInux 5.10.7 (Manjaro, testing branch)

Any idea why this happens or what to do to fix it? I suspect it has something to do with the bottom level acceleration structure, because my application always crashes with VK_ERROR_DEVICE_LOST when I try to build ASs of this size.

My fork containing these meshes and some slight code modifications to check vulkan return values:
https://github.com/ProgrammierPatrick/vulkan_ray_tracing_minimal_abstraction

visual glitches: (maybe hard to see)

cube_scene_pile.obj:
cube_scene_pile

cube_scene_large_pile.obj
cube_scene_large_pile

My modified objs:

cube_scene_pile mesh
cube_scene_large_pile mesh
cube_scene_larger_pile mesh

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.