No More Shading Languages: Compiling C++ to Vulkan SPIR-V

Authors Hugo Devillers , Matthias Kurtenacker , Richard Membarth , Stefan Lemme , Michael Kenzel , Ömercan Yazici , Philipp Slusallek
Conference HPG 2025
DOI 10.2312/hpg.20251167
Published June 2025

Abstract

Graphics APIs have traditionally relied on shading languages, however, these languages have a number of fundamental defects and limitations. By contrast, GPU compute platforms offer powerful, feature-rich languages suitable for heterogeneous compute. We propose reframing shading languages as embedded domain-specific languages, layered on top of a more general language like C++, doing away with traditional limitations on pointers, functions, and recursion, to the benefit of programmability. This represents a significant compilation challenge because the limitations of shaders are reflected in their lower-level representations. We present the Vcc compiler, which allows conventional C and C++ code to run as Vulkan shaders. Our compiler is complemented by a simple shading library and exposes GPU particulars as intrinsics and annotations. We evaluate the performance of our compiler using a selection of benchmarks, including a real-time path tracer, achieving competitive performance compared to their native CUDA counterparts.

Bibtex

@inproceedings{devillers2025vcc,
    author          = {Devillers, Hugo and Kurtenacker, Matthias and Membarth, Richard and Lemme, Stefan and Kenzel, Michael and Yazici, Ömercan and Slusallek, Philipp},
    address         = {Copenhagen, Denmark},
    booktitle       = {Symposium Papers of the High-Performance Graphics (HPG)},
    title           = {No More Shading Languages: Compiling {C++} to {Vulkan} {SPIR-V}},
    pages           = {1--10},
    year            = 2025,
    month           = jun,
    date            = {2025-06-23/2025-06-25},
    doi             = {10.2312/hpg.20251167},
    organization    = {The Eurographics Association},
}