After three years of development, a research project called VCC (Vulkan Clang Compiler) has been presented. The project aims to create a compiler capable of translating C++ code into the representation of GPU, specifically supporting the graphic API VULKAN. Unlike GPU programming models based on the GLSL and HLSL languages, VCC focuses on complete refusal to use individual shaders and instead enables direct compilation of C/C++ code for VULKAN. The project is distributed under the MIT license.
The compilation of code involves the use of LLVM and Clang as a front-end. To execute on the GPU, an intermediate representation of shaders called Shady is being developed, along with a compiler for converting code into this view. VCC also supports compilation of standard C/C++ code and provides additional built-in functions for GPU-specific features.
One of the key features of VCC is its use of standard capabilities of C/C++ to control program execution, including the use of the GOTO operator. VCC also allows for calling functions, recursive execution of functions, the use of physical signs, tagging indicators and signs on functions, performing arithmetic operations over signs, as well as determining the layout of types in memory.
To support C/C++ capabilities such as functions and pointers, the intermediate representation of Shady is expanded to include support for special structures. Shady is based on the intermediate presentation of SPIR-V 3 and uses emulation to implement advanced capabilities that cannot be directly implemented on top of SPIR-V. Built-in functions and annotations are also provided for use in shader programs.
It is important to note that VCC requires a GPU with Vulkan 1.1 support, extension vk_khr_buffer_device_address, and types Int8, Int16, and Int64. Compatibility is claimed with various Vulkan drivers including RADV (AMD Mesa), AMDVLK (AMD), NVK (NVIDIA), Anv (Intel Mesa), and Proprietary Drivers AMD, Intel Arc, and NVIDIA. However, there are some limitations such as the lack of support for C++ exceptions, the inaccessibility of Malloc/Free functions, and the inability to transfer functions and signs between the host system and GPU.