Quellcode durchsuchen

Fixed GLSL shaders not updating source code on live reload.

Lasse Öörni vor 12 Jahren
Ursprung
Commit
321d9ef74b
1 geänderte Dateien mit 8 neuen und 1 gelöschten Zeilen
  1. 8 1
      Engine/Graphics/OpenGL/OGLShader.cpp

+ 8 - 1
Engine/Graphics/OpenGL/OGLShader.cpp

@@ -92,11 +92,18 @@ bool Shader::Load(Deserializer& source)
     if (!ProcessSource(psSourceCode_, psSourceCodeLength_, path + fileName + ".frag"))
         return false;
     
-    // If variations had already been created, release them
+    // If variations had already been created, release them and set new source code
+    /// \todo Should also update defines
     for (HashMap<StringHash, SharedPtr<ShaderVariation> >::Iterator i = vsVariations_.Begin(); i != vsVariations_.End(); ++i)
+    {
         i->second_->Release();
+        i->second_->SetSourceCode(vsSourceCode_, vsSourceCodeLength_);
+    }
     for (HashMap<StringHash, SharedPtr<ShaderVariation> >::Iterator i = psVariations_.Begin(); i != psVariations_.End(); ++i)
+    {
         i->second_->Release();
+        i->second_->SetSourceCode(psSourceCode_, psSourceCodeLength_);
+    }
     
     SetMemoryUse(sizeof(Shader) + 2 * sizeof(ShaderParser) + (vsVariations_.Size() + psVariations_.Size()) *
         sizeof(ShaderVariation));