Commit Graph

8578 Commits

Author SHA1 Message Date
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
Ben Clayton 567a53e87c tint/utils: Add Vector::Any(), Vector::All() and predicates
Can be used to write simple whole-vector comparision checks.

Change-Id: I441a7e8d6b626a5a32ef3db9043e771f792900d3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131746
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-05-09 15:10:05 +00:00
James Price 13ca70fa08 Reland "ir/spirv-writer: Emit entry point declarations"
Emit the OpEntryPoint instruction with the pipeline stage. Interface
variables will be done later.

Emit OpExecutionMode instructions for the workgroup size and fragment
shader origin, depending on the pipeline stage.

This is a reland of commit 90789ea1f8
with compilation fixes for MSVC.

Bug: tint:1906
Change-Id: If5290df504ebc8925b3c52510acab123edfd1073
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131800
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Auto-Submit: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2023-05-09 12:25:07 +00:00
James Price 81fc109822 [tint] Fix unshadowing of abstract const users
Unwrap sem::Materialize as well as sem::Load when looking for users of
a renamed declaration.

Fixed: tint:1934
Change-Id: I7d5ade1f902dbdb4cf3b4f7552b78359f5b3ea9a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132060
Commit-Queue: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2023-05-09 10:59:58 +00:00
James Price e162a1adee [spirv-writer] Don't emit abstract accessor source
When traverseing an accessor expression, stop as soon as we hit a
source object that has a constant value. This prevents us from trying
to emit expressions that have abstract types and no materialization
nodes.

Bug: chromium:1442551
Change-Id: I8296ae58e63624e647052cdf966dbff15630a4d8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132040
Auto-Submit: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2023-05-09 10:57:21 +00:00
James Price f91b77dd6d [spirv-reader] Use builtin matrix aliases
This makes the generated WGSL more concise and readable.

Change-Id: I78a722b9a86264d3bbf219445628dc5597cbfd62
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132141
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: David Neto <dneto@google.com>
2023-05-09 10:40:06 +00:00
James Price 114bae24b0 [spirv-reader] Use builtin vector aliases
This makes the generated WGSL more concise and readable.

Change-Id: Ia486a74796a4029aaac1c4d051d304d05f1d5ea2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132140
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: James Price <jrprice@google.com>
2023-05-09 10:36:41 +00:00
Austin Eng 5696997251 Improve runtime minBindingSize validation message
The message now reports the group/number of the binding that failed
validation, as well as the buffer.

Bug: dawn:1604
Change-Id: Ib08a3eace5ec5ebaf9eecce01eb397b5c0681bd1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131843
Reviewed-by: Brandon Jones <bajones@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2023-05-09 02:37:54 +00:00
jchen10 46014f69a0 d3d11: enable CompressedTextureFormatTests
Bug: dawn:1801
Bug: dawn:1705

Change-Id: I4b63d865ceb3a20a16917030b608309452aeb045
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131844
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jie A Chen <jie.a.chen@intel.com>
2023-05-09 02:27:41 +00:00
jchen10 f083783f7e d3d11: VertexBufferTracker
This introduces VertexBufferTracker to correctly track pipeline's
vertex buffer state.

Bug: dawn:1799
Bug: dawn:1705
Change-Id: I06f32b501a3637b22318ec201b1953eba6ed0cf2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131700
Reviewed-by: Peng Huang <penghuang@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jie A Chen <jie.a.chen@intel.com>
2023-05-09 02:22:42 +00:00
jchen10 b4425f537c d3d11: enable FirstIndexOffsetTests
Bug: dawn:1803
Bug: dawn:1705

Change-Id: I54ee08aa79da6c37c4c9b70db1f815d2d52e7756
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131940
Commit-Queue: Jie A Chen <jie.a.chen@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Peng Huang <penghuang@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2023-05-09 01:25:25 +00:00
Austin Eng 1a8bb02624 Ensure commands are submitted before exporting the last signaled event
Consumers of the event expect it to be signaled after all work
enqueued thus far. Ensure that commands are flushed to ensure this.

Fixed: dawn:1691
Change-Id: I1409c668119a12e5e50a1ce2924ebc16d0470a4d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131880
Commit-Queue: Austin Eng <enga@chromium.org>
Kokoro: Austin Eng <enga@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
2023-05-08 19:43:35 +00:00
James Price a187e9e281 spirv-reader: Error for OpSpecConstantComposite expression
This is not currently supported, so produce a meaningful error message
instead of crashing.

Bug: oss-fuzz:55819
Bug: tint:111
Change-Id: Ib245a47edbbe6ef972844f940ea1d674e6b08a76
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131222
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: David Neto <dneto@google.com>
Kokoro: James Price <jrprice@google.com>
2023-05-08 17:48:30 +00:00
Peng Huang a3a0b3299b d3d11: enable more passed end2end tests
Bug: dawn:1705
Bug: dawn:1768
Change-Id: I1999b1f3029d9121e1851b3006836417017f159b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131860
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Peng Huang <penghuang@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-05-08 15:34:43 +00:00
jchen10 8b2ab40c39 d3d11: enable BufferZeroInitTests.Copy2DArrayTextureToBuffer
This fixes the dst buffer initialization for Texture2BufferCopy.

