2 * Copyright (c) 2022 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-instruction.h>
27 #include <dali/internal/render/common/render-item.h>
28 #include <dali/internal/render/common/render-list.h>
29 #include <dali/internal/update/nodes/node.h>
31 using Dali::Internal::SceneGraph::Node;
32 using Dali::Internal::SceneGraph::RenderList;
40 // These functions should only be defined if they are being used by the #define in the header.
41 // Otherwise they will contribute negatively to code coverage.
42 #ifdef DALI_PRINT_RENDER_INFO
44 void PrintFrameStart(BufferIndex bufferIndex)
46 DALI_LOG_RENDER_INFO("RENDER START - bufferIndex: %d\n", bufferIndex);
51 DALI_LOG_RENDER_INFO("RENDER END\n\n");
54 void PrintRenderInstruction(const SceneGraph::RenderInstruction& instruction, BufferIndex index)
56 const char* target = (nullptr != instruction.mFrameBuffer) ? "FrameBuffer" : "Screen";
58 std::stringstream debugStream;
59 debugStream << "Rendering to " << target << ", View: " << *(instruction.GetViewMatrix(index)) << " Projection: " << *(instruction.GetProjectionMatrix(index));
61 if(instruction.mIsViewportSet)
63 debugStream << " Viewport: " << instruction.mViewport.x << "," << instruction.mViewport.y << " " << instruction.mViewport.width << "x" << instruction.mViewport.height;
66 if(instruction.mIsClearColorSet)
68 debugStream << " ClearColor: " << instruction.mClearColor;
71 std::string debugString(debugStream.str());
72 DALI_LOG_RENDER_INFO(" %s\n", debugString.c_str());
75 void PrintRenderList(const RenderList& list)
77 std::stringstream debugStream;
78 debugStream << "Rendering items";
82 debugStream << ", ClippingBox: " << list.GetClippingBox().x << "," << list.GetClippingBox().y << " " << list.GetClippingBox().width << "x" << list.GetClippingBox().height;
85 std::string debugString(debugStream.str());
86 DALI_LOG_RENDER_INFO(" %s\n", debugString.c_str());
89 void PrintRenderItem(const SceneGraph::RenderItem& item)
91 std::stringstream debugStream;
92 debugStream << "Rendering item, ModelView: " << item.mModelViewMatrix;
94 std::string debugString(debugStream.str());
95 DALI_LOG_RENDER_INFO(" %s\n", debugString.c_str());
98 void PrintRendererCount(unsigned int frameCount, unsigned int rendererCount)
100 if(frameCount % 120 == 30) // Print every 2 seconds reg
102 Debug::LogMessage(Debug::INFO, "Renderer Total # renderers: %u\n", rendererCount);
108 } // namespace Render
110 } // namespace Internal