The * and & operator grammar was updated in the spec to closer
match other languages. This CL updates the Tint WGSL parser to
match the current spec.
Bug: tint:1756
Change-Id: I81b7c373bbd6a540b9273813c63a29487e2907ce
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111580
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Can be run with:
./tools/run git-stats
Change-Id: Ie46be01ff3318ff50acdb13eb809d5304f867f04
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111180
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Don't return a raw pointer to the map entry's value, instead return a new Reference which re-looks up the entry if the map is mutated.
Change-Id: I031749785faeac98e2a129a776493cb0371a5cb9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110540
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Enums are scientifically proven to be 96.4% better than a bool for parameters.
Also throw in kConst because we can.
Change-Id: I788504d8d452d6a879d2d675891e3171db6a40f2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111244
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
The `line`, `lineadj` and `point` reserved words were removed from
the spec. Update Tint to match.
Bug: tint:1769
Change-Id: I219bcf1d6053013133b8e369bb01c86af7bb9193
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111320
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
This fixes the build on certain macOS systems.
Change-Id: Ifac6d77c81982d0f147dd8197cf68a33d5cc909e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111480
Kokoro: Kokoro <noreply+kokoro@google.com>
Auto-Submit: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: James Price <jrprice@google.com>
This is reserved in C++, and triggers a warning-as-error for gcc
Change-Id: I0595977e690f9e0e7d5e1b6dd1fdeb74183fc378
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111440
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Ben Clayton <bclayton@google.com>
Check that these work as a mix of constant and runtime.
Bug: tint:1581
Change-Id: I572122d9425c4bb8e60125879f9829d765580d1f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111243
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
This CL removes support or if-break and requires the use of break-if.
Bug: tint:1724
Change-Id: I8311de2f0ce11b5af7fada71d258ae441f9e42f8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111100
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
This CL adds the machinery to emit binary operations to the IR. The
debug helper is split into Debug and Disassembler. The Disassembler is
used to help test the IR output.
Bug: tint:1718
Change-Id: Iffdd3be92e69a87828655ac41be91b34d5618174
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110841
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
This CL updates the if and switch nodes to store the condition value in
a register. The EmitExpression is updated to return a Register and the
builder updated to emit the expressions for the if, break-if, while,
and switch expressions.
Bug: tint:1718
Change-Id: Ie710812c74e8b9423a4aa997db451d9cdf304feb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110784
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
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>