Skip to content

Shaders and Compile Time Functions

Photo of Phil Nash
Hosted By
Phil N. and 3 others
Shaders and Compile Time Functions

Details

This month we welcome back Dominic Jones and Valentin Galea.

************************
Important!
Please register at SkillsMatter, too:
https://skillsmatter.com/meetups/11094-c-plus-plus-london-august
*************************

Dominic Jones: "Delving into compile time functions"

Following on from the talk "Expression Tree Transforms", one of its key compile time functions will be examined: the "dual of a list of numbers". Whilst conceptually straight forward, it offers significant implementation challenges, hopefully providing some insight into how to get started in this branch of programming.

Valentin Galea: "Rapid Prototyping of Graphics Shaders in Modern C++"

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!

---

About the speakers:

Dominic Read Mechanical Engineering at UMIST, Manchester, in 2005 and stayed on to complete a doctorate on spray simulation using probability density functions. At Queen Mary, London, adjoint methods for fluid dynamics simulation was the focus of a three year post-doctoral project. Following this research, some of the ideas were carried forward into industry, applying the adjoint methodology to Star-CCM+ simulation software at Siemens. Presently the director of a university residential college in North West London, and due to start a Master's in Philosophy in September 2018.

Valentin Galea is a professional video game developer based in London, UK. He currently works at Splash Damage for projects such as the award-winning "Gears of War" franchise on Windows 10 and Xbox One. C++ enthusiast and evangelist, focused on systems, graphics and engine programming. He has 10+ years worth of experience, with past work ranging from MMO projects to mobile and handheld games. When he's not geeking out on games, he collects vinyl records.

Photo of C++ London group
C++ London
See more events
Skills Matter | Code Node
10 South Place EC2M 2RB · London