Convert command buffer autogen to python3
The python scripts to generate GLES2/raster/WebGPU command buffer was still running with vpython which is 2.7. Update the PRESUBMIT to run with python3 and fix python3 compatibility issues. Bug: none Change-Id: Ibe11208afb11bfe9870dc261865a7c909f76bde2 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3577186 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Reviewed-by: Derek Schuff <dschuff@chromium.org> Commit-Queue: Kyle Charbonneau <kylechar@chromium.org> Cr-Commit-Position: refs/heads/main@{#991501}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
2784ff0fc0
commit
9bf308380b
@ -65,7 +65,7 @@ def CommonChecks(input_api, output_api):
|
||||
input_api.Command(
|
||||
name='build_gles2_cmd_buffer',
|
||||
cmd=[
|
||||
input_api.python_executable, 'build_gles2_cmd_buffer.py',
|
||||
input_api.python3_executable, 'build_gles2_cmd_buffer.py',
|
||||
'--check', '--output-dir=' + temp_dir
|
||||
],
|
||||
kwargs={},
|
||||
@ -75,7 +75,7 @@ def CommonChecks(input_api, output_api):
|
||||
input_api.Command(
|
||||
name='build_raster_cmd_buffer',
|
||||
cmd=[
|
||||
input_api.python_executable, 'build_raster_cmd_buffer.py',
|
||||
input_api.python3_executable, 'build_raster_cmd_buffer.py',
|
||||
'--check', '--output-dir=' + temp_dir
|
||||
],
|
||||
kwargs={},
|
||||
@ -85,7 +85,7 @@ def CommonChecks(input_api, output_api):
|
||||
input_api.Command(
|
||||
name='build_webgpu_cmd_buffer',
|
||||
cmd=[
|
||||
input_api.python_executable, 'build_webgpu_cmd_buffer.py',
|
||||
input_api.python3_executable, 'build_webgpu_cmd_buffer.py',
|
||||
'--check', '--output-dir=' + temp_dir
|
||||
],
|
||||
kwargs={},
|
||||
|
@ -682,7 +682,7 @@ def _Namespace():
|
||||
def Grouper(n, iterable, fillvalue=None):
|
||||
"""Collect data into fixed-length chunks or blocks"""
|
||||
args = [iter(iterable)] * n
|
||||
return itertools.izip_longest(fillvalue=fillvalue, *args)
|
||||
return itertools.zip_longest(fillvalue=fillvalue, *args)
|
||||
|
||||
|
||||
def SplitWords(input_string):
|
||||
@ -831,7 +831,7 @@ class CWriter(object):
|
||||
except OSError as e:
|
||||
if e.errno == errno.EEXIST:
|
||||
pass
|
||||
self._file = open(filename, 'wb')
|
||||
self._file = open(filename, 'w')
|
||||
|
||||
def __enter__(self):
|
||||
self._file.write(self._ENTER_MSG)
|
||||
@ -1477,7 +1477,7 @@ TEST_F(%(prefix)sImplementationTest,
|
||||
"""
|
||||
for invalid_arg in constants:
|
||||
gl_arg_strings = []
|
||||
invalid = invalid_arg.GetInvalidArg(func)
|
||||
invalid = invalid_arg.GetInvalidArg(0)
|
||||
for arg in func.GetOriginalArgs():
|
||||
if arg is invalid_arg:
|
||||
gl_arg_strings.append(invalid[0])
|
||||
@ -5923,7 +5923,7 @@ class Function(object):
|
||||
"""Writes the cmd cmd_flags constant."""
|
||||
# By default trace only at the highest level 3.
|
||||
trace_level = int(self.GetInfo('trace_level', default = 3))
|
||||
if trace_level not in xrange(0, 4):
|
||||
if trace_level not in range(0, 4):
|
||||
raise KeyError("Unhandled trace_level: %d" % trace_level)
|
||||
|
||||
cmd_flags = ('CMD_FLAG_SET_TRACE_LEVEL(%d)' % trace_level)
|
||||
@ -6351,11 +6351,11 @@ class GLGenerator(object):
|
||||
def Log(self, msg):
|
||||
"""Prints something if verbose is true."""
|
||||
if self.verbose:
|
||||
print msg
|
||||
print(msg)
|
||||
|
||||
def Error(self, msg):
|
||||
"""Prints an error."""
|
||||
print "Error: %s" % msg
|
||||
print("Error: %s" % msg)
|
||||
self.errors += 1
|
||||
|
||||
def ParseGLH(self, filename):
|
||||
@ -6703,7 +6703,7 @@ void ContextState::InitState(const ContextState *prev_state) const {
|
||||
continue
|
||||
if state['type'] == 'FrontBack':
|
||||
num_states = len(state['states'])
|
||||
for ndx, group in enumerate(Grouper(num_states / 2,
|
||||
for ndx, group in enumerate(Grouper(num_states // 2,
|
||||
state['states'])):
|
||||
if test_prev:
|
||||
f.write(" if (")
|
||||
@ -6992,7 +6992,7 @@ void ContextStateTestHelpers::SetupInitStateExpectations(
|
||||
state = _STATE_INFO[state_name]
|
||||
if state['type'] == 'FrontBack':
|
||||
num_states = len(state['states'])
|
||||
for ndx, group in enumerate(Grouper(num_states / 2,
|
||||
for ndx, group in enumerate(Grouper(num_states // 2,
|
||||
state['states'])):
|
||||
args = []
|
||||
for item in group:
|
||||
@ -7424,13 +7424,13 @@ const size_t %(p)sUtil::enum_to_string_table_len_ =
|
||||
f.write("#include \"ppapi/c/ppb_opengles2.h\"\n\n")
|
||||
else:
|
||||
f.write("\n#ifndef __gl2_h_\n")
|
||||
for (k, v) in _GL_TYPES.iteritems():
|
||||
for (k, v) in _GL_TYPES.items():
|
||||
f.write("typedef %s %s;\n" % (v, k))
|
||||
f.write("#ifdef _WIN64\n")
|
||||
for (k, v) in _GL_TYPES_64.iteritems():
|
||||
for (k, v) in _GL_TYPES_64.items():
|
||||
f.write("typedef %s %s;\n" % (v, k))
|
||||
f.write("#else\n")
|
||||
for (k, v) in _GL_TYPES_32.iteritems():
|
||||
for (k, v) in _GL_TYPES_32.items():
|
||||
f.write("typedef %s %s;\n" % (v, k))
|
||||
f.write("#endif // _WIN64\n")
|
||||
f.write("#endif // __gl2_h_\n\n")
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
@ -4318,7 +4318,7 @@ def main(argv):
|
||||
chromium_root_dir)
|
||||
|
||||
if gen.errors > 0:
|
||||
print "build_gles2_cmd_buffer.py: Failed with %d errors" % gen.errors
|
||||
print("build_gles2_cmd_buffer.py: Failed with %d errors" % gen.errors)
|
||||
return 1
|
||||
|
||||
check_failed_filenames = []
|
||||
@ -4329,10 +4329,10 @@ def main(argv):
|
||||
check_failed_filenames.append(filename)
|
||||
|
||||
if len(check_failed_filenames) > 0:
|
||||
print 'Please run gpu/command_buffer/build_gles2_cmd_buffer.py'
|
||||
print 'Failed check on autogenerated command buffer files:'
|
||||
print('Please run gpu/command_buffer/build_gles2_cmd_buffer.py')
|
||||
print('Failed check on autogenerated command buffer files:')
|
||||
for filename in check_failed_filenames:
|
||||
print filename
|
||||
print(filename)
|
||||
return 1
|
||||
|
||||
return 0
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
# Copyright 2018 The Chromium Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
@ -468,7 +468,7 @@ def main(argv):
|
||||
chromium_root_dir)
|
||||
|
||||
if gen.errors > 0:
|
||||
print "build_raster_cmd_buffer.py: Failed with %d errors" % gen.errors
|
||||
print("build_raster_cmd_buffer.py: Failed with %d errors" % gen.errors)
|
||||
return 1
|
||||
|
||||
check_failed_filenames = []
|
||||
@ -479,10 +479,10 @@ def main(argv):
|
||||
check_failed_filenames.append(filename)
|
||||
|
||||
if len(check_failed_filenames) > 0:
|
||||
print 'Please run gpu/command_buffer/build_raster_cmd_buffer.py'
|
||||
print 'Failed check on autogenerated command buffer files:'
|
||||
print('Please run gpu/command_buffer/build_raster_cmd_buffer.py')
|
||||
print('Failed check on autogenerated command buffer files:')
|
||||
for filename in check_failed_filenames:
|
||||
print filename
|
||||
print(filename)
|
||||
return 1
|
||||
|
||||
return 0
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
# Copyright 2018 The Chromium Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
@ -168,7 +168,7 @@ def main(argv):
|
||||
chromium_root_dir)
|
||||
|
||||
if gen.errors > 0:
|
||||
print "build_webgpu_cmd_buffer.py: Failed with %d errors" % gen.errors
|
||||
print("build_webgpu_cmd_buffer.py: Failed with %d errors" % gen.errors)
|
||||
return 1
|
||||
|
||||
check_failed_filenames = []
|
||||
@ -179,10 +179,10 @@ def main(argv):
|
||||
check_failed_filenames.append(filename)
|
||||
|
||||
if len(check_failed_filenames) > 0:
|
||||
print 'Please run gpu/command_buffer/build_webgpu_cmd_buffer.py'
|
||||
print 'Failed check on autogenerated command buffer files:'
|
||||
print('Please run gpu/command_buffer/build_webgpu_cmd_buffer.py')
|
||||
print('Failed check on autogenerated command buffer files:')
|
||||
for filename in check_failed_filenames:
|
||||
print filename
|
||||
print(filename)
|
||||
return 1
|
||||
|
||||
return 0
|
||||
|
@ -11,9 +11,9 @@
|
||||
#ifndef GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_FORMAT_AUTOGEN_H_
|
||||
#define GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_FORMAT_AUTOGEN_H_
|
||||
|
||||
#define GL_SYNC_FLUSH_COMMANDS_BIT 0x00000001
|
||||
#define GL_SYNC_GPU_COMMANDS_COMPLETE 0x9117
|
||||
#define GL_SCANOUT_CHROMIUM 0x6000
|
||||
#define GL_SYNC_GPU_COMMANDS_COMPLETE 0x9117
|
||||
#define GL_SYNC_FLUSH_COMMANDS_BIT 0x00000001
|
||||
|
||||
struct ActiveTexture {
|
||||
typedef ActiveTexture ValueType;
|
||||
|
@ -52,19 +52,19 @@ describe {
|
||||
#include "ppapi/c/pp_resource.h"
|
||||
|
||||
#ifndef __gl2_h_
|
||||
typedef void GLvoid;
|
||||
typedef int GLsizei;
|
||||
typedef unsigned short GLushort;
|
||||
typedef short GLshort;
|
||||
typedef unsigned char GLubyte;
|
||||
typedef unsigned int GLenum;
|
||||
typedef int GLint;
|
||||
typedef unsigned char GLboolean;
|
||||
typedef unsigned int GLbitfield;
|
||||
typedef signed char GLbyte;
|
||||
typedef short GLshort;
|
||||
typedef int GLint;
|
||||
typedef int GLsizei;
|
||||
typedef unsigned char GLubyte;
|
||||
typedef unsigned short GLushort;
|
||||
typedef unsigned int GLuint;
|
||||
typedef float GLfloat;
|
||||
typedef float GLclampf;
|
||||
typedef signed char GLbyte;
|
||||
typedef unsigned int GLuint;
|
||||
typedef void GLvoid;
|
||||
typedef int GLfixed;
|
||||
typedef int GLclampx;
|
||||
#ifdef _WIN64
|
||||
|
Reference in New Issue
Block a user