[Bf-blender-cvs] [39efb58446e] blender2.8: GPU Framebuffer: simplify gpu_framebuffer_update_attachments_and_fill_empty_slots func

mano-wii noreply at git.blender.org
Thu Dec 6 15:48:27 CET 2018


Commit: 39efb58446eb7af0f3ab10f8316ba81f465cdc17
Author: mano-wii
Date:   Thu Dec 6 11:47:37 2018 -0200
Branches: blender2.8
https://developer.blender.org/rB39efb58446eb7af0f3ab10f8316ba81f465cdc17

GPU Framebuffer: simplify gpu_framebuffer_update_attachments_and_fill_empty_slots func

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

M	source/blender/gpu/intern/gpu_framebuffer.c

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

diff --git a/source/blender/gpu/intern/gpu_framebuffer.c b/source/blender/gpu/intern/gpu_framebuffer.c
index d5762700b0f..8714c72686c 100644
--- a/source/blender/gpu/intern/gpu_framebuffer.c
+++ b/source/blender/gpu/intern/gpu_framebuffer.c
@@ -424,7 +424,6 @@ static void gpu_framebuffer_update_attachments(GPUFrameBuffer *fb)
 static void gpu_framebuffer_update_attachments_and_fill_empty_slots(GPUFrameBuffer *fb)
 {
 	GLenum gl_attachments[GPU_FB_MAX_COLOR_ATTACHMENT];
-	bool fill_empty_slot = false;
 	int dummy_tex = 0;
 
 	BLI_assert(GPU_framebuffer_active_get() == fb);
@@ -435,11 +434,10 @@ static void gpu_framebuffer_update_attachments_and_fill_empty_slots(GPUFrameBuff
 
 		if (type >= GPU_FB_COLOR_ATTACHMENT0) {
 			int slot = type - GPU_FB_COLOR_ATTACHMENT0;
-			if (tex != NULL || fill_empty_slot) {
+			if (tex != NULL || (dummy_tex != 0)) {
 				gl_attachments[slot] = convert_attachment_type_to_gl(type);
 
-				if (!fill_empty_slot) {
-					fill_empty_slot = true;
+				if (dummy_tex == 0) {
 					dummy_tex = GPU_texture_opengl_bindcode(tex);
 				}
 			}
@@ -448,22 +446,23 @@ static void gpu_framebuffer_update_attachments_and_fill_empty_slots(GPUFrameBuff
 			}
 		}
 		else {
-			fill_empty_slot = false;
 			dummy_tex = 0;
 		}
 
-		if ((fill_empty_slot && tex == NULL) || GPU_FB_ATTACHEMENT_IS_DIRTY(fb->dirty_flag, type)) {
+		if ((dummy_tex != 0) && tex == NULL) {
+			/* Fill empty slot */
+			glFramebufferTexture(GL_FRAMEBUFFER, convert_attachment_type_to_gl(type), dummy_tex, 0);
+		}
+		else if (GPU_FB_ATTACHEMENT_IS_DIRTY(fb->dirty_flag, type)) {
 			if (tex != NULL) {
 				gpu_framebuffer_attachment_attach(&fb->attachments[type], type);
 
 				fb->multisample = (GPU_texture_samples(tex) > 0);
 				fb->width = GPU_texture_width(tex);
 				fb->height = GPU_texture_height(tex);
-
-				fill_empty_slot = dummy_tex != 0;
 			}
 			else {
-				glFramebufferTexture(GL_FRAMEBUFFER, convert_attachment_type_to_gl(type), dummy_tex, 0);
+				gpu_framebuffer_attachment_detach(&fb->attachments[type], type);
 			}
 		}
 	}



More information about the Bf-blender-cvs mailing list