Move the use of absl::from_chars() in the WGSL parser into utils, behind
a new abstraction.
If we decide one day to drop the absl dependency, we can reimplement
this function. It also consolodates tint source_set dependencies on absl
to the common utils module.
No new tests as this is a thin wrapper around an existing
implementation, and the single use is already heavily tested for parsing.
Change-Id: I1ce5d68857e81299d1c97322b0ec28f0a83a31b7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/134581
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Add utils::Split(), utils::Join() for splitting and joining strings with
delimiters.
Add options to SuggestAlternatives().
Add Quote() for surrounding a string with '.
Requires some include shuffling and minor tweaks to other utilities.
Change-Id: If75058e68cd986450fecc0b27bcc9a94c765a665
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/134580
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
We have to invent a header block and use that as the target for the
back-edge, and also make sure we always emit the continuing block with
a back-edge even when it is unreachable.
Bug: tint:1906
Change-Id: I1e66f5e7a54a01fbd7ac74865fa25d179a7ef5f5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/134561
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
User can create texture for external ID3D11Texture which may
already be set debug label with SetPrivateData() call. It will cause
debug layer warnings, so ignore it.
Bug: dawn:1705
Change-Id: I8090a64eb54275f338e5c0423941705a568560d1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/134700
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Peng Huang <penghuang@chromium.org>
Adds the CopySrc and CopyDst usages to swapchain textures when
available in backends so that the wgpu::Texture returned from
GetCurrentTexture can be used in copies.
Also adds a swapchain tests to check that these usages indeed
work.
Bug: dawn:1551
Change-Id: I8495075b0bfb5b8dd953a7811a9d75a76096b143
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/133464
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Add support for `abs()`, `max()`, and `min()`. Import the GLSL
extended instruction set the first time it is needed.
Move testing utilities from the binary tests into the base test helper
class, as they are more widely useful.
Bug: tint:1906
Change-Id: I5faa928b98c621afcca770cb14a8f9c06f36bcfe
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/134521
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
Otherwise for non-constant initializers the var instruction will
reference the result of an instruction that comes after it.
Bug: tint:1718
Change-Id: Ie8c6c900768277c344f1e1304b0812a546c889a6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/134560
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
This CL adds a `NextIteration` instruction in order to branch from a
continue block back to the start of a loop. The `next_iteration` is
clearer then the `break-if false` pattern that was there previously.
BreakIf is retained and used when an `ast::BreakIf` is encountered as
it's clearer then the replaced `if` structure.
Bug: tint:1718
Change-Id: Ie6ce0db51c244866e2e99118bc00e4cfd2b3dc74
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/134600
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
This CL adds the ExitIf, ExitLoop and ExitSwitch instructions. The dump
to Dot has been removed as the graph is substantially different and it
needs a full re-write if we want to draw the graph.
Bug: tint:1718
Change-Id: I5ff4282abaa7542575d4f8b4b8640a3ed4d5c68f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/134464
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
This CL adds a BreakIf instruction to the IR to instruct a loop to
go break based on a condition or to iterate the loop.
Bug: tint:1718
Change-Id: I70e65736e59ae189ddb2ea9b05c4b084291314f0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/134463
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
This is to eventually allow more using swapchain textures as CopySrc and
CopyDst. Note that this commit doesn't add any additional usages.
Because textures can reflect their creation parameters, swapchains now
need to pass in the correct texture descriptor in all code paths. This
requires additional handling in dawn::native error swapchains, and
dawn::wire::client's SwapChain reservation and Device::CreateSwapChain
code.
Tests are added for all of these code paths except
dawn::wire::client::Device::CreateSwapChain because there is no way to
create a Surface in wire tests at the moment (they don't have an
instance).
Bug: dawn:1551
Change-Id: I22d5e909e1e94d48eb52cae57aabff8a7f0c04c1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/133463
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
This is prohibited by the GLSL ES spec:
"In addition, all identifiers containing two consecutive underscores (__) are reserved for use by underlying
software layers. Defining such a name in a shader does not itself result in an error, but may result in
unintended behaviors that stem from having multiple definitions of the same name."
(https://registry.khronos.org/OpenGL/specs/es/3.1/GLSL_ES_Specification_3.10.withchanges.pdf, section 3.7).
However, while glslang validation will not give an error on this, NVidia
ES drivers will. So I've added a Dawn end2end test instead of a WGSL test.
Bug: tint:1944
Change-Id: I4b965af00039ca7a232bc11be884483f8e02ccf6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/134140
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
This CL adds a `Continue` instruction into the IR and uses it when
branching into the continue block.
Bug: tint:1718
Change-Id: If54afe6f53b587f1d8a99afd920b94ebdcb608e5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/134462
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
This Cl adds a `ret` instruction into the IR. The `FunctionTerminator`
block has been removed.
Bug: tint:1718
Change-Id: Ie5fcdbfa8983b4c960773494b0c58793bd9ef503
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/134461
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Suspect causing undefined behavior seen in crbug.com/1448982
The D3D11 backend is producing validation layers errors, so
that could be the root cause.
Bug: chromium:1448982, dawn:1847
Change-Id: I3fa943f6f9fb48f6cf05da0e571041e6d0c48bed
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/134542
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
Auto-Submit: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
perfmon is struggling with the number of benchmarks x CLs in flight.
Remove some of the less useful benchmarks.
Change-Id: Ib01432e990c437dbc5ef2445da23d4beaf087f68
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/134501
Kokoro: Kokoro <noreply+kokoro@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
The FlowNode concept is gone, rename the symbol in the disassembly.
Bug: tint:1718
Change-Id: I8a7b5d8113a033592de5ca013cf8839330a7686c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/134460
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
When the `BuilderImpl` tests were split apart in 131581 these two files
accidentally got created in the wrong spot. This removed them from being
tested.
Add them back and update format to match current disassembly.
Bug: tint:1718
Change-Id: I9b248121a9f45862060d44f50a290344e1222874
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/134440
Kokoro: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
This CL updates the `UserCall` to hold a `Function` value instead of the
functions name symbol. The name symbol is also removed from the function
itself and stored into the module like all other values.
Bug: tint:1718
Change-Id: I6c94ce435a6a260f9fe953a04278129b35b3bd39
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/134303
Reviewed-by: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
"_LOONGARCH_SIM" is a deprecated built-in macro, and should not be
used anymore.
Bug: chromium:1448745
Change-Id: Ie62efd55ea5ffb8b90fca6f04feb785e5d2c1794
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/134401
Auto-Submit: Zhao Jiazhong <zhaojiazhong-hf@loongson.cn>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
These required binding point remapping so that the @group is always zero.
Also: Use a unique_ptr for the file in ProgramAndFile. Previously the diagnostics were referring to the std::moved file, causing segfaults if the benchmark program errors and printed diagnostics.
Change-Id: Id0e41665b97b3fc73a6cdd5848c5f505cd77e805
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/134280
Kokoro: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
This CL removes IsConnected as it isn't useful anymore.
Bug: tint:1718
Change-Id: I12b32879e87925e8a2faf0e48e9d23114a2aa484
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/134304
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
The `Block` is now the basis, there is no need for `FlowNode` anymore.
Bug: tint:1718
Change-Id: I4834c442e2b1dd24a708822fc04e68e88f13d7a5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/134302
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Use the parameterized test helper for binary expressions to more
comprehensively test scalar and vector values across different types.
Bug: tint:1906
Change-Id: I2be087d7889d0993125eb0e3f897acbdf56575b2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/134323
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: James Price <jrprice@google.com>
Commit-Queue: James Price <jrprice@google.com>
This CL deprecate Discover[Default]Adapters and replace them with
Discover[Default]PhysicalDevices. This help clearify the behavior of
discovering physical devices and requesting / getting adapters, and
prepare for adding adapter toggles in GetAdapters.
Related end-to-end tests AdapterDiscoveryTests are split into
PhysicalDeviceDiscoveryTests and AdapterCreationTests as well.
Bug: dawn:1774, dawn:1495
Change-Id: Iac3d9da3022e5eb3c6dd6b3e3b2224f523792289
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/133968
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
In the ProgramBuilder and the ir::Builder.
All constant::Value pointers are now guaranteed to be de-duplicated for the entire Program / ir::Module.
Fixed: tint:1935
Change-Id: I7afa769972351f62725d6ce8e3937d49b06ed715
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/134362
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: James Price <jrprice@google.com>
Once constants are de-duplicated, they must be fully immutable.
Bug: tint:1935
Change-Id: Iba1f85079f2ada1f44ba44d1da9b8a65d1abf2ad
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/134361
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Constructs deduplicated constants, similarly to type::Manager
The constant::Manager owns the type::Manager so they can be
std::move()'d together without having to risk having the
constant::Manager hold a stale pointer to a moved type::Manager.
Not currently used. That comes next.
Also un-inline type::Manager scalar helpers. Reduces transitive
includes.
Bug: tint:1935
Change-Id: I28fc74a712f19a171850df5e84433e2d60cba256
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/134360
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
This CL moves the `Function` node to be a `Value` instead of a `Block`.
Bug: tint:1718
Change-Id: I7e67f87fc0a442e0b390fc59f761287382a4b682
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/134301
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: James Price <jrprice@google.com>
This CL switches the disassembler back to being recursive and fixes up
the indenting of blocks to better highlight if branches and switch
cases.
Bug: tint:1718
Change-Id: I14e8d7c68a083bf3afd9ff7241d49b2aa76be4ba
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/134300
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Change-Id: I049bc6499f22ddb359b9d4701eaa5df31f5a652a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/134340
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
This CL updates a bunch of uses of FlowNode to use Block instead. The
InboundBranches are moved from FlowNode to Block.
Bug: tint:1718
Change-Id: Ic1c07dae103e25364a3a6b3333cfcb57d10b30c2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/134260
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
This CL moves the FunctionTerminator and RootTerminator nodes to be
blocks instead of FlowNodes.
Bug: tint:1718
Change-Id: Iee7830bccd99e4587b95b22b53268d1d2921e82f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/134222
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
This CL removes the Jump instruction. This didn't add much value over
the branch instruction and was confusing as to which to use when.
Bug: tint:1718
Change-Id: I69253aa7baf39b00f698e4e8f9608465f6019dcd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/134221
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: James Price <jrprice@google.com>
The transform was only being run if there was at least one override
without an initializer. We actually need to run the transform if there
are any overrides at all, even if they all have initializers.
Bug: chromium:1447418
Change-Id: Ia300ea4326b675c1fd84dd7709112fb69128963d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/134203
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
Change the instruction->id map to a generic non-constant value->id map
so that it can be used for other types of values.
Bug: tint:1906
Change-Id: I79a0a7f671214167fa17ca903f9e94a54507d17c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/134201
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
Creating scalar types is extremely common when using builders.
Bug: tint:1718
Change-Id: I2c2f0f521af1384bd8dee344ddfa525583535911
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132284
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>