Commit Graph

6359 Commits

Author SHA1 Message Date
Shrek Shao 286061d810 Update default value for map range size to WGPU_WHOLE_MAP_SIZE
Bug exposed by emscripten webgpu binding issue.

It seems the spec updated after the last code updates. Update the
validation part a bit (introduce rangeSize).

Bug: dawn:1400
Change-Id: I0ddefd5c1a0976cc34102a44514bccd70f7a1ac0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/88080
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Shrek Shao <shrekshao@google.com>
2022-04-29 18:12:17 +00:00
Brandon Jones 3daebe896f Deprecate dispatch* in favor of dispatchWorkgroups*
In https://github.com/gpuweb/gpuweb/pull/2689 both dispatch and
dispatchIndirect were renamed to dispatchWorkgroups and
dispatchWorkgroupsIndirect in order to clarify the meaning of the
arguments.

Change-Id: Iadb9d8b60c43445a69f9c569fba2340b5dca95a9
Bug: dawn:22
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/88364
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Brandon Jones <bajones@chromium.org>
2022-04-29 17:51:54 +00:00
Stephen White a734f81922 OpenGL: skip depth and stencil tests if readback is unsupported.
Add appropriate toggles.

Change-Id: I99906d1622f4c30b364ba8a9d7d808faa0203e1d
Bug: dawn:667
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/88360
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2022-04-29 11:57:45 +00:00
Ben Clayton 2fb28e008d tools: Extract getDawnRoot() from run-cts to utils
This is needed elsewhere.
Rename location.go to paths.go, as this is really dealing with file
paths.

Bug: dawn:1342
Change-Id: Ifdbfafc0fd763ac7ec2b8f692efc35772c4793da
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/87704
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-04-29 11:18:43 +00:00
Ben Clayton ad0602fbf2 dawn/native: Fix a bunch of GCC warnings
GCC is warning that the switch cases do not have a 'default' clause, and so control flow can reach the end of the function, which does not have a return.

Change-Id: I45465e7f9547d683ea7eb5f356b80a77e6d95d73
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/88310
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2022-04-29 11:07:33 +00:00
Ben Clayton 9432887ce8 tint/sem: Add abstract int and float types
Bug: tint:1504
Bug: tint:1516
Change-Id: I7dafaade903c85a6bd6ed095d0d7545de2f238a7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/88309
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-04-29 09:14:15 +00:00
James Price 26ebe5ec36 tint: Refactor if-else statement representation
Instead of using an `if` node that has a list of `else` statements,
make each `if` statement have a single optional `else` statement,
which may itself be an `if` statement (or just a block statement).

This better matches the WGSL grammar (now that we have removed
`elseif`), and simplifies various pieces of code that handle these
statements.

Change-Id: Ie4272f1422224490ac598a03aa8b4dd00ba03010
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/87940
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: James Price <jrprice@google.com>
2022-04-29 00:14:53 +00:00
Austin Eng 7e03dc7f63 Fix 64 to 32 bit narrowing in dawn/utils
Bug: dawn:1377
Change-Id: Iece057afeeca43092e5e16d7f00d2388dde31d13
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/87673
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2022-04-28 22:27:53 +00:00
Loko Kung 04912aa836 Add multiple device testing capability in DawnTest.
- Factors out device creation code to helper.
- Updates callbacks and test infra to support different devices and use mock callbacks.
- Updates some tests that were using outdated device lost callbacks and multiple devices.

Change-Id: I4210280420b8dadbc6355d27995ccf0cd864108c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/87480
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Loko Kung <lokokung@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-04-28 21:55:33 +00:00
Corentin Wallez bd8de5d2a4 Add MetalRenderR8RG8UnormSmallMipToTempTexture workaround
This workaround replaces the toggle that forbids creating mipmapped
R8Unorm and RG8Unorm textures on Metal. Instead it adds a Metal render
pass workaround that renders to a temporary texture under certain
conditions, then copies back to the correct mip level.

