Re-number Dawn enums to start with Dawn prefix
Bug: 42241083
Change-Id: I44b4bec9968241a5cdee88eccfd8ea416172278f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/195035
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
diff --git a/docs/dawn/codegen.md b/docs/dawn/codegen.md
index 47702db..a81ce9f 100644
--- a/docs/dawn/codegen.md
+++ b/docs/dawn/codegen.md
@@ -37,6 +37,8 @@
Most items and sub-items can include a list of `"tags"`, which, if specified, conditionally includes the item if any of its tags appears in the `enabled_tags` configuration passed to `parse_json`. This is used to include and exclude various items for Dawn, Emscripten, or upstream header variants. Tags are applied in the "parse_json" step ([rather than later](https://docs.google.com/document/d/1fBniVOxx3-hQbxHMugEPcQsaXaKBZYVO8yG9iXJp-fU/edit?usp=sharing)): this has the benefit of automatically catching when, for a particular tag configuration, an included item references an excluded item.
+When used on enum values, `"tags"` may add an additional prefix to the enum value. This is to implement [implementation-specific ranges of enums](https://github.com/webgpu-native/webgpu-headers/issues/214). All compat enums are to start at `0x0002_0000`, Emscripten enums are to start at `0x0004_0000`, and all Dawn enums are to start at `0x0005_0000`. Use of `"compat"`, `"emscripten"`, or `"dawn"` tags will add these values, respectively. So, an enum with value `"3"` but tag `"emscripten"` will actually use value `0x0002_0003`. Multi-implementation native enums start at `0x0001_0000`, so this value is added if the `"native"` tag is present and no other value-impacting tag is applied.
+
A **record** is a list of **record members**, each of which is a dictionary with the following schema:
- `"name"` a string
- `"type"` a string, the name of the base type for this member
diff --git a/generator/dawn_json_generator.py b/generator/dawn_json_generator.py
index e81d444..cfd3009 100644
--- a/generator/dawn_json_generator.py
+++ b/generator/dawn_json_generator.py
@@ -123,15 +123,35 @@
if not is_enabled(m):
continue
value = m['value']
- name = m['name']
- if name == "undefined":
+ value_name = m['name']
+ tags = m.get('tags', [])
+
+ prefix = 0
+ if 'compat' in tags:
+ assert prefix == 0
+ prefix = 0x0002_0000
+
+ if 'emscripten' in tags:
+ assert prefix == 0
+ prefix = 0x0004_0000
+
+ if 'dawn' in tags:
+ assert prefix == 0
+ prefix = 0x0005_0000
+
+ if prefix == 0 and 'native' in tags:
+ prefix = 0x0001_0000
+
+ value += prefix
+
+ if value_name == "undefined":
assert value == 0
self.hasUndefined = True
if value != lastValue + 1:
self.contiguousFromZero = False
lastValue = value
self.values.append(
- EnumValue(Name(name), value, m.get('valid', True), m))
+ EnumValue(Name(value_name), value, m.get('valid', True), m))
# Assert that all values are unique in enums
all_values = set()
@@ -1181,8 +1201,9 @@
renders = []
- params_dawn = parse_json(loaded_json,
- enabled_tags=['dawn', 'native', 'deprecated'])
+ params_dawn = parse_json(
+ loaded_json,
+ enabled_tags=['compat', 'dawn', 'native', 'deprecated'])
metadata = params_dawn['metadata']
RENDER_PARAMS_BASE = make_base_render_params(metadata)
@@ -1246,17 +1267,18 @@
[RENDER_PARAMS_BASE, params_dawn]))
if 'webgpu_headers' in targets:
- params_upstream = parse_json(loaded_json,
- enabled_tags=['upstream', 'native'],
- disabled_tags=['dawn'])
+ params_upstream = parse_json(
+ loaded_json,
+ enabled_tags=['compat', 'upstream', 'native'],
+ disabled_tags=['dawn'])
renders.append(
FileRender('api.h', 'webgpu-headers/' + api + '.h',
[RENDER_PARAMS_BASE, params_upstream]))
if 'emscripten_bits' in targets:
assert api == 'webgpu'
- params_emscripten = parse_json(loaded_json,
- enabled_tags=['emscripten'])
+ params_emscripten = parse_json(
+ loaded_json, enabled_tags=['compat', 'emscripten'])
# system/include/webgpu
renders.append(
FileRender('api.h',
@@ -1376,9 +1398,10 @@
frontend_params))
if 'wire' in targets:
- params_dawn_wire = parse_json(loaded_json,
- enabled_tags=['dawn', 'deprecated'],
- disabled_tags=['native'])
+ params_dawn_wire = parse_json(
+ loaded_json,
+ enabled_tags=['compat', 'dawn', 'deprecated'],
+ disabled_tags=['native'])
additional_params = compute_wire_params(params_dawn_wire,
wire_json)
@@ -1444,9 +1467,10 @@
if 'dawn_lpmfuzz_proto' in targets:
- params_dawn_wire = parse_json(loaded_json,
- enabled_tags=['dawn', 'deprecated'],
- disabled_tags=['native'])
+ params_dawn_wire = parse_json(
+ loaded_json,
+ enabled_tags=['compat', 'dawn', 'deprecated'],
+ disabled_tags=['native'])
api_and_wire_params = compute_wire_params(params_dawn_wire,
wire_json)
@@ -1472,9 +1496,10 @@
lpm_params))
if 'dawn_lpmfuzz_cpp' in targets:
- params_dawn_wire = parse_json(loaded_json,
- enabled_tags=['dawn', 'deprecated'],
- disabled_tags=['native'])
+ params_dawn_wire = parse_json(
+ loaded_json,
+ enabled_tags=['compat', 'dawn', 'deprecated'],
+ disabled_tags=['native'])
api_and_wire_params = compute_wire_params(params_dawn_wire,
wire_json)
diff --git a/src/dawn/dawn.json b/src/dawn/dawn.json
index 93c5501..e9f8f0e 100644
--- a/src/dawn/dawn.json
+++ b/src/dawn/dawn.json
@@ -2443,62 +2443,62 @@
{"value": 10, "name": "BGRA8 unorm storage"},
{"value": 11, "name": "float32 filterable", "jsrepr": "'float32-filterable'"},
- {"value": 1002, "name": "dawn internal usages", "tags": ["dawn"]},
- {"value": 1003, "name": "dawn multi planar formats", "tags": ["dawn"]},
- {"value": 1004, "name": "dawn native", "tags": ["dawn", "native"]},
- {"value": 1006, "name": "chromium experimental timestamp query inside passes", "tags": ["dawn"]},
- {"value": 1007, "name": "implicit device synchronization", "tags": ["dawn", "native"]},
- {"value": 1008, "name": "surface capabilities", "tags": ["dawn", "native"]},
- {"value": 1009, "name": "transient attachments", "tags": ["dawn"]},
- {"value": 1010, "name": "MSAA render to single sampled", "tags": ["dawn"]},
- {"value": 1011, "name": "dual source blending", "tags": ["dawn"]},
- {"value": 1012, "name": "D3D11 multithread protected", "tags": ["dawn", "native"]},
- {"value": 1013, "name": "ANGLE texture sharing", "tags": ["dawn", "native"]},
- {"value": 1014, "name": "chromium experimental subgroups", "tags": ["dawn"]},
- {"value": 1015, "name": "chromium experimental subgroup uniform control flow", "tags": ["dawn"]},
- {"value": 1017, "name": "pixel local storage coherent", "tags": ["dawn"]},
- {"value": 1018, "name": "pixel local storage non coherent", "tags": ["dawn"]},
- {"value": 1019, "name": "unorm16 texture formats", "tags": ["dawn"]},
- {"value": 1020, "name": "snorm16 texture formats", "tags": ["dawn"]},
- {"value": 1021, "name": "multi planar format extended usages", "tags": ["dawn"]},
- {"value": 1022, "name": "multi planar format p010", "tags": ["dawn"]},
- {"value": 1023, "name": "host mapped pointer", "tags": ["dawn"]},
- {"value": 1024, "name": "multi planar render targets", "tags": ["dawn"]},
- {"value": 1025, "name": "multi planar format nv12a", "tags": ["dawn"]},
- {"value": 1026, "name": "framebuffer fetch", "tags": ["dawn"]},
- {"value": 1027, "name": "buffer map extended usages", "tags": ["dawn"]},
- {"value": 1028, "name": "adapter properties memory heaps", "tags": ["dawn"]},
- {"value": 1029, "name": "adapter properties D3D", "tags": ["dawn"]},
- {"value": 1030, "name": "adapter properties vk", "tags": ["dawn"]},
- {"value": 1031, "name": "r8 unorm storage", "tags": ["dawn"]},
- {"value": 1032, "name": "format capabilities", "tags": ["dawn"]},
- {"value": 1033, "name": "drm format capabilities", "tags": ["dawn"]},
- {"value": 1034, "name": "norm16 texture formats", "tags": ["dawn"]},
- {"value": 1035, "name": "multi planar format nv16", "tags": ["dawn"]},
- {"value": 1036, "name": "multi planar format nv24", "tags": ["dawn"]},
- {"value": 1037, "name": "multi planar format p210", "tags": ["dawn"]},
- {"value": 1038, "name": "multi planar format p410", "tags": ["dawn"]},
+ {"value": 0, "name": "dawn internal usages", "tags": ["dawn"]},
+ {"value": 1, "name": "dawn multi planar formats", "tags": ["dawn"]},
+ {"value": 2, "name": "dawn native", "tags": ["dawn", "native"]},
+ {"value": 3, "name": "chromium experimental timestamp query inside passes", "tags": ["dawn"]},
+ {"value": 4, "name": "implicit device synchronization", "tags": ["dawn", "native"]},
+ {"value": 5, "name": "surface capabilities", "tags": ["dawn", "native"]},
+ {"value": 6, "name": "transient attachments", "tags": ["dawn"]},
+ {"value": 7, "name": "MSAA render to single sampled", "tags": ["dawn"]},
+ {"value": 8, "name": "dual source blending", "tags": ["dawn"]},
+ {"value": 9, "name": "D3D11 multithread protected", "tags": ["dawn", "native"]},
+ {"value": 10, "name": "ANGLE texture sharing", "tags": ["dawn", "native"]},
+ {"value": 11, "name": "chromium experimental subgroups", "tags": ["dawn"]},
+ {"value": 12, "name": "chromium experimental subgroup uniform control flow", "tags": ["dawn"]},
+ {"value": 13, "name": "pixel local storage coherent", "tags": ["dawn"]},
+ {"value": 14, "name": "pixel local storage non coherent", "tags": ["dawn"]},
+ {"value": 15, "name": "unorm16 texture formats", "tags": ["dawn"]},
+ {"value": 16, "name": "snorm16 texture formats", "tags": ["dawn"]},
+ {"value": 17, "name": "multi planar format extended usages", "tags": ["dawn"]},
+ {"value": 18, "name": "multi planar format p010", "tags": ["dawn"]},
+ {"value": 19, "name": "host mapped pointer", "tags": ["dawn"]},
+ {"value": 20, "name": "multi planar render targets", "tags": ["dawn"]},
+ {"value": 21, "name": "multi planar format nv12a", "tags": ["dawn"]},
+ {"value": 22, "name": "framebuffer fetch", "tags": ["dawn"]},
+ {"value": 23, "name": "buffer map extended usages", "tags": ["dawn"]},
+ {"value": 24, "name": "adapter properties memory heaps", "tags": ["dawn"]},
+ {"value": 25, "name": "adapter properties D3D", "tags": ["dawn"]},
+ {"value": 26, "name": "adapter properties vk", "tags": ["dawn"]},
+ {"value": 27, "name": "r8 unorm storage", "tags": ["dawn"]},
+ {"value": 28, "name": "format capabilities", "tags": ["dawn"]},
+ {"value": 29, "name": "drm format capabilities", "tags": ["dawn"]},
+ {"value": 30, "name": "norm16 texture formats", "tags": ["dawn"]},
+ {"value": 31, "name": "multi planar format nv16", "tags": ["dawn"]},
+ {"value": 32, "name": "multi planar format nv24", "tags": ["dawn"]},
+ {"value": 33, "name": "multi planar format p210", "tags": ["dawn"]},
+ {"value": 34, "name": "multi planar format p410", "tags": ["dawn"]},
- {"value": 1100, "name": "shared texture memory vk dedicated allocation", "tags": ["dawn", "native"]},
- {"value": 1101, "name": "shared texture memory a hardware buffer", "tags": ["dawn", "native"]},
- {"value": 1102, "name": "shared texture memory dma buf", "tags": ["dawn", "native"]},
- {"value": 1103, "name": "shared texture memory opaque FD", "tags": ["dawn", "native"]},
- {"value": 1104, "name": "shared texture memory zircon handle", "tags": ["dawn", "native"]},
- {"value": 1105, "name": "shared texture memory DXGI shared handle", "tags": ["dawn", "native"]},
- {"value": 1106, "name": "shared texture memory D3D11 texture 2D", "tags": ["dawn", "native"]},
- {"value": 1107, "name": "shared texture memory IO surface", "tags": ["dawn", "native"]},
- {"value": 1108, "name": "shared texture memory EGL image", "tags": ["dawn", "native"]},
- {"value": 1200, "name": "shared fence vk semaphore opaque FD", "tags": ["dawn", "native"]},
- {"value": 1201, "name": "shared fence vk semaphore sync FD", "tags": ["dawn", "native"]},
- {"value": 1202, "name": "shared fence vk semaphore zircon handle", "tags": ["dawn", "native"]},
- {"value": 1203, "name": "shared fence DXGI shared handle", "tags": ["dawn", "native"]},
- {"value": 1204, "name": "shared fence MTL shared event", "tags": ["dawn", "native"]},
- {"value": 1205, "name": "shared buffer memory D3D12 resource", "tags": ["dawn", "native"]},
- {"value": 1206, "name": "static samplers", "tags": ["dawn"]},
- {"value": 1207, "name": "y cb cr vulkan samplers", "tags": ["dawn"]},
- {"value": 1208, "name": "shader module compilation options", "tags": ["dawn"]},
+ {"value": 35, "name": "shared texture memory vk dedicated allocation", "tags": ["dawn", "native"]},
+ {"value": 36, "name": "shared texture memory a hardware buffer", "tags": ["dawn", "native"]},
+ {"value": 37, "name": "shared texture memory dma buf", "tags": ["dawn", "native"]},
+ {"value": 38, "name": "shared texture memory opaque FD", "tags": ["dawn", "native"]},
+ {"value": 39, "name": "shared texture memory zircon handle", "tags": ["dawn", "native"]},
+ {"value": 40, "name": "shared texture memory DXGI shared handle", "tags": ["dawn", "native"]},
+ {"value": 41, "name": "shared texture memory D3D11 texture 2D", "tags": ["dawn", "native"]},
+ {"value": 42, "name": "shared texture memory IO surface", "tags": ["dawn", "native"]},
+ {"value": 43, "name": "shared texture memory EGL image", "tags": ["dawn", "native"]},
+ {"value": 44, "name": "shared fence vk semaphore opaque FD", "tags": ["dawn", "native"]},
+ {"value": 45, "name": "shared fence vk semaphore sync FD", "tags": ["dawn", "native"]},
+ {"value": 46, "name": "shared fence vk semaphore zircon handle", "tags": ["dawn", "native"]},
+ {"value": 47, "name": "shared fence DXGI shared handle", "tags": ["dawn", "native"]},
+ {"value": 48, "name": "shared fence MTL shared event", "tags": ["dawn", "native"]},
+ {"value": 49, "name": "shared buffer memory D3D12 resource", "tags": ["dawn", "native"]},
+ {"value": 50, "name": "static samplers", "tags": ["dawn"]},
+ {"value": 51, "name": "y cb cr vulkan samplers", "tags": ["dawn"]},
+ {"value": 52, "name": "shader module compilation options", "tags": ["dawn"]},
- {"value": 1209, "name": "dawn load resolve texture", "tags": ["dawn"]}
+ {"value": 53, "name": "dawn load resolve texture", "tags": ["dawn"]}
]
},
"filter mode": {
@@ -3966,68 +3966,70 @@
{"value": 8, "name": "surface descriptor from wayland surface", "tags": ["native"]},
{"value": 9, "name": "surface descriptor from android native window", "tags": ["native"]},
{"value": 10, "name": "surface descriptor from xcb window", "tags": ["upstream"]},
- {"value": 11, "name": "surface descriptor from windows core window", "tags": ["dawn"]},
- {"value": 12, "name": "external texture binding entry", "tags": ["dawn"]},
- {"value": 13, "name": "external texture binding layout", "tags": ["dawn"]},
- {"value": 14, "name": "surface descriptor from windows swap chain panel", "tags": ["dawn"]},
- {"value": 15, "name": "render pass descriptor max draw count"},
- {"value": 16, "name": "depth stencil state depth write defined dawn", "tags": ["dawn"]},
- {"value": 17, "name": "texture binding view dimension descriptor"},
- {"value": 1000, "name": "dawn texture internal usage descriptor", "tags": ["dawn"]},
- {"value": 1003, "name": "dawn encoder internal usage descriptor", "tags": ["dawn"]},
- {"value": 1004, "name": "dawn instance descriptor", "tags": ["dawn", "native"]},
- {"value": 1005, "name": "dawn cache device descriptor", "tags": ["dawn", "native"]},
- {"value": 1006, "name": "dawn adapter properties power preference", "tags": ["dawn", "native"]},
- {"value": 1007, "name": "dawn buffer descriptor error info from wire client", "tags": ["dawn"]},
- {"value": 1008, "name": "dawn toggles descriptor", "tags": ["dawn", "native"]},
- {"value": 1009, "name": "dawn shader module SPIRV options descriptor", "tags": ["dawn"]},
- {"value": 1010, "name": "request adapter options LUID", "tags": ["dawn", "native"]},
- {"value": 1011, "name": "request adapter options get GL proc", "tags": ["dawn", "native"]},
- {"value": 1012, "name": "request adapter options D3D11 device", "tags": ["dawn", "native"]},
- {"value": 1014, "name": "dawn render pass color attachment render to single sampled", "tags": ["dawn"]},
- {"value": 1015, "name": "render pass pixel local storage", "tags": ["dawn"]},
- {"value": 1016, "name": "pipeline layout pixel local storage", "tags": ["dawn"]},
- {"value": 1017, "name": "buffer host mapped pointer", "tags": ["dawn"]},
- {"value": 1018, "name": "dawn experimental subgroup limits", "tags": ["dawn"]},
- {"value": 1019, "name": "adapter properties memory heaps", "tags": ["dawn"]},
- {"value": 1020, "name": "adapter properties D3D", "tags": ["dawn"]},
- {"value": 1021, "name": "adapter properties vk", "tags": ["dawn"]},
- {"value": 1022, "name": "dawn compute pipeline full subgroups", "tags": ["dawn"]},
- {"value": 1023, "name": "dawn wire WGSL control", "tags": ["dawn"]},
- {"value": 1024, "name": "dawn WGSL blocklist", "tags": ["dawn", "native"]},
- {"value": 1025, "name": "drm format capabilities", "tags": ["dawn"]},
- {"value": 1026, "name": "shader module compilation options", "tags": ["dawn"]},
- {"value": 1027, "name": "color target state expand resolve texture dawn", "tags": ["dawn"]},
+ {"value": 11, "name": "render pass descriptor max draw count"},
- {"value": 1101, "name": "shared texture memory vk dedicated allocation descriptor", "tags": ["dawn", "native"]},
- {"value": 1102, "name": "shared texture memory a hardware buffer descriptor", "tags": ["dawn", "native"]},
- {"value": 1103, "name": "shared texture memory dma buf descriptor", "tags": ["dawn", "native"]},
- {"value": 1104, "name": "shared texture memory opaque FD descriptor", "tags": ["dawn", "native"]},
- {"value": 1105, "name": "shared texture memory zircon handle descriptor", "tags": ["dawn", "native"]},
- {"value": 1106, "name": "shared texture memory DXGI shared handle descriptor", "tags": ["dawn", "native"]},
- {"value": 1107, "name": "shared texture memory D3D11 texture 2D descriptor", "tags": ["dawn", "native"]},
- {"value": 1108, "name": "shared texture memory IO surface descriptor", "tags": ["dawn", "native"]},
- {"value": 1109, "name": "shared texture memory EGL image descriptor", "tags": ["dawn", "native"]},
- {"value": 1200, "name": "shared texture memory initialized begin state", "tags": ["dawn", "native"]},
- {"value": 1201, "name": "shared texture memory initialized end state", "tags": ["dawn", "native"]},
- {"value": 1202, "name": "shared texture memory vk image layout begin state", "tags": ["dawn", "native"]},
- {"value": 1203, "name": "shared texture memory vk image layout end state", "tags": ["dawn", "native"]},
- {"value": 1204, "name": "shared texture memory D3D swapchain begin state", "tags": ["dawn", "native"]},
- {"value": 1205, "name": "shared fence vk semaphore opaque FD descriptor", "tags": ["dawn", "native"]},
- {"value": 1206, "name": "shared fence vk semaphore opaque FD export info", "tags": ["dawn", "native"]},
- {"value": 1207, "name": "shared fence vk semaphore sync FD descriptor", "tags": ["dawn", "native"]},
- {"value": 1208, "name": "shared fence vk semaphore sync FD export info", "tags": ["dawn", "native"]},
- {"value": 1209, "name": "shared fence vk semaphore zircon handle descriptor", "tags": ["dawn", "native"]},
- {"value": 1210, "name": "shared fence vk semaphore zircon handle export info", "tags": ["dawn", "native"]},
- {"value": 1211, "name": "shared fence DXGI shared handle descriptor", "tags": ["dawn", "native"]},
- {"value": 1212, "name": "shared fence DXGI shared handle export info", "tags": ["dawn", "native"]},
- {"value": 1213, "name": "shared fence MTL shared event descriptor", "tags": ["dawn", "native"]},
- {"value": 1214, "name": "shared fence MTL shared event export info", "tags": ["dawn", "native"]},
- {"value": 1215, "name": "shared buffer memory D3D12 resource descriptor", "tags": ["dawn", "native"]},
- {"value": 1216, "name": "static sampler binding layout", "tags": ["dawn"]},
- {"value": 1217, "name": "y cb cr vk descriptor", "tags": ["dawn"]},
- {"value": 1218, "name": "shared texture memory a hardware buffer properties", "tags": ["dawn", "native"]},
- {"value": 1219, "name": "a hardware buffer properties", "tags": ["dawn", "native"]}
+ {"value": 0, "name": "texture binding view dimension descriptor", "tags": ["compat"]},
+
+ {"value": 0, "name": "surface descriptor from windows core window", "tags": ["dawn"]},
+ {"value": 1, "name": "external texture binding entry", "tags": ["dawn"]},
+ {"value": 2, "name": "external texture binding layout", "tags": ["dawn"]},
+ {"value": 3, "name": "surface descriptor from windows swap chain panel", "tags": ["dawn"]},
+ {"value": 4, "name": "depth stencil state depth write defined dawn", "tags": ["dawn"]},
+ {"value": 5, "name": "dawn texture internal usage descriptor", "tags": ["dawn"]},
+ {"value": 6, "name": "dawn encoder internal usage descriptor", "tags": ["dawn"]},
+ {"value": 7, "name": "dawn instance descriptor", "tags": ["dawn", "native"]},
+ {"value": 8, "name": "dawn cache device descriptor", "tags": ["dawn", "native"]},
+ {"value": 9, "name": "dawn adapter properties power preference", "tags": ["dawn", "native"]},
+ {"value": 10, "name": "dawn buffer descriptor error info from wire client", "tags": ["dawn"]},
+ {"value": 11, "name": "dawn toggles descriptor", "tags": ["dawn", "native"]},
+ {"value": 12, "name": "dawn shader module SPIRV options descriptor", "tags": ["dawn"]},
+ {"value": 13, "name": "request adapter options LUID", "tags": ["dawn", "native"]},
+ {"value": 14, "name": "request adapter options get GL proc", "tags": ["dawn", "native"]},
+ {"value": 15, "name": "request adapter options D3D11 device", "tags": ["dawn", "native"]},
+ {"value": 16, "name": "dawn render pass color attachment render to single sampled", "tags": ["dawn"]},
+ {"value": 17, "name": "render pass pixel local storage", "tags": ["dawn"]},
+ {"value": 18, "name": "pipeline layout pixel local storage", "tags": ["dawn"]},
+ {"value": 19, "name": "buffer host mapped pointer", "tags": ["dawn"]},
+ {"value": 20, "name": "dawn experimental subgroup limits", "tags": ["dawn"]},
+ {"value": 21, "name": "adapter properties memory heaps", "tags": ["dawn"]},
+ {"value": 22, "name": "adapter properties D3D", "tags": ["dawn"]},
+ {"value": 23, "name": "adapter properties vk", "tags": ["dawn"]},
+ {"value": 24, "name": "dawn compute pipeline full subgroups", "tags": ["dawn"]},
+ {"value": 25, "name": "dawn wire WGSL control", "tags": ["dawn"]},
+ {"value": 26, "name": "dawn WGSL blocklist", "tags": ["dawn", "native"]},
+ {"value": 27, "name": "drm format capabilities", "tags": ["dawn"]},
+ {"value": 28, "name": "shader module compilation options", "tags": ["dawn"]},
+ {"value": 29, "name": "color target state expand resolve texture dawn", "tags": ["dawn"]},
+
+ {"value": 30, "name": "shared texture memory vk dedicated allocation descriptor", "tags": ["dawn", "native"]},
+ {"value": 31, "name": "shared texture memory a hardware buffer descriptor", "tags": ["dawn", "native"]},
+ {"value": 32, "name": "shared texture memory dma buf descriptor", "tags": ["dawn", "native"]},
+ {"value": 33, "name": "shared texture memory opaque FD descriptor", "tags": ["dawn", "native"]},
+ {"value": 34, "name": "shared texture memory zircon handle descriptor", "tags": ["dawn", "native"]},
+ {"value": 35, "name": "shared texture memory DXGI shared handle descriptor", "tags": ["dawn", "native"]},
+ {"value": 36, "name": "shared texture memory D3D11 texture 2D descriptor", "tags": ["dawn", "native"]},
+ {"value": 37, "name": "shared texture memory IO surface descriptor", "tags": ["dawn", "native"]},
+ {"value": 38, "name": "shared texture memory EGL image descriptor", "tags": ["dawn", "native"]},
+ {"value": 39, "name": "shared texture memory initialized begin state", "tags": ["dawn", "native"]},
+ {"value": 40, "name": "shared texture memory initialized end state", "tags": ["dawn", "native"]},
+ {"value": 41, "name": "shared texture memory vk image layout begin state", "tags": ["dawn", "native"]},
+ {"value": 42, "name": "shared texture memory vk image layout end state", "tags": ["dawn", "native"]},
+ {"value": 43, "name": "shared texture memory D3D swapchain begin state", "tags": ["dawn", "native"]},
+ {"value": 44, "name": "shared fence vk semaphore opaque FD descriptor", "tags": ["dawn", "native"]},
+ {"value": 45, "name": "shared fence vk semaphore opaque FD export info", "tags": ["dawn", "native"]},
+ {"value": 46, "name": "shared fence vk semaphore sync FD descriptor", "tags": ["dawn", "native"]},
+ {"value": 47, "name": "shared fence vk semaphore sync FD export info", "tags": ["dawn", "native"]},
+ {"value": 48, "name": "shared fence vk semaphore zircon handle descriptor", "tags": ["dawn", "native"]},
+ {"value": 49, "name": "shared fence vk semaphore zircon handle export info", "tags": ["dawn", "native"]},
+ {"value": 50, "name": "shared fence DXGI shared handle descriptor", "tags": ["dawn", "native"]},
+ {"value": 51, "name": "shared fence DXGI shared handle export info", "tags": ["dawn", "native"]},
+ {"value": 52, "name": "shared fence MTL shared event descriptor", "tags": ["dawn", "native"]},
+ {"value": 53, "name": "shared fence MTL shared event export info", "tags": ["dawn", "native"]},
+ {"value": 54, "name": "shared buffer memory D3D12 resource descriptor", "tags": ["dawn", "native"]},
+ {"value": 55, "name": "static sampler binding layout", "tags": ["dawn"]},
+ {"value": 56, "name": "y cb cr vk descriptor", "tags": ["dawn"]},
+ {"value": 57, "name": "shared texture memory a hardware buffer properties", "tags": ["dawn", "native"]},
+ {"value": 58, "name": "a hardware buffer properties", "tags": ["dawn", "native"]}
]
},
"texture": {
@@ -4111,9 +4113,9 @@
{"value": 1, "name": "all"},
{"value": 2, "name": "stencil only"},
{"value": 3, "name": "depth only"},
- {"value": 4, "name": "plane 0 only", "tags": ["dawn"]},
- {"value": 5, "name": "plane 1 only", "tags": ["dawn"]},
- {"value": 6, "name": "plane 2 only", "tags": ["dawn"]}
+ {"value": 0, "name": "plane 0 only", "tags": ["dawn"]},
+ {"value": 1, "name": "plane 1 only", "tags": ["dawn"]},
+ {"value": 2, "name": "plane 2 only", "tags": ["dawn"]}
]
},
"texture data layout": {
@@ -4266,21 +4268,21 @@
{"value": 94, "name": "ASTC 12x12 unorm", "jsrepr": "'astc-12x12-unorm'"},
{"value": 95, "name": "ASTC 12x12 unorm srgb", "jsrepr": "'astc-12x12-unorm-srgb'"},
- {"value": 96, "name": "R16 unorm", "tags": ["dawn"]},
- {"value": 97, "name": "RG16 unorm", "tags": ["dawn"]},
- {"value": 98, "name": "RGBA16 unorm", "tags": ["dawn"]},
- {"value": 99, "name": "R16 snorm", "tags": ["dawn"]},
- {"value": 100, "name": "RG16 snorm", "tags": ["dawn"]},
- {"value": 101, "name": "RGBA16 snorm", "tags": ["dawn"]},
+ {"value": 0, "name": "R16 unorm", "tags": ["dawn"]},
+ {"value": 1, "name": "RG16 unorm", "tags": ["dawn"]},
+ {"value": 2, "name": "RGBA16 unorm", "tags": ["dawn"]},
+ {"value": 3, "name": "R16 snorm", "tags": ["dawn"]},
+ {"value": 4, "name": "RG16 snorm", "tags": ["dawn"]},
+ {"value": 5, "name": "RGBA16 snorm", "tags": ["dawn"]},
- {"value": 102, "name": "R8 BG8 Biplanar 420 unorm", "tags": ["dawn"]},
- {"value": 103, "name": "R10X6 BG10X6 Biplanar 420 unorm", "tags": ["dawn"]},
- {"value": 104, "name": "R8 BG8 A8 Triplanar 420 unorm", "tags": ["dawn"]},
- {"value": 105, "name": "R8 BG8 Biplanar 422 unorm", "tags": ["dawn"]},
- {"value": 106, "name": "R8 BG8 Biplanar 444 unorm", "tags": ["dawn"]},
- {"value": 107, "name": "R10X6 BG10X6 Biplanar 422 unorm", "tags": ["dawn"]},
- {"value": 108, "name": "R10X6 BG10X6 Biplanar 444 unorm", "tags": ["dawn"]},
- {"value": 109, "name": "External", "tags": ["dawn"]}
+ {"value": 6, "name": "R8 BG8 Biplanar 420 unorm", "tags": ["dawn"]},
+ {"value": 7, "name": "R10X6 BG10X6 Biplanar 420 unorm", "tags": ["dawn"]},
+ {"value": 8, "name": "R8 BG8 A8 Triplanar 420 unorm", "tags": ["dawn"]},
+ {"value": 9, "name": "R8 BG8 Biplanar 422 unorm", "tags": ["dawn"]},
+ {"value": 10, "name": "R8 BG8 Biplanar 444 unorm", "tags": ["dawn"]},
+ {"value": 11, "name": "R10X6 BG10X6 Biplanar 422 unorm", "tags": ["dawn"]},
+ {"value": 12, "name": "R10X6 BG10X6 Biplanar 444 unorm", "tags": ["dawn"]},
+ {"value": 13, "name": "External", "tags": ["dawn"]}
]
},
"texture usage": {
@@ -4397,11 +4399,12 @@
{"value": 2, "name": "packed 4x8 integer dot product", "jsrepr": "'packed_4x8_integer_dot_product'"},
{"value": 3, "name": "unrestricted pointer parameters", "jsrepr": "'unrestricted_pointer_parameters'"},
{"value": 4, "name": "pointer composite access", "jsrepr": "'pointer_composite_access'"},
- {"value": 1000, "name": "chromium testing unimplemented", "jsrepr": "'chromium_testing_unimplemented'", "tags": ["dawn"]},
- {"value": 1001, "name": "chromium testing unsafe experimental", "jsrepr": "'chromium_testing_unsafe_experimental'", "tags": ["dawn"]},
- {"value": 1002, "name": "chromium testing experimental", "jsrepr": "'chromium_testing_experimental'", "tags": ["dawn"]},
- {"value": 1003, "name": "chromium testing shipped with killswitch", "jsrepr": "'chromium_testing_shipped_with_killswitch'", "tags": ["dawn"]},
- {"value": 1004, "name": "chromium testing shipped", "jsrepr": "'chromium_testing_shipped'", "tags": ["dawn"]}
+
+ {"value": 0, "name": "chromium testing unimplemented", "jsrepr": "'chromium_testing_unimplemented'", "tags": ["dawn"]},
+ {"value": 1, "name": "chromium testing unsafe experimental", "jsrepr": "'chromium_testing_unsafe_experimental'", "tags": ["dawn"]},
+ {"value": 2, "name": "chromium testing experimental", "jsrepr": "'chromium_testing_experimental'", "tags": ["dawn"]},
+ {"value": 3, "name": "chromium testing shipped with killswitch", "jsrepr": "'chromium_testing_shipped_with_killswitch'", "tags": ["dawn"]},
+ {"value": 4, "name": "chromium testing shipped", "jsrepr": "'chromium_testing_shipped'", "tags": ["dawn"]}
]
},
"whole size" : {
diff --git a/src/dawn/native/Format.cpp b/src/dawn/native/Format.cpp
index 029f474..7a2492b 100644
--- a/src/dawn/native/Format.cpp
+++ b/src/dawn/native/Format.cpp
@@ -173,11 +173,29 @@
// For the enum for formats are packed but this might change when we have a broader feature
// mechanism for webgpu.h. Formats start at 1 because 0 is the undefined format.
+// Dawn internal formats start with a prefix. We strip the prefix and then pack
+// them after the last WebGPU format.
FormatIndex ComputeFormatIndex(wgpu::TextureFormat format) {
- // This takes advantage of overflows to make the index of TextureFormat::Undefined outside
- // of the range of the FormatTable.
- static_assert(static_cast<uint32_t>(wgpu::TextureFormat::Undefined) - 1 > kKnownFormatCount);
- return static_cast<FormatIndex>(static_cast<uint32_t>(format) - 1);
+ uint32_t formatValue = static_cast<uint32_t>(format);
+ switch (formatValue & kEnumPrefixMask) {
+ case 0:
+ // This takes advantage of overflows to make the index of TextureFormat::Undefined
+ // outside of the range of the FormatTable.
+ static_assert(static_cast<uint32_t>(wgpu::TextureFormat::Undefined) - 1 >
+ kKnownFormatCount);
+ return static_cast<FormatIndex>(formatValue - 1);
+ case kDawnEnumPrefix: {
+ uint32_t dawnIndex = formatValue & ~kEnumPrefixMask;
+ if (dawnIndex < kDawnFormatCount) {
+ return static_cast<FormatIndex>(dawnIndex + kWebGPUFormatCount);
+ }
+ break;
+ }
+ default:
+ break;
+ }
+ // Invalid format. Return an index outside the format table.
+ return FormatIndex(~0);
}
FormatTable BuildFormatTable(const DeviceBase* device) {
diff --git a/src/dawn/native/Format.h b/src/dawn/native/Format.h
index 3efb5b4..32218998 100644
--- a/src/dawn/native/Format.h
+++ b/src/dawn/native/Format.h
@@ -118,7 +118,9 @@
// The number of formats Dawn knows about. Asserts in BuildFormatTable ensure that this is the
// exact number of known format.
-static constexpr uint32_t kKnownFormatCount = 109;
+static constexpr uint32_t kWebGPUFormatCount = 95;
+static constexpr uint32_t kDawnFormatCount = 14;
+static constexpr uint32_t kKnownFormatCount = kWebGPUFormatCount + kDawnFormatCount;
using FormatIndex = TypedInteger<struct FormatIndexT, uint32_t>;
diff --git a/src/dawn/native/dawn_platform.h b/src/dawn/native/dawn_platform.h
index 02406c4..1fe5e37 100644
--- a/src/dawn/native/dawn_platform.h
+++ b/src/dawn/native/dawn_platform.h
@@ -97,6 +97,10 @@
// Extra TextureViewDimension for input attachment.
static constexpr wgpu::TextureViewDimension kInternalInputAttachmentDim =
static_cast<wgpu::TextureViewDimension>(~0u);
+
+static constexpr uint32_t kEnumPrefixMask = 0xFFFF'0000;
+static constexpr uint32_t kDawnEnumPrefix = 0x0005'0000;
+
} // namespace dawn::native
#endif // SRC_DAWN_NATIVE_DAWN_PLATFORM_H_