Blender V4.3
workbench_shadow_info.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#include "draw_defines.hh"
6
8
9/* -------------------------------------------------------------------- */
13GPU_SHADER_CREATE_INFO(workbench_shadow_common)
14 .storage_buf(3, Qualifier::READ, "float", "pos[]", Frequency::GEOMETRY)
15 /* WORKAROUND: Needed to support OpenSubdiv vertex format. Should be removed. */
16 .push_constant(Type::IVEC2, "gpu_attr_3")
17 .uniform_buf(1, "ShadowPassData", "pass_data")
18 .typedef_source("workbench_shader_shared.h")
19 .additional_info("gpu_index_load")
20 .additional_info("draw_view")
21 .additional_info("draw_modelmat_new")
22 .additional_info("draw_resource_handle_new");
23
24GPU_SHADER_CREATE_INFO(workbench_shadow_visibility_compute_common)
25 .local_group_size(DRW_VISIBILITY_GROUP_SIZE)
26 .define("DRW_VIEW_LEN", "64")
27 .storage_buf(0, Qualifier::READ, "ObjectBounds", "bounds_buf[]")
28 .uniform_buf(2, "ExtrudedFrustum", "extruded_frustum")
29 .push_constant(Type::INT, "resource_len")
30 .push_constant(Type::INT, "view_len")
31 .push_constant(Type::INT, "visibility_word_per_draw")
32 .push_constant(Type::BOOL, "force_fail_method")
33 .push_constant(Type::VEC3, "shadow_direction")
34 .typedef_source("workbench_shader_shared.h")
35 .compute_source("workbench_shadow_visibility_comp.glsl")
36 .additional_info("draw_view", "draw_view_culling");
37
38GPU_SHADER_CREATE_INFO(workbench_shadow_visibility_compute_dynamic_pass_type)
39 .additional_info("workbench_shadow_visibility_compute_common")
40 .define("DYNAMIC_PASS_SELECTION")
41 .storage_buf(1, Qualifier::READ_WRITE, "uint", "pass_visibility_buf[]")
42 .storage_buf(2, Qualifier::READ_WRITE, "uint", "fail_visibility_buf[]")
43 .do_static_compilation(true);
44
45GPU_SHADER_CREATE_INFO(workbench_shadow_visibility_compute_static_pass_type)
46 .additional_info("workbench_shadow_visibility_compute_common")
47 .storage_buf(1, Qualifier::READ_WRITE, "uint", "visibility_buf[]")
48 .do_static_compilation(true);
49
52/* -------------------------------------------------------------------- */
56GPU_SHADER_CREATE_INFO(workbench_shadow_no_debug)
57 .fragment_source("gpu_shader_depth_only_frag.glsl");
58
59GPU_SHADER_CREATE_INFO(workbench_shadow_debug)
60 .fragment_out(0, Type::VEC4, "out_debug_color")
61 .fragment_source("workbench_shadow_debug_frag.glsl");
62
65/* -------------------------------------------------------------------- */
69#define WORKBENCH_SHADOW_VARIATIONS(common, prefix, suffix, ...) \
70 GPU_SHADER_CREATE_INFO(prefix##_pass_manifold_no_caps##suffix) \
71 .define("SHADOW_PASS") \
72 .vertex_source("workbench_shadow_vert.glsl") \
73 .additional_info(common, __VA_ARGS__) \
74 .do_static_compilation(true); \
75 GPU_SHADER_CREATE_INFO(prefix##_pass_no_manifold_no_caps##suffix) \
76 .define("SHADOW_PASS") \
77 .define("DOUBLE_MANIFOLD") \
78 .vertex_source("workbench_shadow_vert.glsl") \
79 .additional_info(common, __VA_ARGS__) \
80 .do_static_compilation(true); \
81 GPU_SHADER_CREATE_INFO(prefix##_fail_manifold_caps##suffix) \
82 .define("SHADOW_FAIL") \
83 .vertex_source("workbench_shadow_caps_vert.glsl") \
84 .additional_info(common, __VA_ARGS__) \
85 .do_static_compilation(true); \
86 GPU_SHADER_CREATE_INFO(prefix##_fail_manifold_no_caps##suffix) \
87 .define("SHADOW_FAIL") \
88 .vertex_source("workbench_shadow_vert.glsl") \
89 .additional_info(common, __VA_ARGS__) \
90 .do_static_compilation(true); \
91 GPU_SHADER_CREATE_INFO(prefix##_fail_no_manifold_caps##suffix) \
92 .define("SHADOW_FAIL") \
93 .define("DOUBLE_MANIFOLD") \
94 .vertex_source("workbench_shadow_caps_vert.glsl") \
95 .additional_info(common, __VA_ARGS__) \
96 .do_static_compilation(true); \
97 GPU_SHADER_CREATE_INFO(prefix##_fail_no_manifold_no_caps##suffix) \
98 .define("SHADOW_FAIL") \
99 .define("DOUBLE_MANIFOLD") \
100 .vertex_source("workbench_shadow_vert.glsl") \
101 .additional_info(common, __VA_ARGS__) \
102 .do_static_compilation(true);
103
104WORKBENCH_SHADOW_VARIATIONS("workbench_shadow_common",
106 ,
107 "workbench_shadow_no_debug")
108
109WORKBENCH_SHADOW_VARIATIONS("workbench_shadow_common",
112 "workbench_shadow_debug")
113
#define DRW_VISIBILITY_GROUP_SIZE
#define GPU_SHADER_CREATE_INFO(_info)
#define WORKBENCH_SHADOW_VARIATIONS(common, prefix, suffix,...)