2 * Copyright (c) 2014 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>
30 using Dali::Internal::SceneGraph::RenderList;
41 void PrintFrameStart( BufferIndex bufferIndex )
43 DALI_LOG_RENDER_INFO( "RENDER START - bufferIndex: %d\n", bufferIndex );
48 DALI_LOG_RENDER_INFO( "RENDER END\n\n" );
51 void PrintRenderInstruction( const SceneGraph::RenderInstruction& instruction, BufferIndex index )
53 const char* target = (0 != instruction.mOffscreenTextureId) ? "FrameBuffer" : "Screen";
55 std::stringstream debugStream;
56 debugStream << "Rendering to " << target << ", View: " << *(instruction.GetViewMatrix(index)) << " Projection: " << *(instruction.GetProjectionMatrix(index));
58 if( instruction.mIsViewportSet )
60 debugStream << " Viewport: " << instruction.mViewport.x << "," << instruction.mViewport.y << " " << instruction.mViewport.width << "x" << instruction.mViewport.height;
63 if( instruction.mIsClearColorSet )
65 debugStream << " ClearColor: " << instruction.mClearColor;
68 std::string debugString( debugStream.str() );
69 DALI_LOG_RENDER_INFO( " %s\n", debugString.c_str() );
72 void PrintRenderList( const RenderList& list )
74 unsigned int flags = list.GetFlags();
76 std::stringstream debugStream;
77 debugStream << "Rendering items";
81 debugStream << " with:";
83 if( flags & RenderList::DEPTH_BUFFER_ENABLED )
85 debugStream << " DEPTH_TEST";
88 if( flags & RenderList::DEPTH_WRITE )
90 debugStream << " DEPTH_WRITE";
93 if( flags & RenderList::DEPTH_CLEAR )
95 debugStream << " DEPTH_CLEAR";
98 if( flags & RenderList::STENCIL_BUFFER_ENABLED )
100 debugStream << " STENCIL_TEST";
103 if( flags & RenderList::STENCIL_WRITE )
105 debugStream << " STENCIL_WRITE";
108 if( flags & RenderList::STENCIL_CLEAR )
110 debugStream << " STENCIL_CLEAR";
115 debugStream << " without any DEPTH_TEST, DEPTH_WRITE etc";
118 if( list.IsClipping() )
120 debugStream << ", ClippingBox: " << list.GetClippingBox().x << "," << list.GetClippingBox().y << " " << list.GetClippingBox().width << "x" << list.GetClippingBox().height;
123 std::string debugString( debugStream.str() );
124 DALI_LOG_RENDER_INFO( " %s\n", debugString.c_str() );
127 void PrintRenderItem( const SceneGraph::RenderItem& item )
129 std::stringstream debugStream;
130 debugStream << "Rendering item, ModelView: " << item.GetModelViewMatrix();
132 std::string debugString( debugStream.str() );
133 DALI_LOG_RENDER_INFO( " %s\n", debugString.c_str() );
136 void PrintRendererCount( unsigned int frameCount, unsigned int rendererCount )
138 if( frameCount % 120 == 30 ) // Print every 2 seconds reg
140 Debug::LogMessage( Debug::DebugInfo, "Renderer Total # renderers: %u\n", rendererCount );
144 void PrintCullCount( unsigned int frameCount, unsigned int culledCount )
146 if( frameCount % 120 == 30 ) // Print every 2 seconds reg
148 Debug::LogMessage( Debug::DebugInfo, "Renderer # Culled renderers: %u\n", culledCount );