Bug: dawn:1799
Bug: dawn:1705
Change-Id: Ibd4d2db9e6e0b025acf3385591f285edd2aa64ec
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131701
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jie A Chen <jie.a.chen@intel.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Peng Huang <penghuang@chromium.org>
2023-05-06 06:20:08 +00:00
jchen10 331ef65fed d3d11: enable BufferZeroInitTests
Bug: dawn:1799
Bug: dawn:1705
Change-Id: I59ea4ba6bdbb200e1263c9a35d4aaa2b50bb08f7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131502
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jie A Chen <jie.a.chen@intel.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-05-06 03:02:02 +00:00
Stephen White b9e12716c6 Add FeatureLevel to AdapterBase; implement Compat.
This introduces the notion of FeatureLevel, currently consisting of
Core or Compatibility. Each AdapterBase is now constructed with the
FeatureLevel it supports.

When discovering PhysicalDevices, create an AdapterBase for each of
the FeaturLevels which that PhysicalDevice supports. For most of the
backends, this will mean Core and Compatibility, while OpenGL and
D3D11 support only Compatibility.

Bug: dawn:1796.

Change-Id: I828247ef43e2220805ccf6c08827aa5e2382a026
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/118240
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Stephen White <senorblanco@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2023-05-06 01:26:25 +00:00
Peng Huang 3ee4f6af41 d3d11: fix indirect indexed draw
Bug: dawn:1791
Change-Id: If2fe2df3fdd5d719070e07afd1d7c7b68b42e1ee
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131801
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Peng Huang <penghuang@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2023-05-06 01:14:18 +00:00
Loko Kung 743ceb017a Adds a check and message for when encoding on a finished encoder.
Bug: dawn:1736
Change-Id: I1b968823deb23b1b047f9430b3410b8b5279eb52
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131504
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Loko Kung <lokokung@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2023-05-05 23:14:42 +00:00
Peng Huang 300ec34c72 d3d11: fix indirect draw and dispatch
Bug: dawn:1716
Bug: dawn:1791
Change-Id: I6027a9ab8b33bfaf80d32300eed11fe7df5135e3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131760
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Peng Huang <penghuang@chromium.org>
2023-05-05 21:50:39 +00:00
Peng Huang 283b3a042f d3d11: fix and enable ComputeStorageBufferBarrierTests
The problem is becasue a resource can not be set as input and
output at same time on device context. So we have to track used
slots and unset related slots before binding a group.

This CL also unset all affect slots when a render pass or compute
pass is end, so all related resources could be unref from the
device context.

Bug: dawn:1705
Change-Id: I597762ad8afa3b8df7139b0070f0b457d7319836
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131380
Commit-Queue: Peng Huang <penghuang@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-05-05 20:07:24 +00:00
Ben Clayton b703afc061 tint/utils: Support hetrogeneous hashmap key lookups
Allows map with std::string keys to be looked up, using a c-string or
stringview without incuring a temporary heap allocation.

Change-Id: Id5b7fd5ac1ab7febf545472f9767273f8637a0de
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131623
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2023-05-05 18:55:15 +00:00
Ben Clayton 4204bb3ef1 tint/writer/spirv: Fix build on MSVC / some clang builds
For some reason, only a handful of compilers complain about the implicit cast of an enum to a uint32_t.
Make the cast explicit to fix these builds.

Change-Id: Ib57026cbbb28e330055a5c64eaf1ae05ea3ff7dd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131744
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: James Price <jrprice@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
2023-05-05 17:00:52 +00:00
Ben Clayton 1dd578ad35 Revert "ir/spirv-writer: Emit entry point declarations"
This reverts commit 90789ea1f8.

Reason for revert: Compilation errors on MSVC and some linux machines.

Original change's description:
> ir/spirv-writer: Emit entry point declarations
>
> Emit the OpEntryPoint instruction with the pipeline stage. Interface
> variables will be done later.
>
> Emit OpExecutionMode instructions for the workgroup size and fragment
> shader origin, depending on the pipeline stage.
>
> Bug: tint:1906
> Change-Id: Ieeeda5f17da48a8cf0d3344d3b254542c7198cb9
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131381
> Kokoro: Kokoro <noreply+kokoro@google.com>
> Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
> Commit-Queue: James Price <jrprice@google.com>

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

Change-Id: If828577648a585a51568eabc79f41e1735b72b8a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: tint:1906
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131743
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
2023-05-05 13:40:23 +00:00
Ben Clayton 146b67e0cd tint/ir: Replace getter with raw fields for more classes
There's an odd mix of IR classes that use raw fields, and others that
have getters. Migrate a bunch of those getters to raw fields.

Change-Id: I5c80abe16d3b4e6e5e9dc8f985611f9edfe5cdc6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131621
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-05-05 12:12:16 +00:00
Ben Clayton 895d240fbf tint/ir: Replace Converter with FromProgram() free function
ToProgram() will most likely be conditionally compiled as a separate .h
and .cc file. With just one static method, ir::Converter doesn't make a
lot of sense to be a class. Just replace with a free-function.

