Explorar o código

Removed need for anisotropic filter OpenGL extension.
Removed redundant hires shadow map support flag.

Lasse Öörni %!s(int64=13) %!d(string=hai) anos
pai
achega
18e8cb6334

+ 1 - 1
Docs/GettingStarted.dox

@@ -18,7 +18,7 @@ To run Urho3D, the minimum system requirements are:
 
 
 - Windows: CPU with SSE instructions support, Windows XP or newer, DirectX 9.0c, GPU with %Shader %Model 2 support (%Shader %Model 3 recommended.)
 - Windows: CPU with SSE instructions support, Windows XP or newer, DirectX 9.0c, GPU with %Shader %Model 2 support (%Shader %Model 3 recommended.)
 
 
-- Linux & Mac OS X: GPU with OpenGL 2.0 support and EXT_framebuffer_object, EXT_packed_depth_stencil and EXT_texture_filter_anisotropic extensions.
+- Linux & Mac OS X: GPU with OpenGL 2.0 support, EXT_framebuffer_object and EXT_packed_depth_stencil extensions.
 
 
 - Android: OS version 2.2 or newer, OpenGL ES 2.0 capable GPU.
 - Android: OS version 2.2 or newer, OpenGL ES 2.0 capable GPU.
 
 

+ 0 - 1
Docs/ScriptAPI.dox

@@ -2334,7 +2334,6 @@ Properties:<br>
 - bool deferredSupport (readonly)
 - bool deferredSupport (readonly)
 - bool hardwareDepthSupport (readonly)
 - bool hardwareDepthSupport (readonly)
 - bool hardwareShadowSupport (readonly)
 - bool hardwareShadowSupport (readonly)
-- bool hiresShadowSupport (readonly)
 - bool forceSM2
 - bool forceSM2
 - IntVector2[]@ resolutions (readonly)
 - IntVector2[]@ resolutions (readonly)
 - int[]@ multiSampleLevels (readonly)
 - int[]@ multiSampleLevels (readonly)

+ 0 - 1
Engine/Engine/GraphicsAPI.cpp

@@ -787,7 +787,6 @@ static void RegisterGraphics(asIScriptEngine* engine)
     engine->RegisterObjectMethod("Graphics", "bool get_deferredSupport() const", asMETHOD(Graphics, GetDeferredSupport), asCALL_THISCALL);
     engine->RegisterObjectMethod("Graphics", "bool get_deferredSupport() const", asMETHOD(Graphics, GetDeferredSupport), asCALL_THISCALL);
     engine->RegisterObjectMethod("Graphics", "bool get_hardwareDepthSupport() const", asMETHOD(Graphics, GetHardwareDepthSupport), asCALL_THISCALL);
     engine->RegisterObjectMethod("Graphics", "bool get_hardwareDepthSupport() const", asMETHOD(Graphics, GetHardwareDepthSupport), asCALL_THISCALL);
     engine->RegisterObjectMethod("Graphics", "bool get_hardwareShadowSupport() const", asMETHOD(Graphics, GetHardwareShadowSupport), asCALL_THISCALL);
     engine->RegisterObjectMethod("Graphics", "bool get_hardwareShadowSupport() const", asMETHOD(Graphics, GetHardwareShadowSupport), asCALL_THISCALL);
-    engine->RegisterObjectMethod("Graphics", "bool get_hiresShadowSupport() const", asMETHOD(Graphics, GetHiresShadowSupport), asCALL_THISCALL);
     engine->RegisterObjectMethod("Graphics", "void set_forceSM2(bool)", asMETHOD(Graphics, SetForceSM2), asCALL_THISCALL);
     engine->RegisterObjectMethod("Graphics", "void set_forceSM2(bool)", asMETHOD(Graphics, SetForceSM2), asCALL_THISCALL);
     engine->RegisterObjectMethod("Graphics", "bool get_forceSM2() const", asMETHOD(Graphics, GetForceSM2), asCALL_THISCALL);
     engine->RegisterObjectMethod("Graphics", "bool get_forceSM2() const", asMETHOD(Graphics, GetForceSM2), asCALL_THISCALL);
     engine->RegisterObjectMethod("Graphics", "Array<IntVector2>@ get_resolutions() const", asFUNCTION(GraphicsGetResolutions), asCALL_CDECL_OBJLAST);
     engine->RegisterObjectMethod("Graphics", "Array<IntVector2>@ get_resolutions() const", asFUNCTION(GraphicsGetResolutions), asCALL_CDECL_OBJLAST);

