[mupen64plus-video-rice] 35/191: Imported Upstream version 1.99.4

Sven Eckelmann ecsv-guest at moszumanska.debian.org
Thu Nov 26 06:17:13 UTC 2015


This is an automated email from the git hooks/post-receive script.

ecsv-guest pushed a commit to branch armhf_test
in repository mupen64plus-video-rice.

commit 3009f0d89779fc1694f2897a34e945bc47ac0ee5
Author: Sven Eckelmann <sven.eckelmann at gmx.de>
Date:   Wed Nov 24 20:46:47 2010 +0100

    Imported Upstream version 1.99.4
---
 RELEASE                    | 11 +++++++++++
 projects/unix/Makefile     | 20 +++++++++++++-------
 src/Config.cpp             | 24 +++++++++++++----------
 src/Config.h               | 22 +++++++++++++++-------
 src/OGLExtRender.cpp       | 47 ++++++++++++++++++++++++++++++++++++++++++++--
 src/OGLGraphicsContext.cpp | 36 +++++++++++++++++++++++++++++++++++
 src/OGLGraphicsContext.h   |  6 ++++++
 src/OGLRender.cpp          |  8 +++++++-
 src/OGLTexture.cpp         | 33 ++++++++++++++++++++++++++++++--
 src/Render.cpp             |  1 -
 src/Render.h               |  2 +-
 src/osal_files.h           |  7 ++++++-
 src/osal_files_unix.c      |  1 -
 src/version.h              |  2 +-
 14 files changed, 186 insertions(+), 34 deletions(-)

diff --git a/RELEASE b/RELEASE
index c81d3eb..f2a86f2 100644
--- a/RELEASE
+++ b/RELEASE
@@ -1,6 +1,17 @@
 Mupen64Plus-Video-Rice RELEASE
 ------------------------------
 
+Mupen64Plus-Video-Rice v1.99.4 - November 22, 2010
+--------------------------------------------------
+ - new feature: anisotropic filtering
+ - new feature: trilinear filtering
+ - new feature: mipmaps
+ - cleaned up FindScaleFactor function based upon r45 of the 1964 repo
+ - bugfix: buffer overrun (and crash) when reading vendor string info on some opengl implementations
+ - API change for reading the video buffer: new interface is more flexible and avoids some potential problems
+ - support for anti-aliasing (GL_MULTISAMPLE)
+ - makefile fixes, improvements, and code cleanups
+
 Mupen64Plus-Video-Rice v1.99.3 - February 13, 2010
 --------------------------------------------------
  - sync with core<-->plugin API change for RomOpen()
diff --git a/projects/unix/Makefile b/projects/unix/Makefile
index 84febf7..cc275e6 100644
--- a/projects/unix/Makefile
+++ b/projects/unix/Makefile
@@ -34,6 +34,11 @@ ifeq ("$(UNAME)","linux")
   SO_EXTENSION = so
   SHARED = -shared
 endif
+ifneq ("$(filter GNU hurd,$(UNAME))","")
+  OS = LINUX
+  SO_EXTENSION = so
+  SHARED = -shared
+endif
 ifeq ("$(UNAME)","Darwin")
   OS = OSX
   SO_EXTENSION = dylib
@@ -86,7 +91,7 @@ endif
 # base CFLAGS, LIBS, and LDFLAGS
 CFLAGS += -Wall -ffast-math -funroll-loops -fexpensive-optimizations -fno-strict-aliasing -fvisibility=hidden -I../../src
 CXXFLAGS += -fvisibility-inlines-hidden
-LDFLAGS += -ldl -lpng
+LDFLAGS += -lpng
 
 # Since we are building a shared library, we must compile with -fPIC for x86_64 CPUs.
 # On 32-bit systems we do not want to use -fPIC because we don't have to and it has a big performance penalty on this arch
@@ -104,10 +109,11 @@ endif
 
 # set special flags per-system
 ifeq ($(OS),FREEBSD)
-  LDFLAGS += -lGL
+  LDFLAGS += -lGL $(shell pkg-config --libs libpng)
+  CFLAGS += $(shell pkg-config --cflags libpng)
 endif
 ifeq ($(OS), LINUX)
-  LDFLAGS += -lGL
+  LDFLAGS += -ldl -lGL
   # only export api symbols
   LDFLAGS += -Wl,-version-script,$(SRCDIR)/video_api_export.ver
   ifeq ($(CPU), X86)
