Skip to content

WIP: GLSL emit refactoring

Erik Faye-Lund requested to merge kusma/virglrenderer:shader-refactoring into master

OK, so here's a big and bulky series of patches that intends to clean up the GLSL emitting code quite a bit:

  1. It switches away from ad-hoc error-return code, to C++ exception style setjmp/longjmp error handling, mostly isolated in two locations. In very branching heavy code, this pattern can be beneficial, as it's a lot easier to audit the code.
  2. It introduces some varadic helpers to avoid most of the snprintf-buffer reasoning. Also, the varadic helpers fall back to malloc if the temp buffer is too small. We can probably also introduce a bound to these to catch blatant bugs, but I'm not sure this is worth it. It might be worth discussing, though.

With these patches, compiling vrend_shader.c goes from producing 134 warnings to 15.

The reason this is marked as WIP, is that i's completely untested beyond compilation. So it would be very immature to merge this; I've only send this PR early because I want to know if this is something worth pursuing further or not.

Merge request reports