Commit Graph

8578 Commits

Author SHA1 Message Date
James Price 75aaa49d77 [ir][spirv-writer] Emit function variables
Bug: tint:1906
Change-Id: I2e1f44acddb86bbb8d57b5ffc8e8ba2b1c35ffbe
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/133223
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
2023-05-18 02:30:39 +00:00
Ben Clayton 6e40b1a9df [tint][ir][ToProgram] Begin emitting Switch statements
Like If, block arguments still needs implementing.

Bug: tint:1902
Change-Id: Ifd660760de13f8003b33aa562c706aed24743851
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/133466
Auto-Submit: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2023-05-18 01:51:45 +00:00
Austin Eng b34f5f6789 Fix Dawn Windows ASAN fuzzer build
Bug: dawn:302
Change-Id: I91c9dd26456c7f7b8b72a24c332d1aae053fd73d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/133365
Kokoro: Kokoro <noreply+kokoro@google.com>
Auto-Submit: Austin Eng <enga@chromium.org>
Kokoro: Austin Eng <enga@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
Commit-Queue: Loko Kung <lokokung@google.com>
2023-05-18 01:19:30 +00:00
Peng Huang 62d9b14b6f d3d11: enable OpArrayLengthTest
Bug: dawn:1705
Change-Id: Ie16b368bb371a379710f99f5a0569eff671e7b56
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/133340
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Peng Huang <penghuang@chromium.org>
2023-05-18 00:15:06 +00:00
Loko Kung 59f4cfb03f Moves cpp_headers into public_deps when depending on the dawn:cpp.
Bug: dawn:1822
Change-Id: Iaec2efe2349c48a0dbbd2bb4e043e0ff07795a60
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/133482
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Loko Kung <lokokung@google.com>
2023-05-17 23:31:43 +00:00
shrekshao e121931563 Compat GL/GLES: blit a depth texture to a buffer using compute
Add compute blit emulation path for Depth16Unorm/Depth32Float
depth textures in OpenGL/OpenGLES backend.

Extend DepthCopyTests for better test coverage, especially for
testing Depth16Unorm compute emulation path.

Bug: dawn:1782, dawn:1291, dawn:1237
Change-Id: I02f6e10d13e8b0080b412a9f9a6d62b1e470ac9c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130820
Auto-Submit: Shrek Shao <shrekshao@google.com>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Shrek Shao <shrekshao@google.com>
2023-05-17 22:25:34 +00:00
Loko Kung 5ae7d10977 Fixes TSAN race by moving cleanup of platform into dtor.
- Before since it was in the TearDown, cleanup can be called before
  the device was gone which meant that async tasks could still be in
  flight.

Bug: dawn:1374
Change-Id: I4cd5a4e096a3fe13e230197a6a4d4d57daea31c8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/133480
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Loko Kung <lokokung@google.com>
2023-05-17 22:03:16 +00:00
dan sinclair 43b110ce53 [ir] Only show type on lhs
This CL updates the IR to only show types on the LHS of an assignment.
The RHS does not show the types anymore. This removes a lot of clutter
from the output.

Bug: tint:1718
Change-Id: I5e9cff2ae5cd727a7a8cb256d08b417233a197d3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/133240
Reviewed-by: Ben Clayton <bclayton@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
2023-05-17 21:56:43 +00:00
Austin Eng 3f18fc9a05 Suppress tests failing on Apple GPUs
Bug: dawn:1828, dawn:1829, dawn:1830
Change-Id: If6f6b107b58822b46c286cf84075ca7981c3edc7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/133441
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
2023-05-17 20:27:23 +00:00
James Price c42014805a [tint][ir] Guard transform source sets in GN build
These sources cannot build without the IR being explicitly enabled, as
they depend on code in headers that would be `#ifdef`'d out.

Change-Id: Id542f41679c3e6e6f210ca632e85ca796e61a746
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/133402
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Auto-Submit: James Price <jrprice@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: James Price <jrprice@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
Kokoro: James Price <jrprice@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2023-05-17 20:04:56 +00:00
James Price 54d1d714ce [ir][spirv-writer] Move code to `ir` subdirectory
Also add `_ir` to the names of test files.This makes it less likely to
confuse IR code with non-IR code.

Bug: tint:1906
Change-Id: I2db85440c815c2834d7bab1899afa0fafc89ce6a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/133222
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-05-17 19:51:42 +00:00
James Price 90b8cc1e93 [ir] Add load instruction
When converting an AST expression to IR, check for a sem::Load node
and emit a load instruction if present.

Update conversion of compound assignment and increment/decrement to
load from the LHS.

Convert load instructions to inline variable references when going
back to the AST.

