1 /*-------------------------------------------------------------------------
2  * drawElements Quality Program Tester Core
3  * ----------------------------------------
4  *
5  * Copyright 2014 The Android Open Source Project
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  * \file
21  * \brief EGL common defines and types
22  *//*--------------------------------------------------------------------*/
23 
24 #include "egluStaticESLibrary.hpp"
25 #include "tcuFunctionLibrary.hpp"
26 
27 #define STATIC_LIB_NONE	0
28 #define STATIC_LIB_ES20	1
29 #define STATIC_LIB_ES30	2
30 #define STATIC_LIB_ES31	3
31 #define STATIC_LIB_ES32	4
32 
33 #if defined(DEQP_GLES32_DIRECT_LINK)
34 #	if (DE_OS == DE_OS_IOS)
35 #		include <OpenGLES/ES32/gl.h>
36 #	else
37 #		include <GLES3/gl32.h>
38 #	endif
39 #	define STATIC_LIB STATIC_LIB_ES32
40 #elif defined(DEQP_GLES31_DIRECT_LINK)
41 #	if (DE_OS == DE_OS_IOS)
42 #		include <OpenGLES/ES31/gl.h>
43 #	else
44 #		include <GLES3/gl31.h>
45 #	endif
46 #	define STATIC_LIB STATIC_LIB_ES31
47 #elif defined(DEQP_GLES3_DIRECT_LINK)
48 #	if (DE_OS == DE_OS_IOS)
49 #		include <OpenGLES/ES3/gl.h>
50 #	else
51 #		include <GLES3/gl3.h>
52 #	endif
53 #	define STATIC_LIB STATIC_LIB_ES30
54 #elif defined(DEQP_GLES2_DIRECT_LINK)
55 #	if (DE_OS == DE_OS_IOS)
56 #		include <OpenGLES/ES2/gl.h>
57 #	else
58 #		include <GLES2/gl2.h>
59 #	endif
60 #	define STATIC_LIB STATIC_LIB_ES20
61 #else
62 #	define STATIC_LIB STATIC_LIB_NONE
63 #endif
64 
65 namespace eglu
66 {
67 
createStaticESLibrary(void)68 tcu::FunctionLibrary* createStaticESLibrary (void)
69 {
70 #if (STATIC_LIB == STATIC_LIB_NONE)
71 	return new tcu::StaticFunctionLibrary(DE_NULL, 0);
72 #else
73 	static const tcu::StaticFunctionLibrary::Entry s_functions[] =
74 	{
75 #if (STATIC_LIB == STATIC_LIB_ES32)
76 #	include "egluStaticES32Library.inl"
77 #elif (STATIC_LIB == STATIC_LIB_ES31)
78 #	include "egluStaticES31Library.inl"
79 #elif (STATIC_LIB == STATIC_LIB_ES30)
80 #	include "egluStaticES30Library.inl"
81 #elif (STATIC_LIB == STATIC_LIB_ES20)
82 #	include "egluStaticES20Library.inl"
83 #else
84 #	error "Unknown STATIC_LIB value"
85 #endif
86 	};
87 
88 	return new tcu::StaticFunctionLibrary(&s_functions[0], DE_LENGTH_OF_ARRAY(s_functions));
89 #endif
90 }
91 
92 } // eglu
93