Fix: Asset using selection in instances to points node
[blender.git] / source / blender / draw / tests / shaders_test.cc
1 /* Apache License, Version 2.0 */
2
3 #include "testing/testing.h"
4
5 #include "draw_testing.hh"
6
7 #include "GPU_context.h"
8 #include "GPU_index_buffer.h"
9 #include "GPU_init_exit.h"
10 #include "GPU_shader.h"
11 #include "GPU_texture.h"
12 #include "GPU_vertex_buffer.h"
13
14 #include "intern/draw_manager_testing.h"
15
16 #include "engines/eevee/eevee_private.h"
17 #include "engines/gpencil/gpencil_engine.h"
18 #include "engines/image/image_private.h"
19 #include "engines/overlay/overlay_private.h"
20 #include "engines/workbench/workbench_private.h"
21 #include "intern/draw_shader.h"
22
23 namespace blender::draw {
24
25 static void test_workbench_glsl_shaders()
26 {
27   workbench_shader_library_ensure();
28
29   const int MAX_WPD = 6;
30   WORKBENCH_PrivateData wpds[MAX_WPD];
31
32   wpds[0].sh_cfg = GPU_SHADER_CFG_DEFAULT;
33   wpds[0].shading.light = V3D_LIGHTING_FLAT;
34   wpds[1].sh_cfg = GPU_SHADER_CFG_DEFAULT;
35   wpds[1].shading.light = V3D_LIGHTING_MATCAP;
36   wpds[2].sh_cfg = GPU_SHADER_CFG_DEFAULT;
37   wpds[2].shading.light = V3D_LIGHTING_STUDIO;
38   wpds[3].sh_cfg = GPU_SHADER_CFG_CLIPPED;
39   wpds[3].shading.light = V3D_LIGHTING_FLAT;
40   wpds[4].sh_cfg = GPU_SHADER_CFG_CLIPPED;
41   wpds[4].shading.light = V3D_LIGHTING_MATCAP;
42   wpds[5].sh_cfg = GPU_SHADER_CFG_CLIPPED;
43   wpds[5].shading.light = V3D_LIGHTING_STUDIO;
44
45   for (int wpd_index = 0; wpd_index < MAX_WPD; wpd_index++) {
46     WORKBENCH_PrivateData *wpd = &wpds[wpd_index];
47     EXPECT_NE(workbench_shader_opaque_get(wpd, WORKBENCH_DATATYPE_MESH), nullptr);
48     EXPECT_NE(workbench_shader_opaque_get(wpd, WORKBENCH_DATATYPE_HAIR), nullptr);
49     EXPECT_NE(workbench_shader_opaque_get(wpd, WORKBENCH_DATATYPE_POINTCLOUD), nullptr);
50     EXPECT_NE(workbench_shader_opaque_image_get(wpd, WORKBENCH_DATATYPE_MESH, false), nullptr);
51     EXPECT_NE(workbench_shader_opaque_image_get(wpd, WORKBENCH_DATATYPE_MESH, true), nullptr);
52     EXPECT_NE(workbench_shader_opaque_image_get(wpd, WORKBENCH_DATATYPE_HAIR, false), nullptr);
53     EXPECT_NE(workbench_shader_opaque_image_get(wpd, WORKBENCH_DATATYPE_HAIR, true), nullptr);
54     EXPECT_NE(workbench_shader_opaque_image_get(wpd, WORKBENCH_DATATYPE_POINTCLOUD, false),
55               nullptr);
56     EXPECT_NE(workbench_shader_opaque_image_get(wpd, WORKBENCH_DATATYPE_POINTCLOUD, true),
57               nullptr);
58     EXPECT_NE(workbench_shader_composite_get(wpd), nullptr);
59     EXPECT_NE(workbench_shader_merge_infront_get(wpd), nullptr);
60
61     EXPECT_NE(workbench_shader_transparent_get(wpd, WORKBENCH_DATATYPE_MESH), nullptr);
62     EXPECT_NE(workbench_shader_transparent_get(wpd, WORKBENCH_DATATYPE_HAIR), nullptr);
63     EXPECT_NE(workbench_shader_transparent_get(wpd, WORKBENCH_DATATYPE_POINTCLOUD), nullptr);
64     EXPECT_NE(workbench_shader_transparent_image_get(wpd, WORKBENCH_DATATYPE_MESH, false),
65               nullptr);
66     EXPECT_NE(workbench_shader_transparent_image_get(wpd, WORKBENCH_DATATYPE_MESH, true), nullptr);
67     EXPECT_NE(workbench_shader_transparent_image_get(wpd, WORKBENCH_DATATYPE_HAIR, false),
68               nullptr);
69     EXPECT_NE(workbench_shader_transparent_image_get(wpd, WORKBENCH_DATATYPE_HAIR, true), nullptr);
70     EXPECT_NE(workbench_shader_transparent_image_get(wpd, WORKBENCH_DATATYPE_POINTCLOUD, false),
71               nullptr);
72     EXPECT_NE(workbench_shader_transparent_image_get(wpd, WORKBENCH_DATATYPE_POINTCLOUD, true),
73               nullptr);
74     EXPECT_NE(workbench_shader_transparent_resolve_get(wpd), nullptr);
75   }
76
77   EXPECT_NE(workbench_shader_shadow_pass_get(false), nullptr);
78   EXPECT_NE(workbench_shader_shadow_pass_get(true), nullptr);
79   EXPECT_NE(workbench_shader_shadow_fail_get(false, false), nullptr);
80   EXPECT_NE(workbench_shader_shadow_fail_get(false, true), nullptr);
81   EXPECT_NE(workbench_shader_shadow_fail_get(true, false), nullptr);
82   EXPECT_NE(workbench_shader_shadow_fail_get(true, true), nullptr);
83
84   /* NOTE: workbench_shader_cavity_get(false, false) isn't a valid option. */
85   EXPECT_NE(workbench_shader_cavity_get(false, true), nullptr);
86   EXPECT_NE(workbench_shader_cavity_get(true, false), nullptr);
87   EXPECT_NE(workbench_shader_cavity_get(true, true), nullptr);
88   EXPECT_NE(workbench_shader_outline_get(), nullptr);
89
90   EXPECT_NE(workbench_shader_antialiasing_accumulation_get(), nullptr);
91   EXPECT_NE(workbench_shader_antialiasing_get(0), nullptr);
92   EXPECT_NE(workbench_shader_antialiasing_get(1), nullptr);
93   EXPECT_NE(workbench_shader_antialiasing_get(2), nullptr);
94
95   EXPECT_NE(workbench_shader_volume_get(false, false, WORKBENCH_VOLUME_INTERP_LINEAR, false),
96             nullptr);
97   EXPECT_NE(workbench_shader_volume_get(false, false, WORKBENCH_VOLUME_INTERP_LINEAR, true),
98             nullptr);
99   EXPECT_NE(workbench_shader_volume_get(false, false, WORKBENCH_VOLUME_INTERP_CUBIC, false),
100             nullptr);
101   EXPECT_NE(workbench_shader_volume_get(false, false, WORKBENCH_VOLUME_INTERP_CUBIC, true),
102             nullptr);
103   EXPECT_NE(workbench_shader_volume_get(false, false, WORKBENCH_VOLUME_INTERP_CLOSEST, false),
104             nullptr);
105   EXPECT_NE(workbench_shader_volume_get(false, false, WORKBENCH_VOLUME_INTERP_CLOSEST, true),
106             nullptr);
107   EXPECT_NE(workbench_shader_volume_get(false, true, WORKBENCH_VOLUME_INTERP_LINEAR, false),
108             nullptr);
109   EXPECT_NE(workbench_shader_volume_get(false, true, WORKBENCH_VOLUME_INTERP_LINEAR, true),
110             nullptr);
111   EXPECT_NE(workbench_shader_volume_get(false, true, WORKBENCH_VOLUME_INTERP_CUBIC, false),
112             nullptr);
113   EXPECT_NE(workbench_shader_volume_get(false, true, WORKBENCH_VOLUME_INTERP_CUBIC, true),
114             nullptr);
115   EXPECT_NE(workbench_shader_volume_get(false, true, WORKBENCH_VOLUME_INTERP_CLOSEST, false),
116             nullptr);
117   EXPECT_NE(workbench_shader_volume_get(false, true, WORKBENCH_VOLUME_INTERP_CLOSEST, true),
118             nullptr);
119   EXPECT_NE(workbench_shader_volume_get(true, false, WORKBENCH_VOLUME_INTERP_LINEAR, false),
120             nullptr);
121   EXPECT_NE(workbench_shader_volume_get(true, false, WORKBENCH_VOLUME_INTERP_LINEAR, true),
122             nullptr);
123   EXPECT_NE(workbench_shader_volume_get(true, false, WORKBENCH_VOLUME_INTERP_CUBIC, false),
124             nullptr);
125   EXPECT_NE(workbench_shader_volume_get(true, false, WORKBENCH_VOLUME_INTERP_CUBIC, true),
126             nullptr);
127   EXPECT_NE(workbench_shader_volume_get(true, false, WORKBENCH_VOLUME_INTERP_CLOSEST, false),
128             nullptr);
129   EXPECT_NE(workbench_shader_volume_get(true, false, WORKBENCH_VOLUME_INTERP_CLOSEST, true),
130             nullptr);
131   EXPECT_NE(workbench_shader_volume_get(true, true, WORKBENCH_VOLUME_INTERP_LINEAR, false),
132             nullptr);
133   EXPECT_NE(workbench_shader_volume_get(true, true, WORKBENCH_VOLUME_INTERP_LINEAR, true),
134             nullptr);
135   EXPECT_NE(workbench_shader_volume_get(true, true, WORKBENCH_VOLUME_INTERP_CUBIC, false),
136             nullptr);
137   EXPECT_NE(workbench_shader_volume_get(true, true, WORKBENCH_VOLUME_INTERP_CUBIC, true), nullptr);
138   EXPECT_NE(workbench_shader_volume_get(true, true, WORKBENCH_VOLUME_INTERP_CLOSEST, false),
139             nullptr);
140   EXPECT_NE(workbench_shader_volume_get(true, true, WORKBENCH_VOLUME_INTERP_CLOSEST, true),
141             nullptr);
142
143   GPUShader *dof_prepare_sh;
144   GPUShader *dof_downsample_sh;
145   GPUShader *dof_blur1_sh;
146   GPUShader *dof_blur2_sh;
147   GPUShader *dof_resolve_sh;
148   workbench_shader_depth_of_field_get(
149       &dof_prepare_sh, &dof_downsample_sh, &dof_blur1_sh, &dof_blur2_sh, &dof_resolve_sh);
150   EXPECT_NE(dof_prepare_sh, nullptr);
151   EXPECT_NE(dof_downsample_sh, nullptr);
152   EXPECT_NE(dof_blur1_sh, nullptr);
153   EXPECT_NE(dof_blur2_sh, nullptr);
154   EXPECT_NE(dof_resolve_sh, nullptr);
155
156   workbench_shader_free();
157 }
158 DRAW_TEST(workbench_glsl_shaders)
159
160 static void test_gpencil_glsl_shaders()
161 {
162   EXPECT_NE(GPENCIL_shader_antialiasing(0), nullptr);
163   EXPECT_NE(GPENCIL_shader_antialiasing(1), nullptr);
164   EXPECT_NE(GPENCIL_shader_antialiasing(2), nullptr);
165
166   EXPECT_NE(GPENCIL_shader_geometry_get(), nullptr);
167   EXPECT_NE(GPENCIL_shader_layer_blend_get(), nullptr);
168   EXPECT_NE(GPENCIL_shader_mask_invert_get(), nullptr);
169   EXPECT_NE(GPENCIL_shader_depth_merge_get(), nullptr);
170   EXPECT_NE(GPENCIL_shader_fx_blur_get(), nullptr);
171   EXPECT_NE(GPENCIL_shader_fx_colorize_get(), nullptr);
172   EXPECT_NE(GPENCIL_shader_fx_composite_get(), nullptr);
173   EXPECT_NE(GPENCIL_shader_fx_transform_get(), nullptr);
174   EXPECT_NE(GPENCIL_shader_fx_glow_get(), nullptr);
175   EXPECT_NE(GPENCIL_shader_fx_pixelize_get(), nullptr);
176   EXPECT_NE(GPENCIL_shader_fx_rim_get(), nullptr);
177   EXPECT_NE(GPENCIL_shader_fx_shadow_get(), nullptr);
178
179   GPENCIL_shader_free();
180 }
181 DRAW_TEST(gpencil_glsl_shaders)
182
183 static void test_image_glsl_shaders()
184 {
185   IMAGE_shader_library_ensure();
186
187   EXPECT_NE(IMAGE_shader_image_get(false), nullptr);
188   EXPECT_NE(IMAGE_shader_image_get(true), nullptr);
189
190   IMAGE_shader_free();
191 }
192 DRAW_TEST(image_glsl_shaders)
193
194 static void test_overlay_glsl_shaders()
195 {
196   OVERLAY_shader_library_ensure();
197
198   for (int i = 0; i < 2; i++) {
199     eGPUShaderConfig sh_cfg = i == 0 ? GPU_SHADER_CFG_DEFAULT : GPU_SHADER_CFG_CLIPPED;
200     DRW_draw_state_init_gtests(sh_cfg);
201     EXPECT_NE(OVERLAY_shader_antialiasing(), nullptr);
202     EXPECT_NE(OVERLAY_shader_armature_degrees_of_freedom_wire(), nullptr);
203     EXPECT_NE(OVERLAY_shader_armature_degrees_of_freedom_solid(), nullptr);
204     EXPECT_NE(OVERLAY_shader_armature_envelope(false), nullptr);
205     EXPECT_NE(OVERLAY_shader_armature_envelope(true), nullptr);
206     EXPECT_NE(OVERLAY_shader_armature_shape(false), nullptr);
207     EXPECT_NE(OVERLAY_shader_armature_shape(true), nullptr);
208     EXPECT_NE(OVERLAY_shader_armature_shape_wire(), nullptr);
209     EXPECT_NE(OVERLAY_shader_armature_sphere(false), nullptr);
210     EXPECT_NE(OVERLAY_shader_armature_sphere(true), nullptr);
211     EXPECT_NE(OVERLAY_shader_armature_stick(), nullptr);
212     EXPECT_NE(OVERLAY_shader_armature_wire(), nullptr);
213     EXPECT_NE(OVERLAY_shader_background(), nullptr);
214     EXPECT_NE(OVERLAY_shader_clipbound(), nullptr);
215     EXPECT_NE(OVERLAY_shader_depth_only(), nullptr);
216     EXPECT_NE(OVERLAY_shader_edit_curve_handle(), nullptr);
217     EXPECT_NE(OVERLAY_shader_edit_curve_point(), nullptr);
218     EXPECT_NE(OVERLAY_shader_edit_curve_wire(), nullptr);
219     EXPECT_NE(OVERLAY_shader_edit_gpencil_guide_point(), nullptr);
220     EXPECT_NE(OVERLAY_shader_edit_gpencil_point(), nullptr);
221     EXPECT_NE(OVERLAY_shader_edit_gpencil_wire(), nullptr);
222     EXPECT_NE(OVERLAY_shader_edit_lattice_point(), nullptr);
223     EXPECT_NE(OVERLAY_shader_edit_lattice_wire(), nullptr);
224     EXPECT_NE(OVERLAY_shader_edit_mesh_analysis(), nullptr);
225     EXPECT_NE(OVERLAY_shader_edit_mesh_edge(false), nullptr);
226     EXPECT_NE(OVERLAY_shader_edit_mesh_edge(true), nullptr);
227     EXPECT_NE(OVERLAY_shader_edit_mesh_face(), nullptr);
228     EXPECT_NE(OVERLAY_shader_edit_mesh_facedot(), nullptr);
229     EXPECT_NE(OVERLAY_shader_edit_mesh_normal(), nullptr);
230     EXPECT_NE(OVERLAY_shader_edit_mesh_skin_root(), nullptr);
231     EXPECT_NE(OVERLAY_shader_edit_mesh_vert(), nullptr);
232     EXPECT_NE(OVERLAY_shader_edit_particle_strand(), nullptr);
233     EXPECT_NE(OVERLAY_shader_edit_particle_point(), nullptr);
234     EXPECT_NE(OVERLAY_shader_edit_uv_edges_get(), nullptr);
235     EXPECT_NE(OVERLAY_shader_edit_uv_face_get(), nullptr);
236     EXPECT_NE(OVERLAY_shader_edit_uv_face_dots_get(), nullptr);
237     EXPECT_NE(OVERLAY_shader_edit_uv_verts_get(), nullptr);
238     EXPECT_NE(OVERLAY_shader_edit_uv_stretching_area_get(), nullptr);
239     EXPECT_NE(OVERLAY_shader_edit_uv_stretching_angle_get(), nullptr);
240     EXPECT_NE(OVERLAY_shader_edit_uv_tiled_image_borders_get(), nullptr);
241     EXPECT_NE(OVERLAY_shader_edit_uv_stencil_image(), nullptr);
242     EXPECT_NE(OVERLAY_shader_edit_uv_mask_image(), nullptr);
243     EXPECT_NE(OVERLAY_shader_extra(false), nullptr);
244     EXPECT_NE(OVERLAY_shader_extra(true), nullptr);
245     EXPECT_NE(OVERLAY_shader_extra_groundline(), nullptr);
246     EXPECT_NE(OVERLAY_shader_extra_wire(false, false), nullptr);
247     EXPECT_NE(OVERLAY_shader_extra_wire(false, true), nullptr);
248     EXPECT_NE(OVERLAY_shader_extra_wire(true, false), nullptr);
249     EXPECT_NE(OVERLAY_shader_extra_wire(true, true), nullptr);
250     EXPECT_NE(OVERLAY_shader_extra_loose_point(), nullptr);
251     EXPECT_NE(OVERLAY_shader_extra_point(), nullptr);
252     EXPECT_NE(OVERLAY_shader_facing(), nullptr);
253     EXPECT_NE(OVERLAY_shader_gpencil_canvas(), nullptr);
254     EXPECT_NE(OVERLAY_shader_grid(), nullptr);
255     EXPECT_NE(OVERLAY_shader_grid_image(), nullptr);
256     EXPECT_NE(OVERLAY_shader_image(), nullptr);
257     EXPECT_NE(OVERLAY_shader_motion_path_line(), nullptr);
258     EXPECT_NE(OVERLAY_shader_motion_path_vert(), nullptr);
259     EXPECT_NE(OVERLAY_shader_uniform_color(), nullptr);
260     EXPECT_NE(OVERLAY_shader_outline_prepass(false), nullptr);
261     EXPECT_NE(OVERLAY_shader_outline_prepass(true), nullptr);
262     EXPECT_NE(OVERLAY_shader_outline_prepass_gpencil(), nullptr);
263     EXPECT_NE(OVERLAY_shader_outline_prepass_pointcloud(), nullptr);
264     EXPECT_NE(OVERLAY_shader_extra_grid(), nullptr);
265     EXPECT_NE(OVERLAY_shader_outline_detect(), nullptr);
266     EXPECT_NE(OVERLAY_shader_paint_face(), nullptr);
267     EXPECT_NE(OVERLAY_shader_paint_point(), nullptr);
268     EXPECT_NE(OVERLAY_shader_paint_texture(), nullptr);
269     EXPECT_NE(OVERLAY_shader_paint_vertcol(), nullptr);
270     EXPECT_NE(OVERLAY_shader_paint_weight(false), nullptr);
271     EXPECT_NE(OVERLAY_shader_paint_weight(true), nullptr);
272     EXPECT_NE(OVERLAY_shader_paint_wire(), nullptr);
273     EXPECT_NE(OVERLAY_shader_particle_dot(), nullptr);
274     EXPECT_NE(OVERLAY_shader_particle_shape(), nullptr);
275     EXPECT_NE(OVERLAY_shader_sculpt_mask(), nullptr);
276     EXPECT_NE(OVERLAY_shader_volume_velocity(false, false), nullptr);
277     EXPECT_NE(OVERLAY_shader_volume_velocity(false, true), nullptr);
278     EXPECT_NE(OVERLAY_shader_volume_velocity(true, false), nullptr);
279     EXPECT_NE(OVERLAY_shader_wireframe(false), nullptr);
280     EXPECT_NE(OVERLAY_shader_wireframe(true), nullptr);
281     EXPECT_NE(OVERLAY_shader_wireframe_select(), nullptr);
282     EXPECT_NE(OVERLAY_shader_xray_fade(), nullptr);
283   }
284
285   OVERLAY_shader_free();
286 }
287 DRAW_TEST(overlay_glsl_shaders)
288
289 static void test_eevee_glsl_shaders_static()
290 {
291   EEVEE_shaders_material_shaders_init();
292
293   EXPECT_NE(EEVEE_shaders_bloom_blit_get(false), nullptr);
294   EXPECT_NE(EEVEE_shaders_bloom_blit_get(true), nullptr);
295   EXPECT_NE(EEVEE_shaders_bloom_downsample_get(false), nullptr);
296   EXPECT_NE(EEVEE_shaders_bloom_downsample_get(true), nullptr);
297   EXPECT_NE(EEVEE_shaders_bloom_upsample_get(false), nullptr);
298   EXPECT_NE(EEVEE_shaders_bloom_upsample_get(true), nullptr);
299   EXPECT_NE(EEVEE_shaders_bloom_resolve_get(false), nullptr);
300   EXPECT_NE(EEVEE_shaders_bloom_resolve_get(true), nullptr);
301   EXPECT_NE(EEVEE_shaders_depth_of_field_bokeh_get(), nullptr);
302   EXPECT_NE(EEVEE_shaders_depth_of_field_setup_get(), nullptr);
303   EXPECT_NE(EEVEE_shaders_depth_of_field_flatten_tiles_get(), nullptr);
304   EXPECT_NE(EEVEE_shaders_depth_of_field_dilate_tiles_get(false), nullptr);
305   EXPECT_NE(EEVEE_shaders_depth_of_field_dilate_tiles_get(true), nullptr);
306   EXPECT_NE(EEVEE_shaders_depth_of_field_downsample_get(), nullptr);
307   EXPECT_NE(EEVEE_shaders_depth_of_field_reduce_get(true), nullptr);
308   EXPECT_NE(EEVEE_shaders_depth_of_field_reduce_get(false), nullptr);
309   EXPECT_NE(EEVEE_shaders_depth_of_field_gather_get(DOF_GATHER_FOREGROUND, false), nullptr);
310   EXPECT_NE(EEVEE_shaders_depth_of_field_gather_get(DOF_GATHER_FOREGROUND, true), nullptr);
311   EXPECT_NE(EEVEE_shaders_depth_of_field_gather_get(DOF_GATHER_BACKGROUND, false), nullptr);
312   EXPECT_NE(EEVEE_shaders_depth_of_field_gather_get(DOF_GATHER_BACKGROUND, true), nullptr);
313   EXPECT_NE(EEVEE_shaders_depth_of_field_gather_get(DOF_GATHER_HOLEFILL, false), nullptr);
314   EXPECT_NE(EEVEE_shaders_depth_of_field_gather_get(DOF_GATHER_HOLEFILL, true), nullptr);
315   EXPECT_NE(EEVEE_shaders_depth_of_field_filter_get(), nullptr);
316   EXPECT_NE(EEVEE_shaders_depth_of_field_scatter_get(false, false), nullptr);
317   EXPECT_NE(EEVEE_shaders_depth_of_field_scatter_get(false, true), nullptr);
318   EXPECT_NE(EEVEE_shaders_depth_of_field_scatter_get(true, false), nullptr);
319   EXPECT_NE(EEVEE_shaders_depth_of_field_scatter_get(true, true), nullptr);
320   EXPECT_NE(EEVEE_shaders_depth_of_field_resolve_get(false, true), nullptr);
321   EXPECT_NE(EEVEE_shaders_depth_of_field_resolve_get(false, false), nullptr);
322   EXPECT_NE(EEVEE_shaders_depth_of_field_resolve_get(true, true), nullptr);
323   EXPECT_NE(EEVEE_shaders_depth_of_field_resolve_get(true, false), nullptr);
324   EXPECT_NE(EEVEE_shaders_effect_downsample_sh_get(), nullptr);
325   EXPECT_NE(EEVEE_shaders_effect_downsample_cube_sh_get(), nullptr);
326   EXPECT_NE(EEVEE_shaders_effect_minz_downlevel_sh_get(), nullptr);
327   EXPECT_NE(EEVEE_shaders_effect_maxz_downlevel_sh_get(), nullptr);
328   EXPECT_NE(EEVEE_shaders_effect_minz_downdepth_sh_get(), nullptr);
329   EXPECT_NE(EEVEE_shaders_effect_maxz_downdepth_sh_get(), nullptr);
330   EXPECT_NE(EEVEE_shaders_effect_minz_downdepth_layer_sh_get(), nullptr);
331   EXPECT_NE(EEVEE_shaders_effect_maxz_downdepth_layer_sh_get(), nullptr);
332   EXPECT_NE(EEVEE_shaders_effect_maxz_copydepth_layer_sh_get(), nullptr);
333   EXPECT_NE(EEVEE_shaders_effect_minz_copydepth_sh_get(), nullptr);
334   EXPECT_NE(EEVEE_shaders_effect_maxz_copydepth_sh_get(), nullptr);
335   EXPECT_NE(EEVEE_shaders_effect_mist_sh_get(), nullptr);
336   EXPECT_NE(EEVEE_shaders_effect_motion_blur_sh_get(), nullptr);
337   EXPECT_NE(EEVEE_shaders_effect_motion_blur_object_sh_get(), nullptr);
338   EXPECT_NE(EEVEE_shaders_effect_motion_blur_hair_sh_get(), nullptr);
339   EXPECT_NE(EEVEE_shaders_effect_motion_blur_velocity_tiles_sh_get(), nullptr);
340   EXPECT_NE(EEVEE_shaders_effect_motion_blur_velocity_tiles_expand_sh_get(), nullptr);
341   EXPECT_NE(EEVEE_shaders_effect_ambient_occlusion_sh_get(), nullptr);
342   EXPECT_NE(EEVEE_shaders_effect_ambient_occlusion_debug_sh_get(), nullptr);
343   EXPECT_NE(EEVEE_shaders_ggx_lut_sh_get(), nullptr);
344   EXPECT_NE(EEVEE_shaders_ggx_refraction_lut_sh_get(), nullptr);
345   EXPECT_NE(EEVEE_shaders_probe_filter_glossy_sh_get(), nullptr);
346   EXPECT_NE(EEVEE_shaders_probe_filter_diffuse_sh_get(), nullptr);
347   EXPECT_NE(EEVEE_shaders_probe_filter_visibility_sh_get(), nullptr);
348   EXPECT_NE(EEVEE_shaders_probe_grid_fill_sh_get(), nullptr);
349   EXPECT_NE(EEVEE_shaders_probe_planar_downsample_sh_get(), nullptr);
350   EXPECT_NE(EEVEE_shaders_renderpasses_post_process_sh_get(), nullptr);
351   EXPECT_NE(EEVEE_shaders_cryptomatte_sh_get(false), nullptr);
352   EXPECT_NE(EEVEE_shaders_cryptomatte_sh_get(true), nullptr);
353   EXPECT_NE(EEVEE_shaders_shadow_sh_get(), nullptr);
354   EXPECT_NE(EEVEE_shaders_shadow_accum_sh_get(), nullptr);
355   EXPECT_NE(EEVEE_shaders_subsurface_first_pass_sh_get(), nullptr);
356   EXPECT_NE(EEVEE_shaders_subsurface_second_pass_sh_get(), nullptr);
357   EXPECT_NE(EEVEE_shaders_volumes_clear_sh_get(), nullptr);
358   EXPECT_NE(EEVEE_shaders_volumes_clear_sh_get(), nullptr);
359   EXPECT_NE(EEVEE_shaders_volumes_scatter_sh_get(), nullptr);
360   EXPECT_NE(EEVEE_shaders_volumes_scatter_with_lights_sh_get(), nullptr);
361   EXPECT_NE(EEVEE_shaders_volumes_integration_sh_get(), nullptr);
362   EXPECT_NE(EEVEE_shaders_volumes_resolve_sh_get(false), nullptr);
363   EXPECT_NE(EEVEE_shaders_volumes_resolve_sh_get(true), nullptr);
364   EXPECT_NE(EEVEE_shaders_volumes_accum_sh_get(), nullptr);
365   EXPECT_NE(EEVEE_shaders_studiolight_probe_sh_get(), nullptr);
366   EXPECT_NE(EEVEE_shaders_studiolight_background_sh_get(), nullptr);
367   EXPECT_NE(EEVEE_shaders_probe_cube_display_sh_get(), nullptr);
368   EXPECT_NE(EEVEE_shaders_probe_grid_display_sh_get(), nullptr);
369   EXPECT_NE(EEVEE_shaders_probe_planar_display_sh_get(), nullptr);
370   EXPECT_NE(EEVEE_shaders_update_noise_sh_get(), nullptr);
371   EXPECT_NE(EEVEE_shaders_velocity_resolve_sh_get(), nullptr);
372   EXPECT_NE(EEVEE_shaders_taa_resolve_sh_get(EFFECT_TAA), nullptr);
373   EXPECT_NE(EEVEE_shaders_taa_resolve_sh_get(EFFECT_TAA_REPROJECT), nullptr);
374   EXPECT_NE(EEVEE_shaders_effect_reflection_trace_sh_get(), nullptr);
375   EXPECT_NE(EEVEE_shaders_effect_reflection_resolve_sh_get(), nullptr);
376   EEVEE_shaders_free();
377 }
378 DRAW_TEST(eevee_glsl_shaders_static)
379
380 static void test_draw_shaders(eParticleRefineShaderType sh_type)
381 {
382   DRW_shaders_free();
383   EXPECT_NE(DRW_shader_hair_refine_get(PART_REFINE_CATMULL_ROM, sh_type), nullptr);
384   DRW_shaders_free();
385 }
386
387 static void test_draw_glsl_shaders()
388 {
389 #ifndef __APPLE__
390   test_draw_shaders(PART_REFINE_SHADER_TRANSFORM_FEEDBACK);
391   test_draw_shaders(PART_REFINE_SHADER_COMPUTE);
392 #endif
393   test_draw_shaders(PART_REFINE_SHADER_TRANSFORM_FEEDBACK_WORKAROUND);
394 }
395 DRAW_TEST(draw_glsl_shaders)
396
397 }  // namespace blender::draw