/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
* @param[in] rhs Right hand side item
* @return True if left item is greater than right
*/
-bool PartialCompareItems( const RenderInstructionProcessor::SortAttributes& lhs,
- const RenderInstructionProcessor::SortAttributes& rhs )
+inline bool PartialCompareItems( const RenderInstructionProcessor::SortAttributes& lhs,
+ const RenderInstructionProcessor::SortAttributes& rhs )
{
if( lhs.shader == rhs.shader )
{
// encapsulates the same data (e.g. the middle-order bits of the ptrs).
if( lhs.renderItem->mDepthIndex == rhs.renderItem->mDepthIndex )
{
- return PartialCompareItems(lhs, rhs);
+ return PartialCompareItems( lhs, rhs );
}
return lhs.renderItem->mDepthIndex < rhs.renderItem->mDepthIndex;
}
/**
- * Function which sorts render items by clipping hierarchy, then depth index and instance
- * ptrs of shader/geometry/material.
- * @param[in] lhs Left hand side item
- * @param[in] rhs Right hand side item
- * @return True if left item is greater than right
- */
-bool CompareItemsWithClipping( const RenderInstructionProcessor::SortAttributes& lhs, const RenderInstructionProcessor::SortAttributes& rhs )
-{
- // Items must be sorted in order of clipping first, otherwise incorrect clipping regions could be used.
- if( lhs.renderItem->mNode->mClippingSortModifier == rhs.renderItem->mNode->mClippingSortModifier )
- {
- return CompareItems( lhs, rhs );
- }
-
- return lhs.renderItem->mNode->mClippingSortModifier < rhs.renderItem->mNode->mClippingSortModifier;
-}
-
-/**
* Function which sorts the render items by Z function, then
* by instance ptrs of shader / geometry / material.
* @param[in] lhs Left hand side item
*/
bool CompareItems3D( const RenderInstructionProcessor::SortAttributes& lhs, const RenderInstructionProcessor::SortAttributes& rhs )
{
- bool lhsIsOpaque = lhs.renderItem->mIsOpaque;
+ const bool lhsIsOpaque = lhs.renderItem->mIsOpaque;
if( lhsIsOpaque == rhs.renderItem->mIsOpaque )
{
if( lhsIsOpaque )
: mSortingHelper()
{
// Set up a container of comparators for fast run-time selection.
- mSortComparitors.Reserve( 4u );
+ mSortComparitors.Reserve( 3u );
mSortComparitors.PushBack( CompareItems );
- mSortComparitors.PushBack( CompareItemsWithClipping );
mSortComparitors.PushBack( CompareItems3D );
mSortComparitors.PushBack( CompareItems3DWithClipping );
}
}
}
- // Here we detemine which comparitor (of the 4) to use.
- // The comparitors work like a bitmask.
- // 1 << 0 is added to select a clipping comparitor.
- // 1 << 1 is added for 3D comparitors.
- const unsigned int comparitorIndex = ( respectClippingOrder ? ( 1u << 0u ) : 0u ) |
- ( layer.GetBehavior() == Dali::Layer::LAYER_3D ? ( 1u << 1u ) : 0u );
+ // Here we determine which comparitor (of the 3) to use.
+ // 0 is LAYER_UI
+ // 1 is LAYER_3D
+ // 2 is LAYER_3D + Clipping
+ const unsigned int comparitorIndex = layer.GetBehavior() == Dali::Layer::LAYER_3D ? respectClippingOrder ? 2u : 1u : 0u;
std::stable_sort( mSortingHelper.begin(), mSortingHelper.end(), mSortComparitors[ comparitorIndex ] );