[Bf-blender-cvs] [45b3555cba9] blender2.8: OpenGL: fix compatibility with Mac & Mesa

Mike Erwin noreply at git.blender.org
Tue Apr 18 18:11:21 CEST 2017


Commit: 45b3555cba998424752c2db8057f751c31f1ca53
Author: Mike Erwin
Date:   Tue Apr 18 11:54:13 2017 -0400
Branches: blender2.8
https://developer.blender.org/rB45b3555cba998424752c2db8057f751c31f1ca53

OpenGL: fix compatibility with Mac & Mesa

This combines the Mesa fix (16e929e6ff1007d057d183b56bb7fc2d1f8aae53 by @brita_) with the Mac fix (89e23c743e601940fc051189ef01c537233d2043 by @merwin).

And uses the same fix for another call to glFramebufferTexture introduced in f1fb605ec9ffd69b82652f3702de8b7ada570fd8.

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

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 afa0d4c7f17..52e9a6aec3a 100644
--- a/source/blender/gpu/intern/gpu_framebuffer.c
+++ b/source/blender/gpu/intern/gpu_framebuffer.c
@@ -143,15 +143,13 @@ bool GPU_framebuffer_texture_attach(GPUFrameBuffer *fb, GPUTexture *tex, int slo
 	else
 		attachment = GL_COLOR_ATTACHMENT0 + slot;
 
-#if defined(__APPLE__) && defined(WITH_GL_PROFILE_COMPAT)
-	/* Mac workaround, remove after we switch to core profile */
-	glFramebufferTextureEXT(GL_FRAMEBUFFER, attachment, GPU_texture_opengl_bindcode(tex), mip);
-#elif defined(WITH_GL_PROFILE_COMPAT)
-	/* Workaround for Mesa compatibility profile, remove after we switch to core profile */
-	if(!GLEW_VERSION_3_2) /* glFramebufferTexture was introduced in 3.2. It is *not* available in the ARB FBO extension */
-		glFramebufferTexture2D(GL_FRAMEBUFFER, attachment, GPU_texture_target(tex), GPU_texture_opengl_bindcode(tex), mip);
-	else
+#if defined(WITH_GL_PROFILE_COMPAT)
+	/* Workaround for Mac & Mesa compatibility profile, remove after we switch to core profile */
+	/* glFramebufferTexture was introduced in 3.2. It is *not* available in the ARB FBO extension */
+	if (GLEW_VERSION_3_2)
 		glFramebufferTexture(GL_FRAMEBUFFER, attachment, GPU_texture_opengl_bindcode(tex), mip); /* normal core call, same as below */
+	else
+		glFramebufferTexture2D(GL_FRAMEBUFFER, attachment, GPU_texture_target(tex), GPU_texture_opengl_bindcode(tex), mip);
 #else
 	glFramebufferTexture(GL_FRAMEBUFFER, attachment, GPU_texture_opengl_bindcode(tex), mip);
 #endif
@@ -194,7 +192,16 @@ void GPU_framebuffer_texture_detach(GPUTexture *tex)
 		attachment = GL_COLOR_ATTACHMENT0 + fb_attachment;
 	}
 
+#if defined(WITH_GL_PROFILE_COMPAT)
+	/* Workaround for Mac & Mesa compatibility profile, remove after we switch to core profile */
+	/* glFramebufferTexture was introduced in 3.2. It is *not* available in the ARB FBO extension */
+	if (GLEW_VERSION_3_2)
+		glFramebufferTexture(GL_FRAMEBUFFER, attachment, 0, 0); /* normal core call, same as below */
+	else
+		glFramebufferTexture2D(GL_FRAMEBUFFER, attachment, GPU_texture_target(tex), 0, 0);
+#else
 	glFramebufferTexture(GL_FRAMEBUFFER, attachment, 0, 0);
+#endif
 
 	GPU_texture_framebuffer_set(tex, NULL, -1);
 }




More information about the Bf-blender-cvs mailing list