Bug: tint:1902
Change-Id: I305bf9cb73082a94848ec5b94129feabdb9b6fe9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131620
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-05-05 09:51:22 +00:00
Zhaoming Jiang 960918b1b6 Dawn: fix limit tiering for maxBufferSize and maxStorageBufferBindingSize
This CL fix an issue related to tiering the maxBufferSize and
maxStorageBufferBindingSize limits. In detail, this CL:
1. Fix the maxStorageBufferBindingSize tiers to [128MB, 1GB, 2GB-4,
   4GB-4] instead of the original last two 2GB-1 and 4GB-1, holding the
   guarantee that maxStorageBufferBindingSize is a multiple of 4 bytes.
2. Add a maxBufferSize tier 4GB, ensuring the guarantee that
   maxStorageBufferBindingSize must be no larger than maxBufferSize in
   case of it tiered to 4GB-4. Previously the largest maxBufferSize tier
   is 2GB, making this guarantee broken after tiering.
3. Move the adapter limits normalization logics in adapter initializing
   to Limits.cpp to allow unittest. Related unittests implemented.
4. Normalize tiered limits to ensure that tiered
   maxStorageBufferBindingSize and maxUniformBufferBindingSize are no
   larger than tiered maxBufferSize. Related unittests implemented.

Issue: dawn:1780
Change-Id: I4821f196fa89c7f18ebbf8e5e45df1c3268db895
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130120
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2023-05-05 02:14:31 +00:00
James Price 90789ea1f8 ir/spirv-writer: Emit entry point declarations
Emit the OpEntryPoint instruction with the pipeline stage. Interface
variables will be done later.

Emit OpExecutionMode instructions for the workgroup size and fragment
shader origin, depending on the pipeline stage.

Bug: tint:1906
Change-Id: Ieeeda5f17da48a8cf0d3344d3b254542c7198cb9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131381
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: James Price <jrprice@google.com>
2023-05-04 22:46:21 +00:00
James Price 436fffe2a1 ir/spirv-writer: Emit function declarations
Emit the return type, function type, and the OpFunction
instruction. The body is just a label and a hardcoded OpReturn for now
and will be emitted properly in a future patch, along with entry point
declarations and function parameters.

Bug: tint:1906
Change-Id: Id7117da078bccd77a00afb54a63c9c55b13236f9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131600
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
2023-05-04 21:26:58 +00:00
Loko Kung 0edb5204ab Adds AllowUnsafeAPIs toggle and fixes code-paths to use it.
- Note unsafe API paths currently check both AllowUnsafeAPIs and
  DisallowUnsafeAPIs toggle, allowing unsafe APIs if either is set to
  explicitly allow them. This will be removed once users have been
  updated.

Bug: dawn:1685
Change-Id: If322cc6dbe5ac3a02a31956df6fed0f5d3ec8e8f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131400
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Loko Kung <lokokung@google.com>
2023-05-04 21:09:40 +00:00
dan sinclair c9734160bc [ir] Add tests for compound operators.
This CL adds tests for the compound assignment builder_impl. The ops
which can not be compound assigned have been moved to report diagnostics
messages.

Bug: tint:1718
Change-Id: Ia3dbbf706f0f074fd988a2b1c01f3fb5cc602c04
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131661
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
2023-05-04 20:49:45 +00:00
dan sinclair eae9902c81 [ir] Add store test
This CL adds a simple test for the builder_impl for assignments.

Bug: tint:1718
Change-Id: Ia727ace4d01f107c6ac2ad1f8e430ef00ec43da9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131660
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
2023-05-04 20:46:02 +00:00
James Price 02b5b224e3 ir/spirv-writer: Add support for scalar types
Also add a test helper header with some base classes that derive from
the IR builder.

Bug: tint:1906
Change-Id: If642bc64a50b6cae10363018a8dea8547ab9f542
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131441
Commit-Queue: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
2023-05-04 18:50:49 +00:00
dan sinclair b169165633 [ir] Add tests for unary conversion.
This CL adds tests for the builder_impl unary conversion.

Bug: tint:1718
Change-Id: Ie0b6dae94e2c8d3d702331448daa0de54181851d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131582
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: James Price <jrprice@google.com>
2023-05-04 18:15:42 +00:00
dan sinclair 63716c55cc [ir] Spit builder_impl tests.
This Cl splits apart the builder_impl test file in order to make it
easier to determine what has been tested.

Bug: tint:1718
Change-Id: Ib2f4d11a398b26fd774eb8c60555475053f20e0b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131581
Kokoro: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2023-05-04 18:01:26 +00:00
dan sinclair 34f41c7bad [ir] Change unary not to a binary equal
This CL removes unary `not` and instead emits `x == false`. When coming
back out of IR we can detect the `== false` and convert back to a `!`.

