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

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

Issue 1236053003: texture mipmap level is not zero-only in ES 3 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update framebufferTexture2DMultisamplerEXT Created 5 years, 1 month 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
« no previous file with comments | « no previous file | gpu/command_buffer/client/gles2_cmd_helper_autogen.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1990 matching lines...) Expand 10 before | Expand all | Expand 10 after
2001 '1', 2001 '1',
2002 '2', 2002 '2',
2003 '3', 2003 '3',
2004 '4', 2004 '4',
2005 ], 2005 ],
2006 'invalid': [ 2006 'invalid': [
2007 '0', 2007 '0',
2008 '5', 2008 '5',
2009 ], 2009 ],
2010 }, 2010 },
2011 'ZeroOnly': { 2011 'ZeroOnlyForES2': {
piman 2015/11/17 23:40:06 What is the point of GLintZeroOnlyForES2 (as oppos
yunchao 2015/11/19 10:14:10 Yeah. The code in build_gles2_cmd_buffer.py seems
zmo 2015/11/19 19:15:00 ZeroOnlyForES2 is misleading. The code generator
yunchao 2015/11/23 10:44:39 Done.
2012 'type': 'GLint', 2012 'type': 'GLint',
2013 'is_complete': True, 2013 'is_constant_for_es2': True,
2014 'valid': [ 2014 'valid': [
2015 '0', 2015 '0',
2016 ], 2016 ],
2017 'invalid': [ 2017 'invalid': [
2018 '1', 2018 '1',
2019 ], 2019 ],
2020 }, 2020 },
2021 'FalseOnly': { 2021 'FalseOnly': {
2022 'type': 'GLboolean', 2022 'type': 'GLboolean',
2023 'is_complete': True, 2023 'is_complete': True,
(...skipping 6382 matching lines...) Expand 10 before | Expand all | Expand 10 after
8406 8406
8407 def GetDeprecatedValuesES3(self): 8407 def GetDeprecatedValuesES3(self):
8408 return self.deprecated_es3 8408 return self.deprecated_es3
8409 8409
8410 def IsConstant(self): 8410 def IsConstant(self):
8411 if not 'is_complete' in self.info: 8411 if not 'is_complete' in self.info:
8412 return False 8412 return False
8413 8413
8414 return len(self.GetValidValues()) == 1 8414 return len(self.GetValidValues()) == 1
8415 8415
8416 def IsConstantForES2(self):
8417 if not 'is_constant_for_es2' in self.info:
8418 return False
8419
8420 return len(self.GetValidValues()) == 1
8421
8416 def GetConstantValue(self): 8422 def GetConstantValue(self):
8417 return self.GetValidValues()[0] 8423 return self.GetValidValues()[0]
8418 8424
8419 class Argument(object): 8425 class Argument(object):
8420 """A class that represents a function argument.""" 8426 """A class that represents a function argument."""
8421 8427
8422 cmd_type_map_ = { 8428 cmd_type_map_ = {
8423 'GLenum': 'uint32_t', 8429 'GLenum': 'uint32_t',
8424 'GLint': 'int32_t', 8430 'GLint': 'int32_t',
8425 'GLintptr': 'int32_t', 8431 'GLintptr': 'int32_t',
(...skipping 21 matching lines...) Expand all
8447 return False 8453 return False
8448 8454
8449 def IsPointer2D(self): 8455 def IsPointer2D(self):
8450 """Returns true if argument is a 2D pointer.""" 8456 """Returns true if argument is a 2D pointer."""
8451 return False 8457 return False
8452 8458
8453 def IsConstant(self): 8459 def IsConstant(self):
8454 """Returns true if the argument has only one valid value.""" 8460 """Returns true if the argument has only one valid value."""
8455 return False 8461 return False
8456 8462
8463 def IsConstantForES2(self):
8464 """Returns true if the argument has only one valid value for ES2."""
8465 return False
8466
8457 def AddCmdArgs(self, args): 8467 def AddCmdArgs(self, args):
8458 """Adds command arguments for this argument to the given list.""" 8468 """Adds command arguments for this argument to the given list."""
8459 if not self.IsConstant(): 8469 if not self.IsConstant():
8460 return args.append(self) 8470 return args.append(self)
8461 8471
8462 def AddInitArgs(self, args): 8472 def AddInitArgs(self, args):
8463 """Adds init arguments for this argument to the given list.""" 8473 """Adds init arguments for this argument to the given list."""
8464 if not self.IsConstant(): 8474 if not self.IsConstant():
8465 return args.append(self) 8475 return args.append(self)
8466 8476
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
8683 Argument.__init__(self, name, gl_type) 8693 Argument.__init__(self, name, gl_type)
8684 8694
8685 self.gl_error = gl_error 8695 self.gl_error = gl_error
8686 name = type[len(gl_type):] 8696 name = type[len(gl_type):]
8687 self.type_name = name 8697 self.type_name = name
8688 self.named_type = NamedType(_NAMED_TYPE_INFO[name]) 8698 self.named_type = NamedType(_NAMED_TYPE_INFO[name])
8689 8699
8690 def IsConstant(self): 8700 def IsConstant(self):
8691 return self.named_type.IsConstant() 8701 return self.named_type.IsConstant()
8692 8702
8703 def IsConstantForES2(self):
8704 return self.named_type.IsConstantForES2()
8705
8693 def GetConstantValue(self): 8706 def GetConstantValue(self):
8694 return self.named_type.GetConstantValue() 8707 return self.named_type.GetConstantValue()
8695 8708
8696 def WriteValidationCode(self, f, func): 8709 def WriteValidationCode(self, f, func):
8697 if func.IsUnsafe(): 8710 if func.IsUnsafe():
8698 return 8711 return
8699 if self.named_type.IsConstant(): 8712 if self.named_type.IsConstant():
8700 return 8713 return
8714 if self.named_type.IsConstantForES2():
8715 return
8701 f.write(" if (!validators_->%s.IsValid(%s)) {\n" % 8716 f.write(" if (!validators_->%s.IsValid(%s)) {\n" %
8702 (ToUnderscore(self.type_name), self.name)) 8717 (ToUnderscore(self.type_name), self.name))
8703 if self.gl_error == "GL_INVALID_ENUM": 8718 if self.gl_error == "GL_INVALID_ENUM":
8704 f.write( 8719 f.write(
8705 " LOCAL_SET_GL_ERROR_INVALID_ENUM(\"gl%s\", %s, \"%s\");\n" % 8720 " LOCAL_SET_GL_ERROR_INVALID_ENUM(\"gl%s\", %s, \"%s\");\n" %
8706 (func.original_name, self.name, self.name)) 8721 (func.original_name, self.name, self.name))
8707 else: 8722 else:
8708 f.write( 8723 f.write(
8709 " LOCAL_SET_GL_ERROR(%s, \"gl%s\", \"%s %s\");\n" % 8724 " LOCAL_SET_GL_ERROR(%s, \"gl%s\", \"%s %s\");\n" %
8710 (self.gl_error, func.original_name, self.name, self.gl_error)) 8725 (self.gl_error, func.original_name, self.name, self.gl_error))
(...skipping 1930 matching lines...) Expand 10 before | Expand all | Expand 10 after
10641 func.WriteGLES2ImplementationUnitTest(f) 10656 func.WriteGLES2ImplementationUnitTest(f)
10642 self.generated_cpp_filenames.append(filename) 10657 self.generated_cpp_filenames.append(filename)
10643 10658
10644 def WriteServiceUtilsHeader(self, filename): 10659 def WriteServiceUtilsHeader(self, filename):
10645 """Writes the gles2 auto generated utility header.""" 10660 """Writes the gles2 auto generated utility header."""
10646 with CHeaderWriter(filename) as f: 10661 with CHeaderWriter(filename) as f:
10647 for name in sorted(_NAMED_TYPE_INFO.keys()): 10662 for name in sorted(_NAMED_TYPE_INFO.keys()):
10648 named_type = NamedType(_NAMED_TYPE_INFO[name]) 10663 named_type = NamedType(_NAMED_TYPE_INFO[name])
10649 if named_type.IsConstant(): 10664 if named_type.IsConstant():
10650 continue 10665 continue
10666 if named_type.IsConstantForES2():
10667 continue
10651 f.write("ValueValidator<%s> %s;\n" % 10668 f.write("ValueValidator<%s> %s;\n" %
10652 (named_type.GetType(), ToUnderscore(name))) 10669 (named_type.GetType(), ToUnderscore(name)))
10653 f.write("\n") 10670 f.write("\n")
10654 self.generated_cpp_filenames.append(filename) 10671 self.generated_cpp_filenames.append(filename)
10655 10672
10656 def WriteServiceUtilsImplementation(self, filename): 10673 def WriteServiceUtilsImplementation(self, filename):
10657 """Writes the gles2 auto generated utility implementation.""" 10674 """Writes the gles2 auto generated utility implementation."""
10658 with CHeaderWriter(filename) as f: 10675 with CHeaderWriter(filename) as f:
10659 names = sorted(_NAMED_TYPE_INFO.keys()) 10676 names = sorted(_NAMED_TYPE_INFO.keys())
10660 for name in names: 10677 for name in names:
10661 named_type = NamedType(_NAMED_TYPE_INFO[name]) 10678 named_type = NamedType(_NAMED_TYPE_INFO[name])
10662 if named_type.IsConstant(): 10679 if named_type.IsConstant():
10663 continue 10680 continue
10681 if named_type.IsConstantForES2():
10682 continue
10664 if named_type.GetValidValues(): 10683 if named_type.GetValidValues():
10665 f.write("static const %s valid_%s_table[] = {\n" % 10684 f.write("static const %s valid_%s_table[] = {\n" %
10666 (named_type.GetType(), ToUnderscore(name))) 10685 (named_type.GetType(), ToUnderscore(name)))
10667 for value in named_type.GetValidValues(): 10686 for value in named_type.GetValidValues():
10668 f.write(" %s,\n" % value) 10687 f.write(" %s,\n" % value)
10669 f.write("};\n") 10688 f.write("};\n")
10670 f.write("\n") 10689 f.write("\n")
10671 if named_type.GetValidValuesES3(): 10690 if named_type.GetValidValuesES3():
10672 f.write("static const %s valid_%s_table_es3[] = {\n" % 10691 f.write("static const %s valid_%s_table_es3[] = {\n" %
10673 (named_type.GetType(), ToUnderscore(name))) 10692 (named_type.GetType(), ToUnderscore(name)))
10674 for value in named_type.GetValidValuesES3(): 10693 for value in named_type.GetValidValuesES3():
10675 f.write(" %s,\n" % value) 10694 f.write(" %s,\n" % value)
10676 f.write("};\n") 10695 f.write("};\n")
10677 f.write("\n") 10696 f.write("\n")
10678 if named_type.GetDeprecatedValuesES3(): 10697 if named_type.GetDeprecatedValuesES3():
10679 f.write("static const %s deprecated_%s_table_es3[] = {\n" % 10698 f.write("static const %s deprecated_%s_table_es3[] = {\n" %
10680 (named_type.GetType(), ToUnderscore(name))) 10699 (named_type.GetType(), ToUnderscore(name)))
10681 for value in named_type.GetDeprecatedValuesES3(): 10700 for value in named_type.GetDeprecatedValuesES3():
10682 f.write(" %s,\n" % value) 10701 f.write(" %s,\n" % value)
10683 f.write("};\n") 10702 f.write("};\n")
10684 f.write("\n") 10703 f.write("\n")
10685 f.write("Validators::Validators()") 10704 f.write("Validators::Validators()")
10686 pre = ' : ' 10705 pre = ' : '
10687 for count, name in enumerate(names): 10706 for count, name in enumerate(names):
10688 named_type = NamedType(_NAMED_TYPE_INFO[name]) 10707 named_type = NamedType(_NAMED_TYPE_INFO[name])
10689 if named_type.IsConstant(): 10708 if named_type.IsConstant():
10690 continue 10709 continue
10710 if named_type.IsConstantForES2():
10711 continue
10691 if named_type.GetValidValues(): 10712 if named_type.GetValidValues():
10692 code = """%(pre)s%(name)s( 10713 code = """%(pre)s%(name)s(
10693 valid_%(name)s_table, arraysize(valid_%(name)s_table))""" 10714 valid_%(name)s_table, arraysize(valid_%(name)s_table))"""
10694 else: 10715 else:
10695 code = "%(pre)s%(name)s()" 10716 code = "%(pre)s%(name)s()"
10696 f.write(code % { 10717 f.write(code % {
10697 'name': ToUnderscore(name), 10718 'name': ToUnderscore(name),
10698 'pre': pre, 10719 'pre': pre,
10699 }) 10720 })
10700 pre = ',\n ' 10721 pre = ',\n '
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
11114 Format(gen.generated_cpp_filenames) 11135 Format(gen.generated_cpp_filenames)
11115 11136
11116 if gen.errors > 0: 11137 if gen.errors > 0:
11117 print "%d errors" % gen.errors 11138 print "%d errors" % gen.errors
11118 return 1 11139 return 1
11119 return 0 11140 return 0
11120 11141
11121 11142
11122 if __name__ == '__main__': 11143 if __name__ == '__main__':
11123 sys.exit(main(sys.argv[1:])) 11144 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « no previous file | gpu/command_buffer/client/gles2_cmd_helper_autogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698