Fix RPDesc::occlusionQuerySet not defaulting to nullptr

The default value for optional object structure members wasn't set
correctly for C++ structures.

Bug: dawn:22
Change-Id: I09e7f3675f6e0b5990ddcf03601b3b91cd25f553
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/31200
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Shaobo Yan <shaobo.yan@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Corentin Wallez 2020-10-29 13:09:12 +00:00 committed by Commit Bot service account
parent dbc916c6f6
commit b0789fde61
3 changed files with 5 additions and 1 deletions

View File

@ -644,7 +644,7 @@
"name": "create swap chain",
"returns": "swap chain",
"args": [
{"name": "surface", "type": "surface", "optional": "true"},
{"name": "surface", "type": "surface"},
{"name": "descriptor", "type": "swap chain descriptor", "annotation": "const*"}
]
},

View File

@ -23,6 +23,8 @@ namespace dawn_native {
{% macro render_cpp_default_value(member) -%}
{%- if member.annotation in ["*", "const*", "const*const*"] and member.optional -%}
{{" "}}= nullptr
{%- elif member.type.category == "object" and member.optional -%}
{{" "}}= nullptr
{%- elif member.type.category in ["enum", "bitmask"] and member.default_value != None -%}
{{" "}}= wgpu::{{as_cppType(member.type.name)}}::{{as_cppEnum(Name(member.default_value))}}
{%- elif member.type.category == "native" and member.default_value != None -%}

View File

@ -143,6 +143,8 @@ namespace wgpu {
{% macro render_cpp_default_value(member) -%}
{%- if member.annotation in ["*", "const*", "const*const*"] and member.optional -%}
{{" "}}= nullptr
{%- elif member.type.category == "object" and member.optional -%}
{{" "}}= nullptr
{%- elif member.type.category in ["enum", "bitmask"] and member.default_value != None -%}
{{" "}}= {{as_cppType(member.type.name)}}::{{as_cppEnum(Name(member.default_value))}}
{%- elif member.type.category == "native" and member.default_value != None -%}