402a759b891a6c56c831f2919ff30f85d20fc7f9
[platform/core/uifw/dali-core.git] / dali / internal / render / gl-resources / gl-call-debug.h
1 #ifndef __DALI_INTERNAL_GL_CALL_DEBUG_H__
2 #define __DALI_INTERNAL_GL_CALL_DEBUG_H__
3
4 /*
5  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21 // INTERNAL INCLUDES
22 #include <dali/integration-api/debug.h>
23
24 namespace Dali
25 {
26 namespace Integration
27 {
28 class GlAbstraction;
29 }
30
31 namespace Internal
32 {
33
34 /**
35  * Helper to check GL errors
36  * @param glAbstraction to use for error check
37  * @param operation to be logged
38  */
39 void CheckGlError( Integration::GlAbstraction& glAbstraction, const char* operation );
40
41 // wrap gl calls with CHECK_GL e.g. "CHECK_GL( mGlAbstraction, mGlAbstraction.UseProgram(mProgramId) );"
42 // will LOG any glErrors eg "glError (0x0501) GL_INVALID_VALUE - glBindTexture(textureId)"
43 // only enable if specifically enabled as it can slow down GL a lot!
44 #ifdef DALI_GL_ERROR_CHECK
45 #define CHECK_GL(c,a)  (a); CheckGlError(c,#a)
46 #else
47 #define CHECK_GL(c,a)  (a)
48 #endif
49
50 #ifdef DEBUG_ENABLED
51 /// Switch debug level to Concise to disable, General to enable. Note, enabling snapshot logging will do this on the fly.
52 extern Debug::Filter* gGlLogFilter;
53 #endif // DEBUG_ENABLED
54
55 // Don't put guards around here (LOG_INFO has it's own guards)
56 #define LOG_GL(format, args...) \
57   DALI_LOG_INFO(gGlLogFilter, Debug::General, format, ## args)
58
59 }
60
61 }
62
63 #endif // __DALI_INTERNAL_GL_CALL_DEBUG_H__
64