[Bf-blender-cvs] [16e929e6ff1] blender2.8: OpenGL: Fix crash on start with Mesa drivers

Ines Almeida noreply at git.blender.org
Mon Apr 17 22:36:15 CEST 2017


Commit: 16e929e6ff1007d057d183b56bb7fc2d1f8aae53
Author: Ines Almeida
Date:   Mon Apr 17 22:31:56 2017 +0200
Branches: blender2.8
https://developer.blender.org/rB16e929e6ff1007d057d183b56bb7fc2d1f8aae53

OpenGL: Fix crash on start with Mesa drivers

glFramebufferTexture() is only available from OGL 3.2, it is also not part of the ARB_framebuffer_object extension.
I don't know if there is a better way to check for mesa drivers or if using the 2D version will have issues with f2f16a256, but so far I had no problems

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

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 fc6eb6baf51..9e34304190d 100644
--- a/source/blender/gpu/intern/gpu_framebuffer.c
+++ b/source/blender/gpu/intern/gpu_framebuffer.c
@@ -146,6 +146,12 @@ bool GPU_framebuffer_texture_attach(GPUFrameBuffer *fb, GPUTexture *tex, int slo
 #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), 0);
+#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), 0);
+	else
+		glFramebufferTexture(GL_FRAMEBUFFER, attachment, GPU_texture_opengl_bindcode(tex), 0); /* normal core call, same as below */
 #else
 	glFramebufferTexture(GL_FRAMEBUFFER, attachment, GPU_texture_opengl_bindcode(tex), 0);
 #endif




More information about the Bf-blender-cvs mailing list