Blender  V2.93
eevee_shadows.c
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * Copyright 2019, Blender Foundation.
17  */
18 
23 #include "BLI_string_utils.h"
24 #include "BLI_sys_types.h" /* bool */
25 
26 #include "BKE_object.h"
27 
28 #include "DEG_depsgraph_query.h"
29 
30 #include "eevee_private.h"
31 
32 #define SH_CASTER_ALLOC_CHUNK 32
33 
35 {
36  evsh->contact_dist = (la->mode & LA_SHAD_CONTACT) ? la->contact_dist : 0.0f;
37  evsh->contact_bias = 0.05f * la->contact_bias;
39 }
40 
42 {
43  const uint shadow_ubo_size = sizeof(EEVEE_Shadow) * MAX_SHADOW +
46 
47  const DRWContextState *draw_ctx = DRW_context_state_get();
48  const Scene *scene_eval = DEG_get_evaluated_scene(draw_ctx->depsgraph);
49 
50  if (!sldata->lights) {
51  sldata->lights = MEM_callocN(sizeof(EEVEE_LightsInfo), "EEVEE_LightsInfo");
52  sldata->light_ubo = GPU_uniformbuf_create_ex(sizeof(EEVEE_Light) * MAX_LIGHT, NULL, "evLight");
53  sldata->shadow_ubo = GPU_uniformbuf_create_ex(shadow_ubo_size, NULL, "evShadow");
54 
55  for (int i = 0; i < 2; i++) {
56  sldata->shcasters_buffers[i].bbox = MEM_mallocN(
57  sizeof(EEVEE_BoundBox) * SH_CASTER_ALLOC_CHUNK, __func__);
58  sldata->shcasters_buffers[i].update = BLI_BITMAP_NEW(SH_CASTER_ALLOC_CHUNK, __func__);
59  sldata->shcasters_buffers[i].alloc_count = SH_CASTER_ALLOC_CHUNK;
60  sldata->shcasters_buffers[i].count = 0;
61  }
62  sldata->lights->shcaster_frontbuffer = &sldata->shcasters_buffers[0];
63  sldata->lights->shcaster_backbuffer = &sldata->shcasters_buffers[1];
64  }
65 
66  /* Flip buffers */
69  sldata->lights->shcaster_backbuffer);
70 
71  int sh_cube_size = scene_eval->eevee.shadow_cube_size;
72  int sh_cascade_size = scene_eval->eevee.shadow_cascade_size;
73  const bool sh_high_bitdepth = (scene_eval->eevee.flag & SCE_EEVEE_SHADOW_HIGH_BITDEPTH) != 0;
74  sldata->lights->soft_shadows = (scene_eval->eevee.flag & SCE_EEVEE_SHADOW_SOFT) != 0;
75 
76  EEVEE_LightsInfo *linfo = sldata->lights;
77  if ((linfo->shadow_cube_size != sh_cube_size) ||
78  (linfo->shadow_high_bitdepth != sh_high_bitdepth)) {
79  BLI_assert((sh_cube_size > 0) && (sh_cube_size <= 4096));
81  CLAMP(sh_cube_size, 1, 4096);
82  }
83 
84  if ((linfo->shadow_cascade_size != sh_cascade_size) ||
85  (linfo->shadow_high_bitdepth != sh_high_bitdepth)) {
86  BLI_assert((sh_cascade_size > 0) && (sh_cascade_size <= 4096));
88  CLAMP(sh_cascade_size, 1, 4096);
89  }
90 
91  linfo->shadow_high_bitdepth = sh_high_bitdepth;
92  linfo->shadow_cube_size = sh_cube_size;
93  linfo->shadow_cascade_size = sh_cascade_size;
94 }
95 
97 {
98  EEVEE_LightsInfo *linfo = sldata->lights;
99  EEVEE_StorageList *stl = vedata->stl;
100  EEVEE_PassList *psl = vedata->psl;
101 
102  EEVEE_ShadowCasterBuffer *backbuffer = linfo->shcaster_backbuffer;
103  EEVEE_ShadowCasterBuffer *frontbuffer = linfo->shcaster_frontbuffer;
104 
105  frontbuffer->count = 0;
106  linfo->num_cube_layer = 0;
107  linfo->num_cascade_layer = 0;
108  linfo->cube_len = linfo->cascade_len = linfo->shadow_len = 0;
109 
110  /* Shadow Casters: Reset flags. */
111  BLI_bitmap_set_all(backbuffer->update, true, backbuffer->alloc_count);
112  /* Is this one needed? */
113  BLI_bitmap_set_all(frontbuffer->update, false, frontbuffer->alloc_count);
114 
116 
117  {
120 
122  psl->shadow_pass);
123  }
124 }
125 
126 /* Make that object update shadow casting lights inside its influence bounding box. */
128 {
129  EEVEE_LightsInfo *linfo = sldata->lights;
130  EEVEE_ShadowCasterBuffer *backbuffer = linfo->shcaster_backbuffer;
131  EEVEE_ShadowCasterBuffer *frontbuffer = linfo->shcaster_frontbuffer;
132  bool update = true;
133  int id = frontbuffer->count;
134 
135  /* Make sure shadow_casters is big enough. */
136  if (id >= frontbuffer->alloc_count) {
137  /* Double capacity to prevent exponential slowdown. */
138  frontbuffer->alloc_count *= 2;
139  frontbuffer->bbox = MEM_reallocN(frontbuffer->bbox,
140  sizeof(EEVEE_BoundBox) * frontbuffer->alloc_count);
141  BLI_BITMAP_RESIZE(frontbuffer->update, frontbuffer->alloc_count);
142  }
143 
144  if (ob->base_flag & BASE_FROM_DUPLI) {
145  /* Duplis will always refresh the shadow-maps as if they were deleted each frame. */
146  /* TODO(fclem): fix this. */
147  update = true;
148  }
149  else {
151  int past_id = oedata->shadow_caster_id;
152  oedata->shadow_caster_id = id;
153  /* Update flags in backbuffer. */
154  if (past_id > -1 && past_id < backbuffer->count) {
155  BLI_BITMAP_SET(backbuffer->update, past_id, oedata->need_update);
156  }
157  update = oedata->need_update;
158  oedata->need_update = false;
159  }
160 
161  if (update) {
162  BLI_BITMAP_ENABLE(frontbuffer->update, id);
163  }
164 
165  /* Update World AABB in frontbuffer. */
167  float min[3], max[3];
168  INIT_MINMAX(min, max);
169  for (int i = 0; i < 8; i++) {
170  float vec[3];
171  copy_v3_v3(vec, bb->vec[i]);
172  mul_m4_v3(ob->obmat, vec);
173  minmax_v3v3_v3(min, max, vec);
174  }
175 
176  EEVEE_BoundBox *aabb = &frontbuffer->bbox[id];
177  /* Note that `*aabb` has not been initialized yet. */
178  add_v3_v3v3(aabb->center, min, max);
179  mul_v3_fl(aabb->center, 0.5f);
180  sub_v3_v3v3(aabb->halfdim, aabb->center, max);
181 
182  aabb->halfdim[0] = fabsf(aabb->halfdim[0]);
183  aabb->halfdim[1] = fabsf(aabb->halfdim[1]);
184  aabb->halfdim[2] = fabsf(aabb->halfdim[2]);
185 
188 
189  frontbuffer->count++;
190 }
191 
192 /* Used for checking if object is inside the shadow volume. */
193 static bool sphere_bbox_intersect(const BoundSphere *bs, const EEVEE_BoundBox *bb)
194 {
195  /* We are testing using a rougher AABB vs AABB test instead of full AABB vs Sphere. */
196  /* TODO test speed with AABB vs Sphere. */
197  bool x = fabsf(bb->center[0] - bs->center[0]) <= (bb->halfdim[0] + bs->radius);
198  bool y = fabsf(bb->center[1] - bs->center[1]) <= (bb->halfdim[1] + bs->radius);
199  bool z = fabsf(bb->center[2] - bs->center[2]) <= (bb->halfdim[2] + bs->radius);
200 
201  return x && y && z;
202 }
203 
205 {
206  EEVEE_StorageList *stl = vedata->stl;
207  EEVEE_EffectsInfo *effects = stl->effects;
208  EEVEE_LightsInfo *linfo = sldata->lights;
209  EEVEE_ShadowCasterBuffer *backbuffer = linfo->shcaster_backbuffer;
210  EEVEE_ShadowCasterBuffer *frontbuffer = linfo->shcaster_frontbuffer;
211 
212  eGPUTextureFormat shadow_pool_format = (linfo->shadow_high_bitdepth) ? GPU_DEPTH_COMPONENT24 :
214  /* Setup enough layers. */
215  /* Free textures if number mismatch. */
216  if (linfo->num_cube_layer != linfo->cache_num_cube_layer) {
218  linfo->cache_num_cube_layer = linfo->num_cube_layer;
219  /* Update all lights. */
220  BLI_bitmap_set_all(&linfo->sh_cube_update[0], true, MAX_LIGHT);
221  }
222 
223  if (linfo->num_cascade_layer != linfo->cache_num_cascade_layer) {
226  }
227 
228  if (!sldata->shadow_cube_pool) {
230  linfo->shadow_cube_size,
231  max_ii(1, linfo->num_cube_layer * 6),
232  shadow_pool_format,
234  NULL);
235  }
236 
237  if (!sldata->shadow_cascade_pool) {
239  linfo->shadow_cascade_size,
240  max_ii(1, linfo->num_cascade_layer),
241  shadow_pool_format,
243  NULL);
244  }
245 
246  if (sldata->shadow_fb == NULL) {
247  sldata->shadow_fb = GPU_framebuffer_create("shadow_fb");
248  }
249 
250  /* Gather all light own update bits. to avoid costly intersection check. */
251  for (int j = 0; j < linfo->cube_len; j++) {
252  const EEVEE_Light *evli = linfo->light_data + linfo->shadow_cube_light_indices[j];
253  /* Setup shadow cube in UBO and tag for update if necessary. */
254  if (EEVEE_shadows_cube_setup(linfo, evli, effects->taa_current_sample - 1)) {
255  BLI_BITMAP_ENABLE(&linfo->sh_cube_update[0], j);
256  }
257  }
258 
259  /* TODO(fclem): This part can be slow, optimize it. */
260  EEVEE_BoundBox *bbox = backbuffer->bbox;
261  BoundSphere *bsphere = linfo->shadow_bounds;
262  /* Search for deleted shadow casters or if shcaster WAS in shadow radius. */
263  for (int i = 0; i < backbuffer->count; i++) {
264  /* If the shadow-caster has been deleted or updated. */
265  if (BLI_BITMAP_TEST(backbuffer->update, i)) {
266  for (int j = 0; j < linfo->cube_len; j++) {
267  if (!BLI_BITMAP_TEST(&linfo->sh_cube_update[0], j)) {
268  if (sphere_bbox_intersect(&bsphere[j], &bbox[i])) {
269  BLI_BITMAP_ENABLE(&linfo->sh_cube_update[0], j);
270  }
271  }
272  }
273  }
274  }
275  /* Search for updates in current shadow casters. */
276  bbox = frontbuffer->bbox;
277  for (int i = 0; i < frontbuffer->count; i++) {
278  /* If the shadow-caster has been updated. */
279  if (BLI_BITMAP_TEST(frontbuffer->update, i)) {
280  for (int j = 0; j < linfo->cube_len; j++) {
281  if (!BLI_BITMAP_TEST(&linfo->sh_cube_update[0], j)) {
282  if (sphere_bbox_intersect(&bsphere[j], &bbox[i])) {
283  BLI_BITMAP_ENABLE(&linfo->sh_cube_update[0], j);
284  }
285  }
286  }
287  }
288  }
289 
290  /* Resize shcasters buffers if too big. */
291  if (frontbuffer->alloc_count - frontbuffer->count > SH_CASTER_ALLOC_CHUNK) {
292  frontbuffer->alloc_count = (frontbuffer->count / SH_CASTER_ALLOC_CHUNK) *
294  frontbuffer->alloc_count += (frontbuffer->count % SH_CASTER_ALLOC_CHUNK != 0) ?
296  0;
297  frontbuffer->bbox = MEM_reallocN(frontbuffer->bbox,
298  sizeof(EEVEE_BoundBox) * frontbuffer->alloc_count);
299  BLI_BITMAP_RESIZE(frontbuffer->update, frontbuffer->alloc_count);
300  }
301 }
302 
303 /* this refresh lights shadow buffers */
305 {
306  EEVEE_LightsInfo *linfo = sldata->lights;
307 
308  int saved_ray_type = sldata->common_data.ray_type;
309 
310  /* Precompute all shadow/view test before rendering and trashing the culling cache. */
312  bool any_visible = linfo->cascade_len > 0;
313  for (int cube = 0; cube < linfo->cube_len; cube++) {
315  BLI_BITMAP_ENABLE(cube_visible, cube);
316  any_visible = true;
317  }
318  }
319 
320  if (any_visible) {
322  GPU_uniformbuf_update(sldata->common_ubo, &sldata->common_data);
323  }
324 
325  DRW_stats_group_start("Cube Shadow Maps");
326  {
327  for (int cube = 0; cube < linfo->cube_len; cube++) {
328  if (BLI_BITMAP_TEST(cube_visible, cube) && BLI_BITMAP_TEST(linfo->sh_cube_update, cube)) {
329  EEVEE_shadows_draw_cubemap(sldata, vedata, cube);
330  }
331  }
332  }
334 
335  DRW_stats_group_start("Cascaded Shadow Maps");
336  {
337  for (int cascade = 0; cascade < linfo->cascade_len; cascade++) {
338  EEVEE_shadows_draw_cascades(sldata, vedata, view, cascade);
339  }
340  }
342 
344 
345  GPU_uniformbuf_update(sldata->shadow_ubo, &linfo->shadow_data); /* Update all data at once */
346 
347  if (any_visible) {
348  sldata->common_data.ray_type = saved_ray_type;
349  GPU_uniformbuf_update(sldata->common_ubo, &sldata->common_data);
350  }
351 }
352 
353 /* -------------------------------------------------------------------- */
358  EEVEE_Data *vedata,
359  uint UNUSED(tot_samples))
360 {
361  EEVEE_FramebufferList *fbl = vedata->fbl;
362  EEVEE_TextureList *txl = vedata->txl;
363  EEVEE_PassList *psl = vedata->psl;
365 
366  /* Create FrameBuffer. */
367  const eGPUTextureFormat texture_format = GPU_R32F;
368  DRW_texture_ensure_fullscreen_2d(&txl->shadow_accum, texture_format, 0);
369 
370  GPU_framebuffer_ensure_config(&fbl->shadow_accum_fb,
371  {GPU_ATTACHMENT_NONE, GPU_ATTACHMENT_TEXTURE(txl->shadow_accum)});
372 
373  /* Create Pass and shgroup. */
377  psl->shadow_accum_pass);
378  DRW_shgroup_uniform_texture_ref(grp, "depthBuffer", &dtxl->depth);
380  DRW_shgroup_uniform_block(grp, "probe_block", sldata->probe_ubo);
381  DRW_shgroup_uniform_block(grp, "grid_block", sldata->grid_ubo);
382  DRW_shgroup_uniform_block(grp, "planar_block", sldata->planar_ubo);
383  DRW_shgroup_uniform_block(grp, "light_block", sldata->light_ubo);
384  DRW_shgroup_uniform_block(grp, "shadow_block", sldata->shadow_ubo);
385  DRW_shgroup_uniform_block(grp, "common_block", sldata->common_ubo);
386  DRW_shgroup_uniform_block(grp, "renderpass_block", sldata->renderpass_ubo.combined);
387  DRW_shgroup_uniform_texture_ref(grp, "shadowCubeTexture", &sldata->shadow_cube_pool);
388  DRW_shgroup_uniform_texture_ref(grp, "shadowCascadeTexture", &sldata->shadow_cascade_pool);
389 
391 }
392 
394 {
395  EEVEE_FramebufferList *fbl = vedata->fbl;
396  EEVEE_PassList *psl = vedata->psl;
397  EEVEE_EffectsInfo *effects = vedata->stl->effects;
398 
399  if (fbl->shadow_accum_fb != NULL) {
401 
402  /* Clear texture. */
403  if (effects->taa_current_sample == 1) {
404  const float clear[4] = {0.0f, 0.0f, 0.0f, 0.0f};
405  GPU_framebuffer_clear_color(fbl->shadow_accum_fb, clear);
406  }
407 
409 
410  /* Restore */
412  }
413 }
414 
General operations, lookup, etc. for blender objects.
struct BoundBox * BKE_object_boundbox_get(struct Object *ob)
Definition: object.c:3817
#define BLI_assert(a)
Definition: BLI_assert.h:58
#define BLI_BITMAP_TEST(_bitmap, _index)
Definition: BLI_bitmap.h:63
#define BLI_BITMAP_ENABLE(_bitmap, _index)
Definition: BLI_bitmap.h:78
#define BLI_BITMAP_NEW_ALLOCA(_tot)
Definition: BLI_bitmap.h:54
#define BLI_BITMAP_NEW(_tot, _alloc_string)
Definition: BLI_bitmap.h:50
void BLI_bitmap_set_all(BLI_bitmap *bitmap, bool set, size_t bits)
Definition: bitmap.c:33
#define BLI_BITMAP_SET(_bitmap, _index, _set)
Definition: BLI_bitmap.h:93
#define BLI_BITMAP_RESIZE(_bitmap, _tot)
Definition: BLI_bitmap.h:106
unsigned int BLI_bitmap
Definition: BLI_bitmap.h:32
MINLINE int max_ii(int a, int b)
void mul_m4_v3(const float M[4][4], float r[3])
Definition: math_matrix.c:732
void minmax_v3v3_v3(float min[3], float max[3], const float vec[3])
Definition: math_vector.c:1020
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void mul_v3_fl(float r[3], float f)
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void add_v3_v3v3(float r[3], const float a[3], const float b[3])
unsigned int uint
Definition: BLI_sys_types.h:83
#define INIT_MINMAX(min, max)
#define SWAP(type, a, b)
#define UNUSED(x)
struct Scene * DEG_get_evaluated_scene(const struct Depsgraph *graph)
@ BASE_FROM_DUPLI
#define LA_SHAD_CONTACT
@ SCE_EEVEE_SHADOW_HIGH_BITDEPTH
@ SCE_EEVEE_SHADOW_SOFT
@ DRW_TEX_FILTER
Definition: DRW_render.h:139
@ DRW_TEX_COMPARE
Definition: DRW_render.h:141
DRWState
Definition: DRW_render.h:312
@ DRW_STATE_WRITE_DEPTH
Definition: DRW_render.h:314
@ DRW_STATE_SHADOW_OFFSET
Definition: DRW_render.h:353
@ DRW_STATE_BLEND_ADD_FULL
Definition: DRW_render.h:338
@ DRW_STATE_WRITE_COLOR
Definition: DRW_render.h:315
@ DRW_STATE_DEPTH_LESS_EQUAL
Definition: DRW_render.h:323
@ DRW_STATE_DEPTH_ALWAYS
Definition: DRW_render.h:321
#define DRW_PASS_CREATE(pass, state)
Definition: DRW_render.h:593
#define DRW_shgroup_call(shgroup, geom, ob)
Definition: DRW_render.h:420
#define DRW_TEXTURE_FREE_SAFE(tex)
Definition: DRW_render.h:180
static AppView * view
void GPU_framebuffer_bind(GPUFrameBuffer *fb)
GPUFrameBuffer * GPU_framebuffer_create(const char *name)
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble z
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
eGPUTextureFormat
Definition: GPU_texture.h:84
@ GPU_R32F
Definition: GPU_texture.h:111
@ GPU_DEPTH_COMPONENT24
Definition: GPU_texture.h:167
@ GPU_DEPTH_COMPONENT16
Definition: GPU_texture.h:168
GPUUniformBuf * GPU_uniformbuf_create_ex(size_t size, const void *data, const char *name)
void GPU_uniformbuf_update(GPUUniformBuf *ubo, const void *data)
#define MEM_reallocN(vmemh, len)
Group RGB to Bright Vector Camera CLAMP
GPUBatch * DRW_cache_fullscreen_quad_get(void)
Definition: draw_cache.c:358
const DRWContextState * DRW_context_state_get(void)
DefaultTextureList * DRW_viewport_texture_list_get(void)
Definition: draw_manager.c:702
void DRW_shgroup_uniform_block(DRWShadingGroup *shgroup, const char *name, const GPUUniformBuf *ubo)
void DRW_shgroup_uniform_texture(DRWShadingGroup *shgroup, const char *name, const GPUTexture *tex)
DRWShadingGroup * DRW_shgroup_create(struct GPUShader *shader, DRWPass *pass)
void DRW_shgroup_uniform_texture_ref(DRWShadingGroup *shgroup, const char *name, GPUTexture **tex)
void DRW_view_set_active(DRWView *view)
bool DRW_culling_sphere_test(const DRWView *view, const BoundSphere *bsphere)
void DRW_draw_pass(DRWPass *pass)
void DRW_stats_group_start(const char *name)
void DRW_stats_group_end(void)
void DRW_texture_ensure_fullscreen_2d(GPUTexture **tex, eGPUTextureFormat format, DRWTextureFlag flags)
GPUTexture * DRW_texture_create_2d_array(int w, int h, int d, eGPUTextureFormat format, DRWTextureFlag flags, const float *fpixels)
EEVEE_ObjectEngineData * EEVEE_object_data_ensure(Object *ob)
Definition: eevee_data.c:307
struct GPUTexture * EEVEE_materials_get_util_tex(void)
struct EEVEE_Shadow EEVEE_Shadow
#define MAX_SHADOW_CASCADE
Definition: eevee_private.h:53
struct GPUShader * EEVEE_shaders_shadow_accum_sh_get(void)
struct EEVEE_ShadowCascade EEVEE_ShadowCascade
bool EEVEE_shadows_cube_setup(EEVEE_LightsInfo *linfo, const EEVEE_Light *evli, int sample_ofs)
void EEVEE_shadows_draw_cascades(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata, DRWView *view, int cascade_index)
#define EEVEE_RAY_SHADOW
EEVEE_ShadowCasterBuffer
#define MAX_SHADOW_CUBE
Definition: eevee_private.h:54
#define MAX_LIGHT
Definition: eevee_private.h:50
struct GPUShader * EEVEE_shaders_shadow_sh_get(void)
void EEVEE_shadows_draw_cubemap(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata, int cube_index)
#define MAX_SHADOW
Definition: eevee_private.h:52
void EEVEE_shadows_update(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
void EEVEE_shadows_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
Definition: eevee_shadows.c:96
void EEVEE_shadow_output_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata, uint UNUSED(tot_samples))
#define SH_CASTER_ALLOC_CHUNK
Definition: eevee_shadows.c:32
void EEVEE_shadows_caster_register(EEVEE_ViewLayerData *sldata, Object *ob)
void EEVEE_shadow_output_accumulate(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *vedata)
void EEVEE_shadows_init(EEVEE_ViewLayerData *sldata)
Definition: eevee_shadows.c:41
void EEVEE_shadows_draw(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata, DRWView *view)
static bool sphere_bbox_intersect(const BoundSphere *bs, const EEVEE_BoundBox *bb)
void eevee_contact_shadow_setup(const Light *la, EEVEE_Shadow *evsh)
Definition: eevee_shadows.c:34
int count
#define fabsf(x)
void *(* MEM_callocN)(size_t len, const char *str)
Definition: mallocn.c:45
void *(* MEM_mallocN)(size_t len, const char *str)
Definition: mallocn.c:47
static ulong state[N]
static void clear(Message *msg)
Definition: msgfmt.c:294
static void update(bNodeTree *ntree)
#define min(a, b)
Definition: sort.c:51
float vec[8][3]
float center[3]
Definition: DRW_render.h:87
float radius
Definition: DRW_render.h:87
struct GPUTexture * depth
float halfdim[3]
EEVEE_TextureList * txl
EEVEE_StorageList * stl
EEVEE_PassList * psl
EEVEE_FramebufferList * fbl
struct GPUFrameBuffer * main_fb
struct GPUFrameBuffer * shadow_accum_fb
struct EEVEE_Light light_data[MAX_LIGHT]
struct EEVEE_ShadowCasterBuffer * shcaster_frontbuffer
struct EEVEE_Shadow shadow_data[MAX_SHADOW]
struct BoundSphere shadow_bounds[MAX_LIGHT]
BLI_bitmap sh_cube_update[BLI_BITMAP_SIZE(MAX_SHADOW_CUBE)]
uchar shadow_cube_light_indices[MAX_SHADOW_CUBE]
struct EEVEE_ShadowCasterBuffer * shcaster_backbuffer
struct EEVEE_LightsInfo::@199 shcaster_aabb
struct DRWPass * shadow_accum_pass
struct DRWPass * shadow_pass
struct DRWShadingGroup * shadow_shgrp
float contact_bias
float contact_thickness
float contact_dist
struct EEVEE_PrivateData * g_data
struct EEVEE_EffectsInfo * effects
struct GPUTexture * shadow_accum
struct EEVEE_CommonUniformBuffer common_data
struct GPUTexture * shadow_cube_pool
struct GPUUniformBuf * combined
struct GPUUniformBuf * shadow_ubo
struct GPUUniformBuf * probe_ubo
struct GPUUniformBuf * grid_ubo
struct GPUFrameBuffer * shadow_fb
struct GPUUniformBuf * planar_ubo
struct EEVEE_ViewLayerData::@202 renderpass_ubo
struct GPUUniformBuf * common_ubo
struct GPUUniformBuf * light_ubo
struct GPUTexture * shadow_cascade_pool
struct EEVEE_ShadowCasterBuffer shcasters_buffers[2]
struct EEVEE_LightsInfo * lights
float contact_thickness
float contact_dist
float contact_bias
short base_flag
float obmat[4][4]
struct SceneEEVEE eevee
float max