@@ -122,10 +128,10 @@ ifeq ($(OS), OSX)
   ifeq ($(CPU), X86)
     ifeq ($(ARCH_DETECTED), 64BITS)
       CFLAGS += -pipe -O3 -arch x86_64 -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk
-      LDFLAGS += -bundle -framework OpenGL -arch x86_64
+      LDFLAGS += -ldl -bundle -framework OpenGL -arch x86_64
     else
       CFLAGS += -pipe -O3 -mmmx -msse -fomit-frame-pointer -arch i686 -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk
-      LDFLAGS += -bundle -framework OpenGL -arch i686
+      LDFLAGS += -ldl -bundle -framework OpenGL -arch i686
     endif
   endif
 endif
@@ -138,8 +144,8 @@ ifeq ($(shell which sdl-config 2>/dev/null),)
   $(error No SDL development libraries found!)
 endif
 ifeq ($(OS),FREEBSD)
-    CFLAGS  += `${SDL_CONFIG} --cflags`
-    LDFLAGS += `${SDL_CONFIG} --libs`
+    CFLAGS  += $(shell sdl-config --cflags) -DPIC
+    LDFLAGS += $(shell sdl-config --libs) -DPIC
 endif
 ifeq ($(OS),OSX)
     CFLAGS  += $(shell sdl-config --cflags) -DPIC
diff --git a/src/Config.cpp b/src/Config.cpp
index 0325443..248b955 100644
--- a/src/Config.cpp
+++ b/src/Config.cpp
@@ -21,7 +21,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #include <fstream>
 
 #include <stdlib.h>
-#include <limits.h> // PATH_MAX
 
 #include "osal_preproc.h"
 #include "m64p_types.h"
@@ -144,7 +143,6 @@ SettingInfo ForceTextureFilterSettings[] =
 {"N64 Default Texture Filter",  FORCE_DEFAULT_FILTER},
 {"Force Nearest Filter (faster, low quality)", FORCE_POINT_FILTER},
 {"Force Linear Filter (slower, better quality)", FORCE_LINEAR_FILTER},
-//{"Force Bilinear Filter slower, best quality", FORCE_BILINEAR_FILTER}, 
 };
 
 SettingInfo TextureEnhancementSettings[] =
@@ -332,7 +330,6 @@ BOOL InitConfiguration(void)
     ConfigSetDefaultBool(l_ConfigVideoRice, "DefaultCombinerDisable", FALSE, "Force to use normal color combiner");
 
     ConfigSetDefaultBool(l_ConfigVideoRice, "EnableHacks", TRUE, "Enable game-specific settings from INI file");
-    ConfigSetDefaultBool(l_ConfigVideoRice, "EnableFog", FALSE, "Enable or disable fog generation");
     ConfigSetDefaultBool(l_ConfigVideoRice, "WinFrameMode", FALSE, "If enabled, graphics will be drawn in WinFrame mode instead of solid and texture mode");
     ConfigSetDefaultBool(l_ConfigVideoRice, "FullTMEMEmulation", FALSE, "N64 Texture Memory Full Emulation (may fix some games, may break others)");
     ConfigSetDefaultBool(l_ConfigVideoRice, "OpenGLVertexClipper", FALSE, "Enable vertex clipper for fog operations");
@@ -344,15 +341,19 @@ BOOL InitConfiguration(void)
     ConfigSetDefaultBool(l_ConfigVideoRice, "LoadHiResTextures", FALSE, "Enable hi-resolution texture file loading");
     ConfigSetDefaultBool(l_ConfigVideoRice, "DumpTexturesToFiles", FALSE, "Enable texture dumping");
     ConfigSetDefaultBool(l_ConfigVideoRice, "ShowFPS", FALSE, "Display On-screen FPS");