The texture lazy-clearing code is also changed to use the helper that
does workarounds for Metal render passes.

A test is added that triggers the issue with a small amount of code, but
more extensive coverage is left to the CTS. For example texture_zero
tests caught multiple issues during the creation of this CL.

Bug: dawn:1071

Change-Id: I7ef1151524e71e5a9a8e8f5205d9b554bee438b3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/87864
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-04-28 19:00:53 +00:00
Ben Clayton 01004b7732 tint: Remove '_type' suffix from file names
These suffixes existed because the GN build errored when there were two files sets with the same name (ast + sem).
This is no longer required as the GN build splits these into two separate targets.

Change-Id: Ib451da33a5f4aa5c867cb99419dd252766dc3daa
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/88308
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-04-28 18:49:04 +00:00
Ben Clayton 7e8df044c6 tint/writer/spirv: Replace Operand with std::variant
Operand is just a tagged union of uint32_t, float and std::string.

Use std::variant for this.
Reduces memory size, and removes the need to always construct an empty string when the operand is float or int.

Bug: tint:1383
Change-Id: I02fc10137d6fab410ea25a8d6c6e279b882b2287
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/88302
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-04-28 18:40:03 +00:00
Austin Eng b0b53ba403 Fix 64 to 32 bit narrowing in dawn/common
Bug: dawn:1377
Change-Id: I25981cf18dc768cc0b6d4f6a6463b4dc169ca6c1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/87672
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
2022-04-28 17:58:33 +00:00
Ben Clayton 617570a7da tint/writer: Replace scope_stack_, fix type ctor scoping.
ScopeStack is not needed here - the resolver already provides variable scoping with the sem::Variables.

Re-purpose scope_stack_ for a stack of Scope, which now holds the type constructor -> SPIR-V ID map.
This map needs to be per-scope, to fix issues like crbug.com/tint/1520

Fixed: tint:1520
Change-Id: Ifa7749338abf63652a1369e76cf5400be1c37298
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/88301
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-04-28 16:23:03 +00:00
Corentin Wallez e8592a4913 GN: Rely on the Chromium macOS deployment target again.
Chromium requires macOS 10.11 so we no longer need to special case this
in Dawn for Metal support anymore.

Bug: None
Change-Id: Ib5dee5464a3ec27abdd0f5c62e51caa42171fadb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/88303
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2022-04-28 15:35:13 +00:00
Ben Clayton e85fe161cd tint: ProgramBuilder: Rename Const() to Let()
These methods produce `let` declarations.
With creation-time expressions, we'll need to add `const` declarations.

Note that module-scope `let` declarations have been removed in the spec (for `const`). ProgramBuilder::GlobalConst() has not been renamed, although it still currently produces 'let' declarations.

Bug: tint:1504
Change-Id: I34f6d62236f0572163fc9c2d8fddfe4503817422
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/88305
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
2022-04-28 14:35:04 +00:00
Ben Clayton 046abc08e8 tint/writer: Replace use of strings for cache keys
Concatenating strings to use for cache keys is horribly inefficent and very error prone.

Add a UnorderedKeyWrapper helper to allow types to be used as a unordered_map and unordered_set key. Use this for the type_constructor_to_id_ map.

Produces SPIR-V with some duplicate SPIR-V instructions for constructors removed.

Change-Id: Ib072d485ca28bb07f03e979c133cdce1f69ee482
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/88300
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
2022-04-28 13:08:22 +00:00
Ben Clayton bd18618bf6 tools: Move go.mod & go.sum files to root
Go tooling does not work properly when modifying go files in subdirectories from the root of the IDE.

Consolidate the two go modules in the source tree.
We'll eventually want to move `src/dawn/node/tools` to `tools/src`.

Allows us to type `go test ./...` at the root, and test all go code in
the entire repo.

Bug: dawn:1342
Change-Id: Ie3dd2c89a769cd25c2b68884970ef0f2ba8c7560
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86532
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2022-04-28 09:51:03 +00:00
dan sinclair f7ec85f9bd Rename UniformConstant to Handle.
The UniformConstant storage class was renamed to Handle in the WGSL
spec. This CL updates Tint internals to match.


