[Bf-committers] [Bf-blender-cvs] SVN commit: /data/svn/bf-blender [52782] trunk/blender: Fix #33417: add back GPU Mipmap Generation option, apparently with this disabled

Mitchell Stokes mogurijin at gmail.com
Tue Dec 11 06:16:22 CET 2012


I wish I would have caught this sooner, but U.use_gpu_mipmap will always be
false in the Blenderplayer. The Blenderplayer doesn't make use of user
preferences and instead grabs settings from the command line or values
saved in Scene data. If you look at line 487 of GPG_ghost.cpp, then you'll
see that U.anisotropic_filter is explicitly set prior to the
GPU_set_anisotropic() call.

Cheers,
Mitchell Stokes

On Wed, Dec 5, 2012 at 3:46 AM, Brecht Van Lommel <
brechtvanlommel at pandora.be> wrote:

> Revision: 52782
>
> http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=52782
> Author:   blendix
> Date:     2012-12-05 11:46:13 +0000 (Wed, 05 Dec 2012)
> Log Message:
> -----------
> Fix #33417: add back GPU Mipmap Generation option, apparently with this
> disabled
> it takes up less memory on some cards, still unclear why.
>
> Modified Paths:
> --------------
>     trunk/blender/release/scripts/startup/bl_ui/space_userpref.py
>     trunk/blender/source/blender/gpu/GPU_draw.h
>     trunk/blender/source/blender/gpu/intern/gpu_draw.c
>     trunk/blender/source/blender/makesrna/intern/rna_userdef.c
>     trunk/blender/source/blender/windowmanager/intern/wm_init_exit.c
>     trunk/blender/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
>
> Modified: trunk/blender/release/scripts/startup/bl_ui/space_userpref.py
> ===================================================================
> --- trunk/blender/release/scripts/startup/bl_ui/space_userpref.py
> 2012-12-05 06:30:17 UTC (rev 52781)
> +++ trunk/blender/release/scripts/startup/bl_ui/space_userpref.py
> 2012-12-05 11:46:13 UTC (rev 52782)
> @@ -437,6 +437,7 @@
>          col.label(text="OpenGL:")
>          col.prop(system, "gl_clip_alpha", slider=True)
>          col.prop(system, "use_mipmaps")
> +        col.prop(system, "use_gpu_mipmap")
>          col.prop(system, "use_16bit_textures")
>          col.label(text="Anisotropic Filtering")
>          col.prop(system, "anisotropic_filter", text="")
>
> Modified: trunk/blender/source/blender/gpu/GPU_draw.h
> ===================================================================
> --- trunk/blender/source/blender/gpu/GPU_draw.h 2012-12-05 06:30:17 UTC
> (rev 52781)
> +++ trunk/blender/source/blender/gpu/GPU_draw.h 2012-12-05 11:46:13 UTC
> (rev 52782)
> @@ -116,7 +116,7 @@
>  float GPU_get_anisotropic(void);
>
>  /* enable gpu mipmapping */
> -void GPU_set_gpu_mipmapping(void);
> +void GPU_set_gpu_mipmapping(int gpu_mipmap);
>
>  /* Image updates and free
>   * - these deal with images bound as opengl textures */
>
> Modified: trunk/blender/source/blender/gpu/intern/gpu_draw.c
> ===================================================================
> --- trunk/blender/source/blender/gpu/intern/gpu_draw.c  2012-12-05
> 06:30:17 UTC (rev 52781)
> +++ trunk/blender/source/blender/gpu/intern/gpu_draw.c  2012-12-05
> 11:46:13 UTC (rev 52782)
> @@ -240,10 +240,16 @@
>
>  /* Mipmap settings */
>
> -void GPU_set_gpu_mipmapping()
> +void GPU_set_gpu_mipmapping(int gpu_mipmap)
>  {
> -       /* always enable if it's supported */
> -       GTS.gpu_mipmap = GLEW_EXT_framebuffer_object;
> +       int old_value = GTS.gpu_mipmap;
> +
> +       /* only actually enable if it's supported */
> +       GTS.gpu_mipmap = gpu_mipmap && GLEW_EXT_framebuffer_object;
> +
> +       if (old_value != GTS.gpu_mipmap) {
> +               GPU_free_images();
> +       }
>  }
>
>  void GPU_set_mipmap(int mipmap)
>
> Modified: trunk/blender/source/blender/makesrna/intern/rna_userdef.c
> ===================================================================
> --- trunk/blender/source/blender/makesrna/intern/rna_userdef.c  2012-12-05
> 06:30:17 UTC (rev 52781)
> +++ trunk/blender/source/blender/makesrna/intern/rna_userdef.c  2012-12-05
> 11:46:13 UTC (rev 52782)
> @@ -144,6 +144,12 @@
>         rna_userdef_update(bmain, scene, ptr);
>  }
>
> +static void rna_userdef_gl_gpu_mipmaps(Main *bmain, Scene *scene,
> PointerRNA *ptr)
> +{
> +       GPU_set_gpu_mipmapping(U.use_gpu_mipmap);
> +       rna_userdef_update(bmain, scene, ptr);
> +}
> +
>  static void rna_userdef_gl_texture_limit_update(Main *bmain, Scene
> *scene, PointerRNA *ptr)
>  {
>         GPU_free_images();
> @@ -3218,6 +3224,11 @@
>         RNA_def_property_ui_text(prop, "16 Bit Float Textures", "Use 16
> bit per component texture for float images");
>         RNA_def_property_update(prop, 0,
> "rna_userdef_gl_use_16bit_textures");
>
> +       prop = RNA_def_property(srna, "use_gpu_mipmap", PROP_BOOLEAN,
> PROP_NONE);
> +       RNA_def_property_boolean_sdna(prop, NULL, "use_gpu_mipmap", 1);
> +       RNA_def_property_ui_text(prop, "GPU Mipmap Generation", "Generate
> Image Mipmaps on the GPU");
> +       RNA_def_property_update(prop, 0, "rna_userdef_gl_gpu_mipmaps");
> +
>         prop = RNA_def_property(srna, "use_vertex_buffer_objects",
> PROP_BOOLEAN, PROP_NONE);
>         RNA_def_property_boolean_negative_sdna(prop, NULL, "gameflags",
> USER_DISABLE_VBO);
>         RNA_def_property_ui_text(prop, "VBOs",
>
> Modified: trunk/blender/source/blender/windowmanager/intern/wm_init_exit.c
> ===================================================================
> --- trunk/blender/source/blender/windowmanager/intern/wm_init_exit.c
>  2012-12-05 06:30:17 UTC (rev 52781)
> +++ trunk/blender/source/blender/windowmanager/intern/wm_init_exit.c
>  2012-12-05 11:46:13 UTC (rev 52782)
> @@ -183,7 +183,7 @@
>                 GPU_extensions_init();
>                 GPU_set_mipmap(!(U.gameflags & USER_DISABLE_MIPMAP));
>                 GPU_set_anisotropic(U.anisotropic_filter);
> -               GPU_set_gpu_mipmapping();
> +               GPU_set_gpu_mipmapping(U.use_gpu_mipmap);
>
>                 UI_init();
>         }
>
> Modified: trunk/blender/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
> ===================================================================
> --- trunk/blender/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
>  2012-12-05 06:30:17 UTC (rev 52781)
> +++ trunk/blender/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
>  2012-12-05 11:46:13 UTC (rev 52782)
> @@ -756,7 +756,7 @@
>                 }
>
>                 GPU_set_anisotropic(U.anisotropic_filter);
> -               GPU_set_gpu_mipmapping();
> +               GPU_set_gpu_mipmapping(U.use_gpu_mipmap);
>
>                 // Create the system
>                 if (GHOST_ISystem::createSystem() == GHOST_kSuccess)
>
> _______________________________________________
> 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