-
-    ConfigSetDefaultInt(l_ConfigVideoRice, "TextureEnhancement", 0, "Primary texture filter (0=None, 1=2X, 2=2XSAI, 3=HQ2X, 4=LQ2X, 5=HQ4X, 6=Sharpen, 7=Sharpen More, 8=External, 9=Mirrored)");
-    ConfigSetDefaultInt(l_ConfigVideoRice, "TextureEnhancementControl", 0, "Secondary texture filter (0 = none, 1-4 = filtered)");
-    ConfigSetDefaultInt(l_ConfigVideoRice, "ForceTextureFilter", 0, "Texture filter to use (0=default, 1=nearest neighbor, 2=linear, 3=bilinear)");
-    ConfigSetDefaultInt(l_ConfigVideoRice, "TextureQuality", TXT_QUALITY_DEFAULT, "Color bit depth to use for textures (0=default, 1=32 bits, 2=16 bits");
+    ConfigSetDefaultBool(l_ConfigVideoRice, "EnableMipmaping", TRUE, "Enable/Disable Mipmaping");
+
+    ConfigSetDefaultInt(l_ConfigVideoRice, "FogMethod", 0, "Enable, Disable or Force fog generation (0=Disable, 1=Enable n64 choose, 2=Force Fog)");
+    ConfigSetDefaultInt(l_ConfigVideoRice, "ForceTextureFilter", 0, "Force to use texture filtering or not (0=auto: n64 choose, 1=force no filtering, 2=force filtering)");
+    ConfigSetDefaultInt(l_ConfigVideoRice, "TextureFilteringMethod", 1, "Choose wich texture filtering method will be used by your graphic card(0=no filtering, 1=bilinear, 2=trilinear)");
+    ConfigSetDefaultInt(l_ConfigVideoRice, "TextureEnhancement", 0, "Primary texture enhancement filter (0=None, 1=2X, 2=2XSAI, 3=HQ2X, 4=LQ2X, 5=HQ4X, 6=Sharpen, 7=Sharpen More, 8=External, 9=Mirrored)");
+    ConfigSetDefaultInt(l_ConfigVideoRice, "TextureEnhancementControl", 0, "Secondary texture enhancement filter (0 = none, 1-4 = filtered)");
+    ConfigSetDefaultInt(l_ConfigVideoRice, "TextureQuality", TXT_QUALITY_DEFAULT, "Color bit depth to use for textures (0=default, 1=32 bits, 2=16 bits)");
     ConfigSetDefaultInt(l_ConfigVideoRice, "OpenGLDepthBufferSetting", 16, "Z-buffer depth (only 16 or 32)");
     ConfigSetDefaultInt(l_ConfigVideoRice, "MultiSampling", 0, "Enable/Disable MultiSampling (0=off, 2,4,8,16=quality)");
     ConfigSetDefaultInt(l_ConfigVideoRice, "ColorQuality", TEXTURE_FMT_A8R8G8B8, "Color bit depth for rendering window (0=32 bits, 1=16 bits)");
     ConfigSetDefaultInt(l_ConfigVideoRice, "OpenGLRenderSetting", OGL_DEVICE, "OpenGL level to support (0=auto, 1=OGL_1.1, 2=OGL_1.2, 3=OGL_1.3, 4=OGL_1.4, 5=OGL_1.4_V2, 6=OGL_TNT2, 7=NVIDIA_OGL, 8=OGL_FRAGMENT_PROGRAM)");
+    ConfigSetDefaultInt(l_ConfigVideoRice, "AnisotropicFiltering", 0, "Enable/Disable Anisotropic Filtering for Mipmaping (0=no filtering, 2-16=quality). This is uneffective if EnableMipmaping is false. If the given value is to high to be supported by your graphic card, the value will be the highest value your graphic card can support. Better result with Trilinear filtering");
     return TRUE;
 }
 
@@ -441,7 +442,6 @@ static void ReadConfiguration(void)
     defaultRomOptions.bNormalCombiner = ConfigGetParamBool(l_ConfigVideoRice, "DefaultCombinerDisable");
 
     options.bEnableHacks = ConfigGetParamBool(l_ConfigVideoRice, "EnableHacks");
-    options.bEnableFog = ConfigGetParamBool(l_ConfigVideoRice, "EnableFog");
     options.bWinFrameMode = ConfigGetParamBool(l_ConfigVideoRice, "WinFrameMode");
     options.bFullTMEM = ConfigGetParamBool(l_ConfigVideoRice, "FullTMEMEmulation");
     options.bOGLVertexClipper = ConfigGetParamBool(l_ConfigVideoRice, "OpenGLVertexClipper");
