[Bf-committers] [Bf-blender-cvs] SVN commit: /data/svn/bf-blender [23940] trunk/blender/source: Fix #19669 and other: triple buffer & icon texture drawing could cause

Jasper Mine jaspermine at ptd.net
Mon Oct 19 18:44:47 CEST 2009


Hello,

I can confirm this workaround has fixed the kernel panic on Apple OSX  
10.5 intel with ATI card.

Jasper


On Oct 19, 2009, at 6:10 AM, Brecht Van Lommel wrote:

> Revision: 23940
>          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=23940
> Author:   blendix
> Date:     2009-10-19 12:10:05 +0200 (Mon, 19 Oct 2009)
>
> Log Message:
> -----------
> Fix #19669 and other: triple buffer & icon texture drawing could cause
> a system crash and other issues on ATI/Apple, due to a buggy driver
> (similar issues reported for other OpenGL applications). For now, work
> around it by not using non-power-of-two textures on this combination.
>
> Modified Paths:
> --------------
>    trunk/blender/source/blender/editors/interface/interface_icons.c
>    trunk/blender/source/blender/editors/space_view3d/drawobject.c
>    trunk/blender/source/blender/editors/space_view3d/drawvolume.c
>    trunk/blender/source/blender/gpu/GPU_extensions.h
>    trunk/blender/source/blender/gpu/intern/gpu_extensions.c
>    trunk/blender/source/blender/windowmanager/intern/wm_draw.c
>    trunk/blender/source/gameengine/BlenderRoutines/ 
> BL_KetsjiEmbedStart.cpp
>    trunk/blender/source/gameengine/GamePlayer/ghost/ 
> GPG_Application.cpp
>
> Modified: trunk/blender/source/blender/editors/interface/ 
> interface_icons.c
> ===================================================================
> --- trunk/blender/source/blender/editors/interface/interface_icons.c	 
> 2009-10-19 10:07:19 UTC (rev 23939)
> +++ trunk/blender/source/blender/editors/interface/interface_icons.c	 
> 2009-10-19 10:10:05 UTC (rev 23940)
> @@ -489,7 +489,7 @@
> 		}
>
> 		/* we only use a texture for cards with non-power of two */
> -		if(GLEW_ARB_texture_non_power_of_two) {
> +		if(GPU_non_power_of_two_support()) {
> 			glGenTextures(1, &icongltex.id);
>
> 			if(icongltex.id) {
>
> Modified: trunk/blender/source/blender/editors/space_view3d/ 
> drawobject.c
> ===================================================================
> --- trunk/blender/source/blender/editors/space_view3d/drawobject.c	 
> 2009-10-19 10:07:19 UTC (rev 23939)
> +++ trunk/blender/source/blender/editors/space_view3d/drawobject.c	 
> 2009-10-19 10:10:05 UTC (rev 23940)
> @@ -212,7 +212,7 @@
>
> int draw_glsl_material(Scene *scene, Object *ob, View3D *v3d, int dt)
> {
> -	if(!GPU_extensions_minimum_support())
> +	if(!GPU_glsl_support())
> 		return 0;
> 	if(G.f & G_PICKSEL)
> 		return 0;
>
> Modified: trunk/blender/source/blender/editors/space_view3d/ 
> drawvolume.c
> ===================================================================
> --- trunk/blender/source/blender/editors/space_view3d/drawvolume.c	 
> 2009-10-19 10:07:19 UTC (rev 23939)
> +++ trunk/blender/source/blender/editors/space_view3d/drawvolume.c	 
> 2009-10-19 10:10:05 UTC (rev 23940)
> @@ -349,7 +349,7 @@
> 	else
> 		printf("No volume shadow\n");
>
> -	if (!GLEW_ARB_texture_non_power_of_two) {
> +	if (!GPU_non_power_of_two_support()) {
> 		cor[0] = (float)res[0]/(float)larger_pow2(res[0]);
> 		cor[1] = (float)res[1]/(float)larger_pow2(res[1]);
> 		cor[2] = (float)res[2]/(float)larger_pow2(res[2]);
>
> Modified: trunk/blender/source/blender/gpu/GPU_extensions.h
> ===================================================================
> --- trunk/blender/source/blender/gpu/GPU_extensions.h	2009-10-19  
> 10:07:19 UTC (rev 23939)
> +++ trunk/blender/source/blender/gpu/GPU_extensions.h	2009-10-19  
> 10:10:05 UTC (rev 23940)
> @@ -54,7 +54,8 @@
> void GPU_extensions_disable(void);
> void GPU_extensions_init(void); /* call this before running any of  
> the functions below */
> void GPU_extensions_exit(void);
> -int GPU_extensions_minimum_support(void);
> +int GPU_glsl_support(void);
> +int GPU_non_power_of_two_support(void);
> int GPU_print_error(char *str);
>
> /* GPU Texture
>
> Modified: trunk/blender/source/blender/gpu/intern/gpu_extensions.c
> ===================================================================
> --- trunk/blender/source/blender/gpu/intern/gpu_extensions.c	 
> 2009-10-19 10:07:19 UTC (rev 23939)
> +++ trunk/blender/source/blender/gpu/intern/gpu_extensions.c	 
> 2009-10-19 10:10:05 UTC (rev 23940)
> @@ -69,7 +69,7 @@
> static struct GPUGlobal {
> 	GLint maxtextures;
> 	GLuint currentfb;
> -	int minimumsupport;
> +	int glslsupport;
> 	int extdisabled;
> } GG = {1, 0, 0, 0};
>
> @@ -87,17 +87,29 @@
> 	if (GLEW_ARB_multitexture)
> 		glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS_ARB, &GG.maxtextures);
>
> -	GG.minimumsupport = 1;
> -	if (!GLEW_ARB_multitexture) GG.minimumsupport = 0;
> -	if (!GLEW_ARB_vertex_shader) GG.minimumsupport = 0;
> -	if (!GLEW_ARB_fragment_shader) GG.minimumsupport = 0;
> +	GG.glslsupport = 1;
> +	if (!GLEW_ARB_multitexture) GG.glslsupport = 0;
> +	if (!GLEW_ARB_vertex_shader) GG.glslsupport = 0;
> +	if (!GLEW_ARB_fragment_shader) GG.glslsupport = 0;
> }
>
> -int GPU_extensions_minimum_support()
> +int GPU_glsl_support()
> {
> -	return !GG.extdisabled && GG.minimumsupport;
> +	return !GG.extdisabled && GG.glslsupport;
> }
>
> +int GPU_non_power_of_two_support()
> +{
> +	/* Exception for buggy ATI/Apple driver in Mac OS X 10.5/10.6,
> +	 * they claim to support this but can cause system freeze */
> +#ifdef __APPLE__
> +	if(strcmp(glGetString(GL_VENDOR), "ATI Technologies Inc.") == 0)
> +		return 0;
> +#endif
> +
> +	return GLEW_ARB_texture_non_power_of_two;
> +}
> +
> int GPU_print_error(char *str)
> {
> 	GLenum errCode;
> @@ -231,7 +243,7 @@
> 		return NULL;
> 	}
>
> -	if (!GLEW_ARB_texture_non_power_of_two) {
> +	if (!GPU_non_power_of_two_support()) {
> 		tex->w = larger_pow2(tex->w);
> 		tex->h = larger_pow2(tex->h);
> 	}
> @@ -337,7 +349,7 @@
> 		return NULL;
> 	}
>
> -	if (!GLEW_ARB_texture_non_power_of_two) {
> +	if (!GPU_non_power_of_two_support()) {
> 		tex->w = larger_pow2(tex->w);
> 		tex->h = larger_pow2(tex->h);
> 		tex->depth = larger_pow2(tex->depth);
>
> Modified: trunk/blender/source/blender/windowmanager/intern/wm_draw.c
> ===================================================================
> --- trunk/blender/source/blender/windowmanager/intern/wm_draw.c	 
> 2009-10-19 10:07:19 UTC (rev 23939)
> +++ trunk/blender/source/blender/windowmanager/intern/wm_draw.c	 
> 2009-10-19 10:10:05 UTC (rev 23940)
> @@ -376,7 +376,7 @@
> 		triple->x[0]= win->sizex;
> 		triple->y[0]= win->sizey;
> 	}
> -	else if(GLEW_ARB_texture_non_power_of_two) {
> +	else if(GPU_non_power_of_two_support()) {
> 		triple->target= GL_TEXTURE_2D;
> 		triple->nx= 1;
> 		triple->ny= 1;
>
> Modified: trunk/blender/source/gameengine/BlenderRoutines/ 
> BL_KetsjiEmbedStart.cpp
> ===================================================================
> --- trunk/blender/source/gameengine/BlenderRoutines/ 
> BL_KetsjiEmbedStart.cpp	2009-10-19 10:07:19 UTC (rev 23939)
> +++ trunk/blender/source/gameengine/BlenderRoutines/ 
> BL_KetsjiEmbedStart.cpp	2009-10-19 10:10:05 UTC (rev 23940)
> @@ -356,7 +356,7 @@
> 			if(GLEW_ARB_multitexture && GLEW_VERSION_1_1)
> 				usemat = true;
>
> -			if(GPU_extensions_minimum_support())
> +			if(GPU_glsl_support())
> 				useglslmat = true;
> 			else if(blscene->gm.matmode == GAME_MAT_GLSL)
> 				usemat = false;
>
> Modified: trunk/blender/source/gameengine/GamePlayer/ghost/ 
> GPG_Application.cpp
> ===================================================================
> --- trunk/blender/source/gameengine/GamePlayer/ghost/ 
> GPG_Application.cpp	2009-10-19 10:07:19 UTC (rev 23939)
> +++ trunk/blender/source/gameengine/GamePlayer/ghost/ 
> GPG_Application.cpp	2009-10-19 10:10:05 UTC (rev 23940)
> @@ -539,7 +539,7 @@
> 		if(GLEW_ARB_multitexture && GLEW_VERSION_1_1)
> 			m_blendermat = (SYS_GetCommandLineInt(syshandle,  
> "blender_material", 1) != 0);
>
> -		if(GPU_extensions_minimum_support())
> +		if(GPU_glsl_support())
> 			m_blenderglslmat = (SYS_GetCommandLineInt(syshandle,  
> "blender_glsl_material", 1) != 0);
> 		else if(gm->matmode == GAME_MAT_GLSL)
> 			m_blendermat = false;
>
>
> _______________________________________________
> Bf-blender-cvs mailing list
> Bf-blender-cvs at blender.org
> http://lists.blender.org/mailman/listinfo/bf-blender-cvs
>



More information about the Bf-committers mailing list