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

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

Issue 12494005: Use client side arrays for GL_STREAM_DRAW attributes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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 | « no previous file | gpu/command_buffer/common/gles2_cmd_utils_implementation_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 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after
1169 # gen_func: Name of function that generates GL resource for corresponding 1169 # gen_func: Name of function that generates GL resource for corresponding
1170 # bind function. 1170 # bind function.
1171 # states: array of states that get set by this function corresponding to 1171 # states: array of states that get set by this function corresponding to
1172 # the given arguments 1172 # the given arguments
1173 # state_flag: name of flag that is set to true when function is called. 1173 # state_flag: name of flag that is set to true when function is called.
1174 # no_gl: no GL function is called. 1174 # no_gl: no GL function is called.
1175 # valid_args: A dictionary of argument indices to args to use in unit tests 1175 # valid_args: A dictionary of argument indices to args to use in unit tests
1176 # when they can not be automatically determined. 1176 # when they can not be automatically determined.
1177 # pepper_interface: The pepper interface that is used for this extension 1177 # pepper_interface: The pepper interface that is used for this extension
1178 # invalid_test: False if no invalid test needed. 1178 # invalid_test: False if no invalid test needed.
1179 # shadowed: True = the value is shadowed so no glGetXXX call will be made.
1179 1180
1180 _FUNCTION_INFO = { 1181 _FUNCTION_INFO = {
1181 'ActiveTexture': { 1182 'ActiveTexture': {
1182 'decoder_func': 'DoActiveTexture', 1183 'decoder_func': 'DoActiveTexture',
1183 'unit_test': False, 1184 'unit_test': False,
1184 'impl_func': False, 1185 'impl_func': False,
1185 'client_test': False, 1186 'client_test': False,
1186 }, 1187 },
1187 'AttachShader': {'decoder_func': 'DoAttachShader'}, 1188 'AttachShader': {'decoder_func': 'DoAttachShader'},
1188 'BindAttribLocation': {'type': 'GLchar', 'bucket': True, 'needs_size': True}, 1189 'BindAttribLocation': {'type': 'GLchar', 'bucket': True, 'needs_size': True},
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
1556 'cmd_args': 1557 'cmd_args':
1557 'GLidProgram program, const char* name, NonImmediate GLint* location', 1558 'GLidProgram program, const char* name, NonImmediate GLint* location',
1558 'result': ['GLint'], 1559 'result': ['GLint'],
1559 }, 1560 },
1560 'GetBooleanv': { 1561 'GetBooleanv': {
1561 'type': 'GETn', 1562 'type': 'GETn',
1562 'result': ['SizedResult<GLboolean>'], 1563 'result': ['SizedResult<GLboolean>'],
1563 'decoder_func': 'DoGetBooleanv', 1564 'decoder_func': 'DoGetBooleanv',
1564 'gl_test_func': 'glGetBooleanv', 1565 'gl_test_func': 'glGetBooleanv',
1565 }, 1566 },
1566 'GetBufferParameteriv': {'type': 'GETn', 'result': ['SizedResult<GLint>']}, 1567 'GetBufferParameteriv': {
1568 'type': 'GETn',
1569 'result': ['SizedResult<GLint>'],
1570 'decoder_func': 'DoGetBufferParameteriv',
1571 'expectation': False,
1572 'shadowed': True,
1573 },
1567 'GetError': { 1574 'GetError': {
1568 'type': 'Is', 1575 'type': 'Is',
1569 'decoder_func': 'GetGLError', 1576 'decoder_func': 'GetGLError',
1570 'impl_func': False, 1577 'impl_func': False,
1571 'result': ['GLenum'], 1578 'result': ['GLenum'],
1572 'client_test': False, 1579 'client_test': False,
1573 }, 1580 },
1574 'GetFloatv': { 1581 'GetFloatv': {
1575 'type': 'GETn', 1582 'type': 'GETn',
1576 'result': ['SizedResult<GLfloat>'], 1583 'result': ['SizedResult<GLfloat>'],
(...skipping 2761 matching lines...) Expand 10 before | Expand all | Expand 10 after
4338 """ 4345 """
4339 file.Write(code % { 4346 file.Write(code % {
4340 'last_arg_type': last_arg.type, 4347 'last_arg_type': last_arg.type,
4341 'func_name': func.name, 4348 'func_name': func.name,
4342 }) 4349 })
4343 func.WriteHandlerValidation(file) 4350 func.WriteHandlerValidation(file)
4344 code = """ // Check that the client initialized the result. 4351 code = """ // Check that the client initialized the result.
4345 if (result->size != 0) { 4352 if (result->size != 0) {
4346 return error::kInvalidArguments; 4353 return error::kInvalidArguments;
4347 } 4354 }
4348 CopyRealGLErrorsToWrapper();
4349 """ 4355 """
4356 shadowed = func.GetInfo('shadowed')
4357 if not shadowed:
4358 file.Write(" CopyRealGLErrorsToWrapper();\n");
4350 file.Write(code) 4359 file.Write(code)
4351 func.WriteHandlerImplementation(file) 4360 func.WriteHandlerImplementation(file)
4352 code = """ GLenum error = glGetError(); 4361 if shadowed:
4362 code = """ result->SetNumResults(num_values);
4363 return error::kNoError;
4364 }
4365 """
4366 else:
4367 code = """ GLenum error = glGetError();
4353 if (error == GL_NO_ERROR) { 4368 if (error == GL_NO_ERROR) {
4354 result->SetNumResults(num_values); 4369 result->SetNumResults(num_values);
4355 } else { 4370 } else {
4356 SetGLError(error, "", ""); 4371 SetGLError(error, "", "");
4357 } 4372 }
4358 return error::kNoError; 4373 return error::kNoError;
4359 } 4374 }
4360 4375
4361 """ 4376 """
4362 file.Write(code) 4377 file.Write(code)
(...skipping 3234 matching lines...) Expand 10 before | Expand all | Expand 10 after
7597 gen.WriteGLES2Header("../GLES2/gl2chromium_autogen.h") 7612 gen.WriteGLES2Header("../GLES2/gl2chromium_autogen.h")
7598 7613
7599 if gen.errors > 0: 7614 if gen.errors > 0:
7600 print "%d errors" % gen.errors 7615 print "%d errors" % gen.errors
7601 return 1 7616 return 1
7602 return 0 7617 return 0
7603 7618
7604 7619
7605 if __name__ == '__main__': 7620 if __name__ == '__main__':
7606 sys.exit(main(sys.argv[1:])) 7621 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « no previous file | gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698