
All faces and mip levels are uploaded into video memory, and the cubemap is displayed on a skybox as a backdrop and on a 3D model as a reflection. Loads a cube map texture from disk containing six different faces. 2D texture arrays don't do any interpolation between the slices. Loads a 2D texture array containing multiple 2D texture slices (each with its own mip chain) and renders multiple meshes each sampling from a different layer of the texture. Loads a 2D texture from disk (including all mip levels), uses staging to upload it into video memory and samples from it using combined image samplers. Uses SPIR-V specialization constants to create multiple pipelines with different lighting paths from a single "uber" shader. Uses push constants, small blocks of uniform data stored within a command buffer, to pass data to a shader without the need for uniform buffers.

Individual matrices are dynamically addressed upon descriptor binding time, minimizing the number of required descriptor sets. Dynamic uniform buffersĭynamic uniform buffers are used for rendering multiple objects with multiple matrices stored in a single uniform buffer object. Sets up descriptor sets, layouts, pools, creates a single pipeline based on the set layout and renders multiple objects with different descriptor sets. Descriptor setsĭescriptors are used to pass data to shader binding points. Also demonstrates the use of pipeline derivatives. Using pipeline state objects (pso) that bake state information (rasterization states, culling modes, etc.) along with the shaders into a single object, making it easy for an implementation to optimize usage (compared to OpenGL's dynamic state machine).
Shadow complex map in lava factory code#
A huge part of the code is boilerplate that is abstracted away in later examples. This is meant as a starting point for learning Vulkan from the ground up. Examples Basics First triangleīasic and verbose example for getting a colored triangle rendered to the screen using Vulkan. While still work-in-progress, if you're interested in a more proper way of synchronization in Vulkan, please take a look at that branch. I'm currently reworking this in the this branch. This is a heavy operation and is suboptimal in regards to having CPU and GPU operations run in parallel. Synchronization in the master branch currently isn't optimal und uses vkDeviceQueueWaitIdle at the end of each frame. The primary shader language used here is GLSL but thanks to an external contribution you'll also find HLSL shader sources. This makes it possible to use different shader languages by compiling them to that bytecode format. Vulkan consumes shaders in an intermediate representation called SPIR-V. Note that some examples require specific device features, and if you are on a multi-gpu system you might need to use the -gl and -g to select a gpu that supports them.

bw, -benchwarmup: Set warmup time for benchmark mode in seconds gl, -listgpus: Display a list of available Vulkan devices bf, -benchfilename: Set file name for benchmark results b, -benchmark: Run example in benchmark mode s, -shaders: Select shader type to use (glsl or hlsl) bt, -benchframetimes: Save frame times to benchmark results file f, -fullscreen: Start in fullscreen mode br, -benchruntime: Set duration time for benchmark mode in seconds

v, -validation: Enable validation layers This repository contains submodules for external dependencies, so when doing a fresh clone you need to clone recursively: Khronos recently made an official Vulkan Samples repository available to the public ( press release).Īs I've been involved with getting the official repository up and running, I'll be mostly contributing to that repository from now, but may still add samples that don't fit there in here and I'll of course continue to maintain these samples. A comprehensive collection of open source C++ examples for Vulkan®, the new generation graphics and compute API from Khronos.
