Blender
V5.0
source
blender
draw
engines
eevee
eevee_sampling_shared.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
8
9
#pragma once
10
11
#include "
GPU_shader_shared_utils.hh
"
12
13
#ifndef GPU_SHADER
14
namespace
blender::eevee
{
15
#endif
16
17
enum
eSamplingDimension
: uint32_t {
18
SAMPLING_FILTER_U
= 0u,
19
SAMPLING_FILTER_V
= 1u,
20
SAMPLING_LENS_U
= 2u,
21
SAMPLING_LENS_V
= 3u,
22
SAMPLING_TIME
= 4u,
23
SAMPLING_SHADOW_U
= 5u,
24
SAMPLING_SHADOW_V
= 6u,
25
SAMPLING_SHADOW_W
= 7u,
26
SAMPLING_SHADOW_X
= 8u,
27
SAMPLING_SHADOW_Y
= 9u,
28
SAMPLING_CLOSURE
= 10u,
29
SAMPLING_LIGHTPROBE
= 11u,
30
SAMPLING_TRANSPARENCY
= 12u,
31
SAMPLING_SSS_U
= 13u,
32
SAMPLING_SSS_V
= 14u,
33
SAMPLING_RAYTRACE_U
= 15u,
34
SAMPLING_RAYTRACE_V
= 16u,
35
SAMPLING_RAYTRACE_W
= 17u,
36
SAMPLING_RAYTRACE_X
= 18u,
37
SAMPLING_AO_U
= 19u,
38
SAMPLING_AO_V
= 20u,
39
SAMPLING_AO_W
= 21u,
40
SAMPLING_CURVES_U
= 22u,
41
SAMPLING_VOLUME_U
= 23u,
42
SAMPLING_VOLUME_V
= 24u,
43
SAMPLING_VOLUME_W
= 25u,
44
SAMPLING_SHADOW_I
= 26u,
45
SAMPLING_SHADOW_J
= 27u,
46
SAMPLING_SHADOW_K
= 28u,
47
SAMPLING_UNUSED_0
= 29u,
48
SAMPLING_UNUSED_1
= 30u,
49
SAMPLING_UNUSED_2
= 31u,
50
};
51
56
#define SAMPLING_DIMENSION_COUNT 32
57
58
/* NOTE(@fclem): Needs to be used in #StorageBuffer because of arrays of scalar. */
59
struct
SamplingData
{
61
float
dimensions
[
SAMPLING_DIMENSION_COUNT
];
62
};
63
BLI_STATIC_ASSERT_ALIGN
(
SamplingData
, 16)
64
65
/* Returns total sample count in a web pattern of the given size. */
66
static inline
int
sampling_web_sample_count_get
(
int
web_density,
int
in_ring_count)
67
{
68
return
((in_ring_count * in_ring_count + in_ring_count) / 2) * web_density + 1;
69
}
70
71
/* Returns lowest possible ring count that contains at least sample_count samples. */
72
static
inline
int
sampling_web_ring_count_get
(
int
web_density,
int
sample_count)
73
{
74
/* Inversion of web_sample_count_get(). */
75
float
x
= 2.0f * (
float
(sample_count) - 1.0f) /
float
(web_density);
76
/* Solving polynomial. We only search positive solution. */
77
float
discriminant = 1.0f + 4.0f *
x
;
78
return
int(
ceilf
(0.5f * (
sqrtf
(discriminant) - 1.0f)));
79
}
80
81
#ifndef GPU_SHADER
82
}
// namespace blender::eevee
83
#endif
BLI_STATIC_ASSERT_ALIGN
#define BLI_STATIC_ASSERT_ALIGN(st, align)
Definition
BLI_assert.h:86
x
x
Definition
BLI_expr_pylike_eval_test.cc:345
GPU_shader_shared_utils.hh
float
nullptr float
Definition
closures_template.h:123
SAMPLING_DIMENSION_COUNT
#define SAMPLING_DIMENSION_COUNT
Definition
eevee_sampling_shared.hh:56
blender::eevee
Definition
eevee_ambient_occlusion.cc:29
blender::eevee::eSamplingDimension
eSamplingDimension
Definition
eevee_sampling_shared.hh:17
blender::eevee::SAMPLING_SSS_U
@ SAMPLING_SSS_U
Definition
eevee_sampling_shared.hh:31
blender::eevee::SAMPLING_VOLUME_V
@ SAMPLING_VOLUME_V
Definition
eevee_sampling_shared.hh:42
blender::eevee::SAMPLING_AO_W
@ SAMPLING_AO_W
Definition
eevee_sampling_shared.hh:39
blender::eevee::SAMPLING_FILTER_V
@ SAMPLING_FILTER_V
Definition
eevee_sampling_shared.hh:19
blender::eevee::SAMPLING_VOLUME_W
@ SAMPLING_VOLUME_W
Definition
eevee_sampling_shared.hh:43
blender::eevee::SAMPLING_SHADOW_J
@ SAMPLING_SHADOW_J
Definition
eevee_sampling_shared.hh:45
blender::eevee::SAMPLING_TIME
@ SAMPLING_TIME
Definition
eevee_sampling_shared.hh:22
blender::eevee::SAMPLING_LENS_U
@ SAMPLING_LENS_U
Definition
eevee_sampling_shared.hh:20
blender::eevee::SAMPLING_RAYTRACE_W
@ SAMPLING_RAYTRACE_W
Definition
eevee_sampling_shared.hh:35
blender::eevee::SAMPLING_SHADOW_W
@ SAMPLING_SHADOW_W
Definition
eevee_sampling_shared.hh:25
blender::eevee::SAMPLING_FILTER_U
@ SAMPLING_FILTER_U
Definition
eevee_sampling_shared.hh:18
blender::eevee::SAMPLING_CURVES_U
@ SAMPLING_CURVES_U
Definition
eevee_sampling_shared.hh:40
blender::eevee::SAMPLING_SSS_V
@ SAMPLING_SSS_V
Definition
eevee_sampling_shared.hh:32
blender::eevee::SAMPLING_UNUSED_1
@ SAMPLING_UNUSED_1
Definition
eevee_sampling_shared.hh:48
blender::eevee::SAMPLING_SHADOW_Y
@ SAMPLING_SHADOW_Y
Definition
eevee_sampling_shared.hh:27
blender::eevee::SAMPLING_RAYTRACE_U
@ SAMPLING_RAYTRACE_U
Definition
eevee_sampling_shared.hh:33
blender::eevee::SAMPLING_SHADOW_I
@ SAMPLING_SHADOW_I
Definition
eevee_sampling_shared.hh:44
blender::eevee::SAMPLING_SHADOW_V
@ SAMPLING_SHADOW_V
Definition
eevee_sampling_shared.hh:24
blender::eevee::SAMPLING_RAYTRACE_X
@ SAMPLING_RAYTRACE_X
Definition
eevee_sampling_shared.hh:36
blender::eevee::SAMPLING_SHADOW_X
@ SAMPLING_SHADOW_X
Definition
eevee_sampling_shared.hh:26
blender::eevee::SAMPLING_UNUSED_2
@ SAMPLING_UNUSED_2
Definition
eevee_sampling_shared.hh:49
blender::eevee::SAMPLING_UNUSED_0
@ SAMPLING_UNUSED_0
Definition
eevee_sampling_shared.hh:47
blender::eevee::SAMPLING_RAYTRACE_V
@ SAMPLING_RAYTRACE_V
Definition
eevee_sampling_shared.hh:34
blender::eevee::SAMPLING_SHADOW_K
@ SAMPLING_SHADOW_K
Definition
eevee_sampling_shared.hh:46
blender::eevee::SAMPLING_AO_V
@ SAMPLING_AO_V
Definition
eevee_sampling_shared.hh:38
blender::eevee::SAMPLING_LIGHTPROBE
@ SAMPLING_LIGHTPROBE
Definition
eevee_sampling_shared.hh:29
blender::eevee::SAMPLING_AO_U
@ SAMPLING_AO_U
Definition
eevee_sampling_shared.hh:37
blender::eevee::SAMPLING_CLOSURE
@ SAMPLING_CLOSURE
Definition
eevee_sampling_shared.hh:28
blender::eevee::SAMPLING_TRANSPARENCY
@ SAMPLING_TRANSPARENCY
Definition
eevee_sampling_shared.hh:30
blender::eevee::SAMPLING_VOLUME_U
@ SAMPLING_VOLUME_U
Definition
eevee_sampling_shared.hh:41
blender::eevee::SAMPLING_SHADOW_U
@ SAMPLING_SHADOW_U
Definition
eevee_sampling_shared.hh:23
blender::eevee::SAMPLING_LENS_V
@ SAMPLING_LENS_V
Definition
eevee_sampling_shared.hh:21
blender::eevee::sampling_web_ring_count_get
static int sampling_web_ring_count_get(int web_density, int sample_count)
Definition
eevee_sampling_shared.hh:72
blender::eevee::sampling_web_sample_count_get
static int sampling_web_sample_count_get(int web_density, int in_ring_count)
Definition
eevee_sampling_shared.hh:66
sqrtf
#define sqrtf
ceilf
#define ceilf
blender::eevee::SamplingData
Definition
eevee_sampling_shared.hh:59
blender::eevee::SamplingData::dimensions
float dimensions[SAMPLING_DIMENSION_COUNT]
Definition
eevee_sampling_shared.hh:61
Generated on
for Blender by
doxygen
1.16.1