Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(495)

Side by Side Diff: gpu/command_buffer/build_gles2_cmd_buffer.py

Issue 2354713004: Implement WEBGL_compressed_texture_es3_0 extension for WebGL 1/2 (Closed)
Patch Set: refactor ETC2/EAC support in command buffer (plus rebase) Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """code generator for GLES2 command buffers.""" 6 """code generator for GLES2 command buffers."""
7 7
8 import itertools 8 import itertools
9 import os 9 import os
10 import os.path 10 import os.path
(...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after
804 ], 804 ],
805 'invalid': [ 805 'invalid': [
806 'GL_NONE', 806 'GL_NONE',
807 ], 807 ],
808 }, 808 },
809 'CompressedTextureFormat': { 809 'CompressedTextureFormat': {
810 'type': 'GLenum', 810 'type': 'GLenum',
811 'valid': [ 811 'valid': [
812 ], 812 ],
813 'valid_es3': [ 813 'valid_es3': [
814 'GL_COMPRESSED_R11_EAC',
815 'GL_COMPRESSED_SIGNED_R11_EAC',
816 'GL_COMPRESSED_RG11_EAC',
817 'GL_COMPRESSED_SIGNED_RG11_EAC',
818 'GL_COMPRESSED_RGB8_ETC2',
819 'GL_COMPRESSED_SRGB8_ETC2',
820 'GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2',
821 'GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2',
822 'GL_COMPRESSED_RGBA8_ETC2_EAC',
823 'GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC',
824 ], 814 ],
825 }, 815 },
826 'GLState': { 816 'GLState': {
827 'type': 'GLenum', 817 'type': 'GLenum',
828 'valid': [ 818 'valid': [
829 # NOTE: State an Capability entries added later. 819 # NOTE: State an Capability entries added later.
830 'GL_ACTIVE_TEXTURE', 820 'GL_ACTIVE_TEXTURE',
831 'GL_ALIASED_LINE_WIDTH_RANGE', 821 'GL_ALIASED_LINE_WIDTH_RANGE',
832 'GL_ALIASED_POINT_SIZE_RANGE', 822 'GL_ALIASED_POINT_SIZE_RANGE',
833 'GL_ALPHA_BITS', 823 'GL_ALPHA_BITS',
(...skipping 1280 matching lines...) Expand 10 before | Expand all | Expand 10 after
2114 'GL_RGB10_A2UI', 2104 'GL_RGB10_A2UI',
2115 'GL_RGBA16UI', 2105 'GL_RGBA16UI',
2116 'GL_RGBA16I', 2106 'GL_RGBA16I',
2117 'GL_RGBA32UI', 2107 'GL_RGBA32UI',
2118 'GL_RGBA32I', 2108 'GL_RGBA32I',
2119 'GL_DEPTH_COMPONENT16', 2109 'GL_DEPTH_COMPONENT16',
2120 'GL_DEPTH_COMPONENT24', 2110 'GL_DEPTH_COMPONENT24',
2121 'GL_DEPTH_COMPONENT32F', 2111 'GL_DEPTH_COMPONENT32F',
2122 'GL_DEPTH24_STENCIL8', 2112 'GL_DEPTH24_STENCIL8',
2123 'GL_DEPTH32F_STENCIL8', 2113 'GL_DEPTH32F_STENCIL8',
2124 'GL_COMPRESSED_R11_EAC',
2125 'GL_COMPRESSED_SIGNED_R11_EAC',
2126 'GL_COMPRESSED_RG11_EAC',
2127 'GL_COMPRESSED_SIGNED_RG11_EAC',
2128 'GL_COMPRESSED_RGB8_ETC2',
2129 'GL_COMPRESSED_SRGB8_ETC2',
2130 'GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2',
2131 'GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2',
2132 'GL_COMPRESSED_RGBA8_ETC2_EAC',
2133 'GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC',
2134 ], 2114 ],
2135 'deprecated_es3': [ 2115 'deprecated_es3': [
2136 'GL_ALPHA8_EXT', 2116 'GL_ALPHA8_EXT',
2137 'GL_LUMINANCE8_EXT', 2117 'GL_LUMINANCE8_EXT',
2138 'GL_LUMINANCE8_ALPHA8_EXT', 2118 'GL_LUMINANCE8_ALPHA8_EXT',
2139 'GL_ALPHA16F_EXT', 2119 'GL_ALPHA16F_EXT',
2140 'GL_LUMINANCE16F_EXT', 2120 'GL_LUMINANCE16F_EXT',
2141 'GL_LUMINANCE_ALPHA16F_EXT', 2121 'GL_LUMINANCE_ALPHA16F_EXT',
2142 'GL_ALPHA32F_EXT', 2122 'GL_ALPHA32F_EXT',
2143 'GL_LUMINANCE32F_EXT', 2123 'GL_LUMINANCE32F_EXT',
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
2301 'GL_OBJECT_TYPE', 2281 'GL_OBJECT_TYPE',
2302 'GL_SYNC_CONDITION', 2282 'GL_SYNC_CONDITION',
2303 'GL_SYNC_FLAGS', 2283 'GL_SYNC_FLAGS',
2304 ], 2284 ],
2305 'invalid': [ 2285 'invalid': [
2306 'GL_SYNC_FENCE', 2286 'GL_SYNC_FENCE',
2307 ], 2287 ],
2308 }, 2288 },
2309 } 2289 }
2310 2290
2291 _ES30_COMPRESSED_TEXTURE_FORMATS = [
2292 'GL_COMPRESSED_R11_EAC',
2293 'GL_COMPRESSED_SIGNED_R11_EAC',
2294 'GL_COMPRESSED_RG11_EAC',
2295 'GL_COMPRESSED_SIGNED_RG11_EAC',
2296 'GL_COMPRESSED_RGB8_ETC2',
2297 'GL_COMPRESSED_SRGB8_ETC2',
2298 'GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2',
2299 'GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2',
2300 'GL_COMPRESSED_RGBA8_ETC2_EAC',
2301 'GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC',
2302 ]
2303
2311 # This table specifies the different pepper interfaces that are supported for 2304 # This table specifies the different pepper interfaces that are supported for
2312 # GL commands. 'dev' is true if it's a dev interface. 2305 # GL commands. 'dev' is true if it's a dev interface.
2313 _PEPPER_INTERFACES = [ 2306 _PEPPER_INTERFACES = [
2314 {'name': '', 'dev': False}, 2307 {'name': '', 'dev': False},
2315 {'name': 'InstancedArrays', 'dev': False}, 2308 {'name': 'InstancedArrays', 'dev': False},
2316 {'name': 'FramebufferBlit', 'dev': False}, 2309 {'name': 'FramebufferBlit', 'dev': False},
2317 {'name': 'FramebufferMultisample', 'dev': False}, 2310 {'name': 'FramebufferMultisample', 'dev': False},
2318 {'name': 'ChromiumEnableFeature', 'dev': False}, 2311 {'name': 'ChromiumEnableFeature', 'dev': False},
2319 {'name': 'ChromiumMapSub', 'dev': False}, 2312 {'name': 'ChromiumMapSub', 'dev': False},
2320 {'name': 'Query', 'dev': False}, 2313 {'name': 'Query', 'dev': False},
(...skipping 8611 matching lines...) Expand 10 before | Expand all | Expand 10 after
10932 f.write(code % { 10925 f.write(code % {
10933 'name': ToUnderscore(name), 10926 'name': ToUnderscore(name),
10934 }) 10927 })
10935 if named_type.GetValidValuesES3(): 10928 if named_type.GetValidValuesES3():
10936 code = """ %(name)s.AddValues( 10929 code = """ %(name)s.AddValues(
10937 valid_%(name)s_table_es3, arraysize(valid_%(name)s_table_es3)); 10930 valid_%(name)s_table_es3, arraysize(valid_%(name)s_table_es3));
10938 """ 10931 """
10939 f.write(code % { 10932 f.write(code % {
10940 'name': ToUnderscore(name), 10933 'name': ToUnderscore(name),
10941 }) 10934 })
10935 f.write("UpdateES30CompressedTextureFormats();");
10936 f.write("}\n\n");
10937
10938 f.write("void Validators::UpdateES30CompressedTextureFormats() {\n")
10939 for name in ['CompressedTextureFormat', 'TextureInternalFormatStorage']:
10940 for fmt in _ES30_COMPRESSED_TEXTURE_FORMATS:
10941 code = """ %(name)s.AddValue(%(format)s);
10942 """
10943 f.write(code % {
10944 'name': ToUnderscore(name),
10945 'format': fmt,
10946 })
10942 f.write("}\n\n"); 10947 f.write("}\n\n");
10943 self.generated_cpp_filenames.append(filename) 10948 self.generated_cpp_filenames.append(filename)
10944 10949
10945 def WriteCommonUtilsHeader(self, filename): 10950 def WriteCommonUtilsHeader(self, filename):
10946 """Writes the gles2 common utility header.""" 10951 """Writes the gles2 common utility header."""
10947 with CHeaderWriter(filename) as f: 10952 with CHeaderWriter(filename) as f:
10948 type_infos = sorted(_NAMED_TYPE_INFO.keys()) 10953 type_infos = sorted(_NAMED_TYPE_INFO.keys())
10949 for type_info in type_infos: 10954 for type_info in type_infos:
10950 if _NAMED_TYPE_INFO[type_info]['type'] == 'GLenum': 10955 if _NAMED_TYPE_INFO[type_info]['type'] == 'GLenum':
10951 f.write("static std::string GetString%s(uint32_t value);\n" % 10956 f.write("static std::string GetString%s(uint32_t value);\n" %
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
11315 Format(gen.generated_cpp_filenames) 11320 Format(gen.generated_cpp_filenames)
11316 11321
11317 if gen.errors > 0: 11322 if gen.errors > 0:
11318 print "%d errors" % gen.errors 11323 print "%d errors" % gen.errors
11319 return 1 11324 return 1
11320 return 0 11325 return 0
11321 11326
11322 11327
11323 if __name__ == '__main__': 11328 if __name__ == '__main__':
11324 sys.exit(main(sys.argv[1:])) 11329 sys.exit(main(sys.argv[1:]))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698