Commit Graph

323 Commits

Author SHA1 Message Date
Ningxin Hu 7e5930bd1c Make the template of ProcTable flexible
BUG=dawn:1201

Change-Id: I723c064c7cf8541798e5736d7860769b238cbf01
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/73400
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: ningxin hu <ningxin.hu@intel.com>
2021-12-22 06:12:13 +00:00
fujunwei 2b1dcd92b1 Make the templates of ChainUtils and ObjectType flexible
Replace hardcode contents with metadata.

BUG=dawn:1201
Change-Id: I5e000edfeae3cc597127e487da29455c99fa8de2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/73920
Reviewed-by: ningxin hu <ningxin.hu@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Junwei Fu <junwei.fu@intel.com>
2021-12-22 01:05:03 +00:00
Jiawei Shao 1fa386cc87 dawn_wire: use memcpy on structures when possible
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>
2021-12-21 04:04:51 +00:00
fujunwei 7f3f8ac004 Make the templates of native struct flexible
Rename wgpu_structs.cpp/h to api_structs.cpp/h and replace hardcode contents
with metadata.

BUG=dawn:1201

Change-Id: I4f2978c6abec7b492da142499890733567e2cec3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/73300
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Junwei Fu <junwei.fu@intel.com>
2021-12-21 03:27:34 +00:00
fujunwei fc38f7d879 Make dawn_platform.h template flexible
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>
2021-12-17 00:46:08 +00:00
fujunwei a2241d402e Configure the namespace of native implementation in api.json
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>
2021-12-16 04:54:38 +00:00
Austin Eng 874c6cfd7e Update BSD 3 license comment
Bug: none
Change-Id: If65c7f077ccefa62a62d24fad7003b4ab245c757
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/73120
Commit-Queue: Austin Eng <enga@chromium.org>
Auto-Submit: Austin Eng <enga@chromium.org>
Reviewed-by: Shrek Shao <shrekshao@google.com>
Commit-Queue: Shrek Shao <shrekshao@google.com>
2021-12-16 00:52:26 +00:00
Austin Eng 736dd07303 Fix typo in api_struct_info.json
Breaking the Dawn->Chromium roll

Bug: none
Change-Id: Ic016b8bbdc817696bd31192a48dfd2022adcff8f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/73060
Commit-Queue: Austin Eng <enga@chromium.org>
Auto-Submit: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2021-12-15 18:06:36 +00:00
fujunwei 16ae3b8b95 Make the templates of mocking api flexible
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>
2021-12-15 04:35:26 +00:00
Yan 5204053954 Support "length" in dawn.json could be a integer
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>
2021-12-15 04:08:56 +00:00
Austin Eng 89ddadcd1e Add feature queries to dawn_native/dawn_wire
This is so we can implement the adapter/device APIs fully
on dawn_wire.

Bug: dawn:689
Change-Id: I47f68157d081f359f871e0efe0d974dfe53de7d7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/71521
Reviewed-by: Loko Kung <lokokung@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-12-15 00:12:30 +00:00
Austin Eng 5397f9f9d0 Add basic or stub implementations of upstream instance/adapter APIs
Adds upstream instance/adapter APIs. In dawn_native, the basic APIs
to get limits and properties are implemented, but requestAdapter and
requestDevice are not. In dawn_wire, nothing is implemented, but the
stub definitions are put in place, as well the mechanism to inject
WGPUInstance into the wire.

There is a lifetime concern with WGPUInstance and WGPUAdapter on the
wire in that we need to ensure that the client cannot free the
instance or adapter while they are in use. In the near term, this is
not a problem because Chromium will always hold ownership of the
instance and adapters outside of the wire - i.e. it won't inject and
then release ownership.

Bug: dawn:160, dawn:689
Change-Id: Id904272983f23babc9177bc163d78c4fa1044da0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/71520
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-12-14 23:22:46 +00:00
fujunwei d3cac111b6 Template hardcode functions in webgpu_cpp.cpp
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>
2021-12-14 02:20:15 +00:00
Shrek Shao d7304d1971 Further api.h license issue fixes
Beef up the comment in the file to describe what's going on with
the licenses, as well as describe why the generated file is
a different license.

Also move the BSD text to a different file.

