Browse Source

Reuse constant buffer object number when resizing. Do not mark light queue to shadow batches, as it is unnecessary and could lead to shader parameter update bugs (requires further refactoring to prevent in the Graphics class.)

Lasse Öörni 10 years ago
parent
commit
f450d0c3b4

+ 2 - 3
Source/Urho3D/Graphics/OpenGL/OGLConstantBuffer.cpp

@@ -67,8 +67,6 @@ void ConstantBuffer::OnDeviceReset()
 
 bool ConstantBuffer::SetSize(unsigned size)
 {
-    Release();
-
     if (!size)
     {
         LOGERROR("Can not create zero-sized constant buffer");
@@ -87,7 +85,8 @@ bool ConstantBuffer::SetSize(unsigned size)
     if (graphics_)
     {
         #ifndef GL_ES_VERSION_2_0
-        glGenBuffers(1, &object_);
+        if (!object_)
+            glGenBuffers(1, &object_);
         glBindBuffer(GL_UNIFORM_BUFFER, object_);
         glBufferData(GL_UNIFORM_BUFFER, size_, shadowData_.Get(), GL_DYNAMIC_DRAW);
         #endif

+ 0 - 1
Source/Urho3D/Graphics/View.cpp

@@ -1053,7 +1053,6 @@ void View::GetLightBatches()
                             destBatch.pass_ = pass;
                             destBatch.camera_ = shadowCamera;
                             destBatch.zone_ = zone;
-                            destBatch.lightQueue_ = &lightQueue;
                             
                             AddBatchToQueue(shadowQueue.shadowBatches_, destBatch, tech);
                         }