Questions tagged [vulkan]

Vulkan is a low-overhead, cross-platform graphics API from the Khronos Group.

Vulkan, once known as Next Generation OpenGL or just GLnext, is designed to be a low-overhead API that facilitates multithreaded 3D development, enabling different CPU threads to simultaneously prepare batches of commands to send to the GPU. It gives developers greater control of generating commands, putting tasks such as memory and thread management in their hands rather than relying on video drivers to handle these responsibilities. In so doing, it greatly reduces the amount of work and validation that the driver must perform, thus drastically reducing driver complexity. Conversely it increases the responsibilities of the application / developer to ensure that operations are valid and properly synchronized with each other.

Vulkan uses SPIR-V bytecode as its standard representation for graphics and compute shaders. The Khronos reference GLSL compiler compiles a form of GLSL (which implements a special extension to support Vulkan features) into SPIR-V, but users can use whatever compilers they wish which have a SPIR-V backend. The SPIR-V ecosystem also includes support for compiling from other languages such as HLSL, and for cross compiling SPIR-V bytecode back into various languages, including GLSL, HLSL and C++.

Vulkan enjoys wide native platform support on Windows, Linux, & Android. Additionally, a large subset of Vulkan is supported on the iOS and MacOS platforms through MoltenVk, part of the Vulkan Portability Initiative. Additional work is being done to develop a similar implementation of Vulkan over D3D12 to allow it to be used on UWP platforms that might not have native Vulkan drivers.

2248 questions
8
votes
2 answers

Multi-thread rendering vs command pools

Nicol Bolas: After all, being able to build command buffers in parallel is one of the selling points of Vulkan. Specs (5.1 Command Pools) (emphasis mine): Command pools are application-synchronized, meaning that a command pool must not be used…
Shahbaz
  • 46,337
  • 19
  • 116
  • 182
8
votes
1 answer

Update an VkDescriptorSet inside a renderPass

Lets say I have multiple meshes I want to render with different materials. I know I can use push constants for this example, but this question is more to understand how vkDescriptorset is suppose to work. struct Material { vec4 color; …
hidayat
  • 9,493
  • 13
  • 51
  • 66
8
votes
2 answers

When to use VK_IMAGE_LAYOUT_GENERAL

It isn't clear to me when it's a good idea to use VK_IMAGE_LAYOUT_GENERAL as opposed to transitioning to the optimal layout for whatever action I'm about to perform. Currently, my policy is to always transition to the optimal layout. But…
Columbo
  • 6,648
  • 4
  • 19
  • 30
8
votes
1 answer

Vulkan command execution order

Quoting Vulkan 1.0 specification document, chapter.5(Command Buffers) 4th paragraph, "Unless otherwise specified, and without explicit synchronization, the various commands submitted to a queue via command buffers may execute in arbitrary order…
jspark
  • 105
  • 1
  • 6
8
votes
1 answer

Vulkan samples: vkQueueSubmit always followed by vkWaitForFences?

In the API-Samples that come with Vulkan, it appears that there is always a call to vkWaitForFences after a call to vkQueueSubmit, either directly or via execute_queue_command_buffer (in util_init.hpp). The call to vkWaitForFences will block the CPU…
MuertoExcobito
  • 9,741
  • 2
  • 37
  • 78
8
votes
1 answer

Why is Vulkan's VkBool32 implemented as an unsigned int?

Looking through Sascha Willem's C++ Vulkan Demos hosted on GitHub, I noticed that some Functions returned the Datatype VkBool32. I was curious to why Khronos didn't use a normal bool when I noticed the Line typedef uint32_t VkBool32; in vulkan.h.…
Jan Hohenheim
  • 3,552
  • 2
  • 17
  • 42
7
votes
2 answers

How to measure execution time of Vulkan pipeline

Summary I wish to be able to measure time elapsed in milliseconds, on the GPU, of running the entire graphics pipeline. The goal: To be able to save benchmarks before/after optimizing the code (next step would be mipmapping textures) to see…
alexpanter
  • 1,222
  • 10
  • 25
7
votes
2 answers

How to execute parallel compute shaders across multiple compute queues in Vulkan?

Update: This has been solved, you can find further details here: https://stackoverflow.com/a/64405505/1889253 A similar question was asked previously, but that question was initially focused around using multiple command buffers, and triggering the…
axsauze
  • 343
  • 4
  • 14
7
votes
1 answer

What is GPU driven rendering?

Nowadays I'm hearing from different places about the so called GPU driven rendering which is a new paradigm of rendering which doesn't require draw calls at all, and that it is supported by the new versions of OpenGL and Vulkan APIs. Can someone…
bobeff
  • 3,543
  • 3
  • 34
  • 62
7
votes
1 answer

Vulkan-hpp is reinterpret_casting non-standard-layout class to another class. Is this legal?

So recently I have been working with Vulkan-Hpp (The official c++ bindings of Vulkan Api, Github Link). Looking into the source, I have found that they create wrapper classes around native Vulkan structs (e.g. vk::InstanceCreateInfo wraps around…
ph3rin
  • 4,426
  • 1
  • 18
  • 42
7
votes
2 answers

How to use Nvidia's Tensor Cores via Vulkan

How can one make use of Nvidia's tensor cores (in a compute shader?!) using Vulkan? There is this article by Nvidia Programming Tensor Cores in CUDA 9, but that's obviously focusing on CUDA. I am not too familiar with CUDA but it looks like some…
j00hi
  • 5,420
  • 3
  • 45
  • 82
7
votes
1 answer

YCbCr Sampler in Vulkan

I've been trying to sample a YCbCr image in Vulkan but I keep getting incorrect results, and I was hoping someone might be able to spot my mistake. I have a NV12 YCbCr image which I want to render onto two triangles forming a quad. If i understand…
MulattoKid
  • 573
  • 6
  • 14
7
votes
1 answer

Subpass dependencies for a single subpass. How to?

So I have a render pass with a single subpass that draws directly to a framebuffer. The specification doesn't force me to use dependencies - if I omit them, the implementation inserts them implicitly (though I don't understand why it uses…
nikitablack
  • 4,359
  • 2
  • 35
  • 68
7
votes
1 answer

Can I flush device memory after unmap in Vulkan?

Can I flush a memory range after unmap? At first seems wrong, because the function is called vkFlushMappedMemoryRanges(), but the documentation seems to imply the memory is ready to be flushed, even after being unmapped: Unmapping non-coherent…
lvella
  • 12,754
  • 11
  • 54
  • 106
7
votes
1 answer

Linearize depth

In OpenGL you can linearize a depth value like so: float linearize_depth(float d,float zNear,float zFar) { float z_n = 2.0 * d - 1.0; return 2.0 * zNear * zFar / (zFar + zNear - z_n * (zFar - zNear)); } (Source:…
l1994743
  • 73
  • 1
  • 3