Change-Id: I6d08256317f3a0a150e0c35d3d902fceb7dcb44e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/72680
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Shrek Shao <shrekshao@google.com>
2021-12-14 01:06:15 +00:00
Jiawei Shao 1f25ea94bb dawn_wire: Directly use the data in deserialized buffer when possible
This patch tries to use the data directly in deserialized buffer
when the data is "data-only" and doesn't affect the control flow instead
of allocating and copying into a temporary buffer. Due to the protection
of TOCTOU attacks, currently we only set "wire_is_data_only" on the
parameter "data" in Queue.WriteBuffer() and Queue.WriteTexture().

With this patch, the performance of dawn_perf_tests
BufferUploadPerf.Run/*_WriteBuffer_BufferSize_* with "-w" will
be greatly improved (~20%) when the upload buffer size is greater than
1MB.

BUG=chromium:1266727

Change-Id: I7a9d54c9b505975235ee37aa72ee97f082ad3aa3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/72063
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2021-12-10 02:05:28 +00:00
fujunwei a840574db0 Replace hardcode functions in templates
Make dawn_proc.c and dawn_thread_dispatch_proc.cpp flexible

BUG=dawn:1201

Change-Id: Ifca73b33d6aed70b2dda3cf181a4650380f0a2fb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/72065
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>
2021-12-10 01:35:19 +00:00
Austin Eng 63f65465f5 Add a build target for a webgpu_dawn library
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>
2021-12-09 20:03:48 +00:00
Jiawei Shao 264f239259 dawn_wire: Remove unused support of "const*const*"
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>
2021-12-09 02:43:28 +00:00
fujunwei ed33e05db1 Move EnumClassBitmasks from wgpu to dawn namespace
The EnumClassBitmasks is used by dawn/api_cpp.h that needs to be common.
Define a macro to export the operators from dawn to other various namespace.

BUG=dawn:1201
Change-Id: I20badd54e844fead6ecf12546a2c9e0afa2fd83f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/71900
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Junwei Fu <junwei.fu@intel.com>
2021-12-08 05:46:17 +00:00
fujunwei c7d4f2c9f1 Make templates webgpu_cpp.h and webgpu_cpp_print.h flexible
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>
2021-12-07 00:46:35 +00:00
fujunwei 3a464767a5 Make the prefix of proc table configurable in api.json
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>
2021-12-05 05:29:44 +00:00
Corentin Wallez c6d3a840da Replace reinterpret_cast with FromAPI/ToAPI where possible
This brings more type safety to the code and is marginally more
readable.

Bug: None
Change-Id: I0330a8a8e95cd9b8b531af266acd8fdc50c50460
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/71606
Reviewed-by: Brandon Jones <bajones@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
2021-12-03 16:47:18 +00:00
Shrek Shao 2bf99905a7 Fix google3 license related issues
Append BSD license to LICENSE.

Change-Id: Ie6688396bc06cdf4e34add729134454054dd4b31
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/71442
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Shrek Shao <shrekshao@google.com>
2021-12-02 21:25:58 +00:00
Austin Eng 2d0007ca8f Don't connect to backends that aren't needed
Change backend connection in Instance.cpp to store a bitset of
backends that have been connected. This lets us only connect to a
single backend if AdapterDiscoveryOptions are passed explicitly,
and track which connections have/have not been made. Later, we can
connect to the rest of the backends if more are requested.

This is part of some improvements to the existing code so we can
selectively discover adapters and control discovery of the
high-performance, low-power, and fallback WebGPU adapters.

Bug: chromium:1266550
Change-Id: Iceb0d3f71751f5aac6218996ace3cf89deda8a29
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/69521
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-12-02 18:12:57 +00:00
fujunwei 23f71624b3 Add a category named function in dawn.json
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>
2021-12-02 07:41:21 +00:00
Jiawei Shao 6d6b63c470 dawn_wire: Use memcpy in Serializer / Deserializer when possible
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>
2021-12-02 07:29:41 +00:00
fujunwei 4e8769087a Add ability to generate constants from dawn.json
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>
2021-11-25 08:44:01 +00:00
fujunwei 76bda371ef dawn.json changes for the flexible templates
- 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>
2021-11-23 08:47:35 +00:00
Corentin Wallez 61c853276f Make CompilationInfo extensible.
This adds overloads for WireCmd [De]serialization that don't take the
object id provider/resolvers and produce a fatal error as soon as an
object is encountered.

Bug: dawn:1186

Change-Id: I13e796a5d8f59c26279b9079d4496390506c739a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/68941
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
2021-11-16 09:25:35 +00:00
Corentin Wallez 1f05a8540a Reorganize WireCmd.cpp. No functional changes.
- Puts all the macros first, then all the instantiation of macros for
   more clarity of what code actually gets generated.
 - Move ErrorObjectProvider and friend in the anonymous namespace.
 - Give a name to a boolean parameter.

Bug: dawn:1186

Change-Id: I2662ba16bfff23b53342d352d9b7fbd62aabb8c3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/68940
Commit-Queue: Loko Kung <lokokung@google.com>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
2021-11-15 17:58:34 +00:00
Brandon Jones 2514566d82 Make validation error formatting more consistent
- Updates error message formatting to ensure they end with a newline to
   prevent errors from running together.
 - Updated all encoder/device context messages to normalize their format
   and include more information.
 - Update Abseil formatter to make objects indicate if they are an error
   object in the formatted string. (ie: [Invalid BindGroup])
 - Added fallback code in case a context message doesn't format
   correctly to aid in debugging.

Bug: dawn:1154
Change-Id: Id27b11305cf8efcca343597f90489dde5552c775
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/68200
Commit-Queue: Brandon Jones <bajones@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-11-03 01:31:19 +00:00
Austin Eng 3faa478ed2 Add FromAPI / ToAPI helpers for dawn_native
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>
2021-10-27 19:07:37 +00:00
Brandon Jones 7dc906a4c9 Improve validation messages for surface/swap chain
Updates validation messages with more contextual information in:
 - ChainUtils.h
 - Device.cpp
 - SpirvValidation.cpp
 - Surface.cpp
 - SwapChain.cpp

Bug: dawn:563
Change-Id: I486512791caaf1acf4607539aa5ad11daf1ab9be
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/67140
Commit-Queue: Brandon Jones <bajones@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-10-21 19:25:04 +00:00
Zhaoming Jiang 2a5b981a87 Deprecation of using 0 as default size in buffer mapAsync
For size parameter in mapAsync, use wgpu::kWholeMapSize rather than 0 to
indicate using the default size, i.e. remaining buffer size after
offset. Using size=0 is still available but will cause a deprecation
warning.

Bug: dawn:1159
Change-Id: I474d87ecae4a54ceb28d636f883a6233c91f16fa
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/66284
Auto-Submit: Zhaoming Jiang <zhaoming.jiang@intel.com>
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-10-18 05:30:39 +00:00
Corentin Wallez 5497aad240 Improve validation errors for ShaderModule
Bug: dawn:563
Change-Id: I3c0809742f87517456fd8a5f7645005af636fa75
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65801
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2021-10-08 10:16:27 +00:00
Brandon Jones a089e8c4f2 Improve validation errors in CommandValidation
Updates all validation messages in CommandValidation.cpp to give them
better contextual information.

Bug: dawn:563
Change-Id: I6af5b0a0d99218c09ef564039218b3a7fb6a74db
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65607
Auto-Submit: Brandon Jones <bajones@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Brandon Jones <bajones@chromium.org>
2021-10-05 00:34:30 +00:00
Brandon Jones 9b643b72f7 Improve validation errors, Part 3
Modified ConsumedError and TryEncode methods to allow for top-level
error context messages. Applied them to:
 - ComputePassEncoder
 - ProgrammablePassEncoder
 - RenderEncoderBase
 - RenderPassEncoder
 - Device

Bug: dawn:563
Change-Id: I4a989763f57afbcf6b1cfe87ccaaba502ebd29fe
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65101
Commit-Queue: Brandon Jones <bajones@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-09-29 18:39:23 +00:00
Ben Clayton 6e57843e67 Fix build on GCC: Add missing include
Change-Id: Id5c8701a673c8fececb83e94dab909272d2f6c00
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65341
Commit-Queue: Ben Clayton <bclayton@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-09-28 19:52:35 +00:00
Loko Kung 8d195d511d Refactors dawn_native objects for list tracking and adds destroy skeleton API.
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>
2021-09-28 15:40:01 +00:00
Austin Eng 8411a12ab1 Add a mechanism for finding the best tier for a set of limits
Multiple groups of limits may be defined via macros.
ApplyLimitTiers degrades the incoming limits such that
each limit value within a group is clamped to the
best possible tier. A device may be in Tier 2 for one
limit group, but Tier 1 for another limit group.

Also adds equality operators to dawn_native generated structs
for comparison of expected limits in the test.

Bug: dawn:685
Change-Id: Ibdf947f2ccd44f70d66f48bed472ff5681230633
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64720
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Brandon Jones <bajones@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-09-28 01:04:10 +00:00
Brandon Jones ba66295033 Improve validation errors, Part 1
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>
2021-09-23 21:26:33 +00:00
Ben Clayton 999cc24209 Fix all GCC 10 warnings
Change-Id: Ibabab265e734a4a421a38ab586e7e11905fa5da1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64740
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-09-23 17:34:53 +00:00
Kai Ninomiya 7d174a1eff dawn.json changes to match upstream webgpu.h
Bug: dawn:1080
Change-Id: Icc77f8ccd5a07162d0e7795d7160d936f9c33e49
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64620
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
2021-09-21 17:36:27 +00:00
Austin Eng 0c82405aca dawn.json: chained/extensible must be "in" or "out" or false
Bug: dawn:685
Change-Id: I0e63f6f8bfb3edb8e727670ecc2453841f3da513
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64602
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-09-20 16:07:25 +00:00
Kai Ninomiya 930e9186a6 Generate multiple variants of webgpu.h header
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>
2021-09-17 19:44:43 +00:00
Austin Eng bffc966f17 Add wgpuDeviceGetLimits. Split Required/Supported limit structs
Bug: dawn:685
Change-Id: Ibb5dd0479f5e887d4b2ca864c014ebaafb674dba
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64443
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-09-17 15:36:00 +00:00
jchen10 4935c14eec Use WGPU_MIP_LEVEL_COUNT_UNDEFINED instead of 0
The follow up CL will remove 0.

Bug: dawn:1026
Change-Id: Ida62f8d8b0dd8f9722e40f3f95366d3db0c7ab52
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64164
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jie A Chen <jie.a.chen@intel.com>
2021-09-15 06:27:25 +00:00
jchen10 96ac969a33 Use WGPU_ARRAY_LAYER_COUNT_UNDEFINED instead of 0
This seperates the undefined 'arrayLayerCount' from 0 to
WGPU_ARRAY_LAYER_COUNT_UNDEFINED. So 0 arrayLayerCount is treated
as a validation error.

Bug: dawn:1026
Change-Id: I7b4ae024b02ac0d2aa260b2a8c64b09bd967db87
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63660
Reviewed-by: Jie A Chen <jie.a.chen@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jie A Chen <jie.a.chen@intel.com>
2021-09-14 02:41:49 +00:00
Austin Eng 02fbf168e0 Add validation, storage, and querying of limits
Adds a way to store the limits on the Adapter and the
Device. For now, adapter limits are always the default
limits, and device limits are stored but not used.

This CL also adds usage of an ErrorObjectIdResolver and
Provider in the WGPUDeviceProperties serialization and
deserialization helpers. Serializing/deserializing this
struct should never have objects.

Bug: dawn:685
Change-Id: I1479b4407b0f9ec9f9b2bff62cad7caa693c99d7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63983
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-09-13 18:49:09 +00:00
Austin Eng dc7971ce58 dawn_wire: Support deserializing s->c chained structs
Chained structs *may* contain objects which means
deserialization may need an ObjectIdResolver.
However, in practice, we never need to send chained
structs from the server to the client that contain objects for
a valid command.

The one upcoming need for chained server->client structs is to
serialize limit structs.

Because limit structs never need objects, we provide a dummy
implementation of the ObjectIdResolver which always yields an error.
An analogous change is done for ObjectIdProvider.
These classes will be used in a follow-up CL.

Bug: dawn:685
Change-Id: I1c0f3f2d080377f2e1a77bc6e896f24d3d9ab931
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63981
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-09-10 20:36:20 +00:00