[Bf-blender-cvs] [780219f868a] master: Eevee: Fix reflection plane weird behavior when comming from lookdev mode

Clément Foucault noreply at git.blender.org
Wed Mar 27 22:02:36 CET 2019


Commit: 780219f868a52fb910cc4f97826cb3a59679c21e
Author: Clément Foucault
Date:   Wed Mar 27 22:02:13 2019 +0100
Branches: master
https://developer.blender.org/rB780219f868a52fb910cc4f97826cb3a59679c21e

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.

===================================================================

M	source/blender/draw/engines/eevee/eevee_lightprobes.c

===================================================================

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) {



More information about the Bf-blender-cvs mailing list