Bug: tint:1718
Change-Id: Ib2b850efb304a71eff95aadac825f015623b6eb3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/133220
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
2023-05-17 18:41:27 +00:00
Austin Eng 2731b76ded Namespace dawn/common/ and dawn/utils/ in dawn::
Only Constants.h remains in no namespace; but it may be addressed
in the future as well.

Bug: dawn:302
Change-Id: Ib9b9ab4b974ad1de1bb9f2302f4d24d8216f55e4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132841
Kokoro: Austin Eng <enga@chromium.org>
Auto-Submit: Austin Eng <enga@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2023-05-17 18:41:02 +00:00
James Price 0bb1bb3067 [ir] Remove references, indirection and address-of
Change the type of a `var` to a pointer. Fold away address-of and
indirection.

Fixed: tint:1912
Change-Id: Ib1f07538c63df9349c5b6171062b6f79750c1439
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/133400
Commit-Queue: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
2023-05-17 18:34:39 +00:00
Loko Kung 7511bf6334 Removes remaining SetPlatform APIs from being exposed in native.
Bug: dawn:1374
Change-Id: I252c1e686d6ba31fbf81c6ea990e553222907d47
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132269
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Loko Kung <lokokung@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-05-17 18:25:28 +00:00
James Price 82db91ac96 [ir][spirv-writer] Emit `If` flow nodes
Adds support for both `If` and `Block` flow nodes as branch
targets. Also support a nullptr branch target by emitting
OpUnreachable.

Bug: tint:1906
Change-Id: I1adea83ce6c7c85c6a2e2dae9327499cb7f850bd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132861
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
2023-05-17 18:17:34 +00:00
James Price 7ac28d3c6e [ir] Add AddEmptyEntryPoint transform
Use it in the SPIR-V writer.

Bug: tint:1718, tint:1906
Change-Id: If8f29300712c457a02ddc9eb2fd76e0b49ee8fea
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132682
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-05-17 17:04:52 +00:00
James Price 95b06129f0 [ir] Add base `ir::transform::Transform` class
Enable the transform manager to run a pipeline that mixes AST and IR
transforms, automatically converting the current program as necessary.

Bug: tint:1718
Change-Id: I8df76db61edd94e0b1d7c2aaabc18b394db3d8de
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132502
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: James Price <jrprice@google.com>
2023-05-17 15:52:05 +00:00
James Price db5ad9f357 [tint] Materialize compound assignment RHS
The RHS of a compound assignment statement may need to be
materialized. This was showing up when converting things like `i += 1`
to IR, as abstract types were creeping into the IR.

Change-Id: Idf9b1523d1751e26c28a795af07769ca85a65f14
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/133221
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
2023-05-17 14:49:26 +00:00
dan sinclair 11ee6b6cc6 [ir] Handle phony assignment.
This CL adds phony assignment to the IR. The assignment part is ignored
and the RHS of the expression is generated. This creates a result value
which is then never used.

Bug: tint:1918
Change-Id: Ic87fdcb387cb4d9783c4dbbe26ebc76f67a3cdd9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/133260
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-05-17 13:52:41 +00:00
dan sinclair bbaa456b18 [ir] Remove instruction allocator.
The Instructions are now inheriting from Value so they can use the value
block allocator. Remove the instruction allocator.

Bug: tint:1718
Change-Id: Ia8f3b8b106d03883b3c72ebead392ae972a86c4b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/133164
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: dan sinclair <dsinclair@google.com>
2023-05-17 13:51:50 +00:00
dan sinclair 0531610e99 [ir] Add basic block arguments.
This CL adds the ability to add parameters to blocks and emits the
params as needed in the disassembly.

The ShortCircuit is updated to use block arguments instead of creating
a return value.

Bug: tint:1909
Change-Id: I92afa6cf8ff4e01bfa3de46e76c26c465f0d6062
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/133200
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
2023-05-17 13:28:47 +00:00
dan sinclair 9fc46dc3c1 [ir] Drop address space and access from ir::Var.
The address space and access mode both exist on the type of the Var,
storing the information into Var is redundant. This CL removes them from
var in favour of the type fields.

Bug: tint:1718
Change-Id: I0198a8794d6359834592562251b2788e8a0347ca
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/133163
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-05-17 13:26:40 +00:00
Ben Clayton 25ae3114b3 [tint][ir][ToProgram] Emit returns with values
And implement functions with return values.

Bug: tint:1902
Change-Id: Id4015aa83bf75de2a0f3dfdbfe19f728c05226c8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/133142
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
2023-05-17 10:46:48 +00:00
Ben Clayton a6e7cfc1d0 [tint][ir][ToProgram] Emit returns without values
Returns with values requires fleshing out of functions, which comes next

