Browse Source

Set shaders before material state to ensure changing the depth bias on OpenGL dirties the camera shader parameter group properly.

Lasse Öörni 10 years ago
parent
commit
cdfb6b77d9
1 changed files with 3 additions and 3 deletions
  1. 3 3
      Source/Urho3D/Graphics/Batch.cpp

+ 3 - 3
Source/Urho3D/Graphics/Batch.cpp

@@ -179,6 +179,9 @@ void Batch::Prepare(View* view, bool setModelTransform, bool allowDepthWrite) co
     Light* light = lightQueue_ ? lightQueue_->light_ : 0;
     Texture2D* shadowMap = lightQueue_ ? lightQueue_->shadowMap_ : 0;
 
+    // Set shaders first. The available shader parameters and their register/uniform positions depend on the currently set shaders
+    graphics->SetShaders(vertexShader_, pixelShader_);
+
     // Set pass / material-specific renderstates
     if (pass_ && material_)
     {
@@ -205,9 +208,6 @@ void Batch::Prepare(View* view, bool setModelTransform, bool allowDepthWrite) co
         graphics->SetDepthWrite(pass_->GetDepthWrite() && allowDepthWrite);
     }
     
-    // Set shaders first. The available shader parameters and their register/uniform positions depend on the currently set shaders
-    graphics->SetShaders(vertexShader_, pixelShader_);
-    
     // Set global (per-frame) shader parameters
     if (graphics->NeedParameterUpdate(SP_FRAME, (void*)0))
         view->SetGlobalShaderParameters();