2 * Copyright (c) 2016 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include <dali/internal/render/common/render-debug.h>
25 #include <dali/integration-api/debug.h>
26 #include <dali/internal/render/common/render-item.h>
27 #include <dali/internal/render/common/render-list.h>
28 #include <dali/internal/render/common/render-instruction.h>
29 #include <dali/internal/update/nodes/node.h>
31 using Dali::Internal::SceneGraph::Node;
32 using Dali::Internal::SceneGraph::RenderList;
43 // These functions should only be defined if they are being used by the #define in the header.
44 // Otherwise they will contribute negatively to code coverage.
45 #ifdef DALI_PRINT_RENDER_INFO
47 void PrintFrameStart( BufferIndex bufferIndex )
49 DALI_LOG_RENDER_INFO( "RENDER START - bufferIndex: %d\n", bufferIndex );
54 DALI_LOG_RENDER_INFO( "RENDER END\n\n" );
57 void PrintRenderInstruction( const SceneGraph::RenderInstruction& instruction, BufferIndex index )
59 const char* target = (0 != instruction.mOffscreenTextureId) ? "FrameBuffer" : "Screen";
61 std::stringstream debugStream;
62 debugStream << "Rendering to " << target << ", View: " << *(instruction.GetViewMatrix(index)) << " Projection: " << *(instruction.GetProjectionMatrix(index));
64 if( instruction.mIsViewportSet )
66 debugStream << " Viewport: " << instruction.mViewport.x << "," << instruction.mViewport.y << " " << instruction.mViewport.width << "x" << instruction.mViewport.height;
69 if( instruction.mIsClearColorSet )
71 debugStream << " ClearColor: " << instruction.mClearColor;
74 std::string debugString( debugStream.str() );
75 DALI_LOG_RENDER_INFO( " %s\n", debugString.c_str() );
78 void PrintRenderList( const RenderList& list )
80 std::stringstream debugStream;
81 debugStream << "Rendering items";
83 if( list.IsClipping() )
85 debugStream << ", ClippingBox: " << list.GetClippingBox().x << "," << list.GetClippingBox().y << " " << list.GetClippingBox().width << "x" << list.GetClippingBox().height;
88 std::string debugString( debugStream.str() );
89 DALI_LOG_RENDER_INFO( " %s\n", debugString.c_str() );
92 void PrintRenderItem( const SceneGraph::RenderItem& item )
94 std::stringstream debugStream;
95 debugStream << "Rendering item, ModelView: " << item.mModelViewMatrix;
97 std::string debugString( debugStream.str() );
98 DALI_LOG_RENDER_INFO( " %s\n", debugString.c_str() );
101 void PrintRendererCount( unsigned int frameCount, unsigned int rendererCount )
103 if( frameCount % 120 == 30 ) // Print every 2 seconds reg
105 Debug::LogMessage( Debug::DebugInfo, "Renderer Total # renderers: %u\n", rendererCount );