[Bf-blender-cvs] [bc648af4e1b] blender2.8: Fix Opengl Error with glBlitFramebuffer

Clément Foucault noreply at git.blender.org
Tue Nov 14 20:49:40 CET 2017


Commit: bc648af4e1bb9635d6d4fa6ef5d196607a47d2fb
Author: Clément Foucault
Date:   Tue Nov 14 20:49:13 2017 +0100
Branches: blender2.8
https://developer.blender.org/rBbc648af4e1bb9635d6d4fa6ef5d196607a47d2fb

Fix Opengl Error with glBlitFramebuffer

This was caused by 93936b8643b9c4f77fe13d35b41ecaa246843dd8

>From GL spec :
GL_INVALID_OPERATION is generated if mask contains GL_DEPTH_BUFFER_BIT or GL_STENCIL_BUFFER_BIT and the source and destination depth and stencil formats do not match.

So blitting framebuffer with depth or stencil require the SAME FORMAT.

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

M	source/blender/draw/engines/basic/basic_engine.c
M	source/blender/draw/engines/clay/clay_engine.c
M	source/blender/draw/engines/eevee/eevee_temporal_sampling.c
M	source/blender/gpu/intern/gpu_framebuffer.c

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

diff --git a/source/blender/draw/engines/basic/basic_engine.c b/source/blender/draw/engines/basic/basic_engine.c
index a4ee3d22444..92ffa8a1794 100644
--- a/source/blender/draw/engines/basic/basic_engine.c
+++ b/source/blender/draw/engines/basic/basic_engine.c
@@ -136,7 +136,7 @@ static void BASIC_engine_init(void *vedata)
 #ifdef USE_DEPTH
 	if (DRW_state_is_fbo()) {
 		const float *viewport_size = DRW_viewport_size_get();
-		DRWFboTexture tex = {&txl->depth_dup, DRW_TEX_DEPTH_24, 0};
+		DRWFboTexture tex = {&txl->depth_dup, DRW_TEX_DEPTH_24_STENCIL_8, 0};
 		DRW_framebuffer_init(&fbl->dupli_depth, &draw_engine_basic_type,
 		                     (int)viewport_size[0], (int)viewport_size[1],
 		                     &tex, 1);
diff --git a/source/blender/draw/engines/clay/clay_engine.c b/source/blender/draw/engines/clay/clay_engine.c
index c3ec878b94b..c4d4ff1a56d 100644
--- a/source/blender/draw/engines/clay/clay_engine.c
+++ b/source/blender/draw/engines/clay/clay_engine.c
@@ -414,7 +414,7 @@ static void CLAY_engine_init(void *vedata)
 
 	if (DRW_state_is_fbo()) {
 		const float *viewport_size = DRW_viewport_size_get();
-		DRWFboTexture tex = {&e_data.depth_dup, DRW_TEX_DEPTH_24, DRW_TEX_TEMP};
+		DRWFboTexture tex = {&e_data.depth_dup, DRW_TEX_DEPTH_24_STENCIL_8, DRW_TEX_TEMP};
 		DRW_framebuffer_init(&fbl->dupli_depth, &draw_engine_clay_type,
 		                     (int)viewport_size[0], (int)viewport_size[1],
 		                     &tex, 1);
diff --git a/source/blender/draw/engines/eevee/eevee_temporal_sampling.c b/source/blender/draw/engines/eevee/eevee_temporal_sampling.c
index 434c76643f2..6e70ba45edf 100644
--- a/source/blender/draw/engines/eevee/eevee_temporal_sampling.c
+++ b/source/blender/draw/engines/eevee/eevee_temporal_sampling.c
@@ -119,7 +119,7 @@ int EEVEE_temporal_sampling_init(EEVEE_SceneLayerData *UNUSED(sldata), EEVEE_Dat
 			effects->taa_current_sample = 1;
 		}
 
-		DRWFboTexture tex_double_buffer = {&txl->depth_double_buffer, DRW_TEX_DEPTH_24};
+		DRWFboTexture tex_double_buffer = {&txl->depth_double_buffer, DRW_TEX_DEPTH_24_STENCIL_8, 0};
 
 		DRW_framebuffer_init(&fbl->depth_double_buffer_fb, &draw_engine_eevee_type,
 		                    (int)viewport_size[0], (int)viewport_size[1],
diff --git a/source/blender/gpu/intern/gpu_framebuffer.c b/source/blender/gpu/intern/gpu_framebuffer.c
index 884a305bd02..5aa7e5e8008 100644
--- a/source/blender/gpu/intern/gpu_framebuffer.c
+++ b/source/blender/gpu/intern/gpu_framebuffer.c
@@ -532,9 +532,11 @@ void GPU_framebuffer_blit(
 
 	if (use_depth) {
 		BLI_assert(GPU_texture_depth(read_tex) && GPU_texture_depth(write_tex));
+		BLI_assert(GPU_texture_format(read_tex) == GPU_texture_format(write_tex));
 	}
 	else if (use_stencil) {
 		BLI_assert(GPU_texture_stencil(read_tex) && GPU_texture_stencil(write_tex));
+		BLI_assert(GPU_texture_format(read_tex) == GPU_texture_format(write_tex));
 	}
 
 	/* read from multi-sample buffer */



More information about the Bf-blender-cvs mailing list