GPU: Shader Create Info GLSL-C++ stubs #3

Closed
Clément Foucault wants to merge 90 commits from create-info-cpp-macros into glsl-include

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
8 changed files with 85 additions and 96 deletions
Showing only changes of commit 181785fdc5 - Show all commits

View File

@ -50,22 +50,19 @@ GPU_SHADER_CREATE_INFO(basic_pointcloud_conservative_no_geom)
/** \name Variations Declaration /** \name Variations Declaration
* \{ */ * \{ */
#define BASIC_FINAL_VARIATION(name, ...) \
GPU_SHADER_CREATE_INFO(name).additional_info(__VA_ARGS__).do_static_compilation(true);
#define BASIC_CLIPPING_VARIATIONS(prefix, ...) \ #define BASIC_CLIPPING_VARIATIONS(prefix, ...) \
BASIC_FINAL_VARIATION(prefix##_clipped, "drw_clipped", __VA_ARGS__) \ CREATE_INFO_VARIANT(prefix##_clipped, drw_clipped, __VA_ARGS__) \
BASIC_FINAL_VARIATION(prefix, __VA_ARGS__) CREATE_INFO_VARIANT(prefix, __VA_ARGS__)
#define BASIC_CONSERVATIVE_VARIATIONS(prefix, ...) \ #define BASIC_CONSERVATIVE_VARIATIONS(prefix, ...) \
BASIC_CLIPPING_VARIATIONS(prefix##_conservative, "basic_conservative", __VA_ARGS__) \ BASIC_CLIPPING_VARIATIONS(prefix##_conservative, basic_conservative, __VA_ARGS__) \
BASIC_CLIPPING_VARIATIONS(prefix##_conservative_no_geom, __VA_ARGS__) \ BASIC_CLIPPING_VARIATIONS(prefix##_conservative_no_geom, __VA_ARGS__) \
BASIC_CLIPPING_VARIATIONS(prefix, __VA_ARGS__) BASIC_CLIPPING_VARIATIONS(prefix, __VA_ARGS__)
#define BASIC_OBTYPE_VARIATIONS(prefix, ...) \ #define BASIC_OBTYPE_VARIATIONS(prefix, ...) \
BASIC_CONSERVATIVE_VARIATIONS(prefix##_mesh, "basic_mesh", __VA_ARGS__) \ BASIC_CONSERVATIVE_VARIATIONS(prefix##_mesh, basic_mesh, __VA_ARGS__) \
BASIC_CONSERVATIVE_VARIATIONS(prefix##_pointcloud, "basic_pointcloud", __VA_ARGS__) \ BASIC_CONSERVATIVE_VARIATIONS(prefix##_pointcloud, basic_pointcloud, __VA_ARGS__) \
BASIC_CLIPPING_VARIATIONS(prefix##_curves, "basic_curves", __VA_ARGS__) BASIC_CLIPPING_VARIATIONS(prefix##_curves, basic_curves, __VA_ARGS__)
/** \} */ /** \} */
@ -75,6 +72,6 @@ GPU_SHADER_CREATE_INFO(basic_pointcloud_conservative_no_geom)
GPU_SHADER_CREATE_INFO(basic_depth).fragment_source("basic_depth_frag.glsl"); GPU_SHADER_CREATE_INFO(basic_depth).fragment_source("basic_depth_frag.glsl");
BASIC_OBTYPE_VARIATIONS(basic_depth, "basic_depth", "draw_globals"); BASIC_OBTYPE_VARIATIONS(basic_depth, basic_depth, draw_globals);
/** \} */ /** \} */

View File

@ -143,16 +143,13 @@ GPU_SHADER_CREATE_INFO(eevee_depth_of_field_lut)
GPU_SHADER_CREATE_INFO(eevee_depth_of_field_background).define("DOF_FOREGROUND_PASS", "false"); GPU_SHADER_CREATE_INFO(eevee_depth_of_field_background).define("DOF_FOREGROUND_PASS", "false");
GPU_SHADER_CREATE_INFO(eevee_depth_of_field_foreground).define("DOF_FOREGROUND_PASS", "true"); GPU_SHADER_CREATE_INFO(eevee_depth_of_field_foreground).define("DOF_FOREGROUND_PASS", "true");
#define EEVEE_DOF_FINAL_VARIATION(name, ...) \
GPU_SHADER_CREATE_INFO(name).additional_info(__VA_ARGS__).do_static_compilation(true);
#define EEVEE_DOF_LUT_VARIATIONS(prefix, ...) \ #define EEVEE_DOF_LUT_VARIATIONS(prefix, ...) \
EEVEE_DOF_FINAL_VARIATION(prefix##_lut, "eevee_depth_of_field_lut", __VA_ARGS__) \ CREATE_INFO_VARIANT(prefix##_lut, eevee_depth_of_field_lut, __VA_ARGS__) \
EEVEE_DOF_FINAL_VARIATION(prefix##_no_lut, "eevee_depth_of_field_no_lut", __VA_ARGS__) CREATE_INFO_VARIANT(prefix##_no_lut, eevee_depth_of_field_no_lut, __VA_ARGS__)
#define EEVEE_DOF_GROUND_VARIATIONS(name, ...) \ #define EEVEE_DOF_GROUND_VARIATIONS(name, ...) \
EEVEE_DOF_LUT_VARIATIONS(name##_background, "eevee_depth_of_field_background", __VA_ARGS__) \ EEVEE_DOF_LUT_VARIATIONS(name##_background, eevee_depth_of_field_background, __VA_ARGS__) \
EEVEE_DOF_LUT_VARIATIONS(name##_foreground, "eevee_depth_of_field_foreground", __VA_ARGS__) EEVEE_DOF_LUT_VARIATIONS(name##_foreground, eevee_depth_of_field_foreground, __VA_ARGS__)
/** \} */ /** \} */
@ -178,7 +175,7 @@ GPU_SHADER_CREATE_INFO(eevee_depth_of_field_gather)
.compute_source("eevee_depth_of_field_gather_comp.glsl") .compute_source("eevee_depth_of_field_gather_comp.glsl")
.additional_info("eevee_depth_of_field_gather_common"); .additional_info("eevee_depth_of_field_gather_common");
EEVEE_DOF_GROUND_VARIATIONS(eevee_depth_of_field_gather, "eevee_depth_of_field_gather") EEVEE_DOF_GROUND_VARIATIONS(eevee_depth_of_field_gather, eevee_depth_of_field_gather)
GPU_SHADER_CREATE_INFO(eevee_depth_of_field_hole_fill) GPU_SHADER_CREATE_INFO(eevee_depth_of_field_hole_fill)
.do_static_compilation(true) .do_static_compilation(true)
@ -260,6 +257,6 @@ GPU_SHADER_CREATE_INFO(eevee_depth_of_field_resolve)
.image(2, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_color_img") .image(2, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_color_img")
.compute_source("eevee_depth_of_field_resolve_comp.glsl"); .compute_source("eevee_depth_of_field_resolve_comp.glsl");
EEVEE_DOF_LUT_VARIATIONS(eevee_depth_of_field_resolve, "eevee_depth_of_field_resolve") EEVEE_DOF_LUT_VARIATIONS(eevee_depth_of_field_resolve, eevee_depth_of_field_resolve)
/** \} */ /** \} */

View File

@ -387,30 +387,27 @@ GPU_SHADER_CREATE_INFO(eevee_material_stub)
/* Dummy uniform buffer to detect overlap with material node-tree. */ /* Dummy uniform buffer to detect overlap with material node-tree. */
.uniform_buf(0, "int", "node_tree"); .uniform_buf(0, "int", "node_tree");
# define EEVEE_MAT_FINAL_VARIATION(name, ...) \
GPU_SHADER_CREATE_INFO(name).additional_info(__VA_ARGS__).do_static_compilation(true);
# define EEVEE_MAT_GEOM_VARIATIONS(prefix, ...) \ # define EEVEE_MAT_GEOM_VARIATIONS(prefix, ...) \
EEVEE_MAT_FINAL_VARIATION(prefix##_world, "eevee_geom_world", __VA_ARGS__) \ CREATE_INFO_VARIANT(prefix##_world, eevee_geom_world, __VA_ARGS__) \
/* Turned off until dependency on common_view/math_lib are sorted out. */ \ /* Turned off until dependency on common_view/math_lib are sorted out. */ \
/* EEVEE_MAT_FINAL_VARIATION(prefix##_gpencil, "eevee_geom_gpencil", __VA_ARGS__) */ \ /* CREATE_INFO_VARIANT(prefix##_gpencil, eevee_geom_gpencil, __VA_ARGS__) */ \
EEVEE_MAT_FINAL_VARIATION(prefix##_curves, "eevee_geom_curves", __VA_ARGS__) \ CREATE_INFO_VARIANT(prefix##_curves, eevee_geom_curves, __VA_ARGS__) \
EEVEE_MAT_FINAL_VARIATION(prefix##_mesh, "eevee_geom_mesh", __VA_ARGS__) \ CREATE_INFO_VARIANT(prefix##_mesh, eevee_geom_mesh, __VA_ARGS__) \
EEVEE_MAT_FINAL_VARIATION(prefix##_point_cloud, "eevee_geom_point_cloud", __VA_ARGS__) \ CREATE_INFO_VARIANT(prefix##_point_cloud, eevee_geom_point_cloud, __VA_ARGS__) \
EEVEE_MAT_FINAL_VARIATION(prefix##_volume, "eevee_geom_volume", __VA_ARGS__) CREATE_INFO_VARIANT(prefix##_volume, eevee_geom_volume, __VA_ARGS__)
# define EEVEE_MAT_PIPE_VARIATIONS(name, ...) \ # define EEVEE_MAT_PIPE_VARIATIONS(name, ...) \
EEVEE_MAT_GEOM_VARIATIONS(name##_world, "eevee_surf_world", __VA_ARGS__) \ EEVEE_MAT_GEOM_VARIATIONS(name##_world, eevee_surf_world, __VA_ARGS__) \
EEVEE_MAT_GEOM_VARIATIONS(name##_depth, "eevee_surf_depth", __VA_ARGS__) \ EEVEE_MAT_GEOM_VARIATIONS(name##_depth, eevee_surf_depth, __VA_ARGS__) \
EEVEE_MAT_GEOM_VARIATIONS(name##_deferred, "eevee_surf_deferred", __VA_ARGS__) \ EEVEE_MAT_GEOM_VARIATIONS(name##_deferred, eevee_surf_deferred, __VA_ARGS__) \
EEVEE_MAT_GEOM_VARIATIONS(name##_forward, "eevee_surf_forward", __VA_ARGS__) \ EEVEE_MAT_GEOM_VARIATIONS(name##_forward, eevee_surf_forward, __VA_ARGS__) \
EEVEE_MAT_GEOM_VARIATIONS(name##_capture, "eevee_surf_capture", __VA_ARGS__) \ EEVEE_MAT_GEOM_VARIATIONS(name##_capture, eevee_surf_capture, __VA_ARGS__) \
EEVEE_MAT_GEOM_VARIATIONS(name##_volume, "eevee_surf_volume", __VA_ARGS__) \ EEVEE_MAT_GEOM_VARIATIONS(name##_volume, eevee_surf_volume, __VA_ARGS__) \
EEVEE_MAT_GEOM_VARIATIONS(name##_occupancy, "eevee_surf_occupancy", __VA_ARGS__) \ EEVEE_MAT_GEOM_VARIATIONS(name##_occupancy, eevee_surf_occupancy, __VA_ARGS__) \
EEVEE_MAT_GEOM_VARIATIONS(name##_shadow_atomic, "eevee_surf_shadow_atomic", __VA_ARGS__) \ EEVEE_MAT_GEOM_VARIATIONS(name##_shadow_atomic, eevee_surf_shadow_atomic, __VA_ARGS__) \
EEVEE_MAT_GEOM_VARIATIONS(name##_shadow_tbdr, "eevee_surf_shadow_tbdr", __VA_ARGS__) EEVEE_MAT_GEOM_VARIATIONS(name##_shadow_tbdr, eevee_surf_shadow_tbdr, __VA_ARGS__)
EEVEE_MAT_PIPE_VARIATIONS(eevee_surface, "eevee_material_stub") EEVEE_MAT_PIPE_VARIATIONS(eevee_surface, eevee_material_stub)
#endif #endif

View File

@ -50,30 +50,27 @@ GPU_SHADER_CREATE_INFO(workbench_resolve_shadow)
/* Variations */ /* Variations */
#define WORKBENCH_FINAL_VARIATION(name, ...) \
GPU_SHADER_CREATE_INFO(name).additional_info(__VA_ARGS__).do_static_compilation(true);
#define WORKBENCH_RESOLVE_SHADOW_VARIATION(prefix, ...) \ #define WORKBENCH_RESOLVE_SHADOW_VARIATION(prefix, ...) \
WORKBENCH_FINAL_VARIATION(prefix##_shadow, "workbench_resolve_shadow", __VA_ARGS__) \ CREATE_INFO_VARIANT(prefix##_shadow, workbench_resolve_shadow, __VA_ARGS__) \
WORKBENCH_FINAL_VARIATION(prefix##_no_shadow, __VA_ARGS__) CREATE_INFO_VARIANT(prefix##_no_shadow, __VA_ARGS__)
#define WORKBENCH_CURVATURE_VARIATIONS(prefix, ...) \ #define WORKBENCH_CURVATURE_VARIATIONS(prefix, ...) \
WORKBENCH_RESOLVE_SHADOW_VARIATION( \ WORKBENCH_RESOLVE_SHADOW_VARIATION( \
prefix##_curvature, "workbench_resolve_curvature", __VA_ARGS__) \ prefix##_curvature, workbench_resolve_curvature, __VA_ARGS__) \
WORKBENCH_RESOLVE_SHADOW_VARIATION(prefix##_no_curvature, __VA_ARGS__) WORKBENCH_RESOLVE_SHADOW_VARIATION(prefix##_no_curvature, __VA_ARGS__)
#define WORKBENCH_CAVITY_VARIATIONS(prefix, ...) \ #define WORKBENCH_CAVITY_VARIATIONS(prefix, ...) \
WORKBENCH_CURVATURE_VARIATIONS(prefix##_cavity, "workbench_resolve_cavity", __VA_ARGS__) \ WORKBENCH_CURVATURE_VARIATIONS(prefix##_cavity, workbench_resolve_cavity, __VA_ARGS__) \
WORKBENCH_CURVATURE_VARIATIONS(prefix##_no_cavity, __VA_ARGS__) WORKBENCH_CURVATURE_VARIATIONS(prefix##_no_cavity, __VA_ARGS__)
#define WORKBENCH_LIGHTING_VARIATIONS(prefix, ...) \ #define WORKBENCH_LIGHTING_VARIATIONS(prefix, ...) \
WORKBENCH_CAVITY_VARIATIONS( \ WORKBENCH_CAVITY_VARIATIONS( \
prefix##_opaque_studio, "workbench_resolve_opaque_studio", __VA_ARGS__) \ prefix##_opaque_studio, workbench_resolve_opaque_studio, __VA_ARGS__) \
WORKBENCH_CAVITY_VARIATIONS( \ WORKBENCH_CAVITY_VARIATIONS( \
prefix##_opaque_matcap, "workbench_resolve_opaque_matcap", __VA_ARGS__) \ prefix##_opaque_matcap, workbench_resolve_opaque_matcap, __VA_ARGS__) \
WORKBENCH_CAVITY_VARIATIONS(prefix##_opaque_flat, "workbench_resolve_opaque_flat", __VA_ARGS__) WORKBENCH_CAVITY_VARIATIONS(prefix##_opaque_flat, workbench_resolve_opaque_flat, __VA_ARGS__)
WORKBENCH_LIGHTING_VARIATIONS(workbench_resolve, "workbench_composite"); WORKBENCH_LIGHTING_VARIATIONS(workbench_resolve, workbench_composite);
#undef WORKBENCH_FINAL_VARIATION #undef WORKBENCH_FINAL_VARIATION
#undef WORKBENCH_CURVATURE_VARIATIONS #undef WORKBENCH_CURVATURE_VARIATIONS

View File

@ -117,33 +117,30 @@ GPU_SHADER_CREATE_INFO(workbench_flat).define("WORKBENCH_SHADING_FLAT");
GPU_SHADER_CREATE_INFO(workbench_studio).define("WORKBENCH_SHADING_STUDIO"); GPU_SHADER_CREATE_INFO(workbench_studio).define("WORKBENCH_SHADING_STUDIO");
GPU_SHADER_CREATE_INFO(workbench_matcap).define("WORKBENCH_SHADING_MATCAP"); GPU_SHADER_CREATE_INFO(workbench_matcap).define("WORKBENCH_SHADING_MATCAP");
#define WORKBENCH_FINAL_VARIATION(name, ...) \
GPU_SHADER_CREATE_INFO(name).additional_info(__VA_ARGS__).do_static_compilation(true);
#define WORKBENCH_CLIPPING_VARIATIONS(prefix, ...) \ #define WORKBENCH_CLIPPING_VARIATIONS(prefix, ...) \
WORKBENCH_FINAL_VARIATION(prefix##_clip, "drw_clipped", __VA_ARGS__) \ CREATE_INFO_VARIANT(prefix##_clip, drw_clipped, __VA_ARGS__) \
WORKBENCH_FINAL_VARIATION(prefix##_no_clip, __VA_ARGS__) CREATE_INFO_VARIANT(prefix##_no_clip, __VA_ARGS__)
#define WORKBENCH_COLOR_VARIATIONS(prefix, ...) \ #define WORKBENCH_COLOR_VARIATIONS(prefix, ...) \
WORKBENCH_CLIPPING_VARIATIONS(prefix##_material, "workbench_color_material", __VA_ARGS__) \ WORKBENCH_CLIPPING_VARIATIONS(prefix##_material, workbench_color_material, __VA_ARGS__) \
WORKBENCH_CLIPPING_VARIATIONS(prefix##_texture, "workbench_color_texture", __VA_ARGS__) \ WORKBENCH_CLIPPING_VARIATIONS(prefix##_texture, workbench_color_texture, __VA_ARGS__) \
WORKBENCH_CLIPPING_VARIATIONS(prefix##_vertex, "workbench_color_vertex", __VA_ARGS__) WORKBENCH_CLIPPING_VARIATIONS(prefix##_vertex, workbench_color_vertex, __VA_ARGS__)
#define WORKBENCH_SHADING_VARIATIONS(prefix, ...) \ #define WORKBENCH_SHADING_VARIATIONS(prefix, ...) \
WORKBENCH_COLOR_VARIATIONS(prefix##_flat, "workbench_lighting_flat", __VA_ARGS__) \ WORKBENCH_COLOR_VARIATIONS(prefix##_flat, workbench_lighting_flat, __VA_ARGS__) \
WORKBENCH_COLOR_VARIATIONS(prefix##_studio, "workbench_lighting_studio", __VA_ARGS__) \ WORKBENCH_COLOR_VARIATIONS(prefix##_studio, workbench_lighting_studio, __VA_ARGS__) \
WORKBENCH_COLOR_VARIATIONS(prefix##_matcap, "workbench_lighting_matcap", __VA_ARGS__) WORKBENCH_COLOR_VARIATIONS(prefix##_matcap, workbench_lighting_matcap, __VA_ARGS__)
#define WORKBENCH_PIPELINE_VARIATIONS(prefix, ...) \ #define WORKBENCH_PIPELINE_VARIATIONS(prefix, ...) \
WORKBENCH_SHADING_VARIATIONS(prefix##_transparent, "workbench_transparent_accum", __VA_ARGS__) \ WORKBENCH_SHADING_VARIATIONS(prefix##_transparent, workbench_transparent_accum, __VA_ARGS__) \
WORKBENCH_SHADING_VARIATIONS(prefix##_opaque, "workbench_opaque", __VA_ARGS__) WORKBENCH_SHADING_VARIATIONS(prefix##_opaque, workbench_opaque, __VA_ARGS__)
#define WORKBENCH_GEOMETRY_VARIATIONS(prefix, ...) \ #define WORKBENCH_GEOMETRY_VARIATIONS(prefix, ...) \
WORKBENCH_PIPELINE_VARIATIONS(prefix##_mesh, "workbench_mesh", __VA_ARGS__) \ WORKBENCH_PIPELINE_VARIATIONS(prefix##_mesh, workbench_mesh, __VA_ARGS__) \
WORKBENCH_PIPELINE_VARIATIONS(prefix##_curves, "workbench_curves", __VA_ARGS__) \ WORKBENCH_PIPELINE_VARIATIONS(prefix##_curves, workbench_curves, __VA_ARGS__) \
WORKBENCH_PIPELINE_VARIATIONS(prefix##_ptcloud, "workbench_pointcloud", __VA_ARGS__) WORKBENCH_PIPELINE_VARIATIONS(prefix##_ptcloud, workbench_pointcloud, __VA_ARGS__)
WORKBENCH_GEOMETRY_VARIATIONS(workbench_prepass, "workbench_prepass"); WORKBENCH_GEOMETRY_VARIATIONS(workbench_prepass, workbench_prepass);
#undef WORKBENCH_FINAL_VARIATION #undef WORKBENCH_FINAL_VARIATION
#undef WORKBENCH_CLIPPING_VARIATIONS #undef WORKBENCH_CLIPPING_VARIATIONS

View File

@ -70,46 +70,39 @@ GPU_SHADER_CREATE_INFO(workbench_shadow_debug)
#define WORKBENCH_SHADOW_VARIATIONS(common, prefix, suffix, ...) \ #define WORKBENCH_SHADOW_VARIATIONS(common, prefix, suffix, ...) \
GPU_SHADER_CREATE_INFO(prefix##_pass_manifold_no_caps##suffix) \ GPU_SHADER_CREATE_INFO(prefix##_pass_manifold_no_caps##suffix) \
.define("SHADOW_PASS") \ .define("SHADOW_PASS") \
.vertex_source("workbench_shadow_vert.glsl") \ .vertex_source("workbench_shadow_vert.glsl") ADDITIONAL_INFO_EXPAND(common, __VA_ARGS__) \
.additional_info(common, __VA_ARGS__) \
.do_static_compilation(true); \ .do_static_compilation(true); \
GPU_SHADER_CREATE_INFO(prefix##_pass_no_manifold_no_caps##suffix) \ GPU_SHADER_CREATE_INFO(prefix##_pass_no_manifold_no_caps##suffix) \
.define("SHADOW_PASS") \ .define("SHADOW_PASS") \
.define("DOUBLE_MANIFOLD") \ .define("DOUBLE_MANIFOLD") \
.vertex_source("workbench_shadow_vert.glsl") \ .vertex_source("workbench_shadow_vert.glsl") ADDITIONAL_INFO_EXPAND(common, __VA_ARGS__) \
.additional_info(common, __VA_ARGS__) \
.do_static_compilation(true); \ .do_static_compilation(true); \
GPU_SHADER_CREATE_INFO(prefix##_fail_manifold_caps##suffix) \ GPU_SHADER_CREATE_INFO(prefix##_fail_manifold_caps##suffix) \
.define("SHADOW_FAIL") \ .define("SHADOW_FAIL") \
.vertex_source("workbench_shadow_caps_vert.glsl") \ .vertex_source("workbench_shadow_caps_vert.glsl") \
.additional_info(common, __VA_ARGS__) \ ADDITIONAL_INFO_EXPAND(common, __VA_ARGS__) \
.do_static_compilation(true); \ .do_static_compilation(true); \
GPU_SHADER_CREATE_INFO(prefix##_fail_manifold_no_caps##suffix) \ GPU_SHADER_CREATE_INFO(prefix##_fail_manifold_no_caps##suffix) \
.define("SHADOW_FAIL") \ .define("SHADOW_FAIL") \
.vertex_source("workbench_shadow_vert.glsl") \ .vertex_source("workbench_shadow_vert.glsl") ADDITIONAL_INFO_EXPAND(common, __VA_ARGS__) \
.additional_info(common, __VA_ARGS__) \
.do_static_compilation(true); \ .do_static_compilation(true); \
GPU_SHADER_CREATE_INFO(prefix##_fail_no_manifold_caps##suffix) \ GPU_SHADER_CREATE_INFO(prefix##_fail_no_manifold_caps##suffix) \
.define("SHADOW_FAIL") \ .define("SHADOW_FAIL") \
.define("DOUBLE_MANIFOLD") \ .define("DOUBLE_MANIFOLD") \
.vertex_source("workbench_shadow_caps_vert.glsl") \ .vertex_source("workbench_shadow_caps_vert.glsl") \
.additional_info(common, __VA_ARGS__) \ ADDITIONAL_INFO_EXPAND(common, __VA_ARGS__) \
.do_static_compilation(true); \ .do_static_compilation(true); \
GPU_SHADER_CREATE_INFO(prefix##_fail_no_manifold_no_caps##suffix) \ GPU_SHADER_CREATE_INFO(prefix##_fail_no_manifold_no_caps##suffix) \
.define("SHADOW_FAIL") \ .define("SHADOW_FAIL") \
.define("DOUBLE_MANIFOLD") \ .define("DOUBLE_MANIFOLD") \
.vertex_source("workbench_shadow_vert.glsl") \ .vertex_source("workbench_shadow_vert.glsl") ADDITIONAL_INFO_EXPAND(common, __VA_ARGS__) \
.additional_info(common, __VA_ARGS__) \
.do_static_compilation(true); .do_static_compilation(true);
WORKBENCH_SHADOW_VARIATIONS("workbench_shadow_common", WORKBENCH_SHADOW_VARIATIONS(workbench_shadow_common, workbench_shadow, , workbench_shadow_no_debug)
workbench_shadow,
,
"workbench_shadow_no_debug")
WORKBENCH_SHADOW_VARIATIONS("workbench_shadow_common", WORKBENCH_SHADOW_VARIATIONS(workbench_shadow_common,
workbench_shadow, workbench_shadow,
_debug, _debug,
"workbench_shadow_debug") workbench_shadow_debug)
/** \} */ /** \} */

View File

@ -105,26 +105,22 @@ GPU_SHADER_CREATE_INFO(workbench_volume_slice)
* \{ */ * \{ */
#define WORKBENCH_VOLUME_SLICE_VARIATIONS(prefix, ...) \ #define WORKBENCH_VOLUME_SLICE_VARIATIONS(prefix, ...) \
GPU_SHADER_CREATE_INFO(prefix##_slice) \ CREATE_INFO_VARIANT(prefix##_slice, workbench_volume_slice, __VA_ARGS__) \
.additional_info("workbench_volume_slice", __VA_ARGS__) \ CREATE_INFO_VARIANT(prefix##_no_slice, __VA_ARGS__)
.do_static_compilation(true); \
GPU_SHADER_CREATE_INFO(prefix##_no_slice) \
.additional_info(__VA_ARGS__) \
.do_static_compilation(true);
#define WORKBENCH_VOLUME_COBA_VARIATIONS(prefix, ...) \ #define WORKBENCH_VOLUME_COBA_VARIATIONS(prefix, ...) \
WORKBENCH_VOLUME_SLICE_VARIATIONS(prefix##_coba, "workbench_volume_coba", __VA_ARGS__) \ WORKBENCH_VOLUME_SLICE_VARIATIONS(prefix##_coba, workbench_volume_coba, __VA_ARGS__) \
WORKBENCH_VOLUME_SLICE_VARIATIONS(prefix##_no_coba, "workbench_volume_no_coba", __VA_ARGS__) WORKBENCH_VOLUME_SLICE_VARIATIONS(prefix##_no_coba, workbench_volume_no_coba, __VA_ARGS__)
#define WORKBENCH_VOLUME_INTERP_VARIATIONS(prefix, ...) \ #define WORKBENCH_VOLUME_INTERP_VARIATIONS(prefix, ...) \
WORKBENCH_VOLUME_COBA_VARIATIONS(prefix##_linear, "workbench_volume_linear", __VA_ARGS__) \ WORKBENCH_VOLUME_COBA_VARIATIONS(prefix##_linear, workbench_volume_linear, __VA_ARGS__) \
WORKBENCH_VOLUME_COBA_VARIATIONS(prefix##_cubic, "workbench_volume_cubic", __VA_ARGS__) \ WORKBENCH_VOLUME_COBA_VARIATIONS(prefix##_cubic, workbench_volume_cubic, __VA_ARGS__) \
WORKBENCH_VOLUME_COBA_VARIATIONS(prefix##_closest, "workbench_volume_closest", __VA_ARGS__) WORKBENCH_VOLUME_COBA_VARIATIONS(prefix##_closest, workbench_volume_closest, __VA_ARGS__)
#define WORKBENCH_VOLUME_SMOKE_VARIATIONS(prefix, ...) \ #define WORKBENCH_VOLUME_SMOKE_VARIATIONS(prefix, ...) \
WORKBENCH_VOLUME_INTERP_VARIATIONS(prefix##_smoke, "workbench_volume_smoke", __VA_ARGS__) \ WORKBENCH_VOLUME_INTERP_VARIATIONS(prefix##_smoke, workbench_volume_smoke, __VA_ARGS__) \
WORKBENCH_VOLUME_INTERP_VARIATIONS(prefix##_object, "workbench_volume_object", __VA_ARGS__) WORKBENCH_VOLUME_INTERP_VARIATIONS(prefix##_object, workbench_volume_object, __VA_ARGS__)
WORKBENCH_VOLUME_SMOKE_VARIATIONS(workbench_volume, "workbench_volume") WORKBENCH_VOLUME_SMOKE_VARIATIONS(workbench_volume, workbench_volume)
/** \} */ /** \} */

View File

@ -15,6 +15,7 @@
#include "BLI_hash.hh" #include "BLI_hash.hh"
#include "BLI_string_ref.hh" #include "BLI_string_ref.hh"
#include "BLI_utildefines_variadic.h"
#include "BLI_vector.hh" #include "BLI_vector.hh"
#include "GPU_common_types.hh" #include "GPU_common_types.hh"
#include "GPU_material.hh" #include "GPU_material.hh"
@ -1394,3 +1395,17 @@ template<> struct DefaultHash<Vector<blender::gpu::shader::SpecializationConstan
} }
}; };
} // namespace blender } // namespace blender
#define _INFO_EXPAND2(a, b) ADDITIONAL_INFO(a) ADDITIONAL_INFO(b)
#define _INFO_EXPAND3(a, b, c) _INFO_EXPAND2(a, b) ADDITIONAL_INFO(c)
#define _INFO_EXPAND4(a, b, c, d) _INFO_EXPAND3(a, b, c) ADDITIONAL_INFO(d)
#define _INFO_EXPAND5(a, b, c, d, e) _INFO_EXPAND4(a, b, c, d) ADDITIONAL_INFO(e)
#define _INFO_EXPAND6(a, b, c, d, e, f) _INFO_EXPAND5(a, b, c, d, e) ADDITIONAL_INFO(f)
#define ADDITIONAL_INFO_EXPAND(...) VA_NARGS_CALL_OVERLOAD(_INFO_EXPAND, __VA_ARGS__)
#define CREATE_INFO_VARIANT(name, ...) \
GPU_SHADER_CREATE_INFO(name) \
DO_STATIC_COMPILATION() \
ADDITIONAL_INFO_EXPAND(__VA_ARGS__) \
GPU_SHADER_CREATE_END()