Bug: tint:1902
Change-Id: I5f956805441b99038f2d48758d1bd767ea4e1a1d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/133141
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Ben Clayton <bclayton@google.com>
2023-05-17 10:45:26 +00:00
Ben Clayton 6ab77f16f0 [tint][ir][ToProgram] Emit 'else if' instead of 'else { if'
Bug: tint:1902
Change-Id: If49a7fd71d72cd562fc49957a5715ea7eefc8b4d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/133140
Kokoro: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2023-05-17 10:43:46 +00:00
Ben Clayton 1ea1e1a375 [tint][ir][ToProgram] Begin flow node traversal
Traverse the block nodes, and if statements.

Bug: tint:1902
Change-Id: Ie5533acdc65378bfea91b46a62090c4d3216b303
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/133100
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
2023-05-17 10:40:41 +00:00
Ben Clayton 0b9cb101bf [tint][ir][ToProgram] Implement var expressions
Bug: tint:1902
Change-Id: I97c026adc113b4a8834b9b5e978b4084d777328a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/133060
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
2023-05-17 10:38:36 +00:00
dan sinclair f55d13b754 [ir] Add increment and decrement statements.
This CL adds increment and decrement statement support into the IR.

Bug: tint:1718
Change-Id: Ieba2ab7a4c9232dc9d76a8605637cd5ea46b0e08
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/133162
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
2023-05-17 02:04:55 +00:00
Brandon Jones 112b7fd856 Allow device lost callback to be passed at creation
This change updates the Device descriptor to allow a device lost
callback to be passed in at device creation time. This will be
important for allowing the API to return devices which have
already been lost in a future CL, which is the behavior required
by the spec.

This change does not yet deprecate the old method for setting the
callback, as there's still some tricky scenarios that will need to
be worked around to enable that and this CL is already fairly
large. (The uses in question pass the device or a value created
from the device as the userdata.)

Bug: chromium:1234617
Change-Id: I1adea5ceffdfdcfedff9fff4960f12303abba29c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/121041
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Brandon Jones <bajones@chromium.org>
2023-05-17 01:52:30 +00:00
James Price 0e6534e44d [tint] Make Transform base class
This will allow for both AST transforms and IR transforms to be used
in the same transform manager.

The transform manager is no longer a Tranform subclass.

Bug: tint:1718

Change-Id: I59bd87806090fa365ce4b575710c5ffcfc657bd8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132501
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-05-17 01:21:45 +00:00
James Price a6d8e81371 [ir][spirv-writer] Implement binary subtract
Bug: tint:1906
Change-Id: Ie57fecbafd4823de78c0b8d3322865253eb4c39b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132743
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-05-17 00:17:31 +00:00
Ben Clayton 9940c7bdcc [tint][ir][ToProgram] Stub ToProgram()
This is the first commit to implementing an IR -> AST conversion path.

Not much currently implemented, but enough to start building upon.

Started implementing AST -> IR -> AST roundtrip tests.

Bug: tint:1902
Change-Id: I17fa9f3bc609b48ecb916ab47ae61bfa36821b44
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131180
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2023-05-16 22:07:39 +00:00
Peng Huang 34832fe82f d3d11: enable CopyTextureForBrowserTests
Bug: dawn:1705
Change-Id: I13dda162ed1b9a7714ffbe729d691bcbde6abdab
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/133120
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Peng Huang <penghuang@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-05-16 21:47:58 +00:00
dan sinclair 0df7f8bccd [ir] Update disassembly output.
This CL updates the disassembly output to make it clearer when
instructions are flow node traversals, and when they're actual
instructions in a block.

Bug: tint:1718
Change-Id: I95e103a5672b5579081b73e9633bf07b31e51187
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/133161
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2023-05-16 21:21:21 +00:00
Peng Huang 7ddaaf23cf d3d11: enable CopyExternalTextureForBrowserTests
Bug: dawn:1705
Change-Id: I9963d446b6bfb71e4bb70a5b9174a631a5229a8a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/133121
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Peng Huang <penghuang@chromium.org>
2023-05-16 20:29:09 +00:00
dan sinclair 11bd8a012f [ir] Fix scope stack for loops.
The scope stack for a loop is slightly different from other constructs
as the block for the body and the block for the continuing need to share
the scope. This CL fixes the loop conversion to special case the scope
stack for the loop body so the continuing block can see the variables.

Bug: tint:1718
Change-Id: I2e4898b36f1541b48a4e349955833b155332947a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/133160
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2023-05-16 17:46:52 +00:00
James Price 055de27441 [ir][spirv-writer] Emit vector constants
Switch the constant map key to constant::Value.

Bug: tint:1906
Change-Id: I71743cc8b47a5c703f6333371ed686cf70900f74
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132742
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>
2023-05-16 15:24:19 +00:00
James Price 2f324c59ff [ir] Remove list of entry points from module
This is unneeded, as we can now determine if a function is an entry
point by checking its pipeline stage.

