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

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

Issue 7765013: Revert 98504 - Manually merging trunk revs 95836 and 96904 to 835 branch (second attempt) (Closed) Base URL: svn://svn.chromium.org/chrome/branches/835/src/
Patch Set: Created 9 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 | Annotate | Revision Log
« no previous file with comments | « content/renderer/gpu/renderer_gl_context.cc ('k') | gpu/command_buffer/client/gles2_demo.cc » ('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/python 1 #!/usr/bin/python
2 # 2 #
3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """code generator for GLES2 command buffers.""" 7 """code generator for GLES2 command buffers."""
8 8
9 import os 9 import os
10 import os.path 10 import os.path
(...skipping 1460 matching lines...) Expand 10 before | Expand all | Expand 10 after
1471 'IsShader': { 1471 'IsShader': {
1472 'type': 'Is', 1472 'type': 'Is',
1473 'decoder_func': 'DoIsShader', 1473 'decoder_func': 'DoIsShader',
1474 'expectation': False, 1474 'expectation': False,
1475 }, 1475 },
1476 'IsTexture': { 1476 'IsTexture': {
1477 'type': 'Is', 1477 'type': 'Is',
1478 'decoder_func': 'DoIsTexture', 1478 'decoder_func': 'DoIsTexture',
1479 'expectation': False, 1479 'expectation': False,
1480 }, 1480 },
1481 'LinkProgram': { 1481 'LinkProgram': {'decoder_func': 'DoLinkProgram'},
1482 'decoder_func': 'DoLinkProgram',
1483 'impl_func': False,
1484 },
1485 'MapBufferSubDataCHROMIUM': { 1482 'MapBufferSubDataCHROMIUM': {
1486 'gen_cmd': False, 1483 'gen_cmd': False,
1487 'extension': True, 1484 'extension': True,
1488 'chromium': True, 1485 'chromium': True,
1489 }, 1486 },
1490 'MapTexSubImage2DCHROMIUM': { 1487 'MapTexSubImage2DCHROMIUM': {
1491 'gen_cmd': False, 1488 'gen_cmd': False,
1492 'extension': True, 1489 'extension': True,
1493 'chromium': True, 1490 'chromium': True,
1494 }, 1491 },
(...skipping 1572 matching lines...) Expand 10 before | Expand all | Expand 10 after
3067 """Overrriden from TypeHandler.""" 3064 """Overrriden from TypeHandler."""
3068 file.Write("%s %s(%s) {\n" % 3065 file.Write("%s %s(%s) {\n" %
3069 (func.return_type, func.original_name, 3066 (func.return_type, func.original_name,
3070 func.MakeTypedOriginalArgString(""))) 3067 func.MakeTypedOriginalArgString("")))
3071 func.WriteDestinationInitalizationValidation(file) 3068 func.WriteDestinationInitalizationValidation(file)
3072 self.WriteClientGLCallLog(func, file) 3069 self.WriteClientGLCallLog(func, file)
3073 for arg in func.GetOriginalArgs(): 3070 for arg in func.GetOriginalArgs():
3074 arg.WriteClientSideValidationCode(file, func) 3071 arg.WriteClientSideValidationCode(file, func)
3075 file.Write( 3072 file.Write(
3076 " GPU_CLIENT_DCHECK(%s != 0);\n" % func.GetOriginalArgs()[-1].name) 3073 " GPU_CLIENT_DCHECK(%s != 0);\n" % func.GetOriginalArgs()[-1].name)
3077 file.Write(" %sHelper(%s);\n" % 3074 file.Write(" program_and_shader_id_handler_->FreeIds(1, &%s);\n" %
3078 (func.original_name, func.GetOriginalArgs()[-1].name)) 3075 func.GetOriginalArgs()[-1].name)
3076 file.Write(" helper_->%s(%s);\n" %
3077 (func.name, func.MakeCmdArgString("")))
3078 file.Write(" Flush();\n")
3079 file.Write("}\n") 3079 file.Write("}\n")
3080 file.Write("\n") 3080 file.Write("\n")
3081 3081
3082 3082
3083 class DELnHandler(TypeHandler): 3083 class DELnHandler(TypeHandler):
3084 """Handler for glDelete___ type functions.""" 3084 """Handler for glDelete___ type functions."""
3085 3085
3086 def __init__(self): 3086 def __init__(self):
3087 TypeHandler.__init__(self) 3087 TypeHandler.__init__(self)
3088 3088
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
3197 """ % func.GetOriginalArgs()[1].name) 3197 """ % func.GetOriginalArgs()[1].name)
3198 file.Write(""" GPU_CLIENT_DCHECK_CODE_BLOCK({ 3198 file.Write(""" GPU_CLIENT_DCHECK_CODE_BLOCK({
3199 for (GLsizei i = 0; i < n; ++i) { 3199 for (GLsizei i = 0; i < n; ++i) {
3200 GPU_DCHECK(%s[i] != 0); 3200 GPU_DCHECK(%s[i] != 0);
3201 } 3201 }
3202 }); 3202 });
3203 """ % func.GetOriginalArgs()[1].name) 3203 """ % func.GetOriginalArgs()[1].name)
3204 for arg in func.GetOriginalArgs(): 3204 for arg in func.GetOriginalArgs():
3205 arg.WriteClientSideValidationCode(file, func) 3205 arg.WriteClientSideValidationCode(file, func)
3206 code = """ %(name)sHelper(%(args)s); 3206 code = """ %(name)sHelper(%(args)s);
3207 helper_->%(name)sImmediate(%(args)s);
3208 Flush();
3207 } 3209 }
3208 3210
3209 """ 3211 """
3210 file.Write(code % args) 3212 file.Write(code % args)
3211 3213
3212 def WriteImmediateCmdComputeSize(self, func, file): 3214 def WriteImmediateCmdComputeSize(self, func, file):
3213 """Overrriden from TypeHandler.""" 3215 """Overrriden from TypeHandler."""
3214 file.Write(" static uint32 ComputeDataSize(GLsizei n) {\n") 3216 file.Write(" static uint32 ComputeDataSize(GLsizei n) {\n")
3215 file.Write( 3217 file.Write(
3216 " return static_cast<uint32>(sizeof(GLuint) * n); // NOLINT\n") 3218 " return static_cast<uint32>(sizeof(GLuint) * n); // NOLINT\n")
(...skipping 989 matching lines...) Expand 10 before | Expand all | Expand 10 after
4206 def WriteGLES2ImplementationHeader(self, func, file): 4208 def WriteGLES2ImplementationHeader(self, func, file):
4207 """Overrriden from TypeHandler.""" 4209 """Overrriden from TypeHandler."""
4208 code_1 = "%(return_type)s %(func_name)s(%(args)s) {\n" 4210 code_1 = "%(return_type)s %(func_name)s(%(args)s) {\n"
4209 code_2 = """ GPU_CLIENT_LOG("[" << this << "] gl%(func_name)s" << "(" 4211 code_2 = """ GPU_CLIENT_LOG("[" << this << "] gl%(func_name)s" << "("
4210 << %(arg0)s << ", " 4212 << %(arg0)s << ", "
4211 << %(arg1)s << ", " 4213 << %(arg1)s << ", "
4212 << static_cast<void*>(%(arg2)s) << ", " 4214 << static_cast<void*>(%(arg2)s) << ", "
4213 << static_cast<void*>(%(arg3)s) << ")"); 4215 << static_cast<void*>(%(arg3)s) << ")");
4214 helper_->SetBucketSize(kResultBucketId, 0); 4216 helper_->SetBucketSize(kResultBucketId, 0);
4215 helper_->%(func_name)s(%(id_name)s, kResultBucketId); 4217 helper_->%(func_name)s(%(id_name)s, kResultBucketId);
4216 std::string str; 4218 if (bufsize > 0) {
4217 GLsizei max_size = 0; 4219 std::string str;
4218 if (GetBucketAsString(kResultBucketId, &str)) { 4220 if (GetBucketAsString(kResultBucketId, &str)) {
4219 if (bufsize > 0) { 4221 GLsizei max_size =
4220 max_size =
4221 std::min(static_cast<size_t>(%(bufsize_name)s) - 1, str.size()); 4222 std::min(static_cast<size_t>(%(bufsize_name)s) - 1, str.size());
4223 if (%(length_name)s != NULL) {
4224 *%(length_name)s = max_size;
4225 }
4222 memcpy(%(dest_name)s, str.c_str(), max_size); 4226 memcpy(%(dest_name)s, str.c_str(), max_size);
4223 %(dest_name)s[max_size] = '\\0'; 4227 %(dest_name)s[max_size] = '\\0';
4224 GPU_CLIENT_LOG("------\\n" << %(dest_name)s << "\\n------"); 4228 GPU_CLIENT_LOG("------\\n" << %(dest_name)s << "\\n------");
4225 } 4229 }
4226 } 4230 }
4227 if (%(length_name)s != NULL) {
4228 *%(length_name)s = max_size;
4229 }
4230 } 4231 }
4231 """ 4232 """
4232 args = func.GetOriginalArgs() 4233 args = func.GetOriginalArgs()
4233 str_args = { 4234 str_args = {
4234 'return_type': func.return_type, 4235 'return_type': func.return_type,
4235 'func_name': func.original_name, 4236 'func_name': func.original_name,
4236 'args': func.MakeTypedOriginalArgString(""), 4237 'args': func.MakeTypedOriginalArgString(""),
4237 'id_name': args[0].name, 4238 'id_name': args[0].name,
4238 'bufsize_name': args[1].name, 4239 'bufsize_name': args[1].name,
4239 'length_name': args[2].name, 4240 'length_name': args[2].name,
(...skipping 1737 matching lines...) Expand 10 before | Expand all | Expand 10 after
5977 5978
5978 if options.generate_docs: 5979 if options.generate_docs:
5979 gen.WriteDocs("docs/gles2_cmd_format_docs_autogen.h") 5980 gen.WriteDocs("docs/gles2_cmd_format_docs_autogen.h")
5980 5981
5981 if gen.errors > 0: 5982 if gen.errors > 0:
5982 print "%d errors" % gen.errors 5983 print "%d errors" % gen.errors
5983 sys.exit(1) 5984 sys.exit(1)
5984 5985
5985 if __name__ == '__main__': 5986 if __name__ == '__main__':
5986 main(sys.argv[1:]) 5987 main(sys.argv[1:])
OLDNEW
« no previous file with comments | « content/renderer/gpu/renderer_gl_context.cc ('k') | gpu/command_buffer/client/gles2_demo.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698