diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2022-01-26 17:55:33 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2022-01-26 20:10:59 +0300 |
commit | b42adab3a2b89eb02c5829a389eab9b2921f13b7 (patch) | |
tree | 7bc4395dac1982e23ee9186d0eaaebd36adeab1d /source/blender/gpu/GPU_shader_shared.h | |
parent | e729abb0e2020acce814a22ad34cdf2254a5ca35 (diff) |
GPUShader: Add GLSL source modification pass to support enums
This uses a light parser / string modification pass to convert
C++ enum declaration syntax to GLSL compatible one.
GLSL having no support for enums, we are forced to convert the
enum values to a series of constant uints.
The parser (not really one by the way), being stupidly simple,
will not change anything to the values and thus make some C++
syntax (like omitting the values) not work.
The string replacement happens on all GLSL files on startup.
I did not measure significant changes in blender startup speed.
There is plans to do all of this at compile time.
We limit the scope of the search to `.h` and `.hh` files to prevent
confusing syntax in `.glsl` files.
There is basic error reporting with file, line and char logging
for easy debuggabiliy.
The requirements to use this enum sharing system are already listed in
`gpu_shader_shared_utils.h` and repeated on top of the preprocessor
function.
Diffstat (limited to 'source/blender/gpu/GPU_shader_shared.h')
0 files changed, 0 insertions, 0 deletions