Bug: tint:1138
Change-Id: I93ec581575955ab6830eb8aea44f74dbc28e9ef5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/88280
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-04-28 09:48:26 +00:00
Ben Clayton 6bdd6592d9 DEPS: Update Dawn standalone toolchains
Roll chromium/src/build       c7876b5 .. 87b04ad
Roll chromium/src/buildtools  e1471b2 .. f0d740e
Roll chromium/src/tools/clang df9b14e .. 3c4a622

Required to roll ANGLE as it now uses new Clang flags.

Change-Id: I55caa9892ff65ebc4852b2d49df88908ee1ca3e7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/88221
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-04-28 08:26:23 +00:00
Loko Kung 928a7d1e93 Fix freed memory access due to DestroyObjects.
- Use a while loop to pop the list instead of iterating it and deleting at the same time.
- Adds regression tests to verify that the fix works.

Bug: chromium:1318792
Change-Id: I84fb494c64b07d3e1bd2b5b3af7cb9f82eee28b0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/88043
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Loko Kung <lokokung@google.com>
2022-04-28 02:54:43 +00:00
Brandon Jones d44e7b3b0a Surface D3D12 validation messages in WebGPU errors
This change ensures that when errors are raised from WebGPU, including
lost context errors, they can include any associated D3D12 validation
layer messages in the message text if backend validation is enabled.
This will allow these messages to be surfaced in places like when
running CTS tests on browser build infrastructure.

Also makes a minor adjustment to how HRESULT codes are reported so that
they're easier to read.

Bug: dawn:1396
Change-Id: Ib5c039157c57e6926bc82941a68be03e33e9084c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/88044
Commit-Queue: Brandon Jones <bajones@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2022-04-28 01:06:53 +00:00
Austin Eng 5441f45b41 Fix 64 to 32 bit narrowing in dawn::wire
Bug: dawn:1377
Change-Id: I310daeb99de986389e79282b99006e95964149ea
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/87671
Commit-Queue: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Loko Kung <lokokung@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2022-04-27 20:02:03 +00:00
Stephen White 79c217ba36 OpenGL ES: implement support for BGRA textures and reads.
ES requires GL_EXT_texture_format_BGRA8888 or GL_APPLE_texture_format_BGRA8888 to create BGRA8 internalFormat textures, and GL_EXT_read_format_bgra to read from them. Desktop GL can swizzle back and forth from RGBA8, so keep using RGBA8 if the extension is unavailable.

Intel's implementation of GL_EXT_texture_format_BGRA8888 on ES is broken, and won't create GL_BGRA8_EXT or GL_BGRA internalFormat textures, so disable the test there and modify another test to not use BGRA textures.

Change-Id: Ia81d9ff20e2849b00379f8e01fb5d2ecfa34bd53
Bug: dawn:596, dawn:1393
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86744
Commit-Queue: Stephen White <senorblanco@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-04-27 19:45:33 +00:00
Corentin Wallez dc87f2ac66 Metal: Move Metal render pass workarounds to UtilsMetal
In follow-up commits these workarounds will be used in more than just
the CommandBuffer but also for lazy-texture clearing. In this CL the
helpers are just moved and changed to take `encodeInside` as a
std::function.

Bug: dawn:1071

Change-Id: Ib3b90826c89e12edca41223b3c8b5a4cfc6fed04
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/87863
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-04-27 17:31:43 +00:00
Corentin Wallez 646ba4e716 Remove test suppressions due to SPIRV-Cross
Bug: dawn:259, dawn:945, dawn:571
Change-Id: I0c6da9c186697396c42a7e6416b9f66c51440633
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/88002
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-04-27 11:15:12 +00:00
Zhaoming Jiang 3b1e30a496 tint: Add `i` suffix and validate UInt literal non-negative
In this patch, `i` suffix for SInt literal is added, making `-234i`
valid. Meanwhile, validation of UInt literal must not be negative is
add, making `-42u` invalid with proper error message.

