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

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

Issue 11138021: Make GLES2Implementation based on GLES2Interface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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/client/gles2_implementation.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 os 8 import os
9 import os.path 9 import os.path
10 import sys 10 import sys
(...skipping 2231 matching lines...) Expand 10 before | Expand all | Expand 10 after
2242 file.Write("// TODO(gman): %s\n" % func.name) 2242 file.Write("// TODO(gman): %s\n" % func.name)
2243 2243
2244 def WriteBucketValidationCode(self, func, file): 2244 def WriteBucketValidationCode(self, func, file):
2245 """Writes the validation code for a bucket version of a command.""" 2245 """Writes the validation code for a bucket version of a command."""
2246 file.Write("// TODO(gman): %s\n" % func.name) 2246 file.Write("// TODO(gman): %s\n" % func.name)
2247 2247
2248 def WriteGLES2ImplementationDeclaration(self, func, file): 2248 def WriteGLES2ImplementationDeclaration(self, func, file):
2249 """Writes the GLES2 Implemention declaration.""" 2249 """Writes the GLES2 Implemention declaration."""
2250 impl_decl = func.GetInfo('impl_decl') 2250 impl_decl = func.GetInfo('impl_decl')
2251 if impl_decl == None or impl_decl == True: 2251 if impl_decl == None or impl_decl == True:
2252 file.Write("%s %s(%s);\n" % 2252 file.Write("virtual %s %s(%s) OVERRIDE;\n" %
2253 (func.return_type, func.original_name, 2253 (func.return_type, func.original_name,
2254 func.MakeTypedOriginalArgString(""))) 2254 func.MakeTypedOriginalArgString("")))
2255 file.Write("\n") 2255 file.Write("\n")
2256 2256
2257 def WriteGLES2CLibImplementation(self, func, file): 2257 def WriteGLES2CLibImplementation(self, func, file):
2258 file.Write("%s GLES2%s(%s) {\n" % 2258 file.Write("%s GLES2%s(%s) {\n" %
2259 (func.return_type, func.name, 2259 (func.return_type, func.name,
2260 func.MakeTypedOriginalArgString(""))) 2260 func.MakeTypedOriginalArgString("")))
2261 result_string = "return " 2261 result_string = "return "
2262 if func.return_type == "void": 2262 if func.return_type == "void":
(...skipping 12 matching lines...) Expand all
2275 ' GPU_CLIENT_LOG("[" << GetLogPrefix() << "] gl%s("%s%s << ")");\n' % 2275 ' GPU_CLIENT_LOG("[" << GetLogPrefix() << "] gl%s("%s%s << ")");\n' %
2276 (func.original_name, comma, func.MakeLogArgString())) 2276 (func.original_name, comma, func.MakeLogArgString()))
2277 2277
2278 def WriteClientGLReturnLog(self, func, file): 2278 def WriteClientGLReturnLog(self, func, file):
2279 """Writes the return value logging code.""" 2279 """Writes the return value logging code."""
2280 if func.return_type != "void": 2280 if func.return_type != "void":
2281 file.Write(' GPU_CLIENT_LOG("return:" << result)\n') 2281 file.Write(' GPU_CLIENT_LOG("return:" << result)\n')
2282 2282
2283 def WriteGLES2ImplementationHeader(self, func, file): 2283 def WriteGLES2ImplementationHeader(self, func, file):
2284 """Writes the GLES2 Implemention.""" 2284 """Writes the GLES2 Implemention."""
2285 self.WriteGLES2ImplementationDeclaration(func, file)
2286
2287 def WriteGLES2Implementation(self, func, file):
2288 """Writes the GLES2 Implemention."""
2285 impl_func = func.GetInfo('impl_func') 2289 impl_func = func.GetInfo('impl_func')
2286 impl_decl = func.GetInfo('impl_decl') 2290 impl_decl = func.GetInfo('impl_decl')
2287 gen_cmd = func.GetInfo('gen_cmd') 2291 gen_cmd = func.GetInfo('gen_cmd')
2288 if (func.can_auto_generate and 2292 if (func.can_auto_generate and
2289 (impl_func == None or impl_func == True) and 2293 (impl_func == None or impl_func == True) and
2290 (impl_decl == None or impl_decl == True) and 2294 (impl_decl == None or impl_decl == True) and
2291 (gen_cmd == None or gen_cmd == True)): 2295 (gen_cmd == None or gen_cmd == True)):
2292 file.Write("%s %s(%s) {\n" % 2296 file.Write("%s GLES2Implementation::%s(%s) {\n" %
2293 (func.return_type, func.original_name, 2297 (func.return_type, func.original_name,
2294 func.MakeTypedOriginalArgString(""))) 2298 func.MakeTypedOriginalArgString("")))
2295 file.Write(" GPU_CLIENT_SINGLE_THREAD_CHECK();\n") 2299 file.Write(" GPU_CLIENT_SINGLE_THREAD_CHECK();\n")
2296 self.WriteClientGLCallLog(func, file) 2300 self.WriteClientGLCallLog(func, file)
2297 func.WriteDestinationInitalizationValidation(file) 2301 func.WriteDestinationInitalizationValidation(file)
2298 for arg in func.GetOriginalArgs(): 2302 for arg in func.GetOriginalArgs():
2299 arg.WriteClientSideValidationCode(file, func) 2303 arg.WriteClientSideValidationCode(file, func)
2300 file.Write(" helper_->%s(%s);\n" % 2304 file.Write(" helper_->%s(%s);\n" %
2301 (func.name, func.MakeOriginalArgString(""))) 2305 (func.name, func.MakeOriginalArgString("")))
2302 self.WriteClientGLReturnLog(func, file) 2306 self.WriteClientGLReturnLog(func, file)
2303 file.Write("}\n") 2307 file.Write("}\n")
2304 file.Write("\n") 2308 file.Write("\n")
2305 else: 2309
2306 self.WriteGLES2ImplementationDeclaration(func, file) 2310 def WriteGLES2InterfaceHeader(self, func, file):
2311 """Writes the GLES2 Interface."""
2312 file.Write("virtual %s %s(%s) = 0;\n" %
2313 (func.return_type, func.original_name,
2314 func.MakeTypedOriginalArgString("")))
2315
2316 def WriteGLES2InterfaceStub(self, func, file):
2317 """Writes the GLES2 Interface stub declaration."""
2318 file.Write("virtual %s %s(%s) OVERRIDE;\n" %
2319 (func.return_type, func.original_name,
2320 func.MakeTypedOriginalArgString("")))
2321
2322 def WriteGLES2InterfaceStubImpl(self, func, file):
2323 """Writes the GLES2 Interface stub declaration."""
2324 args = func.GetOriginalArgs()
2325 arg_string = ", ".join(
2326 ["%s /* %s */" % (arg.type, arg.name) for arg in args])
2327 file.Write("%s GLES2InterfaceStub::%s(%s) {\n" %
2328 (func.return_type, func.original_name, arg_string))
2329 if func.return_type != "void":
2330 file.Write(" return 0;\n")
2331 file.Write("}\n")
2307 2332
2308 def WriteGLES2ImplementationUnitTest(self, func, file): 2333 def WriteGLES2ImplementationUnitTest(self, func, file):
2309 """Writes the GLES2 Implemention unit test.""" 2334 """Writes the GLES2 Implemention unit test."""
2310 client_test = func.GetInfo('client_test') 2335 client_test = func.GetInfo('client_test')
2311 if (func.can_auto_generate and 2336 if (func.can_auto_generate and
2312 (client_test == None or client_test == True)): 2337 (client_test == None or client_test == True)):
2313 code = """ 2338 code = """
2314 TEST_F(GLES2ImplementationTest, %(name)s) { 2339 TEST_F(GLES2ImplementationTest, %(name)s) {
2315 struct Cmds { 2340 struct Cmds {
2316 %(name)s cmd; 2341 %(name)s cmd;
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
2467 pass 2492 pass
2468 2493
2469 def WriteImmediateFormatTest(self, func, file): 2494 def WriteImmediateFormatTest(self, func, file):
2470 """Overrriden from TypeHandler.""" 2495 """Overrriden from TypeHandler."""
2471 pass 2496 pass
2472 2497
2473 def WriteGLES2ImplementationUnitTest(self, func, file): 2498 def WriteGLES2ImplementationUnitTest(self, func, file):
2474 """Overrriden from TypeHandler.""" 2499 """Overrriden from TypeHandler."""
2475 pass 2500 pass
2476 2501
2477 def WriteGLES2ImplementationHeader(self, func, file): 2502 def WriteGLES2Implementation(self, func, file):
2478 """Overrriden from TypeHandler.""" 2503 """Overrriden from TypeHandler."""
2479 file.Write("%s %s(%s) {\n" % 2504 file.Write("%s GLES2Implementation::%s(%s) {\n" %
2480 (func.return_type, func.original_name, 2505 (func.return_type, func.original_name,
2481 func.MakeTypedOriginalArgString(""))) 2506 func.MakeTypedOriginalArgString("")))
2482 file.Write(" // TODO: for now this is a no-op\n") 2507 file.Write(" // TODO: for now this is a no-op\n")
2483 file.Write( 2508 file.Write(
2484 " SetGLError(GL_INVALID_OPERATION, \"gl%s\", \"not implemented\");\n" % 2509 " SetGLError(GL_INVALID_OPERATION, \"gl%s\", \"not implemented\");\n" %
2485 func.name) 2510 func.name)
2486 if func.return_type != "void": 2511 if func.return_type != "void":
2487 file.Write(" return 0;\n") 2512 file.Write(" return 0;\n")
2488 file.Write("}\n") 2513 file.Write("}\n")
2489 file.Write("\n") 2514 file.Write("\n")
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
2600 file.Write("// TODO(gman): %s\n\n" % func.name) 2625 file.Write("// TODO(gman): %s\n\n" % func.name)
2601 2626
2602 def WriteImmediateServiceImplementation(self, func, file): 2627 def WriteImmediateServiceImplementation(self, func, file):
2603 """Overrriden from TypeHandler.""" 2628 """Overrriden from TypeHandler."""
2604 pass 2629 pass
2605 2630
2606 def WriteImmediateFormatTest(self, func, file): 2631 def WriteImmediateFormatTest(self, func, file):
2607 """Overrriden from TypeHandler.""" 2632 """Overrriden from TypeHandler."""
2608 file.Write("// TODO(gman): Implement test for %s\n" % func.name) 2633 file.Write("// TODO(gman): Implement test for %s\n" % func.name)
2609 2634
2635 def WriteGLES2Implementation(self, func, file):
2636 """Overrriden from TypeHandler."""
2637 pass
2638
2610 def WriteGLES2ImplementationHeader(self, func, file): 2639 def WriteGLES2ImplementationHeader(self, func, file):
2611 """Overrriden from TypeHandler.""" 2640 """Overrriden from TypeHandler."""
2612 file.Write("%s %s(%s);\n" % 2641 file.Write("virtual %s %s(%s) OVERRIDE;\n" %
2613 (func.return_type, func.original_name, 2642 (func.return_type, func.original_name,
2614 func.MakeTypedOriginalArgString(""))) 2643 func.MakeTypedOriginalArgString("")))
2615 file.Write("\n") 2644 file.Write("\n")
2616 2645
2617 def WriteImmediateCmdGetTotalSize(self, func, file): 2646 def WriteImmediateCmdGetTotalSize(self, func, file):
2618 """Overrriden from TypeHandler.""" 2647 """Overrriden from TypeHandler."""
2619 # TODO(gman): Move this data to _FUNCTION_INFO? 2648 # TODO(gman): Move this data to _FUNCTION_INFO?
2620 if func.name == 'ShaderSourceImmediate': 2649 if func.name == 'ShaderSourceImmediate':
2621 file.Write(" uint32 total_size = ComputeSize(_data_size);\n") 2650 file.Write(" uint32 total_size = ComputeSize(_data_size);\n")
2622 else: 2651 else:
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
2815 TEST_F(%(test_name)s, %(name)sInvalidArgs%(arg_index)d_%(value_index)d) { 2844 TEST_F(%(test_name)s, %(name)sInvalidArgs%(arg_index)d_%(value_index)d) {
2816 EXPECT_CALL(*gl_, %(gl_func_name)s(%(gl_args)s)).Times(0); 2845 EXPECT_CALL(*gl_, %(gl_func_name)s(%(gl_args)s)).Times(0);
2817 SpecializedSetup<%(name)s, 0>(false); 2846 SpecializedSetup<%(name)s, 0>(false);
2818 %(name)s cmd; 2847 %(name)s cmd;
2819 cmd.Init(%(args)s); 2848 cmd.Init(%(args)s);
2820 EXPECT_EQ(error::%(parse_result)s, ExecuteCmd(cmd));%(gl_error_test)s 2849 EXPECT_EQ(error::%(parse_result)s, ExecuteCmd(cmd));%(gl_error_test)s
2821 } 2850 }
2822 """ 2851 """
2823 self.WriteInvalidUnitTest(func, file, invalid_test) 2852 self.WriteInvalidUnitTest(func, file, invalid_test)
2824 2853
2825 def WriteGLES2ImplementationHeader(self, func, file): 2854 def WriteGLES2Implementation(self, func, file):
2826 """Writes the GLES2 Implemention.""" 2855 """Writes the GLES2 Implemention."""
2827 2856
2828 impl_func = func.GetInfo('impl_func') 2857 impl_func = func.GetInfo('impl_func')
2829 impl_decl = func.GetInfo('impl_decl') 2858 impl_decl = func.GetInfo('impl_decl')
2830 2859
2831 if (func.can_auto_generate and 2860 if (func.can_auto_generate and
2832 (impl_func == None or impl_func == True) and 2861 (impl_func == None or impl_func == True) and
2833 (impl_decl == None or impl_decl == True)): 2862 (impl_decl == None or impl_decl == True)):
2834 2863
2835 file.Write("%s %s(%s) {\n" % 2864 file.Write("%s GLES2Implementation::%s(%s) {\n" %
2836 (func.return_type, func.original_name, 2865 (func.return_type, func.original_name,
2837 func.MakeTypedOriginalArgString(""))) 2866 func.MakeTypedOriginalArgString("")))
2838 file.Write(" GPU_CLIENT_SINGLE_THREAD_CHECK();\n") 2867 file.Write(" GPU_CLIENT_SINGLE_THREAD_CHECK();\n")
2839 func.WriteDestinationInitalizationValidation(file) 2868 func.WriteDestinationInitalizationValidation(file)
2840 self.WriteClientGLCallLog(func, file) 2869 self.WriteClientGLCallLog(func, file)
2841 for arg in func.GetOriginalArgs(): 2870 for arg in func.GetOriginalArgs():
2842 arg.WriteClientSideValidationCode(file, func) 2871 arg.WriteClientSideValidationCode(file, func)
2843 2872
2844 code = """ if (Is%(type)sReservedId(%(id)s)) { 2873 code = """ if (Is%(type)sReservedId(%(id)s)) {
2845 SetGLError(GL_INVALID_OPERATION, "%(name)s\", \"%(id)s reserved id"); 2874 SetGLError(GL_INVALID_OPERATION, "%(name)s\", \"%(id)s reserved id");
(...skipping 13 matching lines...) Expand all
2859 name_arg = func.GetOriginalArgs()[1] 2888 name_arg = func.GetOriginalArgs()[1]
2860 2889
2861 file.Write(code % { 2890 file.Write(code % {
2862 'name': func.name, 2891 'name': func.name,
2863 'arg_string': func.MakeOriginalArgString(""), 2892 'arg_string': func.MakeOriginalArgString(""),
2864 'id': name_arg.name, 2893 'id': name_arg.name,
2865 'type': name_arg.resource_type, 2894 'type': name_arg.resource_type,
2866 'lc_type': name_arg.resource_type.lower(), 2895 'lc_type': name_arg.resource_type.lower(),
2867 }) 2896 })
2868 2897
2869 else:
2870 self.WriteGLES2ImplementationDeclaration(func, file)
2871
2872 2898
2873 class GENnHandler(TypeHandler): 2899 class GENnHandler(TypeHandler):
2874 """Handler for glGen___ type functions.""" 2900 """Handler for glGen___ type functions."""
2875 2901
2876 def __init__(self): 2902 def __init__(self):
2877 TypeHandler.__init__(self) 2903 TypeHandler.__init__(self)
2878 2904
2879 def InitFunction(self, func): 2905 def InitFunction(self, func):
2880 """Overrriden from TypeHandler.""" 2906 """Overrriden from TypeHandler."""
2881 pass 2907 pass
(...skipping 14 matching lines...) Expand all
2896 " }\n" % 2922 " }\n" %
2897 (func.name, func.GetLastOriginalArg().name)) 2923 (func.name, func.GetLastOriginalArg().name))
2898 2924
2899 def WriteImmediateHandlerImplementation(self, func, file): 2925 def WriteImmediateHandlerImplementation(self, func, file):
2900 """Overrriden from TypeHandler.""" 2926 """Overrriden from TypeHandler."""
2901 file.Write(" if (!%sHelper(n, %s)) {\n" 2927 file.Write(" if (!%sHelper(n, %s)) {\n"
2902 " return error::kInvalidArguments;\n" 2928 " return error::kInvalidArguments;\n"
2903 " }\n" % 2929 " }\n" %
2904 (func.original_name, func.GetLastOriginalArg().name)) 2930 (func.original_name, func.GetLastOriginalArg().name))
2905 2931
2906 def WriteGLES2ImplementationHeader(self, func, file): 2932 def WriteGLES2Implementation(self, func, file):
2907 """Overrriden from TypeHandler.""" 2933 """Overrriden from TypeHandler."""
2908 log_code = (""" GPU_CLIENT_LOG_CODE_BLOCK({ 2934 log_code = (""" GPU_CLIENT_LOG_CODE_BLOCK({
2909 for (GLsizei i = 0; i < n; ++i) { 2935 for (GLsizei i = 0; i < n; ++i) {
2910 GPU_CLIENT_LOG(" " << i << ": " << %s[i]); 2936 GPU_CLIENT_LOG(" " << i << ": " << %s[i]);
2911 } 2937 }
2912 });""" % func.GetOriginalArgs()[1].name) 2938 });""" % func.GetOriginalArgs()[1].name)
2913 args = { 2939 args = {
2914 'log_code': log_code, 2940 'log_code': log_code,
2915 'return_type': func.return_type, 2941 'return_type': func.return_type,
2916 'name': func.original_name, 2942 'name': func.original_name,
2917 'typed_args': func.MakeTypedOriginalArgString(""), 2943 'typed_args': func.MakeTypedOriginalArgString(""),
2918 'args': func.MakeOriginalArgString(""), 2944 'args': func.MakeOriginalArgString(""),
2919 'resource_types': func.GetInfo('resource_types'), 2945 'resource_types': func.GetInfo('resource_types'),
2920 'count_name': func.GetOriginalArgs()[0].name, 2946 'count_name': func.GetOriginalArgs()[0].name,
2921 } 2947 }
2922 file.Write("%(return_type)s %(name)s(%(typed_args)s) {\n" % args) 2948 file.Write(
2949 "%(return_type)s GLES2Implementation::%(name)s(%(typed_args)s) {\n" %
2950 args)
2923 func.WriteDestinationInitalizationValidation(file) 2951 func.WriteDestinationInitalizationValidation(file)
2924 self.WriteClientGLCallLog(func, file) 2952 self.WriteClientGLCallLog(func, file)
2925 for arg in func.GetOriginalArgs(): 2953 for arg in func.GetOriginalArgs():
2926 arg.WriteClientSideValidationCode(file, func) 2954 arg.WriteClientSideValidationCode(file, func)
2927 code = """ GPU_CLIENT_SINGLE_THREAD_CHECK(); 2955 code = """ GPU_CLIENT_SINGLE_THREAD_CHECK();
2928 GetIdHandler(id_namespaces::k%(resource_types)s)-> 2956 GetIdHandler(id_namespaces::k%(resource_types)s)->
2929 MakeIds(this, 0, %(args)s); 2957 MakeIds(this, 0, %(args)s);
2930 helper_->%(name)sImmediate(%(args)s); 2958 helper_->%(name)sImmediate(%(args)s);
2931 %(log_code)s 2959 %(log_code)s
2932 } 2960 }
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
3157 }) 3185 })
3158 3186
3159 def WriteHandlerImplementation (self, func, file): 3187 def WriteHandlerImplementation (self, func, file):
3160 """Overrriden from TypeHandler.""" 3188 """Overrriden from TypeHandler."""
3161 file.Write(" uint32 client_id = c.client_id;\n") 3189 file.Write(" uint32 client_id = c.client_id;\n")
3162 file.Write(" if (!%sHelper(%s)) {\n" % 3190 file.Write(" if (!%sHelper(%s)) {\n" %
3163 (func.name, func.MakeCmdArgString(""))) 3191 (func.name, func.MakeCmdArgString("")))
3164 file.Write(" return error::kInvalidArguments;\n") 3192 file.Write(" return error::kInvalidArguments;\n")
3165 file.Write(" }\n") 3193 file.Write(" }\n")
3166 3194
3167 def WriteGLES2ImplementationHeader(self, func, file): 3195 def WriteGLES2Implementation(self, func, file):
3168 """Overrriden from TypeHandler.""" 3196 """Overrriden from TypeHandler."""
3169 file.Write("%s %s(%s) {\n" % 3197 file.Write("%s GLES2Implementation::%s(%s) {\n" %
3170 (func.return_type, func.original_name, 3198 (func.return_type, func.original_name,
3171 func.MakeTypedOriginalArgString(""))) 3199 func.MakeTypedOriginalArgString("")))
3172 file.Write(" GPU_CLIENT_SINGLE_THREAD_CHECK();\n") 3200 file.Write(" GPU_CLIENT_SINGLE_THREAD_CHECK();\n")
3173 func.WriteDestinationInitalizationValidation(file) 3201 func.WriteDestinationInitalizationValidation(file)
3174 self.WriteClientGLCallLog(func, file) 3202 self.WriteClientGLCallLog(func, file)
3175 for arg in func.GetOriginalArgs(): 3203 for arg in func.GetOriginalArgs():
3176 arg.WriteClientSideValidationCode(file, func) 3204 arg.WriteClientSideValidationCode(file, func)
3177 file.Write(" GLuint client_id;\n") 3205 file.Write(" GLuint client_id;\n")
3178 file.Write( 3206 file.Write(
3179 " GetIdHandler(id_namespaces::kProgramsAndShaders)->\n") 3207 " GetIdHandler(id_namespaces::kProgramsAndShaders)->\n")
3180 file.Write(" MakeIds(this, 0, 1, &client_id);\n") 3208 file.Write(" MakeIds(this, 0, 1, &client_id);\n")
3181 file.Write(" helper_->%s(%s);\n" % 3209 file.Write(" helper_->%s(%s);\n" %
3182 (func.name, func.MakeCmdArgString(""))) 3210 (func.name, func.MakeCmdArgString("")))
3183 file.Write(' GPU_CLIENT_LOG("returned " << client_id);\n') 3211 file.Write(' GPU_CLIENT_LOG("returned " << client_id);\n')
3184 file.Write(" return client_id;\n") 3212 file.Write(" return client_id;\n")
3185 file.Write("}\n") 3213 file.Write("}\n")
3186 file.Write("\n") 3214 file.Write("\n")
3187 3215
3188 3216
3189 class DeleteHandler(TypeHandler): 3217 class DeleteHandler(TypeHandler):
3190 """Handler for glDelete___ single resource type functions.""" 3218 """Handler for glDelete___ single resource type functions."""
3191 3219
3192 def __init__(self): 3220 def __init__(self):
3193 TypeHandler.__init__(self) 3221 TypeHandler.__init__(self)
3194 3222
3195 def WriteServiceImplementation(self, func, file): 3223 def WriteServiceImplementation(self, func, file):
3196 """Overrriden from TypeHandler.""" 3224 """Overrriden from TypeHandler."""
3197 pass 3225 pass
3198 3226
3199 def WriteGLES2ImplementationHeader(self, func, file): 3227 def WriteGLES2Implementation(self, func, file):
3200 """Overrriden from TypeHandler.""" 3228 """Overrriden from TypeHandler."""
3201 file.Write("%s %s(%s) {\n" % 3229 file.Write("%s GLES2Implementation::%s(%s) {\n" %
3202 (func.return_type, func.original_name, 3230 (func.return_type, func.original_name,
3203 func.MakeTypedOriginalArgString(""))) 3231 func.MakeTypedOriginalArgString("")))
3204 file.Write(" GPU_CLIENT_SINGLE_THREAD_CHECK();\n") 3232 file.Write(" GPU_CLIENT_SINGLE_THREAD_CHECK();\n")
3205 func.WriteDestinationInitalizationValidation(file) 3233 func.WriteDestinationInitalizationValidation(file)
3206 self.WriteClientGLCallLog(func, file) 3234 self.WriteClientGLCallLog(func, file)
3207 for arg in func.GetOriginalArgs(): 3235 for arg in func.GetOriginalArgs():
3208 arg.WriteClientSideValidationCode(file, func) 3236 arg.WriteClientSideValidationCode(file, func)
3209 file.Write( 3237 file.Write(
3210 " GPU_CLIENT_DCHECK(%s != 0);\n" % func.GetOriginalArgs()[-1].name) 3238 " GPU_CLIENT_DCHECK(%s != 0);\n" % func.GetOriginalArgs()[-1].name)
3211 file.Write(" %sHelper(%s);\n" % 3239 file.Write(" %sHelper(%s);\n" %
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
3321 def WriteHandlerImplementation (self, func, file): 3349 def WriteHandlerImplementation (self, func, file):
3322 """Overrriden from TypeHandler.""" 3350 """Overrriden from TypeHandler."""
3323 file.Write(" %sHelper(n, %s);\n" % 3351 file.Write(" %sHelper(n, %s);\n" %
3324 (func.name, func.GetLastOriginalArg().name)) 3352 (func.name, func.GetLastOriginalArg().name))
3325 3353
3326 def WriteImmediateHandlerImplementation (self, func, file): 3354 def WriteImmediateHandlerImplementation (self, func, file):
3327 """Overrriden from TypeHandler.""" 3355 """Overrriden from TypeHandler."""
3328 file.Write(" %sHelper(n, %s);\n" % 3356 file.Write(" %sHelper(n, %s);\n" %
3329 (func.original_name, func.GetLastOriginalArg().name)) 3357 (func.original_name, func.GetLastOriginalArg().name))
3330 3358
3331 def WriteGLES2ImplementationHeader(self, func, file): 3359 def WriteGLES2Implementation(self, func, file):
3332 """Overrriden from TypeHandler.""" 3360 """Overrriden from TypeHandler."""
3333 impl_decl = func.GetInfo('impl_decl') 3361 impl_decl = func.GetInfo('impl_decl')
3334 if impl_decl == None or impl_decl == True: 3362 if impl_decl == None or impl_decl == True:
3335 args = { 3363 args = {
3336 'return_type': func.return_type, 3364 'return_type': func.return_type,
3337 'name': func.original_name, 3365 'name': func.original_name,
3338 'typed_args': func.MakeTypedOriginalArgString(""), 3366 'typed_args': func.MakeTypedOriginalArgString(""),
3339 'args': func.MakeOriginalArgString(""), 3367 'args': func.MakeOriginalArgString(""),
3340 'resource_type': func.GetInfo('resource_type').lower(), 3368 'resource_type': func.GetInfo('resource_type').lower(),
3341 'count_name': func.GetOriginalArgs()[0].name, 3369 'count_name': func.GetOriginalArgs()[0].name,
3342 } 3370 }
3343 file.Write("%(return_type)s %(name)s(%(typed_args)s) {\n" % args) 3371 file.Write(
3372 "%(return_type)s GLES2Implementation::%(name)s(%(typed_args)s) {\n" %
3373 args)
3344 file.Write(" GPU_CLIENT_SINGLE_THREAD_CHECK();\n") 3374 file.Write(" GPU_CLIENT_SINGLE_THREAD_CHECK();\n")
3345 func.WriteDestinationInitalizationValidation(file) 3375 func.WriteDestinationInitalizationValidation(file)
3346 self.WriteClientGLCallLog(func, file) 3376 self.WriteClientGLCallLog(func, file)
3347 file.Write(""" GPU_CLIENT_LOG_CODE_BLOCK({ 3377 file.Write(""" GPU_CLIENT_LOG_CODE_BLOCK({
3348 for (GLsizei i = 0; i < n; ++i) { 3378 for (GLsizei i = 0; i < n; ++i) {
3349 GPU_CLIENT_LOG(" " << i << ": " << %s[i]); 3379 GPU_CLIENT_LOG(" " << i << ": " << %s[i]);
3350 } 3380 }
3351 }); 3381 });
3352 """ % func.GetOriginalArgs()[1].name) 3382 """ % func.GetOriginalArgs()[1].name)
3353 file.Write(""" GPU_CLIENT_DCHECK_CODE_BLOCK({ 3383 file.Write(""" GPU_CLIENT_DCHECK_CODE_BLOCK({
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
3500 result->SetNumResults(num_values); 3530 result->SetNumResults(num_values);
3501 } else { 3531 } else {
3502 SetGLError(error, "", ""); 3532 SetGLError(error, "", "");
3503 } 3533 }
3504 return error::kNoError; 3534 return error::kNoError;
3505 } 3535 }
3506 3536
3507 """ 3537 """
3508 file.Write(code) 3538 file.Write(code)
3509 3539
3510 def WriteGLES2ImplementationHeader(self, func, file): 3540 def WriteGLES2Implementation(self, func, file):
3511 """Overrriden from TypeHandler.""" 3541 """Overrriden from TypeHandler."""
3512 impl_decl = func.GetInfo('impl_decl') 3542 impl_decl = func.GetInfo('impl_decl')
3513 if impl_decl == None or impl_decl == True: 3543 if impl_decl == None or impl_decl == True:
3514 file.Write("%s %s(%s) {\n" % 3544 file.Write("%s GLES2Implementation::%s(%s) {\n" %
3515 (func.return_type, func.original_name, 3545 (func.return_type, func.original_name,
3516 func.MakeTypedOriginalArgString(""))) 3546 func.MakeTypedOriginalArgString("")))
3517 file.Write(" GPU_CLIENT_SINGLE_THREAD_CHECK();\n") 3547 file.Write(" GPU_CLIENT_SINGLE_THREAD_CHECK();\n")
3518 func.WriteDestinationInitalizationValidation(file) 3548 func.WriteDestinationInitalizationValidation(file)
3519 self.WriteClientGLCallLog(func, file) 3549 self.WriteClientGLCallLog(func, file)
3520 for arg in func.GetOriginalArgs(): 3550 for arg in func.GetOriginalArgs():
3521 arg.WriteClientSideValidationCode(file, func) 3551 arg.WriteClientSideValidationCode(file, func)
3522 all_but_last_args = func.GetOriginalArgs()[:-1] 3552 all_but_last_args = func.GetOriginalArgs()[:-1]
3523 arg_string = ( 3553 arg_string = (
3524 ", ".join(["%s" % arg.name for arg in all_but_last_args])) 3554 ", ".join(["%s" % arg.name for arg in all_but_last_args]))
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
3734 if (!ComputeDataSize(1, sizeof(%s), %d, &data_size)) { 3764 if (!ComputeDataSize(1, sizeof(%s), %d, &data_size)) {
3735 return error::kOutOfBounds; 3765 return error::kOutOfBounds;
3736 } 3766 }
3737 """ 3767 """
3738 file.Write(code % (func.info.data_type, func.info.count)) 3768 file.Write(code % (func.info.data_type, func.info.count))
3739 if func.is_immediate: 3769 if func.is_immediate:
3740 file.Write(" if (data_size > immediate_data_size) {\n") 3770 file.Write(" if (data_size > immediate_data_size) {\n")
3741 file.Write(" return error::kOutOfBounds;\n") 3771 file.Write(" return error::kOutOfBounds;\n")
3742 file.Write(" }\n") 3772 file.Write(" }\n")
3743 3773
3744 def WriteGLES2ImplementationHeader(self, func, file): 3774 def WriteGLES2Implementation(self, func, file):
3745 """Overrriden from TypeHandler.""" 3775 """Overrriden from TypeHandler."""
3746 file.Write("%s %s(%s) {\n" % 3776 file.Write("%s GLES2Implementation::%s(%s) {\n" %
3747 (func.return_type, func.original_name, 3777 (func.return_type, func.original_name,
3748 func.MakeTypedOriginalArgString(""))) 3778 func.MakeTypedOriginalArgString("")))
3749 file.Write(" GPU_CLIENT_SINGLE_THREAD_CHECK();\n") 3779 file.Write(" GPU_CLIENT_SINGLE_THREAD_CHECK();\n")
3750 func.WriteDestinationInitalizationValidation(file) 3780 func.WriteDestinationInitalizationValidation(file)
3751 self.WriteClientGLCallLog(func, file) 3781 self.WriteClientGLCallLog(func, file)
3752 last_arg_name = func.GetLastOriginalArg().name 3782 last_arg_name = func.GetLastOriginalArg().name
3753 values_str = ' << ", " << '.join( 3783 values_str = ' << ", " << '.join(
3754 ["%s[%d]" % (last_arg_name, ndx) for ndx in range(0, func.info.count)]) 3784 ["%s[%d]" % (last_arg_name, ndx) for ndx in range(0, func.info.count)])
3755 file.Write(' GPU_CLIENT_LOG("values: " << %s);\n' % values_str) 3785 file.Write(' GPU_CLIENT_LOG("values: " << %s);\n' % values_str)
3756 for arg in func.GetOriginalArgs(): 3786 for arg in func.GetOriginalArgs():
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
4003 if (!ComputeDataSize(count, sizeof(%s), %d, &data_size)) { 4033 if (!ComputeDataSize(count, sizeof(%s), %d, &data_size)) {
4004 return error::kOutOfBounds; 4034 return error::kOutOfBounds;
4005 } 4035 }
4006 """ 4036 """
4007 file.Write(code % (func.info.data_type, func.info.count)) 4037 file.Write(code % (func.info.data_type, func.info.count))
4008 if func.is_immediate: 4038 if func.is_immediate:
4009 file.Write(" if (data_size > immediate_data_size) {\n") 4039 file.Write(" if (data_size > immediate_data_size) {\n")
4010 file.Write(" return error::kOutOfBounds;\n") 4040 file.Write(" return error::kOutOfBounds;\n")
4011 file.Write(" }\n") 4041 file.Write(" }\n")
4012 4042
4013 def WriteGLES2ImplementationHeader(self, func, file): 4043 def WriteGLES2Implementation(self, func, file):
4014 """Overrriden from TypeHandler.""" 4044 """Overrriden from TypeHandler."""
4015 file.Write("%s %s(%s) {\n" % 4045 file.Write("%s GLES2Implementation::%s(%s) {\n" %
4016 (func.return_type, func.original_name, 4046 (func.return_type, func.original_name,
4017 func.MakeTypedOriginalArgString(""))) 4047 func.MakeTypedOriginalArgString("")))
4018 file.Write(" GPU_CLIENT_SINGLE_THREAD_CHECK();\n") 4048 file.Write(" GPU_CLIENT_SINGLE_THREAD_CHECK();\n")
4019 func.WriteDestinationInitalizationValidation(file) 4049 func.WriteDestinationInitalizationValidation(file)
4020 self.WriteClientGLCallLog(func, file) 4050 self.WriteClientGLCallLog(func, file)
4021 last_arg_name = func.GetLastOriginalArg().name 4051 last_arg_name = func.GetLastOriginalArg().name
4022 file.Write(""" GPU_CLIENT_LOG_CODE_BLOCK({ 4052 file.Write(""" GPU_CLIENT_LOG_CODE_BLOCK({
4023 for (GLsizei i = 0; i < count; ++i) { 4053 for (GLsizei i = 0; i < count; ++i) {
4024 """) 4054 """)
4025 values_str = ' << ", " << '.join( 4055 values_str = ' << ", " << '.join(
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
4486 } 4516 }
4487 """ 4517 """
4488 file.Write(code % {'func_name': func.name}) 4518 file.Write(code % {'func_name': func.name})
4489 func.WriteHandlerValidation(file) 4519 func.WriteHandlerValidation(file)
4490 file.Write(" *result_dst = %s(%s);\n" % 4520 file.Write(" *result_dst = %s(%s);\n" %
4491 (func.GetGLFunctionName(), func.MakeOriginalArgString(""))) 4521 (func.GetGLFunctionName(), func.MakeOriginalArgString("")))
4492 file.Write(" return error::kNoError;\n") 4522 file.Write(" return error::kNoError;\n")
4493 file.Write("}\n") 4523 file.Write("}\n")
4494 file.Write("\n") 4524 file.Write("\n")
4495 4525
4496 def WriteGLES2ImplementationHeader(self, func, file): 4526 def WriteGLES2Implementation(self, func, file):
4497 """Overrriden from TypeHandler.""" 4527 """Overrriden from TypeHandler."""
4498 impl_func = func.GetInfo('impl_func') 4528 impl_func = func.GetInfo('impl_func')
4499 if impl_func == None or impl_func == True: 4529 if impl_func == None or impl_func == True:
4500 error_value = func.GetInfo("error_value") or "GL_FALSE" 4530 error_value = func.GetInfo("error_value") or "GL_FALSE"
4501 file.Write("%s %s(%s) {\n" % 4531 file.Write("%s GLES2Implementation::%s(%s) {\n" %
4502 (func.return_type, func.original_name, 4532 (func.return_type, func.original_name,
4503 func.MakeTypedOriginalArgString(""))) 4533 func.MakeTypedOriginalArgString("")))
4504 file.Write(" GPU_CLIENT_SINGLE_THREAD_CHECK();\n") 4534 file.Write(" GPU_CLIENT_SINGLE_THREAD_CHECK();\n")
4505 func.WriteDestinationInitalizationValidation(file) 4535 func.WriteDestinationInitalizationValidation(file)
4506 self.WriteClientGLCallLog(func, file) 4536 self.WriteClientGLCallLog(func, file)
4507 file.Write(" typedef %s::Result Result;\n" % func.name) 4537 file.Write(" typedef %s::Result Result;\n" % func.name)
4508 file.Write(" Result* result = GetResultAs<Result*>();\n") 4538 file.Write(" Result* result = GetResultAs<Result*>();\n")
4509 file.Write(" if (!result) {\n") 4539 file.Write(" if (!result) {\n")
4510 file.Write(" return %s;\n" % error_value) 4540 file.Write(" return %s;\n" % error_value)
4511 file.Write(" }\n") 4541 file.Write(" }\n")
4512 file.Write(" *result = 0;\n") 4542 file.Write(" *result = 0;\n")
4513 arg_string = func.MakeOriginalArgString("") 4543 arg_string = func.MakeOriginalArgString("")
4514 comma = "" 4544 comma = ""
4515 if len(arg_string) > 0: 4545 if len(arg_string) > 0:
4516 comma = ", " 4546 comma = ", "
4517 file.Write( 4547 file.Write(
4518 " helper_->%s(%s%sGetResultShmId(), GetResultShmOffset());\n" % 4548 " helper_->%s(%s%sGetResultShmId(), GetResultShmOffset());\n" %
4519 (func.name, arg_string, comma)) 4549 (func.name, arg_string, comma))
4520 file.Write(" WaitForCmd();\n") 4550 file.Write(" WaitForCmd();\n")
4521 file.Write(' GPU_CLIENT_LOG("returned " << *result);\n') 4551 file.Write(' GPU_CLIENT_LOG("returned " << *result);\n')
4522 file.Write(" return *result;\n") 4552 file.Write(" return *result;\n")
4523 file.Write("}\n") 4553 file.Write("}\n")
4524 file.Write("\n") 4554 file.Write("\n")
4525 else:
4526 self.WriteGLES2ImplementationDeclaration(func, file)
4527 4555
4528 def WriteGLES2ImplementationUnitTest(self, func, file): 4556 def WriteGLES2ImplementationUnitTest(self, func, file):
4529 """Overrriden from TypeHandler.""" 4557 """Overrriden from TypeHandler."""
4530 client_test = func.GetInfo('client_test') 4558 client_test = func.GetInfo('client_test')
4531 if client_test == None or client_test == True: 4559 if client_test == None or client_test == True:
4532 code = """ 4560 code = """
4533 TEST_F(GLES2ImplementationTest, %(name)s) { 4561 TEST_F(GLES2ImplementationTest, %(name)s) {
4534 struct Cmds { 4562 struct Cmds {
4535 %(name)s cmd; 4563 %(name)s cmd;
4536 }; 4564 };
(...skipping 27 matching lines...) Expand all
4564 4592
4565 def InitFunction(self, func): 4593 def InitFunction(self, func):
4566 """Overrriden from TypeHandler.""" 4594 """Overrriden from TypeHandler."""
4567 # remove all but the first cmd args. 4595 # remove all but the first cmd args.
4568 cmd_args = func.GetCmdArgs() 4596 cmd_args = func.GetCmdArgs()
4569 func.ClearCmdArgs() 4597 func.ClearCmdArgs()
4570 func.AddCmdArg(cmd_args[0]) 4598 func.AddCmdArg(cmd_args[0])
4571 # add on a bucket id. 4599 # add on a bucket id.
4572 func.AddCmdArg(Argument('bucket_id', 'uint32')) 4600 func.AddCmdArg(Argument('bucket_id', 'uint32'))
4573 4601
4574 def WriteGLES2ImplementationHeader(self, func, file): 4602 def WriteGLES2Implementation(self, func, file):
4575 """Overrriden from TypeHandler.""" 4603 """Overrriden from TypeHandler."""
4576 code_1 = """%(return_type)s %(func_name)s(%(args)s) { 4604 code_1 = """%(return_type)s GLES2Implementation::%(func_name)s(%(args)s) {
4577 GPU_CLIENT_SINGLE_THREAD_CHECK(); 4605 GPU_CLIENT_SINGLE_THREAD_CHECK();
4578 """ 4606 """
4579 code_2 = """ GPU_CLIENT_LOG("[" << GetLogPrefix() 4607 code_2 = """ GPU_CLIENT_LOG("[" << GetLogPrefix()
4580 << "] gl%(func_name)s" << "(" 4608 << "] gl%(func_name)s" << "("
4581 << %(arg0)s << ", " 4609 << %(arg0)s << ", "
4582 << %(arg1)s << ", " 4610 << %(arg1)s << ", "
4583 << static_cast<void*>(%(arg2)s) << ", " 4611 << static_cast<void*>(%(arg2)s) << ", "
4584 << static_cast<void*>(%(arg3)s) << ")"); 4612 << static_cast<void*>(%(arg3)s) << ")");
4585 helper_->SetBucketSize(kResultBucketId, 0); 4613 helper_->SetBucketSize(kResultBucketId, 0);
4586 helper_->%(func_name)s(%(id_name)s, kResultBucketId); 4614 helper_->%(func_name)s(%(id_name)s, kResultBucketId);
(...skipping 911 matching lines...) Expand 10 before | Expand all | Expand 10 after
5498 self.type_handler.WriteServiceImplementation(self, file) 5526 self.type_handler.WriteServiceImplementation(self, file)
5499 5527
5500 def WriteServiceUnitTest(self, file): 5528 def WriteServiceUnitTest(self, file):
5501 """Writes the service implementation for a command.""" 5529 """Writes the service implementation for a command."""
5502 self.type_handler.WriteServiceUnitTest(self, file) 5530 self.type_handler.WriteServiceUnitTest(self, file)
5503 5531
5504 def WriteGLES2CLibImplementation(self, file): 5532 def WriteGLES2CLibImplementation(self, file):
5505 """Writes the GLES2 C Lib Implemention.""" 5533 """Writes the GLES2 C Lib Implemention."""
5506 self.type_handler.WriteGLES2CLibImplementation(self, file) 5534 self.type_handler.WriteGLES2CLibImplementation(self, file)
5507 5535
5536 def WriteGLES2InterfaceHeader(self, file):
5537 """Writes the GLES2 Interface declaration."""
5538 self.type_handler.WriteGLES2InterfaceHeader(self, file)
5539
5540 def WriteGLES2InterfaceStub(self, file):
5541 """Writes the GLES2 Interface Stub declaration."""
5542 self.type_handler.WriteGLES2InterfaceStub(self, file)
5543
5544 def WriteGLES2InterfaceStubImpl(self, file):
5545 """Writes the GLES2 Interface Stub declaration."""
5546 self.type_handler.WriteGLES2InterfaceStubImpl(self, file)
5547
5508 def WriteGLES2ImplementationHeader(self, file): 5548 def WriteGLES2ImplementationHeader(self, file):
5509 """Writes the GLES2 Implemention declaration.""" 5549 """Writes the GLES2 Implemention declaration."""
5510 self.type_handler.WriteGLES2ImplementationHeader(self, file) 5550 self.type_handler.WriteGLES2ImplementationHeader(self, file)
5511 5551
5552 def WriteGLES2Implementation(self, file):
5553 """Writes the GLES2 Implemention definition."""
5554 self.type_handler.WriteGLES2Implementation(self, file)
5555
5512 def WriteGLES2ImplementationUnitTest(self, file): 5556 def WriteGLES2ImplementationUnitTest(self, file):
5513 """Writes the GLES2 Implemention unit test.""" 5557 """Writes the GLES2 Implemention unit test."""
5514 self.type_handler.WriteGLES2ImplementationUnitTest(self, file) 5558 self.type_handler.WriteGLES2ImplementationUnitTest(self, file)
5515 5559
5516 def WriteDestinationInitalizationValidation(self, file): 5560 def WriteDestinationInitalizationValidation(self, file):
5517 """Writes the client side destintion initialization validation.""" 5561 """Writes the client side destintion initialization validation."""
5518 self.type_handler.WriteDestinationInitalizationValidation(self, file) 5562 self.type_handler.WriteDestinationInitalizationValidation(self, file)
5519 5563
5520 def WriteFormatTest(self, file): 5564 def WriteFormatTest(self, file):
5521 """Writes the cmd's format test.""" 5565 """Writes the cmd's format test."""
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
6016 file = CHeaderWriter( 6060 file = CHeaderWriter(
6017 filename, 6061 filename,
6018 "// These functions emulate GLES2 over command buffers.\n") 6062 "// These functions emulate GLES2 over command buffers.\n")
6019 6063
6020 for func in self.original_functions: 6064 for func in self.original_functions:
6021 func.WriteGLES2CLibImplementation(file) 6065 func.WriteGLES2CLibImplementation(file)
6022 file.Write("\n") 6066 file.Write("\n")
6023 6067
6024 file.Close() 6068 file.Close()
6025 6069
6070 def WriteGLES2InterfaceHeader(self, filename):
6071 """Writes the GLES2 interface header."""
6072 file = CHeaderWriter(
6073 filename,
6074 "// This file is included by gles2_interface.h to declare the\n"
6075 "// GL api functions.\n")
6076 for func in self.original_functions:
6077 func.WriteGLES2InterfaceHeader(file)
6078 file.Close()
6079
6080 def WriteGLES2InterfaceStub(self, filename):
6081 """Writes the GLES2 interface stub header."""
6082 file = CHeaderWriter(
6083 filename,
6084 "// This file is included by gles2_interface_stub.h.\n")
6085 for func in self.original_functions:
6086 func.WriteGLES2InterfaceStub(file)
6087 file.Close()
6088
6089 def WriteGLES2InterfaceStubImpl(self, filename):
6090 """Writes the GLES2 interface header."""
6091 file = CHeaderWriter(
6092 filename,
6093 "// This file is included by gles2_interface_stub.cc.\n")
6094 for func in self.original_functions:
6095 func.WriteGLES2InterfaceStubImpl(file)
6096 file.Close()
6097
6026 def WriteGLES2ImplementationHeader(self, filename): 6098 def WriteGLES2ImplementationHeader(self, filename):
6027 """Writes the GLES2 helper header.""" 6099 """Writes the GLES2 Implementation header."""
6028 file = CHeaderWriter( 6100 file = CHeaderWriter(
6029 filename, 6101 filename,
6030 "// This file is included by gles2_implementation.h to declare the\n" 6102 "// This file is included by gles2_implementation.h to declare the\n"
6031 "// GL api functions.\n") 6103 "// GL api functions.\n")
6032 for func in self.original_functions: 6104 for func in self.original_functions:
6033 func.WriteGLES2ImplementationHeader(file) 6105 func.WriteGLES2ImplementationHeader(file)
6034 file.Close() 6106 file.Close()
6035 6107
6108 def WriteGLES2Implementation(self, filename):
6109 """Writes the GLES2 Implementation."""
6110 file = CHeaderWriter(
6111 filename,
6112 "// This file is included by gles2_implementation.cc to define the\n"
6113 "// GL api functions.\n")
6114 for func in self.original_functions:
6115 func.WriteGLES2Implementation(file)
6116 file.Close()
6117
6036 def WriteGLES2ImplementationUnitTests(self, filename): 6118 def WriteGLES2ImplementationUnitTests(self, filename):
6037 """Writes the GLES2 helper header.""" 6119 """Writes the GLES2 helper header."""
6038 file = CHeaderWriter( 6120 file = CHeaderWriter(
6039 filename, 6121 filename,
6040 "// This file is included by gles2_implementation.h to declare the\n" 6122 "// This file is included by gles2_implementation.h to declare the\n"
6041 "// GL api functions.\n") 6123 "// GL api functions.\n")
6042 for func in self.original_functions: 6124 for func in self.original_functions:
6043 func.WriteGLES2ImplementationUnitTest(file) 6125 func.WriteGLES2ImplementationUnitTest(file)
6044 file.Close() 6126 file.Close()
6045 6127
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
6400 elif options.alternate_mode == "nacl_ppapi": 6482 elif options.alternate_mode == "nacl_ppapi":
6401 os.chdir("ppapi") 6483 os.chdir("ppapi")
6402 gen.WritePepperGLES2NaClProxy( 6484 gen.WritePepperGLES2NaClProxy(
6403 "native_client/src/shared/ppapi_proxy/plugin_opengles.cc") 6485 "native_client/src/shared/ppapi_proxy/plugin_opengles.cc")
6404 6486
6405 else: 6487 else:
6406 os.chdir("gpu/command_buffer") 6488 os.chdir("gpu/command_buffer")
6407 gen.WriteCommandIds("common/gles2_cmd_ids_autogen.h") 6489 gen.WriteCommandIds("common/gles2_cmd_ids_autogen.h")
6408 gen.WriteFormat("common/gles2_cmd_format_autogen.h") 6490 gen.WriteFormat("common/gles2_cmd_format_autogen.h")
6409 gen.WriteFormatTest("common/gles2_cmd_format_test_autogen.h") 6491 gen.WriteFormatTest("common/gles2_cmd_format_test_autogen.h")
6492 gen.WriteGLES2InterfaceHeader("client/gles2_interface_autogen.h")
6493 gen.WriteGLES2InterfaceStub("client/gles2_interface_stub_autogen.h")
6494 gen.WriteGLES2InterfaceStubImpl(
6495 "client/gles2_interface_stub_impl_autogen.h")
6410 gen.WriteGLES2ImplementationHeader("client/gles2_implementation_autogen.h") 6496 gen.WriteGLES2ImplementationHeader("client/gles2_implementation_autogen.h")
6497 gen.WriteGLES2Implementation("client/gles2_implementation_impl_autogen.h")
6411 gen.WriteGLES2ImplementationUnitTests( 6498 gen.WriteGLES2ImplementationUnitTests(
6412 "client/gles2_implementation_unittest_autogen.h") 6499 "client/gles2_implementation_unittest_autogen.h")
6413 gen.WriteGLES2CLibImplementation("client/gles2_c_lib_autogen.h") 6500 gen.WriteGLES2CLibImplementation("client/gles2_c_lib_autogen.h")
6414 gen.WriteCmdHelperHeader("client/gles2_cmd_helper_autogen.h") 6501 gen.WriteCmdHelperHeader("client/gles2_cmd_helper_autogen.h")
6415 gen.WriteServiceImplementation("service/gles2_cmd_decoder_autogen.h") 6502 gen.WriteServiceImplementation("service/gles2_cmd_decoder_autogen.h")
6416 gen.WriteServiceUnitTests("service/gles2_cmd_decoder_unittest_%d_autogen.h") 6503 gen.WriteServiceUnitTests("service/gles2_cmd_decoder_unittest_%d_autogen.h")
6417 gen.WriteServiceUtilsHeader("service/gles2_cmd_validation_autogen.h") 6504 gen.WriteServiceUtilsHeader("service/gles2_cmd_validation_autogen.h")
6418 gen.WriteServiceUtilsImplementation( 6505 gen.WriteServiceUtilsImplementation(
6419 "service/gles2_cmd_validation_implementation_autogen.h") 6506 "service/gles2_cmd_validation_implementation_autogen.h")
6420 gen.WriteCommonUtilsHeader("common/gles2_cmd_utils_autogen.h") 6507 gen.WriteCommonUtilsHeader("common/gles2_cmd_utils_autogen.h")
6421 gen.WriteCommonUtilsImpl("common/gles2_cmd_utils_implementation_autogen.h") 6508 gen.WriteCommonUtilsImpl("common/gles2_cmd_utils_implementation_autogen.h")
6422 6509
6423 if gen.errors > 0: 6510 if gen.errors > 0:
6424 print "%d errors" % gen.errors 6511 print "%d errors" % gen.errors
6425 return 1 6512 return 1
6426 return 0 6513 return 0
6427 6514
6428 6515
6429 if __name__ == '__main__': 6516 if __name__ == '__main__':
6430 sys.exit(main(sys.argv[1:])) 6517 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « no previous file | gpu/command_buffer/client/gles2_implementation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698