Bug: tint:1928
Change-Id: I905493182533ac2787ab9fe9245c8b53d51c1298
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131580
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
2023-05-04 17:09:07 +00:00
dan sinclair e964f5163c [ir] Update type display in disassembly, remove string methods.
This CL consolidates the various ToInstruction and ToValue methods into
the disassembler. The type output is updated to prefix `:` instead of
surrounding by `()`.

Bug: tint:1718
Change-Id: I69e2d96ffbfe2113932740ce69d0967d29d41541
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131460
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2023-05-04 13:34:06 +00:00
James Price b298b6a222 ir/function: Add missing <array> include
Change-Id: I13c1d6d102e1fe11bd05320e8d363719b94f2552
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131540
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Auto-Submit: James Price <jrprice@google.com>
2023-05-04 11:54:19 +00:00
Ben Clayton 29bff642fc ir: Use std::optional::value_or to simplify code
Change-Id: Iaf3ec58a70cd49c508c3279f62c029440b82c599
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131520
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2023-05-04 11:53:31 +00:00
Antonio Maiorano f789854a94 tint: fix undetected overflow in const-eval refract
Bug: oss-fuzz:58526
Change-Id: I59a2e9151036da6aba83c523605664b54002f3dc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131342
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2023-05-04 08:42:15 +00:00
Jiawei Shao c81bc4521f D3D12: Disable the toggles about alpha blending on latest Intel driver
This patch disables all the toggles about the alpha blending issue on
the latest Intel D3D12 driver which has the fix against all the related
driver bugs.

Bug: dawn:1579
Change-Id: Ief8b08fd00df1b2872d663245d728374fb38a5b3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131440
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2023-05-04 08:07:28 +00:00
François Beaufort b22c5a465c Handle new errors to WGPUBufferMapAsyncStatus
This CL raises "mapping already pending", "offset out of range", and
"size out of range", and "validation error" error to make it easier
for developers to know why APIMapAsync fail in those cases.

Bug: chromium:1431622

Change-Id: I6f04751b2d67420a51d94aeac39ffbfd6e126fbf
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/129740
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Fr <beaufort.francois@gmail.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2023-05-04 06:46:19 +00:00
Brandon Jones 45b44fdb9f Remove DawnDeviceDescriptor code paths
This was listed as deprecated and has been for a while (at least a
year.) No code paths in Dawn make use of it and the few remaining
uses in Chrome are being removed in
https://chromium-review.googlesource.com/c/chromium/src/+/4501347

Bug: dawn:1797
Change-Id: Ifff4e5609e228080361e5d3a20a881eaf811ab6c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131321
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Brandon Jones <bajones@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2023-05-04 02:01:52 +00:00
James Price 8f9ea96c20 tint/writer/spirv: Add path for generating from IR
This adds a GeneratorImplIr class and an option to the SPIR-V writer
to use it instead of the AST-based GeneratorImpl class.

The Tint exe now has a --use-ir flag which will use this path.

Bug: tint:1906
Change-Id: I34cc5c7468c8faf4a808669da8c44551ad01da8f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131341
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
2023-05-04 01:31:36 +00:00
James Price 057b7f326e tint/writer/spirv: Use Diagnostics() for errors
Brings the SPIR-V writer in line with other writers.

Change-Id: Iaa261150de953b414f966dd004bd48f7315ceb0c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131221
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
2023-05-03 23:25:01 +00:00
James Price cb8f3308a3 spirv-reader: Error for OpUndef image argument
We can't generate meaningful WGSL for this case, so just avoid
crashing.

Bug: oss-fuzz:58112
Change-Id: I6c02d9113c237171fdafcd06e063a62f26cae9c0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128900
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: David Neto <dneto@google.com>
2023-05-03 23:11:55 +00:00
James Price f885a90a5f tint/writer/spirv: Create Module class
Move the generic code for building up a SPIR-V module from Builder to
a new Module class. This can then be reused by the new IR-based SPIR-V
writer.

Switches to naming of methods to camel case to bring in line with the
rest of the codebase.

Bug: tint:1906
Change-Id: I7775edff6fe56328c6562559c016a19097b50805
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131340
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-05-03 22:54:15 +00:00
dan sinclair 09b02ffc7b [ir] Split the Terminator into two nodes.
This CL moves to having a `FunctionTerminator` and a `RootTerminator` so
we can assert if the IR is in a function depending on the terminator
seen.

Bug: tint:1929
Change-Id: Ie9e3aed71b7cf3b91439efbcca20885ec2cabe24
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131281
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: James Price <jrprice@google.com>
2023-05-03 22:13:28 +00:00
dan sinclair 69bb5dd816 [ir] Add function return information.
This Cl adds information into the IR on the function return type and any
associated attributes.

Bug: tint:1915
Change-Id: I74cbf2613b4ae575e33a61d04d30b515df6ba796
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131300
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-05-03 21:31:51 +00:00
dan sinclair 9d9a38336e [ir] Add function attributes
This CL adds the pipeline_stage and workgroup_size attributes into the
IR function.

