Merge vk-gl-cts/vulkan-cts-1.0.2 into vk-gl-cts/master
[platform/upstream/VK-GL-CTS.git] / framework / egl / egluStaticESLibrary.cpp
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
31 #if defined(DEQP_GLES3_DIRECT_LINK)
32 #       if (DE_OS == DE_OS_IOS)
33 #               include <OpenGLES/ES3/gl.h>
34 #       else
35 #               include <GLES3/gl3.h>
36 #       endif
37 #       define STATIC_LIB STATIC_LIB_ES30
38 #elif defined(DEQP_GLES2_DIRECT_LINK)
39 #       if (DE_OS == DE_OS_IOS)
40 #               include <OpenGLES/ES2/gl.h>
41 #       else
42 #               include <GLES2/gl2.h>
43 #       endif
44 #       define STATIC_LIB STATIC_LIB_ES20
45 #else
46 #       define STATIC_LIB STATIC_LIB_NONE
47 #endif
48
49 // \todo [2014-03-14 pyry] ES3.1 support
50
51 namespace eglu
52 {
53
54 tcu::FunctionLibrary* createStaticESLibrary (void)
55 {
56 #if (STATIC_LIB == STATIC_LIB_NONE)
57         return new tcu::StaticFunctionLibrary(DE_NULL, 0);
58 #else
59         static const tcu::StaticFunctionLibrary::Entry s_functions[] =
60         {
61 #if (STATIC_LIB == STATIC_LIB_ES30)
62 #       include "egluStaticES30Library.inl"
63 #elif (STATIC_LIB == STATIC_LIB_ES20)
64 #       include "egluStaticES20Library.inl"
65 #else
66 #       error "Unknown STATIC_LIB value"
67 #endif
68         };
69
70         return new tcu::StaticFunctionLibrary(&s_functions[0], DE_LENGTH_OF_ARRAY(s_functions));
71 #endif
72 }
73
74 } // eglu