1 # -*- coding: utf-8 -*-
3 #-------------------------------------------------------------------------
4 # drawElements Quality Program utilities
5 # --------------------------------------
7 # Copyright 2015 The Android Open Source Project
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
13 # http://www.apache.org/licenses/LICENSE-2.0
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.
21 #-------------------------------------------------------------------------
28 sys.path.append(os.path.dirname(os.path.dirname(__file__)))
30 from src_util import *
31 from khr_util.gen_str_util import addValuePrefix, genStrUtilProtos, genStrUtilImpls
36 ("BufferMask", ["DEPTH_BUFFER_BIT", "STENCIL_BUFFER_BIT", "COLOR_BUFFER_BIT"]),
41 "MAP_INVALIDATE_RANGE_BIT",
42 "MAP_INVALIDATE_BUFFER_BIT",
43 "MAP_FLUSH_EXPLICIT_BIT",
44 "MAP_UNSYNCHRONIZED_BIT"
47 ("MemoryBarrierFlags", [
48 "VERTEX_ATTRIB_ARRAY_BARRIER_BIT",
49 "ELEMENT_ARRAY_BARRIER_BIT",
50 "UNIFORM_BARRIER_BIT",
51 "TEXTURE_FETCH_BARRIER_BIT",
52 "SHADER_IMAGE_ACCESS_BARRIER_BIT",
53 "COMMAND_BARRIER_BIT",
54 "PIXEL_BUFFER_BARRIER_BIT",
55 "TEXTURE_UPDATE_BARRIER_BIT",
56 "BUFFER_UPDATE_BARRIER_BIT",
57 "FRAMEBUFFER_BARRIER_BIT",
58 "TRANSFORM_FEEDBACK_BARRIER_BIT",
59 "ATOMIC_COUNTER_BARRIER_BIT"
64 "FRAGMENT_SHADER_BIT",
66 "GEOMETRY_SHADER_BIT",
67 "TESS_CONTROL_SHADER_BIT",
68 "TESS_EVALUATION_SHADER_BIT"
77 ("Error", ["NO_ERROR", "INVALID_ENUM", "INVALID_VALUE", "INVALID_OPERATION", "OUT_OF_MEMORY",
78 "INVALID_FRAMEBUFFER_OPERATION"]),
79 # PixelType, partially
90 "UNSIGNED_SHORT_5_6_5",
91 "UNSIGNED_SHORT_4_4_4_4",
92 "UNSIGNED_SHORT_5_5_5_1",
97 "UNSIGNED_INT_2_10_10_10_REV",
98 "UNSIGNED_INT_10F_11F_11F_REV",
99 "UNSIGNED_INT_5_9_9_9_REV",
101 "FLOAT_32_UNSIGNED_INT_24_8_REV",
103 "UNSIGNED_NORMALIZED",
109 # GetPName, also GettableState below
113 "ALIASED_POINT_SIZE_RANGE",
114 "ALIASED_LINE_WIDTH_RANGE",
121 "STENCIL_CLEAR_VALUE",
124 "STENCIL_PASS_DEPTH_FAIL",
125 "STENCIL_PASS_DEPTH_PASS",
127 "STENCIL_VALUE_MASK",
131 "STENCIL_BACK_PASS_DEPTH_FAIL",
132 "STENCIL_BACK_PASS_DEPTH_PASS",
134 "STENCIL_BACK_VALUE_MASK",
135 "STENCIL_BACK_WRITEMASK",
152 "POLYGON_OFFSET_UNITS",
153 "POLYGON_OFFSET_FILL",
154 "POLYGON_OFFSET_FACTOR",
155 "TEXTURE_BINDING_2D",
158 "SAMPLE_COVERAGE_VALUE",
159 "SAMPLE_COVERAGE_INVERT",
161 "MAX_CUBE_MAP_TEXTURE_SIZE",
162 "MAX_RENDERBUFFER_SIZE",
165 "MAX_VERTEX_ATTRIBS",
166 "MAX_VERTEX_UNIFORM_VECTORS",
167 "MAX_VARYING_VECTORS",
168 "MAX_COMBINED_TEXTURE_IMAGE_UNITS",
169 "MAX_VERTEX_TEXTURE_IMAGE_UNITS",
170 "MAX_TEXTURE_IMAGE_UNITS",
171 "MAX_FRAGMENT_UNIFORM_VECTORS"
178 "ACTIVE_ATTRIBUTE_MAX_LENGTH",
180 "ACTIVE_UNIFORM_BLOCKS",
181 "ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH",
182 "ACTIVE_UNIFORM_MAX_LENGTH",
187 "PROGRAM_BINARY_RETRIEVABLE_HINT",
188 "TRANSFORM_FEEDBACK_BUFFER_MODE",
189 "TRANSFORM_FEEDBACK_VARYINGS",
190 "TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH",
192 "GEOMETRY_INPUT_TYPE",
193 "GEOMETRY_OUTPUT_TYPE",
194 "GEOMETRY_VERTICES_OUT",
195 "GEOMETRY_SHADER_INVOCATIONS",
197 "COMPUTE_WORK_GROUP_SIZE",
198 "ACTIVE_ATOMIC_COUNTER_BUFFERS",
199 "TESS_CONTROL_OUTPUT_VERTICES",
202 "TESS_GEN_VERTEX_ORDER",
203 "TESS_GEN_POINT_MODE",
211 "UNIFORM_NAME_LENGTH",
212 "UNIFORM_BLOCK_INDEX",
214 "UNIFORM_ARRAY_STRIDE",
215 "UNIFORM_MATRIX_STRIDE",
216 "UNIFORM_IS_ROW_MAJOR"
221 ("FramebufferAttachment", ["COLOR_ATTACHMENT0", "COLOR_ATTACHMENT1", "COLOR_ATTACHMENT2", "COLOR_ATTACHMENT3",
222 "COLOR_ATTACHMENT4", "COLOR_ATTACHMENT5", "COLOR_ATTACHMENT6", "COLOR_ATTACHMENT7",
223 "COLOR_ATTACHMENT8", "COLOR_ATTACHMENT9", "COLOR_ATTACHMENT10", "COLOR_ATTACHMENT11",
224 "COLOR_ATTACHMENT12", "COLOR_ATTACHMENT13", "COLOR_ATTACHMENT14", "COLOR_ATTACHMENT15",
225 "DEPTH_ATTACHMENT", "STENCIL_ATTACHMENT", "DEPTH_STENCIL_ATTACHMENT",
226 "BACK", "FRONT_LEFT", "FRONT_RIGHT", "BACK_LEFT", "BACK_RIGHT",
227 "DEPTH", "STENCIL"]),
229 ("FramebufferAttachmentParameter", ["FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE", "FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",
230 "FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL", "FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",
231 "FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER", "FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE",
232 "FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING", "FRAMEBUFFER_ATTACHMENT_RED_SIZE",
233 "FRAMEBUFFER_ATTACHMENT_GREEN_SIZE", "FRAMEBUFFER_ATTACHMENT_BLUE_SIZE",
234 "FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE", "FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE",
235 "FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE", "FRAMEBUFFER_ATTACHMENT_LAYERED"]),
236 ("FramebufferTarget", ["FRAMEBUFFER", "RENDERBUFFER", "DRAW_FRAMEBUFFER", "READ_FRAMEBUFFER"]),
237 ("FramebufferStatus", ["FRAMEBUFFER_COMPLETE", "FRAMEBUFFER_INCOMPLETE_ATTACHMENT", "FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",
238 "FRAMEBUFFER_INCOMPLETE_DIMENSIONS", "FRAMEBUFFER_UNSUPPORTED", "FRAMEBUFFER_INCOMPLETE_MULTISAMPLE",
239 "FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS"]),
240 ("FramebufferAttachmentType", ["NONE", "FRAMEBUFFER_DEFAULT", "TEXTURE", "RENDERBUFFER"]),
241 ("FramebufferColorEncoding", ["LINEAR", "SRGB"]),
243 ("FramebufferParameter", [
244 "FRAMEBUFFER_DEFAULT_WIDTH",
245 "FRAMEBUFFER_DEFAULT_HEIGHT",
246 "FRAMEBUFFER_DEFAULT_SAMPLES",
247 "FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS",
248 "FRAMEBUFFER_DEFAULT_LAYERS",
252 ("RenderbufferParameter", ["RENDERBUFFER_WIDTH", "RENDERBUFFER_HEIGHT", "RENDERBUFFER_INTERNAL_FORMAT", "RENDERBUFFER_RED_SIZE",
253 "RENDERBUFFER_GREEN_SIZE", "RENDERBUFFER_BLUE_SIZE", "RENDERBUFFER_ALPHA_SIZE", "RENDERBUFFER_DEPTH_SIZE",
254 "RENDERBUFFER_STENCIL_SIZE", "RENDERBUFFER_SAMPLES"]),
257 ("PrimitiveType", ["POINTS", "LINES", "LINE_STRIP", "LINE_LOOP", "TRIANGLES", "TRIANGLE_STRIP", "TRIANGLE_FAN", "LINES_ADJACENCY", "LINE_STRIP_ADJACENCY", "TRIANGLES_ADJACENCY", "TRIANGLE_STRIP_ADJACENCY"]),
260 ("BlendFactor", ["ZERO", "ONE", "SRC_ALPHA_SATURATE",
261 "SRC_COLOR", "ONE_MINUS_SRC_COLOR", "SRC_ALPHA", "ONE_MINUS_SRC_ALPHA",
262 "SRC1_COLOR", "ONE_MINUS_SRC1_COLOR", "SRC1_ALPHA", "ONE_MINUS_SRC1_ALPHA",
263 "DST_COLOR", "ONE_MINUS_DST_COLOR", "DST_ALPHA", "ONE_MINUS_DST_ALPHA",
264 "CONSTANT_COLOR", "ONE_MINUS_CONSTANT_COLOR", "CONSTANT_ALPHA", "ONE_MINUS_CONSTANT_ALPHA"]),
268 "FUNC_REVERSE_SUBTRACT",
283 "HSL_SATURATION_KHR",
285 "HSL_LUMINOSITY_KHR",
291 "ELEMENT_ARRAY_BUFFER",
295 "PIXEL_UNPACK_BUFFER",
296 "TRANSFORM_FEEDBACK_BUFFER",
298 "DRAW_INDIRECT_BUFFER",
299 "SHADER_STORAGE_BUFFER",
301 "DISPATCH_INDIRECT_BUFFER",
302 "ATOMIC_COUNTER_BUFFER",
304 ("BufferBinding", ["ARRAY_BUFFER_BINDING", "ELEMENT_ARRAY_BUFFER_BINDING"]),
315 ("BufferQuery", ["BUFFER_SIZE", "BUFFER_USAGE", "BUFFER_ACCESS_FLAGS", "BUFFER_MAPPED", "BUFFER_MAP_OFFSET", "BUFFER_MAP_LENGTH"]),
318 ("Face", ["FRONT", "BACK", "FRONT_AND_BACK"]),
320 # Comparison function
321 ("CompareFunc", ["NEVER", "LESS", "LEQUAL", "GREATER", "EQUAL", "NOTEQUAL", "GEQUAL", "ALWAYS"]),
324 ("EnableCap", ["TEXTURE_2D", "CULL_FACE", "BLEND", "DITHER", "STENCIL_TEST", "DEPTH_TEST", "SCISSOR_TEST",
325 "POLYGON_OFFSET_FILL", "SAMPLE_ALPHA_TO_COVERAGE", "SAMPLE_COVERAGE",
326 "PRIMITIVE_RESTART_FIXED_INDEX", "RASTERIZER_DISCARD",
327 "FRAMEBUFFER_SRGB", "SAMPLE_SHADING", "DEPTH_CLAMP",
328 "PRIMITIVE_RESTART", "SAMPLE_MASK", "DEBUG_OUTPUT", "DEBUG_OUTPUT_SYNCHRONOUS",
329 "BLEND_ADVANCED_COHERENT_KHR"]),
331 # Indexed enable-disable bit
332 ("IndexedEnableCap", ["BLEND"]),
335 ("Winding", ["CW", "CCW"]),
338 ("HintMode", ["DONT_CARE", "FASTEST", "NICEST"]),
339 ("Hint", ["GENERATE_MIPMAP_HINT"]),
342 ("StencilOp", ["ZERO", "KEEP", "REPLACE", "INCR", "DECR", "INVERT", "INCR_WRAP", "DECR_WRAP"]),
349 "TESS_CONTROL_SHADER",
350 "TESS_EVALUATION_SHADER",
355 ("Buffer", ["COLOR", "DEPTH", "STENCIL", "DEPTH_STENCIL"]),
357 # Invalidate buffer target
358 ("InvalidateAttachment",["COLOR", "DEPTH", "STENCIL",
368 "STENCIL_ATTACHMENT",
369 "DEPTH_STENCIL_ATTACHMENT"]),
371 # Draw/ReadBuffer attachment
372 ("DrawReadBuffer", ["COLOR", "DEPTH", "STENCIL", "BACK", "NONE",
382 "STENCIL_ATTACHMENT",
383 "DEPTH_STENCIL_ATTACHMENT"]),
386 ("TextureTarget", ["TEXTURE_1D",
387 "TEXTURE_2D", "TEXTURE_CUBE_MAP",
388 "TEXTURE_CUBE_MAP_POSITIVE_X", "TEXTURE_CUBE_MAP_NEGATIVE_X",
389 "TEXTURE_CUBE_MAP_POSITIVE_Y", "TEXTURE_CUBE_MAP_NEGATIVE_Y",
390 "TEXTURE_CUBE_MAP_POSITIVE_Z", "TEXTURE_CUBE_MAP_NEGATIVE_Z",
391 "TEXTURE_3D", "TEXTURE_2D_ARRAY", "TEXTURE_2D_MULTISAMPLE",
392 "TEXTURE_2D_MULTISAMPLE_ARRAY",
394 "TEXTURE_CUBE_MAP_ARRAY"]),
395 ("TextureParameter", [
399 "TEXTURE_BASE_LEVEL",
401 "TEXTURE_COMPARE_MODE",
402 "TEXTURE_COMPARE_FUNC",
409 "TEXTURE_MIN_FILTER",
410 "TEXTURE_MAG_FILTER",
411 "DEPTH_STENCIL_TEXTURE_MODE",
412 "TEXTURE_SRGB_DECODE_EXT",
413 "TEXTURE_BORDER_COLOR",
416 "TEXTURE_IMMUTABLE_LEVELS",
417 "TEXTURE_IMMUTABLE_FORMAT",
419 ("TextureLevelParameter", [
421 "TEXTURE_FIXED_SAMPLE_LOCATIONS",
425 "TEXTURE_INTERNAL_FORMAT",
427 "TEXTURE_GREEN_SIZE",
429 "TEXTURE_ALPHA_SIZE",
430 "TEXTURE_DEPTH_SIZE",
431 "TEXTURE_STENCIL_SIZE",
432 "TEXTURE_SHARED_SIZE",
434 "TEXTURE_GREEN_TYPE",
436 "TEXTURE_ALPHA_TYPE",
437 "TEXTURE_DEPTH_TYPE",
438 "TEXTURE_COMPRESSED",
439 "TEXTURE_BUFFER_DATA_STORE_BINDING",
440 "TEXTURE_BUFFER_OFFSET",
441 "TEXTURE_BUFFER_SIZE",
443 ("RepeatMode", ["REPEAT", "CLAMP_TO_EDGE", "MIRRORED_REPEAT", "CLAMP_TO_BORDER"]),
444 ("TextureFilter", ["NEAREST", "LINEAR", "NEAREST_MIPMAP_NEAREST", "LINEAR_MIPMAP_NEAREST",
445 "NEAREST_MIPMAP_LINEAR", "LINEAR_MIPMAP_LINEAR"]),
446 ("TextureWrapMode", ["REPEAT", "CLAMP_TO_EDGE", "MIRRORED_REPEAT"]),
447 ("TextureSwizzle", ["RED", "GREEN", "BLUE", "ALPHA", "ZERO", "ONE"]),
448 ("TextureCompareMode", ["NONE", "COMPARE_REF_TO_TEXTURE"]),
449 ("CubeMapFace", ["TEXTURE_CUBE_MAP_POSITIVE_X", "TEXTURE_CUBE_MAP_NEGATIVE_X",
450 "TEXTURE_CUBE_MAP_POSITIVE_Y", "TEXTURE_CUBE_MAP_NEGATIVE_Y",
451 "TEXTURE_CUBE_MAP_POSITIVE_Z", "TEXTURE_CUBE_MAP_NEGATIVE_Z"]),
452 ("TextureDepthStencilMode", ["DEPTH_COMPONENT", "STENCIL_INDEX"]),
453 ("PixelStoreParameter", [
455 "UNPACK_IMAGE_HEIGHT",
457 "UNPACK_SKIP_IMAGES",
459 "UNPACK_SKIP_PIXELS",
462 "PACK_SKIP_PIXELS"]),
463 ("UncompressedTextureFormat", [
464 # GLES2 unsized formats
471 # GLES2 sized formats
478 # GLES3 unsized formats
488 # GLES3 sized formats
543 "DEPTH_COMPONENT32F",
548 # OES_required_internalformat
558 # GL_EXT_texture_sRGB_R8 & RG8
562 # GL_EXT_read_format_bgra
566 ("CompressedTextureFormat", [
568 "COMPRESSED_R11_EAC",
569 "COMPRESSED_SIGNED_R11_EAC",
570 "COMPRESSED_RG11_EAC",
571 "COMPRESSED_SIGNED_RG11_EAC",
572 "COMPRESSED_RGB8_ETC2",
573 "COMPRESSED_SRGB8_ETC2",
574 "COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",
575 "COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",
576 "COMPRESSED_RGBA8_ETC2_EAC",
577 "COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",
580 "COMPRESSED_RGBA_ASTC_4x4_KHR",
581 "COMPRESSED_RGBA_ASTC_5x4_KHR",
582 "COMPRESSED_RGBA_ASTC_5x5_KHR",
583 "COMPRESSED_RGBA_ASTC_6x5_KHR",
584 "COMPRESSED_RGBA_ASTC_6x6_KHR",
585 "COMPRESSED_RGBA_ASTC_8x5_KHR",
586 "COMPRESSED_RGBA_ASTC_8x6_KHR",
587 "COMPRESSED_RGBA_ASTC_8x8_KHR",
588 "COMPRESSED_RGBA_ASTC_10x5_KHR",
589 "COMPRESSED_RGBA_ASTC_10x6_KHR",
590 "COMPRESSED_RGBA_ASTC_10x8_KHR",
591 "COMPRESSED_RGBA_ASTC_10x10_KHR",
592 "COMPRESSED_RGBA_ASTC_12x10_KHR",
593 "COMPRESSED_RGBA_ASTC_12x12_KHR",
594 "COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR",
595 "COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR",
596 "COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR",
597 "COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR",
598 "COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR",
599 "COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR",
600 "COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR",
601 "COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR",
602 "COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR",
603 "COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR",
604 "COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR",
605 "COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR",
606 "COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR",
607 "COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR",
609 # EXT_texture_compression_s3tc
610 "COMPRESSED_RGB_S3TC_DXT1_EXT",
611 "COMPRESSED_RGBA_S3TC_DXT1_EXT",
612 "COMPRESSED_RGBA_S3TC_DXT3_EXT",
613 "COMPRESSED_RGBA_S3TC_DXT5_EXT",
615 # IMG_texture_compression_pvrtc
616 "COMPRESSED_RGB_PVRTC_4BPPV1_IMG",
617 "COMPRESSED_RGB_PVRTC_2BPPV1_IMG",
618 "COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",
619 "COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",
654 "SAMPLER_2D_ARRAY_SHADOW",
655 "SAMPLER_CUBE_SHADOW",
659 "INT_SAMPLER_2D_ARRAY",
660 "UNSIGNED_INT_SAMPLER_2D",
661 "UNSIGNED_INT_SAMPLER_3D",
662 "UNSIGNED_INT_SAMPLER_CUBE",
663 "UNSIGNED_INT_SAMPLER_2D_ARRAY",
664 "SAMPLER_2D_MULTISAMPLE",
665 "INT_SAMPLER_2D_MULTISAMPLE",
666 "UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE",
674 "INT_IMAGE_2D_ARRAY",
675 "UNSIGNED_INT_IMAGE_2D",
676 "UNSIGNED_INT_IMAGE_3D",
677 "UNSIGNED_INT_IMAGE_CUBE",
678 "UNSIGNED_INT_IMAGE_2D_ARRAY",
679 "UNSIGNED_INT_ATOMIC_COUNTER",
680 "SAMPLER_2D_MULTISAMPLE_ARRAY",
681 "INT_SAMPLER_2D_MULTISAMPLE_ARRAY",
682 "UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY",
684 "INT_SAMPLER_BUFFER",
685 "UNSIGNED_INT_SAMPLER_BUFFER",
688 "UNSIGNED_INT_IMAGE_BUFFER",
689 "SAMPLER_CUBE_MAP_ARRAY",
690 "SAMPLER_CUBE_MAP_ARRAY_SHADOW",
691 "INT_SAMPLER_CUBE_MAP_ARRAY",
692 "UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY",
693 "IMAGE_CUBE_MAP_ARRAY",
694 "INT_IMAGE_CUBE_MAP_ARRAY",
695 "UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY",
699 ("ShaderParam", [ "SHADER_TYPE", "DELETE_STATUS", "COMPILE_STATUS", "INFO_LOG_LENGTH", "SHADER_SOURCE_LENGTH"]),
701 # Vertex attribute queries
702 ("VertexAttribParameterName", [
703 "VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",
704 "VERTEX_ATTRIB_ARRAY_ENABLED",
705 "VERTEX_ATTRIB_ARRAY_SIZE",
706 "VERTEX_ATTRIB_ARRAY_STRIDE",
707 "VERTEX_ATTRIB_ARRAY_TYPE",
708 "VERTEX_ATTRIB_ARRAY_NORMALIZED",
709 "VERTEX_ATTRIB_ARRAY_INTEGER",
710 "VERTEX_ATTRIB_ARRAY_DIVISOR",
711 "CURRENT_VERTEX_ATTRIB",
712 "VERTEX_ATTRIB_BINDING",
713 "VERTEX_ATTRIB_RELATIVE_OFFSET",
716 ("Boolean", ["FALSE", "TRUE"]),
720 "ELEMENT_ARRAY_BUFFER_BINDING", "ARRAY_BUFFER_BINDING", "VERTEX_ARRAY_BINDING", "VIEWPORT", "DEPTH_RANGE",
721 "TRANSFORM_FEEDBACK_BINDING", "LINE_WIDTH", "CULL_FACE_MODE", "FRONT_FACE", "POLYGON_OFFSET_FACTOR",
722 "POLYGON_OFFSET_UNITS", "SAMPLE_COVERAGE_VALUE", "SAMPLE_COVERAGE_INVERT", "ACTIVE_TEXTURE", "TEXTURE_BINDING_1D",
723 "TEXTURE_BINDING_2D", "TEXTURE_BINDING_3D", "TEXTURE_BINDING_2D_ARRAY",
724 "TEXTURE_BINDING_CUBE_MAP", "SAMPLER_BINDING", "SCISSOR_BOX", "STENCIL_FUNC", "STENCIL_VALUE_MASK",
725 "STENCIL_REF", "STENCIL_FAIL", "STENCIL_PASS_DEPTH_FAIL", "STENCIL_PASS_DEPTH_PASS", "STENCIL_BACK_FUNC",
726 "STENCIL_BACK_VALUE_MASK", "STENCIL_BACK_REF", "STENCIL_BACK_FAIL", "STENCIL_BACK_PASS_DEPTH_FAIL", "STENCIL_BACK_PASS_DEPTH_PASS",
727 "DEPTH_FUNC", "BLEND_SRC_RGB", "BLEND_SRC_ALPHA", "BLEND_DST_RGB", "BLEND_DST_ALPHA",
728 "BLEND_EQUATION_RGB", "BLEND_EQUATION_ALPHA", "BLEND_COLOR", "COLOR_WRITEMASK", "DEPTH_WRITEMASK",
729 "STENCIL_WRITEMASK", "STENCIL_BACK_WRITEMASK", "COLOR_CLEAR_VALUE", "DEPTH_CLEAR_VALUE", "STENCIL_CLEAR_VALUE",
730 "DRAW_FRAMEBUFFER_BINDING", "READ_FRAMEBUFFER_BINDING", "RENDERBUFFER_BINDING", "DRAW_BUFFER0", "DRAW_BUFFER1",
731 "DRAW_BUFFER2", "DRAW_BUFFER3", "DRAW_BUFFER4", "DRAW_BUFFER5", "DRAW_BUFFER6",
732 "DRAW_BUFFER7", "DRAW_BUFFER8", "DRAW_BUFFER9", "DRAW_BUFFER10", "DRAW_BUFFER11",
733 "DRAW_BUFFER12", "DRAW_BUFFER13", "DRAW_BUFFER14", "DRAW_BUFFER15", "READ_BUFFER",
734 "UNPACK_IMAGE_HEIGHT", "UNPACK_SKIP_IMAGES", "UNPACK_ROW_LENGTH", "UNPACK_SKIP_ROWS", "UNPACK_SKIP_PIXELS",
735 "UNPACK_ALIGNMENT", "PACK_ROW_LENGTH", "PACK_SKIP_ROWS", "PACK_SKIP_PIXELS", "PACK_ALIGNMENT",
736 "PIXEL_PACK_BUFFER_BINDING", "PIXEL_UNPACK_BUFFER_BINDING", "CURRENT_PROGRAM", "TRANSFORM_FEEDBACK_BUFFER_BINDING", "TRANSFORM_FEEDBACK_PAUSED",
737 "TRANSFORM_FEEDBACK_ACTIVE", "UNIFORM_BUFFER_BINDING", "GENERATE_MIPMAP_HINT", "FRAGMENT_SHADER_DERIVATIVE_HINT", "MAX_ELEMENT_INDEX",
738 "SUBPIXEL_BITS", "MAX_3D_TEXTURE_SIZE", "MAX_TEXTURE_SIZE", "MAX_ARRAY_TEXTURE_LAYERS", "MAX_TEXTURE_LOD_BIAS",
739 "MAX_CUBE_MAP_TEXTURE_SIZE", "MAX_RENDERBUFFER_SIZE", "MAX_DRAW_BUFFERS", "MAX_COLOR_ATTACHMENTS", "MAX_VIEWPORT_DIMS",
740 "ALIASED_POINT_SIZE_RANGE", "ALIASED_LINE_WIDTH_RANGE", "MAX_ELEMENTS_INDICES", "MAX_ELEMENTS_VERTICES", "COMPRESSED_TEXTURE_FORMATS",
741 "NUM_COMPRESSED_TEXTURE_FORMATS", "PROGRAM_BINARY_FORMATS", "NUM_PROGRAM_BINARY_FORMATS", "SHADER_BINARY_FORMATS", "NUM_SHADER_BINARY_FORMATS",
742 "SHADER_COMPILER", "MAX_SERVER_WAIT_TIMEOUT", "NUM_EXTENSIONS", "MAJOR_VERSION", "MINOR_VERSION",
743 "MAX_VERTEX_ATTRIBS", "MAX_VERTEX_UNIFORM_COMPONENTS", "MAX_VERTEX_UNIFORM_VECTORS", "MAX_VERTEX_UNIFORM_BLOCKS", "MAX_VERTEX_OUTPUT_COMPONENTS",
744 "MAX_VERTEX_TEXTURE_IMAGE_UNITS", "MAX_FRAGMENT_UNIFORM_COMPONENTS", "MAX_FRAGMENT_UNIFORM_VECTORS", "MAX_FRAGMENT_UNIFORM_BLOCKS", "MAX_FRAGMENT_INPUT_COMPONENTS",
745 "MAX_TEXTURE_IMAGE_UNITS", "MIN_PROGRAM_TEXEL_OFFSET", "MAX_PROGRAM_TEXEL_OFFSET", "MAX_UNIFORM_BUFFER_BINDINGS", "MAX_UNIFORM_BLOCK_SIZE",
746 "UNIFORM_BUFFER_OFFSET_ALIGNMENT", "MAX_COMBINED_UNIFORM_BLOCKS", "MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS", "MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS", "MAX_VARYING_COMPONENTS",
747 "MAX_VARYING_VECTORS", "MAX_COMBINED_TEXTURE_IMAGE_UNITS", "MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS", "MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS", "MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS",
748 "SAMPLE_BUFFERS", "SAMPLES", "MAX_SAMPLES", "DEPTH_BITS", "STENCIL_BITS",
749 "IMPLEMENTATION_COLOR_READ_TYPE", "IMPLEMENTATION_COLOR_READ_FORMAT", "COPY_READ_BUFFER_BINDING", "COPY_WRITE_BUFFER_BINDING", "RED_BITS",
750 "GREEN_BITS", "BLUE_BITS", "ALPHA_BITS", "MAX_COLOR_TEXTURE_SAMPLES", "TIMESTAMP",
751 "MAX_DEPTH_TEXTURE_SAMPLES", "MAX_INTEGER_SAMPLES", "TEXTURE_BINDING_2D_MULTISAMPLE", "TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY", "MAX_VERTEX_ATTRIB_STRIDE",
752 "MAX_VERTEX_ATTRIB_BINDINGS", "MAX_VERTEX_ATTRIB_RELATIVE_OFFSET", "MIN_SAMPLE_SHADING_VALUE", "FRAGMENT_INTERPOLATION_OFFSET_BITS", "MAX_FRAGMENT_INTERPOLATION_OFFSET",
753 "MIN_FRAGMENT_INTERPOLATION_OFFSET", "MAX_GEOMETRY_SHADER_INVOCATIONS", "LAYER_PROVOKING_VERTEX", "MAX_GEOMETRY_UNIFORM_COMPONENTS", "MAX_GEOMETRY_SHADER_STORAGE_BLOCKS",
754 "MAX_GEOMETRY_UNIFORM_BLOCKS", "MAX_GEOMETRY_INPUT_COMPONENTS", "MAX_GEOMETRY_OUTPUT_COMPONENTS", "MAX_GEOMETRY_IMAGE_UNIFORMS", "MAX_GEOMETRY_TEXTURE_IMAGE_UNITS",
755 "MAX_GEOMETRY_OUTPUT_VERTICES", "MAX_GEOMETRY_ATOMIC_COUNTERS", "MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS", "MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS", "MAX_FRAMEBUFFER_LAYERS",
756 "PROVOKING_VERTEX", "PRIMITIVE_RESTART_INDEX", "MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS", "MAX_FRAGMENT_ATOMIC_COUNTERS", "MAX_FRAGMENT_IMAGE_UNIFORMS",
757 "MAX_COMPUTE_UNIFORM_BLOCKS", "MAX_COMPUTE_TEXTURE_IMAGE_UNITS", "MAX_COMPUTE_UNIFORM_COMPONENTS", "MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS", "MAX_COMPUTE_ATOMIC_COUNTERS",
758 "MAX_COMPUTE_IMAGE_UNIFORMS", "MAX_COMPUTE_SHADER_STORAGE_BLOCKS", "MAX_FRAGMENT_SHADER_STORAGE_BLOCKS", "MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS", "MAX_VERTEX_ATOMIC_COUNTER_BUFFERS",
759 "MAX_VERTEX_ATOMIC_COUNTERS", "MAX_VERTEX_IMAGE_UNIFORMS", "MAX_VERTEX_SHADER_STORAGE_BLOCKS", "MAX_COMBINED_SHADER_OUTPUT_RESOURCES", "MAX_ATOMIC_COUNTER_BUFFER_BINDINGS",
760 "MAX_ATOMIC_COUNTER_BUFFER_SIZE", "MAX_IMAGE_UNITS", "MAX_COMBINED_ATOMIC_COUNTER_BUFFERS", "MAX_COMBINED_IMAGE_UNIFORMS", "MAX_SHADER_STORAGE_BUFFER_BINDINGS",
761 "MAX_SHADER_STORAGE_BLOCK_SIZE", "MAX_COMBINED_ATOMIC_COUNTERS", "MAX_COMBINED_SHADER_STORAGE_BLOCKS", "SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT", "PRIMITIVE_BOUNDING_BOX_EXT",
762 "DRAW_INDIRECT_BUFFER_BINDING", "MAX_SAMPLE_MASK_WORDS", "PROGRAM_PIPELINE_BINDING", "ATOMIC_COUNTER_BUFFER_BINDING", "SHADER_STORAGE_BUFFER_BINDING",
763 "DISPATCH_INDIRECT_BUFFER_BINDING", "MAX_FRAMEBUFFER_WIDTH", "MAX_FRAMEBUFFER_HEIGHT", "MAX_FRAMEBUFFER_SAMPLES", "MAX_COMPUTE_SHARED_MEMORY_SIZE",
764 "MIN_PROGRAM_TEXTURE_GATHER_OFFSET", "MAX_PROGRAM_TEXTURE_GATHER_OFFSET", "MAX_COMPUTE_WORK_GROUP_INVOCATIONS", "MAX_UNIFORM_LOCATIONS", "MAX_DEBUG_MESSAGE_LENGTH",
765 "MAX_DEBUG_LOGGED_MESSAGES", "MAX_DEBUG_GROUP_STACK_DEPTH", "MAX_LABEL_LENGTH", "CONTEXT_FLAGS", "DEBUG_LOGGED_MESSAGES",
766 "DEBUG_NEXT_LOGGED_MESSAGE_LENGTH", "DEBUG_GROUP_STACK_DEPTH", "MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS", "TEXTURE_BUFFER_OFFSET_ALIGNMENT", "TEXTURE_BUFFER_BINDING",
767 "TEXTURE_BINDING_BUFFER", "MAX_TEXTURE_BUFFER_SIZE", "MAX_PATCH_VERTICES", "MAX_TESS_GEN_LEVEL", "MAX_TESS_CONTROL_UNIFORM_COMPONENTS",
768 "MAX_TESS_EVALUATION_UNIFORM_COMPONENTS", "MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS", "MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS", "MAX_TESS_CONTROL_OUTPUT_COMPONENTS", "MAX_TESS_PATCH_COMPONENTS",
769 "MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS", "MAX_TESS_EVALUATION_OUTPUT_COMPONENTS", "MAX_TESS_CONTROL_UNIFORM_BLOCKS", "MAX_TESS_EVALUATION_UNIFORM_BLOCKS", "MAX_TESS_CONTROL_INPUT_COMPONENTS",
770 "MAX_TESS_EVALUATION_INPUT_COMPONENTS", "MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS", "MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS", "MAX_TESS_CONTROL_ATOMIC_COUNTERS", "MAX_TESS_EVALUATION_ATOMIC_COUNTERS",
771 "MAX_TESS_CONTROL_IMAGE_UNIFORMS", "MAX_TESS_EVALUATION_IMAGE_UNIFORMS", "MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS", "MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS","MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS",
772 "MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS", "PATCH_VERTICES", "PRIMITIVE_RESTART_FOR_PATCHES_SUPPORTED"
775 ("GettableIndexedState", [
776 "TRANSFORM_FEEDBACK_BUFFER_BINDING",
777 "UNIFORM_BUFFER_BINDING",
778 "TRANSFORM_FEEDBACK_BUFFER_START",
779 "TRANSFORM_FEEDBACK_BUFFER_SIZE",
780 "UNIFORM_BUFFER_START",
781 "UNIFORM_BUFFER_SIZE",
783 "VERTEX_BINDING_OFFSET",
784 "VERTEX_BINDING_STRIDE",
785 "VERTEX_BINDING_DIVISOR",
786 "VERTEX_BINDING_BUFFER",
787 "MAX_COMPUTE_WORK_GROUP_COUNT",
788 "MAX_COMPUTE_WORK_GROUP_SIZE",
789 "ATOMIC_COUNTER_BUFFER_BINDING",
790 "ATOMIC_COUNTER_BUFFER_START",
791 "ATOMIC_COUNTER_BUFFER_SIZE",
792 "SHADER_STORAGE_BUFFER_BINDING",
793 "SHADER_STORAGE_BUFFER_START",
794 "SHADER_STORAGE_BUFFER_SIZE",
795 "IMAGE_BINDING_NAME",
796 "IMAGE_BINDING_LEVEL",
797 "IMAGE_BINDING_LAYERED",
798 "IMAGE_BINDING_LAYER",
799 "IMAGE_BINDING_ACCESS",
800 "IMAGE_BINDING_FORMAT",
801 "BLEND_EQUATION_RGB",
802 "BLEND_EQUATION_ALPHA",
813 "SHADING_LANGUAGE_VERSION",
819 "DEBUG_CALLBACK_FUNCTION",
820 "DEBUG_CALLBACK_USER_PARAM",
823 ("InternalFormatParameter", ["NUM_SAMPLE_COUNTS", "SAMPLES"]),
824 ("InternalFormatTarget", [
826 "TEXTURE_2D_MULTISAMPLE",
827 "TEXTURE_2D_MULTISAMPLE_ARRAY",
834 ("MultisampleParameter", ["SAMPLE_POSITION"]),
836 # Occlusion and timer queries
839 "ANY_SAMPLES_PASSED",
840 "PRIMITIVES_GENERATED",
841 "TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN",
845 ("QueryParam", ["CURRENT_QUERY", "QUERY_COUNTER_BITS"]),
846 ("QueryObjectParam", ["QUERY_RESULT", "QUERY_RESULT_AVAILABLE"]),
848 ("ImageAccess", ["READ_ONLY", "WRITE_ONLY", "READ_WRITE"]),
850 ("ProgramInterface", [
853 "ATOMIC_COUNTER_BUFFER",
856 "TRANSFORM_FEEDBACK_VARYING",
858 "SHADER_STORAGE_BLOCK",
861 ("ProgramResourceProperty", [
864 "NUM_ACTIVE_VARIABLES",
870 "ATOMIC_COUNTER_BUFFER_INDEX",
875 "REFERENCED_BY_VERTEX_SHADER",
876 "REFERENCED_BY_FRAGMENT_SHADER",
877 "REFERENCED_BY_COMPUTE_SHADER",
878 "REFERENCED_BY_GEOMETRY_SHADER",
879 "REFERENCED_BY_TESS_CONTROL_SHADER",
880 "REFERENCED_BY_TESS_EVALUATION_SHADER",
881 "TOP_LEVEL_ARRAY_SIZE",
882 "TOP_LEVEL_ARRAY_STRIDE",
887 ("PrecisionFormatType", ["LOW_FLOAT", "MEDIUM_FLOAT", "HIGH_FLOAT", "LOW_INT", "MEDIUM_INT", "HIGH_INT"]),
889 ("TransformFeedbackTarget", ["TRANSFORM_FEEDBACK"]),
891 ("ProvokingVertex", ["FIRST_VERTEX_CONVENTION", "LAST_VERTEX_CONVENTION", "UNDEFINED_VERTEX"]),
893 ("DebugMessageSource", [
895 "DEBUG_SOURCE_WINDOW_SYSTEM",
896 "DEBUG_SOURCE_SHADER_COMPILER",
897 "DEBUG_SOURCE_THIRD_PARTY",
898 "DEBUG_SOURCE_APPLICATION",
899 "DEBUG_SOURCE_OTHER", "DONT_CARE"
901 ("DebugMessageType", [
903 "DEBUG_TYPE_DEPRECATED_BEHAVIOR",
904 "DEBUG_TYPE_UNDEFINED_BEHAVIOR",
905 "DEBUG_TYPE_PORTABILITY",
906 "DEBUG_TYPE_PERFORMANCE",
909 "DEBUG_TYPE_PUSH_GROUP",
910 "DEBUG_TYPE_POP_GROUP",
913 ("DebugMessageSeverity", [
914 "DEBUG_SEVERITY_HIGH",
915 "DEBUG_SEVERITY_MEDIUM",
916 "DEBUG_SEVERITY_LOW",
917 "DEBUG_SEVERITY_NOTIFICATION",
930 "TESS_CONTROL_SHADER",
931 "TESS_EVALUATION_SHADER",
939 # generated: UncompressedTextureFormat + CompressedTextureFormat
943 def getEnumGroupByName (name):
944 # \note: will raise an (index out of bounds) error if no such group
945 return [x for x in ENUM_GROUPS if x[0]==name][0][1]
947 # EnableCap EnumGroups are also GettableState EnumGroups
948 getEnumGroupByName("GettableState").extend(getEnumGroupByName("EnableCap"))
950 # TextureFormat = UncompressedTextureFormat + CompressedTextureFormat
951 getEnumGroupByName("TextureFormat").extend(getEnumGroupByName("UncompressedTextureFormat") + getEnumGroupByName("CompressedTextureFormat"))
953 def genStrUtil (iface):
954 enumGroups = addValuePrefix(ENUM_GROUPS, "GL_")
955 bitfieldGroups = addValuePrefix(BITFIELD_GROUPS, "GL_")
956 prototypeFile = os.path.join(OPENGL_DIR, "gluStrUtilPrototypes.inl")
957 implFile = os.path.join(OPENGL_DIR, "gluStrUtil.inl")
959 writeInlFile(prototypeFile, indentLines(genStrUtilProtos(iface, enumGroups, bitfieldGroups)))
960 writeInlFile(implFile, genStrUtilImpls(iface, enumGroups, bitfieldGroups))
962 if __name__ == "__main__":
963 genStrUtil(getHybridInterface())