Bug: tint:1915
Change-Id: I245dbf0104a1784cff364535106b3e520322ac73
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130920
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-05-03 19:22:31 +00:00
dan sinclair 4cadbc4daf [ir] Handle IdentifierExpression
This Cl adds a scope stack into the IR builder and uses it to replace
IdentifierExpressions with the relevant IDs. If the IdentifierExpression
was const-eval'd then it will be replaced by the constant value.

Bug: tint:1919
Change-Id: I54e38d56bd24e2ced1818c509115dd5a5149cb40
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130900
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
2023-05-03 19:20:48 +00:00
Austin Eng 94bc4cf046 Log HLSL for dump_shaders even if HLSL compilation fails
Fixed: dawn:1681
Change-Id: I56abb56c47d97105fac541a49c377cc0222feb10
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130460
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2023-05-03 19:19:19 +00:00
Peng Huang a246d8d3c2 d3d: remove external image related name alias from d3d12 namespace
Bug: dawn:1705
Bug: dawn:1724
Change-Id: Idd62c8f0a4f77ec975161fad7e981efb8326a2a6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131220
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Peng Huang <penghuang@chromium.org>
2023-05-03 18:03:27 +00:00
Austin Eng 249f8d5aa2 d3d: match maxStorageBufferBindingSize and maxBufferSize
Fixed: dawn:1751
Change-Id: I77303bf23a9a64e38acc72d9f039097b4d901306
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131280
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Austin Eng <enga@chromium.org>
Kokoro: Austin Eng <enga@chromium.org>
2023-05-03 17:41:29 +00:00
Albin Bernhardsson 42b688bcff Fix Vulkan swapchain synchronization
It is necessary to use a semaphore to synchronize rendering and
presenting even when the graphics and present queues are the same.

This fixes rendering artifacts encountered on a Mali-G78 device.

Bug: dawn:269
Change-Id: Ieb0240d3668b7f9f68857ed3cf8d3bfea18cf33a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130221
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Albin Bernhardsson <albin.bernhardsson@arm.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2023-05-03 17:06:13 +00:00
Ben Clayton 1545ca191b tint: Remove Program|ProgramBuilder::FriendlyName()
Now that we don't need the symbol table to get the names of the types, we can just call FriendlyName() on the type directly.

Change-Id: I39478f5b8847ee032e77c15fd0de0665ddbf4811
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130220
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: James Price <jrprice@google.com>
2023-05-03 16:26:40 +00:00
dan sinclair 6ac51c1c57 [ir] Update binary and unary names.
This CL removes the LogicalAnd and LogicalOr binary kinds, and updates
the names in binary and unary to drop `bit_` and `log_` prefixes.

Bug: tint:1718
Change-Id: Ie180549ee5ecfad65fff9e4b4db86dd8a8b54833
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130800
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2023-05-03 16:25:44 +00:00
Antonio Maiorano fa00fe9d41 tint/hlsl+glsl: fix workgroupUniformLoad polyfills
The BuiltinPolyfill transform expects the DirectVariableAccess transform
to run after it, but this regressed as part of
https://dawn-review.googlesource.com/c/dawn/+/122203

Add unit test along with e2e 1926.wgsl test.

Bug: tint:1926
Change-Id: I5107453ce152b12e6f2f36930846e1fffa775708
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131020
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2023-05-03 15:30:54 +00:00
dan sinclair e903396ff2 [ir] Emit short-circuit as an `If` node
This Cl removes the `&&` and `||` logical binary nodes and replaces them
with a var declaration and if node.

Bug: tint:1925
Change-Id: I9f25411a9b9c909fa25f2f37cbd51181ac584acc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130500
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2023-05-03 14:59:03 +00:00
Loko Kung 2966d3ad08 Adds pass labels into the commands and plumbs through for Metal.
Bug: dawn:1784
Change-Id: Ie71360d83c4f3c47821916ebf8a187662e3f286f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131100
Commit-Queue: Loko Kung <lokokung@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2023-05-03 07:33:18 +00:00
Loko Kung 2552dd3c9f Plumbs labels for the following Metal objects:
- Buffers
- Pipelines
- QuerySets
- Samplers
- Shaders
- Textures

Change also includes:
- Metal debug name utilities

Bug: dawn:1784
Change-Id: Iddd2546f842c794570c225577d35c82e56809c6c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130940
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Loko Kung <lokokung@google.com>
2023-05-03 05:57:06 +00:00
Loko Kung b27e2bfa71 Adds generation for WGSL descriptor to rename source->code.
- Adds a deprecation warning for the incorrect usage.
- Adds test to verify that the warning is emitted and that the results
  are equal.
- Fixes all existing tests to use the newer code path.

Change-Id: I01bf85137ad1c66966e1aa0259ae03fc5247ba25
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130320
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Loko Kung <lokokung@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2023-05-03 02:23:25 +00:00
Stephen White fed6b6b35b Turn AdapterBase into a wrapper class.
Change AdapterBase from an alias to PhysicalDeviceBase to a thin
wrapper class holding a ref to a PhysicalDeviceBase. This way,
mutiple AdapterBases can point at the same PhysicalDeviceBase.

