Commit: 84db9fdf4dd3bb5e1ddd6c2884787033386ac2ca
Author: Campbell Barton
Date:   Tue Apr 28 01:14:48 2015 +1000
Branches: master
https://developer.blender.org/rB84db9fdf4dd3bb5e1ddd6c2884787033386ac2ca

Fix T44464: Viewport mipmaps no longer toggle off

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

M       source/blender/gpu/intern/gpu_draw.c
M       source/creator/creator.c
M       
source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp

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

diff --git a/source/blender/gpu/intern/gpu_draw.c 
b/source/blender/gpu/intern/gpu_draw.c
index a31e90f..a24067f 100644
--- a/source/blender/gpu/intern/gpu_draw.c
+++ b/source/blender/gpu/intern/gpu_draw.c
@@ -239,8 +239,12 @@ static struct GPUTextureState {
        int curtileYRep, tileYRep;
        Image *ima, *curima;
 
-       bool domipmap, linearmipmap;
-       bool texpaint; /* store this so that new images created while texture 
painting won't be set to mipmapped */
+       /* also controls min/mag filtering */
+       bool domipmap;
+       /* only use when 'domipmap' is set */
+       bool linearmipmap;
+       /* store this so that new images created while texture painting won't 
be set to mipmapped */
+       bool texpaint;
 
        int alphablend;
        float anisotropic;
@@ -292,7 +296,6 @@ void GPU_set_mipmap(bool mipmap)
 void GPU_set_linear_mipmap(bool linear)
 {
        if (GTS.linearmipmap != linear) {
-               GPU_free_images();
                GTS.linearmipmap = linear;
        }
 }
@@ -312,18 +315,23 @@ static GLenum gpu_get_mipmap_filter(bool mag)
        /* linearmipmap is off by default *when mipmapping is off,
         * use unfiltered display */
        if (mag) {
-               if (GTS.linearmipmap || GTS.domipmap)
+               if (GTS.domipmap)
                        return GL_LINEAR;
                else
                        return GL_NEAREST;
        }
        else {
-               if (GTS.linearmipmap)
-                       return GL_LINEAR_MIPMAP_LINEAR;
-               else if (GTS.domipmap)
-                       return GL_LINEAR_MIPMAP_NEAREST;
-               else
+               if (GTS.domipmap) {
+                       if (GTS.linearmipmap) {
+                               return GL_LINEAR_MIPMAP_LINEAR;
+                       }
+                       else {
+                               return GL_LINEAR_MIPMAP_NEAREST;
+                       }
+               }
+               else {
                        return GL_NEAREST;
+               }
        }
 }
 
diff --git a/source/creator/creator.c b/source/creator/creator.c
index d86ccd6..721e43c 100644
--- a/source/creator/creator.c
+++ b/source/creator/creator.c
@@ -1024,6 +1024,7 @@ static int set_ge_parameters(int argc, const char **argv, 
void *data)
                        }
                        /* linearMipMap */
                        if (STREQ(argv[a], "linearmipmap")) {
+                               GPU_set_mipmap(1);
                                GPU_set_linear_mipmap(1); //linearMipMap = 1;
                        }
 
diff --git 
a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp 
b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
index f47f565..95c153a 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
@@ -1074,12 +1074,17 @@ void RAS_OpenGLRasterizer::SetMipmapping(MipmapOption 
val)
 
 RAS_IRasterizer::MipmapOption RAS_OpenGLRasterizer::GetMipmapping()
 {
-       if (GPU_get_linear_mipmap())
-               return RAS_IRasterizer::RAS_MIPMAP_LINEAR;
-       else if (GPU_get_mipmap())
-               return RAS_IRasterizer::RAS_MIPMAP_NEAREST;
-       else
+       if (GPU_get_mipmap()) {
+               if (GPU_get_linear_mipmap()) {
+                       return RAS_IRasterizer::RAS_MIPMAP_LINEAR;
+               }
+               else {
+                       return RAS_IRasterizer::RAS_MIPMAP_NEAREST;
+               }
+       }
+       else {
                return RAS_IRasterizer::RAS_MIPMAP_NONE;
+       }
 }
 
 void RAS_OpenGLRasterizer::SetUsingOverrideShader(bool val)

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to