Bug: tint:1718
Change-Id: Icb09b39b7a63cf9a9a36ccad5e144eceec1dfdeb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131521
Commit-Queue: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
2023-05-16 14:59:30 +00:00
dan sinclair f59547fb7f [ir] Add optional CreateFunction parameters.
This CL adds the pipeline stage and workgroup_size as optional
parameters when creating a function in the IR.

Bug: tint:1718

Change-Id: Iae65dcb9557a644a17ec67fc5269d0c2db3f8aba
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/133001
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
2023-05-16 14:43:45 +00:00
dan sinclair 69b5900c88 [ir] Use the branch helper in the spirv tests.
This CL updates the SPIRV IR generator tests to use the `Branch` method
of the builder.

Bug: tint:1718
Change-Id: I16961382b797dc90277529f706ee240be282d623
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/133000
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: James Price <jrprice@google.com>
2023-05-16 14:42:29 +00:00
Ben Clayton 34c794e2e9 [tint][ir] Shuffle and refactor from_program.cc
Change-Id: Ibbeceb2410e7b3598fd9a92f3871603ee26b69b2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132961
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2023-05-16 12:31:46 +00:00
Ben Clayton 8d98977a30 [tint][ir] Make the ir::BuilderImpl PIMPL
Black-box the BuilderImpl by putting the BuilderImpl into the
from_program.cc file.

Why:

* It means there's only a single definition of all the methods that need
  to be maintained, instead of pointlessly splitting code between two
  files (.cc / .h).
* It removes all the implementation details from the header.
* It removes a whole bunch of transitive includes, slowing compiles.
* It prevents the temptation for future #includes to
  private-implementation details.
* It reduces the amount of symbols declared outside of anonymous
  namespaces, reducing symbol polution and the amount of work on the
  linker.

Bug: tint:1718
Change-Id: I82838089f784ab003dae4ef06545bba1ca2401cc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132321
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
2023-05-16 12:30:06 +00:00
Ben Clayton c9dd75a0e9 clang-format
Change-Id: Ibb0a7f4612ee5bf12f6c23a2529711808453685c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132880
Kokoro: Ben Clayton <bclayton@chromium.org>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
2023-05-16 11:14:12 +00:00
Loko Kung 14ed533565 Updates DawnInstanceDescriptor to pass in the Platform.
Notes:
- Separates ChainedStruct to be reusable without cpp header. (Also
  updates native structs to directly use it.)
- Manually implements the descriptor in DawnNative.
- Reworks ChainUtils with mapping from struct to STypes.
- Updates the tests to use either SetPlatformForTesting which is still
  required because DawnTest uses a "global" instance for all tests and
  some tests require setting (and cleaning up) a test specific platform.

Bug: dawn:1374
Change-Id: I078c78f22c5137030cf3cf0e8358fe4373ee9c6c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132268
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Loko Kung <lokokung@google.com>
2023-05-16 04:50:32 +00:00
Brendon Tiszka f9f9f829e3 Add Dawn Wire Server LPM Fuzzer [5/N]
Add custom C++ serializer for methods that need to be handwritten

Bug: chromium:1374747
Change-Id: I438db05b6fd6d1a1542d847c4b40f22b9143b0d5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/114721
Commit-Queue: Brendon Tiszka <tiszka@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-05-16 03:45:03 +00:00
Peng Huang 64df2e6235 d3d11: fix and enable ExternalTextureTests
Bug: dawn:1705
Change-Id: I29fbb5bebbc217a4f95a51e24ec295d6e3cd6e8e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132740
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Peng Huang <penghuang@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2023-05-16 02:43:53 +00:00
jchen10 c29e10c442 d3d11: enable GpuMemorySynchronizationTests
RTV and UAV in d3d11 pixel shaders share the same resource slots. To
avoid any potential conflicts, this assigns UAV slots reversely.

Bug: dawn:1807
Bug: dawn:1705

Change-Id: Ie0ca20aa0e532736c0534c6810b8a807dde6f972
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132274
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Jie A Chen <jie.a.chen@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2023-05-16 01:30:02 +00:00
dan sinclair c9923d2ee3 [ir] Set default flow node values.
For the `if`, `switch` and `function` flow nodes this Cl makes a few
required fields part of the constructor. This cuts down boilerplate when
creating new nodes.

Bug: tint:1718
Change-Id: I739bcefc2ed36b0203b57974b50bb2b79f6e1684
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132980
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-05-15 23:44:04 +00:00
dan sinclair 809187c579 [ir] Move ir::Builder to hold module reference
This CL moves the module from being owned by the builder, to be passed
into the builder and stored as a reference. This allows the transforms
to create builders based on the same module as needed.

Bug: tint:1718
Change-Id: I4863f368582242626c2a2c6996fd62f053314bb1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132862
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: James Price <jrprice@google.com>
2023-05-15 23:42:33 +00:00
Brendon Tiszka 27521c6b91 Add Dawn Wire Server LPM Fuzzer [4/N]
Implements C++ serializer implementation that translates protobuf
objects into Dawn serial data.

