Add nullable annotations to webgpu.h

Bug: dawn:22
Change-Id: Ie14072e91bab3b69b8d98f15bcbdeaa6679ffcd7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/91240
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
Corentin Wallez 2022-05-23 15:44:29 +00:00 committed by Dawn LUCI CQ
parent cc2efbcdbf
commit 74771202c7
2 changed files with 13 additions and 0 deletions

View File

@ -1065,12 +1065,22 @@
}, },
{ {
"name": "create swap chain", "name": "create swap chain",
"tags": ["dawn"],
"returns": "swap chain", "returns": "swap chain",
"args": [ "args": [
{"name": "surface", "type": "surface", "optional": true}, {"name": "surface", "type": "surface", "optional": true},
{"name": "descriptor", "type": "swap chain descriptor", "annotation": "const*"} {"name": "descriptor", "type": "swap chain descriptor", "annotation": "const*"}
] ]
}, },
{
"name": "create swap chain",
"tags": ["upstream", "emscripten"],
"returns": "swap chain",
"args": [
{"name": "surface", "type": "surface"},
{"name": "descriptor", "type": "swap chain descriptor", "annotation": "const*"}
]
},
{ {
"name": "create texture", "name": "create texture",
"returns": "texture", "returns": "texture",

View File

@ -100,6 +100,7 @@ typedef struct {{c_prefix}}ChainedStructOut {
{% endif %} {% endif %}
{% for member in type.members %} {% for member in type.members %}
{{as_annotated_cType(member)}}; {{as_annotated_cType(member)}};
{%- if member.optional %} // nullable{% endif %}{{""}}
{% endfor %} {% endfor %}
} {{as_cType(type.name)}}; } {{as_cType(type.name)}};
@ -143,6 +144,7 @@ extern "C" {
{{-as_cType(type.name)}} {{as_varName(type.name)}} {{-as_cType(type.name)}} {{as_varName(type.name)}}
{%- for arg in method.arguments -%} {%- for arg in method.arguments -%}
, {{as_annotated_cType(arg)}} , {{as_annotated_cType(arg)}}
{%- if arg.optional %} /* nullable */{% endif %}
{%- endfor -%} {%- endfor -%}
); );
{% endfor %} {% endfor %}
@ -167,6 +169,7 @@ extern "C" {
{{-as_cType(type.name)}} {{as_varName(type.name)}} {{-as_cType(type.name)}} {{as_varName(type.name)}}
{%- for arg in method.arguments -%} {%- for arg in method.arguments -%}
, {{as_annotated_cType(arg)}} , {{as_annotated_cType(arg)}}
{%- if arg.optional %} /* nullable */{% endif %}
{%- endfor -%} {%- endfor -%}
); );
{% endfor %} {% endfor %}