diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2022-02-03 00:11:44 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2022-02-03 00:11:44 +0300 |
commit | e167c1cb8965b7a6ed60c1bc76535ffc705cd7da (patch) | |
tree | 2a1ff4d14f38e0431dc804ecdff7cb232213dccd /source/blender/draw/engines/eevee/shaders | |
parent | e9fe318e8e219ac289d79dc11ad4de85f756a09c (diff) |
EEVEE: Add material shader tests in the form of unused createInfos
This adds basic variations check at compile time in debug mode.
Diffstat (limited to 'source/blender/draw/engines/eevee/shaders')
-rw-r--r-- | source/blender/draw/engines/eevee/shaders/infos/eevee_material_info.hh | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/source/blender/draw/engines/eevee/shaders/infos/eevee_material_info.hh b/source/blender/draw/engines/eevee/shaders/infos/eevee_material_info.hh index a3dcc59514c..7cf6d5cbcb0 100644 --- a/source/blender/draw/engines/eevee/shaders/infos/eevee_material_info.hh +++ b/source/blender/draw/engines/eevee/shaders/infos/eevee_material_info.hh @@ -152,3 +152,45 @@ GPU_SHADER_CREATE_INFO(eevee_volume_deferred) .additional_info("draw_fullscreen"); /** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Test shaders + * + * Variations that are only there to test shaders at compile time. + * \{ */ + +#ifdef DEBUG + +/* Stub functions defined by the material evaluation. */ +GPU_SHADER_CREATE_INFO(eevee_stub) + .define("attrib_load()") + .define("nodetree_displacement()", "vec3(0)") + .define("nodetree_surface()", "CLOSURE_DEFAULT") + .define("nodetree_volume()", "CLOSURE_DEFAULT") + .define("nodetree_thickness()", "0.1"); + +# define EEVEE_MAT_FINAL_VARIATION(name, ...) \ + GPU_SHADER_CREATE_INFO(name) \ + .additional_info(__VA_ARGS__) \ + .auto_resource_location(true) \ + .do_static_compilation(true); + +# define EEVEE_MAT_GEOM_VARIATIONS(prefix, ...) \ + EEVEE_MAT_FINAL_VARIATION(prefix##_world, "eevee_surface_world", __VA_ARGS__) \ + EEVEE_MAT_FINAL_VARIATION(prefix##_gpencil, "eevee_surface_gpencil", __VA_ARGS__) \ + EEVEE_MAT_FINAL_VARIATION(prefix##_lookdev, "eevee_surface_lookdev", __VA_ARGS__) \ + EEVEE_MAT_FINAL_VARIATION(prefix##_hair, "eevee_surface_hair", __VA_ARGS__) \ + EEVEE_MAT_FINAL_VARIATION(prefix##_mesh, "eevee_surface_mesh", __VA_ARGS__) + +# define EEVEE_MAT_PIPE_VARIATIONS(name, ...) \ + EEVEE_MAT_GEOM_VARIATIONS(name##_background, "eevee_surface_background", __VA_ARGS__) \ + EEVEE_MAT_GEOM_VARIATIONS(name##_depth, "eevee_surface_depth", __VA_ARGS__) \ + EEVEE_MAT_GEOM_VARIATIONS(name##_depth_simple, "eevee_surface_depth_simple", __VA_ARGS__) \ + EEVEE_MAT_GEOM_VARIATIONS(name##_deferred, "eevee_surface_deferred", __VA_ARGS__) \ + EEVEE_MAT_GEOM_VARIATIONS(name##_forward, "eevee_surface_forward", __VA_ARGS__) + +EEVEE_MAT_PIPE_VARIATIONS(eevee_surface, "eevee_stub") + +#endif + +/** \} */ |