@@ -453,15 +453,19 @@ static void ReadConfiguration(void)
     options.bLoadHiResTextures = ConfigGetParamBool(l_ConfigVideoRice, "LoadHiResTextures");
     options.bDumpTexturesToFiles = ConfigGetParamBool(l_ConfigVideoRice, "DumpTexturesToFiles");
     options.bShowFPS = ConfigGetParamBool(l_ConfigVideoRice, "ShowFPS");
+    options.bEnableMipmaping = ConfigGetParamBool(l_ConfigVideoRice, "EnableMipmaping");
 
+    options.fogMethod = ConfigGetParamInt(l_ConfigVideoRice, "FogMethod");
+    options.forceTextureFilter = ConfigGetParamInt(l_ConfigVideoRice, "ForceTextureFilter");
+    options.textureFilteringMethod = ConfigGetParamInt(l_ConfigVideoRice, "TextureFilteringMethod");
     options.textureEnhancement = ConfigGetParamInt(l_ConfigVideoRice, "TextureEnhancement");
     options.textureEnhancementControl = ConfigGetParamInt(l_ConfigVideoRice, "TextureEnhancementControl");
-    options.forceTextureFilter = ConfigGetParamInt(l_ConfigVideoRice, "ForceTextureFilter");
     options.textureQuality = ConfigGetParamInt(l_ConfigVideoRice, "TextureQuality");
     options.OpenglDepthBufferSetting = ConfigGetParamInt(l_ConfigVideoRice, "OpenGLDepthBufferSetting");
     options.multiSampling = ConfigGetParamInt(l_ConfigVideoRice, "MultiSampling");
     options.colorQuality = ConfigGetParamInt(l_ConfigVideoRice, "ColorQuality");
     options.OpenglRenderSetting = ConfigGetParamInt(l_ConfigVideoRice, "OpenGLRenderSetting");
+    options.anisotropicFiltering = ConfigGetParamInt(l_ConfigVideoRice, "AnisotropicFiltering");
 
     CDeviceBuilder::SelectDeviceType((SupportedDeviceType)options.OpenglRenderSetting);
 
