Loading…
CppCon 2018 has ended
Back To Schedule
Thursday, September 27 • 16:45 - 17:45
Rapid Prototyping of Graphics Shaders in Modern C++

Sign up or log in to save this to your schedule, view media, leave feedback and see who's attending!

Traditionally it's been hard or downright impossible to have C++ on a GPU: Graphics Shaders are mainly done in GLSL/HLSL (C-like languages) and Compute Shaders only recently run it via CUDA/LLVM complex toolchains. This is not always desirable or available - mobile phones for ex. Turns out code can compile both as valid C++ and shader language with a bit of library writing effort. All you mostly need is equivalent 2D/3D/4D vector and matrix types.

What's the catch then? Swizzling! The shader vector allows addressing of its components both as [0], [1], [2] etc but also as .x, .y, .xyz, .zyx, .xxx and all possible combinations. The talk details how this can be achieved in modern C++, clean and in a generic way, without preprocessor tricks, and overcome language obstacles like template argument deduction with implicit conversions. After all the effort it's possible to prototype complex procedural effects at an interactive rate with full CPU-side debugging. Of course, a dedicated GPU will very quickly outpace this but loses the debugging, and some devices might not always produce correct results due to driver bugs.

As takeaway and showcase of what can be achieved with the C++ techniques presented I'll introduce Signed Distance Field functions modeling and some shaders that use it: Procedural Generated Planet, Volumetric Clouds simulation and some fun experiments: a Vinyl Turntable and an Egg On Bicycle!

Speakers
avatar for Valentin Galea

Valentin Galea

Technical Lead, Splash Damage
Valentin Galea is a professional video game developer based in London, UK. He assisted with or oversaw development of award-winning video game franchises like "Gears of War" and "Halo: The Master Chief Collection". C++ enthusiast and evangelist, focused on systems, graphics and engine... Read More →


Thursday September 27, 2018 16:45 - 17:45 PDT
Winter Park (406)
  • Graphics Programming