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/gl-resources/gl-call-debug.h>
22 #include <dali/public-api/common/dali-common.h>
23 #include <dali/integration-api/debug.h>
24 #include <dali/integration-api/gl-abstraction.h>
25 #include <dali/integration-api/gl-defines.h>
34 const Dali::GLenum errorCode;
35 const char* errorString;
37 errorStrings errors[] =
39 { GL_NO_ERROR, "GL_NO_ERROR" },
40 { GL_INVALID_ENUM, "GL_INVALID_ENUM" },
41 { GL_INVALID_VALUE, "GL_INVALID_VALUE" },
42 { GL_INVALID_OPERATION, "GL_INVALID_OPERATION" },
43 { GL_OUT_OF_MEMORY, "GL_OUT_OF_MEMORY" }
46 const char* ErrorToString( Dali::GLenum errorCode )
48 for( unsigned int i = 0; i < sizeof(errors) / sizeof(errors[0]); ++i)
50 if (errorCode == errors[i].errorCode)
52 return errors[i].errorString;
55 return "Unknown Open GLES error";
67 /// Switch debug level to Concise to disable, General to enable. Note, enabling snapshot logging will do this on the fly.
68 Debug::Filter* gGlLogFilter = Debug::Filter::New(Debug::Concise, false, "LOG_CONTEXT");
69 #endif // DEBUG_ENABLED
71 void CheckGlError( Integration::GlAbstraction& glAbstraction, const char* operation )
73 bool foundError = false;
74 while( GLint error = glAbstraction.GetError() )
76 DALI_LOG_ERROR( "glError (0x%x) %s - after %s\n", error, ErrorToString( error ), operation );
79 DALI_ASSERT_ALWAYS( !foundError && "GL ERROR" ); // if errors are being checked we should assert