1) A generator that builds a fuzzing harness that converts LPM structured data
into serialized bytes, that are then sent to Dawn Wire Server.
2) Object store for dawn objects that are allocated and
freed.

Bug: chromium:1374747
Change-Id: I09c1be6cdc2eccf4a91de808f19494d97d01b3d6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/114720
Commit-Queue: Brendon Tiszka <tiszka@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2023-05-15 22:22:07 +00:00
Austin Eng 8e42cfa7ea Expand intentional Metal counter sets leak to Intel Gen11
Bug: chromium:1443658
Change-Id: I9a0fe75cacf31b5b22cd89468af2c854079a19a6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132900
Kokoro: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2023-05-15 21:28:34 +00:00
Ben Clayton 36aa48ce36 [tint][ir] Clean up tests
Remove the direct use of BuilderImpl from TestHelperBase to cut down the amount
of internal state management required by the tests, and removing confusing
conflation between the BuilderImpl and Builder.

This change removes the following methods from TestHelperBase:
* CreateBuilder()
* InjectFlowBlock()
* CreateEmptyBuilder()
* FlowNodeForAstNode()

Tests now just use FromProgram() function for testing AST -> IR.

The downside to the black-box testing is that the per-method granularity of the
unit testing increases to whole FromProgram() granularity. However, my personal
opinion is that this is more than offset by the lack of state leakage from the
implementation to the tests.

Bug tint:1718

Change-Id: Iba2560e0fbcbd3dfb936694e50997d716f09fbd8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132960
Kokoro: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2023-05-15 20:26:43 +00:00
James Price 8370ddddc5 [ir][spirv-writer] Emit vector types
Bug: tint:1906
Change-Id: I1caedc1e9fea90c7cd3ffe03eb89002beb5a9fef
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132741
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2023-05-15 17:49:40 +00:00
Peng Huang 90b9ac2b7b Animometer: update FPS calculation
Change-Id: Idd173038505ce0af388a1fad2add673a40e6b0bf
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132760
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Peng Huang <penghuang@chromium.org>
2023-05-15 17:01:49 +00:00
Ben Clayton 1a8bc1df7f [tint] Add support for benchmarking .spv files
Change-Id: Id687d5208e9f39ae7b40db4d90c194283ebac91b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132642
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2023-05-14 01:36:30 +00:00
Albin Bernhardsson e5d1a8494d Implement depth-clip-control without VK_EXT_depth_clip_enable
In Vulkan, unclippedDepth is currently implemented as depthClamp=true,
depthClipEnable=false. However, depthClamp=true will implicitly
disable depth clipping if no
VkPipelineRasterizationDepthClipStateCreateInfoEXT is specified. This
allows us to support depth-clip-control on devices without
VK_EXT_depth_clip_enable.

Change-Id: I27c81da34dc3c72e31118cd858f92d9fdfae83e9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132620
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2023-05-12 20:46:38 +00:00
Ben Clayton b0726080f4 [tint] static_assert that C in Castable<C[, B]> is correct
Fix a bug this caught.

Fixed: tint:1939
Change-Id: I61ea4eb66fe1f91b3bc17ba5d65aee7324aa555c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132621
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-05-12 12:00:06 +00:00
Austin Eng 6d50a49da6 Suppress another TextureViewRenderingTest on Intel d3d11
failing with DXGI_ERROR_DEVICE_HUNG

Bug: dawn:1812
Change-Id: Ib76d91784e9ec1102427c7b4468e9d4a214f99ec
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132560
Auto-Submit: Austin Eng <enga@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Loko Kung <lokokung@google.com>
2023-05-12 06:35:50 +00:00
James Price 2b7406ad55 [tint] Remove ast:: prefixes from AST transforms
Now that AST transforms live in the AST namespace, these prefixes are
no longer necessary.

Change-Id: I658746ac04220075653ec57d6dc998947232d8bc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132425
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
2023-05-12 01:43:50 +00:00
Brandon Jones d5611aa7c2 Validate compute pass timestamp queries are unique
This validation existed for render passes but not for compute passes,
and it's not clear why.

Bug: dawn:1809
Change-Id: I8babb6ddf455a915f5a0c85ad1a7d741fdb467a8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132481
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Brandon Jones <bajones@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2023-05-11 22:36:36 +00:00
James Price b4acbb8bb0 [tint] Introduce an ast::transform namespace
All AST transforms live inside this namespace. There will be a
corresponding ir::transform namespace for IR transforms.

Change-Id: I543972451c08e7df5632b835257999a8af3701d1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132424
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>
2023-05-11 21:27:16 +00:00
Yunchao He 9924426c94 Unset vertex buffer: validations and unittests
If vertex buffer is null, SetVertexBuffer() actually unset that
buffer slot. This is a new feature in WebGPU. This change adds
validations and unittest in order to support this feature.