Bugs: tint:1514, tint:1515
Change-Id: Idd0e9ae5649a62e7d348c29f95c2570049653bd8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/88140
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
2022-04-27 10:48:12 +00:00
Zhaoming Jiang 7098d3d692 tint: Add enable directive for extensions
In this CL the enable directive is implemented.
1. Add AST node for enable directive, assign a ExtensionKind (enum) for
each supported extension.
2. Use an unorder_set in ast::Module to record all required extensions'
kind.
3. Provide inspector methods for getting names of used extension, and
getting all used enable directives' extension names and location.
4. For different writer, the extension nodes are handled in different
ways. MSL and HLSL writers will just ignore the extension nodes, while
SPIRV and GLSL writers will emit corresponding code.
5. Implement unittests and end2end test for enable directive and
inspector, using a reserved extension name `InternalExtensionForTesting`.

Bug: tint:1472
Change-Id: I40cb4061554deb477bc2005d7e38c9718385f825
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86623
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
2022-04-27 02:27:52 +00:00
Loko Kung f92040a3d9 Remove PersistentCache and suppress shader cache tests.
- Removed to allow for easier development changes to caching interface as it is implemented for pipeline caching without having to keep supporting this incomplete feature.

Bug: dawn:549, dawn:1341
Change-Id: Id27deca45ac5607a4a6a7a016b19e3d60693ed72
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/87610
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Shrek Shao <shrekshao@google.com>
Commit-Queue: Loko Kung <lokokung@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-04-27 01:25:12 +00:00
dan sinclair d3a5080c7b Fixup validator tests added during split from resolver.
This PR adds the validator_is_storable test into the CMakeList file
correctly and removes the helper files. The resolver helper is used
instead and a test helper to return the validator added into the
resolver.

Change-Id: I5b18bcc6373e3b39807af05cf5c058fab61ed4ca
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/88041
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-04-26 22:19:22 +00:00
Corentin Wallez f49fbbfb88 DawnTest: handle buffer readbacks not aligned to 4.
Bug: None
Change-Id: I69e8b9a9c0eae5d0287351cacbe21e550741cacc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/87861
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Loko Kung <lokokung@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-04-26 17:02:42 +00:00
Ben Clayton 1d882f55b7 Revert "Add External Texture Gamma/Gamut Correction"
This reverts commit 857175e59b.

Reason for revert: Suspected change for Dawn -> Chromium roll failures:

* https://chromium-review.googlesource.com/c/chromium/src/+/3607875/
* https://ci.chromium.org/ui/p/chromium/builders/try/mac-rel/982037/overview
* https://chrome-public-gold.skia.org/search?issue=3607875&crs=gerrit&patchsets=3&corpus=chrome-gpu


Original change's description:
> Add External Texture Gamma/Gamut Correction
>
> Adds configurable gamma and gamut correction in Tint's external texture
> transform. Adds constants in Dawn to perform correct conversion from
> BT.709 to sRGB.
>
> Bug: dawn:1082
> Change-Id: Id5eecc37f0224541bf36e2f9757e7e2047e4b66b
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/87666
> Kokoro: Kokoro <noreply+kokoro@google.com>
> Reviewed-by: Ben Clayton <bclayton@google.com>
> Commit-Queue: Brandon1 Jones <brandon1.jones@intel.com>

TBR=cwallez@chromium.org,enga@chromium.org,brandon1.jones@intel.com,bclayton@google.com,noreply+kokoro@google.com,dawn-scoped@luci-project-accounts.iam.gserviceaccount.com

Change-Id: Id3880e506172a18ff1258462c8c4cedb5c51c235
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: dawn:1082
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/88001
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-04-26 12:20:02 +00:00
Ben Clayton b84c0b9adf dawn/common: Comment UNIMPLEMENTED()
This macro does not exist in this scope.
This was added in https://dawn-review.googlesource.com/c/dawn/+/87600, but was previously a comment.

