mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-14 07:36:15 +00:00
Support chained extension structs on the wire
This CL also adds a couple of dummy extensions in dawn.json so that the serialization/deserialization in the wire can be tested. Bug: dawn:369 Change-Id: I5ec3853c286f45d9b04e8bf9d04ebd9176dc917b Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/18520 Commit-Queue: Austin Eng <enga@chromium.org> Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
2479860e4b
commit
76a8d0b92f
@@ -25,11 +25,15 @@ from generator_lib import Generator, run_generator, FileRender
|
||||
class Name:
|
||||
def __init__(self, name, native=False):
|
||||
self.native = native
|
||||
self.name = name
|
||||
if native:
|
||||
self.chunks = [name]
|
||||
else:
|
||||
self.chunks = name.split(' ')
|
||||
|
||||
def get(self):
|
||||
return self.name
|
||||
|
||||
def CamelChunk(self, chunk):
|
||||
return chunk[0].upper() + chunk[1:]
|
||||
|
||||
@@ -145,18 +149,23 @@ class Record:
|
||||
def __init__(self, name):
|
||||
self.name = Name(name)
|
||||
self.members = []
|
||||
self.has_dawn_object = False
|
||||
self.may_have_dawn_object = False
|
||||
|
||||
def update_metadata(self):
|
||||
def has_dawn_object(member):
|
||||
def may_have_dawn_object(member):
|
||||
if isinstance(member.type, ObjectType):
|
||||
return True
|
||||
elif isinstance(member.type, StructureType):
|
||||
return member.type.has_dawn_object
|
||||
return member.type.may_have_dawn_object
|
||||
else:
|
||||
return False
|
||||
|
||||
self.has_dawn_object = any(has_dawn_object(member) for member in self.members)
|
||||
self.may_have_dawn_object = any(may_have_dawn_object(member) for member in self.members)
|
||||
|
||||
# set may_have_dawn_object to true if the type is chained or extensible. Chained structs
|
||||
# may contain a Dawn object.
|
||||
if isinstance(self, StructureType):
|
||||
self.may_have_dawn_object = self.may_have_dawn_object or self.chained or self.extensible
|
||||
|
||||
class StructureType(Record, Type):
|
||||
def __init__(self, name, json_data):
|
||||
|
||||
Reference in New Issue
Block a user