diff --git a/src/Config.h b/src/Config.h
index 1dc7429..bd9bab2 100644
--- a/src/Config.h
+++ b/src/Config.h
@@ -102,15 +102,12 @@ enum {
     FORCE_DEFAULT_FILTER,
     FORCE_POINT_FILTER,
     FORCE_LINEAR_FILTER,
-    FORCE_BILINEAR_FILTER,
 };
 
 enum {
-    TEXTURE_ENHANCEMENT_NORMAL,
-    TEXTURE_ENHANCEMENT_WITH_SMOOTH_FILTER_1,
-    TEXTURE_ENHANCEMENT_WITH_SMOOTH_FILTER_2,
-    TEXTURE_ENHANCEMENT_WITH_SMOOTH_FILTER_3,
-    TEXTURE_ENHANCEMENT_WITH_SMOOTH_FILTER_4,
+    TEXTURE_NO_FILTER,
+    TEXTURE_BILINEAR_FILTER,
+    TEXTURE_TRILINEAR_FILTER,
 };
 
 enum {
@@ -127,6 +124,14 @@ enum {
 };
 
 enum {
+    TEXTURE_ENHANCEMENT_NORMAL,
+    TEXTURE_ENHANCEMENT_WITH_SMOOTH_FILTER_1,
+    TEXTURE_ENHANCEMENT_WITH_SMOOTH_FILTER_2,
+    TEXTURE_ENHANCEMENT_WITH_SMOOTH_FILTER_3,
+    TEXTURE_ENHANCEMENT_WITH_SMOOTH_FILTER_4,
+};
+
+enum {
     SCREEN_UPDATE_DEFAULT = 0,
     SCREEN_UPDATE_AT_VI_UPDATE = 1,
     SCREEN_UPDATE_AT_VI_CHANGE = 2,
@@ -196,7 +201,6 @@ enum {
 
 typedef struct {
     BOOL    bEnableHacks;
-    BOOL    bEnableFog;
     BOOL    bWinFrameMode;
     BOOL    bOGLVertexClipper;
     BOOL    bEnableSSE;
@@ -206,11 +210,15 @@ typedef struct {
     BOOL    bUseFullTMEM;
 
     BOOL    bShowFPS;
+    BOOL    bEnableMipmaping;
 
+    uint32  fogMethod;
     uint32  forceTextureFilter;
+    uint32  textureFilteringMethod;
     uint32  textureEnhancement;
     uint32  textureEnhancementControl;
     uint32  textureQuality;
+    uint32  anisotropicFiltering;
     uint32  multiSampling;
     BOOL    bTexRectOnly;
     BOOL    bSmallTextureOnly;
diff --git a/src/OGLExtRender.cpp b/src/OGLExtRender.cpp
index abecf0b..7cc1e1c 100644
--- a/src/OGLExtRender.cpp
+++ b/src/OGLExtRender.cpp
@@ -236,10 +236,53 @@ void COGLExtRender::ApplyTextureFilter()
 {
     static uint32 minflag[8], magflag[8];
     static uint32 mtex[8];
+
+    int iMinFilter, iMagFilter;
+
     for( int i=0; i<m_maxTexUnits; i++ )
     {
-        int iMinFilter = (m_dwMinFilter == FILTER_LINEAR ? GL_LINEAR : GL_NEAREST);
-        int iMagFilter = (m_dwMagFilter == FILTER_LINEAR ? GL_LINEAR : GL_NEAREST);
+        //Compute iMinFilter and iMagFilter
+        if(m_dwMinFilter == FILTER_LINEAR) //Texture will use filtering
+        {
+            iMagFilter = GL_LINEAR;
+
+            if(options.bEnableMipmaping)
+            {
+                //Texture filtering method user want
+                switch(options.textureFilteringMethod)
+                {
+                case TEXTURE_BILINEAR_FILTER:
+                    iMinFilter = GL_LINEAR_MIPMAP_NEAREST;
+                    break;
+                case TEXTURE_TRILINEAR_FILTER:
+                    iMinFilter = GL_LINEAR_MIPMAP_LINEAR;
+                    break;
+                case TEXTURE_NO_FILTER:
+                default:
+                    iMinFilter = GL_NEAREST_MIPMAP_NEAREST;
+                    break;
+                }
+            }
+            else
+            {
+                //Bilinear without mipmap
+                iMinFilter = GL_LINEAR;
+            }
+        }
+        else    //dont use filtering, all is nearest
+        {
+            iMagFilter = GL_NEAREST;
+
+            if(options.bEnableMipmaping)
+            {
+                iMinFilter = GL_NEAREST_MIPMAP_NEAREST;
+            }
+            else
+            {
+                iMinFilter = GL_NEAREST;
+            }
+        }
+
         if( m_texUnitEnabled[i] )
         {
             if( mtex[i] != m_curBoundTex[i] )
diff --git a/src/OGLGraphicsContext.cpp b/src/OGLGraphicsContext.cpp
index 1a227aa..3dd92d0 100644
--- a/src/OGLGraphicsContext.cpp
+++ b/src/OGLGraphicsContext.cpp
@@ -90,6 +90,7 @@ bool COGLGraphicsContext::Initialize(uint32 dwWidth, uint32 dwHeight, BOOL bWind
     CoreVideo_GL_SetAttribute(M64P_GL_BUFFER_SIZE, colorBufferDepth);
     CoreVideo_GL_SetAttribute(M64P_GL_DEPTH_SIZE, depthBufferDepth);
 
+    /* set multisampling */
     if (options.multiSampling > 0)
     {
         CoreVideo_GL_SetAttribute(M64P_GL_MULTISAMPLEBUFFERS, 1);
@@ -213,6 +214,31 @@ void COGLGraphicsContext::InitOGLExtension(void)
     // Optional extension features
     m_bSupportRescaleNormal = IsExtensionSupported("GL_EXT_rescale_normal");
     m_bSupportLODBias = IsExtensionSupported("GL_EXT_texture_lod_bias");
+    m_bSupportAnisotropicFiltering = IsExtensionSupported("GL_EXT_texture_filter_anisotropic");
+
+    // Compute maxAnisotropicFiltering
+    m_maxAnisotropicFiltering = 0;
+
+    if( m_bSupportAnisotropicFiltering
+    && (options.anisotropicFiltering == 2
+        || options.anisotropicFiltering == 4
+        || options.anisotropicFiltering == 8
+        || options.anisotropicFiltering == 16))
+    {
+        //Get the max value of aniso that the graphic card support
+        glGetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &m_maxAnisotropicFiltering);
+        OPENGL_CHECK_ERRORS;
+
+        // If user want more aniso than hardware can do
+        if(options.anisotropicFiltering > (uint32) m_maxAnisotropicFiltering)
+        {
+            DebugMessage(M64MSG_INFO, "A value of '%i' is set for AnisotropicFiltering option but the hardware has a maximum value of '%i' so this will be used", options.anisotropicFiltering, m_maxAnisotropicFiltering);
+        }
+
+        //check if user want less anisotropy than hardware can do
+        if((uint32) m_maxAnisotropicFiltering > options.anisotropicFiltering)
+        m_maxAnisotropicFiltering = options.anisotropicFiltering;
+    }
 
     // Nvidia only extension features (optional)
     m_bSupportNVRegisterCombiner = IsExtensionSupported("GL_NV_register_combiners");
@@ -400,3 +426,13 @@ void COGLGraphicsContext::InitDeviceParameters()
     status.isVertexShaderEnabled = false;   // Disable it for now
 }
 
+// Get methods
+bool COGLGraphicsContext::IsSupportAnisotropicFiltering()
+{
+    return m_bSupportAnisotropicFiltering;
+}
+
+int COGLGraphicsContext::getMaxAnisotropicFiltering()
+{
+    return m_maxAnisotropicFiltering;
+}
\ No newline at end of file
diff --git a/src/OGLGraphicsContext.h b/src/OGLGraphicsContext.h
index 99335ac..a16d152 100644
--- a/src/OGLGraphicsContext.h
+++ b/src/OGLGraphicsContext.h
@@ -40,6 +40,10 @@ public:
     bool IsWglExtensionSupported(const char* pExtName);
     static void InitDeviceParameters();
 
+    //Get methods (TODO, remove all friend class and use get methods instead)
+    bool IsSupportAnisotropicFiltering();
+    int  getMaxAnisotropicFiltering();
+
 protected:
     friend class OGLDeviceBuilder;
     COGLGraphicsContext();
@@ -59,6 +63,8 @@ protected:
     // Optional OGL extension features;
     bool    m_bSupportRescaleNormal;
     bool    m_bSupportLODBias;
+    bool    m_bSupportAnisotropicFiltering;
+    int     m_maxAnisotropicFiltering;
 
     // Nvidia OGL only features
     bool    m_bSupportTextureMirrorRepeat;
diff --git a/src/OGLRender.cpp b/src/OGLRender.cpp
index 252b5d5..7ae7e7d 100644
--- a/src/OGLRender.cpp
+++ b/src/OGLRender.cpp
@@ -947,7 +947,13 @@ void OGLRender::SetFogEnable(bool bEnable)
 {
     DEBUGGER_IF_DUMP( (gRSP.bFogEnabled != (bEnable==TRUE) && logFog ), TRACE1("Set Fog %s", bEnable? "enable":"disable"));
 
-    gRSP.bFogEnabled = bEnable&&options.bEnableFog;
+    gRSP.bFogEnabled = bEnable&&(options.fogMethod == 1);
+    
+    // If force fog
+    if(options.fogMethod == 2)
+    {
+        gRSP.bFogEnabled = true;
+    }
 
     if( gRSP.bFogEnabled )
     {
diff --git a/src/OGLTexture.cpp b/src/OGLTexture.cpp
index 273f71f..00e7048 100644
--- a/src/OGLTexture.cpp
+++ b/src/OGLTexture.cpp
@@ -21,6 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #include "Config.h"
 #include "Debugger.h"
 #include "OGLDebug.h"
+#include "OGLGraphicsContext.h"
 #include "OGLTexture.h"
 #include "TextureManager.h"
 
@@ -94,12 +95,40 @@ bool COGLTexture::StartUpdate(DrawInfo *di)
 
 void COGLTexture::EndUpdate(DrawInfo *di)
 {
+    COGLGraphicsContext *pcontext = (COGLGraphicsContext *)(CGraphicsContext::g_pGraphicsContext);	// we need this to check if the GL extension is avaible
+
     glBindTexture(GL_TEXTURE_2D, m_dwTextureName);
     OPENGL_CHECK_ERRORS;
-    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
-    OPENGL_CHECK_ERRORS;
+
     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
     OPENGL_CHECK_ERRORS;
+
+    // mipmap support
+    if(options.bEnableMipmaping)
+    {
+        int m_maximumAnistropy = pcontext->getMaxAnisotropicFiltering(); //if getMaxAnisotropicFiltering() return more than 0, so aniso is supported and maxAnisotropicFiltering is set
+
+        // Set Anisotropic filtering (mipmaping have to be activated, aniso filtering is not effective without)
+        if( m_maximumAnistropy )	
+        {
+            glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, m_maximumAnistropy);
+            OPENGL_CHECK_ERRORS;
+        }
+
+        // Set Mipmap
+        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
+        OPENGL_CHECK_ERRORS;
+
+        // Tell to hardware to generate mipmap (himself) when glTexImage2D is called
+        glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE); 
+        OPENGL_CHECK_ERRORS;
+    }
+    else
+    {
+        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+        OPENGL_CHECK_ERRORS;
+    }
+
     // Copy the image data from main memory to video card texture memory
     glTexImage2D(GL_TEXTURE_2D, 0, m_glFmt, m_dwCreatedTextureWidth, m_dwCreatedTextureHeight, 0, GL_BGRA_EXT, GL_UNSIGNED_BYTE, m_pTexture);
     OPENGL_CHECK_ERRORS;
diff --git a/src/Render.cpp b/src/Render.cpp
index 47725e0..07164aa 100644
--- a/src/Render.cpp
+++ b/src/Render.cpp
@@ -1979,7 +1979,6 @@ void CRender::SetTextureFilter(uint32 dwFilter)
             m_dwMinFilter = m_dwMagFilter = FILTER_POINT;
             break;
         case FORCE_LINEAR_FILTER:
-        case FORCE_BILINEAR_FILTER:
             m_dwMinFilter = m_dwMagFilter = FILTER_LINEAR;
             break;
         }
diff --git a/src/Render.h b/src/Render.h
index 92f6736..9ae2849 100644
--- a/src/Render.h
+++ b/src/Render.h
@@ -91,7 +91,7 @@ public:
     virtual void SetFogEnable(bool bEnable) 
     { 
         DEBUGGER_IF_DUMP( (gRSP.bFogEnabled != bEnable && logFog ), TRACE1("Set Fog %s", bEnable? "enable":"disable"));
-        gRSP.bFogEnabled = bEnable&&options.bEnableFog;
+        gRSP.bFogEnabled = bEnable&&(options.fogMethod > 0);
     }
     virtual void SetFogMinMax(float fMin, float fMax) = 0;
     virtual void TurnFogOnOff(bool flag)=0;
diff --git a/src/osal_files.h b/src/osal_files.h
index 6965bea..9b46449 100644
--- a/src/osal_files.h
+++ b/src/osal_files.h
@@ -40,10 +40,15 @@ extern "C" {
   #include <limits.h>  // for PATH_MAX
   #define OSAL_DIR_SEPARATOR_STR       "/"
   #define OSAL_DIR_SEPARATOR_CHAR      '/'
+
+  /* PATH_MAX only may be defined by limits.h */
+  #ifndef PATH_MAX
+    #define PATH_MAX 4096
+  #endif
 #endif
 
 int osal_is_directory(const char* name);
-int osal_mkdirp(const char *dirpath, int mode);
+int osal_mkdirp(const char *dirpath, int mode);
 
 void * osal_search_dir_open(const char *pathname);
 const char *osal_search_dir_read_next(void * dir_handle);
diff --git a/src/osal_files_unix.c b/src/osal_files_unix.c
index 2c8c562..c586f97 100644
--- a/src/osal_files_unix.c
+++ b/src/osal_files_unix.c
@@ -29,7 +29,6 @@
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
-#include <limits.h> // PATH_MAX
 #include <dirent.h>
 
 #include "osal_files.h"
diff --git a/src/version.h b/src/version.h
index 80ce4cf..080c04a 100644
--- a/src/version.h
+++ b/src/version.h
@@ -27,7 +27,7 @@
 #define VERSION_H
 
 #define PLUGIN_NAME    "Mupen64Plus OpenGL Video Plugin by Rice"
-#define PLUGIN_VERSION 0x016303
+#define PLUGIN_VERSION 0x016304
 
 #define VERSION_PRINTF_SPLIT(x) (((x) >> 16) & 0xffff), (((x) >> 8) & 0xff), ((x) & 0xff)
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/mupen64plus-video-rice.git



More information about the Pkg-games-commits mailing list