{"id":29983,"date":"2025-06-29T17:40:58","date_gmt":"2025-06-29T14:40:58","guid":{"rendered":"https:\/\/hgpu.org\/?p=29983"},"modified":"2025-06-29T17:40:58","modified_gmt":"2025-06-29T14:40:58","slug":"no-more-shading-languages-compiling-c-to-vulkan-shaders","status":"publish","type":"post","link":"https:\/\/hgpu.org\/?p=29983","title":{"rendered":"No More Shading Languages: Compiling C++ to Vulkan Shaders"},"content":{"rendered":"<p>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.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 [&hellip;]<\/p>\n","protected":false},"author":351,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[180,3],"tags":[1797,2169,7,955,187,20,2174,2143,176,181,144,1847],"class_list":["post-29983","post","type-post","status-publish","format-standard","hentry","category-3d-graphics-and-realism","category-paper","tag-3d-graphics-and-realism","tag-amd-radeon-rx-7900-xt","tag-ati","tag-compilers","tag-glsl","tag-nvidia","tag-nvidia-geforce-rtx-3050-ti","tag-nvidia-geforce-rtx-4070","tag-package","tag-raytracing","tag-rendering","tag-vulkan"],"views":1431,"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/hgpu.org\/index.php?rest_route=\/wp\/v2\/posts\/29983","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hgpu.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hgpu.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hgpu.org\/index.php?rest_route=\/wp\/v2\/users\/351"}],"replies":[{"embeddable":true,"href":"https:\/\/hgpu.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=29983"}],"version-history":[{"count":0,"href":"https:\/\/hgpu.org\/index.php?rest_route=\/wp\/v2\/posts\/29983\/revisions"}],"wp:attachment":[{"href":"https:\/\/hgpu.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=29983"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hgpu.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=29983"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hgpu.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=29983"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}