Bug: dawn:1675
Change-Id: Ia3e5d4196423590ff5b60ea78cc1e8cdd9c67d15
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/124842
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2023-05-11 19:26:30 +00:00
Peng Huang eb53af192f d3d11: suppress two TextureViewRenderingTest with Intel D3D11
Bug: dawn:1812
Change-Id: I22d28af0e299e8368f485bbd6117bb0a6778ef35
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132500
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Peng Huang <penghuang@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-05-11 18:19:34 +00:00
Austin Eng 096ce5936a Move Adapter toggles from PhysicalDevice to Adapter
Bug: dawn:1774
Change-Id: I25a4040af929b5dc49ad481f85a067e427b97424
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132267
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2023-05-11 17:10:28 +00:00
Peng Huang 61446e63b6 d3d11: enable TextureViewTest
Bug: dawn:1705
Bug: dawn:1810
Change-Id: I0a975e074c69d866f1b0b8454a364d05ba1989bc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132443
Commit-Queue: Peng Huang <penghuang@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-05-11 13:16:29 +00:00
Peng Huang c06625efc7 d3d11: enable VertexStateTests
Bug: dawn:1705
Change-Id: I289c2eb1c61b8f0119e136c7538be947ce461fd5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132442
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Peng Huang <penghuang@chromium.org>
2023-05-11 13:15:42 +00:00
James Price 7d2e204911 [tint] Move AST transforms to a subdirectory
This prepares for the addition of IR transforms. Subsequent patches
will introduce an ast::transform namespace and refactor the Transform
class into a common base class for the two types of transform.

Bug: tint:1718
Change-Id: I0088d8356341e861df68df1f4f755ee82757dd2d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132423
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-05-11 13:10:59 +00:00
James Price f7a4d9fe59 [tint] Change ast::builtin::test to ast::test
There is no `builtin` subdirectory of `ast`, and this additional
`builtin` namespaces causes awkward conflicts in a subsequent patch
that moves AST transforms under the `ast` namespace.

Change-Id: I54b11f37b686875f1dab7deb9781e978a639d6e9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132422
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-05-11 13:03:38 +00:00
James Price fd60f17236 [ir][spirv-writer] Fail when errors are present
Make sure we return `false` when something goes wrong during
codegen. Also, add some more TINT_ICE calls in places where we know
stuff is unimplemented. This makes it easier to track current progress
against Tint's E2E tests.

Bug: tint:1906
Change-Id: Ic5885201d7b4f286d8f282df5a2074a017a98477
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132421
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
2023-05-11 10:37:42 +00:00
Peng Huang 6a975ff044 d3d11: enable src/dawn/tests/end2end/DepthStencilStateTests.cpp
Bug: dawn:1705
Change-Id: Id0e383d2d2689df667c854e2a1daba280e8d2f03
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132022
Commit-Queue: Peng Huang <penghuang@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2023-05-11 01:14:50 +00:00
Peng Huang 91fd9d97a2 d3d11: fix and enable some BufferZeroInitTests & Compute tests
Bug: dawn:1755
Bug: dawn:1798
Bug: dawn:1721
Change-Id: I7e5d4964bd248b4429cb393168b0e7dbe119c08c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132001
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Peng Huang <penghuang@chromium.org>
2023-05-11 00:19:49 +00:00
Austin Eng 039e886f9b Reland "Allow internal errors for pipeline creation failure"
This is a reland of commit e241d64d25
It adds handling and tests for internal errors in the wire

Original change's description:
> Allow internal errors for pipeline creation failure
>
> Change-Id: I6b8c109ae67e230fea3fb14511c2b3562191c0fa
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132300
> Kokoro: Kokoro <noreply+kokoro@google.com>
> Commit-Queue: Austin Eng <enga@chromium.org>
> Reviewed-by: Loko Kung <lokokung@google.com>

Change-Id: Icfda2d04bbb340fc4fdacf5ae65593bf958172fb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132441
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-05-11 00:06:38 +00:00
Loko Kung 0214a30479 Renames C++ object Release function to MoveToCHandle.
Bug: dawn:1639
Change-Id: If4aaeefbb629cbef4302bbb430e09d740f057d8f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132273
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Loko Kung <lokokung@google.com>
2023-05-10 23:48:22 +00:00
Peng Huang b8233deafe d3d11: enable FragDepthTests end2end test
Bug: dawn:1705
Bug: dawn:1805
Change-Id: Ibe663a6be07eb9c17b2165073d6a973b72c23e5f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132023
Commit-Queue: Peng Huang <penghuang@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-05-10 23:23:09 +00:00
Austin Eng ccc78f6be4 Revert "Allow internal errors for pipeline creation failure"
This reverts commit e241d64d25.

