Back To Workshops

Book

Splice & Dice

A Field Guide to C++26 Static Reflection

Available to book as a half day online workshop on the following dates

Thursday 2nd April 13:00 - 16:30 UTC
Monday 25th May 09:00 - 12:30 UTC

Suitable for:

Intermediate
Generic / Metaprogramming

Reflection offers exciting new benefits that have the potential to reduce code sizes and also enable you to enforce compile time constraints.

In this workshop you use reflection to interface with OpenGL and ImGUI, where a simple example in the form of a compute shader will be fully developed into a reflection driven pipeline, where shader variables are bound automatically. Reflection will also be used to guard against typical graphical programming mistakes, such as wrong binding ids or locations, struct packing differences and plain old forgetfulness on part of the programmer.

The talk concludes with some practical reflection guidelines and insight into the upcoming release of C++26

Outline

[15 min] Problem statement: an example of a compute shader project (game of life) with configurable parameters (uniforms) in ImGui that does not use reflection. Highlighting some of the problems when adding features to this project.
[20 min] Installation of Clang-P2996 - experimental branch of clang which enables the use of reflection.
[20 min] A simple concept - refresher on concepts and concept syntax: Bindable concept that defines the interface that bindable objects should have + explanation on how to check if a class conforms to the concept.
[10 min] Two implementations of this Bindable concept : BufferResource<Type,Set,Binding> and Uniform<Type,Location>.
[40 min] Main feature: implementing a free function that uses reflections and calls (for example) the bind() method on every nonstatic data member that conforms to the Bindable concept. Difference between splicing and member "extraction": A. Splicing: self.[:m:].bind() in an expansion statement. B. Extraction: extract<MemberT K::*>(m); (self.*pm).bind(); (rock-solid across forks). Compare assembly (manual vs reflective) at -O1 to show zero overhead.
[30 min] Interlude : Demonstrate generating an ImGui interface with reflection --> it is finally possible to create tech demo user interfaces without writing boilerplate code for each editable "component". How to set min/max for slider type variables.
[30 min] Taking it further: compile time checks --> {Set,Binding} unique ? {Location} unique? Does the Type have an exact representation on the gpu side ?
[20 min] Taking it even further: reflect on the shaders with spirv-reflect and generate constexpr values that rapport the various buffers and uniforms in the compute (or other) shader. Check if every buffer or uniform is represented on the CPU side.
[10] Conclusions and practical reflection guidelines + Q&A<


Koen Samyn

Koen is a senior software engineer and lecturer at digital art and entertainment whose primary focus is bringing modern C++ to GPU-driven game technology. Over the past decade he has built and optimized compute-shader pipelines for lighting, physics, and inverse kinematics. In the classroom Koen mentors future developers on topics such as C++20/23 concurrency, data-oriented design, and the nuances of dispatching workloads across CPU and GPU.


Attend The Workshop Taster - 11th - 13th March

If you are unsure or want a better understanding of how the workshop works in practice, then you can attend a taster session for this workshop by purchasing a ticket for the main conference which will run over 3 days from 11th-13th March and which will feature over 25 C++ talks.

You can upgrade your main conference ticket to a workshop ticket at no extra cost compared to purchasing the workshop ticket directly!

The workshop taster is designed to provide you with a preview/overview of this workshop where you will also have an opportunity to ask questions. In addition, the workshop preview will be made available on-demand for you to watch at your own convenience.

Register For The Workshop!

Alternatively, if you already believe this workshop is right for you, then you can register for the workshop now by purchasing one of the tickets below

All workshop tickets also include FREE access to the C++Online Main Conference running March 11th-13th and which will feature over 25 talks.

If you want to attend MORE than one workshop, then please purchase your tickets from the registration page

Register

Please note that you will be asked which date you want to attend, after you have purchased the ticket and assigned it.

Privacy Notice

Please note that the email address that you use for registration will be shared with the instructor so that if needed they can contact you on matters relating to the workshop before, during or after it takes place.

Terms & Conditions

EU VAT

Please note that if you are a VAT registered company based in the EU, you will need to reclaim the VAT through the reverse charge mechanism.

Cancellation Policy

Purchased tickets may be cancelled for a full refund, less a 5% processing fee, up to four weeks before the event.

From four weeks to five days before the event the cancellation fee is 40%.

During the last five days before the event the cancellation fee is 80%.

If you have any questions or need more information regarding anything relating to ticketing, please contact [email protected]

Payment methods

Ticketing is provided by Tito and credit card processing by Stripe. Please note that all ticket sales using this form include UK VAT. For alternate payment methods, or invoices, please contact us.

If you are paying on behalf of an EU or EC company with a reverse charge VAT arrangement with the UK then it is especially important to contact us first.

Other Available C++Online Workshops

VolumetricCondensed