1 // Copyright 2021 The Dawn Authors 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 #include <dawn/{{metadata.api.lower()}}.h> 16 17 namespace dawn_native { 18 19 // This file should be kept in sync with generator/templates/dawn_native/ProcTable.cpp 20 21 {% for function in by_category["function"] %} 22 extern {{as_cType(function.return_type.name)}} Native{{as_cppType(function.name)}}( 23 {%- for arg in function.arguments -%} 24 {% if not loop.first %}, {% endif %}{{as_annotated_cType(arg)}} 25 {%- endfor -%} 26 ); 27 {% endfor %} 28 {% for type in by_category["object"] %} 29 {% for method in c_methods(type) %} 30 extern {{as_cType(method.return_type.name)}} Native{{as_MethodSuffix(type.name, method.name)}}( 31 {{-as_cType(type.name)}} cSelf 32 {%- for arg in method.arguments -%} 33 , {{as_annotated_cType(arg)}} 34 {%- endfor -%} 35 ); 36 {% endfor %} 37 {% endfor %} 38 39 } 40 41 extern "C" { 42 using namespace dawn_native; 43 44 {% for function in by_category["function"] %} 45 {{as_cType(function.return_type.name)}} {{metadata.namespace}}{{as_cppType(function.name)}} ( 46 {%- for arg in function.arguments -%} 47 {% if not loop.first %}, {% endif %}{{as_annotated_cType(arg)}} 48 {%- endfor -%} 49 ) { 50 return Native{{as_cppType(function.name)}}( 51 {%- for arg in function.arguments -%} 52 {% if not loop.first %}, {% endif %}{{as_varName(arg.name)}} 53 {%- endfor -%} 54 ); 55 } 56 {% endfor %} 57 58 {% for type in by_category["object"] %} 59 {% for method in c_methods(type) %} 60 {{as_cType(method.return_type.name)}} {{metadata.namespace}}{{as_MethodSuffix(type.name, method.name)}}( 61 {{-as_cType(type.name)}} cSelf 62 {%- for arg in method.arguments -%} 63 , {{as_annotated_cType(arg)}} 64 {%- endfor -%} 65 ) { 66 return Native{{as_MethodSuffix(type.name, method.name)}}( 67 cSelf 68 {%- for arg in method.arguments -%} 69 , {{as_varName(arg.name)}} 70 {%- endfor -%} 71 ); 72 } 73 {% endfor %} 74 {% endfor %} 75 } 76