-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
// CLASS HEADER
#include <dali/internal/update/common/discard-queue.h>
#include <dali/internal/render/queue/render-queue.h>
#include <dali/internal/update/node-attachments/scene-graph-renderable-attachment.h>
#include <dali/internal/render/renderers/scene-graph-renderer.h>
-#include <dali/internal/render/shaders/shader.h>
-#include <dali/internal/update/modeling/scene-graph-mesh.h>
+#include <dali/internal/render/shaders/scene-graph-shader.h>
namespace Dali
{
namespace SceneGraph
{
-namespace // unnamed namespace
-{
-
-static void DoGlCleanup( BufferIndex updateBufferIndex, GlResourceOwner& owner, RenderQueue& renderQueue )
-{
- typedef Message< GlResourceOwner > DerivedType;
-
- // Reserve some memory inside the render queue
- unsigned int* slot = renderQueue.ReserveMessageSlot( updateBufferIndex, sizeof( DerivedType ) );
-
- // Construct message in the render queue memory; note that delete should not be called on the return value
- new (slot) DerivedType( &owner, &GlResourceOwner::GlCleanup );
-}
-
-} // unnamed namespace
-
DiscardQueue::DiscardQueue( RenderQueue& renderQueue )
: mRenderQueue( renderQueue )
{
}
}
-void DiscardQueue::Add( BufferIndex updateBufferIndex, RefObject& resource )
+void DiscardQueue::Add( BufferIndex updateBufferIndex, Geometry* geometry )
{
- // Check whether resource has GL data
- GlResourceOwner* glResource = dynamic_cast<GlResourceOwner*>( &resource );
- if ( glResource )
- {
- // Send message to clean-up GL resources in the next Render
- DoGlCleanup( updateBufferIndex, *glResource, mRenderQueue );
- }
+ DALI_ASSERT_DEBUG( NULL != geometry );
// The GL resources will now be freed in frame N
// The Update for frame N+1 may occur in parallel with the rendering of frame N
// Queue the node for destruction in frame N+2
if ( 0u == updateBufferIndex )
{
- mResourceQueue0.push_back( DiscardQueue::ResourcePointer(&resource) );
+ mGeometryQueue0.PushBack( geometry );
}
else
{
- mResourceQueue1.push_back( DiscardQueue::ResourcePointer(&resource) );
+ mGeometryQueue1.PushBack( geometry );
}
}
-void DiscardQueue::Add( BufferIndex updateBufferIndex, Mesh* mesh )
+void DiscardQueue::Add( BufferIndex updateBufferIndex, Material* material )
{
- DALI_ASSERT_DEBUG( mesh );
-
- // Send message to clean-up GL resources in the next Render
- DoGlCleanup( updateBufferIndex, *mesh, mRenderQueue );
+ DALI_ASSERT_DEBUG( NULL != material );
// The GL resources will now be freed in frame N
// The Update for frame N+1 may occur in parallel with the rendering of frame N
// Queue the node for destruction in frame N+2
if ( 0u == updateBufferIndex )
{
- mMeshQueue0.PushBack( mesh );
+ mMaterialQueue0.PushBack( material );
}
else
{
- mMeshQueue1.PushBack( mesh );
+ mMaterialQueue1.PushBack( material );
}
}
+
void DiscardQueue::Add( BufferIndex updateBufferIndex, Shader* shader )
{
DALI_ASSERT_DEBUG( NULL != shader );
{
mNodeQueue0.Clear();
mAttachmentQueue0.Clear();
- mResourceQueue0.clear();
- mMeshQueue0.Clear();
mShaderQueue0.Clear();
+ mGeometryQueue0.Clear();
+ mMaterialQueue0.Clear();
}
else
{
mNodeQueue1.Clear();
mAttachmentQueue1.Clear();
- mResourceQueue1.clear();
- mMeshQueue1.Clear();
mShaderQueue1.Clear();
+ mGeometryQueue1.Clear();
+ mMaterialQueue1.Clear();
}
}