Blender V5.0
workbench_effect_dof_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#ifdef GPU_SHADER
6# pragma once
7# include "gpu_shader_compat.hh"
8
10
11# include "draw_view_infos.hh"
12# include "gpu_shader_fullscreen_info.hh"
13
14# define PREPARE
15# define DOWNSAMPLE
16# define BLUR1
17# define BLUR2
18# define RESOLVE
19# define NUM_SAMPLES 49
20#endif
21
23
24/*
25 * NOTE: Keep the sampler bind points consistent between the steps.
26 *
27 * SAMPLER(0, sampler2D, input_coc_tx)
28 * SAMPLER(1, sampler2D, scene_color_tx)
29 * SAMPLER(2, sampler2D, scene_depth_tx)
30 * SAMPLER(3, sampler2D, half_res_color_tx)
31 * SAMPLER(4, sampler2D, blur_tx)
32 * SAMPLER(5, sampler2D, noise_tx)
33 */
34
35GPU_SHADER_CREATE_INFO(workbench_effect_dof)
36PUSH_CONSTANT(float2, inverted_viewport_size)
37PUSH_CONSTANT(float2, near_far)
38PUSH_CONSTANT(float3, dof_params)
39PUSH_CONSTANT(float, noise_offset)
40ADDITIONAL_INFO(gpu_fullscreen)
41ADDITIONAL_INFO(draw_view)
43
44GPU_SHADER_CREATE_INFO(workbench_effect_dof_prepare)
45SAMPLER(1, sampler2D, scene_color_tx)
46SAMPLER(2, sampler2D, scene_depth_tx)
47FRAGMENT_OUT(0, float4, halfResColor)
48FRAGMENT_OUT(1, float2, normalizedCoc)
49FRAGMENT_SOURCE("workbench_effect_dof_prepare_frag.glsl")
50ADDITIONAL_INFO(workbench_effect_dof)
53
54GPU_SHADER_CREATE_INFO(workbench_effect_dof_downsample)
55SAMPLER(0, sampler2D, input_coc_tx)
56SAMPLER(1, sampler2D, scene_color_tx)
57FRAGMENT_OUT(0, float4, outColor)
58FRAGMENT_OUT(1, float2, outCocs)
59FRAGMENT_SOURCE("workbench_effect_dof_downsample_frag.glsl")
60ADDITIONAL_INFO(workbench_effect_dof)
63
64GPU_SHADER_CREATE_INFO(workbench_effect_dof_blur1)
65DEFINE_VALUE("NUM_SAMPLES", "49")
66SAMPLER(0, sampler2D, input_coc_tx)
67SAMPLER(3, sampler2D, half_res_color_tx)
68SAMPLER(5, sampler2D, noise_tx)
69UNIFORM_BUF(1, float4, samples[49])
70FRAGMENT_OUT(0, float4, blurColor)
71FRAGMENT_SOURCE("workbench_effect_dof_blur1_frag.glsl")
72ADDITIONAL_INFO(workbench_effect_dof)
75
76GPU_SHADER_CREATE_INFO(workbench_effect_dof_blur2)
77SAMPLER(0, sampler2D, input_coc_tx)
78SAMPLER(4, sampler2D, blur_tx)
79FRAGMENT_OUT(0, float4, final_color)
80FRAGMENT_SOURCE("workbench_effect_dof_blur2_frag.glsl")
81ADDITIONAL_INFO(workbench_effect_dof)
84
85GPU_SHADER_CREATE_INFO(workbench_effect_dof_resolve)
86SAMPLER(2, sampler2D, scene_depth_tx)
87SAMPLER(3, sampler2D, half_res_color_tx)
88FRAGMENT_OUT_DUAL(0, float4, final_colorAdd, SRC_0)
89FRAGMENT_OUT_DUAL(0, float4, final_colorMul, SRC_1)
90FRAGMENT_SOURCE("workbench_effect_dof_resolve_frag.glsl")
91ADDITIONAL_INFO(workbench_effect_dof)
#define GPU_SHADER_CREATE_INFO(_info)
#define GPU_SHADER_CREATE_END()
#define FRAGMENT_OUT_DUAL(slot, type, name, blend)
#define SAMPLER(slot, type, name)
#define UNIFORM_BUF(slot, type_name, name)
#define FRAGMENT_SOURCE(filename)
#define ADDITIONAL_INFO(info_name)
#define PUSH_CONSTANT(type, name)
#define FRAGMENT_OUT(slot, type, name)
#define DO_STATIC_COMPILATION()
#define DEFINE_VALUE(name, value)
SamplerBase< float, 2 > sampler2D