+ 4 - 10
Engine/Graphics/Direct3D9/D3D9Graphics.cpp

@@ -173,7 +173,6 @@ Graphics::Graphics(Context* context) :
     deferredSupport_(false),
     deferredSupport_(false),
     hardwareDepthSupport_(false),
     hardwareDepthSupport_(false),
     hardwareShadowSupport_(false),
     hardwareShadowSupport_(false),
-    hiresShadowSupport_(false),
     streamOffsetSupport_(false),
     streamOffsetSupport_(false),
     hasSM3_(false),
     hasSM3_(false),
     forceSM2_(false),
     forceSM2_(false),
@@ -2000,7 +1999,6 @@ void Graphics::CheckFeatureSupport()
     lightPrepassSupport_ = false;
     lightPrepassSupport_ = false;
     deferredSupport_ = false;
     deferredSupport_ = false;
     hardwareShadowSupport_ = false;
     hardwareShadowSupport_ = false;
-    hiresShadowSupport_ = false;
     streamOffsetSupport_ = false;
     streamOffsetSupport_ = false;
     hasSM3_ = false;
     hasSM3_ = false;
     depthStencilFormat = D3DFMT_D24S8;
     depthStencilFormat = D3DFMT_D24S8;
@@ -2013,10 +2011,8 @@ void Graphics::CheckFeatureSupport()
     
     
         // Check for hires depth support
         // Check for hires depth support
         hiresShadowMapFormat_ = D3DFMT_D24X8;
         hiresShadowMapFormat_ = D3DFMT_D24X8;
