This helps output in the headers information about which structure can
be used to extend which. In the future it could also be used to generate
helpers that validate that the chain for a root structure contains only
allowed extension structs.
Fixed: dawn:1486
Change-Id: I6134332d477503e242b3bec9f8e9bedeeb352351
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/96000
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
- Note that the device-side cache key will be prepended to object cache keys to prevent incompatible adapter/device cache clashes.
- Adds a new template file to auto=generate these cache serializers based on arguments.
Bug: dawn:549
Change-Id: I24b9d11eb38c579acfcc173a5dced9e1b649cf2c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86081
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Loko Kung <lokokung@google.com>
- Adds generator infra for absl::StrFormat for bind group structs and types.
- Uses absl::ParsedFormat to avoid multiple parsing for format strings.
Bug: dawn:549
Change-Id: Ida4ca65eb85c4474c492161c8ae34f53bd692a3c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/81944
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Loko Kung <lokokung@google.com>
- Fix power preference undefined value
- Remove 'upstream' tagged content from emscripten-bits generation
explicitly tag 'emscripten' to things still needed
Bug: None
Change-Id: If575823ff1d99237d7c2cb0e784c24a7299b4a31
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/79220
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Shrek Shao <shrekshao@google.com>
But keep a namespace alias to avoid breaking project that depend on the
previous namespace name while they get updated.
Done with through the following steps:
- git grep -l dawn_native:: | xargs sed -i "" "s/dawn_native::/dawn::native::/g"
- git grep -l "namespace dawn_native" | xargs sed -i "" "s/namespace dawn_native/namespace dawn::native/g"
- git cl format
- Manual fixups in generator/templates (and the addition of
namespace_case in dawn_json_generator.py).
- The addition of the namespace alias in DawnNative.h
Bug: dawn:824
Change-Id: I676cc4e3ced2e0e4bab32a0d66d7eaf9537e3f09
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/75982
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Move the manually parts to src/dawn_native/webgpu_absl_format.cpp/h.
Rename the template webgpu_absl_format.cpp/h to api_absl_format.cpp.h .
BUG=dawn:1201, dawn:563
Change-Id: Ibbeea43227f4fcf7f1d6b1d0bc3927226e79e6c3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/74300
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Junwei Fu <junwei.fu@intel.com>
This CL implements RequestDevice and also has changes for
Dawn to internally use wgpu::FeatureName enums, instead of
strings. Some of the string handling is kept for now to
support the deprecated creation path. GetFeatureInfo is added
to the instance to get a name and description of the feature,
for reporting in about://gpu.
Dawn device toggles are now passed in an extension struct off
of the device descriptor. This is only supported in dawn_native,
and not dawn_wire, for now, since dawn_wire doesn't have a way
to serialize lists of null-terminated const char*.
To enable the client to check whether the toggle descriptor is
supported, a `dawn-native` feature is added which is supported
all the time with dawn_native, but not supported with dawn_wire.
Feature `dawn-native` also enables a synchronous version of
CreateDevice for convenience.
Bug: dawn:160
Change-Id: Ifc195e7ea808c6c319021528ef4b36bd65583bff
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/72020
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
This patch sets 'is_wire_transparent' on the structures whose members
are all wire transparent and are not pointers, so that we can use
memcpy when serializing and deserializing these structures:
- GPUBlendComponent
- GPUColor
- GPUExtent3D
- GPULimits
- GPUOrigin3D
- GPUStencilFaceState
- GPUVertexAttribute
- GPUBlendState
In the next patch we will support memcpy on the qualified structures
whose members contain pointers (e.g. GPUVertexBufferLayout).
BUG=chromium:1266727
Change-Id: If46289f2d10cc7b17e6f5330cd2c2d4dc481f8b9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/73000
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Replace hardcode content with metadata defined in api.json
BUG=dawn:1201
Change-Id: Ib6d6a9c7afc8fb89d3ff2d0129dbfba04adb542a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/73160
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Junwei Fu <junwei.fu@intel.com>
Make ValidationUtils flexible for other generation.
BUG=dawn:1201
Change-Id: I42ccbd3d9c2fe37abec4b8f7eb395583dbe1dc8d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/72980
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Junwei Fu <junwei.fu@intel.com>
Rename mock_webgpu to mock_api and define the function "GetProcTableAndDevice" to "GetProcTable" for removing the special arguments "WGPUDevice* device" that can be got with "GetNewDevice()".
BUG=dawn:1201
Change-Id: I4fc47e4497ba4b6d280cc8af8605f1d93f43497e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/72761
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Junwei Fu <junwei.fu@intel.com>
Struct member defined in dawn.json could have a 'length' attribute
defines the length of the member if it is an array.
In previous, the 'length' could only be 'strlen' or other variable
which has 'uint32_t' types. It cannot support constant length.
CopyTextureForBrowserOptions transfers conversion parameters and
conversion matrix with a constant length. This CL adds this ability
to meet such requirements.
Bug: dawn:1140
Change-Id: I6eeabbc55cc3853fe15e33bdd44060b16f6096bf
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/72580
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Shaobo Yan <shaobo.yan@intel.com>
Rename webgpu_cpp.cpp to api_cpp.cpp and make it flexible.
BUG=dawn:1201
Change-Id: Ib964be9399e9733c4fe9de5d1cd0361182bb0836
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/72460
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Junwei Fu <junwei.fu@intel.com>
This library binds directly to dawn_native and implements
webgpu.h. It may be built as a single library so it can
be easily used in other projects.
Bug: dawn:1220
Change-Id: I73be8c6455922fa526efd1600446cc46b07e82ed
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/53887
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
This patch removes the support of annotation "const*const*" in
the template WireCmd.cpp as it is not used in current Dawn wire
implementation.
BUG=chromium:1266727
Change-Id: I4c4d68ccc050edb5f855094910440e90aef2bc4a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/72040
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Rename webgpu_cpp.h to api_cpp.h and webgpu_cpp_print.h to api_cpp_print.h.
BUG=dawn:1201
Change-Id: Icceee0fd70fb6497a9e2b0891b5c5843787593f9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/71720
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Junwei Fu <junwei.fu@intel.com>
Add a metadata to configure the prefix of proc table and Make proc table
flexiable with the prefix and declared functions.
BUG=dawn:1201
Change-Id: Id28e5521506fa5dc8efca90a7883fbd3dd548e8d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/71526
Commit-Queue: Junwei Fu <junwei.fu@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Rename "callback" to "function pointer" category.
The function does not belongs to any class that has below two keys:
- `"returns"` a string that's the name of the return type
- `"args"` a **record**, so an array of **record members**
BUG=dawn:1201
Change-Id: I546301a19af9472501122e759c495fd761e27ed5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/71060
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Junwei Fu <junwei.fu@intel.com>
This patch uses memcpy to copy the arrays in basic types instead
of iterating every elements in a for-loop.
In the next step we will copy specific structures with memcpy.
With this patch, the performance of dawn_perf_tests
BufferUploadPerf.Run/*_WriteBuffer_BufferSize_* with "-w" will
be greatly improved (~30%).
BUG=chromium:1266727
Change-Id: I7c6fb0fafa63bd6b602eeef8cf2c0ae0cfc7b0be
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/71180
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
The "constant" category has two keys:
- `"type"`: a string, the name of the base data type
- `"value"`: a string, the value is defined with preprocessor macro
Remove deprecated constant InputStepMode.
BUG=dawn:1201, dawn:1023
Change-Id: If4308bd5b25dddd9453514ce362bebe4fd771a57
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/70704
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Commit-Queue: Junwei Fu <junwei.fu@intel.com>
- Adds "_memtadata" that contains various metadata, the key
"api" represents the target of generating Web Standard API.
Rename webgpu.h to api.h and replace relative content with
metadata.
BUG=dawn:1201
Change-Id: I8b422ce4bd3f33d95e78d6c4b80f1310f7ac6726
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/70220
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Junwei Fu <junwei.fu@intel.com>
Helps to avoid explicitly using reinterpret_cast
Change-Id: I4df0e7094c7d8460385c6f23dac529ace9df9bdc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/67605
Auto-Submit: Austin Eng <enga@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
Adds generated headers in dawn_native for object type tracking similar to that used in dawn_wire. Splits ObjectBase into ObjectBase and ApiObjectBase for clearly differentiation, and adds virtual function to identify the type of ApiObjects. Updates error generation to utilize new object typing for generating messages.
Bug: dawn:628, dawn:840, dawn:563
Change-Id: Ia4f831fcbfb29a70ed5a35d47ed622921e744c84
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64820
Commit-Queue: Loko Kung <lokokung@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Begin's using Abseil's string formatting and new error context tracking
to dramatically improve the usefulness of validation messages. In
addition to putting in place several utilities to enable better messages
this change also updates the BindGroup buffers bindings validation
messages as a test for the new mechanisms.
Bug: dawn:563
Change-Id: Ie5bf5ffb24a9013cebd67745dc4172dfbc901e9a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64201
Commit-Queue: Brandon Jones <bajones@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Adds a "tag" system so that entries of dawn.json can be conditionally
emitted in different configurations. With a few more dawn.json changes,
this will enable generating the exact upstream header.
Bug: dawn:1080
Change-Id: I3506dadd485e31786578a3a64c3603c964c5354f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/62580
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
This is a header-only utility so it can be easily included and
used anyhere. Include it in DawnTest.h to automatically pick up
definitions to print test parameters.
Also, work around bot limitations for very-long test names.
Bug: none
Change-Id: I940263ab0a4cc415b06fa04749694f16ff08335c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/51841
Auto-Submit: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
This CL adds two helpers for more ergonomic processing of
ChainedStructs.
1. FindInChain(): Iterates through the chain and automatically
casts the ChainedStruct into the appropriate child type before
returning.
2. ValidateSTypes(): Verifies that the chain only contains structs
with sTypes from a pre-defined set. This also allows the caller
to specify one-of constraints.
3. ValidateSingleSType(): Verifies that the chain contains a
single struct with a specific sType or is an empty chain. This
is a common case of |ValidateSTypes()| and is separated out as
a fast-path.
Change-Id: I938df0bf2a9b1800b1105fb7f80fbde20bef8ec8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/47680
Commit-Queue: Brian Ho <hob@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Implements the GPUCompilationInfo and GPUCompilationMessage interfaces,
adds the GPUCompilationMessageType enum, and adds the compilationInfo
method to GPUShaderModule.
BUG: dawn:746
Change-Id: Ied70cbbfedbf4890916ec076993714e5042f70e4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/46600
Commit-Queue: Brandon Jones <bajones@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Can be used to help with deprecation during simple struct renames.
Includes typedefs for VertexAttributeDescriptor -> VertexAttribute and
VertexBufferLayoutDescriptor -> VertexBufferLayout as specified by the
latest RenderPipelineDescriptor changes.
Bug: dawn:642
Change-Id: Iab3d74d179884499540e813b0e66859713031ccb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/40581
Commit-Queue: Brandon Jones <bajones@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This is needed so that:
1. We can support multiple devices in the wire. The device will need
to know how to destroy its child objects.
2. The wire needs to be aware of all objects and their in-flight
callbacks so that it can reject them if the wire is disconnnected.
A future change will handle this.
3. Fix leaks of objects on page teardown. When the page is torn down,
the wire client is destroyed, and we skip calling release() for all
objects since the object holding the proc table was also destroyed.
Bug: dawn:384, dawn:556
Change-Id: Ie23afe4e515b02e924fcfc2db92b749fd2257c9c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/31160
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
This is a reland of b04a92f01b
with the deletion of a duplicate exported function in dawn_wire that
was causing a compilation failure on Windows.
Original change's description:
> Add a per-thread proc table using thread local storage
>
> In situations where both dawn_wire and dawn_native are used on separate
> threads (Chrome with --single-process or --in-process-gpu), it's
> desirable to have a per-thread proc table so that the WebGPU C++ API can
> still be used. This eliminates classes of bugs with manual
> reference/release errors.
>
> This also changes many of the GetProcs functions to return const
> references to the static proc tables known at compile time, instead of a
> copy.
>
> Bug: none
> Change-Id: I8775bb715b312dd9476a1903fbd797d4b1302614
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/29240
> Reviewed-by: Stephen White <senorblanco@chromium.org>
> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
> Commit-Queue: Austin Eng <enga@chromium.org>
Bug: none
Change-Id: Id90e5372132cd93a2f8631c8185d0e71b01bc1af
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/29443
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
This reverts commit b04a92f01b.
Reason for revert: Build failed on win-archive-dbg; see:
https://chromium-review.googlesource.com/c/chromium/src/+/2450792
Original change's description:
> Add a per-thread proc table using thread local storage
>
> In situations where both dawn_wire and dawn_native are used on separate
> threads (Chrome with --single-process or --in-process-gpu), it's
> desirable to have a per-thread proc table so that the WebGPU C++ API can
> still be used. This eliminates classes of bugs with manual
> reference/release errors.
>
> This also changes many of the GetProcs functions to return const
> references to the static proc tables known at compile time, instead of a
> copy.
>
> Bug: none
> Change-Id: I8775bb715b312dd9476a1903fbd797d4b1302614
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/29240
> Reviewed-by: Stephen White <senorblanco@chromium.org>
> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
> Commit-Queue: Austin Eng <enga@chromium.org>
TBR=cwallez@chromium.org,senorblanco@chromium.org,enga@chromium.org
Change-Id: I4587b457b7b2dd5d3c7457065bf4e77b95af59d7
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: none
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/29442
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
In situations where both dawn_wire and dawn_native are used on separate
threads (Chrome with --single-process or --in-process-gpu), it's
desirable to have a per-thread proc table so that the WebGPU C++ API can
still be used. This eliminates classes of bugs with manual
reference/release errors.
This also changes many of the GetProcs functions to return const
references to the static proc tables known at compile time, instead of a
copy.
Bug: none
Change-Id: I8775bb715b312dd9476a1903fbd797d4b1302614
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/29240
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
The .clang-format files tell clang-format to ignore certain directories
(replacing code in lint_clang_format.sh which will be removed).
$ git ls-tree -r master --name-only | grep '\.\(c\|h\|cpp\|gn\|gni\|mm\|m\|py\)$' | xargs ./append-space-to-files
$ git checkout -- generator/templates third_party/khronos/{KHR,vulkan}
$ git cl format --full --python
Followed by manual reformatting of a few things in Python for
readability.
Bug: none
Change-Id: I4c9e472cc9a5cd80c07286e808f4e597cfef5428
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24785
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
This header was only used to call DeviceCreateErrorBuffer and
DeviceInjectError that are used in some handwritten client commands.
We remove the need for the header by making these two commands
handwritten.
This also improves readability, previously injecting errors read:
ClientDeviceInjectError(reinterpret_cast<WGPUDevice>(device),
WGPUErrorType_Validation,
"Some validation message");
And now reads:
device->InjectError(WGPUErrorType_Validation, "Some validation message");
Bug: dawn:445
Change-Id: Ie11570aacf3036e13abd174d91670ecb84661226
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24080
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
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>