This patch updates the validations about CreateBuffer() with dawn_wire
to match the latest WebGPU SPEC.
According to the SPEC, the validations in CreateBuffer() should be
executed in the below order:
1. If mappedAtCreation == true, return nullptr and a RangeError will be
generated in Chromium.
2. Validate BufferDescriptor and check if there is OOM at device timeline
3. Check if there is OOM at content timeline
Bug: dawn:1586
Change-Id: I97ff5f82a42208442ddf6e46e66381c3b3680450
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/109040
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
This CL updates the SPIRV-Reader to emit `break-if` nodes instead of
`if-break` statements.
Bug: tint:1724
Change-Id: I8cd568f5e90a950acc5a42a470345273a5f1e6bc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111103
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
This CL fills in the EmitLiteral method. Each literal is emitted as the
appropriate type of register. The literal is not added to the current
flow block as it is not yet used.
Bug: tint:1718
Change-Id: Ic6a576bcc08dc6ea251b60d1d079929ac4d97981
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110783
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
dawn.node now uses tint::Initialize() and tint::Shutdown(), and so
needs to link against libtint.
Fixed: tint:1765
Change-Id: I03e575b4709c43a6052ed3ca635376251c3323c0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111080
Auto-Submit: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Pads serialized wire command buffers to 8 bytes so that we don't have
misaligned write/reads which can cause SIGILL depending on platform and
compilation mode, i.e. -c dbg in google3 builds.
- Adds helpers for aligning sizeof calls.
- Adds constant for wire padding (8u).
- Modifies BufferConsumer to allocate according to padding. This
guarantees that when we [de]serialize stuff, the padding should be
equal on both sides.
- Modifies extra byte serialization code (adding CommandExtension
struct). This makes it clearer that each extension needs to be
padded independently. Otherwise, before in wire/client/Buffer.cpp,
since the read/write handle sizes were being passed as a sum, but
read out separately from the BufferConsumer, we corrupt our pointers.
- Adds some simple unit tests.
Bug: dawn:1334
Change-Id: Id80e7c01a34b9f01c3f02b3e6c04c3bb3ad0eff9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110501
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Loko Kung <lokokung@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Adds tint_public_config to Dawn's internal config so Tint headers
can be included.
Fixed: dawn:1594
Change-Id: I4068fd95b6eae3138fbcc04f29f054c7cffdcf12
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111260
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Shrek Shao <shrekshao@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
Kokoro: Austin Eng <enga@chromium.org>
Sync up with current WebGPU spec to allow FS input being a
subset of VS output instead of requiring a strict match.
This patch involves changing the validation and adding tests,
together with using the TruncateInterstageVariables for hlsl
generator to workaround the extra limit for D3D12 backend.
Bug: dawn:1493
Change-Id: I2d4ba7f43dbe57f17ecd5c5d659f4ca93bb682a3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/109460
Commit-Queue: Shrek Shao <shrekshao@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Shrek Shao <shrekshao@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Add a transform to truncate unused user interstage variables by
adding a new truncated shader io struct wrapper of the original
one, with a truncate function to do the assignments called
at the return statement.
This transform is meant to be run after CanonicalizeEntryPointIO,
and will only be run under hlsl/generator_impl.cc to workaround
the extra register limitation for interstage variables on D3D FXC.
Bug: dawn:1493
Change-Id: I69081189ad7d4b76f2371fcc079f67dced2e9944
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/104620
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Shrek Shao <shrekshao@google.com>
This CL adds a class to store register information for the IR. The
register can hold various types of data depending on if it's a f32, i32,
temporary, etc register.
Bug: tint:1718
Change-Id: I025af70f2b145c9697f1d7f996d0e98022eea829
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110782
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
This CL updates some grammar in break-if error messages.
Change-Id: I15ab6b98fd1b12dd4e6db16a28f0e311e9fee453
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111102
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
And add basic support for builtins returning structures.
Bug tint:1581
Change-Id: I67f987339b9a344e1915c69c9991803f0665305d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111242
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Calling UnmapInternal would set the state to Unmapped, allowing the
buffer to be mapped again even though it is destroyed.
Bug: chromium:1388920
Change-Id: Ibb4da332bafd44a0d4900c8ea5bfbd674bbc35e0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111121
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Loko Kung <lokokung@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
This CL renames the `Build` method in the test helper to be
`CreateBuilder` to maek the intention clearer. A second,
`CreateEmptyBuilder` is provided to allow for easier testing of
expressions.
The `current_flow_block` and `builder` are moved to public so they can
be used/updated during testing.
Bug: tint:1718
Change-Id: I663d4c7a3c76e6bf5396ca05f54fe634d35d0d56
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110781
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
This CL adds commented out blocks for the various switches required to
walk the AST.
Bug: tint:1718
Change-Id: I70e7c4d0168621bf97006a782f2942df1173c393
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110780
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
- Messed up the conditon in previous change so it required both the
enable flag to be on and the disable to be off, but then we can't
deprecate the enable flag in Chromium.
Bug: dawn:549
Change-Id: I1c730939104aafaef48182238fa32ed7fa6a1e16
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110983
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Loko Kung <lokokung@google.com>
- The disable toggle will supercede the enable one once Chromium side
deprecates usage of the enable one.
Bug: dawn:549
Change-Id: I5c5bd60161917fe2654cfce55a6f29e8a7e79962
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110728
Commit-Queue: Loko Kung <lokokung@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
The `forced` parameter is always false, remove it.
Change-Id: I9aa16dfc6a51516f6b6e619a3c8ce982a25ba4c4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111101
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
A simple tool to benchmark tint based on a template file.
Bug: tint:1122
Change-Id: I34ee0fb98e6d2187c145cc38ec3cb48606242cb4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110820
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Update CreateASTTypeFor() to handle a potential edge-case described in tint:1764.
We haven't seen this issue happen in production, nor can I find a way to trigger this with the tint executable, but try to handle this before we encounter a nasty bug.
Fixed: tint:1764
Change-Id: I496932955a6fdcbe26eacef8dcd04988f92545a1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111040
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
This CL adds const-eval for `degrees` and `radians`.
Bug: tint:1581
Change-Id: I7f00e2b1e5ab7c8e895680a6b75b9531dac31f5a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110601
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
And add tests.
This is useful for other tooling.
Change-Id: Ia399071baf6d4bb617f3c73e4ccd4ed72d522c2e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111020
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
There's a reason the overload of `ctx.Replace()` that takes a pointer to the replacement is deprecated - it doesn't play well when used as part of another replacement.
Switch to using the callback overload of Replace() to fix bad transform output.
Bug: tint:1386647
Change-Id: I94292eeb65d24d7b2446b16b8b4ad13bdd27965a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111000
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
...now that we correctly fail on inf/nan. Also fold separate error test
functions into SmoothstepCases.
Also fixed atanh, acos, acosh, and asin tests to properly test error
cases for all float types, not just abstract float.
Bug: tint:1581
Bug: tint:1747
Change-Id: I63bd57d36beab4cc7dde501183052aa688e2efdb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110727
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
This is a catch-all that handles all cases where an operation can result
in non-finite values, such as from calls to std::cosh and std::sinh.
Bug: tint:1581
Bug: tint:1747
Change-Id: Ibb55466fea01b263c98d598459c788fd22cf5bb7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110726
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
For example, a large f32 value converted to f16 now fails, instead of
resulting in +/-inf.
Bug: tint:1581
Bug: tint:1747
Change-Id: I30fd8c61ecc328206e8f73b626af8046dad4b0b9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110723
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Cache .json files are generated at build time. This relies on a
list of the expected cache outputs.
The path to the cache is hardcoded in the test_runner and the
.json files are loaded at runtime.
Change-Id: Icc125125df7e9c338a243526dbc4950a2517039f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110441
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
This will be required to use the new data-caching functionality provided by:
https://github.com/gpuweb/cts/pull/1985
Also propagate `--verbose` down, if passed to the frontend.
Change-Id: Ic436e8ed754296cec859c45bd4db703634c31ab1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/109764
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
The SingleEntryPoint transform currently does not strip away any
unused type declarations, which was leading to broken code when an
alias referenced an override that was removed. We can detect this
scenario and remove such aliases, until we have a better mechanism for
detecting all unused aliases.
Fixed: tint:1763
Change-Id: I319ff30b5e52d7dd54596cc99a2201a708c502f2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110725
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>