-        if (impl_->CheckFormatSupport((D3DFORMAT)hiresShadowMapFormat_, D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_TEXTURE))
-            hiresShadowSupport_ = true;
-        else
-            hiresShadowMapFormat_ = shadowMapFormat_;
+        if (!impl_->CheckFormatSupport((D3DFORMAT)hiresShadowMapFormat_, D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_TEXTURE))
+            hiresShadowMapFormat_ = 0;
     }
     }
     else
     else
     {
     {
@@ -2026,10 +2022,8 @@ void Graphics::CheckFeatureSupport()
         {
         {
             // Check for hires depth support
             // Check for hires depth support
             hiresShadowMapFormat_ = MAKEFOURCC('D', 'F', '2', '4');
             hiresShadowMapFormat_ = MAKEFOURCC('D', 'F', '2', '4');
-            if (impl_->CheckFormatSupport((D3DFORMAT)hiresShadowMapFormat_, D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_TEXTURE))
-                hiresShadowSupport_ = true;
-            else
-                hiresShadowMapFormat_ = shadowMapFormat_;
+            if (!impl_->CheckFormatSupport((D3DFORMAT)hiresShadowMapFormat_, D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_TEXTURE))
+                hiresShadowMapFormat_ = 0;
         }
         }
         else
         else
         {
         {

+ 0 - 4
Engine/Graphics/Direct3D9/D3D9Graphics.h

@@ -233,8 +233,6 @@ public:
     bool GetHardwareDepthSupport() const { return hardwareDepthSupport_; }
     bool GetHardwareDepthSupport() const { return hardwareDepthSupport_; }
     /// Return whether shadow map depth compare is done in hardware.
     /// Return whether shadow map depth compare is done in hardware.
     bool GetHardwareShadowSupport() const { return hardwareShadowSupport_; }
     bool GetHardwareShadowSupport() const { return hardwareShadowSupport_; }
-    /// Return whether 24-bit shadow maps are supported.
-    bool GetHiresShadowSupport() const { return hiresShadowSupport_; }
     /// Return whether stream offset is supported.
     /// Return whether stream offset is supported.
     bool GetStreamOffsetSupport() const { return streamOffsetSupport_; }
     bool GetStreamOffsetSupport() const { return streamOffsetSupport_; }
     /// Return supported fullscreen resolutions.
     /// Return supported fullscreen resolutions.
@@ -392,8 +390,6 @@ private:
     bool hardwareDepthSupport_;
     bool hardwareDepthSupport_;
     /// Hardware shadow map depth compare support flag.
     /// Hardware shadow map depth compare support flag.
     bool hardwareShadowSupport_;
     bool hardwareShadowSupport_;
-    /// 24-bit shadow map support flag.
-    bool hiresShadowSupport_;
     /// Stream offset support flag.
     /// Stream offset support flag.
     bool streamOffsetSupport_;
     bool streamOffsetSupport_;
     /// Shader Model 3 flag.
     /// Shader Model 3 flag.

+ 5 - 5
Engine/Graphics/OpenGL/OGLGraphics.cpp

@@ -139,6 +139,7 @@ Graphics::Graphics(Context* context_) :
     lightPrepassSupport_(false),
     lightPrepassSupport_(false),
     deferredSupport_(false),
     deferredSupport_(false),
     hardwareDepthSupport_(false),
     hardwareDepthSupport_(false),
+    anisotropySupport_(false),
     dxtTextureSupport_(false),
     dxtTextureSupport_(false),
     etcTextureSupport_(false),
     etcTextureSupport_(false),
     pvrtcTextureSupport_(false),
     pvrtcTextureSupport_(false),
@@ -293,16 +294,15 @@ bool Graphics::SetMode(int width, int height, bool fullscreen, bool vsync, bool
             return false;
             return false;
         }
         }
         
         
-        if (!CheckExtension("EXT_framebuffer_object") || !CheckExtension("EXT_packed_depth_stencil") ||
-            !CheckExtension("EXT_texture_filter_anisotropic"))
+        if (!CheckExtension("EXT_framebuffer_object") || !CheckExtension("EXT_packed_depth_stencil"))
         {
         {
-            LOGERROR("EXT_framebuffer_object, EXT_packed_depth_stencil and "
-                "EXT_texture_filter_anisotropic OpenGL extensions are required");
+            LOGERROR("EXT_framebuffer_object and EXT_packed_depth_stencil OpenGL extensions are required");
             Release(true, true);
             Release(true, true);
             return false;
             return false;
         }
         }
         
         
         dxtTextureSupport_ = CheckExtension("EXT_texture_compression_s3tc");
         dxtTextureSupport_ = CheckExtension("EXT_texture_compression_s3tc");
+        anisotropySupport_ = CheckExtension("EXT_texture_filter_anisotropic");
         #else
         #else
         dxtTextureSupport_ = CheckExtension("EXT_texture_compression_dxt1");
         dxtTextureSupport_ = CheckExtension("EXT_texture_compression_dxt1");
         etcTextureSupport_ = CheckExtension("OES_compressed_ETC1_RGB8_texture");
         etcTextureSupport_ = CheckExtension("OES_compressed_ETC1_RGB8_texture");
@@ -1987,7 +1987,7 @@ void Graphics::CheckFeatureSupport()
     else
     else
     {
     {
         shadowMapFormat_ = GL_DEPTH_COMPONENT;
         shadowMapFormat_ = GL_DEPTH_COMPONENT;
-        hiresShadowMapFormat_ = GL_DEPTH_COMPONENT;
+        hiresShadowMapFormat_ = 0;
         hardwareDepthSupport_ = true;
         hardwareDepthSupport_ = true;
     }
     }
     #endif
     #endif

+ 4 - 2
Engine/Graphics/OpenGL/OGLGraphics.h

@@ -239,10 +239,10 @@ public:
     bool GetDeferredSupport() const { return deferredSupport_; }
     bool GetDeferredSupport() const { return deferredSupport_; }
     /// Return whether hardware depth texture is supported. On OpenGL ES this means the depth texture extension.
     /// Return whether hardware depth texture is supported. On OpenGL ES this means the depth texture extension.
     bool GetHardwareDepthSupport() const { return hardwareDepthSupport_; }
     bool GetHardwareDepthSupport() const { return hardwareDepthSupport_; }
+    /// Return whether anisotropic texture filtering is supported.
+    bool GetAnisotropySupport() const { return anisotropySupport_; }
     /// Return whether shadow map depth compare is done in hardware. Always true on OpenGL.
     /// Return whether shadow map depth compare is done in hardware. Always true on OpenGL.
     bool GetHardwareShadowSupport() const { return true; }
     bool GetHardwareShadowSupport() const { return true; }
-    /// Return whether 24-bit shadow maps are supported. Assume true on OpenGL.
-    bool GetHiresShadowSupport() const { return true; }
     /// Return whether stream offset is supported. Always false on OpenGL.
     /// Return whether stream offset is supported. Always false on OpenGL.
     bool GetStreamOffsetSupport() const { return false; }
     bool GetStreamOffsetSupport() const { return false; }
     /// Return supported fullscreen resolutions.
     /// Return supported fullscreen resolutions.
@@ -390,6 +390,8 @@ private:
     bool deferredSupport_;
     bool deferredSupport_;
     /// Hardware depth support flag.
     /// Hardware depth support flag.
     bool hardwareDepthSupport_;
     bool hardwareDepthSupport_;
+    /// Anisotropic filtering support flag.
+    bool anisotropySupport_;
     /// DXT format support flag.
     /// DXT format support flag.
     bool dxtTextureSupport_;
     bool dxtTextureSupport_;
     /// ETC1 format support flag.
     /// ETC1 format support flag.

+ 5 - 2
Engine/Graphics/OpenGL/OGLTexture.cpp

@@ -171,8 +171,11 @@ void Texture::UpdateParameters()
     
     
     #ifndef GL_ES_VERSION_2_0
     #ifndef GL_ES_VERSION_2_0
     // Anisotropy
     // Anisotropy
-    glTexParameterf(target_, GL_TEXTURE_MAX_ANISOTROPY_EXT, filterMode_ == FILTER_ANISOTROPIC ?
-        (float)graphics_->GetTextureAnisotropy() : 1.0f);
+    if (graphics_->GetAnisotropySupport())
+    {
+        glTexParameterf(target_, GL_TEXTURE_MAX_ANISOTROPY_EXT, filterMode_ == FILTER_ANISOTROPIC ?
+            (float)graphics_->GetTextureAnisotropy() : 1.0f);
+    }
     
     
     // Shadow compare
     // Shadow compare
     if (shadowCompare_)
     if (shadowCompare_)

+ 1 - 1
Engine/Graphics/Renderer.cpp

@@ -426,7 +426,7 @@ void Renderer::SetShadowQuality(int quality)
     // If no hardware PCF, do not allow to select one-sample quality
     // If no hardware PCF, do not allow to select one-sample quality
     if (!graphics_->GetHardwareShadowSupport())
     if (!graphics_->GetHardwareShadowSupport())
         quality |= SHADOWQUALITY_HIGH_16BIT;
         quality |= SHADOWQUALITY_HIGH_16BIT;
-    if (!graphics_->GetHiresShadowSupport())
+    if (!graphics_->GetHiresShadowMapFormat())
         quality &= SHADOWQUALITY_HIGH_16BIT;
         quality &= SHADOWQUALITY_HIGH_16BIT;
     
     
     if (quality != shadowQuality_)
     if (quality != shadowQuality_)

+ 2 - 2
Readme.txt

@@ -96,8 +96,8 @@ To run Urho3D, the minimum system requirements are:
 - Windows: CPU with SSE instructions support, Windows XP or newer, DirectX 9.0c,
 - Windows: CPU with SSE instructions support, Windows XP or newer, DirectX 9.0c,
   GPU with Shader Model 2 support (Shader Model 3 recommended.)
   GPU with Shader Model 2 support (Shader Model 3 recommended.)
 
 
-- Linux & Mac OS X: GPU with OpenGL 2.0 support and EXT_framebuffer_object,
-  EXT_packed_depth_stencil and EXT_texture_filter_anisotropic extensions.
+- Linux & Mac OS X: GPU with OpenGL 2.0 support, EXT_framebuffer_object and
+  EXT_packed_depth_stencil extensions.
 
 
 - Android: OS version 2.2 or newer, OpenGL ES 2.0 capable GPU.
 - Android: OS version 2.2 or newer, OpenGL ES 2.0 capable GPU.