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/draw/CMakeLists.txt | |
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/draw/CMakeLists.txt')
-rw-r--r-- | source/blender/draw/CMakeLists.txt | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/source/blender/draw/CMakeLists.txt b/source/blender/draw/CMakeLists.txt index 94a1a0dfeba..0c5b158ac80 100644 --- a/source/blender/draw/CMakeLists.txt +++ b/source/blender/draw/CMakeLists.txt @@ -531,7 +531,7 @@ set(GLSL_SOURCE_CONTENT "") foreach(GLSL_FILE ${GLSL_SRC}) get_filename_component(GLSL_FILE_NAME ${GLSL_FILE} NAME) string(REPLACE "." "_" GLSL_FILE_NAME_UNDERSCORES ${GLSL_FILE_NAME}) - string(APPEND GLSL_SOURCE_CONTENT "SHADER_SOURCE\(datatoc_${GLSL_FILE_NAME_UNDERSCORES}, \"${GLSL_FILE_NAME}\"\)\n") + string(APPEND GLSL_SOURCE_CONTENT "SHADER_SOURCE\(datatoc_${GLSL_FILE_NAME_UNDERSCORES}, \"${GLSL_FILE_NAME}\", \"${GLSL_FILE}\"\)\n") endforeach() set(glsl_source_list_file "${CMAKE_CURRENT_BINARY_DIR}/glsl_draw_source_list.h") |