Should fix dawn -> chromium roll

Bug: dawn:1339
Change-Id: I8457e1ae14b0c199f32f9c1a8b7487b6a8c8120c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/87921
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-04-26 08:17:17 +00:00
Corentin Wallez 53f0723460 utils: Add more defaults for CreateBuffer/TextureImageCopy
Bug: None
Change-Id: I90c7d8486702585fca497e5063eecc163769a13e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/87862
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-04-26 08:09:41 +00:00
Loko Kung 7b20709d0e Fixes serialization of RenderPassCacheQuery struct.
- Since we were recording everything, the sparse representation caused uninitialized data to be recorded in the cache key causing cache key inequality at times.

Bug: dawn:549
Change-Id: I7dc3ea34a7dd91addc7b5ca52c79b3354733966b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/87609
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Loko Kung <lokokung@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-04-26 01:39:41 +00:00
Ben Clayton f4a861dd60 tint/fuzzers: Build protobufs after remove_stale_autogen_files
Add deps to remove_stale_autogen_files to make sure
tint_ast_fuzzer_proto runs after remove_stale_autogen_files run.

Bug: crbug.com/1314527
Change-Id: I01cb469289eae83b04c9b442f97d4eef0139ec81
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/87922
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-04-26 00:12:27 +00:00
Enrico Galli b52d740227 D3D12: Indirect validation shader name cleanup and parameter merge
Bug: dawn:548
Change-Id: Id2bf9c54e10ba791e5878844a0fe98efd4fc85d6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/87705
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Enrico Galli <enrico.galli@intel.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-04-25 23:28:24 +00:00
Brandon Jones 857175e59b Add External Texture Gamma/Gamut Correction
Adds configurable gamma and gamut correction in Tint's external texture
transform. Adds constants in Dawn to perform correct conversion from
BT.709 to sRGB.

Bug: dawn:1082
Change-Id: Id5eecc37f0224541bf36e2f9757e7e2047e4b66b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/87666
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Brandon1 Jones <brandon1.jones@intel.com>
2022-04-25 22:22:51 +00:00
Ben Clayton 67af208758 GN: Move dawn import into build_with_chromium cond
The import target does not exist in the tint repo.
This import is only used inside the `build_with_chromium` condition, so move the import into the condition.

Bug: crbug.com/1314527
Change-Id: I20051d63df9134e2dc5773f26cf2f8ee4df2354e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/87860
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-04-25 22:01:48 +00:00
dan sinclair 617583e30b Use the CTS --quiet flag.
This PR adds the --quite flag into the CTS runner command line. This
will suppress the summary information and the duplicate failure
information as it's already output by the run-cts test runner.

Change-Id: I4e885d416c7ab679551e76f3fc702aa7b5a3535f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/87900
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-04-25 20:24:41 +00:00
Antonio Maiorano 25775308a9 Implement support for Unicode Pattern_White_Space
Bug: tint:1505
Bug: tint:1513
Change-Id: I40fa29c766dc35213e0846071322523e7fc81b79
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86402
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-04-25 19:49:01 +00:00
dan sinclair cc74dc3dda run-cts split output to only colour titles.
Currently the entire block of output gets coloured in the CTS output.
This can lead to giant blocks of red and green on the screen which is
hard to read. This PR changes the output to only colour the title and
leave the message the default colour.

The skip colour of blue was changed to cyan as the blue was showing as
red on my terminal which makes it appear as an error instead of a skip.

Change-Id: Idb4fc053bb83c710871f75b997e1fc3e3fdea695
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/87679
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-04-25 12:15:44 +00:00
Jiawei Shao bd0f0a279c Don't expose internal buffer usages in error messages
Previously the error messages about buffer usages would also include
the internal ones that are not set by the base WebGPU API (e.g.
kInternalStorageBuffer is showed when the buffer usage includes Indirect
or QueryResolve), which may confuse the developers.

