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>2019-03-28 00:02:13 +0300
committerClément Foucault <foucault.clem@gmail.com>2019-03-28 00:02:31 +0300
commit780219f868a52fb910cc4f97826cb3a59679c21e (patch)
tree967113cd97a652e6f73c62852acf75cd2cfe89b2
parent37e3b89506cfb13fa36fdf765d6ef4763d2bfd43 (diff)
Eevee: Fix reflection plane weird behavior when comming from lookdev mode
The reflection was set to use the 1x1px texture as rendering target and was considered valid reflection texture.
-rw-r--r--source/blender/draw/engines/eevee/eevee_lightprobes.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_lightprobes.c b/source/blender/draw/engines/eevee/eevee_lightprobes.c
index b0e0a986630..3a819460c74 100644
--- a/source/blender/draw/engines/eevee/eevee_lightprobes.c
+++ b/source/blender/draw/engines/eevee/eevee_lightprobes.c
@@ -123,15 +123,24 @@ static void planar_pool_ensure_alloc(EEVEE_Data *vedata, int num_planar_ref)
// ViewLayer *view_layer = draw_ctx->view_layer;
float screen_percentage = 1.0f;
- int width = (int)(viewport_size[0] * screen_percentage);
- int height = (int)(viewport_size[1] * screen_percentage);
+ int width = max_ii(1, (int)(viewport_size[0] * screen_percentage));
+ int height = max_ii(1, (int)(viewport_size[1] * screen_percentage));
+
+ /* Fix case were the pool was allocated width the dummy size (1,1,1). */
+ if (txl->planar_pool && (num_planar_ref > 0) &&
+ (GPU_texture_width(txl->planar_pool) != width ||
+ GPU_texture_height(txl->planar_pool) != height))
+ {
+ DRW_TEXTURE_FREE_SAFE(txl->planar_pool);
+ DRW_TEXTURE_FREE_SAFE(txl->planar_depth);
+ }
/* We need an Array texture so allocate it ourself */
if (!txl->planar_pool) {
if (num_planar_ref > 0) {
- txl->planar_pool = DRW_texture_create_2d_array(width, height, max_ff(1, num_planar_ref),
+ txl->planar_pool = DRW_texture_create_2d_array(width, height, max_ii(1, num_planar_ref),
GPU_R11F_G11F_B10F, DRW_TEX_FILTER | DRW_TEX_MIPMAP, NULL);
- txl->planar_depth = DRW_texture_create_2d_array(width, height, max_ff(1, num_planar_ref),
+ txl->planar_depth = DRW_texture_create_2d_array(width, height, max_ii(1, num_planar_ref),
GPU_DEPTH_COMPONENT24, 0, NULL);
}
else if (num_planar_ref == 0) {