mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-16 16:37:08 +00:00
WireCmd: require opt-in to treat ID 0 as nullptr instead of error.
In preparation for the descriptorization of BindGroup, support was added to treat wire ID 0 as nullptr for a bunch of objects. Now that we have a fuzzer for the wire+frontend, we need to validate when we have a 0 id. Either the wire needs to reject the ID or the frontend needs to validate against nullptrs. Since only few entrypoints will have a use for nullptrs (bind groups, render pass resolve textures), we require an opt-in in the JSON file for a structure member or an argument to be optional. This disables the tests related to ID 0 = nullptr, because we don't yet have optional argument/members in dawn.json. BUG=chromium:905273 BUG=chromium:906418 BUG=chromium:908678 Change-Id: If9a3c4857db43ca26a90abff2437e1cebb0ab79b Reviewed-on: https://dawn-review.googlesource.com/c/2704 Reviewed-by: Kai Ninomiya <kainino@chromium.org> Reviewed-by: Stephen White <senorblanco@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
32abaffa73
commit
d8c1a48fc4
@@ -79,11 +79,12 @@ class NativelyDefined(Type):
|
||||
Type.__init__(self, name, record)
|
||||
|
||||
class MethodArgument:
|
||||
def __init__(self, name, typ, annotation):
|
||||
def __init__(self, name, typ, annotation, optional):
|
||||
self.name = name
|
||||
self.type = typ
|
||||
self.annotation = annotation
|
||||
self.length = None
|
||||
self.optional = optional
|
||||
|
||||
Method = namedtuple('Method', ['name', 'return_type', 'arguments'])
|
||||
class ObjectType(Type):
|
||||
@@ -94,11 +95,12 @@ class ObjectType(Type):
|
||||
self.built_type = None
|
||||
|
||||
class StructureMember:
|
||||
def __init__(self, name, typ, annotation):
|
||||
def __init__(self, name, typ, annotation, optional):
|
||||
self.name = name
|
||||
self.type = typ
|
||||
self.annotation = annotation
|
||||
self.length = None
|
||||
self.optional = optional
|
||||
|
||||
class StructureType(Type):
|
||||
def __init__(self, name, record):
|
||||
@@ -120,7 +122,8 @@ def link_object(obj, types):
|
||||
arguments = []
|
||||
arguments_by_name = {}
|
||||
for a in record.get('args', []):
|
||||
arg = MethodArgument(Name(a['name']), types[a['type']], a.get('annotation', 'value'))
|
||||
arg = MethodArgument(Name(a['name']), types[a['type']],
|
||||
a.get('annotation', 'value'), a.get('optional', False))
|
||||
arguments.append(arg)
|
||||
arguments_by_name[arg.name.canonical_case()] = arg
|
||||
|
||||
@@ -153,7 +156,8 @@ def link_object(obj, types):
|
||||
|
||||
def link_structure(struct, types):
|
||||
def make_member(m):
|
||||
return StructureMember(Name(m['name']), types[m['type']], m.get('annotation', 'value'))
|
||||
return StructureMember(Name(m['name']), types[m['type']],
|
||||
m.get('annotation', 'value'), m.get('optional', False))
|
||||
|
||||
members = []
|
||||
members_by_name = {}
|
||||
@@ -410,9 +414,9 @@ def cpp_native_methods(types, typ):
|
||||
|
||||
if typ.is_builder:
|
||||
methods.append(Method(Name('set error callback'), types['void'], [
|
||||
MethodArgument(Name('callback'), types['builder error callback'], 'value'),
|
||||
MethodArgument(Name('userdata1'), types['callback userdata'], 'value'),
|
||||
MethodArgument(Name('userdata2'), types['callback userdata'], 'value'),
|
||||
MethodArgument(Name('callback'), types['builder error callback'], 'value', False),
|
||||
MethodArgument(Name('userdata1'), types['callback userdata'], 'value', False),
|
||||
MethodArgument(Name('userdata2'), types['callback userdata'], 'value', False),
|
||||
]))
|
||||
|
||||
return methods
|
||||
|
||||
Reference in New Issue
Block a user