This patch fixes this issue by implementing Buffer::GetUsageExternalOnly()
for front-end validations which only return the usages with which the
buffer was created using the base WebGPU API.

BUG=dawn:1382

Change-Id: Ie13135efaf2c3dab729d75a80eff486efa525c7e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/87382
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-04-25 08:38:17 +00:00
Stephen White 790e4c2d60 GLSL writer: emit gl_PointSize = 1 in all vertex shaders for OpenGL.
The OpenGL ES 3.1 spec says:

"The point size is taken from the shader built-in gl_PointSize written by the vertex shader, and clamped to the implementation-dependent point size range. If the value written to gl_PointSize is less than or equal to zero, or if no value is written, the point size is undefined."

ANGLE/D3D11 will emit a warning on this and abort processing, causing dawn_end2end tests to fail.

Bug: dawn:1390
Change-Id: I6a56467842ba80d8a070af7240ee07bb111089dd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/87720
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2022-04-22 21:25:02 +00:00
James Price e6d7ea708a tint: Use resolved source var in the Inspector
This replaces the manual AST traversal code that was used to determine
the originating resources for textures and samplers.

Change-Id: I463e9dac836ab5d42d9b5559cda5cd35b154e588
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/87608
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2022-04-22 17:40:33 +00:00
James Price a9d8da4434 tint: Use resolved source var in LocalizeStructArrayAssignment
Fixed: tint:1341
Change-Id: Ic88623bd5891d3d7d32400825e02122c36102803
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/87607
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2022-04-22 17:40:33 +00:00
James Price 98eb169692 tint: Track originating variables in the resolver
Attach the source variable to the sem::Expression nodes.

Bug: tint:1341
Change-Id: I71d8fcf5920c4daab9035c7a5615b34378889dac
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/87606
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-04-22 17:40:33 +00:00
Antonio Maiorano eba0e85c33 tint: make Lexer use line breaks from Source::File
Before this change, we duplicated line break parsing in both
Source::File and Lexer. This change makes it so that the Lexer no longer
looks for line breaks, instead relying on Source::File for this info.
This de-duplication will also help in implementing the latest spec
changes with respect to line breaks (CRLF vs CR, etc).

Bug: tint:1505
Bug: tint:1513
Change-Id: Ifa820f75ede7e82822525282127e05d2fea047e1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/87604
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-04-22 15:34:21 +00:00
Fumitoshi Ukai a238e7bf9d tint_generator_wgsl_corpus should wait for remove_stale_autogen_files
remove_stale_autogen_files will remove files in
gen/third_party/daw/src/tint/fuzzers, so build
failed flakey with no such file under this directory
if remove_stale_autogen_files run after tint_generator_wsg_corpus
action.

add deps to remove_stale_autogen_files to make sure
tint_generator_wgsl_corpus runs after remove_stale_autogen_files run.

Bug: crbug.com/1314527
Change-Id: Ic072d1c80719cd1c1cf29b1ad4463792018ebb94
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/87680
Auto-Submit: Fumitoshi Ukai <ukai@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-04-22 10:08:52 +00:00
Stephen Gutekanst c2f9fea56b dawn/native: Fix undefined behaviour in BindGroupTracker when passing no dynamic offsets
In [Mach engine](https://machengine.org), we compile Dawn's C++ sources using Zig as the C/C++
compiler and Zig's build system (we don't use Dawn's regular build system.) Zig uses clang
with UBSan enabled by default: this caught this instance of undefined behavior, where passing
no dynamic offsets would result in memcpy being called with size 0.

We've encountered at least [one other instance of undefined behavior](https://github.com/hexops/mach/issues/239)
via UBSan in addition to this one, which I will send another CL to fix soon. I'll also verify
we don't see any other instances of UB.

Bug: dawn:1371

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
Change-Id: Ifc3b938e990b6a0a3b203796ea99ee5abb9a4a09
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/87380
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2022-04-22 04:53:21 +00:00