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

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

Issue 165393003: gpu: Generate mailboxes on client side (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: meant to remove crypto/random.cc Created 6 years, 10 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
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 1307 matching lines...) Expand 10 before | Expand all | Expand 10 after
1318 }, 1318 },
1319 }, 1319 },
1320 'ColorMask': { 1320 'ColorMask': {
1321 'type': 'StateSet', 1321 'type': 'StateSet',
1322 'state': 'ColorMask', 1322 'state': 'ColorMask',
1323 'no_gl': True, 1323 'no_gl': True,
1324 'expectation': False, 1324 'expectation': False,
1325 }, 1325 },
1326 'ConsumeTextureCHROMIUM': { 1326 'ConsumeTextureCHROMIUM': {
1327 'decoder_func': 'DoConsumeTextureCHROMIUM', 1327 'decoder_func': 'DoConsumeTextureCHROMIUM',
1328 'impl_func': False,
1328 'type': 'PUT', 1329 'type': 'PUT',
1329 'data_type': 'GLbyte', 1330 'data_type': 'GLbyte',
1330 'count': 64, # GL_MAILBOX_SIZE_CHROMIUM 1331 'count': 64, # GL_MAILBOX_SIZE_CHROMIUM
1331 'unit_test': False, 1332 'unit_test': False,
1333 'client_test': False,
1332 'extension': True, 1334 'extension': True,
1333 'chromium': True, 1335 'chromium': True,
1334 'trace_level': 1, 1336 'trace_level': 1,
1335 }, 1337 },
1336 'ClearStencil': { 1338 'ClearStencil': {
1337 'type': 'StateSet', 1339 'type': 'StateSet',
1338 'state': 'ClearStencil', 1340 'state': 'ClearStencil',
1339 }, 1341 },
1340 'EnableFeatureCHROMIUM': { 1342 'EnableFeatureCHROMIUM': {
1341 'type': 'Custom', 1343 'type': 'Custom',
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after
1901 'PostSubBufferCHROMIUM': { 1903 'PostSubBufferCHROMIUM': {
1902 'type': 'Custom', 1904 'type': 'Custom',
1903 'impl_func': False, 1905 'impl_func': False,
1904 'unit_test': False, 1906 'unit_test': False,
1905 'client_test': False, 1907 'client_test': False,
1906 'extension': True, 1908 'extension': True,
1907 'chromium': True, 1909 'chromium': True,
1908 }, 1910 },
1909 'ProduceTextureCHROMIUM': { 1911 'ProduceTextureCHROMIUM': {
1910 'decoder_func': 'DoProduceTextureCHROMIUM', 1912 'decoder_func': 'DoProduceTextureCHROMIUM',
1913 'impl_func': False,
1911 'type': 'PUT', 1914 'type': 'PUT',
1912 'data_type': 'GLbyte', 1915 'data_type': 'GLbyte',
1913 'count': 64, # GL_MAILBOX_SIZE_CHROMIUM 1916 'count': 64, # GL_MAILBOX_SIZE_CHROMIUM
1914 'unit_test': False, 1917 'unit_test': False,
1918 'client_test': False,
1915 'extension': True, 1919 'extension': True,
1916 'chromium': True, 1920 'chromium': True,
1917 'trace_level': 1, 1921 'trace_level': 1,
1918 }, 1922 },
1919 'RenderbufferStorage': { 1923 'RenderbufferStorage': {
1920 'decoder_func': 'DoRenderbufferStorage', 1924 'decoder_func': 'DoRenderbufferStorage',
1921 'gl_test_func': 'glRenderbufferStorageEXT', 1925 'gl_test_func': 'glRenderbufferStorageEXT',
1922 'expectation': False, 1926 'expectation': False,
1923 }, 1927 },
1924 'RenderbufferStorageMultisampleCHROMIUM': { 1928 'RenderbufferStorageMultisampleCHROMIUM': {
(...skipping 2858 matching lines...) Expand 10 before | Expand all | Expand 10 after
4783 } 4787 }
4784 """ 4788 """
4785 file.Write(code % (func.info.data_type, func.info.count)) 4789 file.Write(code % (func.info.data_type, func.info.count))
4786 if func.is_immediate: 4790 if func.is_immediate:
4787 file.Write(" if (data_size > immediate_data_size) {\n") 4791 file.Write(" if (data_size > immediate_data_size) {\n")
4788 file.Write(" return error::kOutOfBounds;\n") 4792 file.Write(" return error::kOutOfBounds;\n")
4789 file.Write(" }\n") 4793 file.Write(" }\n")
4790 4794
4791 def WriteGLES2Implementation(self, func, file): 4795 def WriteGLES2Implementation(self, func, file):
4792 """Overrriden from TypeHandler.""" 4796 """Overrriden from TypeHandler."""
4797 impl_func = func.GetInfo('impl_func')
4798 if (impl_func != None and impl_func != True):
4799 return;
4793 file.Write("%s GLES2Implementation::%s(%s) {\n" % 4800 file.Write("%s GLES2Implementation::%s(%s) {\n" %
4794 (func.return_type, func.original_name, 4801 (func.return_type, func.original_name,
4795 func.MakeTypedOriginalArgString(""))) 4802 func.MakeTypedOriginalArgString("")))
4796 file.Write(" GPU_CLIENT_SINGLE_THREAD_CHECK();\n") 4803 file.Write(" GPU_CLIENT_SINGLE_THREAD_CHECK();\n")
4797 func.WriteDestinationInitalizationValidation(file) 4804 func.WriteDestinationInitalizationValidation(file)
4798 self.WriteClientGLCallLog(func, file) 4805 self.WriteClientGLCallLog(func, file)
4799 last_arg_name = func.GetLastOriginalArg().name 4806 last_arg_name = func.GetLastOriginalArg().name
4800 values_str = ' << ", " << '.join( 4807 values_str = ' << ", " << '.join(
4801 ["%s[%d]" % (last_arg_name, ndx) for ndx in range(0, func.info.count)]) 4808 ["%s[%d]" % (last_arg_name, ndx) for ndx in range(0, func.info.count)])
4802 file.Write(' GPU_CLIENT_LOG("values: " << %s);\n' % values_str) 4809 file.Write(' GPU_CLIENT_LOG("values: " << %s);\n' % values_str)
4803 for arg in func.GetOriginalArgs(): 4810 for arg in func.GetOriginalArgs():
4804 arg.WriteClientSideValidationCode(file, func) 4811 arg.WriteClientSideValidationCode(file, func)
4805 file.Write(" helper_->%sImmediate(%s);\n" % 4812 file.Write(" helper_->%sImmediate(%s);\n" %
4806 (func.name, func.MakeOriginalArgString(""))) 4813 (func.name, func.MakeOriginalArgString("")))
4807 file.Write(" CheckGLError();\n") 4814 file.Write(" CheckGLError();\n")
4808 file.Write("}\n") 4815 file.Write("}\n")
4809 file.Write("\n") 4816 file.Write("\n")
4810 4817
4811 def WriteGLES2ImplementationUnitTest(self, func, file): 4818 def WriteGLES2ImplementationUnitTest(self, func, file):
4812 """Writes the GLES2 Implemention unit test.""" 4819 """Writes the GLES2 Implemention unit test."""
4820 client_test = func.GetInfo('client_test')
4821 if (client_test != None and client_test != True):
4822 return;
4813 code = """ 4823 code = """
4814 TEST_F(GLES2ImplementationTest, %(name)s) { 4824 TEST_F(GLES2ImplementationTest, %(name)s) {
4815 %(type)s data[%(count)d] = {0}; 4825 %(type)s data[%(count)d] = {0};
4816 struct Cmds { 4826 struct Cmds {
4817 cmds::%(name)sImmediate cmd; 4827 cmds::%(name)sImmediate cmd;
4818 %(type)s data[%(count)d]; 4828 %(type)s data[%(count)d];
4819 }; 4829 };
4820 4830
4821 for (int jj = 0; jj < %(count)d; ++jj) { 4831 for (int jj = 0; jj < %(count)d; ++jj) {
4822 data[jj] = static_cast<%(type)s>(jj); 4832 data[jj] = static_cast<%(type)s>(jj);
(...skipping 3064 matching lines...) Expand 10 before | Expand all | Expand 10 after
7887 "../../mojo/public/gles2/gles2_call_visitor_autogen.h") 7897 "../../mojo/public/gles2/gles2_call_visitor_autogen.h")
7888 7898
7889 if gen.errors > 0: 7899 if gen.errors > 0:
7890 print "%d errors" % gen.errors 7900 print "%d errors" % gen.errors
7891 return 1 7901 return 1
7892 return 0 7902 return 0
7893 7903
7894 7904
7895 if __name__ == '__main__': 7905 if __name__ == '__main__':
7896 sys.exit(main(sys.argv[1:])) 7906 sys.exit(main(sys.argv[1:]))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698