Reason for revert: Missing the change to handle the enums in the wire

Original change's description:
> Allow internal errors for pipeline creation failure
>
> Change-Id: I6b8c109ae67e230fea3fb14511c2b3562191c0fa
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132300
> Kokoro: Kokoro <noreply+kokoro@google.com>
> Commit-Queue: Austin Eng <enga@chromium.org>
> Reviewed-by: Loko Kung <lokokung@google.com>

TBR=enga@chromium.org,noreply+kokoro@google.com,dawn-scoped@luci-project-accounts.iam.gserviceaccount.com,lokokung@google.com

Change-Id: I12309e85e888cc400729f88bb2340e8ecdf6b798
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132440
Auto-Submit: Austin Eng <enga@chromium.org>
Kokoro: Austin Eng <enga@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2023-05-10 20:36:33 +00:00
Austin Eng 3d511b3b7e Intentionally leak MTLDevice.counterSets to workaround a crash
Some drivers over-release this object when is accessed more than
once.

Bug: chromium:1443658
Change-Id: I861a74e7756dcf16b0a2d25a85bf47815b6779f0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132262
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-05-10 20:08:42 +00:00
Brandon Jones dfaeb429f8 Add test for D3D12 descriptor heap allocation lifetimes
Adds a white box test to ensure that D3D12 descriptor heap allocations
only are valid during the serial they are created on.

Bug: dawn:1701
Change-Id: I1e1587ab602d5472fbba9e751bf3cd1e6e5ead11
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132266
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Brandon1 Jones <brandon1.jones@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2023-05-10 18:51:52 +00:00
François Beaufort 48e2b114be Emit warning if zero-size dispatch/draw
This CL make sure developers are warned when zero-size dispatches and
draws occur. Even though those are valid, it is good to encourage
developers to avoid them when possible.

Bug: dawn:1786
Change-Id: I99cbe8d556569d2e779b7b9c64739c3e5da8e290
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132222
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Fr <beaufort.francois@gmail.com>
2023-05-10 18:30:55 +00:00
Ben Clayton 9f83fa1d1b tint/ir: Remove 'type' field from Instruction
ir::Value has a virtual Type() method. Implement this on the subclasses
that actually have a type.

Removed pointless memory usage on instructions that have no value.

Also un-getter some fields to match the other IR code.

Change-Id: Ibf545a582d5cbb820410c9aaec0312692e803373
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131745
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-05-10 17:56:14 +00:00
Peng Huang c872e6a552 d3d11: support uniform buffer with other GPU accelerated usage
d3d11 doesn't allow creating a constant buffer with other GPU
accelerated usage.  This CL workarounds problem by creating two
buffers one for uniform buffer usage, one for other usage, and
copy content to uniform buffer when it is needed.

Bug: dawn:1755
Bug: dawn:1798
Bug: dawn:1721
Change-Id: I26bfee1cca2204f6464ba611872c490165e97f68
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132020
Commit-Queue: Peng Huang <penghuang@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-05-10 17:21:53 +00:00
Ben Clayton c95576ed7b [tint] Fix syntax_tree build
Missing utils:: namespace on TrimSuffix().

Change-Id: I184bee79dc2c807730c1be0a532b290441d5f4ae
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132323
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: James Price <jrprice@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
2023-05-10 16:05:50 +00:00
Peng Huang 05330ab9dd d3d11: fix render pass msaa resolve problem
Bug: dawn:1804
Change-Id: I16373eae35d1a8fb1317a4a11811787bd91d1236
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132420
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Peng Huang <penghuang@chromium.org>
2023-05-10 14:52:15 +00:00
Ben Clayton 42de29e088 tint/ir: Add an initializer field to Var
Fixed: tint:1930
Change-Id: I16b4414a2e575a4fb60c70d4eec7a1d69db8818b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131742
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
2023-05-10 14:29:02 +00:00
Peng Huang 9ac6c02fb2 d3d11: support external image
Bug: dawn:1724
Change-Id: I80e397331672a611a1bc2d805187b9c01c2e0530
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132360
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Peng Huang <penghuang@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2023-05-10 13:03:32 +00:00
Ben Clayton 88417687fa tint/ir: Add name metadata to Module
Register the name of 'var' and 'let' variables when building the IR.
Use the names of these variables when printing the disassembly.

Change-Id: I56ee24a29333f1bc8f97459bc1cfca5c3a59e79d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131741
Auto-Submit: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2023-05-10 09:44:10 +00:00
Colin Blundell 2107af0396 [Vulkan] Add support for transient attachments
This CL adds support for the transient attachment feature and texture
usage flag to Vulkan, using the usage flag to allocate textures via
lazily-allocated memory if the latter is available.