For now, InstanceBase wraps all PhysicalDeviceBases discovered by a
backend in a single AdapterBase. In the future, this relationship will
become many-to-one.

Since Devices now maintain a ref on the AdapterBase wrapper (in order to
query toggles, etc), PhysicalDeviceBase::CreateDeviceImpl() now takes
the AdapterBase as an argument, so that the PhysicalDeviceBase knows
which AdapterBase to vend a Device for.

Note that the Toggles also still remain on the PhysicalDeviceBase, to
be moved up to the AdapterBase in a future change.

Bug: dawn:1774
Change-Id: Idef5d24fbd66d8552959230e246e453abddcc736
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131001
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2023-05-03 01:29:44 +00:00
Austin Eng 5eb3619d3e Add error context to clarify which depth/stencil function/op is validated
Fixed: dawn:1735
Change-Id: I5e3e3e67bb6fd01c10257a2a8c39ba29b49e0933
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131081
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Brandon Jones <toji@google.com>
Kokoro: Austin Eng <enga@chromium.org>
2023-05-03 00:51:08 +00:00
Austin Eng e89f88b600 Add error context on Queue::API* methods
Fixed: dawn:1747
Change-Id: Icc8f4dbc6fcf69c117f880b5ef9d54cf256f7062
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131080
Reviewed-by: Brandon Jones <toji@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2023-05-03 00:43:42 +00:00
Peng Huang 80cf5e51cc d3d11: enable some compute shader tests
Known issues:
 d3d11 buffer cannot be uniform and storage at same time.
 DispatchWorkgroupsIndirect doesn't work correctly.

Bug: dawn:1705
Bug: dawn:1791
Bug: dawn:1792
Change-Id: I14df33c441198fcde9063ad85251da30c4b12c6a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131060
Commit-Queue: Peng Huang <penghuang@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2023-05-02 22:29:23 +00:00
Brendon Tiszka 1f8413f50a Add Dawn Wire Server LPM Fuzzer [3/N]
Add ability to define custom protobuf structures for commands that
need to be hand written.

Bug: chromium:1374747
Change-Id: I69d5c55d69c3544835a23e4e0360900b991ccbd3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/114643
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Brendon Tiszka <tiszka@chromium.org>
2023-05-02 21:41:22 +00:00
Stephen White ebafab6556 Rename vulkan::Adapter -> vulkan::PhysicalDevice.
Bug: dawn:1774
Change-Id: Iad2896033fc4ae04513444db1a0c941c6c1681ae
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131000
Commit-Queue: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-05-02 20:48:09 +00:00
dan sinclair c970e806db [ir] Emit `var` and `let` into the IR
This CL adds a nodes for `var` variables. In order to support
global var a new module level block is added, the `root_block`. It only
exists if there are declarations which are emitted into it. The
initializer for the `var` is assigned through a `store` instruction.

A `let` declaration is just the initializer result.

Bug: tint:1897
Change-Id: Icb949699ef643988151cc52026f9ad6a12cdd93f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130761
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2023-05-02 15:47:29 +00:00
jchen10 1b01b665d7 Workaround for UpdateSubresource1 16-byte alignment
In case of misalignment, we write to a temp staging buffer first,
and then copy to the dest buffer using CopySubresourceRegion.

Bug: dawn:1776
Bug: dawn:1705
Change-Id: Iba44dd79d9ee4b02f8cc83263bcfc911e1cce136
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130140
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Jie A Chen <jie.a.chen@intel.com>
2023-05-02 08:36:10 +00:00
dan sinclair 642a4f1d8c [ir] Make dump output more consistent.
This Cl updates the dump output for the IR to be a bit more consistent.
Brackets are removed, named calls are used in place of symbols. Trailing
commas cleaned up. Values have their type appended to make it clearer
what they are when a literal is emitted.

Bug: tint:1718
Change-Id: Ie202d4a4f8267d00b9af4864063b7133f4c7f324
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130000
Kokoro: Kokoro <noreply+kokoro@google.com>
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2023-05-02 08:27:28 +00:00
Austin Eng 7b82609894 Make TextureComponentType an internal enum
Fixed: dawn:1682
Change-Id: Iadbe7e2829805fed9a7f7e3bb0925544f4318380
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130440
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-05-02 04:34:55 +00:00
Loko Kung ba242e53cc Removes remaining V1 deprecation utilities.
- Note: Any future deprecations should directly use
  device->EmitDeprecationWarning and switch to a ValidationError after
  the deprecation period if applicable.

Bug: dawn:1685
Change-Id: Ia2e51eca32a9645ce362718200c50240d51d6ea0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130840
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Loko Kung <lokokung@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2023-05-02 00:38:56 +00:00
Stephen White 9091b46278 Rename AdapterD3D* -> PhysicalDeviceD3D*.
Bug: dawn:1774

