2
* Spandex benchmark and test framework.
4
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
6
* Contact: Kari J. Kangas <kari.j.kangas@nokia.com>
8
* This framework is free software; you can redistribute it and/or modify it
9
* under the terms of the GNU Lesser General Public License as published by the
10
* Free Software Foundation, version 2.1 of the License.
12
* This framework is distributed in the hope that it will be useful, but
13
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
17
* You should have received a copy of the GNU Lesser General Public License
18
* along with this framework; if not, see <http://www.gnu.org/licenses/>.
22
#include "sct_opengles2checkerroraction.h"
23
#include "sct_sicommon.h"
24
#include "sct_utils.h"
35
void* sctiCreateOpenGLES2CheckErrorActionContext( void* moduleContext, SCTAttributeList* attributes )
37
SCTOpenGLES2CheckErrorActionContext* context;
38
SCTOpenGLES2ModuleContext* mc;
40
SCT_ASSERT_ALWAYS( moduleContext != NULL );
41
SCT_ASSERT_ALWAYS( attributes != NULL );
43
mc = ( SCTOpenGLES2ModuleContext* )( moduleContext );
44
context = ( SCTOpenGLES2CheckErrorActionContext* )( siCommonMemoryAlloc( NULL, sizeof( SCTOpenGLES2CheckErrorActionContext ) ) );
47
SCT_LOG_ERROR( "Allocation failed in CheckError@OpenGLES2 context creation." );
50
memset( context, 0, sizeof( SCTOpenGLES2CheckErrorActionContext ) );
52
context->moduleContext = mc;
54
if( sctiParseOpenGLES2CheckErrorActionAttributes( &( context->data ), attributes ) == SCT_FALSE )
56
sctiDestroyOpenGLES2CheckErrorActionContext( context );
67
void sctiDestroyOpenGLES2CheckErrorActionContext( void* context )
73
siCommonMemoryFree( NULL, context );
80
SCTBoolean sctiOpenGLES2CheckErrorActionExecute( SCTAction* action, int frameNumber )
82
SCTOpenGLES2CheckErrorActionContext* context;
83
OpenGLES2CheckErrorActionData* data;
86
SCT_ASSERT( action != NULL );
87
SCT_ASSERT( action->context != NULL );
88
SCT_USE_VARIABLE( action );
89
SCT_USE_VARIABLE( frameNumber );
91
context = ( SCTOpenGLES2CheckErrorActionContext* )( action->context );
92
data = &( context->data );
96
if( err != GL_NO_ERROR )
99
sprintf( buf, "GL error %s, message \"%s\" in CheckError@OpenGLES2 action execute.",
100
sctiOpenGLES2GetErrorString( err ), data->message );
101
SCT_LOG_ERROR( buf );
103
#if defined( SCT_DEBUG )
104
siCommonDebugPrintf( NULL, "SPANDEX: %s", buf );
105
#endif /* defined( SCT_DEBUG ) */
117
void sctiOpenGLES2CheckErrorActionDestroy( SCTAction* action )
119
SCT_ASSERT_ALWAYS( action != NULL );
121
sctiDestroyOpenGLES2CheckErrorActionContext( action->context );
122
action->context = NULL;