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

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

Issue 851503003: Update from https://crrev.com/311076 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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 570 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 'BufferTarget': { 581 'BufferTarget': {
582 'type': 'GLenum', 582 'type': 'GLenum',
583 'valid': [ 583 'valid': [
584 'GL_ARRAY_BUFFER', 584 'GL_ARRAY_BUFFER',
585 'GL_ELEMENT_ARRAY_BUFFER', 585 'GL_ELEMENT_ARRAY_BUFFER',
586 ], 586 ],
587 'invalid': [ 587 'invalid': [
588 'GL_RENDERBUFFER', 588 'GL_RENDERBUFFER',
589 ], 589 ],
590 }, 590 },
591 'IndexedBufferTarget': {
592 'type': 'GLenum',
593 'valid': [
594 'GL_TRANSFORM_FEEDBACK_BUFFER',
595 'GL_UNIFORM_BUFFER',
596 ],
597 'invalid': [
598 'GL_RENDERBUFFER',
599 ],
600 },
591 'BufferUsage': { 601 'BufferUsage': {
592 'type': 'GLenum', 602 'type': 'GLenum',
593 'valid': [ 603 'valid': [
594 'GL_STREAM_DRAW', 604 'GL_STREAM_DRAW',
595 'GL_STATIC_DRAW', 605 'GL_STATIC_DRAW',
596 'GL_DYNAMIC_DRAW', 606 'GL_DYNAMIC_DRAW',
597 ], 607 ],
598 'invalid': [ 608 'invalid': [
599 'GL_STATIC_READ', 609 'GL_STATIC_READ',
600 ], 610 ],
(...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after
1411 'BindAttribLocation': { 1421 'BindAttribLocation': {
1412 'type': 'GLchar', 1422 'type': 'GLchar',
1413 'data_transfer_methods': ['bucket'], 1423 'data_transfer_methods': ['bucket'],
1414 'needs_size': True, 1424 'needs_size': True,
1415 }, 1425 },
1416 'BindBuffer': { 1426 'BindBuffer': {
1417 'type': 'Bind', 1427 'type': 'Bind',
1418 'decoder_func': 'DoBindBuffer', 1428 'decoder_func': 'DoBindBuffer',
1419 'gen_func': 'GenBuffersARB', 1429 'gen_func': 'GenBuffersARB',
1420 }, 1430 },
1431 'BindBufferBase': {
1432 'type': 'Bind',
1433 'id_mapping': [ 'Buffer' ],
1434 'unsafe': True,
1435 },
1421 'BindFramebuffer': { 1436 'BindFramebuffer': {
1422 'type': 'Bind', 1437 'type': 'Bind',
1423 'decoder_func': 'DoBindFramebuffer', 1438 'decoder_func': 'DoBindFramebuffer',
1424 'gl_test_func': 'glBindFramebufferEXT', 1439 'gl_test_func': 'glBindFramebufferEXT',
1425 'gen_func': 'GenFramebuffersEXT', 1440 'gen_func': 'GenFramebuffersEXT',
1426 'trace_level': 1, 1441 'trace_level': 1,
1427 }, 1442 },
1428 'BindRenderbuffer': { 1443 'BindRenderbuffer': {
1429 'type': 'Bind', 1444 'type': 'Bind',
1430 'decoder_func': 'DoBindRenderbuffer', 1445 'decoder_func': 'DoBindRenderbuffer',
(...skipping 918 matching lines...) Expand 10 before | Expand all | Expand 10 after
2349 'unit_test': False, 2364 'unit_test': False,
2350 'client_test': False, 2365 'client_test': False,
2351 'extension': True, 2366 'extension': True,
2352 'trace_level': 1, 2367 'trace_level': 1,
2353 }, 2368 },
2354 'TexImage2D': { 2369 'TexImage2D': {
2355 'type': 'Manual', 2370 'type': 'Manual',
2356 'data_transfer_methods': ['shm'], 2371 'data_transfer_methods': ['shm'],
2357 'client_test': False, 2372 'client_test': False,
2358 }, 2373 },
2374 'TexImage3D': {
2375 'type': 'Manual',
2376 'data_transfer_methods': ['shm'],
2377 'client_test': False,
2378 'unsafe': True,
2379 },
2359 'TexParameterf': { 2380 'TexParameterf': {
2360 'decoder_func': 'DoTexParameterf', 2381 'decoder_func': 'DoTexParameterf',
2361 'valid_args': { 2382 'valid_args': {
2362 '2': 'GL_NEAREST' 2383 '2': 'GL_NEAREST'
2363 }, 2384 },
2364 }, 2385 },
2365 'TexParameteri': { 2386 'TexParameteri': {
2366 'decoder_func': 'DoTexParameteri', 2387 'decoder_func': 'DoTexParameteri',
2367 'valid_args': { 2388 'valid_args': {
2368 '2': 'GL_NEAREST' 2389 '2': 'GL_NEAREST'
(...skipping 21 matching lines...) Expand all
2390 'TexSubImage2D': { 2411 'TexSubImage2D': {
2391 'type': 'Manual', 2412 'type': 'Manual',
2392 'data_transfer_methods': ['shm'], 2413 'data_transfer_methods': ['shm'],
2393 'client_test': False, 2414 'client_test': False,
2394 'cmd_args': 'GLenumTextureTarget target, GLint level, ' 2415 'cmd_args': 'GLenumTextureTarget target, GLint level, '
2395 'GLint xoffset, GLint yoffset, ' 2416 'GLint xoffset, GLint yoffset, '
2396 'GLsizei width, GLsizei height, ' 2417 'GLsizei width, GLsizei height, '
2397 'GLenumTextureFormat format, GLenumPixelType type, ' 2418 'GLenumTextureFormat format, GLenumPixelType type, '
2398 'const void* pixels, GLboolean internal' 2419 'const void* pixels, GLboolean internal'
2399 }, 2420 },
2421 'TexSubImage3D': {
2422 'type': 'Manual',
2423 'data_transfer_methods': ['shm'],
2424 'client_test': False,
2425 'cmd_args': 'GLenumTextureTarget target, GLint level, '
2426 'GLint xoffset, GLint yoffset, GLint zoffset, '
2427 'GLsizei width, GLsizei height, GLsizei depth, '
2428 'GLenumTextureFormat format, GLenumPixelType type, '
2429 'const void* pixels, GLboolean internal',
2430 'unsafe': True,
2431 },
2400 'Uniform1f': {'type': 'PUTXn', 'count': 1}, 2432 'Uniform1f': {'type': 'PUTXn', 'count': 1},
2401 'Uniform1fv': { 2433 'Uniform1fv': {
2402 'type': 'PUTn', 2434 'type': 'PUTn',
2403 'count': 1, 2435 'count': 1,
2404 'decoder_func': 'DoUniform1fv', 2436 'decoder_func': 'DoUniform1fv',
2405 }, 2437 },
2406 'Uniform1i': {'decoder_func': 'DoUniform1i', 'unit_test': False}, 2438 'Uniform1i': {'decoder_func': 'DoUniform1i', 'unit_test': False},
2407 'Uniform1iv': { 2439 'Uniform1iv': {
2408 'type': 'PUTn', 2440 'type': 'PUTn',
2409 'count': 1, 2441 'count': 1,
(...skipping 1966 matching lines...) Expand 10 before | Expand all | Expand 10 after
4376 cmds::%(name)s cmd; 4408 cmds::%(name)s cmd;
4377 cmd.Init(%(first_arg)s, kNewClientId); 4409 cmd.Init(%(first_arg)s, kNewClientId);
4378 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 4410 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
4379 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 4411 EXPECT_EQ(GL_NO_ERROR, GetGLError());
4380 EXPECT_TRUE(Get%(resource_type)s(kNewClientId) != NULL); 4412 EXPECT_TRUE(Get%(resource_type)s(kNewClientId) != NULL);
4381 } 4413 }
4382 """ 4414 """
4383 self.WriteValidUnitTest(func, file, valid_test, { 4415 self.WriteValidUnitTest(func, file, valid_test, {
4384 'first_arg': func.GetOriginalArgs()[0].GetValidArg(func), 4416 'first_arg': func.GetOriginalArgs()[0].GetValidArg(func),
4385 'first_gl_arg': func.GetOriginalArgs()[0].GetValidGLArg(func), 4417 'first_gl_arg': func.GetOriginalArgs()[0].GetValidGLArg(func),
4386 'resource_type': func.GetOriginalArgs()[1].resource_type, 4418 'resource_type': func.GetOriginalArgs()[-1].resource_type,
4387 'gl_gen_func_name': func.GetInfo("gen_func"), 4419 'gl_gen_func_name': func.GetInfo("gen_func"),
4388 }, *extras) 4420 }, *extras)
4389 4421
4390 invalid_test = """ 4422 invalid_test = """
4391 TEST_P(%(test_name)s, %(name)sInvalidArgs%(arg_index)d_%(value_index)d) { 4423 TEST_P(%(test_name)s, %(name)sInvalidArgs%(arg_index)d_%(value_index)d) {
4392 EXPECT_CALL(*gl_, %(gl_func_name)s(%(gl_args)s)).Times(0); 4424 EXPECT_CALL(*gl_, %(gl_func_name)s(%(gl_args)s)).Times(0);
4393 SpecializedSetup<cmds::%(name)s, 0>(false); 4425 SpecializedSetup<cmds::%(name)s, 0>(false);
4394 cmds::%(name)s cmd; 4426 cmds::%(name)s cmd;
4395 cmd.Init(%(args)s); 4427 cmd.Init(%(args)s);
4396 EXPECT_EQ(error::%(parse_result)s, ExecuteCmd(cmd));%(gl_error_test)s 4428 EXPECT_EQ(error::%(parse_result)s, ExecuteCmd(cmd));%(gl_error_test)s
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
4432 CheckGLError(); 4464 CheckGLError();
4433 } 4465 }
4434 4466
4435 """ 4467 """
4436 name_arg = None 4468 name_arg = None
4437 if len(func.GetOriginalArgs()) == 1: 4469 if len(func.GetOriginalArgs()) == 1:
4438 # Bind functions that have no target (like BindVertexArrayOES) 4470 # Bind functions that have no target (like BindVertexArrayOES)
4439 name_arg = func.GetOriginalArgs()[0] 4471 name_arg = func.GetOriginalArgs()[0]
4440 else: 4472 else:
4441 # Bind functions that have both a target and a name (like BindTexture) 4473 # Bind functions that have both a target and a name (like BindTexture)
4442 name_arg = func.GetOriginalArgs()[1] 4474 name_arg = func.GetOriginalArgs()[-1]
4443 4475
4444 file.Write(code % { 4476 file.Write(code % {
4445 'name': func.name, 4477 'name': func.name,
4446 'arg_string': func.MakeOriginalArgString(""), 4478 'arg_string': func.MakeOriginalArgString(""),
4447 'id': name_arg.name, 4479 'id': name_arg.name,
4448 'type': name_arg.resource_type, 4480 'type': name_arg.resource_type,
4449 'lc_type': name_arg.resource_type.lower(), 4481 'lc_type': name_arg.resource_type.lower(),
4450 }) 4482 })
4451 4483
4452 def WriteGLES2ImplementationUnitTest(self, func, file): 4484 def WriteGLES2ImplementationUnitTest(self, func, file):
(...skipping 4783 matching lines...) Expand 10 before | Expand all | Expand 10 after
9236 Format(gen.generated_cpp_filenames) 9268 Format(gen.generated_cpp_filenames)
9237 9269
9238 if gen.errors > 0: 9270 if gen.errors > 0:
9239 print "%d errors" % gen.errors 9271 print "%d errors" % gen.errors
9240 return 1 9272 return 1
9241 return 0 9273 return 0
9242 9274
9243 9275
9244 if __name__ == '__main__': 9276 if __name__ == '__main__':
9245 sys.exit(main(sys.argv[1:])) 9277 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « gpu/blink/webgraphicscontext3d_in_process_command_buffer_impl.cc ('k') | gpu/command_buffer/client/gles2_c_lib_autogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698