Change-Id: I9eca75c75c1ec162112915af3bd8371e808c2d60
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130421
Commit-Queue: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-05-01 23:10:47 +00:00
Peng Huang 5c2f1678be d3d11: add tests in AdapterDiscoveryTests test suit for d3d11
Bug: dawn:1705
Change-Id: I0841e00b9595651882c7b1c5ae21f00d0201c5a9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130680
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Peng Huang <penghuang@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-05-01 23:05:42 +00:00
Stephen White 8076b2ad73 Rename AdapterGL -> PhysicalDeviceGL.
Bug: dawn:1774

Change-Id: Ic137524027eb519af4cb46396b9a8cea9e4cb7f4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130420
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2023-05-01 21:51:16 +00:00
Stephen White 556147c333 Rename null::Adapter -> null::PhysicalDevice.
Bug: dawn:1774
Change-Id: I05f4578e08175c4ce5703c5555689ba517b4590d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130780
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2023-05-01 21:37:44 +00:00
Stephen White be4b208ab6 Rename metal::Adapter -> metal::PhysicalDevice.
Change-Id: I558b7a22359437dd2a54f05a55a4128a806c7783
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130760
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2023-05-01 21:04:15 +00:00
Austin Eng b15d853239 Split MakeVertexDesc so it is const
Fixed: dawn:1384
Change-Id: I6071097e8d78b8462459623443b66f3afa42d9d8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130480
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Brandon Jones <toji@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2023-05-01 19:57:35 +00:00
Loko Kung 4e9ebeff02 Deprecates PopErrorScope returning a bool.
Bug: dawn:526
Change-Id: Ia4e985fbe4fcb5edb3fe80849f5b0df0190eea00
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130340
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Loko Kung <lokokung@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-05-01 19:25:18 +00:00
Peng Huang fab65123e1 d3d11: remove the workaround in DeviceOutlivesInstance
Bug: dawn:1705
Change-Id: Ic10965ee246b197f72f2be063b6bf70122c5a4ed
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130700
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Peng Huang <penghuang@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-05-01 19:16:33 +00:00
Peng Huang 765cdc283a d3d11: enable render related end2end tests
Set Toggle::ApplyClearBigIntegerColorValueWithDraw for device,
since D3D11 can only clear RTV with float values. It workarounds
issues for clearing some RTV with really big integer values.

Bug: dawn:1705
Change-Id: I2e7ec7f527b9a41edc28a004f7989842c6ced3b7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130600
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Peng Huang <penghuang@chromium.org>
2023-05-01 18:06:39 +00:00
Stephen White e4877b7e68 Rename AdapterBase -> PhysicalDeviceBase.
AdapterBase will become a (thin) wrapper class in an upcoming patch,
allowing a single PhysicalDeviceBase to be wrapped in multiple AdapterBases,
each with different toggles and flags.

For now, alias AdapterBase to PhysicalDeviceBase.

Design doc: https://docs.google.com/document/d/1Ag3UAD6D1OVt9-MwKltzLefVhwKRdX0RqML2etrYVS4/edit

Change-Id: Ie77e99508be5285b651aa24ccb412bc9ff8b0111
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130300
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2023-05-01 16:39:04 +00:00
Peng Huang 0e2a833da8 d3d11: enable entrypoint tests for d3d11 backend
Bug: dawn:1705
Change-Id: Ie8f29132726c015cbe4f552eb77afc1ecbc4a325
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130660
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Peng Huang <penghuang@chromium.org>
2023-05-01 16:29:15 +00:00
Peng Huang 925b77605e d3d11: enable d3d11 by default if it is not built with chromium
Bug: dawn:1705
Bug: dawn:1778
Change-Id: I8d84582f6f9e84676572ecb9c174d0117468888b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130580
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Peng Huang <penghuang@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-05-01 16:13:00 +00:00
Peng Huang 6ffec70123 d3d11: fix link errors
Bug: dawn:1724
Change-Id: If27342937e450d11a54f1d36f4378feb69d5e98e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130400
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Peng Huang <penghuang@chromium.org>
2023-04-29 00:57:59 +00:00
Brandon Jones df6cb23649 Change D3D12 Descriptor Allocator To Invalidate Submitted Descriptors
Changes D3D12 descriptor allocator to invalidate existing descriptors
after the descriptor heap was submitted for use. This fixes a
synchonization issue where stale descriptors were seen as valid because
command list execution ran long.

Bug: dawn:1701
Change-Id: Ibfd450b3be6cf91d66e8dce4ffd19ecf1a37f7f5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/129920
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Brandon1 Jones <brandon1.jones@intel.com>
2023-04-28 22:31:33 +00:00
Peng Huang 948ef4292f d3d11: fix Queue::WriteTexture() and enable queue related tests
Bug: dawn:1705
Change-Id: I63540d46335401aeaa46efe157fdb7a191aa4637
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128860
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Peng Huang <penghuang@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-04-28 19:01:32 +00:00
Peng Huang 85d98a91f7 d3d11: fix and enable viewport end2end tests
Bug: dawn:1705
Change-Id: Ie75f301465b5000c9ebdd58ab0cb1901d251730e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128862
Commit-Queue: Peng Huang <penghuang@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2023-04-28 19:01:18 +00:00
Peng Huang e5a4cfb935 d3d11: enable some CopyTests
To make B2B, B2T and T2B testes work, this CL implements several
missed functions:
 - Texture::Clear() is need for initializing texture data
 - Texture::Read() is need for readback data from 2d and 3d textures

