2017-03-17 00:00:46 +01:00
|
|
|
/*
|
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
|
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
*
|
2019-01-23 11:29:18 +11:00
|
|
|
* Copyright 2016, Blender Foundation.
|
2017-03-17 00:00:46 +01:00
|
|
|
*/
|
|
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
|
* \ingroup DNA
|
2017-03-17 00:00:46 +01:00
|
|
|
*/
|
|
|
|
|
|
2017-05-08 11:44:58 +10:00
|
|
|
#ifndef __EEVEE_PRIVATE_H__
|
|
|
|
|
#define __EEVEE_PRIVATE_H__
|
|
|
|
|
|
2019-08-22 16:04:25 +02:00
|
|
|
#include "DRW_render.h"
|
|
|
|
|
|
|
|
|
|
#include "BLI_bitmap.h"
|
|
|
|
|
|
2018-07-10 15:02:25 +02:00
|
|
|
#include "DNA_lightprobe_types.h"
|
|
|
|
|
|
2018-01-11 14:08:21 +01:00
|
|
|
struct EEVEE_ShadowCasterBuffer;
|
2019-01-28 21:08:24 +11:00
|
|
|
struct GPUFrameBuffer;
|
|
|
|
|
struct Object;
|
2018-02-20 10:14:23 -03:00
|
|
|
struct RenderLayer;
|
2017-03-17 00:00:46 +01:00
|
|
|
|
2017-05-16 03:03:58 +02:00
|
|
|
extern struct DrawEngineType draw_engine_eevee_type;
|
|
|
|
|
|
2017-04-10 12:06:17 +02:00
|
|
|
/* Minimum UBO is 16384 bytes */
|
2017-06-04 12:12:58 +02:00
|
|
|
#define MAX_PROBE 128 /* TODO : find size by dividing UBO max size by probe data size */
|
2019-04-17 06:17:24 +02:00
|
|
|
#define MAX_GRID 64 /* TODO : find size by dividing UBO max size by grid data size */
|
2017-06-17 00:08:03 +02:00
|
|
|
#define MAX_PLANAR 16 /* TODO : find size by dividing UBO max size by grid data size */
|
2017-04-10 12:06:17 +02:00
|
|
|
#define MAX_LIGHT 128 /* TODO : find size by dividing UBO max size by light data size */
|
|
|
|
|
#define MAX_CASCADE_NUM 4
|
2019-08-22 16:04:25 +02:00
|
|
|
#define MAX_SHADOW 128 /* TODO : Make this depends on GL_MAX_ARRAY_TEXTURE_LAYERS */
|
2017-09-05 21:02:17 +02:00
|
|
|
#define MAX_SHADOW_CASCADE 8
|
|
|
|
|
#define MAX_SHADOW_CUBE (MAX_SHADOW - MAX_CASCADE_NUM * MAX_SHADOW_CASCADE)
|
2017-05-07 14:27:43 +02:00
|
|
|
#define MAX_BLOOM_STEP 16
|
2017-04-10 12:06:17 +02:00
|
|
|
|
2019-08-22 16:04:25 +02:00
|
|
|
// #define DEBUG_SHADOW_DISTRIBUTION
|
|
|
|
|
|
2017-06-13 17:39:39 +02:00
|
|
|
/* Only define one of these. */
|
|
|
|
|
// #define IRRADIANCE_SH_L2
|
|
|
|
|
// #define IRRADIANCE_CUBEMAP
|
|
|
|
|
#define IRRADIANCE_HL2
|
2018-11-16 13:46:13 -02:00
|
|
|
#define HAMMERSLEY_SIZE 1024
|
2017-06-13 17:39:39 +02:00
|
|
|
|
2017-10-24 14:49:00 +02:00
|
|
|
#if defined(IRRADIANCE_SH_L2)
|
2017-11-29 10:22:53 +01:00
|
|
|
# define SHADER_IRRADIANCE "#define IRRADIANCE_SH_L2\n"
|
2017-10-24 14:49:00 +02:00
|
|
|
#elif defined(IRRADIANCE_CUBEMAP)
|
2017-11-29 10:22:53 +01:00
|
|
|
# define SHADER_IRRADIANCE "#define IRRADIANCE_CUBEMAP\n"
|
2017-10-24 14:49:00 +02:00
|
|
|
#elif defined(IRRADIANCE_HL2)
|
2017-11-29 10:22:53 +01:00
|
|
|
# define SHADER_IRRADIANCE "#define IRRADIANCE_HL2\n"
|
2017-10-24 14:49:00 +02:00
|
|
|
#endif
|
|
|
|
|
|
2019-04-16 16:53:50 +02:00
|
|
|
/* Macro causes over indentation. */
|
|
|
|
|
/* clang-format off */
|
2017-10-24 14:49:00 +02:00
|
|
|
#define SHADER_DEFINES \
|
2019-04-17 06:17:24 +02:00
|
|
|
"#define EEVEE_ENGINE\n" \
|
|
|
|
|
"#define MAX_PROBE " STRINGIFY(MAX_PROBE) "\n" \
|
|
|
|
|
"#define MAX_GRID " STRINGIFY(MAX_GRID) "\n" \
|
|
|
|
|
"#define MAX_PLANAR " STRINGIFY(MAX_PLANAR) "\n" \
|
|
|
|
|
"#define MAX_LIGHT " STRINGIFY(MAX_LIGHT) "\n" \
|
|
|
|
|
"#define MAX_SHADOW " STRINGIFY(MAX_SHADOW) "\n" \
|
|
|
|
|
"#define MAX_SHADOW_CUBE " STRINGIFY(MAX_SHADOW_CUBE) "\n" \
|
|
|
|
|
"#define MAX_SHADOW_CASCADE " STRINGIFY(MAX_SHADOW_CASCADE) "\n" \
|
|
|
|
|
"#define MAX_CASCADE_NUM " STRINGIFY(MAX_CASCADE_NUM) "\n" \
|
|
|
|
|
SHADER_IRRADIANCE
|
2019-04-16 16:53:50 +02:00
|
|
|
/* clang-format on */
|
2017-10-24 14:49:00 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
#define SWAP_DOUBLE_BUFFERS() \
|
|
|
|
|
{ \
|
|
|
|
|
if (effects->swap_double_buffer) { \
|
|
|
|
|
SWAP(struct GPUFrameBuffer *, fbl->main_fb, fbl->double_buffer_fb); \
|
|
|
|
|
SWAP(struct GPUFrameBuffer *, fbl->main_color_fb, fbl->double_buffer_color_fb); \
|
|
|
|
|
SWAP(GPUTexture *, txl->color, txl->color_double_buffer); \
|
|
|
|
|
effects->swap_double_buffer = false; \
|
|
|
|
|
} \
|
|
|
|
|
} \
|
|
|
|
|
((void)0)
|
|
|
|
|
|
|
|
|
|
#define SWAP_BUFFERS() \
|
|
|
|
|
{ \
|
|
|
|
|
if (effects->target_buffer == fbl->effect_color_fb) { \
|
|
|
|
|
SWAP_DOUBLE_BUFFERS(); \
|
|
|
|
|
effects->source_buffer = txl->color_post; \
|
|
|
|
|
effects->target_buffer = fbl->main_color_fb; \
|
|
|
|
|
} \
|
|
|
|
|
else { \
|
|
|
|
|
SWAP_DOUBLE_BUFFERS(); \
|
|
|
|
|
effects->source_buffer = txl->color; \
|
|
|
|
|
effects->target_buffer = fbl->effect_color_fb; \
|
|
|
|
|
} \
|
|
|
|
|
} \
|
|
|
|
|
((void)0)
|
|
|
|
|
|
|
|
|
|
#define SWAP_BUFFERS_TAA() \
|
|
|
|
|
{ \
|
|
|
|
|
if (effects->target_buffer == fbl->effect_color_fb) { \
|
|
|
|
|
SWAP(struct GPUFrameBuffer *, fbl->effect_fb, fbl->taa_history_fb); \
|
|
|
|
|
SWAP(struct GPUFrameBuffer *, fbl->effect_color_fb, fbl->taa_history_color_fb); \
|
|
|
|
|
SWAP(GPUTexture *, txl->color_post, txl->taa_history); \
|
|
|
|
|
effects->source_buffer = txl->taa_history; \
|
|
|
|
|
effects->target_buffer = fbl->effect_color_fb; \
|
|
|
|
|
} \
|
|
|
|
|
else { \
|
|
|
|
|
SWAP(struct GPUFrameBuffer *, fbl->main_fb, fbl->taa_history_fb); \
|
|
|
|
|
SWAP(struct GPUFrameBuffer *, fbl->main_color_fb, fbl->taa_history_color_fb); \
|
|
|
|
|
SWAP(GPUTexture *, txl->color, txl->taa_history); \
|
|
|
|
|
effects->source_buffer = txl->taa_history; \
|
|
|
|
|
effects->target_buffer = fbl->main_color_fb; \
|
|
|
|
|
} \
|
|
|
|
|
} \
|
|
|
|
|
((void)0)
|
2018-09-09 23:24:06 +02:00
|
|
|
|
2019-08-27 15:47:30 +02:00
|
|
|
#define MATERIAL_PREVIEW_MODE_ENABLED(v3d) ((v3d) && (v3d->shading.type == OB_MATERIAL))
|
2019-04-17 06:17:24 +02:00
|
|
|
#define LOOK_DEV_OVERLAY_ENABLED(v3d) \
|
2019-08-27 15:47:30 +02:00
|
|
|
((v3d) && (v3d->shading.type == OB_MATERIAL) && ((v3d->flag2 & V3D_HIDE_OVERLAYS) == 0) && \
|
2019-04-17 06:17:24 +02:00
|
|
|
(v3d->overlay.flag & V3D_OVERLAY_LOOK_DEV))
|
|
|
|
|
#define USE_SCENE_LIGHT(v3d) \
|
2019-08-27 15:47:30 +02:00
|
|
|
((!v3d) || \
|
|
|
|
|
((v3d->shading.type == OB_MATERIAL) && (v3d->shading.flag & V3D_SHADING_SCENE_LIGHTS)) || \
|
|
|
|
|
((v3d->shading.type == OB_RENDER) && (v3d->shading.flag & V3D_SHADING_SCENE_LIGHTS_RENDER)))
|
2019-04-17 06:17:24 +02:00
|
|
|
#define LOOK_DEV_STUDIO_LIGHT_ENABLED(v3d) \
|
2019-08-27 15:47:30 +02:00
|
|
|
((v3d) && (((v3d->shading.type == OB_MATERIAL) && \
|
|
|
|
|
((v3d->shading.flag & V3D_SHADING_SCENE_WORLD) == 0)) || \
|
|
|
|
|
((v3d->shading.type == OB_RENDER) && \
|
|
|
|
|
((v3d->shading.flag & V3D_SHADING_SCENE_WORLD_RENDER) == 0))))
|
2019-04-17 06:17:24 +02:00
|
|
|
|
|
|
|
|
#define OCTAHEDRAL_SIZE_FROM_CUBESIZE(cube_size) \
|
|
|
|
|
((int)ceilf(sqrtf((cube_size * cube_size) * 6.0f)))
|
2018-07-10 15:02:25 +02:00
|
|
|
#define MIN_CUBE_LOD_LEVEL 3
|
|
|
|
|
#define MAX_PLANAR_LOD_LEVEL 9
|
|
|
|
|
|
2017-06-22 02:41:17 +02:00
|
|
|
/* World shader variations */
|
|
|
|
|
enum {
|
2019-04-17 06:17:24 +02:00
|
|
|
VAR_WORLD_BACKGROUND = 0,
|
|
|
|
|
VAR_WORLD_PROBE = 1,
|
|
|
|
|
VAR_WORLD_VOLUME = 2,
|
2017-06-22 02:41:17 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* Material shader variations */
|
|
|
|
|
enum {
|
2019-04-17 06:17:24 +02:00
|
|
|
VAR_MAT_MESH = (1 << 0),
|
|
|
|
|
VAR_MAT_PROBE = (1 << 1),
|
|
|
|
|
VAR_MAT_HAIR = (1 << 2),
|
2019-05-04 01:42:50 +02:00
|
|
|
VAR_MAT_BLEND = (1 << 3),
|
2019-08-22 16:04:25 +02:00
|
|
|
VAR_MAT_VOLUME = (1 << 4),
|
|
|
|
|
VAR_MAT_LOOKDEV = (1 << 5),
|
2019-04-17 06:17:24 +02:00
|
|
|
/* Max number of variation */
|
|
|
|
|
/* IMPORTANT : Leave it last and set
|
|
|
|
|
* it's value accordingly. */
|
2019-08-22 16:04:25 +02:00
|
|
|
VAR_MAT_MAX = (1 << 6),
|
2019-04-17 06:17:24 +02:00
|
|
|
/* These are options that are not counted in VAR_MAT_MAX
|
|
|
|
|
* because they are not cumulative with the others above. */
|
2019-05-04 01:42:50 +02:00
|
|
|
VAR_MAT_CLIP = (1 << 9),
|
|
|
|
|
VAR_MAT_HASH = (1 << 10),
|
|
|
|
|
VAR_MAT_MULT = (1 << 11),
|
|
|
|
|
VAR_MAT_SHADOW = (1 << 12),
|
|
|
|
|
VAR_MAT_REFRACT = (1 << 13),
|
2017-06-22 02:41:17 +02:00
|
|
|
};
|
|
|
|
|
|
2018-07-10 15:02:25 +02:00
|
|
|
/* ************ PROBE UBO ************* */
|
|
|
|
|
|
|
|
|
|
/* They are the same struct as their Cache siblings.
|
|
|
|
|
* typedef'ing just to keep the naming consistent with
|
|
|
|
|
* other eevee types. */
|
|
|
|
|
typedef LightProbeCache EEVEE_LightProbe;
|
|
|
|
|
typedef LightGridCache EEVEE_LightGrid;
|
|
|
|
|
|
|
|
|
|
typedef struct EEVEE_PlanarReflection {
|
2019-04-17 06:17:24 +02:00
|
|
|
float plane_equation[4];
|
|
|
|
|
float clip_vec_x[3], attenuation_scale;
|
|
|
|
|
float clip_vec_y[3], attenuation_bias;
|
|
|
|
|
float clip_edge_x_pos, clip_edge_x_neg;
|
|
|
|
|
float clip_edge_y_pos, clip_edge_y_neg;
|
|
|
|
|
float facing_scale, facing_bias, clipsta, pad;
|
|
|
|
|
float reflectionmat[4][4]; /* Used for sampling the texture. */
|
|
|
|
|
float mtx[4][4]; /* Not used in shader. TODO move elsewhere. */
|
2018-07-10 15:02:25 +02:00
|
|
|
} EEVEE_PlanarReflection;
|
|
|
|
|
|
|
|
|
|
/* --------------------------------------- */
|
|
|
|
|
|
2018-01-11 14:08:21 +01:00
|
|
|
typedef struct EEVEE_BoundBox {
|
2019-04-17 06:17:24 +02:00
|
|
|
float center[3], halfdim[3];
|
2018-01-11 14:08:21 +01:00
|
|
|
} EEVEE_BoundBox;
|
|
|
|
|
|
2017-03-17 00:00:46 +01:00
|
|
|
typedef struct EEVEE_PassList {
|
2019-04-17 06:17:24 +02:00
|
|
|
/* Shadows */
|
|
|
|
|
struct DRWPass *shadow_pass;
|
|
|
|
|
|
|
|
|
|
/* Probes */
|
|
|
|
|
struct DRWPass *probe_background;
|
|
|
|
|
struct DRWPass *probe_glossy_compute;
|
|
|
|
|
struct DRWPass *probe_diffuse_compute;
|
|
|
|
|
struct DRWPass *probe_visibility_compute;
|
|
|
|
|
struct DRWPass *probe_grid_fill;
|
|
|
|
|
struct DRWPass *probe_display;
|
|
|
|
|
struct DRWPass *probe_planar_downsample_ps;
|
|
|
|
|
|
|
|
|
|
/* Effects */
|
|
|
|
|
struct DRWPass *ao_horizon_search;
|
|
|
|
|
struct DRWPass *ao_horizon_search_layer;
|
|
|
|
|
struct DRWPass *ao_horizon_debug;
|
|
|
|
|
struct DRWPass *ao_accum_ps;
|
|
|
|
|
struct DRWPass *mist_accum_ps;
|
|
|
|
|
struct DRWPass *motion_blur;
|
|
|
|
|
struct DRWPass *bloom_blit;
|
|
|
|
|
struct DRWPass *bloom_downsample_first;
|
|
|
|
|
struct DRWPass *bloom_downsample;
|
|
|
|
|
struct DRWPass *bloom_upsample;
|
|
|
|
|
struct DRWPass *bloom_resolve;
|
|
|
|
|
struct DRWPass *dof_down;
|
|
|
|
|
struct DRWPass *dof_scatter;
|
|
|
|
|
struct DRWPass *dof_resolve;
|
|
|
|
|
struct DRWPass *volumetric_world_ps;
|
|
|
|
|
struct DRWPass *volumetric_objects_ps;
|
|
|
|
|
struct DRWPass *volumetric_scatter_ps;
|
|
|
|
|
struct DRWPass *volumetric_integration_ps;
|
|
|
|
|
struct DRWPass *volumetric_resolve_ps;
|
|
|
|
|
struct DRWPass *ssr_raytrace;
|
|
|
|
|
struct DRWPass *ssr_resolve;
|
|
|
|
|
struct DRWPass *sss_blur_ps;
|
|
|
|
|
struct DRWPass *sss_resolve_ps;
|
|
|
|
|
struct DRWPass *sss_accum_ps;
|
2019-08-22 16:04:25 +02:00
|
|
|
struct DRWPass *sss_translucency_ps;
|
2019-04-17 06:17:24 +02:00
|
|
|
struct DRWPass *color_downsample_ps;
|
|
|
|
|
struct DRWPass *color_downsample_cube_ps;
|
|
|
|
|
struct DRWPass *velocity_resolve;
|
|
|
|
|
struct DRWPass *taa_resolve;
|
2019-05-01 11:01:01 +02:00
|
|
|
struct DRWPass *alpha_checker;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
|
|
|
|
/* HiZ */
|
|
|
|
|
struct DRWPass *minz_downlevel_ps;
|
|
|
|
|
struct DRWPass *maxz_downlevel_ps;
|
|
|
|
|
struct DRWPass *minz_downdepth_ps;
|
|
|
|
|
struct DRWPass *maxz_downdepth_ps;
|
|
|
|
|
struct DRWPass *minz_downdepth_layer_ps;
|
|
|
|
|
struct DRWPass *maxz_downdepth_layer_ps;
|
|
|
|
|
struct DRWPass *minz_copydepth_ps;
|
|
|
|
|
struct DRWPass *maxz_copydepth_ps;
|
|
|
|
|
struct DRWPass *maxz_copydepth_layer_ps;
|
|
|
|
|
|
|
|
|
|
struct DRWPass *depth_pass;
|
|
|
|
|
struct DRWPass *depth_pass_cull;
|
|
|
|
|
struct DRWPass *depth_pass_clip;
|
|
|
|
|
struct DRWPass *depth_pass_clip_cull;
|
|
|
|
|
struct DRWPass *refract_depth_pass;
|
|
|
|
|
struct DRWPass *refract_depth_pass_cull;
|
|
|
|
|
struct DRWPass *refract_depth_pass_clip;
|
|
|
|
|
struct DRWPass *refract_depth_pass_clip_cull;
|
|
|
|
|
struct DRWPass *default_pass[VAR_MAT_MAX];
|
|
|
|
|
struct DRWPass *sss_pass;
|
|
|
|
|
struct DRWPass *sss_pass_cull;
|
|
|
|
|
struct DRWPass *material_pass;
|
|
|
|
|
struct DRWPass *material_pass_cull;
|
|
|
|
|
struct DRWPass *refract_pass;
|
|
|
|
|
struct DRWPass *transparent_pass;
|
|
|
|
|
struct DRWPass *background_pass;
|
|
|
|
|
struct DRWPass *update_noise_pass;
|
2019-04-30 22:23:54 +02:00
|
|
|
struct DRWPass *lookdev_glossy_pass;
|
|
|
|
|
struct DRWPass *lookdev_diffuse_pass;
|
2017-03-17 00:00:46 +01:00
|
|
|
} EEVEE_PassList;
|
|
|
|
|
|
|
|
|
|
typedef struct EEVEE_FramebufferList {
|
2019-04-17 06:17:24 +02:00
|
|
|
/* Effects */
|
|
|
|
|
struct GPUFrameBuffer *gtao_fb;
|
|
|
|
|
struct GPUFrameBuffer *gtao_debug_fb;
|
|
|
|
|
struct GPUFrameBuffer *downsample_fb;
|
|
|
|
|
struct GPUFrameBuffer *bloom_blit_fb;
|
|
|
|
|
struct GPUFrameBuffer *bloom_down_fb[MAX_BLOOM_STEP];
|
|
|
|
|
struct GPUFrameBuffer *bloom_accum_fb[MAX_BLOOM_STEP - 1];
|
|
|
|
|
struct GPUFrameBuffer *sss_blur_fb;
|
|
|
|
|
struct GPUFrameBuffer *sss_blit_fb;
|
|
|
|
|
struct GPUFrameBuffer *sss_resolve_fb;
|
|
|
|
|
struct GPUFrameBuffer *sss_clear_fb;
|
2019-08-22 16:04:25 +02:00
|
|
|
struct GPUFrameBuffer *sss_translucency_fb;
|
2019-04-17 06:17:24 +02:00
|
|
|
struct GPUFrameBuffer *sss_accum_fb;
|
|
|
|
|
struct GPUFrameBuffer *dof_down_fb;
|
|
|
|
|
struct GPUFrameBuffer *dof_scatter_fb;
|
|
|
|
|
struct GPUFrameBuffer *volumetric_fb;
|
|
|
|
|
struct GPUFrameBuffer *volumetric_scat_fb;
|
|
|
|
|
struct GPUFrameBuffer *volumetric_integ_fb;
|
|
|
|
|
struct GPUFrameBuffer *screen_tracing_fb;
|
|
|
|
|
struct GPUFrameBuffer *refract_fb;
|
|
|
|
|
struct GPUFrameBuffer *mist_accum_fb;
|
|
|
|
|
struct GPUFrameBuffer *ao_accum_fb;
|
|
|
|
|
struct GPUFrameBuffer *velocity_resolve_fb;
|
|
|
|
|
|
|
|
|
|
struct GPUFrameBuffer *update_noise_fb;
|
|
|
|
|
|
|
|
|
|
struct GPUFrameBuffer *planarref_fb;
|
|
|
|
|
struct GPUFrameBuffer *planar_downsample_fb;
|
|
|
|
|
|
|
|
|
|
struct GPUFrameBuffer *main_fb;
|
|
|
|
|
struct GPUFrameBuffer *main_color_fb;
|
|
|
|
|
struct GPUFrameBuffer *effect_fb;
|
|
|
|
|
struct GPUFrameBuffer *effect_color_fb;
|
|
|
|
|
struct GPUFrameBuffer *double_buffer_fb;
|
|
|
|
|
struct GPUFrameBuffer *double_buffer_color_fb;
|
|
|
|
|
struct GPUFrameBuffer *double_buffer_depth_fb;
|
|
|
|
|
struct GPUFrameBuffer *taa_history_fb;
|
|
|
|
|
struct GPUFrameBuffer *taa_history_color_fb;
|
2017-03-17 00:00:46 +01:00
|
|
|
} EEVEE_FramebufferList;
|
|
|
|
|
|
|
|
|
|
typedef struct EEVEE_TextureList {
|
2019-04-17 06:17:24 +02:00
|
|
|
/* Effects */
|
|
|
|
|
struct GPUTexture *color_post; /* R16_G16_B16 */
|
|
|
|
|
struct GPUTexture *mist_accum;
|
|
|
|
|
struct GPUTexture *ao_accum;
|
|
|
|
|
struct GPUTexture *sss_dir_accum;
|
|
|
|
|
struct GPUTexture *sss_col_accum;
|
|
|
|
|
struct GPUTexture *refract_color;
|
|
|
|
|
struct GPUTexture *taa_history;
|
|
|
|
|
|
|
|
|
|
struct GPUTexture *volume_prop_scattering;
|
|
|
|
|
struct GPUTexture *volume_prop_extinction;
|
|
|
|
|
struct GPUTexture *volume_prop_emission;
|
|
|
|
|
struct GPUTexture *volume_prop_phase;
|
|
|
|
|
struct GPUTexture *volume_scatter;
|
2019-05-16 21:41:22 +02:00
|
|
|
struct GPUTexture *volume_transmit;
|
2019-04-17 06:17:24 +02:00
|
|
|
struct GPUTexture *volume_scatter_history;
|
2019-05-16 21:41:22 +02:00
|
|
|
struct GPUTexture *volume_transmit_history;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
|
|
|
|
struct GPUTexture *lookdev_grid_tx;
|
|
|
|
|
struct GPUTexture *lookdev_cube_tx;
|
|
|
|
|
|
|
|
|
|
struct GPUTexture *planar_pool;
|
|
|
|
|
struct GPUTexture *planar_depth;
|
|
|
|
|
|
|
|
|
|
struct GPUTexture *maxzbuffer;
|
|
|
|
|
|
|
|
|
|
struct GPUTexture *color; /* R16_G16_B16 */
|
|
|
|
|
struct GPUTexture *color_double_buffer;
|
|
|
|
|
struct GPUTexture *depth_double_buffer;
|
2017-03-17 00:00:46 +01:00
|
|
|
} EEVEE_TextureList;
|
|
|
|
|
|
|
|
|
|
typedef struct EEVEE_StorageList {
|
2019-04-17 06:17:24 +02:00
|
|
|
/* Effects */
|
|
|
|
|
struct EEVEE_EffectsInfo *effects;
|
2017-05-04 17:36:40 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
struct EEVEE_PrivateData *g_data;
|
2018-05-28 17:18:27 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
struct LightCache *lookdev_lightcache;
|
|
|
|
|
EEVEE_LightProbe *lookdev_cube_data;
|
|
|
|
|
EEVEE_LightGrid *lookdev_grid_data;
|
|
|
|
|
LightCacheTexture *lookdev_cube_mips;
|
2017-03-17 00:00:46 +01:00
|
|
|
} EEVEE_StorageList;
|
|
|
|
|
|
2017-04-10 12:06:17 +02:00
|
|
|
/* ************ LIGHT UBO ************* */
|
|
|
|
|
typedef struct EEVEE_Light {
|
2019-04-17 06:17:24 +02:00
|
|
|
float position[3], invsqrdist;
|
|
|
|
|
float color[3], spec;
|
2019-08-22 16:04:25 +02:00
|
|
|
float spotsize, spotblend, radius, shadow_id;
|
2019-04-17 06:17:24 +02:00
|
|
|
float rightvec[3], sizex;
|
|
|
|
|
float upvec[3], sizey;
|
|
|
|
|
float forwardvec[3], light_type;
|
2017-04-10 12:06:17 +02:00
|
|
|
} EEVEE_Light;
|
|
|
|
|
|
2019-02-27 12:02:02 +11:00
|
|
|
/* Special type for elliptic area lights, matches lamps_lib.glsl */
|
Cycles/Eevee: Implement disk and ellipse shapes for area lamps
The implementation is pretty straightforward.
In Cycles, sampling the shapes is currently done w.r.t. area instead of solid angle.
There is a paper on solid angle sampling for disks [1], but the described algorithm is based on
simply sampling the enclosing square and rejecting samples outside of the disk, which is not exactly
great for Cycles' RNG (we'd need to setup a LCG for the repeated sampling) and for GPU divergence.
Even worse, the algorithm is only defined for disks. For ellipses, the basic idea still works, but a
way to analytically calculate the solid angle is required. This is technically possible [2], but the
calculation is extremely complex and still requires a lookup table for the Heuman Lambda function.
Therefore, I've decided to not implement that for now, we could still look into it later on.
In Eevee, the code uses the existing ltc_evaluate_disk to implement the lighting calculations.
[1]: "Solid Angle Sampling of Disk and Cylinder Lights"
[2]: "Analytical solution for the solid angle subtended at any point by an ellipse via a point source radiation vector potential"
Reviewers: sergey, brecht, fclem
Differential Revision: https://developer.blender.org/D3171
2018-05-24 03:50:16 +02:00
|
|
|
#define LAMPTYPE_AREA_ELLIPSE 100.0f
|
|
|
|
|
|
2017-09-05 21:02:17 +02:00
|
|
|
typedef struct EEVEE_Shadow {
|
2019-08-22 16:04:25 +02:00
|
|
|
float near, far, bias, type_data_id;
|
2019-04-17 06:17:24 +02:00
|
|
|
float contact_dist, contact_bias, contact_spread, contact_thickness;
|
2017-09-05 21:02:17 +02:00
|
|
|
} EEVEE_Shadow;
|
|
|
|
|
|
|
|
|
|
typedef struct EEVEE_ShadowCube {
|
2019-08-22 16:04:25 +02:00
|
|
|
float shadowmat[4][4];
|
|
|
|
|
float position[3], _pad0[1];
|
2017-04-10 12:06:17 +02:00
|
|
|
} EEVEE_ShadowCube;
|
|
|
|
|
|
|
|
|
|
typedef struct EEVEE_ShadowCascade {
|
2019-04-17 06:17:24 +02:00
|
|
|
/* World->Light->NDC->Tex : used for sampling the shadow map. */
|
|
|
|
|
float shadowmat[MAX_CASCADE_NUM][4][4];
|
|
|
|
|
float split_start[4];
|
|
|
|
|
float split_end[4];
|
2019-08-22 16:04:25 +02:00
|
|
|
float shadow_vec[3], tex_id;
|
2017-04-10 12:06:17 +02:00
|
|
|
} EEVEE_ShadowCascade;
|
|
|
|
|
|
2019-08-22 16:04:25 +02:00
|
|
|
typedef struct EEVEE_ShadowCascadeRender {
|
|
|
|
|
/* World->Light->NDC : used for rendering the shadow map. */
|
|
|
|
|
float projmat[MAX_CASCADE_NUM][4][4];
|
|
|
|
|
float viewmat[4][4], viewinv[4][4];
|
|
|
|
|
float radius[MAX_CASCADE_NUM];
|
|
|
|
|
float cascade_max_dist;
|
|
|
|
|
float cascade_exponent;
|
|
|
|
|
float cascade_fade;
|
|
|
|
|
int cascade_count;
|
|
|
|
|
} EEVEE_ShadowCascadeRender;
|
2017-04-10 12:06:17 +02:00
|
|
|
|
2019-05-29 16:57:09 +02:00
|
|
|
BLI_STATIC_ASSERT_ALIGN(EEVEE_Light, 16)
|
|
|
|
|
BLI_STATIC_ASSERT_ALIGN(EEVEE_Shadow, 16)
|
|
|
|
|
BLI_STATIC_ASSERT_ALIGN(EEVEE_ShadowCube, 16)
|
|
|
|
|
BLI_STATIC_ASSERT_ALIGN(EEVEE_ShadowCascade, 16)
|
2018-01-11 14:08:21 +01:00
|
|
|
|
2019-08-22 16:04:25 +02:00
|
|
|
BLI_STATIC_ASSERT(sizeof(EEVEE_Shadow) * MAX_SHADOW +
|
|
|
|
|
sizeof(EEVEE_ShadowCascade) * MAX_SHADOW_CASCADE +
|
|
|
|
|
sizeof(EEVEE_ShadowCube) * MAX_SHADOW_CUBE <
|
|
|
|
|
16384,
|
|
|
|
|
"Shadow UBO is too big!!!")
|
2018-01-11 14:08:21 +01:00
|
|
|
|
|
|
|
|
typedef struct EEVEE_ShadowCasterBuffer {
|
2019-08-22 16:04:25 +02:00
|
|
|
struct EEVEE_BoundBox *bbox;
|
|
|
|
|
BLI_bitmap *update;
|
2019-04-17 06:17:24 +02:00
|
|
|
uint alloc_count;
|
|
|
|
|
uint count;
|
2018-01-11 14:08:21 +01:00
|
|
|
} EEVEE_ShadowCasterBuffer;
|
|
|
|
|
|
2017-04-19 22:07:53 +02:00
|
|
|
/* ************ LIGHT DATA ************* */
|
2019-02-27 12:02:02 +11:00
|
|
|
typedef struct EEVEE_LightsInfo {
|
2019-04-17 06:17:24 +02:00
|
|
|
int num_light, cache_num_light;
|
|
|
|
|
int num_cube_layer, cache_num_cube_layer;
|
|
|
|
|
int num_cascade_layer, cache_num_cascade_layer;
|
2019-08-22 16:04:25 +02:00
|
|
|
int cube_len, cascade_len, shadow_len;
|
|
|
|
|
int shadow_cube_size, shadow_cascade_size;
|
2019-04-17 06:17:24 +02:00
|
|
|
bool shadow_high_bitdepth, soft_shadows;
|
|
|
|
|
/* UBO Storage : data used by UBO */
|
|
|
|
|
struct EEVEE_Light light_data[MAX_LIGHT];
|
|
|
|
|
struct EEVEE_Shadow shadow_data[MAX_SHADOW];
|
|
|
|
|
struct EEVEE_ShadowCube shadow_cube_data[MAX_SHADOW_CUBE];
|
|
|
|
|
struct EEVEE_ShadowCascade shadow_cascade_data[MAX_SHADOW_CASCADE];
|
2019-08-22 16:04:25 +02:00
|
|
|
/* Additionnal rendering info for cascade. */
|
|
|
|
|
struct EEVEE_ShadowCascadeRender shadow_cascade_render[MAX_SHADOW_CASCADE];
|
|
|
|
|
/* Back index in light_data. */
|
|
|
|
|
uchar shadow_cube_light_indices[MAX_SHADOW_CUBE];
|
|
|
|
|
uchar shadow_cascade_light_indices[MAX_SHADOW_CASCADE];
|
|
|
|
|
/* Update bitmap. */
|
|
|
|
|
BLI_bitmap sh_cube_update[BLI_BITMAP_SIZE(MAX_SHADOW_CUBE)];
|
2019-04-17 06:17:24 +02:00
|
|
|
/* Lights tracking */
|
2019-08-22 16:04:25 +02:00
|
|
|
struct BoundSphere shadow_bounds[MAX_LIGHT]; /* Tightly packed light bounds */
|
|
|
|
|
/* List of bbox and update bitmap. Double buffered. */
|
|
|
|
|
struct EEVEE_ShadowCasterBuffer *shcaster_frontbuffer, *shcaster_backbuffer;
|
|
|
|
|
/* AABB of all shadow casters combined. */
|
|
|
|
|
struct {
|
|
|
|
|
float min[3], max[3];
|
|
|
|
|
} shcaster_aabb;
|
2019-02-27 12:02:02 +11:00
|
|
|
} EEVEE_LightsInfo;
|
2017-04-18 12:50:09 +02:00
|
|
|
|
|
|
|
|
/* ************ PROBE DATA ************* */
|
2018-04-28 09:01:34 +02:00
|
|
|
typedef struct EEVEE_LightProbeVisTest {
|
2019-04-17 06:17:24 +02:00
|
|
|
struct Collection *collection; /* Skip test if NULL */
|
|
|
|
|
bool invert;
|
|
|
|
|
bool cached; /* Reuse last test results */
|
2018-04-24 12:45:59 +02:00
|
|
|
} EEVEE_LightProbeVisTest;
|
|
|
|
|
|
2017-06-12 20:59:54 +10:00
|
|
|
typedef struct EEVEE_LightProbesInfo {
|
2019-04-17 06:17:24 +02:00
|
|
|
int num_cube, cache_num_cube;
|
|
|
|
|
int num_grid, cache_num_grid;
|
|
|
|
|
int num_planar, cache_num_planar;
|
|
|
|
|
int total_irradiance_samples; /* Total for all grids */
|
|
|
|
|
int cache_irradiance_size[3];
|
|
|
|
|
int update_flag;
|
|
|
|
|
int updated_bounce;
|
|
|
|
|
int num_bounce;
|
|
|
|
|
int cubemap_res;
|
|
|
|
|
/* Update */
|
|
|
|
|
bool do_cube_update;
|
|
|
|
|
bool do_grid_update;
|
|
|
|
|
/* For rendering probes */
|
|
|
|
|
float probemat[6][4][4];
|
|
|
|
|
int layer;
|
|
|
|
|
float texel_size;
|
|
|
|
|
float padding_size;
|
|
|
|
|
float samples_len;
|
|
|
|
|
float samples_len_inv;
|
|
|
|
|
float near_clip;
|
|
|
|
|
float far_clip;
|
|
|
|
|
float roughness;
|
|
|
|
|
float firefly_fac;
|
|
|
|
|
float lodfactor;
|
|
|
|
|
float lod_rt_max, lod_cube_max, lod_planar_max;
|
|
|
|
|
float visibility_range;
|
|
|
|
|
float visibility_blur;
|
|
|
|
|
float intensity_fac;
|
|
|
|
|
int shres;
|
|
|
|
|
EEVEE_LightProbeVisTest planar_vis_tests[MAX_PLANAR];
|
|
|
|
|
/* UBO Storage : data used by UBO */
|
|
|
|
|
EEVEE_LightProbe probe_data[MAX_PROBE];
|
|
|
|
|
EEVEE_LightGrid grid_data[MAX_GRID];
|
|
|
|
|
EEVEE_PlanarReflection planar_data[MAX_PLANAR];
|
|
|
|
|
/* Probe Visibility Collection */
|
|
|
|
|
EEVEE_LightProbeVisTest vis_data;
|
2017-06-12 20:59:54 +10:00
|
|
|
} EEVEE_LightProbesInfo;
|
2017-04-18 12:50:09 +02:00
|
|
|
|
2017-06-12 20:59:54 +10:00
|
|
|
/* EEVEE_LightProbesInfo->update_flag */
|
2017-06-04 12:12:58 +02:00
|
|
|
enum {
|
2019-04-17 06:17:24 +02:00
|
|
|
PROBE_UPDATE_CUBE = (1 << 0),
|
|
|
|
|
PROBE_UPDATE_GRID = (1 << 1),
|
|
|
|
|
PROBE_UPDATE_ALL = 0xFFFFFF,
|
2017-06-04 12:12:58 +02:00
|
|
|
};
|
|
|
|
|
|
2017-05-04 17:36:40 +02:00
|
|
|
/* ************ EFFECTS DATA ************* */
|
2018-03-26 10:02:53 +02:00
|
|
|
|
|
|
|
|
typedef enum EEVEE_EffectsFlag {
|
2019-04-17 06:17:24 +02:00
|
|
|
EFFECT_MOTION_BLUR = (1 << 0),
|
|
|
|
|
EFFECT_BLOOM = (1 << 1),
|
|
|
|
|
EFFECT_DOF = (1 << 2),
|
|
|
|
|
EFFECT_VOLUMETRIC = (1 << 3),
|
|
|
|
|
EFFECT_SSR = (1 << 4),
|
|
|
|
|
EFFECT_DOUBLE_BUFFER = (1 << 5), /* Not really an effect but a feature */
|
|
|
|
|
EFFECT_REFRACT = (1 << 6),
|
|
|
|
|
EFFECT_GTAO = (1 << 7),
|
|
|
|
|
EFFECT_TAA = (1 << 8),
|
|
|
|
|
EFFECT_POST_BUFFER = (1 << 9), /* Not really an effect but a feature */
|
|
|
|
|
EFFECT_NORMAL_BUFFER = (1 << 10), /* Not really an effect but a feature */
|
|
|
|
|
EFFECT_SSS = (1 << 11),
|
|
|
|
|
EFFECT_VELOCITY_BUFFER = (1 << 12), /* Not really an effect but a feature */
|
|
|
|
|
EFFECT_TAA_REPROJECT = (1 << 13), /* should be mutually exclusive with EFFECT_TAA */
|
|
|
|
|
EFFECT_DEPTH_DOUBLE_BUFFER = (1 << 14), /* Not really an effect but a feature */
|
2019-05-01 11:01:01 +02:00
|
|
|
EFFECT_ALPHA_CHECKER = (1 << 15), /* Not really an effect but a feature */
|
2018-03-26 10:02:53 +02:00
|
|
|
} EEVEE_EffectsFlag;
|
|
|
|
|
|
2017-05-04 17:36:40 +02:00
|
|
|
typedef struct EEVEE_EffectsInfo {
|
2019-04-17 06:17:24 +02:00
|
|
|
EEVEE_EffectsFlag enabled_effects;
|
|
|
|
|
bool swap_double_buffer;
|
|
|
|
|
/* SSSS */
|
|
|
|
|
int sss_sample_count;
|
2019-08-22 16:04:25 +02:00
|
|
|
struct GPUTexture *sss_irradiance; /* Textures from pool */
|
|
|
|
|
struct GPUTexture *sss_radius;
|
2019-04-17 06:17:24 +02:00
|
|
|
struct GPUTexture *sss_albedo;
|
|
|
|
|
struct GPUTexture *sss_blur;
|
|
|
|
|
struct GPUTexture *sss_stencil;
|
|
|
|
|
/* Volumetrics */
|
|
|
|
|
int volume_current_sample;
|
2019-05-16 21:41:22 +02:00
|
|
|
struct GPUTexture *volume_scatter;
|
|
|
|
|
struct GPUTexture *volume_transmit;
|
2019-04-17 06:17:24 +02:00
|
|
|
/* SSR */
|
|
|
|
|
bool reflection_trace_full;
|
|
|
|
|
bool ssr_was_persp;
|
2019-07-09 14:34:38 +02:00
|
|
|
bool ssr_was_valid_double_buffer;
|
2019-04-17 06:17:24 +02:00
|
|
|
int ssr_neighbor_ofs;
|
|
|
|
|
int ssr_halfres_ofs[2];
|
|
|
|
|
struct GPUTexture *ssr_normal_input; /* Textures from pool */
|
|
|
|
|
struct GPUTexture *ssr_specrough_input;
|
|
|
|
|
struct GPUTexture *ssr_hit_output;
|
|
|
|
|
struct GPUTexture *ssr_pdf_output;
|
|
|
|
|
/* Temporal Anti Aliasing */
|
|
|
|
|
int taa_reproject_sample;
|
|
|
|
|
int taa_current_sample;
|
|
|
|
|
int taa_render_sample;
|
|
|
|
|
int taa_total_sample;
|
|
|
|
|
float taa_alpha;
|
|
|
|
|
bool prev_drw_support;
|
|
|
|
|
float prev_drw_persmat[4][4];
|
2019-05-21 12:34:48 +02:00
|
|
|
struct DRWView *taa_view;
|
2019-04-17 06:17:24 +02:00
|
|
|
/* Ambient Occlusion */
|
|
|
|
|
int ao_depth_layer;
|
|
|
|
|
struct GPUTexture *ao_src_depth; /* pointer copy */
|
|
|
|
|
struct GPUTexture *gtao_horizons; /* Textures from pool */
|
|
|
|
|
struct GPUTexture *gtao_horizons_debug;
|
|
|
|
|
/* Motion Blur */
|
|
|
|
|
float current_world_to_ndc[4][4];
|
|
|
|
|
float current_ndc_to_world[4][4];
|
|
|
|
|
float past_world_to_ndc[4][4];
|
|
|
|
|
int motion_blur_samples;
|
|
|
|
|
bool motion_blur_mat_cached;
|
|
|
|
|
/* Velocity Pass */
|
|
|
|
|
float velocity_curr_persinv[4][4];
|
|
|
|
|
float velocity_past_persmat[4][4];
|
|
|
|
|
struct GPUTexture *velocity_tx; /* Texture from pool */
|
|
|
|
|
/* Depth Of Field */
|
|
|
|
|
float dof_near_far[2];
|
|
|
|
|
float dof_params[2];
|
|
|
|
|
float dof_bokeh[4];
|
|
|
|
|
float dof_bokeh_sides[4];
|
|
|
|
|
int dof_target_size[2];
|
|
|
|
|
struct GPUTexture *dof_down_near; /* Textures from pool */
|
|
|
|
|
struct GPUTexture *dof_down_far;
|
|
|
|
|
struct GPUTexture *dof_coc;
|
|
|
|
|
struct GPUTexture *dof_blur;
|
|
|
|
|
struct GPUTexture *dof_blur_alpha;
|
2019-05-01 11:01:01 +02:00
|
|
|
/* Alpha Checker */
|
|
|
|
|
float color_checker_dark[4];
|
|
|
|
|
float color_checker_light[4];
|
2019-05-21 12:34:48 +02:00
|
|
|
struct DRWView *checker_view;
|
2019-04-17 06:17:24 +02:00
|
|
|
/* Other */
|
|
|
|
|
float prev_persmat[4][4];
|
2019-04-30 22:23:54 +02:00
|
|
|
/* Lookdev */
|
2019-05-09 21:35:52 +10:00
|
|
|
int sphere_size;
|
2019-04-30 22:23:54 +02:00
|
|
|
int anchor[2];
|
2019-05-21 12:34:48 +02:00
|
|
|
struct DRWView *lookdev_view;
|
2019-04-17 06:17:24 +02:00
|
|
|
/* Bloom */
|
|
|
|
|
int bloom_iteration_len;
|
|
|
|
|
float source_texel_size[2];
|
|
|
|
|
float blit_texel_size[2];
|
|
|
|
|
float downsamp_texel_size[MAX_BLOOM_STEP][2];
|
|
|
|
|
float bloom_color[3];
|
|
|
|
|
float bloom_clamp;
|
|
|
|
|
float bloom_sample_scale;
|
|
|
|
|
float bloom_curve_threshold[4];
|
|
|
|
|
float unf_source_texel_size[2];
|
|
|
|
|
struct GPUTexture *bloom_blit; /* Textures from pool */
|
|
|
|
|
struct GPUTexture *bloom_downsample[MAX_BLOOM_STEP];
|
|
|
|
|
struct GPUTexture *bloom_upsample[MAX_BLOOM_STEP - 1];
|
|
|
|
|
struct GPUTexture *unf_source_buffer; /* pointer copy */
|
|
|
|
|
struct GPUTexture *unf_base_buffer; /* pointer copy */
|
|
|
|
|
/* Not alloced, just a copy of a *GPUtexture in EEVEE_TextureList. */
|
|
|
|
|
struct GPUTexture *source_buffer; /* latest updated texture */
|
|
|
|
|
struct GPUFrameBuffer *target_buffer; /* next target to render to */
|
|
|
|
|
struct GPUTexture *final_tx; /* Final color to transform to display color space. */
|
2019-08-01 13:53:25 +10:00
|
|
|
struct GPUFrameBuffer *final_fb; /* Framebuffer with final_tx as attachment. */
|
2017-05-04 17:36:40 +02:00
|
|
|
} EEVEE_EffectsInfo;
|
|
|
|
|
|
2018-01-21 17:25:10 +01:00
|
|
|
/* ***************** COMMON DATA **************** */
|
|
|
|
|
|
|
|
|
|
/* Common uniform buffer containing all "constant" data over the whole drawing pipeline. */
|
|
|
|
|
/* !! CAUTION !!
|
2018-07-03 09:08:00 +02:00
|
|
|
* - [i]vec3 need to be padded to [i]vec4 (even in ubo declaration).
|
2018-01-21 17:25:10 +01:00
|
|
|
* - Make sure that [i]vec4 start at a multiple of 16 bytes.
|
|
|
|
|
* - Arrays of vec2/vec3 are padded as arrays of vec4.
|
|
|
|
|
* - sizeof(bool) == sizeof(int) in GLSL so use int in C */
|
|
|
|
|
typedef struct EEVEE_CommonUniformBuffer {
|
2019-04-17 06:17:24 +02:00
|
|
|
float prev_persmat[4][4]; /* mat4 */
|
|
|
|
|
float view_vecs[2][4]; /* vec4[2] */
|
|
|
|
|
float mip_ratio[10][4]; /* vec2[10] */
|
|
|
|
|
/* Ambient Occlusion */
|
|
|
|
|
/* -- 16 byte aligned -- */
|
|
|
|
|
float ao_dist, pad1, ao_factor, pad2; /* vec4 */
|
|
|
|
|
float ao_offset, ao_bounce_fac, ao_quality, ao_settings; /* vec4 */
|
|
|
|
|
/* Volumetric */
|
|
|
|
|
/* -- 16 byte aligned -- */
|
2019-07-01 14:43:44 +02:00
|
|
|
int vol_tex_size[3], pad3; /* ivec3 */
|
|
|
|
|
float vol_depth_param[3], pad4; /* vec3 */
|
|
|
|
|
float vol_inv_tex_size[3], pad5; /* vec3 */
|
|
|
|
|
float vol_jitter[3], pad6; /* vec3 */
|
|
|
|
|
float vol_coord_scale[4]; /* vec4 */
|
2019-04-17 06:17:24 +02:00
|
|
|
/* -- 16 byte aligned -- */
|
|
|
|
|
float vol_history_alpha; /* float */
|
|
|
|
|
float vol_light_clamp; /* float */
|
|
|
|
|
float vol_shadow_steps; /* float */
|
|
|
|
|
int vol_use_lights; /* bool */
|
|
|
|
|
/* Screen Space Reflections */
|
|
|
|
|
/* -- 16 byte aligned -- */
|
|
|
|
|
float ssr_quality, ssr_thickness, ssr_pixelsize[2]; /* vec4 */
|
|
|
|
|
float ssr_border_fac; /* float */
|
|
|
|
|
float ssr_max_roughness; /* float */
|
|
|
|
|
float ssr_firefly_fac; /* float */
|
|
|
|
|
float ssr_brdf_bias; /* float */
|
|
|
|
|
int ssr_toggle; /* bool */
|
2019-07-09 14:32:02 +02:00
|
|
|
int ssrefract_toggle; /* bool */
|
2019-04-17 06:17:24 +02:00
|
|
|
/* SubSurface Scattering */
|
|
|
|
|
float sss_jitter_threshold; /* float */
|
|
|
|
|
int sss_toggle; /* bool */
|
|
|
|
|
/* Specular */
|
|
|
|
|
int spec_toggle; /* bool */
|
|
|
|
|
/* Lights */
|
|
|
|
|
int la_num_light; /* int */
|
|
|
|
|
/* Probes */
|
|
|
|
|
int prb_num_planar; /* int */
|
|
|
|
|
int prb_num_render_cube; /* int */
|
|
|
|
|
int prb_num_render_grid; /* int */
|
|
|
|
|
int prb_irradiance_vis_size; /* int */
|
|
|
|
|
float prb_irradiance_smooth; /* float */
|
|
|
|
|
float prb_lod_cube_max; /* float */
|
|
|
|
|
float prb_lod_planar_max; /* float */
|
|
|
|
|
/* Misc */
|
|
|
|
|
int hiz_mip_offset; /* int */
|
|
|
|
|
int ray_type; /* int */
|
|
|
|
|
float ray_depth; /* float */
|
2018-01-21 17:25:10 +01:00
|
|
|
} EEVEE_CommonUniformBuffer;
|
|
|
|
|
|
2019-05-29 16:57:09 +02:00
|
|
|
BLI_STATIC_ASSERT_ALIGN(EEVEE_CommonUniformBuffer, 16)
|
|
|
|
|
|
2018-11-08 19:17:41 +01:00
|
|
|
/* ray_type (keep in sync with rayType) */
|
2019-04-17 06:17:24 +02:00
|
|
|
#define EEVEE_RAY_CAMERA 0
|
|
|
|
|
#define EEVEE_RAY_SHADOW 1
|
|
|
|
|
#define EEVEE_RAY_DIFFUSE 2
|
|
|
|
|
#define EEVEE_RAY_GLOSSY 3
|
2018-11-08 19:17:41 +01:00
|
|
|
|
2017-05-30 22:29:20 +02:00
|
|
|
/* ************** SCENE LAYER DATA ************** */
|
2017-11-22 10:52:39 -02:00
|
|
|
typedef struct EEVEE_ViewLayerData {
|
2019-04-17 06:17:24 +02:00
|
|
|
/* Lights */
|
|
|
|
|
struct EEVEE_LightsInfo *lights;
|
2017-05-30 22:29:20 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
struct GPUUniformBuffer *light_ubo;
|
|
|
|
|
struct GPUUniformBuffer *shadow_ubo;
|
|
|
|
|
struct GPUUniformBuffer *shadow_samples_ubo;
|
2017-05-30 22:29:20 +02:00
|
|
|
|
2019-08-22 16:04:25 +02:00
|
|
|
struct GPUFrameBuffer *shadow_fb;
|
|
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
struct GPUTexture *shadow_cube_pool;
|
|
|
|
|
struct GPUTexture *shadow_cascade_pool;
|
2017-05-30 22:29:20 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
struct EEVEE_ShadowCasterBuffer shcasters_buffers[2];
|
2017-06-01 18:20:44 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
/* Probes */
|
|
|
|
|
struct EEVEE_LightProbesInfo *probes;
|
2017-05-30 22:29:20 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
struct GPUUniformBuffer *probe_ubo;
|
|
|
|
|
struct GPUUniformBuffer *grid_ubo;
|
|
|
|
|
struct GPUUniformBuffer *planar_ubo;
|
2017-05-30 22:29:20 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
/* Common Uniform Buffer */
|
|
|
|
|
struct EEVEE_CommonUniformBuffer common_data;
|
|
|
|
|
struct GPUUniformBuffer *common_ubo;
|
2018-03-10 00:02:01 +01:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
struct LightCache *fallback_lightcache;
|
2017-11-22 10:52:39 -02:00
|
|
|
} EEVEE_ViewLayerData;
|
2017-05-30 22:29:20 +02:00
|
|
|
|
2017-06-01 18:20:44 +02:00
|
|
|
/* ************ OBJECT DATA ************ */
|
2018-07-10 15:02:25 +02:00
|
|
|
|
2019-08-01 13:53:25 +10:00
|
|
|
/* These are the structs stored inside Objects.
|
|
|
|
|
* It works even if the object is in multiple layers
|
2018-01-11 14:08:21 +01:00
|
|
|
* because we don't get the same "Object *" for each layer. */
|
2019-02-27 12:02:02 +11:00
|
|
|
typedef struct EEVEE_LightEngineData {
|
2019-04-17 06:17:24 +02:00
|
|
|
DrawData dd;
|
|
|
|
|
|
|
|
|
|
bool need_update;
|
2019-02-27 12:02:02 +11:00
|
|
|
} EEVEE_LightEngineData;
|
2017-06-01 18:20:44 +02:00
|
|
|
|
2017-06-12 20:59:54 +10:00
|
|
|
typedef struct EEVEE_LightProbeEngineData {
|
2019-04-17 06:17:24 +02:00
|
|
|
DrawData dd;
|
2018-01-29 16:28:24 +01:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
bool need_update;
|
2017-06-12 20:59:54 +10:00
|
|
|
} EEVEE_LightProbeEngineData;
|
2017-06-08 21:48:50 +02:00
|
|
|
|
2017-06-01 18:20:44 +02:00
|
|
|
typedef struct EEVEE_ObjectEngineData {
|
2019-04-17 06:17:24 +02:00
|
|
|
DrawData dd;
|
2018-01-29 16:28:24 +01:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
Object *ob; /* self reference */
|
|
|
|
|
EEVEE_LightProbeVisTest *test_data;
|
|
|
|
|
bool ob_vis, ob_vis_dirty;
|
2018-04-24 12:45:59 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
bool need_update;
|
|
|
|
|
uint shadow_caster_id;
|
2017-06-01 18:20:44 +02:00
|
|
|
} EEVEE_ObjectEngineData;
|
|
|
|
|
|
2018-07-10 14:14:55 +02:00
|
|
|
typedef struct EEVEE_WorldEngineData {
|
2019-04-17 06:17:24 +02:00
|
|
|
DrawData dd;
|
2018-07-10 14:14:55 +02:00
|
|
|
} EEVEE_WorldEngineData;
|
|
|
|
|
|
2017-04-10 12:06:17 +02:00
|
|
|
/* *********************************** */
|
2017-03-17 00:00:46 +01:00
|
|
|
|
|
|
|
|
typedef struct EEVEE_Data {
|
2019-04-17 06:17:24 +02:00
|
|
|
void *engine_type;
|
|
|
|
|
EEVEE_FramebufferList *fbl;
|
|
|
|
|
EEVEE_TextureList *txl;
|
|
|
|
|
EEVEE_PassList *psl;
|
|
|
|
|
EEVEE_StorageList *stl;
|
2017-03-17 00:00:46 +01:00
|
|
|
} EEVEE_Data;
|
|
|
|
|
|
2017-04-29 16:52:12 +10:00
|
|
|
typedef struct EEVEE_PrivateData {
|
2019-04-17 06:17:24 +02:00
|
|
|
struct DRWShadingGroup *shadow_shgrp;
|
|
|
|
|
struct DRWShadingGroup *depth_shgrp;
|
|
|
|
|
struct DRWShadingGroup *depth_shgrp_cull;
|
|
|
|
|
struct DRWShadingGroup *depth_shgrp_clip;
|
|
|
|
|
struct DRWShadingGroup *depth_shgrp_clip_cull;
|
|
|
|
|
struct DRWShadingGroup *refract_depth_shgrp;
|
|
|
|
|
struct DRWShadingGroup *refract_depth_shgrp_cull;
|
|
|
|
|
struct DRWShadingGroup *refract_depth_shgrp_clip;
|
|
|
|
|
struct DRWShadingGroup *refract_depth_shgrp_clip_cull;
|
2019-05-13 17:56:20 +02:00
|
|
|
struct DRWCallBuffer *planar_display_shgrp;
|
2019-04-17 06:17:24 +02:00
|
|
|
struct GHash *material_hash;
|
|
|
|
|
float background_alpha; /* TODO find a better place for this. */
|
|
|
|
|
/* Chosen lightcache: can come from Lookdev or the viewlayer. */
|
|
|
|
|
struct LightCache *light_cache;
|
|
|
|
|
/* For planar probes */
|
|
|
|
|
float planar_texel_size[2];
|
|
|
|
|
/* For double buffering */
|
|
|
|
|
bool view_updated;
|
|
|
|
|
bool valid_double_buffer;
|
|
|
|
|
bool valid_taa_history;
|
|
|
|
|
/* Render Matrices */
|
|
|
|
|
float studiolight_matrix[3][3];
|
|
|
|
|
float overscan, overscan_pixels;
|
|
|
|
|
float size_orig[2];
|
|
|
|
|
|
|
|
|
|
/* Mist Settings */
|
|
|
|
|
float mist_start, mist_inv_dist, mist_falloff;
|
|
|
|
|
|
|
|
|
|
/* Color Management */
|
|
|
|
|
bool use_color_render_settings;
|
|
|
|
|
|
2019-06-14 19:12:39 +02:00
|
|
|
/* Compiling shaders count. This is to track if a shader has finished compiling. */
|
|
|
|
|
int queued_shaders_count;
|
|
|
|
|
int queued_shaders_count_prev;
|
|
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
/* LookDev Settings */
|
|
|
|
|
int studiolight_index;
|
|
|
|
|
float studiolight_rot_z;
|
2019-09-04 16:22:47 +02:00
|
|
|
float studiolight_intensity;
|
2019-04-17 06:17:24 +02:00
|
|
|
int studiolight_cubemap_res;
|
|
|
|
|
float studiolight_glossy_clamp;
|
|
|
|
|
float studiolight_filter_quality;
|
2019-03-19 13:29:22 +01:00
|
|
|
|
2019-05-21 20:24:54 +02:00
|
|
|
/** For rendering shadows. */
|
2019-05-21 12:34:48 +02:00
|
|
|
struct DRWView *cube_views[6];
|
2019-05-21 20:24:54 +02:00
|
|
|
/** For rendering probes. */
|
|
|
|
|
struct DRWView *bake_views[6];
|
|
|
|
|
/** Same as bake_views but does not generate culling infos. */
|
|
|
|
|
struct DRWView *world_views[6];
|
|
|
|
|
/** For rendering planar reflections. */
|
2019-05-21 12:34:48 +02:00
|
|
|
struct DRWView *planar_views[MAX_PLANAR];
|
2017-04-29 16:52:12 +10:00
|
|
|
} EEVEE_PrivateData; /* Transient data */
|
2017-03-26 20:13:34 +02:00
|
|
|
|
2017-06-03 00:53:47 +02:00
|
|
|
/* eevee_data.c */
|
2018-07-27 17:33:53 +02:00
|
|
|
void EEVEE_view_layer_data_free(void *sldata);
|
2017-11-29 11:00:50 +01:00
|
|
|
EEVEE_ViewLayerData *EEVEE_view_layer_data_get(void);
|
2018-07-10 15:02:25 +02:00
|
|
|
EEVEE_ViewLayerData *EEVEE_view_layer_data_ensure_ex(struct ViewLayer *view_layer);
|
2017-11-29 10:36:58 +01:00
|
|
|
EEVEE_ViewLayerData *EEVEE_view_layer_data_ensure(void);
|
2017-11-29 11:00:50 +01:00
|
|
|
EEVEE_ObjectEngineData *EEVEE_object_data_get(Object *ob);
|
2017-11-29 10:36:58 +01:00
|
|
|
EEVEE_ObjectEngineData *EEVEE_object_data_ensure(Object *ob);
|
2017-11-29 11:00:50 +01:00
|
|
|
EEVEE_LightProbeEngineData *EEVEE_lightprobe_data_get(Object *ob);
|
2017-11-29 10:36:58 +01:00
|
|
|
EEVEE_LightProbeEngineData *EEVEE_lightprobe_data_ensure(Object *ob);
|
2019-02-27 12:02:02 +11:00
|
|
|
EEVEE_LightEngineData *EEVEE_light_data_get(Object *ob);
|
|
|
|
|
EEVEE_LightEngineData *EEVEE_light_data_ensure(Object *ob);
|
2018-07-10 14:14:55 +02:00
|
|
|
EEVEE_WorldEngineData *EEVEE_world_data_get(World *wo);
|
|
|
|
|
EEVEE_WorldEngineData *EEVEE_world_data_ensure(World *wo);
|
2017-06-01 18:20:44 +02:00
|
|
|
|
2017-06-04 12:12:58 +02:00
|
|
|
/* eevee_materials.c */
|
2017-07-03 16:38:14 +02:00
|
|
|
struct GPUTexture *EEVEE_materials_get_util_tex(void); /* XXX */
|
2019-04-17 06:17:24 +02:00
|
|
|
void EEVEE_materials_init(EEVEE_ViewLayerData *sldata,
|
|
|
|
|
EEVEE_StorageList *stl,
|
|
|
|
|
EEVEE_FramebufferList *fbl);
|
2018-03-06 02:19:28 +01:00
|
|
|
void EEVEE_materials_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata);
|
2019-04-17 06:17:24 +02:00
|
|
|
void EEVEE_materials_cache_populate(EEVEE_Data *vedata,
|
|
|
|
|
EEVEE_ViewLayerData *sldata,
|
|
|
|
|
Object *ob,
|
|
|
|
|
bool *cast_shadow);
|
|
|
|
|
void EEVEE_hair_cache_populate(EEVEE_Data *vedata,
|
|
|
|
|
EEVEE_ViewLayerData *sldata,
|
|
|
|
|
Object *ob,
|
|
|
|
|
bool *cast_shadow);
|
2019-05-16 16:43:41 +02:00
|
|
|
void EEVEE_materials_cache_finish(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata);
|
2017-06-12 20:59:54 +10:00
|
|
|
struct GPUMaterial *EEVEE_material_world_lightprobe_get(struct Scene *scene, struct World *wo);
|
2017-06-04 12:12:58 +02:00
|
|
|
struct GPUMaterial *EEVEE_material_world_background_get(struct Scene *scene, struct World *wo);
|
2017-10-24 14:49:00 +02:00
|
|
|
struct GPUMaterial *EEVEE_material_world_volume_get(struct Scene *scene, struct World *wo);
|
2019-08-22 16:04:25 +02:00
|
|
|
struct GPUMaterial *EEVEE_material_mesh_get(
|
|
|
|
|
struct Scene *scene, Material *ma, EEVEE_Data *vedata, bool use_blend, bool use_refract);
|
2019-04-17 06:17:24 +02:00
|
|
|
struct GPUMaterial *EEVEE_material_mesh_volume_get(struct Scene *scene, Material *ma);
|
|
|
|
|
struct GPUMaterial *EEVEE_material_mesh_depth_get(struct Scene *scene,
|
|
|
|
|
Material *ma,
|
|
|
|
|
bool use_hashed_alpha,
|
|
|
|
|
bool is_shadow);
|
2019-08-22 16:04:25 +02:00
|
|
|
struct GPUMaterial *EEVEE_material_hair_get(struct Scene *scene, Material *ma);
|
2017-06-04 12:12:58 +02:00
|
|
|
void EEVEE_materials_free(void);
|
2019-08-22 16:04:25 +02:00
|
|
|
void EEVEE_materials_draw_opaque(EEVEE_ViewLayerData *sldata, EEVEE_PassList *psl);
|
2018-02-03 23:45:53 +01:00
|
|
|
void EEVEE_update_noise(EEVEE_PassList *psl, EEVEE_FramebufferList *fbl, const double offsets[3]);
|
2019-03-22 18:06:24 +01:00
|
|
|
void EEVEE_update_viewvecs(float invproj[4][4], float winmat[4][4], float (*r_viewvecs)[4]);
|
2017-06-04 12:12:58 +02:00
|
|
|
|
2017-03-17 00:00:46 +01:00
|
|
|
/* eevee_lights.c */
|
2019-08-22 16:04:25 +02:00
|
|
|
void eevee_light_matrix_get(const EEVEE_Light *evli, float r_mat[4][4]);
|
2018-03-01 19:27:38 +01:00
|
|
|
void EEVEE_lights_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata);
|
2017-11-22 10:52:39 -02:00
|
|
|
void EEVEE_lights_cache_add(EEVEE_ViewLayerData *sldata, struct Object *ob);
|
2018-10-28 21:41:40 +01:00
|
|
|
void EEVEE_lights_cache_finish(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata);
|
2019-08-22 16:04:25 +02:00
|
|
|
|
|
|
|
|
/* eevee_shadows.c */
|
|
|
|
|
void eevee_contact_shadow_setup(const Light *la, EEVEE_Shadow *evsh);
|
|
|
|
|
void EEVEE_shadows_init(EEVEE_ViewLayerData *sldata);
|
|
|
|
|
void EEVEE_shadows_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata);
|
|
|
|
|
void EEVEE_shadows_caster_add(EEVEE_ViewLayerData *sldata,
|
|
|
|
|
EEVEE_StorageList *stl,
|
|
|
|
|
struct GPUBatch *geom,
|
|
|
|
|
Object *ob);
|
|
|
|
|
void EEVEE_shadows_caster_material_add(EEVEE_ViewLayerData *sldata,
|
|
|
|
|
EEVEE_PassList *psl,
|
|
|
|
|
struct GPUMaterial *gpumat,
|
|
|
|
|
struct GPUBatch *geom,
|
|
|
|
|
struct Object *ob,
|
|
|
|
|
const float *alpha_threshold);
|
|
|
|
|
void EEVEE_shadows_caster_register(EEVEE_ViewLayerData *sldata, struct Object *ob);
|
|
|
|
|
void EEVEE_shadows_update(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata);
|
|
|
|
|
void EEVEE_shadows_cube_add(EEVEE_LightsInfo *linfo, EEVEE_Light *evli, struct Object *ob);
|
|
|
|
|
bool EEVEE_shadows_cube_setup(EEVEE_LightsInfo *linfo, const EEVEE_Light *evli, int sample_ofs);
|
|
|
|
|
void EEVEE_shadows_cascade_add(EEVEE_LightsInfo *linfo, EEVEE_Light *evli, struct Object *ob);
|
|
|
|
|
void EEVEE_shadows_draw(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata, struct DRWView *view);
|
|
|
|
|
void EEVEE_shadows_draw_cubemap(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata, int cube_index);
|
|
|
|
|
void EEVEE_shadows_draw_cascades(EEVEE_ViewLayerData *sldata,
|
|
|
|
|
EEVEE_Data *vedata,
|
|
|
|
|
DRWView *view,
|
|
|
|
|
int cascade_index);
|
|
|
|
|
void EEVEE_shadows_free(void);
|
|
|
|
|
|
|
|
|
|
/* eevee_sampling.c */
|
|
|
|
|
void EEVEE_sample_ball(int sample_ofs, float radius, float rsample[3]);
|
|
|
|
|
void EEVEE_sample_rectangle(int sample_ofs,
|
|
|
|
|
const float x_axis[3],
|
|
|
|
|
const float y_axis[3],
|
|
|
|
|
float size_x,
|
|
|
|
|
float size_y,
|
|
|
|
|
float rsample[3]);
|
|
|
|
|
void EEVEE_sample_ellipse(int sample_ofs,
|
|
|
|
|
const float x_axis[3],
|
|
|
|
|
const float y_axis[3],
|
|
|
|
|
float size_x,
|
|
|
|
|
float size_y,
|
|
|
|
|
float rsample[3]);
|
|
|
|
|
void EEVEE_random_rotation_m4(int sample_ofs, float scale, float r_mat[4][4]);
|
2017-04-18 12:50:09 +02:00
|
|
|
|
2018-11-16 13:46:13 -02:00
|
|
|
/* eevee_shaders.c */
|
|
|
|
|
void EEVEE_shaders_lightprobe_shaders_init(void);
|
|
|
|
|
struct GPUShader *EEVEE_shaders_probe_filter_glossy_sh_get(void);
|
|
|
|
|
struct GPUShader *EEVEE_shaders_probe_default_sh_get(void);
|
|
|
|
|
struct GPUShader *EEVEE_shaders_probe_filter_diffuse_sh_get(void);
|
|
|
|
|
struct GPUShader *EEVEE_shaders_probe_filter_visibility_sh_get(void);
|
|
|
|
|
struct GPUShader *EEVEE_shaders_probe_grid_fill_sh_get(void);
|
|
|
|
|
struct GPUShader *EEVEE_shaders_probe_planar_downsample_sh_get(void);
|
|
|
|
|
struct GPUShader *EEVEE_shaders_default_studiolight_sh_get(void);
|
|
|
|
|
struct GPUShader *EEVEE_shaders_probe_cube_display_sh_get(void);
|
|
|
|
|
struct GPUShader *EEVEE_shaders_probe_grid_display_sh_get(void);
|
|
|
|
|
struct GPUShader *EEVEE_shaders_probe_planar_display_sh_get(void);
|
|
|
|
|
struct GPUShader *EEVEE_shaders_velocity_resolve_sh_get(void);
|
|
|
|
|
struct GPUShader *EEVEE_shaders_taa_resolve_sh_get(EEVEE_EffectsFlag enabled_effects);
|
|
|
|
|
void EEVEE_shaders_free(void);
|
|
|
|
|
|
2017-06-12 20:59:54 +10:00
|
|
|
/* eevee_lightprobes.c */
|
2018-04-24 12:45:59 +02:00
|
|
|
bool EEVEE_lightprobes_obj_visibility_cb(bool vis_in, void *user_data);
|
2017-11-22 10:52:39 -02:00
|
|
|
void EEVEE_lightprobes_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata);
|
|
|
|
|
void EEVEE_lightprobes_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata);
|
2018-07-10 15:02:25 +02:00
|
|
|
void EEVEE_lightprobes_cache_add(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata, Object *ob);
|
2017-11-22 10:52:39 -02:00
|
|
|
void EEVEE_lightprobes_cache_finish(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata);
|
|
|
|
|
void EEVEE_lightprobes_refresh(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata);
|
2018-02-03 01:50:38 +01:00
|
|
|
void EEVEE_lightprobes_refresh_planar(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata);
|
2017-06-12 20:59:54 +10:00
|
|
|
void EEVEE_lightprobes_free(void);
|
2017-04-18 12:50:09 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
void EEVEE_lightbake_cache_init(EEVEE_ViewLayerData *sldata,
|
|
|
|
|
EEVEE_Data *vedata,
|
|
|
|
|
GPUTexture *rt_color,
|
|
|
|
|
GPUTexture *rt_depth);
|
|
|
|
|
void EEVEE_lightbake_render_world(EEVEE_ViewLayerData *sldata,
|
|
|
|
|
EEVEE_Data *vedata,
|
|
|
|
|
struct GPUFrameBuffer *face_fb[6]);
|
|
|
|
|
void EEVEE_lightbake_render_scene(EEVEE_ViewLayerData *sldata,
|
|
|
|
|
EEVEE_Data *vedata,
|
|
|
|
|
struct GPUFrameBuffer *face_fb[6],
|
|
|
|
|
const float pos[3],
|
|
|
|
|
float near_clip,
|
|
|
|
|
float far_clip);
|
|
|
|
|
void EEVEE_lightbake_filter_glossy(EEVEE_ViewLayerData *sldata,
|
|
|
|
|
EEVEE_Data *vedata,
|
|
|
|
|
struct GPUTexture *rt_color,
|
|
|
|
|
struct GPUFrameBuffer *fb,
|
|
|
|
|
int probe_idx,
|
|
|
|
|
float intensity,
|
|
|
|
|
int maxlevel,
|
|
|
|
|
float filter_quality,
|
|
|
|
|
float firefly_fac);
|
|
|
|
|
void EEVEE_lightbake_filter_diffuse(EEVEE_ViewLayerData *sldata,
|
|
|
|
|
EEVEE_Data *vedata,
|
|
|
|
|
struct GPUTexture *rt_color,
|
|
|
|
|
struct GPUFrameBuffer *fb,
|
|
|
|
|
int grid_offset,
|
|
|
|
|
float intensity);
|
|
|
|
|
void EEVEE_lightbake_filter_visibility(EEVEE_ViewLayerData *sldata,
|
|
|
|
|
EEVEE_Data *vedata,
|
|
|
|
|
struct GPUTexture *rt_depth,
|
|
|
|
|
struct GPUFrameBuffer *fb,
|
|
|
|
|
int grid_offset,
|
|
|
|
|
float clipsta,
|
|
|
|
|
float clipend,
|
|
|
|
|
float vis_range,
|
|
|
|
|
float vis_blur,
|
|
|
|
|
int vis_size);
|
2018-07-10 15:02:25 +02:00
|
|
|
|
|
|
|
|
void EEVEE_lightprobes_grid_data_from_object(Object *ob, EEVEE_LightGrid *prb_data, int *offset);
|
|
|
|
|
void EEVEE_lightprobes_cube_data_from_object(Object *ob, EEVEE_LightProbe *prb_data);
|
2019-04-17 06:17:24 +02:00
|
|
|
void EEVEE_lightprobes_planar_data_from_object(Object *ob,
|
|
|
|
|
EEVEE_PlanarReflection *eplanar,
|
|
|
|
|
EEVEE_LightProbeVisTest *vis_test);
|
2018-07-10 15:02:25 +02:00
|
|
|
|
2017-11-01 01:03:36 +01:00
|
|
|
/* eevee_depth_of_field.c */
|
2018-01-29 18:16:11 +01:00
|
|
|
int EEVEE_depth_of_field_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata, Object *camera);
|
2017-11-22 10:52:39 -02:00
|
|
|
void EEVEE_depth_of_field_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata);
|
2017-11-01 01:03:36 +01:00
|
|
|
void EEVEE_depth_of_field_draw(EEVEE_Data *vedata);
|
|
|
|
|
void EEVEE_depth_of_field_free(void);
|
|
|
|
|
|
|
|
|
|
/* eevee_bloom.c */
|
2017-11-22 10:52:39 -02:00
|
|
|
int EEVEE_bloom_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata);
|
|
|
|
|
void EEVEE_bloom_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata);
|
2017-11-01 01:03:36 +01:00
|
|
|
void EEVEE_bloom_draw(EEVEE_Data *vedata);
|
|
|
|
|
void EEVEE_bloom_free(void);
|
|
|
|
|
|
|
|
|
|
/* eevee_occlusion.c */
|
2017-11-22 10:52:39 -02:00
|
|
|
int EEVEE_occlusion_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata);
|
2018-02-03 00:00:19 +01:00
|
|
|
void EEVEE_occlusion_output_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata);
|
|
|
|
|
void EEVEE_occlusion_output_accumulate(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata);
|
2017-11-22 10:52:39 -02:00
|
|
|
void EEVEE_occlusion_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata);
|
2019-04-17 06:17:24 +02:00
|
|
|
void EEVEE_occlusion_compute(EEVEE_ViewLayerData *sldata,
|
|
|
|
|
EEVEE_Data *vedata,
|
|
|
|
|
struct GPUTexture *depth_src,
|
|
|
|
|
int layer);
|
2017-11-22 10:52:39 -02:00
|
|
|
void EEVEE_occlusion_draw_debug(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata);
|
2017-11-01 01:03:36 +01:00
|
|
|
void EEVEE_occlusion_free(void);
|
|
|
|
|
|
|
|
|
|
/* eevee_screen_raytrace.c */
|
2017-11-22 10:52:39 -02:00
|
|
|
int EEVEE_screen_raytrace_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata);
|
|
|
|
|
void EEVEE_screen_raytrace_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata);
|
|
|
|
|
void EEVEE_refraction_compute(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata);
|
|
|
|
|
void EEVEE_reflection_compute(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata);
|
2017-11-01 01:03:36 +01:00
|
|
|
void EEVEE_screen_raytrace_free(void);
|
|
|
|
|
|
2017-11-14 00:49:54 +01:00
|
|
|
/* eevee_subsurface.c */
|
2019-05-16 16:43:41 +02:00
|
|
|
void EEVEE_subsurface_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata);
|
|
|
|
|
void EEVEE_subsurface_draw_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata);
|
2017-11-22 10:52:39 -02:00
|
|
|
void EEVEE_subsurface_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata);
|
2018-01-31 21:17:27 +01:00
|
|
|
void EEVEE_subsurface_output_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata);
|
2019-04-17 06:17:24 +02:00
|
|
|
void EEVEE_subsurface_add_pass(EEVEE_ViewLayerData *sldata,
|
|
|
|
|
EEVEE_Data *vedata,
|
|
|
|
|
uint sss_id,
|
|
|
|
|
struct GPUUniformBuffer *sss_profile);
|
2019-08-22 16:04:25 +02:00
|
|
|
void EEVEE_subsurface_translucency_add_pass(EEVEE_ViewLayerData *sldata,
|
|
|
|
|
EEVEE_Data *vedata,
|
|
|
|
|
uint sss_id,
|
|
|
|
|
struct GPUUniformBuffer *sss_profile,
|
|
|
|
|
struct GPUTexture *sss_tex_profile);
|
2017-11-22 10:52:39 -02:00
|
|
|
void EEVEE_subsurface_data_render(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata);
|
|
|
|
|
void EEVEE_subsurface_compute(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata);
|
2018-01-31 21:17:27 +01:00
|
|
|
void EEVEE_subsurface_output_accumulate(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata);
|
2017-11-14 00:49:54 +01:00
|
|
|
void EEVEE_subsurface_free(void);
|
|
|
|
|
|
2017-11-01 01:03:36 +01:00
|
|
|
/* eevee_motion_blur.c */
|
2018-01-29 18:16:11 +01:00
|
|
|
int EEVEE_motion_blur_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata, Object *camera);
|
2017-11-22 10:52:39 -02:00
|
|
|
void EEVEE_motion_blur_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata);
|
2017-11-01 01:03:36 +01:00
|
|
|
void EEVEE_motion_blur_draw(EEVEE_Data *vedata);
|
|
|
|
|
void EEVEE_motion_blur_free(void);
|
|
|
|
|
|
2018-02-01 18:09:06 +01:00
|
|
|
/* eevee_mist.c */
|
|
|
|
|
void EEVEE_mist_output_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata);
|
2018-09-20 14:47:10 +00:00
|
|
|
void EEVEE_mist_output_accumulate(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata);
|
2018-02-01 18:09:06 +01:00
|
|
|
void EEVEE_mist_free(void);
|
|
|
|
|
|
2017-11-01 01:03:36 +01:00
|
|
|
/* eevee_temporal_sampling.c */
|
2018-07-20 22:43:30 +02:00
|
|
|
void EEVEE_temporal_sampling_reset(EEVEE_Data *vedata);
|
2017-11-22 10:52:39 -02:00
|
|
|
int EEVEE_temporal_sampling_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata);
|
2019-04-30 22:23:54 +02:00
|
|
|
void EEVEE_temporal_sampling_offset_calc(const double ht_point[2],
|
|
|
|
|
const float filter_size,
|
|
|
|
|
float r_offset[2]);
|
2019-05-21 12:34:48 +02:00
|
|
|
void EEVEE_temporal_sampling_matrices_calc(EEVEE_EffectsInfo *effects, const double ht_point[2]);
|
2019-05-16 11:40:07 +02:00
|
|
|
void EEVEE_temporal_sampling_update_matrices(EEVEE_Data *vedata);
|
2017-11-22 10:52:39 -02:00
|
|
|
void EEVEE_temporal_sampling_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata);
|
2017-11-01 01:03:36 +01:00
|
|
|
void EEVEE_temporal_sampling_draw(EEVEE_Data *vedata);
|
|
|
|
|
|
|
|
|
|
/* eevee_volumes.c */
|
2019-05-16 21:41:22 +02:00
|
|
|
void EEVEE_volumes_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata);
|
2018-05-11 07:48:52 +02:00
|
|
|
void EEVEE_volumes_set_jitter(EEVEE_ViewLayerData *sldata, uint current_sample);
|
2017-11-22 10:52:39 -02:00
|
|
|
void EEVEE_volumes_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata);
|
2019-04-17 06:17:24 +02:00
|
|
|
void EEVEE_volumes_cache_object_add(EEVEE_ViewLayerData *sldata,
|
|
|
|
|
EEVEE_Data *vedata,
|
|
|
|
|
struct Scene *scene,
|
|
|
|
|
Object *ob);
|
2019-05-16 21:41:22 +02:00
|
|
|
void EEVEE_volumes_cache_finish(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata);
|
|
|
|
|
void EEVEE_volumes_draw_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata);
|
2017-11-22 10:52:39 -02:00
|
|
|
void EEVEE_volumes_compute(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata);
|
|
|
|
|
void EEVEE_volumes_resolve(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata);
|
2017-11-01 01:03:36 +01:00
|
|
|
void EEVEE_volumes_free_smoke_textures(void);
|
|
|
|
|
void EEVEE_volumes_free(void);
|
|
|
|
|
|
2017-05-04 17:36:40 +02:00
|
|
|
/* eevee_effects.c */
|
2019-04-17 06:17:24 +02:00
|
|
|
void EEVEE_effects_init(EEVEE_ViewLayerData *sldata,
|
|
|
|
|
EEVEE_Data *vedata,
|
|
|
|
|
Object *camera,
|
|
|
|
|
const bool minimal);
|
2017-11-22 10:52:39 -02:00
|
|
|
void EEVEE_effects_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata);
|
2019-05-16 21:41:22 +02:00
|
|
|
void EEVEE_effects_draw_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata);
|
2017-07-23 20:33:29 +02:00
|
|
|
void EEVEE_create_minmax_buffer(EEVEE_Data *vedata, struct GPUTexture *depth_src, int layer);
|
2018-03-25 17:46:48 +02:00
|
|
|
void EEVEE_downsample_buffer(EEVEE_Data *vedata, struct GPUTexture *texture_src, int level);
|
|
|
|
|
void EEVEE_downsample_cube_buffer(EEVEE_Data *vedata, struct GPUTexture *texture_src, int level);
|
2019-05-01 11:01:01 +02:00
|
|
|
void EEVEE_draw_alpha_checker(EEVEE_Data *vedata);
|
2018-01-21 17:25:10 +01:00
|
|
|
void EEVEE_draw_effects(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata);
|
2017-05-04 17:36:40 +02:00
|
|
|
void EEVEE_effects_free(void);
|
|
|
|
|
|
2018-02-01 21:38:16 +01:00
|
|
|
/* eevee_render.c */
|
2019-04-17 06:17:24 +02:00
|
|
|
void EEVEE_render_init(EEVEE_Data *vedata,
|
|
|
|
|
struct RenderEngine *engine,
|
|
|
|
|
struct Depsgraph *depsgraph);
|
|
|
|
|
void EEVEE_render_cache(void *vedata,
|
|
|
|
|
struct Object *ob,
|
|
|
|
|
struct RenderEngine *engine,
|
|
|
|
|
struct Depsgraph *depsgraph);
|
|
|
|
|
void EEVEE_render_draw(EEVEE_Data *vedata,
|
|
|
|
|
struct RenderEngine *engine,
|
|
|
|
|
struct RenderLayer *render_layer,
|
|
|
|
|
const struct rcti *rect);
|
|
|
|
|
void EEVEE_render_update_passes(struct RenderEngine *engine,
|
|
|
|
|
struct Scene *scene,
|
|
|
|
|
struct ViewLayer *view_layer);
|
2018-01-29 18:16:11 +01:00
|
|
|
|
2018-05-25 08:06:36 +02:00
|
|
|
/** eevee_lookdev.c */
|
2019-04-17 06:17:24 +02:00
|
|
|
void EEVEE_lookdev_cache_init(EEVEE_Data *vedata,
|
|
|
|
|
DRWShadingGroup **grp,
|
|
|
|
|
DRWPass *pass,
|
|
|
|
|
float background_alpha,
|
|
|
|
|
struct World *world,
|
|
|
|
|
EEVEE_LightProbesInfo *pinfo);
|
2019-04-30 22:23:54 +02:00
|
|
|
void EEVEE_lookdev_draw(EEVEE_Data *vedata);
|
2018-05-25 08:06:36 +02:00
|
|
|
|
2018-07-10 15:02:25 +02:00
|
|
|
/** eevee_engine.c */
|
|
|
|
|
void EEVEE_cache_populate(void *vedata, Object *ob);
|
|
|
|
|
|
2017-04-18 12:50:09 +02:00
|
|
|
/* Shadow Matrix */
|
2019-04-17 06:17:24 +02:00
|
|
|
static const float texcomat[4][4] = {
|
|
|
|
|
/* From NDC to TexCo */
|
|
|
|
|
{0.5f, 0.0f, 0.0f, 0.0f},
|
|
|
|
|
{0.0f, 0.5f, 0.0f, 0.0f},
|
|
|
|
|
{0.0f, 0.0f, 0.5f, 0.0f},
|
|
|
|
|
{0.5f, 0.5f, 0.5f, 1.0f},
|
2017-04-18 12:50:09 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* Cubemap Matrices */
|
|
|
|
|
static const float cubefacemat[6][4][4] = {
|
2019-04-17 06:17:24 +02:00
|
|
|
/* Pos X */
|
|
|
|
|
{{0.0f, 0.0f, -1.0f, 0.0f},
|
|
|
|
|
{0.0f, -1.0f, 0.0f, 0.0f},
|
|
|
|
|
{-1.0f, 0.0f, 0.0f, 0.0f},
|
|
|
|
|
{0.0f, 0.0f, 0.0f, 1.0f}},
|
|
|
|
|
/* Neg X */
|
|
|
|
|
{{0.0f, 0.0f, 1.0f, 0.0f},
|
|
|
|
|
{0.0f, -1.0f, 0.0f, 0.0f},
|
|
|
|
|
{1.0f, 0.0f, 0.0f, 0.0f},
|
|
|
|
|
{0.0f, 0.0f, 0.0f, 1.0f}},
|
|
|
|
|
/* Pos Y */
|
|
|
|
|
{{1.0f, 0.0f, 0.0f, 0.0f},
|
|
|
|
|
{0.0f, 0.0f, -1.0f, 0.0f},
|
|
|
|
|
{0.0f, 1.0f, 0.0f, 0.0f},
|
|
|
|
|
{0.0f, 0.0f, 0.0f, 1.0f}},
|
|
|
|
|
/* Neg Y */
|
|
|
|
|
{{1.0f, 0.0f, 0.0f, 0.0f},
|
|
|
|
|
{0.0f, 0.0f, 1.0f, 0.0f},
|
|
|
|
|
{0.0f, -1.0f, 0.0f, 0.0f},
|
|
|
|
|
{0.0f, 0.0f, 0.0f, 1.0f}},
|
|
|
|
|
/* Pos Z */
|
|
|
|
|
{{1.0f, 0.0f, 0.0f, 0.0f},
|
|
|
|
|
{0.0f, -1.0f, 0.0f, 0.0f},
|
|
|
|
|
{0.0f, 0.0f, -1.0f, 0.0f},
|
|
|
|
|
{0.0f, 0.0f, 0.0f, 1.0f}},
|
|
|
|
|
/* Neg Z */
|
|
|
|
|
{{-1.0f, 0.0f, 0.0f, 0.0f},
|
|
|
|
|
{0.0f, -1.0f, 0.0f, 0.0f},
|
|
|
|
|
{0.0f, 0.0f, 1.0f, 0.0f},
|
|
|
|
|
{0.0f, 0.0f, 0.0f, 1.0f}},
|
2017-04-18 12:50:09 +02:00
|
|
|
};
|
2017-05-08 11:44:58 +10:00
|
|
|
|
|
|
|
|
#endif /* __EEVEE_PRIVATE_H__ */
|