Testing is covered by the
MultisampledRenderingWithTransientAttachmentTest now being run on
Vulkan due to transient attachments feature now being supported on
Vulkan.

Bug: dawn:1695
Change-Id: I45a04d21b1b6ea612086a368b9c77a0ff43e93f8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130180
Reviewed-by: Loko Kung <lokokung@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Colin Blundell <blundell@chromium.org>
2023-05-10 09:08:50 +00:00
James Price 49bae34149 [ir][spirv-writer] Implement binary add instructions
Adds a `Value()` method to the writer which gets the ID for a value,
which could either be a constant or an instruction result.

Bug: tint:1906
Change-Id: I57f5e0cfea1e3b8322702090714bac49d003ba75
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132285
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-05-10 03:58:42 +00:00
Loko Kung 5e155b23d2 Remove lingering disallow_unsafe_apis toggle usage.
Bug: dawn:1685
Change-Id: I6c9da45efac12986095be5dd1a3ed2a536b76d64
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132302
Commit-Queue: Loko Kung <lokokung@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Loko Kung <lokokung@google.com>
Auto-Submit: Loko Kung <lokokung@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-05-10 01:45:54 +00:00
Peng Huang b6e73aa50a d3d11: support multisampled rendering and enable related tests
Bug: dawn:1804
Bug: dawn:1705
Change-Id: Ic90a42dab7149af261af790ca393d8a595e3ec4c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132021
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Peng Huang <penghuang@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2023-05-10 01:44:26 +00:00
Peng Huang 2c9f88ef1d d3d: fix driver description
Bug: dawn:1705
Change-Id: I3077bcc8e136359afc7da036dea5284aef59c3c4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132281
Commit-Queue: Peng Huang <penghuang@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2023-05-09 23:15:17 +00:00
Peng Huang 49db496a51 d3d11: support external image
This CL implements external image for d3d11 backend and enables
related tests.

Bug: dawn:1705
Bug: dawn:1724
Change-Id: Ib95e024fdc1837e3edb198dcf9255ebde8fa9fe7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131201
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Peng Huang <penghuang@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2023-05-09 23:11:53 +00:00
James Price 5e7807f02b [ir][spirv-writer] Emit blocks
All instructions are unimplemented, and the only supported branch
target is the function terminator.

No new tests, as this only handles returning from an empty function.

Bug: tint:1906
Change-Id: I05cf5d252d96d37757c3ac1f84b79d0586c36b97
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132283
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-05-09 22:20:16 +00:00
James Price 577b164b91 [ir][spirv-writer] Emit scalar constant values
Use a hashmap to de-duplicate constants.

Bug: tint:1906
Change-Id: Ic2654e1819d8c3c0199ce3f723f20877495ed0f0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132282
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
2023-05-09 21:57:36 +00:00
Austin Eng e241d64d25 Allow internal errors for pipeline creation failure
Change-Id: I6b8c109ae67e230fea3fb14511c2b3562191c0fa
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132300
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
2023-05-09 21:27:20 +00:00
Ben Clayton a8236a5529 tint/ir: Remove value id field.
There's a few reasons for this change:
* Not all values have identifiers, and carrying redundant fields is
  inefficent.
* Not all IDs will be integers - much like LLVM IR and SPIR-V, we will
  likely want to disassemble with textual identifiers, so a uint32_t
  is not ideal, and a std::string is even more bloat for each value.
* Transforms don't use identifiers, but instead raw pointers. We don't
  want to encourage using IDs as they're simply a less-efficient way to
  refer to values.
* This makes values consistent with types and flow-control blocks, as
  they will both have their disassembly ID generated by the
  disassembler.

The next step will be to add a hashmap to the module so that
pre-declared value names can be stored out-of-band.

Bug: tint:1718
Change-Id: I80beafc165f2bde54cc44a91015776926ca952b2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131740
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2023-05-09 21:17:59 +00:00
Ben Clayton 3731ce8f21 tint: Use new string utilities in various places
Change-Id: I8c97a8a92f5e5e3d9768933589aa304ff52ab103
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131748
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2023-05-09 17:34:08 +00:00
Ben Clayton ce1025fde3 tint/utils: Add more string utilities.
Change-Id: If15bbf8bd662b55222fef87c22cd8beb0447ac4c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131747
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2023-05-09 16:54:43 +00:00
James Price fbef69b61c [ir][spirv-writer] Fix MSVC build
Change-Id: I11b674b422be0499c5016d4617703ce40cc63f85
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132280
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>
2023-05-09 16:50:22 +00:00
James Price 6c18123058 [spirv-reader] Avoid name clashes with builtins
An OpName decoration for a result ID may end up unintentionally
shadowing a WGSL builtin function.

Fixed: tint:1932
Change-Id: I1b1302629c69b7bdf7a0a0c97d3ad6ce3d0d587b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132080
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2023-05-09 16:41:15 +00:00