Bug: dawn:1740,dawn:1768
Change-Id: Ib9e354c82fcdc8cc4e86b1699fa652cfc4a50721
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128621
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Peng Huang <penghuang@chromium.org>
2023-04-28 17:22:03 +00:00
Peng Huang d7a4483148 d3d: move some external image related code to d3d namespace
Expect ExternalImageDXGIImpl, most external image related code can
be shared between d3d11 and d3d12. This CL move those code into
d3d namespace

Bug: dawn:1724
Change-Id: I6c32cfd36880d4d009b272886a9369dc99dffbe6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130100
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Peng Huang <penghuang@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2023-04-28 16:53:28 +00:00
Austin Eng 220aa01153 Fix name of libdawn_webgpu_dawn to libwebgpu_dawn
Fixed: dawn:1298
Change-Id: I7a32b644349837fcfc5e258232285b591f7e99a8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/129860
Commit-Queue: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2023-04-28 15:14:37 +00:00
Corentin Wallez 96b61c56fa Remove support for macOS 10.11 and 10.12
Fixed: dawn:1397
Change-Id: I58c899bb58c445d56c544828a52eddd720bc4847
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/129840
Reviewed-by: Brandon Jones <bajones@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2023-04-28 11:55:21 +00:00
jchen10 c755ec54aa d3d11: enable BindGroupTests
The cases can pass now with a few fixes.

Bug: dawn:1776
Bug: dawn:1705
Change-Id: I4a38887c51d003b4e9b782fd9217c9ce2c7dd423
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128980
Commit-Queue: Jie A Chen <jie.a.chen@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-04-28 02:40:48 +00:00
dan sinclair f26b1269bd [ir] Move `ir::Bitcast` to inherit `ir::Call`.
This CL moves `ir::Bitcast` from `ir::Instruction` to `ir::Call`. The
`bitcast` is, essentially, a templated call instruction.

Bug: tint:1904
Change-Id: Iab8ccffaa484767318433f5fc6c33670c5f6375e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/129940
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
2023-04-27 20:28:01 +00:00
dan sinclair 4a2e0ad36b [ir] Make `ir::Discard` a child of `ir::Call`.
The `discard` statement is, essentially, a function call. This CL moves
the `ir` node from being under `Instruction` to be under `Call`.

Bug: tint:1905
Change-Id: I8098dfc6047286b1c5249679139bcc83aa1cb21d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/129681
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2023-04-27 20:02:17 +00:00
Ben Clayton bc6720b9f6 tint/type: Remove Source from Struct & StructMember
type::Struct is the base class of sem::Struct.

type::Struct does not have a Declaration() member, so it does not make sense for it to have a Source.

Given that sem::Struct has a Declaration() method, use this to obtain the source.

Same logic applies to StructMember.

Change-Id: I693f659c35216ebe5eac5ea2a5b6457773077ddc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/129480
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Ben Clayton <bclayton@google.com>
2023-04-27 19:29:45 +00:00
Ben Clayton bc9e422728 tint: Use type::Struct where possible
type::Struct does not have an ast::Struct declaration, so use that for
builtin structures.

Fix up logic that assumed sem::Struct for both user-declared and builtin
structures to use type::Struct instead.

Assert in the sem::Struct and sem::StructMember that the AST node is not
nullptr.

Change-Id: Ic8fcf27d5610c814ea3b504694c6a94db6cf1191
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/129483
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
2023-04-27 18:31:44 +00:00
Ben Clayton 576ba1c493 tint: Add StructMember attributes to sem.
Removes the need to examine AST attributes.

Change-Id: Iaaa6b10fd56baf732057c4c3960c1bfc5bbdeaa6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/129621
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-04-27 17:58:25 +00:00
Ben Clayton 333cea405c tint/resolver: Clean up attribute resolving
Attributes resolving was done ad-hoc throughout the resolver, with the
validator ensuring that attributes were only applied to the correct nodes.

The ad-hoc nature meant that attributes were inconsistently marked and
resolved, and the attribute arguments were not always validated
(especially when used internally).

This change inlines the attribute processing into the appropriate places
in the resolver, and uses a standardized error message for attributes
that cannot be applied.

Change-Id: Ic084820949bbf8276fb2d33c103fa29b77824a69
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/129620
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
2023-04-27 17:21:58 +00:00
dan sinclair fe8a76cbbc [ir] Use the const eval results for expressions.
If an expression has a `sem::ValueExpression` attached we can use it to
directly obtain the result of the expression and stop emission. This Cl
updates the IR builder to pull the expression result if possible.

Several of the tests have been updated to go through a function in order
to stop const-eval from removing all the test content.

Bug: tint:1924
Change-Id: I6458cc297efc7789ac200069c18f75e8eb70c63b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/129680
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2023-04-27 15:45:56 +00:00