am a5bb49f3: am 8f5780a5: Merge "Remove broken line interpolation tests from MR1...
[platform/upstream/VK-GL-CTS.git] / scripts / opengl / gen_query_util.py
1 # -*- coding: utf-8 -*-
2
3 #-------------------------------------------------------------------------
4 # drawElements Quality Program utilities
5 # --------------------------------------
6 #
7 # Copyright 2015 The Android Open Source Project
8 #
9 # Licensed under the Apache License, Version 2.0 (the "License");
10 # you may not use this file except in compliance with the License.
11 # You may obtain a copy of the License at
12 #
13 #      http://www.apache.org/licenses/LICENSE-2.0
14 #
15 # Unless required by applicable law or agreed to in writing, software
16 # distributed under the License is distributed on an "AS IS" BASIS,
17 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 # See the License for the specific language governing permissions and
19 # limitations under the License.
20 #
21 #-------------------------------------------------------------------------
22
23 from src_util import *
24 from khr_util.gen_str_util import genSetEnumUtilImpls, genQueryEnumUtilImpls
25
26 QUERY_NUM_OUT_ARGUMENTS = [
27
28         ("Basic", [
29                 ("VIEWPORT",                                            4),
30                 ("DEPTH_RANGE",                                         2),
31                 ("SCISSOR_BOX",                                         4),
32                 ("COLOR_WRITEMASK",                                     4),
33                 ("ALIASED_POINT_SIZE_RANGE",            2),
34                 ("ALIASED_LINE_WIDTH_RANGE",            2),
35                 ("MAX_VIEWPORT_DIMS",                           2),
36                 ("MAX_COMPUTE_WORK_GROUP_COUNT",        3),
37                 ("MAX_COMPUTE_WORK_GROUP_SIZE",         3),
38                 ("PRIMITIVE_BOUNDING_BOX_EXT",          8),
39                 ]),
40
41         ("Attribute", [
42                 ("CURRENT_VERTEX_ATTRIB",               4),
43                 ]),
44
45         ("Program", [
46                 ("COMPUTE_WORK_GROUP_SIZE",             3),
47                 ]),
48
49         ("TextureParam", [
50                 ("TEXTURE_BORDER_COLOR",                4),
51                 ]),
52 ]
53
54 SET_NUM_IN_ARGUMENTS = [
55         ("TextureParam", [
56                 ("TEXTURE_BORDER_COLOR",                4),
57                 ]),
58 ]
59
60
61 def addNamePrefix (prefix, groups):
62         return [(groupName, [(prefix + queryName, querySize) for queryName, querySize in groupQueries]) for groupName, groupQueries in groups]
63
64 def genQueryUtil (iface):
65         queryNumOutArgs = addNamePrefix("GL_", QUERY_NUM_OUT_ARGUMENTS);
66         setNumInArgs    = addNamePrefix("GL_", SET_NUM_IN_ARGUMENTS);
67
68         utilFile = os.path.join(OPENGL_DIR, "gluQueryUtil.inl")
69         writeInlFile(utilFile, genQueryEnumUtilImpls(iface, queryNumOutArgs))
70
71         utilFile = os.path.join(OPENGL_DIR, "gluCallLogUtil.inl")
72         writeInlFile(utilFile, genSetEnumUtilImpls(iface, setNumInArgs))
73
74 if __name__ == "__main__":
75         genQueryUtil(getHybridInterface())