Blender V4.3
eevee_film_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
9 .sampler(0, ImageType::DEPTH_2D, "depth_tx")
10 .sampler(1, ImageType::FLOAT_2D, "combined_tx")
11 .sampler(2, ImageType::FLOAT_2D, "vector_tx")
12 .sampler(3, ImageType::FLOAT_2D_ARRAY, "rp_color_tx")
13 .sampler(4, ImageType::FLOAT_2D_ARRAY, "rp_value_tx")
14 /* Color History for TAA needs to be sampler to leverage bilinear sampling. */
15 .sampler(5, ImageType::FLOAT_2D, "in_combined_tx")
16 .sampler(6, ImageType::FLOAT_2D, "cryptomatte_tx")
17 .image(0, GPU_R32F, Qualifier::READ, ImageType::FLOAT_2D_ARRAY, "in_weight_img")
18 .image(1, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D_ARRAY, "out_weight_img")
19 .specialization_constant(Type::UINT, "enabled_categories", 0)
20 .specialization_constant(Type::INT, "samples_len", 0)
21 .specialization_constant(Type::BOOL, "use_reprojection", false)
22 .specialization_constant(Type::INT, "scaling_factor", 1)
23 .specialization_constant(Type::INT, "combined_id", 0)
24 .specialization_constant(Type::INT, "display_id", -1)
25 .specialization_constant(Type::INT, "normal_id", -1)
26 .additional_info("eevee_shared")
27 .additional_info("eevee_global_ubo")
28 .additional_info("eevee_velocity_camera")
29 .additional_info("draw_view");
30
31GPU_SHADER_CREATE_INFO(eevee_film)
32 /* Color History for TAA needs to be sampler to leverage bilinear sampling. */
33 //.image(2, GPU_RGBA16F, Qualifier::READ, ImageType::FLOAT_2D, "in_combined_img")
34 .image(3, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_combined_img")
35 .image(4, GPU_R32F, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "depth_img")
36 .image(5, GPU_RGBA16F, Qualifier::READ_WRITE, ImageType::FLOAT_2D_ARRAY, "color_accum_img")
37 .image(6, GPU_R16F, Qualifier::READ_WRITE, ImageType::FLOAT_2D_ARRAY, "value_accum_img")
38 .image(7, GPU_RGBA32F, Qualifier::READ_WRITE, ImageType::FLOAT_2D_ARRAY, "cryptomatte_img")
39 .additional_info("eevee_film_base");
40
41GPU_SHADER_CREATE_INFO(eevee_film_frag)
42 .do_static_compilation(true)
43 .fragment_out(0, Type::VEC4, "out_color")
44 .fragment_source("eevee_film_frag.glsl")
45 .additional_info("draw_fullscreen", "eevee_film")
46 .depth_write(DepthWrite::ANY);
47
48GPU_SHADER_CREATE_INFO(eevee_film_comp)
49 .do_static_compilation(true)
50 .local_group_size(FILM_GROUP_SIZE, FILM_GROUP_SIZE)
51 .compute_source("eevee_film_comp.glsl")
52 .additional_info("eevee_film");
53
54GPU_SHADER_CREATE_INFO(eevee_film_cryptomatte_post)
55 .do_static_compilation(true)
56 .image(0, GPU_RGBA32F, Qualifier::READ_WRITE, ImageType::FLOAT_2D_ARRAY, "cryptomatte_img")
57 .push_constant(Type::INT, "cryptomatte_layer_len")
58 .push_constant(Type::INT, "cryptomatte_samples_per_layer")
59 .local_group_size(FILM_GROUP_SIZE, FILM_GROUP_SIZE)
60 .compute_source("eevee_film_cryptomatte_post_comp.glsl")
61 .additional_info("eevee_global_ubo", "eevee_shared");
62
63GPU_SHADER_CREATE_INFO(eevee_film_copy_frag)
64 .do_static_compilation(true)
65 .image(3, GPU_RGBA16F, Qualifier::READ, ImageType::FLOAT_2D, "out_combined_img")
66 .image(4, GPU_R32F, Qualifier::READ, ImageType::FLOAT_2D, "depth_img")
67 .image(5, GPU_RGBA16F, Qualifier::READ, ImageType::FLOAT_2D_ARRAY, "color_accum_img")
68 .image(6, GPU_R16F, Qualifier::READ, ImageType::FLOAT_2D_ARRAY, "value_accum_img")
69 .image(7, GPU_RGBA32F, Qualifier::READ, ImageType::FLOAT_2D_ARRAY, "cryptomatte_img")
70 .depth_write(DepthWrite::ANY)
71 .fragment_out(0, Type::VEC4, "out_color")
72 .fragment_source("eevee_film_copy_frag.glsl")
73 .define("FILM_COPY")
74 .additional_info("draw_fullscreen", "eevee_film_base");
75
76/* The combined pass is stored into its own 2D texture with a format of GPU_RGBA16F. */
77GPU_SHADER_CREATE_INFO(eevee_film_pass_convert_combined)
78 .local_group_size(FILM_GROUP_SIZE, FILM_GROUP_SIZE)
79 .push_constant(Type::IVEC2, "offset")
80 .sampler(0, ImageType::FLOAT_2D, "input_tx")
81 .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img")
82 .compute_source("eevee_film_pass_convert_comp.glsl")
83 .do_static_compilation(true);
84
85/* The depth pass is stored into its own 2D texture with a format of GPU_R32F. */
86GPU_SHADER_CREATE_INFO(eevee_film_pass_convert_depth)
87 .local_group_size(FILM_GROUP_SIZE, FILM_GROUP_SIZE)
88 .push_constant(Type::IVEC2, "offset")
89 .sampler(0, ImageType::FLOAT_2D, "input_tx")
90 .image(0, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img")
91 .compute_source("eevee_film_pass_convert_comp.glsl")
92 .do_static_compilation(true);
93
94/* Value passes are stored in a slice of a 2D texture array with a format of GPU_R16F. */
95GPU_SHADER_CREATE_INFO(eevee_film_pass_convert_value)
96 .local_group_size(FILM_GROUP_SIZE, FILM_GROUP_SIZE)
97 .push_constant(Type::IVEC2, "offset")
98 .define("IS_ARRAY_INPUT")
99 .sampler(0, ImageType::FLOAT_2D_ARRAY, "input_tx")
100 .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img")
101 .compute_source("eevee_film_pass_convert_comp.glsl")
102 .do_static_compilation(true);
103
104/* Color passes are stored in a slice of a 2D texture array with a format of GPU_RGBA16F. */
105GPU_SHADER_CREATE_INFO(eevee_film_pass_convert_color)
106 .local_group_size(FILM_GROUP_SIZE, FILM_GROUP_SIZE)
107 .push_constant(Type::IVEC2, "offset")
108 .define("IS_ARRAY_INPUT")
109 .sampler(0, ImageType::FLOAT_2D_ARRAY, "input_tx")
110 .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img")
111 .compute_source("eevee_film_pass_convert_comp.glsl")
112 .do_static_compilation(true);
113
114/* Cryptomatte passes are stored in a slice of a 2D texture array with a format of GPU_RGBA32F. */
115GPU_SHADER_CREATE_INFO(eevee_film_pass_convert_cryptomatte)
116 .local_group_size(FILM_GROUP_SIZE, FILM_GROUP_SIZE)
117 .push_constant(Type::IVEC2, "offset")
118 .define("IS_ARRAY_INPUT")
119 .sampler(0, ImageType::FLOAT_2D_ARRAY, "input_tx")
120 .image(0, GPU_RGBA32F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img")
121 .compute_source("eevee_film_pass_convert_comp.glsl")
122 .do_static_compilation(true);
#define FILM_GROUP_SIZE
combined_tx rp_color_tx in_combined_tx in_weight_img image(1, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D_ARRAY, "out_weight_img") .specialization_constant(Type depth_img GPU_R16F
combined_tx rp_color_tx in_combined_tx GPU_R32F
GPU_RGBA32F
cryptomatte_img push_constant(Type::INT, "cryptomatte_layer_len") .push_constant(Type GPU_RGBA16F
cryptomatte_img push_constant(Type::INT, "cryptomatte_layer_len") .push_constant(Type out_combined_img color_accum_img cryptomatte_img out_color eevee_film_base
#define GPU_SHADER_CREATE_INFO(_info)