Blender V4.3
eevee_lightprobe_sphere_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 "eevee_defines.hh"
7
8/* -------------------------------------------------------------------- */
13 .define("SPHERE_PROBE")
14 .uniform_buf(SPHERE_PROBE_BUF_SLOT,
15 "SphereProbeData",
16 "lightprobe_sphere_buf[SPHERE_PROBE_MAX]")
17 .sampler(SPHERE_PROBE_TEX_SLOT, ImageType::FLOAT_2D_ARRAY, "lightprobe_spheres_tx");
18
19/* Sample cubemap and remap into an octahedral texture. */
20GPU_SHADER_CREATE_INFO(eevee_lightprobe_sphere_remap)
22 .specialization_constant(Type::BOOL, "extract_sh", true)
23 .specialization_constant(Type::BOOL, "extract_sun", true)
24 .push_constant(Type::IVEC4, "probe_coord_packed")
25 .push_constant(Type::IVEC4, "write_coord_packed")
26 .push_constant(Type::IVEC4, "world_coord_packed")
27 .sampler(0, ImageType::FLOAT_CUBE, "cubemap_tx")
28 .sampler(1, ImageType::FLOAT_2D_ARRAY, "atlas_tx")
29 .storage_buf(0, Qualifier::WRITE, "SphereProbeHarmonic", "out_sh[]")
30 .storage_buf(1, Qualifier::WRITE, "SphereProbeSunLight", "out_sun[]")
31 .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D_ARRAY, "atlas_img")
32 .compute_source("eevee_lightprobe_sphere_remap_comp.glsl")
33 .additional_info("eevee_shared", "eevee_global_ubo")
34 .do_static_compilation(true);
35
36GPU_SHADER_CREATE_INFO(eevee_lightprobe_sphere_irradiance)
37 .local_group_size(SPHERE_PROBE_SH_GROUP_SIZE)
38 .push_constant(Type::IVEC3, "probe_remap_dispatch_size")
39 .storage_buf(0, Qualifier::READ, "SphereProbeHarmonic", "in_sh[]")
40 .storage_buf(1, Qualifier::WRITE, "SphereProbeHarmonic", "out_sh")
41 .additional_info("eevee_shared")
42 .do_static_compilation(true)
43 .compute_source("eevee_lightprobe_sphere_irradiance_comp.glsl");
44
45GPU_SHADER_CREATE_INFO(eevee_lightprobe_sphere_sunlight)
46 .local_group_size(SPHERE_PROBE_SH_GROUP_SIZE)
47 .push_constant(Type::IVEC3, "probe_remap_dispatch_size")
48 .storage_buf(0, Qualifier::READ, "SphereProbeSunLight", "in_sun[]")
49 .storage_buf(1, Qualifier::WRITE, "LightData", "sunlight_buf")
50 .additional_info("eevee_shared")
51 .do_static_compilation(true)
52 .compute_source("eevee_lightprobe_sphere_sunlight_comp.glsl");
53
54GPU_SHADER_CREATE_INFO(eevee_lightprobe_sphere_select)
56 .storage_buf(0,
57 Qualifier::READ_WRITE,
58 "SphereProbeData",
59 "lightprobe_sphere_buf[SPHERE_PROBE_MAX]")
60 .push_constant(Type::INT, "lightprobe_sphere_count")
61 .additional_info("eevee_shared",
62 "eevee_sampling_data",
63 "eevee_global_ubo",
64 "eevee_volume_probe_data")
65 .compute_source("eevee_lightprobe_sphere_select_comp.glsl")
66 .do_static_compilation(true);
67
68GPU_SHADER_CREATE_INFO(eevee_lightprobe_sphere_convolve)
70 .additional_info("eevee_shared")
71 .push_constant(Type::IVEC4, "probe_coord_packed")
72 .push_constant(Type::IVEC4, "write_coord_packed")
73 .push_constant(Type::IVEC4, "read_coord_packed")
74 .push_constant(Type::INT, "read_lod")
75 .sampler(0, ImageType::FLOAT_CUBE, "cubemap_tx")
76 .sampler(1, ImageType::FLOAT_2D_ARRAY, "in_atlas_mip_tx")
77 .image(1, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D_ARRAY, "out_atlas_mip_img")
78 .compute_source("eevee_lightprobe_sphere_convolve_comp.glsl")
79 .do_static_compilation(true);
80
81GPU_SHADER_INTERFACE_INFO(eevee_display_lightprobe_sphere_iface, "")
82 .smooth(Type::VEC3, "P")
83 .smooth(Type::VEC2, "lP")
84 .flat(Type::INT, "probe_index");
85
86GPU_SHADER_CREATE_INFO(eevee_display_lightprobe_sphere)
87 .additional_info("eevee_shared", "draw_view", "eevee_lightprobe_sphere_data")
88 .storage_buf(0, Qualifier::READ, "SphereProbeDisplayData", "display_data_buf[]")
89 .vertex_source("eevee_display_lightprobe_sphere_vert.glsl")
90 .vertex_out(eevee_display_lightprobe_sphere_iface)
91 .fragment_source("eevee_display_lightprobe_sphere_frag.glsl")
92 .fragment_out(0, Type::VEC4, "out_color")
93 .do_static_compilation(true);
94
95GPU_SHADER_INTERFACE_INFO(eevee_display_lightprobe_planar_iface, "")
96 .flat(Type::VEC3, "probe_normal")
97 .flat(Type::INT, "probe_index");
98
99GPU_SHADER_CREATE_INFO(eevee_display_lightprobe_planar)
100 .push_constant(Type::IVEC4, "world_coord_packed")
101 .additional_info("eevee_shared",
102 "draw_view",
103 "eevee_lightprobe_planar_data",
104 "eevee_lightprobe_sphere_data")
105 .storage_buf(0, Qualifier::READ, "PlanarProbeDisplayData", "display_data_buf[]")
106 .vertex_source("eevee_display_lightprobe_planar_vert.glsl")
107 .vertex_out(eevee_display_lightprobe_planar_iface)
108 .fragment_source("eevee_display_lightprobe_planar_frag.glsl")
109 .fragment_out(0, Type::VEC4, "out_color")
110 .do_static_compilation(true);
111
#define SPHERE_PROBE_REMAP_GROUP_SIZE
#define SPHERE_PROBE_TEX_SLOT
#define SPHERE_PROBE_SH_GROUP_SIZE
#define SPHERE_PROBE_SELECT_GROUP_SIZE
#define SPHERE_PROBE_BUF_SLOT
#define SPHERE_PROBE_GROUP_SIZE
#define GPU_SHADER_INTERFACE_INFO(_interface, _inst_name)
#define GPU_SHADER_CREATE_INFO(_info)