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
10
votes
2 answers

Vulkan texture rendering on multiple meshes

I am in the middle of rendering different textures on multiple meshes of a model, but I do not have much clues about the procedures. Someone suggested for each mesh, create its own descriptor sets and call vkCmdBindDescriptorSets() and…
Michael Wei
  • 185
  • 2
  • 10
10
votes
1 answer

Vulkan: ordering image memory barriers in multiple command buffers

For resource transitions, you need to know the 'before' and 'after' VkImageLayout of the resource (eg. in the VkImageMemoryBarrier passed to vkCmdPipelineBarrier). Vulkan does not guarantee any ordering of execution of command buffers, unless…
MuertoExcobito
  • 9,741
  • 2
  • 37
  • 78
10
votes
2 answers

Instanced GLSL shaders in Vulkan?

This is the (simplest) instancing shader I can come up with, which basically just transforms a bunch of 2D primitives: #version 400 #extension GL_ARB_draw_instanced : enable #extension GL_ARB_shading_language_420pack : enable layout(std140, binding…
MuertoExcobito
  • 9,741
  • 2
  • 37
  • 78
9
votes
2 answers

Vulkan swapchain format UNORM vs SRGB?

In a Vulkan program, fragment shaders generally output single-precision floating-point colors in the range 0.0 to 1.0 to each red/blue/green channel, and these are then written to (blended into) the swapchain image that is then presented to screen. …
Andrew Tomazos
  • 66,139
  • 40
  • 186
  • 319
9
votes
1 answer

Let's get swapchain's image count straight

After getting familiar with tons of books, tutorials and documentation regarding Vulkan I am still really confused by how does swapchain image count work. Documentation on swapchain image count: VkSwapchainCreateInfoKHR::minImageCount is the…
Kasata Ata
  • 365
  • 3
  • 11
9
votes
1 answer

How can I add Vulkan to a cross platform CMake project?

In order to make a CMake project as simple and as portable as it can get I have consider to add the "whole" repositories of the libraries I need to the project. The project structure is as follows: MyProject/ └──CMakeLists.txt └──src/ …
Roberto P. Romero
  • 357
  • 1
  • 3
  • 14
9
votes
1 answer

Vulkan - when do we need to use more than one logical device (when there is only one physical device)?

In OpenGL we need a device per thread in order to do several actions in parallel. In Vulkan, we can use queue and command pool per thread in order to do several actions in parallel - but they are all can be created from one logical device. So when…
audi02
  • 559
  • 1
  • 4
  • 16
9
votes
1 answer

Traversal of Bounding Volume Hierachy in Shaders

I am working on a path tracer using vulkan compute shaders. I implemented a tree representing a bounding volume hierachy. The idea of the BVH is to minimize the amount of objects a ray intersection test needs to be performed on. #1 Naive…
jns
  • 1,250
  • 1
  • 13
  • 29
9
votes
1 answer

Projection matrices: What should depth map to?

I'm running into contradictions while attempting to build a projection matrix for Vulkan, and have yet to find an explanation for how the projection matrix should map Z from input vector to the output. Mapping x and y is straightforward. My…
Turtles Are Cute
  • 3,200
  • 6
  • 30
  • 38
9
votes
4 answers

Vulkan: How to record command buffers in separate thread?

I don't properly understand how to parallelize work on separate threads in Vulkan. In order to begin issuing vkCmd*s, you need to begin a render pass. The call to begin render pass needs a reference to a framebuffer. However, vkAcquireNextImageKHR()…
Dess
  • 2,064
  • 19
  • 35
9
votes
2 answers

Why do we need multiple render passes and subpasses?

I had some experience with DirectX12 in the past and I don't remember something similar to render passes in Vulkan so I can't make an analogy. If I'm understanding correctly command buffers inside the same subpass doesn't need to be synchronized. So…
nikitablack
  • 4,359
  • 2
  • 35
  • 68
9
votes
2 answers

Why doesn't Vulkan use the "standard cartesian" coordinate system?

Vulkan uses a coordinate system where (-1, -1) is in the top left quadrant, instead of the bottom left quadrant as in the standard cartesian coordinate system one typically learns about in school. So (-1, 1) is in the bottom left quadrant in…
bzm3r
  • 3,113
  • 6
  • 34
  • 67
9
votes
1 answer

confused about render pass in Vulkan API

Recently i started learning Vulkan API,there are some topics that confuses me, my question is what is a render pass, why it is used concurrently with command buffer recording? and finally what are sub pass, sub pass dependencies and attachments?…
BulBul
  • 1,159
  • 3
  • 24
  • 37
9
votes
1 answer

Best practices for rendering multiple meshes with vulkan

I have multiple meshes with different textures/ pipeline constructs such as depth test/ blending functions to render with vulkan. What are the best practices for rendering them in terms of performance. One option is create n command buffers with n…
debonair
  • 2,505
  • 4
  • 33
  • 73
9
votes
2 answers

Is it possible to do offscreen rendering without Surface in Vulkan?

Similar to surfaceless context in OpenGL can we do it in Vulkan.
abhijit jagdale
  • 609
  • 2
  • 8
  • 21