Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2017-09-02 03:27:28 +0300
committerClément Foucault <foucault.clem@gmail.com>2017-09-10 04:09:45 +0300
commit6c17348e9160e412e13e17cad996fe50c1ffcbe9 (patch)
tree41755e4ed5138c3508e1ff0057f37446dfe5c43f /source/blender/draw
parentf46b908cc5e62049e911d963303d36c4ab4e3a64 (diff)
Eevee: Shadow: Add high bitdepth option.
This option is here for reducing the memory usage of shadow maps. Also lower bitdepth are quicker to process.
Diffstat (limited to 'source/blender/draw')
-rw-r--r--source/blender/draw/engines/eevee/eevee_engine.c1
-rw-r--r--source/blender/draw/engines/eevee/eevee_lights.c19
-rw-r--r--source/blender/draw/engines/eevee/eevee_private.h1
3 files changed, 13 insertions, 8 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_engine.c b/source/blender/draw/engines/eevee/eevee_engine.c
index 735c3a77c5d..8d3d749d55a 100644
--- a/source/blender/draw/engines/eevee/eevee_engine.c
+++ b/source/blender/draw/engines/eevee/eevee_engine.c
@@ -312,6 +312,7 @@ static void EEVEE_scene_layer_settings_create(RenderEngine *UNUSED(engine), IDPr
BKE_collection_engine_property_add_int(props, "shadow_method", SHADOW_ESM);
BKE_collection_engine_property_add_int(props, "shadow_size", 512);
+ BKE_collection_engine_property_add_bool(props, "shadow_high_bitdepth", false);
}
static const DrawEngineDataSize EEVEE_data_size = DRW_VIEWPORT_DATA_SIZE(EEVEE_Data);
diff --git a/source/blender/draw/engines/eevee/eevee_lights.c b/source/blender/draw/engines/eevee/eevee_lights.c
index b70cfcb01dc..0033670528a 100644
--- a/source/blender/draw/engines/eevee/eevee_lights.c
+++ b/source/blender/draw/engines/eevee/eevee_lights.c
@@ -97,13 +97,19 @@ void EEVEE_lights_init(EEVEE_SceneLayerData *sldata)
int sh_method = BKE_collection_engine_property_value_get_int(props, "shadow_method");
int sh_size = BKE_collection_engine_property_value_get_int(props, "shadow_size");
+ int sh_high_bitdepth = BKE_collection_engine_property_value_get_int(props, "shadow_high_bitdepth");
EEVEE_LampsInfo *linfo = sldata->lamps;
- if ((linfo->shadow_size != sh_size) || (linfo->shadow_method != sh_method)) {
+ if ((linfo->shadow_size != sh_size) ||
+ (linfo->shadow_method != sh_method) ||
+ (linfo->shadow_high_bitdepth != sh_high_bitdepth))
+ {
BLI_assert((sh_size > 0) && (sh_size <= 8192));
DRW_TEXTURE_FREE_SAFE(sldata->shadow_pool);
+ DRW_TEXTURE_FREE_SAFE(sldata->shadow_cube_target);
DRW_TEXTURE_FREE_SAFE(sldata->shadow_cascade_target);
+ linfo->shadow_high_bitdepth = sh_high_bitdepth;
linfo->shadow_method = sh_method;
linfo->shadow_size = sh_size;
linfo->shadow_render_data.stored_texel_size = 1.0 / (float)linfo->shadow_size;
@@ -115,11 +121,8 @@ void EEVEE_lights_init(EEVEE_SceneLayerData *sldata)
CLAMP(new_cube_target_size, 1, 4096);
- if (linfo->shadow_cube_target_size != new_cube_target_size) {
- linfo->shadow_cube_target_size = new_cube_target_size;
- DRW_TEXTURE_FREE_SAFE(sldata->shadow_cube_target);
- linfo->shadow_render_data.cube_texel_size = 1.0 / (float)linfo->shadow_cube_target_size;
- }
+ linfo->shadow_cube_target_size = new_cube_target_size;
+ linfo->shadow_render_data.cube_texel_size = 1.0 / (float)linfo->shadow_cube_target_size;
}
}
@@ -279,8 +282,8 @@ void EEVEE_lights_cache_finish(EEVEE_SceneLayerData *sldata)
}
switch (linfo->shadow_method) {
- case SHADOW_ESM: shadow_pool_format = DRW_TEX_R_32; break;
- case SHADOW_VSM: shadow_pool_format = DRW_TEX_RG_32; break;
+ case SHADOW_ESM: shadow_pool_format = ((linfo->shadow_high_bitdepth) ? DRW_TEX_R_32 : DRW_TEX_R_16); break;
+ case SHADOW_VSM: shadow_pool_format = ((linfo->shadow_high_bitdepth) ? DRW_TEX_RG_32 : DRW_TEX_RG_16); break;
default:
BLI_assert(!"Incorrect Shadow Method");
break;
diff --git a/source/blender/draw/engines/eevee/eevee_private.h b/source/blender/draw/engines/eevee/eevee_private.h
index 724764b5291..1e994c8d1fa 100644
--- a/source/blender/draw/engines/eevee/eevee_private.h
+++ b/source/blender/draw/engines/eevee/eevee_private.h
@@ -249,6 +249,7 @@ typedef struct EEVEE_LampsInfo {
int num_shadow, cache_num_shadow;
int update_flag;
int shadow_size, shadow_method;
+ bool shadow_high_bitdepth;
int shadow_cube_target_size;
/* List of lights in the scene. */
/* XXX This is fragile, can get out of sync quickly. */