Przeglądaj źródła

Use on-demand shader evaluation for OpenGL as well.

Also correct Urho3DPlayer usage help for setting log level. There is a space between parameter key and parameter value.
Other minor changes to correct formatting.
Yao Wei Tjong 姚伟忠 12 lat temu
rodzic
commit
d719baa38b

+ 1 - 1
Source/Engine/Engine/Engine.cpp

@@ -287,7 +287,7 @@ bool Engine::Initialize(const VariantMap& parameters)
         renderer->SetDrawShadows(GetParameter(parameters, "Shadows", true).GetBool());
         if (renderer->GetDrawShadows() && GetParameter(parameters, "LowQualityShadows", false).GetBool())
             renderer->SetShadowQuality(SHADOWQUALITY_LOW_16BIT);
-    
+
         if (GetParameter(parameters, "Sound", true).GetBool())
         {
             GetSubsystem<Audio>()->SetMode(

+ 8 - 7
Source/Engine/Graphics/Direct3D9/D3D9Graphics.cpp

@@ -298,7 +298,7 @@ bool Graphics::SetMode(int width, int height, bool fullscreen, bool borderless,
     SDL_GetDesktopDisplayMode(0, &mode);
     D3DFORMAT fullscreenFormat = SDL_BITSPERPIXEL(mode.format) == 16 ? D3DFMT_R5G6B5 : D3DFMT_X8R8G8B8;
     
-    // If zero dimensions in windowed mode, ignore well use the maximize flag. If zero in fullscreen, use desktop mode
+    // If zero dimensions in windowed mode, set windowed mode to maximize and set a predefined default restored window size. If zero in fullscreen, use desktop mode
     if (!width || !height)
     {
         if (fullscreen || borderless)
@@ -318,6 +318,7 @@ bool Graphics::SetMode(int width, int height, bool fullscreen, bool borderless,
     if (fullscreen || borderless)
         resizable = false;
 
+    // Borderless cannot be fullscreen, they are mutually exclusive
     if (borderless)
         fullscreen = false;
     
@@ -370,7 +371,7 @@ bool Graphics::SetMode(int width, int height, bool fullscreen, bool borderless,
     
     AdjustWindow(width, height, fullscreen, borderless);
 
-    if(maximize)
+    if (maximize)
     {
         Maximize();
     }
@@ -445,7 +446,7 @@ bool Graphics::SetMode(int width, int height, bool fullscreen, bool borderless,
     #ifdef ENABLE_LOGGING
     String msg;
     msg.AppendWithFormat("Set screen mode %dx%d %s", width_, height_, (fullscreen_ ? "fullscreen" : "windowed"));
-    if(borderless_)
+    if (borderless_)
         msg.Append(" borderless");
     if (resizable_)
         msg.Append(" resizable");
@@ -2016,7 +2017,7 @@ void Graphics::WindowResized()
 
 void Graphics::Maximize()
 {
-    if(!impl_->window_)
+    if (!impl_->window_)
         return;
 
     SDL_MaximizeWindow(impl_->window_);
@@ -2024,7 +2025,7 @@ void Graphics::Maximize()
 
 void Graphics::Minimize()
 {
-    if(!impl_->window_)
+    if (!impl_->window_)
         return;
 
     SDL_MinimizeWindow(impl_->window_);
@@ -2232,7 +2233,7 @@ unsigned Graphics::GetFormat(const String& formatName)
 
 bool Graphics::OpenWindow(int width, int height, bool resizable, bool borderless)
 {
-    if(!externalWindow_)
+    if (!externalWindow_)
     {
         unsigned flags = 0;
         if (resizable)
@@ -2273,7 +2274,7 @@ void Graphics::AdjustWindow(int& newWidth, int& newHeight, bool& newFullscreen,
 {
     if (!externalWindow_)
     {
-        if(!newWidth || !newHeight)
+        if (!newWidth || !newHeight)
         {
             SDL_MaximizeWindow(impl_->window_);
             SDL_GetWindowSize(impl_->window_, &newWidth, &newHeight);

+ 2 - 2
Source/Engine/Graphics/Direct3D9/D3D9Graphics.h

@@ -349,9 +349,9 @@ public:
     
     /// Window was resized through user interaction. Called by Input subsystem.
     void WindowResized();
-    /// Maximize the Window
+    /// Maximize the Window.
     void Maximize();
-    /// Minimize the Window
+    /// Minimize the Window.
     void Minimize();
     /// Add a GPU object to keep track of. Called by GPUObject.
     void AddGPUObject(GPUObject* object);

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

@@ -245,7 +245,7 @@ bool Graphics::SetMode(int width, int height, bool fullscreen, bool borderless,
     // Borderless cannot be fullscreen, they are mutually exclusive
     if (borderless)
         fullscreen = false;
-    
+
     multiSample = Clamp(multiSample, 1, 16);
     
     if (IsInitialized() && width == width_ && height == height_ && fullscreen == fullscreen_ && borderless == borderless_ && resizable == resizable_ &&
@@ -253,7 +253,7 @@ bool Graphics::SetMode(int width, int height, bool fullscreen, bool borderless,
         return true;
     
     // If only vsync changes, do not destroy/recreate the context
-    if(IsInitialized() && width == width_ && height == height_ && fullscreen == fullscreen_ && borderless == borderless_ && resizable == resizable_ &&
+    if (IsInitialized() && width == width_ && height == height_ && fullscreen == fullscreen_ && borderless == borderless_ && resizable == resizable_ &&
         tripleBuffer == tripleBuffer_ && multiSample == multiSample_ && vsync != vsync_)
     {
         SDL_GL_SetSwapInterval(vsync ? 1 : 0);
@@ -261,7 +261,7 @@ bool Graphics::SetMode(int width, int height, bool fullscreen, bool borderless,
         return true;
     }
     
-    // If zero dimensions in windowed mode, ignore well maximize. If zero in fullscreen, use desktop mod
+    // If zero dimensions in windowed mode, set windowed mode to maximize and set a predefined default restored window size. If zero in fullscreen, use desktop mode
     if (!width || !height)
     {
         if (fullscreen || borderless)
@@ -338,7 +338,7 @@ bool Graphics::SetMode(int width, int height, bool fullscreen, bool borderless,
         int y = fullscreen ? 0 : SDL_WINDOWPOS_UNDEFINED;
 
         unsigned flags = SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN;
-        if(fullscreen)
+        if (fullscreen)
             flags |= SDL_WINDOW_FULLSCREEN;
         if (resizable)
             flags |= SDL_WINDOW_RESIZABLE;
@@ -377,7 +377,7 @@ bool Graphics::SetMode(int width, int height, bool fullscreen, bool borderless,
 
         CreateWindowIcon();
 
-        if(maximize)
+        if (maximize)
             Maximize();
         
         // Create/restore context and GPU objects and set initial renderstate

+ 3 - 3
Source/Engine/Graphics/OpenGL/OGLGraphics.h

@@ -241,7 +241,7 @@ public:
     bool GetFullscreen() const { return fullscreen_; }
     /// Return whether window is borderless.
     bool GetBorderless() const { return borderless_; }
-    /// Return whether window is resizable
+    /// Return whether window is resizable.
     bool GetResizable() const { return resizable_; }
     /// Return whether vertical sync is on.
     bool GetVSync() const { return vsync_; }
@@ -376,9 +376,9 @@ public:
     void Release(bool clearGPUObjects, bool closeWindow);
     /// Restore GPU objects and reinitialize state. Requires an open window.
     void Restore();
-    /// Maximize the Window
+    /// Maximize the Window.
     void Maximize();
-    /// Minimize the Window
+    /// Minimize the Window.
     void Minimize();
     /// Clean up a render surface from all FBOs.
     void CleanupRenderSurface(RenderSurface* surface);

+ 2 - 2
Source/Engine/Graphics/OpenGL/OGLShader.cpp

@@ -81,12 +81,12 @@ bool Shader::Load(Deserializer& source)
     {
         PROFILE(ParseShaderDefinition);
         
-        if (!vsParser_.Parse(VS, shaders))
+        if (!vsParser_.Parse(VS, shaders, false))
         {
             LOGERROR("VS: " + vsParser_.GetErrorMessage());
             return false;
         }
-        if (!psParser_.Parse(PS, shaders))
+        if (!psParser_.Parse(PS, shaders, false))
         {
             LOGERROR("PS: " + psParser_.GetErrorMessage());
             return false;

+ 4 - 4
Source/Engine/LuaScript/pkgs/Graphics/Graphics.pkg

@@ -13,8 +13,8 @@ class Graphics : public Object
     void SetSRGB(bool enable);
     void SetFlushGPU(bool enable);
     bool ToggleFullscreen();
-	void Maximize();
-	void Minimize();
+    void Maximize();
+    void Minimize();
     void Close();
     bool TakeScreenShot(Image& destImage);
     
@@ -27,7 +27,7 @@ class Graphics : public Object
     int GetMultiSample() const;
     bool GetFullscreen() const;
     bool GetResizable() const;
-	bool GetBorderless() const;
+    bool GetBorderless() const;
     bool GetVSync() const;
     bool GetTripleBuffer() const;
     bool GetSRGB() const;
@@ -58,7 +58,7 @@ class Graphics : public Object
     tolua_readonly tolua_property__get_set int multiSample;
     tolua_readonly tolua_property__get_set bool fullscreen;
     tolua_readonly tolua_property__get_set bool resizable;
-	    tolua_readonly tolua_property__get_set bool borderless;
+    tolua_readonly tolua_property__get_set bool borderless;
     tolua_readonly tolua_property__get_set bool vSync;
     tolua_readonly tolua_property__get_set bool tripleBuffer;
     tolua_property__get_set bool sRGB;

+ 23 - 23
Source/Tools/Urho3DPlayer/Urho3DPlayer.cpp

@@ -81,29 +81,29 @@ void Urho3DPlayer::Setup()
             "application and subscribing to all necessary events, such as the frame update.\n"
             #ifndef WIN32
             "\nCommand line options:\n"
-            "-x <res>    Horizontal resolution\n"
-            "-y <res>    Vertical resolution\n"
-            "-m <level>  Enable hardware multisampling\n"
-            "-v          Enable vertical sync\n"
-            "-t          Enable triple buffering\n"
-            "-w          Start in windowed mode\n"
-            "-s          Enable resizing when in windowed mode\n"
-            "-q          Enable quiet mode which does not log to standard output stream\n"
-            "-b <length> Sound buffer length in milliseconds\n"
-            "-r <freq>   Sound mixing frequency in Hz\n"
-            "-p <paths>  Resource path(s) to use, separated by semicolons\n"
-            "-log<level> Change the log level, valid 'level' values are 'debug', 'info', 'warning', 'error'\n"
-            "-borderless Borderless window mode\n"
-            "-headless   Headless mode. No application window will be created\n"
-            "-prepass    Use light pre-pass rendering\n"
-            "-deferred   Use deferred rendering\n"
-            "-lqshadows  Use low-quality (1-sample) shadow filtering\n"
-            "-noshadows  Disable shadow rendering\n"
-            "-nolimit    Disable frame limiter\n"
-            "-nothreads  Disable worker threads\n"
-            "-nosound    Disable sound output\n"
-            "-noip       Disable sound mixing interpolation\n"
-            "-sm2        Force SM2.0 rendering\n"
+            "-x <res>     Horizontal resolution\n"
+            "-y <res>     Vertical resolution\n"
+            "-m <level>   Enable hardware multisampling\n"
+            "-v           Enable vertical sync\n"
+            "-t           Enable triple buffering\n"
+            "-w           Start in windowed mode\n"
+            "-s           Enable resizing when in windowed mode\n"
+            "-q           Enable quiet mode which does not log to standard output stream\n"
+            "-b <length>  Sound buffer length in milliseconds\n"
+            "-r <freq>    Sound mixing frequency in Hz\n"
+            "-p <paths>   Resource path(s) to use, separated by semicolons\n"
+            "-log <level> Change the log level, valid 'level' values are 'debug', 'info', 'warning', 'error'\n"
+            "-borderless  Borderless window mode\n"
+            "-headless    Headless mode. No application window will be created\n"
+            "-prepass     Use light pre-pass rendering\n"
+            "-deferred    Use deferred rendering\n"
+            "-lqshadows   Use low-quality (1-sample) shadow filtering\n"
+            "-noshadows   Disable shadow rendering\n"
+            "-nolimit     Disable frame limiter\n"
+            "-nothreads   Disable worker threads\n"
+            "-nosound     Disable sound output\n"
+            "-noip        Disable sound mixing interpolation\n"
+            "-sm2         Force SM2.0 rendering\n"
             #endif
         );
     }