SPIR-V Extension for Visual Studio

vs2015

Source (C#) and download (VSIX for VS2015) can be found at https://github.com/SaschaWillems/SPIRV-VSExtension

With the launch of Vulkan, SPIR-V has been introduced as it’s binary shader format, replacing text based shader formats in favor of an intermediate representation. To make life a bit easier I have just released a Visual Studio (2015) extension that adds SPIR-V related commands to the context menu of shader files (and folders containing shader files):

contextmenufolder

This allows you got generate binary SPIR-V files from GLSL right out of your IDE. The commands use the glslang reference compiler for this and work on all file extensions supported by it.

The extension also parses errors generated if the shader does not compile and adds them to the error list of Visual Studio, so you can double click to jump to the file and line that the error occurred:

errorlist

The extension supports Vulkan and OpenGL semantics for generating the SPIR-V binary files, so if you happen to have a GPU and driver that supports SPIR-V for OpenGL you can generate binary shaders for OpenGL too. To get you started with SPIR-V for OpenGL I have released a simple C++ example that shows how to use SPIR-V with OpenGL.

As for Vulkan, SPIR-V is the only official (i.e. non-extension) source for loading shaders and is used in all of my C++ open source Vulkan examples.

SPIR-V Extension for Visual Studio

Vulkan tip on rendering a fullscreen quad without buffers

fullscreentriangle_clipped

Rendering a fullscreen quad is a common task in 3D realtime graphics, especially with shaders making post processing a common functionality and other techniques like deferred shading also relying on having a quad with uv coordinates cover the whole screen.

While doing some refactoring on my Vulkan examples I removed some code that used vertex and index buffers for rendering such a quad and replaced it with a simple way that generates vertices and uvs in the vertex shader, saving some lines of code.

You can find the article on rendering a fullscreen quad (without buffers) here.

Vulkan tip on rendering a fullscreen quad without buffers

Porting (Vulkan)Quake to Android

Axel Gneiting from iD software recently ported Quake to Vulkan (based on the QuakeSpasm OpenGL port) and released the sources at github with support for windows and Linux. With Vulkan also being available on Android, I decided to use the knowledge gained while porting my Vulkan examples and Demos over to Android and add it to his Vulkan Quake port.

I have tested with the registered and full .pak files of the original Quake and both are fully playable. The Android port supports gamepads and all the gameplay elements are there, including working multiplayer. A few things are still missing, e.g. there is no sound yet as SDL audio doesn’t work on Android out-of-the box. I’m currently looking into implementing OpenSL but no ETA on that yet.

No binaries yet (as the .pak file has to be packed in the .apk and I don’t want to redistribute these), but if you want to try this, the code is available at https://github.com/SaschaWillems/vkQuake.

It includes all files necessary to build the APK using the Android NDK and should run on other Android devices too (but note that you’d need a gamepad).

Continue reading “Porting (Vulkan)Quake to Android”

Video

New Vulkan example: Indirect drawing

I have added another example to my open source C++ Vulkan examples. The new one is about indirect drawing (including multi draw if supported). Contrary to their non-direct counterparts, the indirect drawing commands in Vulkan take their draw calls from a buffer that is ideally stored in device local memory. So instead of running single draw commands that get their index base, index count and instancing numbers passed by the host upon getting called, the indirect commands are backed by a buffer that stores an arbitrary number of draw commands.

The example renders a huge number of plants with different geometries only using one single draw call. All plants geometries are stored in one buffer, and each indirect draw command uses different index offsets and also does instancing.


indirectdraw


This technique is the based for several GPU-based functions that have traditionally been handled by the CPU. As the draw commands are stored in a buffer that the GPU has access too, it’s now possible to have a compute shader manipulate the draw commands that are issued so the GPU can take on tasks like culling or draw command generation in general.

 

New Vulkan example: Indirect drawing