Commit Graph

8203 Commits

Author SHA1 Message Date
Peng Huang e3eb03f8a3 Add the last usage serial in Buffer
Add the last usage serial in Buffer, it is used for optimizing
MapAsync(), so the callback of MapAsync() is called when the last usage
serial is done instead of using the current pending serial when
the MapAsync() is called.

Bug: b/265151060
Change-Id: Ibc95d4e41d41896f0a49b0fd1068912b46ea14e1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116693
Commit-Queue: Peng Huang <penghuang@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2023-01-19 20:33:32 +00:00
Ben Clayton f1fc8c8bc7 tint: Remove commented out includes
Change-Id: I046837b32f27b30920719c7067aae83887e0f039
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117205
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2023-01-19 17:15:00 +00:00
Corentin Wallez 8b5d804963 Revert "DISABLE WireBufferMappingReadTests.DestroyInsideMapReadCallback"
This reverts commit 1966ea9727.

Reason for revert: dawn:1619 has been fixed.

Original change's description:
> DISABLE WireBufferMappingReadTests.DestroyInsideMapReadCallback
>
> It is failing under ASAN but should be fixed after at the same time as
> issue dawn:1619 that makes mapping callbacks called only at the end of
> the BufferBase method.
>
> Bug: dawn:1619, dawn:1621
> Change-Id: Idfdb6e36432a47eaef63b46e041f1404a2562f40
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116284
> Auto-Submit: Corentin Wallez <cwallez@chromium.org>
> Reviewed-by: Austin Eng <enga@chromium.org>
> Kokoro: Kokoro <noreply+kokoro@google.com>
> Commit-Queue: Austin Eng <enga@chromium.org>

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: dawn:1619
Fixed: dawn:1621
Change-Id: Ib700147543c12b35005b718b50ed1b19245cf0ff
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117440
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2023-01-19 16:05:27 +00:00
Austin Eng 03b69ff573 Delete StagingBuffer in favor of mappable buffers
This CL removes StagingBuffer to start to unify implementation
code paths for WriteTexture/Buffer and CopyBufferToTexture/Buffer.

This will help implementing a buffer-to-stencil copy workaround.

Bug: dawn:1389
Change-Id: Ieb23b8d871f14544ef01445a495dc1077274c9f2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117167
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-01-19 02:54:07 +00:00
Takahiro 44e9db3866 Allow reentrant buffer mapping operations in the mapping callback.
WebGPU clears [pending_map] before resolving or rejecting promises,
which means that the callback for .then or .catch is allowed to unmap,
remap, or do anything with the buffer assuming previous mapping
operations are entirely done the buffer.

Mimic this in Dawn by finishing all operations related to mapping
before calling callbacks they might trigger.

bug: dawn:1619
Change-Id: I9e5b82789a68f28a496a54c31bf9fe0ffde23ccf
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116220
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Takahiro <hogehoge@gachapin.jp>
Reviewed-by: Austin Eng <enga@chromium.org>
2023-01-19 01:11:56 +00:00
Ben Clayton d03dceebf3 tint: Add bgra8unorm storage texture support
Polyfill this for the SPIR-V, HLSL and GLSL backends by replacing bgra8unorm with rgba8unorm, and swizzling.

Bug: tint:1804
Change-Id: I36638202840d7313001dff6c5b60dcb948988c34
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117204
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-01-18 19:42:03 +00:00
Austin Eng e2be18a7fd Workaround stencil to buffer copies on Metal Intel
Stencil to buffer copies don't capture contents
written in a rendering stage. Copying through an
intermediate texture fixes this problem on Metal Intel.

Add test for the code path that found the issue:
Nonzero-mip stencil copy, discard, then read

Bug: dawn:1389
Change-Id: I63d982df6bace4b5053d3c643b8abda1682490d1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116851
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-01-18 17:55:14 +00:00
Peng Huang d3b8c489a1 Merge two queue submissions in Queue::SubmitImpl()
Currently Queue::SubmitImpl() may cause two queue submissions, one is
because of Tick() call which will submit pending commands if there are.
The other one is after converting frontend commands to backend command
buffer. Queue::SubmitImpl() will submit converted commands. However
usually queue submissions are expensive, so merge those two queue
submissions into one by not calling Tick() before converting frontend
commands, so pending commands and recorded commands can be submitted
together. After that, we call Tick() to resolve callbacks and perform
bookkeeping operations (deallocating memory for passed operations,
etc).

Bug: b/265151060
Change-Id: Ia171771bcc1061dc599a58aa6d213a645696fb75
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116929
Auto-Submit: Peng Huang <penghuang@chromium.org>
Kokoro: Ben Clayton <bclayton@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Peng Huang <penghuang@chromium.org>
2023-01-18 14:40:07 +00:00
Peng Huang 429c2f93f4 Fix vulkan::Buffer::TransitionUsageAndGetResourceBarrier()
Do not transition if the buffer usage is already MapWrite

Change-Id: I16cf68501e19a5b60d6c6f28eaa539df691f14fd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117240
Reviewed-by: Austin Eng <enga@chromium.org>
Auto-Submit: Peng Huang <penghuang@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Peng Huang <penghuang@chromium.org>
2023-01-17 23:40:41 +00:00
shrekshao e597e04e13 Validate if depth attachment is present when frag_depth is written
Bug: dawn:1636
Change-Id: I47aa4e5734b8e70e8c5a9171872a44a577d168d7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116859
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Shrek Shao <shrekshao@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-01-17 20:53:55 +00:00
Austin Eng cdec06a2aa Revert "Suppress vkUpdateDescriptorSets-None-03047"
This reverts commit afc3f9d4c7.

Reason for revert: crbug.com/dawn/1615 should be fixed now that
vulkan-deps has rolled into Chromium.

Original change's description:
> Suppress vkUpdateDescriptorSets-None-03047
>
> Bug: dawn:1615
> Change-Id: I40f745fe7f7736c9c5ece34fc9fb114d478c9118
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116926
> Commit-Queue: Austin Eng <enga@chromium.org>
> Reviewed-by: Zhaoming Jiang <zhaoming.jiang@intel.com>
> Auto-Submit: Austin Eng <enga@chromium.org>
> Kokoro: Kokoro <noreply+kokoro@google.com>

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: dawn:1615
Change-Id: I5dbd7ae82a0c4f3b3b88ea70a9faac35507a0418
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117320
Kokoro: Austin Eng <enga@google.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Auto-Submit: Austin Eng <enga@google.com>
Commit-Queue: Austin Eng <enga@google.com>
2023-01-17 19:32:46 +00:00
Austin Eng 1177c970d6 Add Metal workaround to allocate stencil8 as combined depth-stencil
Stencil8 textures don't work correctly on some drivers. Workaround
by allocating a combined depth-stencil texture instead.

Suppress newly added test on Windows ANGLE

Bug: dawn:1389, dawn:1637
Change-Id: Iea03e8f3e5e7f663ffc7b344ab007a73836557cc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116846
Reviewed-by: Loko Kung <lokokung@google.com>
Kokoro: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2023-01-17 19:06:12 +00:00
Yan,Shaobo 9b6f01d603 Fix flipY logic in CopyTextureForBrowser()
CopyTextureForBrowser() handles flipY by flipping source texture then
applying copy op. But this is not correct. Instead
it should find the copy rect and apply flipY op in copy rect only,
which is the same as WebGPU GPUImageCopyExternalImage.flipY definition
(https://www.w3.org/TR/webgpu/#dom-gpuimagecopyexternalimage-flipy).

This CL fixed the issue and updated related end2end tests.

Bug: dawn:1635
Change-Id: I3ea7c9de44fb45224bc438486e0e92385446bfb1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116924
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Shaobo Yan <shaobo.yan@intel.com>
2023-01-17 09:29:20 +00:00
Corentin Wallez 16c7ea6bfc Expand VUID-vkUpdateDescriptorSets-None-03047 flake suppression
This isn't just failing on Windows Intel but also Windows Nvidia.

Bug: dawn:1617
Change-Id: I9cd492512df4118161deabb9cf3f97eee29c60d4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116879
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
2023-01-17 09:16:49 +00:00
Austin Eng afc3f9d4c7 Suppress vkUpdateDescriptorSets-None-03047
Bug: dawn:1615
Change-Id: I40f745fe7f7736c9c5ece34fc9fb114d478c9118
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116926
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Zhaoming Jiang <zhaoming.jiang@intel.com>
Auto-Submit: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-01-14 01:00:19 +00:00
Antonio Maiorano 1fd40c1d81 Improve readme for dawn.node
Fix paths, add note about coverage, and format.

Change-Id: I7ac228bf880d6416e89b2f7a3324f9edac5c7a74
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117040
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2023-01-13 19:10:47 +00:00
Peng Huang f58ef99a15 Use std::move() for rvalues in SerialMap and SerialQueue
Change-Id: Iddaf8227cb76b823107997a740eb7563268ff859
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116925
Commit-Queue: Peng Huang <penghuang@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Auto-Submit: Peng Huang <penghuang@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-01-13 18:30:21 +00:00
James Price dd54f74de1 tint/uniformity: Rework generation of diagnostics
Flip the diagnostics so that the trigger location is on the builtin
that requires uniformity.

We also now show the place at which control flow diverges regardless
of where it is in the function call stack.

Change-Id: Id739a137b9011c900649b74165a6600a95d87ca4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116691
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2023-01-13 17:15:32 +00:00
Ben Clayton a1eed91cb0 tint: Use TINT_UNLIKELY() on TINT_ASSERT() condition
Change-Id: I92c6cf4b52132b806822b9edb163838f474d7c3b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116876
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2023-01-13 14:46:21 +00:00
Ben Clayton 884f95258d tint/utils: Add TINT_LIKELY / TINT_UNLIKELY macros
Emits branch prediction hints.
Give unlikely hints about where we call TINT_ICE.

Change-Id: Ied5bc3d7c8b3a838e96e5a0a64156048f90411c6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116875
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
2023-01-12 22:52:57 +00:00
Ben Clayton 91d39a7639 tint/resolver: Reduce Hashmap fixed sizes for UA
Uniformity analysis can have very deep call stacks, and we're on the cusp of stack overflowing. Reducing these sizes helps avoid cache misses at the cost of more heap allocations.

Change-Id: I4685d1d888d062456c296d9dc25231a48d72e941
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116878
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2023-01-12 20:31:33 +00:00
Ben Clayton 42363a5b18 tint/transform: Skip SimplifyPointers if possible
Change-Id: Id937d82e9062cf7a4c54401121ed6d22e5d4fd73
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116870
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-01-12 18:29:07 +00:00
Ben Clayton 3d6c263446 tint/utils: Add Log2 and NextPowerOfTwo
Shamelessly adapted from dawn's implementations.

Change-Id: I77aff9bd1c852c14b0009295024973aa17c50d55
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116873
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2023-01-12 18:23:28 +00:00
Ali Chraghi 2d94a0c075 Add missing Surface creation calls to get wayland surfaces working
Change-Id: I50e7b830769333dee4b865c3c0ab6e6016d81a9f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116922
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-01-12 16:11:44 +00:00
Brandon Jones 1f9e50edd4 Add another const to arrays of strings in renamer.cc
These were triggering the "mutable constants" check on the
android binary size bot.

https://logs.chromium.org/logs/chromium/buildbucket/cr-buildbucket/8792318173224229089/+/u/Trybot_Results/Mutable_Constants_Diff

Bug: dawn:286
Change-Id: I91d823edb14335cbb5139ef0e7723b2d360d1ebc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116801
Auto-Submit: Brandon Jones <bajones@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2023-01-12 11:44:40 +00:00
Corentin Wallez 961ad2358f DawnTest: try to more robustly handle device lost.
Deferred exepectations didn't handle device loss gracefully and would
crash, which meant all future tests were skipped. Instead of crashing,
skip the expectation, the test will fail anyway because the device was
lost.

Bug: None
Change-Id: If143f00a5ed9d2ddd5a923da7c771b1f40d80962
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116861
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-01-12 11:25:25 +00:00
Ben Clayton 7a41bf1e2f tint/transform: Skip Unshadow if possible
Change-Id: I73b7213aafe3ff25a5f6526e7002d2ec3dda57c3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116871
Kokoro: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2023-01-12 10:36:27 +00:00
Ben Clayton b607bfbddf tint/utils: Manually inline HashmapBase::Scan()
Clang was doing a poor job inlining this very hot function and its lambda argument.

Change-Id: Id2005b2ad131a1a1802bc7fb66085395b659ade2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116867
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2023-01-12 08:17:46 +00:00
Ben Clayton 973a685ad3 tint/transform: Skip LocalizeStructArrayAssignment if possible
Change-Id: I148c576f97359923c0d6fd6ffe864ca84ccd5b6b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116869
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2023-01-12 08:16:46 +00:00
Takahiro 46e3e213b0 Fix Buffer mapState after destroyed in Wire
WebGPU specification described that Buffer mapState must be
"unmapped" after destroyed because Destroy() must internally
call Unmap().

But in the current Wire implementation the mapState won't be
"unmapped". The root issue is that Destroy() doesn't update
mMapState in Wire.

This commit fixes the problem by updating mMapState in
Destroy() in Wire.

bug: dawn:1634
Change-Id: I7398510f83ebacfbc6bb33fcc070c2eab10b9c24
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116820
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Takahiro <hogehoge@gachapin.jp>
2023-01-12 02:07:48 +00:00
Austin Eng dc9c306a14 Remove suppressions for tests now passing on Mac Intel
Bug: dawn:704, dawn:791
Change-Id: I3d335c33caee943547798290026dffa7f9a90d83
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116845
Commit-Queue: Austin Eng <enga@chromium.org>
Kokoro: Austin Eng <enga@chromium.org>
Auto-Submit: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2023-01-11 23:29:22 +00:00
Ben Clayton 6345562a98 resolver: Delay copy of TemplateState
Shows up in profiling, and doesn't always need to be done.

Change-Id: If8bf061563979d17dea4c48334dab4834770d921
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116865
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
2023-01-11 22:16:08 +00:00
Ben Clayton e704336001 dawn/node: Avoid exception on teardown
If node is shutdown without first explicitly destroying the GPUDevice, the device's destructor will be called, which would automatically destroy the dawn device.

Before doing this, it would first reject the lost-device promise. With newer versions of node, attempting to construct new GC'd objects on NodeJS tear-down triggers a fatal error.

Work around this by adding a new state to promises, that allows promises to be destroyed without first being rejected or resolved, and without raising a 'Promise not resolved or rejected' fatal message.

Change-Id: I810d6894d384511cdb7989b9c6c5b707dd68d8c2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116864
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Ben Clayton <bclayton@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2023-01-11 21:03:45 +00:00
Austin Eng 3c760b850c Remove supressions for disable_r8_rg8_mipmaps
This toggle no longer exists

Bug: none
Change-Id: I1ef99a760530286f1845ab0b55fa611f61df239d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116843
Commit-Queue: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Kokoro: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Austin Eng <enga@chromium.org>
2023-01-11 20:29:55 +00:00
Ben Clayton 58d1e89426 dawn/node: Avoid empty vector index
If a device lists no features, don't zero-index an empty std::vector.

Change-Id: I10d632f0c5d5a162abec180797ad11adee67fc6b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116863
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2023-01-11 20:05:37 +00:00
Ben Clayton 47a81fc126 tint/utils: Use a C-array instead of std::array
std::array unnecessarily zeros the memory, which shows up in profiles
Change-Id: I2a18ef4fb8ca46bc6fc87504858046d9b7d2fd45
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116866
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-01-11 20:00:55 +00:00
Corentin Wallez edca14171e DawnTest: Move the position of [selected] to be easier to spot.
The [selected] was on the second line of an adpater description in the
output of DawnTest which made it a bit difficult to find. Move it at the
end of the first line which is the adapter name.

Bug: None
Change-Id: I686b40588b03aac827c347510525f6c969b7180b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116860
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-01-11 15:10:05 +00:00
dan sinclair 7092786f31 Fixup return of HLSL sign to match WGSL.
The HLSL `sign` method returns an `int` result (scalar or vector). The
WGSL `sign` expects the result to be the same type as the argument. This
CL injects a cast to the correct type after the `sign` call in the HLSL
generated source.

Bug: tint:1795
Change-Id: I51fed24b5b8b752b6b27fdfb5dd47eb803902793
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116692
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2023-01-11 13:18:29 +00:00
Ben Clayton 54264d3037 tools/run-cts: Optimize coverage collection
Enable coverage collection when using the test server, which is substantially faster than running in separate, isolated processes.

Use clang's `__llvm_profile_*` APIs to reset the counters between each test case run.

Change-Id: I01f8d0c1b3f215f66cfa50ef0fd51f2522c2ea57
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113880
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2023-01-10 21:55:43 +00:00
Ben Clayton c9c937cc3e dawn/node: Allow picking of the adapter by name
Add the "--adapter" flag to run-cts as a helper for setting this.

Make "--verbose" print the picked adapter.

Rename "dawn-backend" flag to just "backend" - this is already specific to the "gpu provider" (dawn).

Change-Id: Idc8d0eb3ccf5fa23325c06f0f9520aa9b528d9dd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116295
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Auto-Submit: Ben Clayton <bclayton@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-01-10 19:15:42 +00:00
Corentin Wallez 0963142273 Add wgpu::Device::ValidateTextureDescriptor
Bug: chromium:1266549
Change-Id: Iaef63ca6f4e447450953dfb0633b43931d8c2552
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116294
Reviewed-by: Brandon Jones <bajones@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2023-01-10 15:17:26 +00:00
Ben Clayton e45bf9f3d6 dawn/node: Handle printf() erroring
printf() can return -1 on error. In this situation, don't adjust msg with a negative offset.

Fixes a spurious crash when emitting lots of text.

Change-Id: Id1e9402bbbe3dd49cf08e660dea0cf67c5369516
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116289
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-01-10 14:13:50 +00:00
senorblanco@chromium.org 477744b7b5 Tint/GLSL: fix null ptr deref in Texture1D -> 2D.
Bug: 1405676
Change-Id: If6edb0ba2b6c1ddd5d75421d234e168297e1b622
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116700
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
2023-01-10 02:13:48 +00:00
Jiawei Shao ab00dd0725 Remove ShaderModuleValidationTest.FragmentOutputLocationExceedsMaxColorAttachments
This patch removes the test
ShaderModuleValidationTest.FragmentOutputLocationExceedsMaxColorAttachments
from dawn_unittests because now the emission of the validation errors about
the maximum value of fragment output location is delayed from
CreateShaderModule() to CreateRenderPipeline(), however this test expects the
error will still be reported in CreateShaderModule().

Previously this test can still pass because kMaxColorAttachments is declared as
an uint8_t, so it will be added as "\b" (ascii code is 8) in string stream when
constructing the shader, then we can still get a shader-creation error because
it is not an integer that is inside the bracket of the location() expression.

Bug: dawn:986
Change-Id: Iaf03f83b2c27e3d9e986f813b2086726b51a0aeb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116554
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-01-10 01:09:28 +00:00
Jiawei Shao f7beb85fd1 Count the line pos, offset and size of compilation message in UTF-16
This patch counts the line position, offset and size of the compilation
message in UTF-16 and saves them to WGPUCompilationMessage to align the
latest WebGPU SPEC.

Bug: dawn:1357
Change-Id: If8f4026bd5b4a64a078e100762b6d1f61da50053
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/115640
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2023-01-10 00:03:24 +00:00
Arman Uguray 2dfd177009 spirv-reader: Apply image coord vector check on unwrapped type
When validating the image coordinate type of an identifier that may have
been hoisted into a 'var' declaration, spirv-reader correctly checked
the type of the unwrapped reference for scalars but not when the
coordinate type is a vector.

This change applies the vector type checks to the unwrapped type.
Introduced a vector coordinate variant of the
SpvParserHandleTest.ImageCoordinateCanBeHoistedConstant test which
demonstrates the issue and passes with the fix.

Fixed: tint:1712
Change-Id: I9d99a1996e5df71921d6f66d1af02fb5088f1f20
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116371
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: David Neto <dneto@google.com>
2023-01-09 20:00:51 +00:00
dan sinclair 5e8ee8581d [ir] Handle some unexpected ast nodes.
This CL adds diagnostics for the ast nodes which would come before
override substitution. The struct member attributes are marked as ICE as
they should never be encountered. The Struct declaration is ignored as
we will get the `type::Struct` from the semantic usage.

Bug: tint:1718
Change-Id: I8c51787f1455d02e822f222f43a9606a844eed3c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116549
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-01-08 01:31:30 +00:00
dan sinclair 97b98619e8 [ir] Convert tests to use disassembler.
This Cl updates the flow node tests to compare against a disassembled
output instead of explicit expect statements. This makes it easier to
see the structure of the IR and to determine any changes.

Bug: tint:1718
Change-Id: I5b8ab42ada4ba902e8937099c7058a39533f2010
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116548
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2023-01-08 01:29:03 +00:00
dan sinclair e3992f2408 [ir] Cleanup disassembler output
This CL expands the disassembler output and makes a bit more useful. The
case selector value is changed to an `ir::Constant` instead of the
`constant::Value` to make disassembly easier. The `BuilderImpl` is
updated to not fail in the face of missing implementation but continue
as best as possible.

Bug: tint:1718
Change-Id: I8b275a19bccbb02bb785d311778198bb0c9e0456
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116547
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2023-01-07 23:15:47 +00:00
dan sinclair a764437138 [ir] Allow branching arguments.
When branching to a different flow node, there is a need to pass
arguments to the branch. These arguments could be the value of the
return.

This extracts a `Branch` out to an object with a target and arguments
and then updates the IR to use the new Branch structure.

Bug: tint:1718
Change-Id: Ic8de8046f58056327a04c8afe3b597810c80ccdb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116546
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2023-01-07 23:13:35 +00:00
Stephen White 797cbf4f58 OpenGLES: implement 1D texture workaround.
OpenGLES doesn't support 1D textures, so use 2D textures of width x 1
as a workaround (requires dependent Tint change).

Bug: dawn:1301
Change-Id: I99dbccfae497ee86d6f9b9e1ca1608049971016d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/114820
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2023-01-07 18:09:14 +00:00
Stephen White 1d04cf841c Enable the 1D -> 2D texture transform in GLSL writer.
Fix unit and WGSL test results.

Bug: dawn:1301
Change-Id: Idfe046bdb211c8db9724e02c2f9dfb12d04d5c2a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/114800
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2023-01-07 17:19:21 +00:00
Stephen White fb8a6dbb5d Implement a Texture1D -> Texture2D transform.
This is required for GLSL ES, which doesn't support Texture1D.

Bug: dawn:1301
Change-Id: Iba08d04a0bc23c278e65618550ea314ca0cbee1c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/114363
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2023-01-07 04:09:25 +00:00
Kai Ninomiya 9bb85fdaef Suppress VVL warning for empty descriptor set
Unsure whether this error is correct, there's an issue open on VVL to
figure that out. Suppress until that's resolved.

Bug: dawn:1627
Change-Id: I9663c1434f6eda48385ff66751432d22b2d8a3d3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116544
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Auto-Submit: Kai Ninomiya <kainino@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-01-06 23:51:19 +00:00
dan sinclair 4a62d91a9e [ir] Remove program in ir tests.
This Cl updates the IR tests which depend on a built IR to clear out the
program after the IR is generated. This will, hopefully, find accesses
into the old program AST in the sanitizer bots.

Bug: tint:1718
Change-Id: I8c83d8d6aa93d702dac6a1e8068ca8e0a00a7753
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116366
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-01-06 19:49:46 +00:00
dan sinclair 8bcb4e9e77 [ir] Remove ast pointers.
This CL removes the AST pointers from the IR nodes.

Bug: tint:1718
Change-Id: I818e1debc644b366c6e8378f448683b1b7d8fb00
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116365
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-01-06 19:45:13 +00:00
dan sinclair 0258f276b5 Convert CaseSelector to IR.
This CL converts the case selectors over from ast CaseSelectors to IR
CaseSelectors. They work the same way in that a `nullptr` value signals
a `default` selector but they only store the resulting `constant::Value`
instead of the `ast::Expression`.

Bug: tint:1718
Change-Id: Ied62d661e03a7f8da4c1e1bdaccc04f21ab38111
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116364
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
2023-01-06 17:58:40 +00:00
dan sinclair 19bc66a375 [ir] Cleanup some comments and un-needed code.
This CL cleans up a few comments for spelling and content. The EmitType
method is removed, types should not be emitted into the IR, they should
be cloned, so we should not need EmitType.

Bug: tint:1718
Change-Id: I7879e864e075837f756d47da422b2b129623d900
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116369
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2023-01-06 16:37:23 +00:00
Corentin Wallez 00208bd134 Fix CopyExternalTextureForBrowserTests overflow.
The call to Queue::WriteTexture was passing a size that was bigger than
the array of data being used. This caused an ASAN failure when running
with the wire, because the serialization of the command would memcpy
past the end of the data.

Bug: dawn:1625
Change-Id: I2a00f2e32e3d8f8ff66d85575d1908480861f153
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116288
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-01-06 14:28:24 +00:00
Jiawei Shao f43b92f6e0 Enable end2end tests that can pass on latest Intel bots
This patch enables all the dawn_end2end_tests that fail with old
Windows Intel driver but pass on the newer ones after the driver
of the bots being upgraded to 31.0.101.2111.

Bug: dawn:416, dawn:815, dawn:1070
Test: dawn_end2end_tests
Change-Id: I3022ff09a6c2be21f1c99fab0077743f84f83b34
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116133
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2023-01-06 10:10:07 +00:00
dan sinclair 529c3fd385 Add clone into constant/
This Cl adds the ability to clone a constant into a context provided.
This allows the IR to clone the constants out of the Program and into
the IR.

Bug: tint:1718
Change-Id: I78170cdc66b5824a1ab81000976a747b5bffee79
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116363
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-01-06 02:57:36 +00:00
James Price 128980f218 tint: Add support for workgroupUniformLoad
Accept any type in the intrinsics definition, and then manually
validate that there are no atomics in the type. Add manual E2E tests
for composite types.

Use the BuiltinPolyfill transform to implement it for all backends.

Update the uniformity analysis with special-case tags for the builtin.

Fixed: tint:1780
Change-Id: I95786dff4df70a0b16ed1c53b853b5d0ec6bc501
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/114862
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>
Kokoro: James Price <jrprice@google.com>
2023-01-06 02:25:06 +00:00
Shrek Shao 3b83e389fa Suppress FragmentInputIsSubsetOfVertexOutput tests for Adreno Pixel 4
Bug: chromium:1404849
Change-Id: I348363833e3ec39b12dab514bfa6e32381dda34f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116367
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Shrek Shao <shrekshao@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2023-01-06 01:15:46 +00:00
Kai Ninomiya a3a68c3d0d Suppress VVL sync hazard for sampling + read-only depth/stencil
This should help unblock the roll of vulkan-deps into chromium, which is
currently failing dawn_end2end_tests and angle_end2end_tests.

Fixed: dawn:1626
Change-Id: I5c0313e93d0be01c794ce9c1ffe73f16c0dfc8df
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116138
Auto-Submit: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2023-01-05 22:56:32 +00:00
dan sinclair f8abdc7aef Add ability to clone types.
This CL adds a `Clone` method into the type base classes. This allows
the IR to clone types provided by the program into the IR context.

Bug: tint:1718
Change-Id: Ieebf011dcf40bedc98bf5acebd3888acfde863bc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116362
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
2023-01-05 21:07:15 +00:00
Corentin Wallez 8e68a89cfb Vulkan: Clamp @builtin(frag_depth) with push constant values
Start using Tint's ClampFragDepth transform in the Vulkan backend when
needed in order to correctly clamp @builtin(frag_depth) on Vulkan. Do
this by always reserving 8 bytes of push constant space to contain the
f32 min and max values from the last viewport command.

Reenables relevant CTS tests that were suppressed on Vulkan.

Bug: dawn:1125, dawn:1576, dawn:1616
Change-Id: I38f4f6c3c51c99b5e591a780fea9859537529534
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/105642
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2023-01-05 12:24:52 +00:00
Corentin Wallez edbebe3582 Remove the suppression for NV12SampleYUVtoRGB on Nvidia D3D12
Bug: dawn:733
Change-Id: Iaedd074e1fa6febab5cb87e20ee0c8255d69761d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116021
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-01-05 09:04:10 +00:00
Jiawei Shao 786d4b12dd Don't clear depth stencil textures when created as committed resource
The toggle D3D12ForceClearCopyableDepthStencilTextureOnCreation can be
disabled when the toggle D3D12Allocate2DTexturewithCopyDstAsCommittedResource
is enabled because with D3D12Allocate2DTexturewithCopyDstAsCommittedResource
all the depth stencil textures (can only be 2D textures) with CopyDst usage
have already been created with CreateCommittedResource() instead of
CreatePlacedResource(), thus the driver issue about creating depth stencil
texture on a dirty heap with CreatePlacedResource() won't be triggered.

Bug: dawn:1487, chromium:1237175
Change-Id: I872d4d95e6e05e1bcf9489b31a72e61f957de3e5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116129
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2023-01-05 01:30:54 +00:00
Yuly Novikov 80f0a3a739 Suppress ColorStateTest.SparseAttachmentsDifferentColorMask on D3D12
Device lost on ASAN Intel and NVIDIA.

Bug: dawn:1625
Change-Id: I7435bf989fa36b4ece7a14e95de153e69a15b177
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116286
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Auto-Submit: Yuly Novikov <ynovikov@chromium.org>
2023-01-05 00:10:53 +00:00
James Price 7ca2e99b64 Remove unused variable
This blocks the import into google3.

Change-Id: Ieb5db932553b5f9c8e44e1c334e497004c6bb778
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116361
Commit-Queue: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2023-01-04 21:29:39 +00:00
Brandon Jones 713cd86f78 Change External Texture Crop Parameters
Removes the ExternalTextureVisibleRect type in favor of the existing
visibleOrigin/visibleRect parameters.

Bug: dawn:1622
Change-Id: Ifa661392b5541543c1445ce3e1e8e5e9db881be4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116124
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Brandon1 Jones <brandon1.jones@intel.com>
2023-01-04 21:27:32 +00:00
Ben Clayton 8e2c3e14f9 tint/resolver: Adjust diagnostic source for member accessor error
And clean up sources in the validation_test.cc file.

Change-Id: If602c7c955c6264e7df98146c320e69aafe55654
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116282
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2023-01-04 20:07:23 +00:00
James Price 3a2573e93c DISABLE WireBufferMappingWriteTests.DestroyInsideMapWriteCallback
Fails with ASAN, should be fixed after at the same time as dawn:1619.

Bug: dawn:1619, dawn:1621
Change-Id: Ia1efbb5466b8e8fbb871c07dd6af53a530620935
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116360
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
2023-01-04 19:23:48 +00:00
David Neto 8937ec4e72 spirv-reader: disable Clspv-related test
The grammar of the NonSemantic.ClspvReflection.1 instruction
set has changed but the corresponding feature in Clspv has not
yet landed.
Disable the Clspv-related test until upstream has settled.

Bug: tint:1789
Change-Id: I1cd9e9d15fc41338704e6e4b487cb6f099581aa0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116320
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: Alan Baker <alanbaker@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Auto-Submit: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-01-04 18:40:08 +00:00
Hans Wennborg 011e95a2ff Add missing include of type_traits
Recent libc++ versions no longer implicitly include <type_traits>
as part of <utility>, see https://reviews.llvm.org/D140426

Bug: chromium:1404923
Change-Id: Ic688b0ca05167ccae1db916ed964b77f53ff999f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116283
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2023-01-04 17:58:39 +00:00
James Price efdfc6bbca tint/gn: Use Unix diagnostic printer on macOS
Renames PrinterLinux to PrinterUnix and enables it for macOS in the GN
build. This allows the Tint EXE to produce colorized/emboldened
diagnostic messages on macOS.

We already do this in the CMake build, so this makes GN match.

Change-Id: I35a0d53de44c793870a5a050fdd14148aaf3d763
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116300
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
2023-01-04 17:48:00 +00:00
Ben Clayton cf1f4658ae tint/resolver: Fix ICE on short-name type used as identifier.
Bug: chromium:1404922
Change-Id: I47a8a294ba62b034feba98566098bef2246a0c9f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116281
Auto-Submit: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
2023-01-04 17:20:57 +00:00
Corentin Wallez 1966ea9727 DISABLE WireBufferMappingReadTests.DestroyInsideMapReadCallback
It is failing under ASAN but should be fixed after at the same time as
issue dawn:1619 that makes mapping callbacks called only at the end of
the BufferBase method.

Bug: dawn:1619, dawn:1621
Change-Id: Idfdb6e36432a47eaef63b46e041f1404a2562f40
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116284
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2023-01-04 16:58:20 +00:00
Ángel Eduardo García Hernández 0fa5fb16bd tint: fix clang-cl compilation
* Disabling warnings was using the MSVC codepath
* Required to disable a float comparison on lexer.cc for clang

Change-Id: Ie3123593ebba2bffe34bff490ff76d5bdbd7d40d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116240
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2023-01-04 12:35:39 +00:00
Ben Clayton f3f813eb0c tint: fix const eval short-circuiting with mixed runtime and constant expressions
For logical binary expressions that can be short-circuited, if the rhs
tree contained a mix of constant and runtime expressions, we would
erroneously mark the node as runtime, although some of its children were
resolved as kNotEvaluated. This would then fail during backend
generation.

This is a fork of 115820, addressing review comments, as amaiorano is OOO this week.

Bug: chromium:1403752
Bug: tint:1581
Change-Id: I18682c7fe1db092d280390881ff86b3c0db23e9b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116020
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
2023-01-04 12:30:47 +00:00
Ben Clayton be367b73ae Reduce shader complexity for external textures
Do more math on the CPU to avoid per-fragment ALU operations.
Use a mat3x2 instead of mat2x3 to avoid padding.

Fixed: dawn:1614
Change-Id: Ib0e0f7d44ed9aa16eaca712f6553214fad141feb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116060
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Brandon1 Jones <brandon1.jones@intel.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2023-01-04 12:29:56 +00:00
Corentin Wallez 7f45581f45 Revert "Skip flaky DrawIndirectTest.Uint32 on Win Intel Vulkan"
This reverts commit f6fd86c524.

Reason for revert: most likely fixed by a VVL roll, see issue dawn:1615

Original change's description:
> Skip flaky DrawIndirectTest.Uint32 on Win Intel Vulkan
>
> Bug: dawn:1620
> Change-Id: I1866630622d674fe24fbd355645dfb2b5a63280c
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/115480
> Auto-Submit: Yuly Novikov <ynovikov@chromium.org>
> Kokoro: Kokoro <noreply+kokoro@google.com>
> Reviewed-by: Kai Ninomiya <kainino@chromium.org>
> Commit-Queue: Kai Ninomiya <kainino@chromium.org>

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: dawn:1620
Change-Id: I1060479ee4dae084197569599182e61da15128dd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116081
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
2023-01-04 04:47:01 +00:00
dan sinclair afd7f2aa21 [ir] Add usage tracking to ir::Value.
This CL updates ir:Value to track the instructions which use a given
value. The instructions add their usage upon construction. This
necessitates making the values non-const in a lot of places as they get
changed by the instruction.

The `result` value is moved up to the base instruction class as it
should exist in all instructions.

Bug: tint:1718
Change-Id: Id7ab6e43d48caea502756d274dd6be2e1e4240f1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116141
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-01-03 21:55:36 +00:00
Ben Clayton b70d610bae dawn/native: Hook tint ICE up to Dawn assertions
Scream and shout if we ICE in a debug build.

Fixed: tint:597
Change-Id: Ie349d314a2ddf518f54df81469e4e14aa16cacda
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/114540
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2023-01-03 21:45:05 +00:00
dan sinclair 4cef4362b0 [ir] Add bitcast expression.
This CL adds the Bitcast expression into the IR.

Bug: tint:1718
Change-Id: Ic48bd54485e9b380c94f599e683c2fbba7505787
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116041
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
2023-01-03 20:29:43 +00:00
dan sinclair cf58122c58 Minor cleanups from #114202.
This Cl adds a couple cleanups requested in 114202 as a followup.
Templates updated to have the EnableIf in the `template` block. The code
for `create` of a Splat or Composite is moved to a helper method.

Bug: tint:1718
Change-Id: Ib302d78633c6102cfbe17d63f0a4841ecf147472
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116100
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-01-03 20:25:37 +00:00
dan sinclair 3e449f2194 [ir] Add types to the ir::Value classes.
This CL updates the Value objects in the IR to store the corresponding
type::Type.

Bug: tint:1718
Change-Id: I58fb764bf438e0aca3bc4e7f59179643fee49b77
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116040
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2023-01-03 20:25:13 +00:00
Yuly Novikov f6fd86c524 Skip flaky DrawIndirectTest.Uint32 on Win Intel Vulkan
Bug: dawn:1620
Change-Id: I1866630622d674fe24fbd355645dfb2b5a63280c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/115480
Auto-Submit: Yuly Novikov <ynovikov@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
2022-12-27 22:55:50 +00:00
Antonio Maiorano 659b5b7727 tint: add const eval matrix accessor unit tests
Bug: tint:1581
Change-Id: Icae0959cda95e028acee9663acfe698978881f93
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/115506
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-12-23 21:10:53 +00:00
Antonio Maiorano c73d673976 tint: add const eval vector accessor unit tests
Bug: tint:1581
Change-Id: I135c0cdc5d45c673aa156cd96ebad5c613545bd2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/115504
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-12-23 21:09:10 +00:00
Antonio Maiorano b71898ea30 tint: add const eval array accessor unit tests
Bug: tint:1581
Change-Id: I0cbb16936bbc1c139e17cecd07007d418c6ee0fa
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/115503
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-12-23 18:51:26 +00:00
Antonio Maiorano dfa92a9cb6 tint: Fix ProgramBuilder::WrapInFunction overload not being picked up
Before this change, the variadic function template version of
WrapInFunction would be selected when passing a utils::VectorRef<const
ast::Statement*>, even though an overload exists for that type. The
reason is that during type deduction, the compiler will select templates
over non-templates in its overload set. The only way around this was to
avoid type-deduction by explicitly casting the argument to
utils::VectorRef<const ast::Statement*>.

This CL adds a CanWrapInStatement metafunction that evaluates to true if
the arg type is one that could be passed to
ProgramBuilder::WrapInStatement. This is used to SFINAE in the variadic
args version of WrapInFunction.

Change-Id: I8aa3d69e2ce7324fd60b1b2a5906a51d51b549a3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/115502
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-12-23 17:56:56 +00:00
Antonio Maiorano 64c243e9e6 tint: add missing unit tests for const eval vector construction of AInt and
AFloat

Bug: tint:1581
Change-Id: Ic994fe50be6a73b215aabc8ec85fab9f31bcc8df
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/115500
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-12-22 22:08:48 +00:00
Antonio Maiorano 6b4622fb07 tint: add const eval array constructor tests
Bug: tint:1581
Change-Id: Ia6c4ba974b40cdff8dc28ddbd510189355ed27cb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/115400
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-12-22 16:27:43 +00:00
James Price 906fc9df20 tint/uniformity: Add a NameFor helper
Use it everywhere, and inline some simple uses for brevity.

Change-Id: I27727feedfb1eaa3e811241a420c3fbed404e5b1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/115381
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-12-22 14:32:54 +00:00
James Price a84ebc3af9 tint: Add forward declaration for CastableBase
This fixes the google3 build, which compiles headers in isolation.

Change-Id: I3c9a91caa75c6da1d9dcc17bb6d2aeb5834c197e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/115440
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Auto-Submit: James Price <jrprice@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-12-22 14:32:16 +00:00
Gregg Tavares 6609f9cfb9 Workaround Metal Validation Issue for copying 3D textures to a buffer.
The metal validation layer complains when copying from a 3D texture to
a buffer if the stride for the destination buffer is larger then 2048
bytes.

Bug: dawn:1430
Change-Id: I6ba4508d71610c35dfb0fab7d2bebc91d37504e3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113426
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Gregg Tavares <gman@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Brandon Jones <bajones@chromium.org>
2022-12-22 01:30:22 +00:00
James Price 0244804193 tint/uniformity: Avoid string allocations for node tags
Use std::initializer_list<std::string_view> for the tags passed to
CreateNode, and only concatenate them if debug mode is enabled.

Change-Id: Ida3662c52d72ba71bae3f91766dca6aaca89ee50
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/115380
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: David Neto <dneto@google.com>
2022-12-22 00:51:18 +00:00
James Price 857b1580c7 tint/uniformity: Handle pointer uniformity
This change is a necessary to support workgroupUniformLoad in a
following patch. Otherwise, there is no change to the set of shaders
that are accepted or rejected by the analysis.

We now distinguish between uniformity requirements on the contents of
a pointer parameter versus the pointer value itself when generating
tags for function parameters.

Whilst processing an expression, if we see a sem::Load node we pass a
flag down through child expressions to indicate that we will be
loading from the result. When processing an identifier expression, we
can then select between adding an edge to the source of the
pointer/reference versus the contents of the root identifier that it
corresponds to.

Since the pointers passed to atomic builtins can be uniform, we
special-case them to capture the fact that their return value is
always considered non-uniform.

The arrayLength builtin no longer needs special-casing.

Added many tests to cover various cases that are now captured
differently in the graph. There are two cases that are disabled as
they require variable pointers to trigger the uniformity violation.

Bug: tint:1780
Change-Id: I03edb65f22a6ffb0e7daf8b2f590f5de898e6262
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/114861
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: David Neto <dneto@google.com>
2022-12-21 22:59:14 +00:00
Antonio Maiorano 1d77e2531c tint: add const eval of swizzle tests
Bug: tint:1581
Change-Id: I08d7279aed1a931072bd31735aa21fffdae2400f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/115340
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-12-21 21:15:03 +00:00
Antonio Maiorano ffb322a096 tint: add bool member to const eval struct member access test
Bug: tint:1581
Change-Id: I65955745b9e4078368ba2b3797dd903e07238edd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/115243
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-12-21 21:15:03 +00:00
Antonio Maiorano 309b10a8c5 tint: add const eval struct zero init tests
Bug: tint:1581
Change-Id: Id2562b288343229b1fc99f5ff78b6c3809532ddb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/115242
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-12-21 21:15:03 +00:00
Antonio Maiorano 0890ecabda tint: add const eval zero init tests for scalars, vectors, matrices, and
arrays

Bug: tint:1581
Change-Id: Ib0024ddccd5107337e6711c6fa56b0efd68dde96
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/115241
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-12-21 21:15:03 +00:00
Antonio Maiorano 994b70feb9 tint: add AFloat and AInt const eval scalar constructor tests
Bug: tint:1581
Change-Id: I0cb190e3114f3fd1c68f4cb821399547830239a2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/115240
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-12-21 21:15:03 +00:00
Antonio Maiorano bc44620d68 tint: implement short-circuiting of const eval bitcast
Bug: tint:1581
Change-Id: I6058dee593bf97f9dee202a80ced7b2551da0ba9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/115220
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: James Price <jrprice@google.com>
2022-12-21 21:15:03 +00:00
Jiawei Shao f8277d0ae4 Add toggle to warn the dst-alpha issue on Intel GPUs
Bug: dawn:1579
Change-Id: Ifdf09aefcdd62be82bd874a6e185b18ab96cb29a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/114920
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2022-12-21 02:22:53 +00:00
shrekshao 49a08b7668 Refix validation for command encoder pass encoding
According to latest spec, beginRenderPass/beginComputePass
don't throw validation error. Error still defers to
CommandEncoder::Finish()

Bug: dawn:1602
Change-Id: I5fd76f2c8951273a8dd82b02e20f076079354b60
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/115120
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Shrek Shao <shrekshao@google.com>
2022-12-20 21:03:16 +00:00
James Price eb34a764a8 tint/uniformity: Fix handling of continuing block
Variables declared inside a loop block were not visible to the
continuing block. Special-case the continuing block by processing it
inside the loop-body block statement, instead of afterwards.

Change-Id: I05bc906bd98b24295dc91116b9ef8d8ef02c3af3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/114860
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-12-20 20:12:51 +00:00
James Price efc9df4695 tint/uniformity: Fix issues with for-loops
Variables declared in for-loop initializers were not being tracked
properly across iterations as a check was wrongly determining them to
be declared inside the loop body.

Also fixes an issue where variables declared in for-loop initializers
were still considered to be in scope after loop exit.

Change-Id: I2ce3a519be45c8daba31bf00e8b2614f0bd6a2de
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/114364
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Auto-Submit: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
2022-12-20 19:08:56 +00:00
Antonio Maiorano 056618541f tint: const eval of bitcast operator
Bug: tint:1581
Change-Id: Ida43b34118282eeb99ae099c91a6465eb3040ca6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/115080
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-12-20 18:34:06 +00:00
Antonio Maiorano ffa83ad1f7 tint: make utils::Bitcast not trigger gcc warning
When useing Bitcast to or from a class type, gcc warns even if the type
is trivially copyable. Fixed this by static_asserting that both types
are trivially copyable, and casting the pointers to std::byte*.

Change-Id: Ibb420f2dcdd35cfb187d74983fa8ab9b50d10c85
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/115180
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-12-20 17:13:39 +00:00
Austin Eng 5cc118bde7 Clear reference to MTLTexture on TextureView::DestroyImpl
Bug: dawn:1355
Change-Id: I834b02a05d50c39b1a8d272e2d437d7ce1f96fb5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/115061
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
2022-12-19 23:36:00 +00:00
Brandon Jones b38b3b0f8c Implement AlwaysResolveIntoZeroLevelAndLayer globally
Previously this toggle was implemented only for the Metal backend, but
a need for it was identified on Android as well. This change moves the
implementation to the backend-agnostic command encoder recording so that
it works for all backends. Fundamentally it's still doing the same
thing, however: Swapping resolve targets that point at a non-zero mip
level or layer with a temporary texture and then performing a copy once
the render pass has ended.

Bug: dawn:1569
Change-Id: I292860cc74f653b2880e727d2ef3a7dfa3f10b91
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/106040
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Brandon Jones <bajones@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-12-19 19:46:12 +00:00
Takahiro 915e55a0d8 Add Buffer.GetMapState()
Bug: dawn:1521
Change-Id: I68962a4d6b17867cd17cfcb3a17910a2007764fa
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111924
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Takahiro <hogehoge@gachapin.jp>
2022-12-19 19:06:51 +00:00
Ben Clayton ce93a6b224 tint: Replace type::UniqueNode::Hash() virtual with field
Virtual methods are expensive to call, and hashes are frequently tested.
The hash must be immutable, so just calculate it once in the constructor and store it as an immutable field.

Change-Id: I9d29fb3fc074e57e7af91367768a47193baa40f1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/114780
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
2022-12-19 17:07:29 +00:00
Takahiro ad541a7cdd Immediate Buffer.MapAsync() rejection if pending map in Wire
This immediate rejection has been implemented in Native but
hasn't been yet in Wire. This commit adds the implementation
to Wire.

Also the commit changes the MapAsync callback firing timing
if pending map buffer is unmapped or destroyed. With this
commit the callback will be fired immediately Unmap or
Destroy is called to match the WebGPU spec. Currently the
callback is fired when the client receives a response from
server but it mismatches the spec.

Change-Id: Ia48d62be31912fd0384e23271e9de516f9d71d6c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113607
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Takahiro <hogehoge@gachapin.jp>
Reviewed-by: Austin Eng <enga@chromium.org>
2022-12-17 04:24:05 +00:00
James Price 0fcc00e22a tint/uniformity: Fix debug graph output
The code that was ifdef'd out no longer compiled.

Change-Id: I6243cc6a3584c555505c4bee68ec02bbb96801c3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113430
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>
2022-12-17 02:21:36 +00:00
Ben Clayton 2f9a98870e tint: Implement sem::Load
The resolver now wraps sem::Expression objects with a sem::Load object
anywhere that the load rule is invoked. sem::Expression provides an
`UnwrapLoad()` method that returns the inner expression (or
passthrough, if no load is present), which is analaguous to
Type::UnwrapRef().

The logic for alias analysis in `RegisterLoadIfNeeded` has been folded
into the new `Resolver::Load` method.

Fixed up many transforms and tests. The only difference in output is
for a single SPIR-V backend test, where some IDs have changed due to
slight re-ordering of when expressions are generated.

There may be further clean-ups possible (e.g. removing unnecessary
calls to `UnwrapRef`, and simplifying places in the SPIR-V writer or
transforms that deal with memory accesses), but these can be addressed
in future patches.

Fixed: tint:1654
Change-Id: I69adecfe9251faae46546b64d0cdc29eea26cd4e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99706
Commit-Queue: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2022-12-17 02:20:04 +00:00
Yuly Novikov 5a4f5dcf90 Skip dawn_end2end_tests failures on Win Intel Optiplex 7080 Vulkan
BindGroupTests.ArbitraryBindingNumbers/Vulkan_Intel_R_UHD_Graphics_630
QueryInternalShaderTests.TimestampComputeShader/Vulkan_Intel_R_UHD_Graphics_630

Bug: dawn:1615
Change-Id: I76d677157857dbc6ef7cb5ecbad6e37d2cc292e1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/114620
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
Auto-Submit: Yuly Novikov <ynovikov@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2022-12-16 20:26:52 +00:00
Antonio Maiorano bf8a230c81 tint: const eval of ldexp builtin
Bug: tint:1581
Change-Id: Ib21717065041b65a637f4d73ce0088544b1fce0d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/114321
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-12-16 18:37:19 +00:00
Austin Eng 04ad2a4c14 Add informational toggle that indirect baseVertex is broken on Mac Intel
Bug: dawn:966
Change-Id: I5f8183911eb04d4809c30cb7c1efdeca414f3329
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/114662
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-12-16 18:10:06 +00:00
Austin Eng e48253f31e Add informational toggle that sample mask is broken on Mac Intel
Bug: dawn:1462
Change-Id: Ifec68914edb7d0f7eaf90e066491a0af3fe7b232
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/114400
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-12-16 16:54:42 +00:00
Yunchao He 5082727e55 D3D12: Remove the 24K extra memory for texture corruption
2D array texture may corrupt on some Intel devices, making out-of-bound
texture access and memory information leak. It's a critical security
issue. Intel driver team suggested the 24K extra memory approach in
order to mitigate the security issue before.

However, the texture corruption issue (and even the correctness issue)
can be worked around via allocating a few extra layers. And patches
have already been merged in Dawn, with a lot tests for verification. The
24K extra memory for each texture is actually incorrect and unnecessary.
So this patch removes relevant code in Dawn.

This patch mainly reverts some code of this patch below:
https://dawn-review.googlesource.com/c/dawn/+/96220

Bug: dawn:1507
Change-Id: Ic3239115ad4c74bdee928577ccbb20f1e35d13c3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/114641
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
2022-12-16 16:46:12 +00:00
Ben Clayton 7c3e9a6dd2 tint: Rework tint::Manager
Don't use dynamic casting in hashing and equality. These should be fast, and dynamic casting is expensive.

Add type::UniqueNode for things that need de-duplicating and bin the types on construction.

Replace some use of SFINAE with constexpr.

Also fixes a build failure for x86.

Bug: oss-fuzz:54184
Change-Id: Ic1b0708394f9f5703fc179a2c31ce18bd07e196c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/114760
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2022-12-16 15:31:19 +00:00
Brandon Jones 183df9d24e Implement External Texture Crop Functionality
Adds to the External Texture shader transform to allow cropping. Tests
included.

Bug: chromium:1316671
Change-Id: Id0ec9acac22a0968ba6847d6ead9cf5084eaca88
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113281
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-12-16 05:41:06 +00:00
dan sinclair 02b466feb1 Move CreateComposite into ProgramBuilder.
This CL moves the CreateComposite helper into the ProgramBuilder.

Bug: tint:1718
Change-Id: I4aca7dc3d7192a7aa8b300f00529670aa9c09a27
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/114202
Kokoro: Kokoro <noreply+kokoro@google.com>
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
2022-12-15 21:56:32 +00:00
dan sinclair 19ebcb2230 Convert ir::Constant over to use a constant::Value
This CL updaets the ir::Constant to store a constant::Value instead of the specific numbers
themselves.

Bug: tint:1718
Change-Id: I66b0a9643893b6079399daf61ee39ac5811e1eaf
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/114362
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-12-15 19:17:22 +00:00
David Neto dd1e4e39f2 Fix typo
Change-Id: I5b15e16c140dde600e83e4f48e2902963e948b46
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/114560
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Auto-Submit: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: David Neto <dneto@google.com>
2022-12-15 18:00:24 +00:00
Takahiro 5208edf37d Buffer.MapAsync pending map error non validation error consumed
Bug: dawn:1613
Change-Id: Ib1e5014d36c2c35d7ed9b946de4d21e046cf1282
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/114280
Commit-Queue: Takahiro <hogehoge@gachapin.jp>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2022-12-15 16:44:18 +00:00
dan sinclair b53b8cf5be Rename constant::Constant to constant::Value.
This CL renames constant::Constant to constant::Value as it reads a bit
nicer.

Bug: tint:1718
Change-Id: I3489a271ebe229dabf98e7668bdaef4fec375534
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/114361
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2022-12-15 16:25:31 +00:00
Yunchao He 69b7f4a61c Add more tests for texture corruption: msaa and depth stencil formats
2D array textures with non-color formats like depth/stencil formats
are always fine. Workaround is not needed.

Multisample textures are treated as array textures from the
perspective of texture memory layout on Intel Gen12 and each sample
acts like a layer. However, multisample textures are fine.
Workaround is not needed.

Bug: dawn:1507

Change-Id: I1e5cd6a4e46503f67e4c1ffe2133e2e8fb121016
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113740
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2022-12-15 00:52:53 +00:00
Brandon Jones 87a1724368 Improve draw-time bind group validation messages
Makes it clear that the index being reported by these messages is the
group index and not the binding number. This was a point of confusion
in on the bug.

Additionally, adds more information to the error message regarding
buffer sizes being too small for the current pipeline. Now includes the
pipeline name and buffer size as well as the minimum required size. Also
includes a note explaining that uniform buffer bindings must be a
multiple of 16. (This recently changed and cause several existing
samples to break for non-obvious reasons.)

The error message still does not contain the buffer or binding number,
which would be helpful. This is because we currently lack a way to look
up the binding index from the packed index that this error is generated
with.

Bug: dawn:1604
Change-Id: Ibb2b44bc9e1583ddef34d703e83bcf64ed7a3aa2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113602
Commit-Queue: Brandon Jones <bajones@chromium.org>
Auto-Submit: Brandon Jones <bajones@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-12-14 23:44:11 +00:00
Ben Clayton ea1cc79cb8 tint/castable: Add Maybe() MaybeAnyOf()
Moves hashcode bloom-filter type logic to helpers instead of inlining
this stuff. Minor code cleanup.

Change-Id: Id6816dd18445d1d1200a9d49f05cb803095b3d89
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/114341
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-12-14 22:38:43 +00:00
dan sinclair 5addefb148 Rename Constant::As to Constant::ValueAs.
This CL updates Constant::As to be Constant::ValueAs. Now that Constant
inherits from CastableBase, there is already an As method on
CastableBase. This makes the override inside Constant confusing and
potentially incorrect.

Bug: tint:1718
Change-Id: I4f73971801e95225a99a5a993124c04194d0d7d6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/114360
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Dan Sinclair <dsinclair@chromium.org>
2022-12-14 20:46:32 +00:00
Ben Clayton 35842190ef tint/castable: Reformat comments (grow width)
Tint used to use 80-character columns, and now uses 100.
Use the extra space

Change-Id: I493a2195094b23ecc70091b906b12cf742deac7c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/114340
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
2022-12-14 20:27:31 +00:00
dan sinclair 93c0ef2b33 Reduce default vec size in composite.
This CL decreases the default vector size in Composite from 8 to 4.
There will, probably, be a lot more vectors then arrays and structs so
this should reduce the used memory slightly.

Change-Id: I0a47780736192b43189cd211d34744a4f8028b97
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/114200
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-12-14 19:29:10 +00:00
dan sinclair 9268561678 Remove ImplResult.
The ImplResult type is the same as ConstEval::Result after recent
changes. This CL replaces all usages and removes ImplResult.

Bug: tint:1718
Change-Id: If424f3d00f953d97a339de8ae18c94083f3346bf
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/114162
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-12-14 19:23:48 +00:00
dan sinclair 8626c9ee87 Move constants into constant namespace.
This CL moves the constants into the constant namespace.

Bug: tint:1718
Change-Id: Id8f98ca6c16085136c06d98bbd8b755b36cb2409
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/114161
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
2022-12-14 19:22:19 +00:00
dan sinclair 0890380d10 Split concrete constant classes into own files.
This Cl splits the concrete constant implementations out of the
const_eval.cc file and into individual files. The classes are left in
the resolver namespace and will have a namespace update in a followup
CL.

Bug: tint:1718
Change-Id: I54539b6aa06f09aff39a1b1331d89f67a3594791
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/114160
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-12-14 18:13:37 +00:00
dan sinclair 7efe4860c9 Move helper methods inside Scalar.
This CL moves ValueOf and IsPositiveZero into the Scalar class which was
the only usage.

Bug: tint:1718
Change-Id: I2c99831ac30d4d3f0b3bfe9ad25a85186bba0f1c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/114123
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2022-12-14 16:20:09 +00:00
dan sinclair 5225fcc689 Remove ImplConstant.
The content of ImplConstant has been removed and can be replaced by the
constant::Constant base class.

Bug: tint:1718
Change-Id: I611f03d43335bf3b5629a8bc44d74318c7f69a58
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/114122
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-12-14 16:18:29 +00:00
dan sinclair d586d91478 Extract constant convert methods.
This CL pulls the convert methods out into standalone methods inside the
resolver and de-couples from the constants.

Bug: tint:1718
Change-Id: Id566704687b2d74e05eae860477552f88f6a06b9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/114120
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-12-14 14:07:07 +00:00
dan sinclair 2e737daaae Rename Element to Shader in ConstEval.
The const-eval Element is renamed to Scalar to better represent what is
stored.

Bug: tint:1718
Change-Id: I882a8d955f805bc04cea6794fdeaeba0ff2f2ae8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/114101
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-12-14 13:43:51 +00:00
Ben Clayton 0335c7d65d tint: Add matrix short names
Fixed: tint:1786
Change-Id: Ifa3acb2fc1792b392ccb4555bde840f5038eef2c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/114141
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
2022-12-14 11:55:58 +00:00
Ben Clayton 167a7da051 tint: Add TypeInfo as a field instead of a virtual
Removes the overhead of a virtual function call, at the expense of a larger object.

Change-Id: I81d783d4a69b16a69143d4b313f8d90d5df88a33
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/114080
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Auto-Submit: Ben Clayton <bclayton@google.com>
2022-12-14 11:22:23 +00:00
Ben Clayton 188ed1793a tint/resolver: Correctly validate f16 usage
There was limited validation for this. Validate all ways to use a f16.

Change-Id: Ibdcde1f304e704790da3db379c79fcc0844cad67
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/114140
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-12-14 11:09:47 +00:00
Loko Kung eaeded4971 Enables maxColorAttachmentBytesPerSample in Dawn node.
Bug: dawn:1522
Change-Id: Iaccbffbc8ac641d407491bdd8ef0b0f2c9cba309
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113901
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Loko Kung <lokokung@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2022-12-14 05:46:48 +00:00
Loko Kung 5646acbd71 Refactors RenderPassLoadOpTests to adhere to new limit.
Bug: dawn:1522
Change-Id: I856bad3d2930d276f1b8b281a7692d38dc82cf21
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113900
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Loko Kung <lokokung@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-12-14 03:06:10 +00:00
Ben Clayton fbb339ff97 tint: Add sem::Load node
This change adds the node, but this is (currently) not generated or used.

Bug: tint:1654
Change-Id: Id38e531bf811833cf576085805cb00f444ea5451
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99581
Commit-Queue: James Price <jrprice@google.com>
Kokoro: James Price <jrprice@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2022-12-14 01:50:52 +00:00
Antonio Maiorano bed9c98a07 tint: const eval of fract
Bug: tint:1581
Change-Id: I14207080b14e45e7520f50230c85cd902f25dc71
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113943
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-12-13 23:59:45 +00:00
dan sinclair 60eac72504 Move constants into a Castable hierarchy.
This CL moves constant to inherit from Castable.

Bug: tint:1718
Change-Id: Ifd00bcd77a838dfa560096ad95af5cf6065bfb5d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/114100
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-12-13 22:36:04 +00:00
Antonio Maiorano 1c953fa863 tint: fix build
Change-Id: I9983c19eba1e170b6598f19625ad6cfcf8574dc7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/114020
Reviewed-by: James Price <jrprice@google.com>
Auto-Submit: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: dan sinclair <dsinclair@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-12-13 18:09:34 +00:00
Ben Clayton 51d88ebf30 tint/utils: Reduce cost of HashCombine
Do less shufflin' for faster hashin'

Change-Id: Ieb6bd960aee4e7a351f4f87249cde96606f835e0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110561
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-12-13 16:53:31 +00:00
Antonio Maiorano be96967778 tint: const eval of pow builtin
Bug: tint:1581
Change-Id: I11999f0adbd4b12d362e8f47772ac0a625b8fa68
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113821
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2022-12-13 16:29:06 +00:00
Antonio Maiorano 7f5b9d0b6f tint: add CheckedPow
Also improve test validation so that failed tests emit the two values
being compared.

Bug: tint:1581
Change-Id: Ie6f62cb623cf6f50a85ac3229f0968321e45154f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113820
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-12-13 16:29:06 +00:00
Ben Clayton 408ace6927 tools: Add documentation for coverage viewer
Change-Id: I5605925bf4dc4012b38f4e2da48f45321d5e047d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113860
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-12-13 15:48:49 +00:00
Ben Clayton e3f3de773a tint/resolver: Fix const-eval Equal()
It was not considering structures, and the default clause was happily assuming two std::monostates (no-value) were equal.
This lead to non-deterministic behaviour as the Hash() would sometimes match and sometimes not.

Change-Id: Idf01a9e0e4ac09d5eaf683b62fcadd1714dc5849
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113981
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-12-13 14:56:25 +00:00
Ben Clayton f2b86aaffb tint: Add hash randomization
Enable this in Kororo builds to ensure that output isn't dependent on
hash values.

Change-Id: Ib538385b53bebf5260186b14cea396dac15caf6c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113980
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-12-13 14:46:02 +00:00
dan sinclair 10182c46d9 Move sem::Constant to constant::Constant
This CL splits the base constant code out of sem into their own folder.
This will allow re-using the constants in the IR. The concrete
implementations from the resolver will move in followup CLs.

Bug: tint:1718
Change-Id: Ic370db76dce34e3e6eca56a9c2a8df607492b4a6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113802
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-12-13 14:17:50 +00:00
Ben Clayton 61b5aaccf3 tools: Move idlgen and run-cts to from dawn/node to tools/
This is the standard place for tooling.

Update src/dawn/node/README.md with the new paths, and drop inferred
arguments from the examples.

Change-Id: Ib944ca045366b81b8897d9548112a8889e097769
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113643
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-12-12 23:06:43 +00:00
dan sinclair f6d95d3244 Rename TypeFlags and TypeFlag.
This CL updates TypeFlags and TypeFlag to drop the Type prefix.

Bug: tint:1718
Change-Id: Ia197c867e39102582ba3314b7b3f24d8bec89712
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113801
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-12-12 21:26:23 +00:00
Loko Kung e70563ac03 Implements maxColorAttachmentBytesPerSample
- Adds the limit
- Adds relevant format-specific data into format table
- Adds deprecation validations regarding the limit
- Adds deprecation validation unit tests and helpful utils
- Moves deprecated api tests from end2end to unittests, allowing tests
  to be cross-files for ease after deprecation.
- Updates some validation messages to include helpful contexts.

Bug: dawn:1522
Change-Id: Ib05f9adb60808ff4d68061d9646e76c729a23643
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113543
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Loko Kung <lokokung@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2022-12-12 20:55:05 +00:00
dan sinclair 28a7827981 Rename type Base methods
This CL renames StructBase and StructMemberBase to drop the Base suffix
now that the move is complete.

Bug: tint:1718
Change-Id: If8126e4993c58bb2de475c2b18695705082a0a92
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113800
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-12-12 20:51:44 +00:00
Li, Hao ad57a58488 Add suppressed end2end tests back on Intel Windows Vulkan
Vulkan backend had been disabled on Intel Windows Vulkan driver <
30.0.101.2111, these suppressed end2end tests are fixed on that version
and later, we can remove the suppression.

Bug: dawn:1392, dawn:819, dawn:1172, dawn:1489
Change-Id: I91a8dfac833b068e8e3bb70d9f9af977f7b6026c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113610
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2022-12-12 17:10:40 +00:00
Antonio Maiorano 7c9e639e35 tint: const eval of mix builtin
Bug: tint:1581
Change-Id: I3b9f0ff3a58956616daf17b3d4a922979fc30216
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113680
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-12-12 15:31:21 +00:00
Antonio Maiorano 28779af91c tint: impement short-circuiting for const eval of logical and/or
Bug: tint:1581
Change-Id: I44852bfeb0e55771009a89ed199ea60ca51e8477
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113431
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-12-09 21:28:51 +00:00
Ben Clayton f528d33d52 tint/transform: fix PromoteInitializersToLet for constant expressions
Fix more edge cases uncovered with tint:1781

Fixed: tint:1781
Change-Id: I58d120185f47c10bc9fe55dd95a198d496c4ec94
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113024
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
2022-12-09 12:34:36 +00:00
dan sinclair 837b8042d3 Rename TypeManager to Manager.
With the move to the type:: hierarchy rename type::TypeManager to
type::Manager.

Bug: tint:1718
Change-Id: I1c8e2c2e469e20b959676232e9f3d62c9b3a789e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113429
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-12-09 05:00:07 +00:00
dan sinclair 98705d417e Remove type:: prefix in type/ folder.
Remove type:: namespaces added during the file moves.

Bug: tint:1718
Change-Id: I9862296cf93aad92e6c2b2e54d06d1c53d3a9b09
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113428
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-12-08 22:21:24 +00:00
dan sinclair 946858ad56 Move array to type/
This CL moves array to the type/ folder. Namespaces are updated as
needed. A FriendlyName method was added to ArrayCount so the sem::
ArrayCount entries do not need to be referenced inside type/.

Bug: tint:1718
Change-Id: I16a8f32b3fab1131b284a6981a5c386081138b08
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113427
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-12-08 22:21:24 +00:00
dan sinclair f53b2b5b2e Split sem/struct into sem and type.
This CL moves the Base entries from sem/struct into type. The class
names are maintained as Base over the move and will be renamed in a
followup.

Bug: tint:1718
Change-Id: I07bed013167c58fc83f0069c781404d8197966ee
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113425
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-12-08 22:21:24 +00:00
dan sinclair d8a084585f Move atomic to type/
This CL moves atomic to type/ and updates the namespaces.

Bug: tint:1718
Change-Id: I3331bc0dfae2ccede52b5589b7d3cc443366096a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113424
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-12-08 22:21:24 +00:00
dan sinclair 0e780da882 Move vector and matrix to type/.
This CL moves vector and matrix to type/ and updates the namespaces as
needed.

Bug: tint:1718
Change-Id: I48423b37f15cd69c03ab288143b2d36564789fbf
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113423
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-12-08 22:21:24 +00:00
Ben Clayton 06c1af47bd tint: Fix Renamer transform with type short-names
Fixed: tint:1783
Change-Id: I0ffd5860405651f15961dc8fe753eeac6edc8434
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113441
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-12-08 20:45:54 +00:00
Ben Clayton d00663d882 tint: Move resolver/type_alias to type/short_name
'Short-name' is way less overloaded than 'alias' and 'builtin'.

The package move allows transforms to use these enums.

Change-Id: I61c6b3f7deee8e835990a948cd5427c07034fa5e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113440
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
2022-12-08 19:07:06 +00:00
James Price 04f792de9f tint/transform: Use InsertFront to add attribute
This is simpler than reconstructing the attribute list and manually
cloning the struct member.

Change-Id: I3d0bd4039030b47e53ce618d9de7ee572b9698f1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113422
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-12-08 19:01:17 +00:00
James Price 48802bb9ea tint/transform: Remove commented out code
Change-Id: Ie5fc57bdcc17e4b96173e43e0a230d4f00f58a93
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113421
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2022-12-08 19:01:17 +00:00
dan sinclair 4d56b48bbf Move pointer and ref to type/
This CL moves the pointer and reference files over to type/ and updates
the namespaces.

Bug: tint:1718
Change-Id: I487a37ef2f6a3884d2ff51af4ac63869c3e03698
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113420
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-12-08 17:50:50 +00:00
Corentin Wallez 92ccab037f Add test for a depth sampling issue.
Bug: dawn:1187

Change-Id: Ib4187377c6a117b35ca3e77d2f5b8a7a7d07b939
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/68944
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Brandon Jones <bajones@chromium.org>
2022-12-08 17:17:04 +00:00
dan sinclair d37ecf9055 Move scalar types over to type/ folder.
This CL moves Bool, F16, F32, I32, U32, and Void over to the type folder
and updates namespaces as needed.

Bug: tint:1718
Change-Id: If3056521e5283ac2d9e1fd09c6daf0f647dd3846
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113342
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-12-08 16:39:59 +00:00
David Neto c223ae26ec spirv-reader: support SSign extended instruction
Fixed: tint:1062
Change-Id: I568f4fad0e5d110d06f2515fde1a31764c65e39a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113320
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Auto-Submit: David Neto <dneto@google.com>
2022-12-08 16:35:49 +00:00
dan sinclair 094ace6f63 Move abstract types to type folder.
This CL moves the abstract files from sem to type and updates namespaces
as needed.

Bug: tint:1718
Change-Id: I5f0be7e820fc66ea72c1ebe612a6d28034e88be6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113341
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
2022-12-08 15:33:01 +00:00
dan sinclair 5ee58b60a8 Move sampler to type.
This CL moves the sampler from sem to type and updates the namespace.

Bug: tint:1718
Change-Id: I22d228df5d24e154dbebecb43e7c6730475e08d2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113283
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-12-08 15:25:18 +00:00
dan sinclair 4595fb7989 Move texture types to type/ folder.
This CL moves the texture types into the type folder and namespace.

Bug: tint:1718
Change-Id: I3088e4f8174855043313f4497b384b3947dc6aaf
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113282
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
2022-12-08 14:14:10 +00:00
dan sinclair c9949ac59e Move type_manager to type/ folder
This CL moves the type_manager from sem to type and updates the
namespace as needed.

Bug: tint:1718
Change-Id: I1fe0c2be08146221e68a9d2e7450283d102afdfa
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113280
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-12-08 12:03:53 +00:00
Takahiro e536775b40 Distinguish Map request callback fired by device
Currently Buffer doesn't distinguish Map request callback fired
by device. For example if buffer.MapAsync(), buffer.Unmap(),
and buffer.MapAsync() are called in this order before the first
MapAsync() finishes the MapAsync callback provided by application
for the first MapAsync() is fired when Map request callback
for the first MapAsync() is fired by device although the first
MapAsync callback provided by application shouldn't be fired
because it is already unmapped.

This commit resolves this problem by assigning MapRequestId to
Map request and distinguishing the callback fired by device.

Change-Id: Ic29b02d27cffb254616dc7b48a60151c39f667e2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113222
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Kokoro: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
2022-12-08 04:49:32 +00:00
dan sinclair 5f764d8527 Move type base classes into type/ folder.
This CL moves sem/type and copies sem/node into the type/ folder. The
type subclasses are moved over to using type::Type while remaining in
the sem:: namespace. They will be moved over in followup CLs.

Bug: tint:1718
Change-Id: I3f3495328d734f88e4fc2dfbc6705343f1198dc5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113180
Reviewed-by: Ben Clayton <bclayton@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-12-08 00:32:27 +00:00
shrekshao ad71dc1ab2 Add validation for pipeline overrides value type error for i32/u32/f32
Follow WebIDL TypeError for float and EnforceRange. Generate
a validation error is the number is not representable.

Bug: dawn:1597
Change-Id: I9a683f65ed0bfadb936d5de358670b01a2036848
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112920
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Shrek Shao <shrekshao@google.com>
2022-12-07 23:32:33 +00:00
Ben Clayton 7017ec264c tint: Implement signed-int overloads of sign()
Bug: tint:1581
Fixed: tint:1782
Change-Id: Ia029bf9d1ce1d978c5cabc3016cb8ad1b4bac06a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113243
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-12-07 19:52:49 +00:00
Ben Clayton d839931a37 tint/resolver: Clean up const eval builtin case functions
Change-Id: I37a687a9831dcae748153a351f631d611d196f50
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113242
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-12-07 19:43:05 +00:00
Ben Clayton 6c337aa18e tint/sem: Rename [un]signed Type helper methods
These only consider integers. Include that fact in their name

Change-Id: I7b54c3fb0a6efd6f8de06fac7734a59eaf7829e5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113241
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-12-07 19:25:17 +00:00
Corentin Wallez 6be7f3212b node: Implement GPUDevice.features
Bug: None
Change-Id: I29f2832d22567d357a474e2b9522d3b7f195b3fb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112600
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Kokoro: Ben Clayton <bclayton@google.com>
2022-12-07 13:53:04 +00:00
Antonio Maiorano 4c8f5a1ac2 tint: const eval of logical AND and OR
Bug: tint:1581
Change-Id: I3921041613cb1c9fa3365d4cb1fc8c81bab92003
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113101
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2022-12-07 13:29:58 +00:00
Zhaoming Jiang 6198bea2ac Dawn&Tint: Implement F16 pipeline IO
This CL implement f16 for pipeline IO, i.e. vertex shader input,
interstage variables between vertex and fragment shader, and fragment
shader output (render target). Unit tests and E2E tests for Tint and
Dawn are also implemented.

Bugs: tint:1473, tint:1502
Change-Id: If0d6b2b3171ec8b7e4efc0efd58cc803c6a3d3a8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111160
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2022-12-07 04:33:24 +00:00
Jason Erb 94751e1a7d tint/utils: Vector::Clear: disable "maybe initialized" warning
Bug: 1607
Change-Id: I0da8ff0ddfe8ff09b06268333f7d1cf0285b2eba
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113060
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-12-07 01:07:54 +00:00
dan sinclair ad9cd0a141 Add base class for sem Struct and StructMember
This CL splits the sem::Struct and sem::StructMember classes into having
a base class and a sem variant. The sem variant contains the
`ast::Declaration` for that sem node. This will allow the base classes
to move into the type hierarchy and keep the sem specific requirements
in the sem folder.

Bug: tint:1718
Change-Id: I83294e957a52b87b8536dbb3582daa06a8516253
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112860
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
2022-12-06 20:01:54 +00:00
Ben Clayton c07de73b0b tint/transform: Strip unused atomic builtins
If a SPIR-V program declared spirv-atomic stubs, but didn't call them then the transform could be skipped, leaving stub functions behind. This could cause writers to vomit.

Ensure that these are correctly stripped.

Bug: oss-fuzz:54057
Change-Id: I27c89a621163b1a3cc5e2ef375f846a094434062
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113023
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-12-06 19:41:22 +00:00
Ben Clayton 49334b05cf tint/utils: Remove non-const accessors on VectorRef
Nothing uses these, and the mutability of these breaks
const-correctness.

Switch functions that used to return `const utils::Vector<T, N>&`
to returning `utils::VectorRef<T>`. Removes the templated size from the
public interface.

Replace all `const utils::VectorRef<T>&` with `utils::Vector<T>`,
there's no point in using yet another level of pointer indirection.

Change-Id: Ib96e3171500606d9afffbb13f40023552a74fffc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113021
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
2022-12-06 19:39:02 +00:00
Jason Erb 6016d1e5cd tint: Fix unused-but-set-parameter warning
Bug: dawn:1608
Change-Id: I49575fc34f162be4b046ac479459c554a563bcca
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113080
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-12-06 19:37:38 +00:00
James Price 8753796aac tint: Add PreservePadding transform
This is used to ensure that assignments to host-visible memory do not
modify padding bytes in structures and arrays. We decompose
assignments of whole structure and array types into member-wise or
element-wise copies, using helper functions.

This is used in all backends except HLSL, which already decomposes
memory accesses.

Bug: tint:1571
Change-Id: Id6de2f917fb80151cc654a7e1c8413ae956f0d61
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112720
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
2022-12-06 18:32:19 +00:00
Ben Clayton a31d89d6a3 tint/utils: Add support for unsafe pointer downcasts
Bug: tint:1779
Change-Id: Icfd27680edf7dfaedbfb70f25641dc762d23f42a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113020
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-12-06 15:43:40 +00:00
Corentin Wallez 4c5a9c1ef7 node: Throw a TypeError when writeTimestamp is not supported
Bug: None
Change-Id: I7e02883c53371c40a9e1766d50550ffc43165c2e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112425
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2022-12-06 13:37:21 +00:00
Austin Eng 3c4fddf3e3 Fix leak of Metal counter sample buffers
The blit descriptor allocation was leaking, which references the
counter sample buffer. Fix it by storing the descriptor in a
scoped NSRef

Fixed: dawn:1603
Change-Id: If40e8608db167717a4e07f3cb64a5e98402e3f1a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112861
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-12-06 02:25:23 +00:00
Austin Eng 99cdc539df Reduce kMaxQueryCount to 4096
Bug: gpuweb#3648
Change-Id: Ic0dc211a4338f42de1a533c0f18f8852d8af4d36
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112445
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2022-12-06 02:24:49 +00:00
Antonio Maiorano 875d116a87 tint: fix signed overflow in const eval modulo
Bug: chromium:1395241
Bug: tint:1581
Change-Id: I6f6084749d9bc5c0d493476b251eeec5543d8621
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112701
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Auto-Submit: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-12-05 17:16:15 +00:00
Corentin Wallez c17b4f9b69 node: Throw a TypeError for unsupported GPUQueryTypes
The WebGPU spec requires this so that an extension not being enabled or
not implemented by the browser both behave the same.

Bug: None
Change-Id: I52d991ba63438068d4adaf1391771336186a402a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112422
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-12-05 13:54:44 +00:00
Corentin Wallez 0d6b1fc45f node: Implement support for depth-clip-control
Bug: None
Change-Id: If62e2963917b1f2a94e415ce2c4c22b14317779a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112601
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-12-05 12:04:16 +00:00
Corentin Wallez e2cdafbf8a node: Throw a TypeError for unsupported GPUTextureFormats
The WebGPU spec requires this so that an extension not being enabled or
not implemented by the browser both behave the same.

Bug: None
Change-Id: Iba449c1f67d266aa53b924501577d646cd944f55
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112421
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-12-05 11:50:49 +00:00
Zhaoming Jiang f42d92a1d5 Tint: Refactor transform VertexPulling and its unit tests
This CL prepare transform VertexPulling and its unit tests for
implementing f16 pipeline io. This CL distinguishes vertex format type
and WGSL variable type of a vertex shader attribute (location input) in
VertexPuilling transform as both `f32` and `f16` WGSL types would be
mapepd to float vertex format. This CL splits VertexPulling unit tests
by base veretx format (SInt, UInt and Float), make it easier to add
`f16` tests.

Bugs: tint:1473, tint:1502
Change-Id: I649deb61e8eb8dac6ebd653bf77ef96475334a56
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112520
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-12-02 18:11:57 +00:00
Corentin Wallez 06749f92b2 node: add support for GPUErrorFilter.Internal
Bug: None
Change-Id: Icb36b8a3d207d068185494580358f438f8332c65
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112420
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-12-02 15:36:17 +00:00
Corentin Wallez 63a67a7218 node: Support sparse vertex buffer layouts
Bug: dawn:1000
Change-Id: I616369acdf5c9d883da8d0da292aa1b3f4a77250
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112021
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
2022-12-02 15:35:14 +00:00
Corentin Wallez 89b2e10eac node: Implement Compute/RenderPassTimestampWrites
Bug: dawn:1250
Change-Id: Iccd9123b3af7347d7586b998df5b11ab15608bb1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112424
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2022-12-02 15:33:51 +00:00
Antonio Maiorano 42ada5f248 tint: const eval of binary right shift
Bug: tint:1581
Change-Id: I3f40454559c4fc36565de1a11a6e6c8c394fd0cc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112620
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-12-02 15:25:20 +00:00
Ben Clayton 7423496da6 tint/transform: Fix NPE in ZeroInitWorkgroupMemory.
If an array uses an override expression, then we'd raise an error, but then attempt to dereference a nullptr.

Bug: chromium:1392853
Change-Id: Ib1d538bc491923b628b32f2398f8b2ace24c3bc3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112561
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-12-02 13:49:57 +00:00
Corentin Wallez 25c0bdf2a9 node: Add support for GPURenderPassDescriptor.maxDrawCount
Bug: None
Change-Id: I5e2ff510ceaa09becf0f5f760d0d0f7bc1d0cb49
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112423
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-12-02 12:06:35 +00:00
dan sinclair 15e7f94b76 Remove ArrayCount helpers.
This CL removes the helpers in sem::Array to determine the type of
ArrayCount. Instead the `Is` and `As` functions from Castable are used
at the call sites.

Bug: tint:1718
Change-Id: Ie666bfbfca6bb1be8ead613266a7221d88f7a76d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112442
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
2022-12-02 02:59:44 +00:00
dan sinclair 4b1d79e292 Moved sem::ArrayCount to an inherited structure
This CL moves the ArrayCount from a variant to use inheritance. This
will allow the sem to have different array count classes from the IR.
The ArrayCounts, similar to types, are unique across the code base and
are provided by the TypeManager.

Bug: tint:1718
Change-Id: Ib9c7c9df881e7a34cc3def2ff29571f536d66244
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112441
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-12-01 23:45:18 +00:00
shrekshao 71e6bcf1af Update validation for pass encoding beginRenderPass/beginComputePass
Make validation for pass encoding aligned to spec, where
descriptor validation failure will make pass invalid and stop
immediately instead of defer to CommandEncoder::Finish()

Bug: dawn:1602
Change-Id: I7892009e31f7565e4da43c38d365b056c9ecc22f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112448
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Shrek Shao <shrekshao@google.com>
2022-12-01 22:23:47 +00:00
dan sinclair 847cfa07c5 Move allocator into TypeManager
Currently the TypeManger is a UniqueAllocator. This works as long as the
TypeManager only manages one specific thing. In order to support
ArrayCount, which is type related, but not a type, the TypeManager will
need to be able to store two types of things.

This CL changes the TypeManager to contain a UniqueAllocator and proxies
the needed Get, Find and iteration methods to that allocator. This will
allow another allocator to be added for ArrayCount later.

Bug: tint:1718
Change-Id: I0f952eb5c3ef90a7c85dead14d11b657dceba951
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112640
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-12-01 21:42:47 +00:00
dan sinclair 2939c4531e Fix stack-overflow in `lhs_expression`.
Currently when parsing `*` and `&` we recursively call into ourselves to
process the tokens. This can cause stack issues if there are an
excessive number of `*`s and `&`s.

This Cl changes `lhs_expression` to generate a list of UnaryOps to be
applied and does not recursively call `lhs_expression`.

Bug: chromium:1394972
Change-Id: I40caee05c9b7f71abb776d375cbf995c6a1fd36f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112580
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-12-01 20:39:33 +00:00
Ben Clayton 6992f51ebd tint: Add DirectVariableAccess transform
Enables the 'chromium_experimental_full_ptr_parameters' extension to
allow passing of uniform, storage and workgroup  address-spaced
pointers as parameters, as well as pointers into sub-objects.

Bug: tint:1758
Change-Id: I8c85e6104ef4f2b9a177dec2857b1bf7f5148212
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/103860
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
2022-12-01 18:49:09 +00:00
Ben Clayton d257e28792 tint: Don't override alignment with @offset
Overriding the alignment to 1 would cause nested structures to be
incorrectly laid out. The fix: Don't override the alignment.

All struct layout validation works on the sem offsets, so none of this
has to change.

Bug: tint:1776
Change-Id: Ic01d45fb2790cd823ed9a55e336860ebdc351aea
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112603
Kokoro: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-12-01 18:41:57 +00:00
Ben Clayton efb17b0254 tint/writer/wgsl: Print @offset attributes as comment
We use WGSL to visualize the AST. Make sure we don't hide anything.

Bug: tint:1776
Change-Id: Iedd7ca797fb745d9db7d0aba8a5718039241afbb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112602
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
2022-12-01 17:37:56 +00:00
dan sinclair f745e4e2bf Add Source to sem::Struct
This CL adds a Source to the sem::Struct. The uses of
struct->Declaration()->source now use the source stored directly on the
struct.

Bug: tint:1718
Change-Id: I860c67764f85d98b3f655247e18f93fa0fef9436
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112447
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-12-01 16:25:25 +00:00
Ben Clayton 8954189545 tint_common_fuzzer: Don't attempt to use an invalid program
validate_program was not returning 0 for invalid programs that did not contain diagnostics with a severity greater than error.
This lead to broken behavior in logic that used the program.

Bug: chromium:1392853
Change-Id: Id860e266cfe24ade955edf4f2f2a9c26c2e117fa
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112560
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
2022-12-01 15:34:55 +00:00
dan sinclair 527e38b68b [sem] Move TransitivelyReferencedOverrides to sem::Info.
This CL pulls the TransitivelyReferencedOverrides from sem::Array and
sem::GlobalVariable up to the sem::Info.

Moving this data outside of sem::Array removes one of the references to
non-Type sem content.

Bug: tint:1718
Change-Id: I40c1c8b2d5ec60dc2723b56cc30cd436e9b7e997
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112324
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-12-01 15:33:43 +00:00
dan sinclair 331a3b7980 Add Source to sem::StructMember
This CL adds a Source to the sem::StructMember. The uses of
member->Declaration()->source now use the source stored directly on the
struct member.

Bug: tint:1718
Change-Id: Ic97053dd3e0080f128ee411857512920d3940858
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112446
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-12-01 15:08:21 +00:00
dan sinclair c5b1b5c77a Access struct member name through sem.
This CL changes the uses of Declaration()->symbol for struct members in
the sem to access the `Name` directly.

Bug: tint:1718
Change-Id: I3050147b97bea66d6c283e176a7152f36eb2b25f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112444
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-12-01 14:52:33 +00:00
Ben Clayton d5d207ba9f tint: Add builtin type aliases (vec3f, etc)
Fixed: tint:1772
Change-Id: I4bed36ded91ca5288875ed6ea819ff4bbb432186
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112340
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
2022-12-01 13:41:56 +00:00
Corentin Wallez cf8513d4e5 Roll third_party/gpuweb/ 3c4734b09..0f5fc665a (381 commits)
And update dawn/node accordingly.

3c4734b09c...0f5fc665a0

$ git log 3c4734b09..0f5fc665a --date=short --no-merges --format='%ad %ae %s'
2022-11-25 alanbaker Deploying to gh-pages from @ gpuweb/gpuweb@6b7d8f4947 🚀
2022-11-24 dneto Deploying to gh-pages from @ gpuweb/gpuweb@7eea224a85 🚀
2022-11-23 dneto Deploying to gh-pages from @ gpuweb/gpuweb@c11820e695 🚀
2022-11-23 alanbaker Deploying to gh-pages from @ gpuweb/gpuweb@162e04d0c0 🚀
2022-11-22 dneto Deploying to gh-pages from @ gpuweb/gpuweb@58a9410e38 🚀
2022-11-22 dneto Deploying to gh-pages from @ gpuweb/gpuweb@9fa1932d13 🚀
2022-11-22 dneto Deploying to gh-pages from @ gpuweb/gpuweb@39f2321f54 🚀
2022-11-21 alanbaker Deploying to gh-pages from @ gpuweb/gpuweb@cc0fc37636 🚀
2022-11-18 mehmetoguzderin Deploying to gh-pages from @ gpuweb/gpuweb@684c5104ce 🚀
2022-11-18 mehmetoguzderin Deploying to gh-pages from @ gpuweb/gpuweb@6049e8fc99 🚀
2022-11-17 dneto Deploying to gh-pages from @ gpuweb/gpuweb@0812694055 🚀
2022-11-17 dneto Deploying to gh-pages from @ gpuweb/gpuweb@9b65623938 🚀
2022-11-17 kainino1 Deploying to gh-pages from @ gpuweb/gpuweb@30e78fb154 🚀
2022-11-16 mehmetoguzderin Deploying to gh-pages from @ gpuweb/gpuweb@8b9da345bd 🚀
2022-11-16 kainino1 Deploying to gh-pages from @ gpuweb/gpuweb@113555271f 🚀
2022-11-13 dneto Deploying to gh-pages from @ gpuweb/gpuweb@9c39cc1f0e 🚀
2022-11-11 dneto Deploying to gh-pages from @ gpuweb/gpuweb@a3d767aff4 🚀
2022-11-09 dneto Deploying to gh-pages from @ gpuweb/gpuweb@576b7c97c7 🚀
2022-11-09 dneto Deploying to gh-pages from @ gpuweb/gpuweb@f2fadab356 🚀
2022-11-09 dneto Deploying to gh-pages from @ gpuweb/gpuweb@a291e74d7e 🚀
2022-11-09 dneto Deploying to gh-pages from @ gpuweb/gpuweb@0f69fcba15 🚀
2022-11-09 jdashg Deploying to gh-pages from @ gpuweb/gpuweb@f02d667d59 🚀
2022-11-07 dneto Deploying to gh-pages from @ gpuweb/gpuweb@0fdebc2886 🚀
2022-11-07 dneto Deploying to gh-pages from @ gpuweb/gpuweb@44164a2c63 🚀
2022-11-07 alanbaker Deploying to gh-pages from @ gpuweb/gpuweb@a5cebd5772 🚀
2022-11-07 dneto Deploying to gh-pages from @ gpuweb/gpuweb@c322a6fed4 🚀
2022-11-07 dneto Deploying to gh-pages from @ gpuweb/gpuweb@7ef39cfc0e 🚀
2022-11-07 dneto Deploying to gh-pages from @ gpuweb/gpuweb@572fc32a83 🚀
2022-11-07 dneto Deploying to gh-pages from @ gpuweb/gpuweb@4bb872ac55 🚀
2022-11-02 dneto Deploying to gh-pages from @ gpuweb/gpuweb@98f851baa4 🚀
2022-11-02 dneto Deploying to gh-pages from @ gpuweb/gpuweb@5c6f648919 🚀
2022-11-02 dneto Deploying to gh-pages from @ gpuweb/gpuweb@bf1d73a036 🚀
2022-11-01 dneto Deploying to gh-pages from @ gpuweb/gpuweb@2371712042 🚀
2022-11-01 dneto Deploying to gh-pages from @ gpuweb/gpuweb@acdc5b3e83 🚀
2022-11-01 dneto Deploying to gh-pages from @ gpuweb/gpuweb@8304c57556 🚀
2022-10-27 mehmetoguzderin Deploying to gh-pages from @ gpuweb/gpuweb@27c5c15c84 🚀
2022-10-26 corentin Deploying to gh-pages from @ gpuweb/gpuweb@4048adbfb3 🚀
2022-10-26 shaobo.yan Deploying to gh-pages from @ gpuweb/gpuweb@b85a821e2f 🚀
2022-10-18 alanbaker Deploying to gh-pages from @ gpuweb/gpuweb@63a7a24e4d 🚀
2022-10-18 dneto Deploying to gh-pages from @ gpuweb/gpuweb@6678c9478d 🚀
2022-10-18 dneto Deploying to gh-pages from @ gpuweb/gpuweb@b56d95976d 🚀
2022-10-18 alanbaker Deploying to gh-pages from @ gpuweb/gpuweb@44cf3bf01c 🚀
2022-10-17 kainino1 Deploying to gh-pages from @ gpuweb/gpuweb@1e332763cd 🚀
2022-10-14 mehmetoguzderin Deploying to gh-pages from @ gpuweb/gpuweb@49eae687bf 🚀
2022-10-14 mehmetoguzderin Deploying to gh-pages from @ gpuweb/gpuweb@d7402a1367 🚀
2022-10-13 kainino1 Deploying to gh-pages from @ gpuweb/gpuweb@d2ef870027 🚀
2022-10-12 kainino1 Deploying to gh-pages from @ gpuweb/gpuweb@db76cc3158 🚀
2022-10-11 kainino1 Deploying to gh-pages from @ gpuweb/gpuweb@823a357986 🚀
2022-10-11 dneto Deploying to gh-pages from @ gpuweb/gpuweb@7857eee214 🚀
2022-10-11 kainino1 Deploying to gh-pages from @ gpuweb/gpuweb@6f93d67391 🚀
(...)
2022-06-14 jimb Correct '/' to '.' in 'derive render targets layout from pipeline'. (#3041)
2022-06-14 corentin Deploying to gh-pages from @ gpuweb/gpuweb@d47a377c38 🚀
2022-06-14 dsinclair Combine section headers which define the same function (#3020)
2022-06-14 dsinclair Combine section headers which define the same function (#3020)
2022-06-14 dsinclair Combine section headers which define the same function (#3020)
2022-06-14 dneto Deploying to gh-pages from @ gpuweb/gpuweb@e37fc8f57a 🚀
2022-06-13 mehmetoguzderin Shorthand
2022-06-13 mehmetoguzderin Shorthand
2022-06-13 mehmetoguzderin Shorthand
2022-06-13 mehmetoguzderin Deploying to gh-pages from @ gpuweb/gpuweb@170f891c4b 🚀
2022-06-13 dneto Add WGSL strict LALR(1) check to CI (#3037)
2022-06-13 dneto Add WGSL strict LALR(1) check to CI (#3037)
2022-06-13 dneto Add WGSL strict LALR(1) check to CI (#3037)
2022-06-13 dneto Deploying to gh-pages from @ gpuweb/gpuweb@edca8002ab 🚀
2022-06-11 kainino editorial nit: specify units for limits where relevant
2022-06-11 kainino editorial nit: specify units for limits where relevant
2022-06-11 kainino editorial nit: specify units for limits where relevant
2022-06-11 tojiro Deploying to gh-pages from @ gpuweb/gpuweb@02dac6eb8a 🚀
2022-06-10 dneto Add WGSL grammar analyzer (#2754)
2022-06-10 dneto Add WGSL grammar analyzer (#2754)
2022-06-10 dneto Add WGSL grammar analyzer (#2754)
2022-06-10 dneto Deploying to gh-pages from @ gpuweb/gpuweb@5fec9c7776 🚀
2022-06-10 kainino fix typo comparison_sampler -> sampler_comparison
2022-06-10 kainino fix typo comparison_sampler -> sampler_comparison
2022-06-10 kainino fix typo comparison_sampler -> sampler_comparison
2022-06-10 kainino1 Deploying to gh-pages from @ gpuweb/gpuweb@d3faddafb9 🚀
2022-06-09 jiawei.shao Ensure the formats supporting multisampling must support rendering (#3018)
2022-06-09 jiawei.shao Ensure the formats supporting multisampling must support rendering (#3018)
2022-06-09 jiawei.shao Ensure the formats supporting multisampling must support rendering (#3018)
2022-06-09 kainino1 Deploying to gh-pages from @ gpuweb/gpuweb@6ab558611a 🚀
2022-06-08 dom Align phrasing of Firing an event with DOM (#3019)
2022-06-08 dom Align phrasing of Firing an event with DOM (#3019)
2022-06-08 dom Align phrasing of Firing an event with DOM (#3019)
2022-06-08 kainino1 Deploying to gh-pages from @ gpuweb/gpuweb@72ce3910cf 🚀
2022-06-08 dsinclair Move builtin names to section headers. (#3016)
2022-06-08 dsinclair Move builtin names to section headers. (#3016)
2022-06-08 dsinclair Move builtin names to section headers. (#3016)
2022-06-08 bclayton wgsl: Allow phony assignment of abstract numeric type
2022-06-08 bclayton wgsl: Allow phony assignment of abstract numeric type
2022-06-08 bclayton wgsl: Allow phony assignment of abstract numeric type
2022-06-08 bclayton Deploying to gh-pages from @ gpuweb/gpuweb@1cfd17eed1 🚀
2022-06-07 kainino Add maxColorAttachments missing from GPUSupportedLimits (#2985)
2022-06-07 kainino Add maxColorAttachments missing from GPUSupportedLimits (#2985)
2022-06-07 kainino Add maxColorAttachments missing from GPUSupportedLimits (#2985)
2022-06-07 kainino1 Deploying to gh-pages from @ gpuweb/gpuweb@356791fbc0 🚀
2022-06-07 kainino Support building multi-file specs with the Bikeshed API (#2856)
2022-06-07 kainino Support building multi-file specs with the Bikeshed API (#2856)
2022-06-07 kainino Support building multi-file specs with the Bikeshed API (#2856)
2022-06-07 kainino1 Deploying to gh-pages from @ gpuweb/gpuweb@22eae85031 🚀
2022-06-07 kainino Format internal slots consistently with IDL attributes (#3011)

Created with:
  roll-dep third_party/gpuweb

Change-Id: Iebc959cfe54e64c17e7d6175379dbd2cfe840986
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111801
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-12-01 13:03:06 +00:00
Corentin Wallez 145643a542 Improve the error message of missing vertex buffers
It now shows at least one vertex buffer that wasn't set, which helped
debug another issue.

Bug: dawn:563
Change-Id: Ifd40611bc10b049780cb1239aeee3186a26bc0c9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112020
Reviewed-by: Brandon Jones <bajones@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-12-01 12:23:07 +00:00
Ben Clayton f62aec2dc8 tint: Add missing tests / benchmarks
For enums generated by intrinsic.def.

Change-Id: I1072248b31e2a365a558736f903d25f6e6184962
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112381
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
2022-12-01 11:40:24 +00:00
Antonio Maiorano f1f6e6fbea tint: merge const eval shift left definitions
No need to define separate entries for concrete and abstract input.

Bug: tint:1581
Change-Id: I7a855d789b87b3856d5433684afec4e8bb59baf6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112440
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2022-12-01 10:38:51 +00:00
Li Hao 5f8b9d28bc Disable Vulkan backend on old Intel Windows driver version
Skip enabling Vulkan backend on Intel Windows driver version < 30.0.101.2111 due to many flaky issue.

Bug: chromium:1338622, dawn:1392
Change-Id: I6975783bdc18d8a94d6c35e134756e3713833a29
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/105741
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Hao Li <hao.x.li@intel.com>
2022-12-01 10:15:35 +00:00
Zhaoming Jiang a54df5eca5 Tint: Fix extractBits polyfill
This CL fix the extractBits polyfill, used for D3D12 backend on windows.
With this patch the related CTS would get pass.

Fixed: tint:1775
Change-Id: I15636bb55af502fff773c19f03b4c3c9e99b63fd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112207
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-11-30 23:55:28 +00:00
Loko Kung b8dcd6b985 Fix condition for memory allocation to check for nullopt.
Bug: chromium:1394660
Change-Id: I54b395728c5a857fdcbff6a0f1c05c8db6051e5a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112443
Commit-Queue: Loko Kung <lokokung@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2022-11-30 22:35:09 +00:00
James Price ff70da9157 Include padding bytes in minBindingSize validation
The "minimum buffer binding size" for a buffer binding variable with
type `T` is `SizeOf(T)`, which includes trailing padding bytes for
structures.

Update several tests that were not creating large enough buffers. Add
a new test for validating the size of a buffer with a non-struct vec3
type, which should still be 12 bytes.

Fixed: tint:1377
Change-Id: Iddbc22c561a67b6aa6659d7ddf78b1b12b230930
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111582
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
2022-11-30 21:56:01 +00:00
Rafael Cintron 0d20b2b2b7 Destroy ResourceAllocationManager in d3d12::Device::DestroyImpl
Since the ZeroBuffer (4MB) is released in DestroyImpl, it sticks
around in the resource allocation manager, along with a large amount
of unneeded tracking data structures.

To further reduce memory consumption after developers Destroy, we now
delete the ResourceAllocationManager in DestroyImpl and ensure any
remaining objects go through the same shutdown path as normal usage.

Placed resources must be released before any heaps they reside in.

Bug: chromium:1377789
Change-Id: I7a0f6ad2fdcc60bfe5a51586c8a620f4862c38a5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111601
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Rafael Cintron <rafael.cintron@microsoft.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-11-30 21:40:59 +00:00
Brandon Jones 85ceb08d5c Add ExternalTexture Rotate and FlipY Functionality
Adds functionality to Dawn and Tint to rotate and flip-Y external
textures through the shader transform. Tests are included.

Bug: chromium:1316671
Change-Id: I40a6b67eaeb2a348f469e4879eeb585bc40537b2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110181
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Brandon1 Jones <brandon1.jones@intel.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-11-30 21:32:26 +00:00
Ben Clayton 94706ecba7 tint: Add 'chromium_experimental_full_ptr_parameters' extension
Removes validation around pointer parameters.

Bug: tint:1758
Change-Id: I3adc48f780fc8c6f5525f9ecc280e2a406069b49
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112286
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-11-30 19:13:29 +00:00
dan sinclair 53f646c55c [ir] Split Binary from Instruction
This CL pulls a Binary instruction out of the Instruction class and
changes Instruction to just be the base class.

Bug: tint:1718
Change-Id: Iab234bd8c3eeebedb56dffff7ec7244cda51d4d5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112320
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-11-30 16:36:46 +00:00
Antonio Maiorano babc21f931 tint: const eval of modulo operator
Bug: tint:1581
Change-Id: Icf9aaab29f45a41e6c367f60bf98ccc8958a56c7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112322
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-11-30 16:02:49 +00:00
Antonio Maiorano 171c542bf7 tint: improve compile error when calling builder::Val with the wrong
type

Now that Val() creates a Vecor of Scalar, we get horrible template spew
if the input value is of the wrong type.

Bug: tint:1581
Change-Id: I464d369e25f6374d3ffce0ee4dc21723b7e533a9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112323
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-11-30 16:02:45 +00:00
dan sinclair 6e306d34b5 [ir] Remove operator<<
The use of `operator<<` gets much more convoluted as things are changed
over to pointers and with inheritance. This CL switches the `operator<<`
methods to `ToString` functions.

Bug: tint:1718
Change-Id: I85fd25b870d82d995eb27014c767abe071e543b0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112046
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
2022-11-30 15:25:05 +00:00
Ben Clayton a160ccb8c3 tint/ir: Fix build
Destructors needs to be marked 'override', with no 'virtual'

Change-Id: I8648a160e6564c391b2c8be6ec6c7d02927c1707
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112382
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Auto-Submit: Ben Clayton <bclayton@google.com>
2022-11-30 14:22:29 +00:00
Antonio Maiorano cfea220927 tint/number: add CheckedMod functions
Will be used to implement const eval of binary modulo.

Bug: tint:1581
Change-Id: Ib3cb422b247d57932d0b7cfc0ea8588206c39671
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112321
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-11-30 14:18:51 +00:00
Ben Clayton 4c593c356b tint/sem: Minor cleanup
Change-Id: I71607570907de4d8cd79f6472413e30cd0cd2c17
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112284
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-11-30 11:50:54 +00:00
Austin Eng 23e2792891 Pipe viewFormats from ExternalImageDXGI to the texture descriptor
Bug: dawn:1470
Change-Id: I14d93d92a56e1b5c124330a992966feb1ddc0944
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112241
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2022-11-30 03:48:00 +00:00
Ben Clayton 205e16de63 tint/utils: Add Vector::Sort()
Convenience helper

Change-Id: I1d9fabcb1a89df1bc23a1e8805e5fd1caa68500b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112285
Kokoro: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-11-30 01:16:53 +00:00
Ben Clayton d205b716ca tint/resolver: forbid spelling non-instantiable pointer types
Fixed: tint:1553
Change-Id: Ib77777a7142d302fe2d0d083de601f7b5042ad6a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111881
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
2022-11-30 01:13:35 +00:00
dan sinclair 31e0850560 [ir] Convert instruction to a pointer
This CL updates the instruction class to be a `Castable` and allocated
from an Arena. Uses are updated to store the const pointer.

Bug: tint:1718
Change-Id: Ie0b8353cb0c6fe6e2ba6e01bcd45871891aef903
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112045
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-11-29 23:29:47 +00:00
dan sinclair e272eaf30f [ir] Split Value into Temp and Constant.
This CL pulls the Temp and Constant classes out of the Value base class.

Bug: tint:1718
Change-Id: Ib7bccc7d3190ddd1c5cf493704e778dd23b5c008
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112044
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-11-29 23:27:46 +00:00
Shrek Shao 0982dcea69 Add DisallowDeprecatedPath toggle
The runtime toggle is off by default. When turned on,
the deprecation warning will be turned into validation error.

Replace device->EmitDeprecationWarning with
DAWN_MAKE_DEPRECATION_ERROR macro which make an internal
validation error or make a MaybeError{} based on the toggle.
The callsite can wrap it with a DAWN_TRY.

Bug: dawn:1563, dawn:1525, dawn:1269, dawn:1602
Change-Id: I7fd6f4f8ffc2e054e5fc5fc4aaf23c47f5733847
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111321
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Shrek Shao <shrekshao@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-11-29 23:05:30 +00:00
Ben Clayton 34afd9b6c6 tint/resolver: Clean up variable validation
Move the validation of usage and address space to helper.
Improve diagnostics.
Fix / clean up tests.

This is in preparation for tint:1553

Change-Id: I2cbc8b851ecf02f214341f8cba6bd52413c42911
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111880
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-11-29 22:34:35 +00:00
shrekshao 67d52eb4f2 Fix stack-use-after-scope for usedInterstageVariables pointer
Bug: chromium:1393728
Change-Id: I078f898b9a6a237c81c15bb86736eb790cf6a261
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112260
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Shrek Shao <shrekshao@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-11-29 22:00:13 +00:00
Ben Clayton 75b18674bf tint: Add Symbol inequality operator
Allows Symbol to be used in a std::variant

Change-Id: If366622c39b5c25d633f6507467c9859394577c3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112283
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Ben Clayton <bclayton@google.com>
2022-11-29 21:17:37 +00:00
Ben Clayton c158e845e6 tint/utils: Add Hashmap equality and hashing
Allows Hashmaps to be used as keys to other hashmaps.

Change-Id: I557d99515451c55e599dda847e15ce8e2b4500c5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112282
Kokoro: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2022-11-29 20:54:06 +00:00
dan sinclair 2d108ae5ed [ir] Make Value a pointer stored in the module.
This CL moves the Value class to pointers stored in the module.

Bug: tint:1718
Change-Id: I0441e898c011b34b0fe2f8ca716ea26c9c566bd7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112043
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-11-29 20:36:59 +00:00
Ben Clayton 028092a843 tint/utils: Add Hashmap::Keys(), Hashmap::Values()
Change-Id: If51cb3f42e50db842ecd006bcfbbbd060957e650
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112281
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
2022-11-29 20:01:42 +00:00
Ben Clayton 05f3ebfc68 tint/utils: Make Hashmap iterator values mutable
Instead of always returning a const ref to the KeyValue, make the value
part mutable if the map is mutable.

Change-Id: I56512ba48a09300c51b1ac1ea31665a4941e2794
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112280
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-11-29 19:59:08 +00:00
Antonio Maiorano b200e74715 tint: simplify const eval binary op unit tests
Use the scalar overload of the case creation function.

Bug: tint:1581
Change-Id: I01b0d09ed99a9835583b1cee02ec323d2f2a546f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112204
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-11-29 19:32:46 +00:00
Austin Eng 75759ac273 Revert "CTS: Lift expectations for passing tests ComputeDispatchTests."
This reverts commit f42c4c7e5b.

Reason for revert: Tests are still failing. Win x86 bot doesn't run by
default on Dawn CQ.

Original change's description:
> CTS: Lift expectations for passing tests ComputeDispatchTests.
>
> Bug: dawn:1196
>
> Change-Id: I566f6171b6783fb51c3727aab64bd1488afa933f
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111800
> Commit-Queue: Austin Eng <enga@chromium.org>
> Reviewed-by: Austin Eng <enga@chromium.org>
> Kokoro: Kokoro <noreply+kokoro@google.com>

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: dawn:1196
Change-Id: I27799d6bcbc9e32079a3a39b94c1d42ec517e233
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112240
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Kokoro: Austin Eng <enga@chromium.org>
2022-11-29 16:39:52 +00:00
Antonio Maiorano 775dfbf7a8 tint: fix const eval of divide to emit errors on dbz and min/-1
Bug: tint:1581
Change-Id: I0459a7feb1be17f3570b68b54f1a0e0a1723880b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112180
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-11-29 15:08:40 +00:00
dan sinclair ec7a1d2a1b [ir] Remove the VarData from Value.
This CL removes VarData from Value. This will be implemented in another
way and is not currently used anywhere.

Bug: tint:1718
Change-Id: If5758cf050a080c6f68812219cd8ac968b54a8d6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112042
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
2022-11-29 14:34:47 +00:00
Loko Kung fbe4ac0957 Fixes Vulkan command buffer leaks when an error occurs.
- Uses an anonymous function to delete command pool/buffers.
- Shuffles the code around a bit so that the CommandPoolAndBuffer are
  clearly next to the EncodingContext stuff to make it clear that we
  may be able to consolidate them in the future.

Bug: chromium:1372772
Change-Id: I92a1d0333b7a85d439b5963a58db69ac685c03a4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112181
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Loko Kung <lokokung@google.com>
2022-11-29 05:29:27 +00:00
dan sinclair 62a07738c8 [ir] Renaming Register and Op
This CL renames Register to Value and Op to Instruction.

Bug: tint:1718
Change-Id: Ided22c524213235369aae366a678d8058a516b60
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112041
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-11-28 22:02:39 +00:00
Antonio Maiorano 3728a505d6 tint: const eval of refract builtin
Bug: tint:1581
Change-Id: Iff64e8a680fbbc82e1f8efe2e2f8e05af8e3692c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111920
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-11-28 21:14:36 +00:00
Corentin Wallez f42c4c7e5b CTS: Lift expectations for passing tests ComputeDispatchTests.
Bug: dawn:1196

Change-Id: I566f6171b6783fb51c3727aab64bd1488afa933f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111800
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-11-28 15:25:33 +00:00
Antonio Maiorano ee7d6db047 tint: const eval of reflect builtin
Bug: tint:1581
Change-Id: Ife4409ca897a5754fe6b76c650d26fd66ef5880f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111901
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-11-28 15:13:16 +00:00
Antonio Maiorano ffeae7aa50 tint: const eval of faceForward builtin
Bug: tint:1581
Change-Id: Ia50b4ec4d494face5e7f438037a092cd1f839849
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111840
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-11-25 23:35:53 +00:00
Ben Clayton 95d174a118 tint/resolver: Further simplify test const eval framework
Replace ScalarArgs struct with Scalar variant and vector.
Fold ValueBase and ConcreteValue into Value.

Change-Id: I5cc5811a87f1aae162feb65fb6b1ecdac033d0fe
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111761
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-11-25 15:30:51 +00:00
Ben Clayton c572df265d tint/utils: Add operator<<() support to vector
Helpful for tests and the like.

Change-Id: I07f8c59af6db4d6a5629dca2dc985398b75eccf9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111760
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-11-25 14:53:23 +00:00
Antonio Maiorano d4908670e1 tint: clean up const eval test framework
- Remove Types variant, and replace with a type-erasing Value class
  instead. This is not only better for compile times, but makes the code
  much easier to understand.
- Value wraps an internal shared_ptr to a const detail::ValueBase,
  allowing it to be used as a value-type (i.e. copyable), while behaving
  polymorphically.
- Add static_asserts to Val, Vec, and Mat creation helpers to emit a
  more useful error message when the wrong type is passed in.

Bug: tint:1581
Change-Id: Icd0d08522bedb3eab12c44efa0d1555ed6e96458
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111700
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-11-25 05:47:42 +00:00
dan sinclair 8392a82a40 Const eval for `normalize`
This CL adds const-eval for the `normalize` builtin.

Bug: tint:1581
Change-Id: I6d5ba3e0ba507921137ca90c4caefa9daf88f735
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111740
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-11-25 04:25:18 +00:00
David Neto 91ad2bc384 Remove support for SPIRV-Tools API transition
Remove the scaffolding required to support SPIRV-Tools using C vs. C++11
enums internally.

Key downstream dependencies have been updated.

Change-Id: Ia1982ba25209b6c50ad01679ac0e9fee06388fb8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111680
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Auto-Submit: David Neto <dneto@google.com>
Commit-Queue: David Neto <dneto@google.com>
2022-11-24 22:41:58 +00:00
dan sinclair 724ad2a290 Const eval for `fma`
This CL adds const-eval for the `fma` builtin.

Bug: tint:1581
Change-Id: Ia4df818fec9d5d969b364b2c165400d787a9e275
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111584
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2022-11-24 21:54:00 +00:00
dan sinclair a2a8895020 Const eval for `distance`
This CL adds const-eval for the `distance` builtin.

Bug: tint:1581
Change-Id: Iee3af6474ace8e7baa230156f582f0a372f77cb7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111583
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-11-24 21:48:48 +00:00
dan sinclair 7736153c15 Const eval for `inverseSqrt`
This CL adds const-eval for the `inverseSqrt` builtin.

Bug: tint:1581
Change-Id: Ieef063416a8033b5fac9396e30c76c20b3360a90
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111581
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-11-24 18:16:13 +00:00
Zhaoming Jiang ab9b5f3aa5 Tint: Implement f16 in uniform and storage address space
This CL implements f16 in uniform and storage address space, allowing
using f16 types in uniform and storage buffers on all backends. Tint
uint tests and Dawn E2E tests are added to validate the f16 types work
as expected.

Bug: tint:1473, tint:1502
Change-Id: I15e3de1033d3727f2ea33f4657f682c5f13c2153
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/106320
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2022-11-24 05:25:35 +00:00
Zhaoming Jiang be2ed98e05 Dawn: Require both DXC compiler and validator version being 1.6 or higher
This CL change the DXC version checking logic to get both DXC compiler
and validator version, which are not necessarily identical, and require
both version being 1.6 or higher to enable the use_dxc toggle.
This CL also modify the src/dawn/tests/BUILD.gn and add a copy target as
data_deps for "dawn_test" template, which copy DXC binaries from Windows
10 SDK 20348 to out directory, to ensure that windows trybots running
dawn_end2end_tests.exe (e.g. win-dawn-rel) can access a DXC of version
1.6 and can run end-to-end tests with DXC.

Bug: tint:1719
Change-Id: I39b48f3dffdf121d3749af7aa4b3d0bed1c22ea8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110340
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2022-11-24 02:07:48 +00:00
Rafael Cintron 36317d9839 Release D3D12 command queue in Device::DestroyImpl
Repeatedly creating and destroying WebGPU devices in a loop causes
large amounts of memory to pile up in the GPU process. Much of this
memory comes from the D3D12 command queue.

Releasing the command queue early in DestroyImpl before the destructor
runs goes a long way towards relieving the memory pressure.

Bug: chromium:1377789
Change-Id: I3ff9a5f6cb3ea3136e41079343532cbe732b6cc4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111280
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Rafael Cintron <rafael.cintron@microsoft.com>
2022-11-24 01:10:35 +00:00
Antonio Maiorano 9ba5f9e2c6 tint: const eval of transpose builtin
Bug: tint:1581
Change-Id: Ia614647bc4a3d24a53d45981ddcdb1c84ea84608
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111600
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-11-23 23:12:56 +00:00
dan sinclair b785dc1e39 Update parser to match * and & spec change.
The * and & operator grammar was updated in the spec to closer
match other languages. This CL updates the Tint WGSL parser to
match the current spec.

Bug: tint:1756
Change-Id: I81b7c373bbd6a540b9273813c63a29487e2907ce
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111580
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
2022-11-23 21:33:11 +00:00
Ben Clayton 7c6e229a18 tint/utils: Make Hashmap::Find() safer to use
Don't return a raw pointer to the map entry's value, instead return a new Reference which re-looks up the entry if the map is mutated.

Change-Id: I031749785faeac98e2a129a776493cb0371a5cb9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110540
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-11-23 21:04:25 +00:00
Ben Clayton 597ad53029 tint/transform: Add HoistToDeclBefore::VariableKind
Enums are scientifically proven to be 96.4% better than a bool for parameters.

Also throw in kConst because we can.

Change-Id: I788504d8d452d6a879d2d675891e3171db6a40f2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111244
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2022-11-23 20:05:10 +00:00
Ben Clayton ed998e91ab tint: Suffix builtin return types with '_f32'
If the template type is f32.

See: https://github.com/gpuweb/gpuweb/pull/3629
Change-Id: Ia686d77b4dbc169d7ef69a91d67e45357bee199f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111442
Reviewed-by: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-11-23 19:57:00 +00:00
Antonio Maiorano 05c8daac42 tint: const eval of determinant builtin
Bug: tint:1581
Change-Id: Ifed8202ba2346eee435ee4e3d0e82ab614a86255
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111281
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Kokoro: Antonio Maiorano <amaiorano@google.com>
2022-11-23 19:16:15 +00:00
dan sinclair 5180be6b1d Remove reserved words.
The `line`, `lineadj` and `point` reserved words were removed from
the spec. Update Tint to match.

Bug: tint:1769
Change-Id: I219bcf1d6053013133b8e369bb01c86af7bb9193
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111320
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
2022-11-23 18:21:41 +00:00
Ben Clayton 69c2c34326 tint: Implement const-eval of frexp()
Also add abstract overloads.

Bug: tint:1581
Fixed: tint:1768
Change-Id: Icda465e0cfe960b77823c2135f0cfe8f82ed394f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111441
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-11-23 18:21:38 +00:00
Takahiro d743778ed5 Also reject mapAsync if the buffer is being mapped
To reflect the WebGPU spec change at
https://github.com/gpuweb/gpuweb/pull/3348

Bug: chromium:1355994
Change-Id: I0159cbd9e1977a05453e3c562a2b0649a0ff930f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110448
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Takahiro <hogehoge@gachapin.jp>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-11-23 18:19:52 +00:00
dan sinclair f2ad5fd260 Add const-eval for `log` and `log2`.
This CL adds const-eval routines for `log` and `log2`.

Bug: tint:1581
Change-Id: I052b5ddd3bc8bdcd7c0925fa7912dcbe1a60e299
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111323
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2022-11-23 17:34:40 +00:00
Corentin Wallez 7a9fe30b11 CompilationMessages: compute offsets directly to take \r\n into account.
Bug: dawn:1357
Fixed: tint:1684
Change-Id: Ia1e9af3ff3ccb0fe674a838b966fa8a49ff8fb4f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111060
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-11-23 17:20:44 +00:00
dan sinclair ae739d6d1c Add const-eval for `exp` and `exp2`.
This CL adds const-eval routines for `exp` and `exp2`.

Bug: tint:1581
Change-Id: I59cc77aee64bfadf6ff10548f27f3d253b68a129
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111322
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-11-23 16:37:21 +00:00
Austin Eng e9ad15ae7f Add tolerances to pass several tests on Mac M1 and SwiftShader
Bug: none
Change-Id: I1fea9b59d3d151d2f94fda0793ad47493d98f6fb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/105780
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-11-23 16:20:03 +00:00
Ben Clayton 47fb4f9c57 tint/ir: fix double-underscore in identifier
This is reserved in C++, and triggers a warning-as-error for gcc

Change-Id: I0595977e690f9e0e7d5e1b6dd1fdeb74183fc378
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111440
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Ben Clayton <bclayton@google.com>
2022-11-23 15:00:51 +00:00
Ben Clayton 31b7fca82c tint: Add abstract overload of modf
Required fleshing out resolver handling of abstract structures.

Bug: tint:1768

Change-Id: Icb2983ac9bf37d4e260735cfdba5ac5e7dfe3ee2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111400
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-11-23 15:00:20 +00:00
Loko Kung bf3fecfc4b Ensures blob cache is always available, even if it is just a placeholder
Bug: dawn:549
Change-Id: I7efbaa58d93691648107fc6b94d76596a77f6516
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111140
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Loko Kung <lokokung@google.com>
2022-11-23 08:55:57 +00:00
Loko Kung c7e156fb7b Deprecates enable_blob_cache toggle in favor of a disable version.
Bug: dawn:549
Change-Id: I5ba4c3e381ae73c356b2e4700df3f463278c979c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110840
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Loko Kung <lokokung@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-11-23 02:32:42 +00:00
dan sinclair 0acbb4e047 Remove if-break deprecation
This CL removes support or if-break and requires the use of break-if.

Bug: tint:1724
Change-Id: I8311de2f0ce11b5af7fada71d258ae441f9e42f8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111100
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-11-23 02:14:05 +00:00
dan sinclair 669e15e139 [ir] Add EmitBinary
This CL adds the machinery to emit binary operations to the IR. The
debug helper is split into Debug and Disassembler. The Disassembler is
used to help test the IR output.

Bug: tint:1718
Change-Id: Iffdd3be92e69a87828655ac41be91b34d5618174
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110841
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
2022-11-23 02:11:52 +00:00
dan sinclair f6fcf0a3ef [ir] Add conditions to if and switch nodes.
This CL updates the if and switch nodes to store the condition value in
a register. The EmitExpression is updated to return a Register and the
builder updated to emit the expressions for the if, break-if, while,
and switch expressions.

Bug: tint:1718
Change-Id: Ie710812c74e8b9423a4aa997db451d9cdf304feb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110784
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-11-23 02:09:43 +00:00
Jiawei Shao 806c58324c Wire: Make validation error prior to OOM if mappedAtCreation == false
This patch updates the validations about CreateBuffer() with dawn_wire
to match the latest WebGPU SPEC.

According to the SPEC, the validations in CreateBuffer() should be
executed in the below order:
1. If mappedAtCreation == true, return nullptr and a RangeError will be
   generated in Chromium.
2. Validate BufferDescriptor and check if there is OOM at device timeline
3. Check if there is OOM at content timeline

Bug: dawn:1586
Change-Id: I97ff5f82a42208442ddf6e46e66381c3b3680450
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/109040
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2022-11-23 02:06:11 +00:00
dan sinclair a8bc296259 [spirv-reader] Emit break-if as needed.
This CL updates the SPIRV-Reader to emit `break-if` nodes instead of
`if-break` statements.

Bug: tint:1724
Change-Id: I8cd568f5e90a950acc5a42a470345273a5f1e6bc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111103
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-11-23 01:51:24 +00:00
dan sinclair a5b73a0fde [ir] Implement EmitLiteral.
This CL fills in the EmitLiteral method. Each literal is emitted as the
appropriate type of register. The literal is not added to the current
flow block as it is not yet used.

Bug: tint:1718
Change-Id: Ic6a576bcc08dc6ea251b60d1d079929ac4d97981
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110783
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-11-23 00:34:48 +00:00
Ben Clayton 329dfd7cbd tint: Implement const-eval of modf
Bug: tint:1581
Change-Id: I53151ebf43601cd6afcdd2ec91d0ff9c4e650ef3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111241
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-11-23 00:05:05 +00:00
Antonio Maiorano 92d858ac3c tint: const eval of length builtin
Bug: tint:1581
Change-Id: Ie6dc9da6b48c606af03da023c835ec36a99dd362
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110981
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-11-23 00:00:45 +00:00
James Price 89f15fc57e dawn/node: Fix shared library build
dawn.node now uses tint::Initialize() and tint::Shutdown(), and so
needs to link against libtint.

Fixed: tint:1765
Change-Id: I03e575b4709c43a6052ed3ca635376251c3323c0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111080
Auto-Submit: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-11-22 23:25:16 +00:00
Loko Kung 2e1b359087 Add wire serialized command buffer padding.
Pads serialized wire command buffers to 8 bytes so that we don't have
misaligned write/reads which can cause SIGILL depending on platform and
compilation mode, i.e. -c dbg in google3 builds.

- Adds helpers for aligning sizeof calls.
- Adds constant for wire padding (8u).
- Modifies BufferConsumer to allocate according to padding. This
  guarantees that when we [de]serialize stuff, the padding should be
  equal on both sides.
- Modifies extra byte serialization code (adding CommandExtension
  struct). This makes it clearer that each extension needs to be
  padded independently. Otherwise, before in wire/client/Buffer.cpp,
  since the read/write handle sizes were being passed as a sum, but
  read out separately from the BufferConsumer, we corrupt our pointers.
- Adds some simple unit tests.

Bug: dawn:1334
Change-Id: Id80e7c01a34b9f01c3f02b3e6c04c3bb3ad0eff9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110501
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Loko Kung <lokokung@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-11-22 23:19:43 +00:00
Austin Eng c982cd45c4 Use TINT_REFLECT for OverrideId
Adds tint_public_config to Dawn's internal config so Tint headers
can be included.

Fixed: dawn:1594
Change-Id: I4068fd95b6eae3138fbcc04f29f054c7cffdcf12
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111260
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Shrek Shao <shrekshao@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
Kokoro: Austin Eng <enga@chromium.org>
2022-11-22 22:23:55 +00:00
shrekshao f9c6633006 Update inter stage variable subsetting validation and add tests
Sync up with current WebGPU spec to allow FS input being a
subset of VS output instead of requiring a strict match.
This patch involves changing the validation and adding tests,
together with using the TruncateInterstageVariables for hlsl
generator to workaround the extra limit for D3D12 backend.

Bug: dawn:1493
Change-Id: I2d4ba7f43dbe57f17ecd5c5d659f4ca93bb682a3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/109460
Commit-Queue: Shrek Shao <shrekshao@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Shrek Shao <shrekshao@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-11-22 21:36:27 +00:00
shrekshao 7f760cb25c Tint truncate interstage variable transform
Add a transform to truncate unused user interstage variables by
adding a new truncated shader io struct wrapper of the original
one, with a truncate function to do the assignments called
at the return statement.

This transform is meant to be run after CanonicalizeEntryPointIO,
and will only be run under hlsl/generator_impl.cc to workaround
the extra register limitation for interstage variables on D3D FXC.

Bug: dawn:1493
Change-Id: I69081189ad7d4b76f2371fcc079f67dced2e9944
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/104620
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Shrek Shao <shrekshao@google.com>
2022-11-22 21:30:10 +00:00
dan sinclair 840bf6fc6d [ir] Add a Register class.
This CL adds a class to store register information for the IR. The
register can hold various types of data depending on if it's a f32, i32,
temporary, etc register.

Bug: tint:1718
Change-Id: I025af70f2b145c9697f1d7f996d0e98022eea829
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110782
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-11-22 20:43:49 +00:00
dan sinclair 2664229fd5 Cleanup some grammar.
This CL updates some grammar in break-if error messages.

Change-Id: I15ab6b98fd1b12dd4e6db16a28f0e311e9fee453
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111102
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-11-22 20:13:11 +00:00
Ben Clayton 6559903234 tint/resolver: Split constant checking to utility
And add basic support for builtins returning structures.

Bug tint:1581

Change-Id: I67f987339b9a344e1915c69c9991803f0665305d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111242
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2022-11-22 19:53:21 +00:00
Antonio Maiorano d6d30f4256 tint: const eval of dot builtin
Bug: tint:1581
Change-Id: Ie7768f8bf254509c1795207de0a1d8b07a317555
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110984
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-11-22 15:02:55 +00:00
Ben Clayton b2e6b7b865 tint/resolver: Consistently use ConstEval::Result
Fixed: tint:1661
Change-Id: I527b5e2d03abeb53b177a1c69952953864ec0913
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111240
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
2022-11-22 14:14:38 +00:00
Austin Eng 8a68537de2 Check buffer state is not destroyed before internally calling unmap
Calling UnmapInternal would set the state to Unmapped, allowing the
buffer to be mapped again even though it is destroyed.

Bug: chromium:1388920
Change-Id: Ibb4da332bafd44a0d4900c8ea5bfbd674bbc35e0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111121
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Loko Kung <lokokung@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2022-11-22 13:34:06 +00:00
dan sinclair e02377c2b3 [ir] Testing updates.
This CL renames the `Build` method in the test helper to be
`CreateBuilder` to maek the intention clearer. A second,
`CreateEmptyBuilder` is provided to allow for easier testing of
expressions.

The `current_flow_block` and `builder` are moved to public so they can
be used/updated during testing.

Bug: tint:1718
Change-Id: I663d4c7a3c76e6bf5396ca05f54fe634d35d0d56
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110781
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-11-22 13:15:08 +00:00
dan sinclair 51ecf65d43 [ir] Stub remaining AST walk structure.
This CL adds commented out blocks for the various switches required to
walk the AST.

Bug: tint:1718
Change-Id: I70e7c4d0168621bf97006a782f2942df1173c393
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110780
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-11-22 10:17:30 +00:00
Loko Kung edbeeee285 Fix cache default on condition.
- Messed up the conditon in previous change so it required both the
  enable flag to be on and the disable to be off, but then we can't
  deprecate the enable flag in Chromium.

Bug: dawn:549
Change-Id: I1c730939104aafaef48182238fa32ed7fa6a1e16
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110983
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Loko Kung <lokokung@google.com>
2022-11-22 03:38:51 +00:00
Loko Kung aa527ba348 Adds toggle to disable blob cache.
- The disable toggle will supercede the enable one once Chromium side
  deprecates usage of the enable one.

Bug: dawn:549
Change-Id: I5c5bd60161917fe2654cfce55a6f29e8a7e79962
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110728
Commit-Queue: Loko Kung <lokokung@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-11-21 21:46:18 +00:00
dan sinclair a32b6b4a0f [spirv-reader] Remove `forced` param from `MakeBranchDetailed`.
The `forced` parameter is always false, remove it.

Change-Id: I9aa16dfc6a51516f6b6e619a3c8ce982a25ba4c4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111101
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-11-21 21:39:42 +00:00
Ben Clayton 81ce4b6237 tint/transform: Include diagnostics in TINT_PRINT_PROGRAM_FOR_EACH_TRANSFORM
Change-Id: Id3e7e0cce464e8b1db00c2adab8db350eee0168c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111041
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-11-21 19:13:43 +00:00
Ben Clayton 87bccb74d8 tint/transform: Handle arrays of complex override lengths
Update CreateASTTypeFor() to handle a potential edge-case described in tint:1764.

We haven't seen this issue happen in production, nor can I find a way to trigger this with the tint executable, but try to handle this before we encounter a nasty bug.

Fixed: tint:1764
Change-Id: I496932955a6fdcbe26eacef8dcd04988f92545a1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111040
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-11-21 19:05:24 +00:00
dan sinclair efe9c49819 Add const-eval for `degrees` and `radians`
This CL adds const-eval for `degrees` and `radians`.

Bug: tint:1581
Change-Id: I7f00e2b1e5ab7c8e895680a6b75b9531dac31f5a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110601
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2022-11-21 18:00:01 +00:00
Ben Clayton 619f9bd639 tint/transform: Fix ICE when combining polyfills
There's a reason the overload of `ctx.Replace()` that takes a pointer to the replacement is deprecated - it doesn't play well when used as part of another replacement.
Switch to using the callback overload of Replace() to fix bad transform output.

Bug: tint:1386647
Change-Id: I94292eeb65d24d7b2446b16b8b4ad13bdd27965a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111000
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-11-21 17:11:05 +00:00
Antonio Maiorano f5eec817de tint: enable smoothstep error tests for f32 and f16
...now that we correctly fail on inf/nan. Also fold separate error test
functions into SmoothstepCases.

Also fixed atanh, acos, acosh, and asin tests to properly test error
cases for all float types, not just abstract float.

Bug: tint:1581
Bug: tint:1747
Change-Id: I63bd57d36beab4cc7dde501183052aa688e2efdb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110727
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2022-11-21 15:29:54 +00:00
Antonio Maiorano 1eaeb310a7 tint: fail on creation of a non-finite constant
This is a catch-all that handles all cases where an operation can result
in non-finite values, such as from calls to std::cosh and std::sinh.

Bug: tint:1581
Bug: tint:1747
Change-Id: Ibb55466fea01b263c98d598459c788fd22cf5bb7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110726
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-11-21 15:29:54 +00:00
Antonio Maiorano 72551392e8 tint: remove ConstEval::current_source member and pass down source through function calls
Bug: tint:1581
Bug: tint:1751
Change-Id: I4dea92d4b67d39559ce65f45144215e56b6a3e9a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110724
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-11-21 15:29:54 +00:00
Antonio Maiorano 893316014a tint: emit an error for float conversions that are not representable
For example, a large f32 value converted to f16 now fails, instead of
resulting in +/-inf.

Bug: tint:1581
Bug: tint:1747
Change-Id: I30fd8c61ecc328206e8f73b626af8046dad4b0b9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110723
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-11-21 15:29:54 +00:00
Ben Clayton 8bc64636cf tools/run-cts: Append --data flag to node
This will be required to use the new data-caching functionality provided by:
https://github.com/gpuweb/cts/pull/1985

Also propagate `--verbose` down, if passed to the frontend.

Change-Id: Ic436e8ed754296cec859c45bd4db703634c31ab1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/109764
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-11-21 13:03:05 +00:00
James Price fcac2f8304 tint: Strip aliases that reference unused overrides
The SingleEntryPoint transform currently does not strip away any
unused type declarations, which was leading to broken code when an
alias referenced an override that was removed. We can detect this
scenario and remove such aliases, until we have a better mechanism for
detecting all unused aliases.

Fixed: tint:1763
Change-Id: I319ff30b5e52d7dd54596cc99a2201a708c502f2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110725
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-11-21 12:49:15 +00:00
Jason Erb 5008af273c Replace CMAKE_SOURCE_DIR with PROJECT_SOURCE_DIR
Bug: 1596
Change-Id: I62285bb912e79323b7bb3fcdaea9ff64b1a4a1b9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110172
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-11-21 11:40:38 +00:00
Austin Eng b097bf2e34 Switch one more debug message UNREACHABLE to ASSERT(false)
Bug: chromium:1375131
Change-Id: I9150ef25ea3278d97f785f6ffbcc8d45ab79fd6a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110703
Auto-Submit: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2022-11-18 19:29:02 +00:00
Ben Clayton 542db5ce06 tint: Fix TINT_PRINT_PROGRAM_FOR_EACH_TRANSFORM
The #if disabled code wasn't compiling as a variable was renamed

Change-Id: I2ce7210d18d52036dd99f729a44e21c6137f84a9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110520
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
2022-11-18 12:11:33 +00:00
Ben Clayton 0d2aedf097 Run ./tools/format
Change-Id: I4a9f375f5c383d02917c2ade4c83c3d4fc458165
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110102
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-11-18 11:57:37 +00:00
Ben Clayton 543dd18d3c tint: Remove textureSampleLevel(texture_external)
Fixed: tint:1671
Change-Id: Iafed8d3ddbc99b80bbe70d3fc3847ac7a25c5e37
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110101
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-11-18 11:17:41 +00:00
Antonio Maiorano aedda6a500 tint: remove all inf/nan input cases for const-eval builtin tests
Bug: tint:1581
Bug: tint:1747
Change-Id: I26dec12c6abbb29f1128c3b3205fd2beb0058bd2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110702
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
2022-11-18 05:45:17 +00:00
Antonio Maiorano aff1656a76 tint/spriv-reader: emit error on non-finite literal
Bug: tint:1581
Bug: tint:1747
Change-Id: I2855c8e277e74ecf1465b81c4545b99fef2a321b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110701
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
2022-11-18 05:45:17 +00:00
Antonio Maiorano 0da91e06c5 tint: make const eval of binary ops on concrete values fail on NaN/Inf
With this CL, binary ops add, subtract, multiply, and divide of concrete
values will now produce an error if the result is inf/NaN, as it was
doing with abstract values. This also affects the cross builtin, which
is written in terms of subtract and multiply.

Bug: tint:1581
Bug: tint:1747
Change-Id: Ib1d0d8deddc82c67ab53729a6011937636fcc1a5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110163
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2022-11-18 05:45:17 +00:00
Loko Kung e956a04daf Suppress MaxLimitTests.MaxBufferBindingSize on Linux/Vulkan/Nvidia.
- The test was failing on the google3 TAP bots.
- Also adjusts the size so that it is the aligned min given the limit,
  not just the aligned limit since that can be larger than the limit.

Bug: dawn:1217
Change-Id: I02a68d14d61099dc5c1a2450cbaadc2320f5b8a9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110760
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Loko Kung <lokokung@google.com>
2022-11-18 00:46:38 +00:00
Jiawei Shao c2646135e1 D3D12: Allocate 2D textures with CopyDst as committed resources on Intel GPUs
This patch adds a workaround on Intel Gen9.5 and Gen11 GPUs to always
allocate 2D textures with CopyDst as committed resources instead of
placed resources to mitigate a driver bug about CreatePlacedResource().

Bug: chromium:1237175
Test: dawn_end2end_tests
Change-Id: I64ab9c083c8835fb2971660eed51252fecac416c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100641
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2022-11-17 23:03:34 +00:00
Loko Kung a88b90a69d Remove ListNode from any LinkedList in dtor.
- Issue found in LinkedListTests when running against ASAN since the
  LinkedList was being destroyed after the Nodes, thereby triggering
  a RemoveFromList on the root node, but the other nodes were never
  removed from the list and are dangling pointers.

Change-Id: I136abbc5d73c35142990c9fe4669e5fc6d5ef644
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110500
Reviewed-by: Austin Eng <enga@chromium.org>
Auto-Submit: Loko Kung <lokokung@google.com>
Commit-Queue: Loko Kung <lokokung@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-11-17 22:35:24 +00:00
James Price 9e15952e2d tint: Fix set of overrides in the shader interface
Since overrides can be used to size workgroup arrays and also as
initializers to module-scope variables, we cannot just consider
overrides that are directly referenced in the shader functions.

This change makes the Resolver track references to overrides whilst
resolving array types and module-scope variable declarations, so that
they are included in the set of overrides reported by the Inspector in
these scenarios.

Fixed: tint:1762
Change-Id: If7501abf3ddcb87a87134ddd578aa4904d204de6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110460
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>
Auto-Submit: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-11-17 22:23:46 +00:00
Brendon Tiszka e32457fa11 Revert "Add assertions to ServerInlineMemoryTransferService to catch corrupted states while fuzzing with DawnWireServerFuzzer and tests."
This reverts commit f3666c45f3.

Reason for revert: Did not realize these assertions could knowingly be reached after this fix for crbug.com/1340654

Original change's description:
> Add assertions to ServerInlineMemoryTransferService to catch corrupted states while fuzzing with DawnWireServerFuzzer and tests.
>
> Bug: chromium:1340654,chromium:1374495,chromium:1376477
> Change-Id: Icfb008a1cd6dbd8af32f3aedc90ef29e29a0465b
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/106041
> Commit-Queue: Brendon Tiszka <tiszka@chromium.org>
> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
> Reviewed-by: Austin Eng <enga@chromium.org>
> Kokoro: Kokoro <noreply+kokoro@google.com>

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: chromium:1340654,chromium:1374495
Change-Id: I5bff56e32266721ec418a545ad72c1065c73d526
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/109461
Commit-Queue: Brendon Tiszka <tiszka@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2022-11-17 22:08:23 +00:00
Ben Clayton 83cef52eb7 tint/resolver: Error when quantizeToF16 value is unrepresentable
...as a F16, for const-eval.

Fixed: tint:1744
Change-Id: I5eff05c6bc4727cbdfefb546602f3ee194d22612
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/108640
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-11-17 21:34:27 +00:00
Austin Eng f6181d0365 Change UNREACHABLE to ASSERT(false) in OnDebugUtilsCallback
In cases that a debug message does happen, we shouldn't use
unreachable as it will make the compiler use a false assumption.
Instead, only ASSERT(false) which crashes in debug, and does
nothing in release builds.

Bug: chromium:1375131
Change-Id: I7733151c241ee875ac40969ce22f037351141e89
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110600
Auto-Submit: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2022-11-17 20:54:14 +00:00
Ben Clayton c2e2013c2d tint/resolver: Fix DBZ with explicit strides of invalid arrays
Fixed: tint:1693
Change-Id: Ieafc8659daade26c5ce4fab583d3bc03d35c2a2a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110580
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-11-17 19:59:19 +00:00
Ben Clayton e412c8d8c6 Remove tint::Source::data_view
It's just a view on another field. It doesn't add anything.

Change-Id: I52c1939c455d48c067c9c31938be87671328d263
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110560
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Auto-Submit: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-11-17 19:16:24 +00:00
dan sinclair 6a4c918cbf [ir] Sketch out tree walk
This CL adds the sketch of how to walk the IR tree in order to rebuild
the format of the original control flow.

Bug: tint:1718
Change-Id: Id9376d51907ea2a60f32506a152928b3a82d14ed
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110481
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
2022-11-17 19:15:07 +00:00
dan sinclair 5fbce71eea Change some kNone to kUnknown.
Missed a couple kNone settings in the Tint executable when attempting
to determine the output format. This CL updates the to be kUnknown.

Change-Id: Ia0c4293fe69711cf1de878255bd18c6eeec4bffe
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110502
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-11-17 18:42:39 +00:00
James Price 4d65fc91bb tint: Implement pointer alias analysis
Track reads and writes to pointer parameters for each function in the
Resolver, as well as accesses to module-scope variables. At function
call sites, check the root identifiers of each pointer argument to
determine if problematic aliasing occurs.

The MSL backend passes pointers to sub-objects to functions when
handling workgroup storage variables, which triggers the alias
analysis. Add a validation override for this scenario.

Bug: tint:1675

Change-Id: I81a40d1309df65521cc5ad39764d6a09a260f51e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110167
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>
2022-11-17 17:27:27 +00:00
dan sinclair d6f9a8a253 Enable some disabled test.
This CL enables some of the @const disabled test now that the
methods are implemented.

Bug: tint:1581
Change-Id: I2cc0aa33188e439a661e2e7c265c6414881c92a0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110169
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-11-17 13:19:16 +00:00
Antonio Maiorano 46682e7e6b tint: remove redundant insertBits tests
Meant to remove this in
https://dawn-review.googlesource.com/c/dawn/+/110482

Bug: tint:1581
Bug: chromium:53440
Change-Id: I38a51873b93c2bfbf6ea20456a7992422ead6208
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110446
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-11-17 12:41:15 +00:00
Antonio Maiorano 8fbfacfd43 tint: fix insertBits edge case
If count is highest and offset is non-zero, or vice-versa, we'd overflow
the count + offset > bit-width check. This CL fixes this case.

Also folded in error tests into extractBits and insertBits.

Bug: tint:1581
Bug: chromium:53440
Change-Id: Id1e9e737b8076e8075da5992a41d18b6b7c8afd4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110482
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-11-17 00:35:49 +00:00
dan sinclair 32c28cbc90 Add const-eval for `smoothstep`
This CL adds const-eval for `smoothstep`.

Bug: tint:1581
Change-Id: I78aa5c4a39882f29ff78e37313e6c44708719095
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110176
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-11-16 23:02:39 +00:00
dan sinclair 19e5042ade Add const-eval for `round`
This CL adds const-eval for `round`.

Bug: tint:1581
Change-Id: I16ebb2010969debb8de50479235d9d9f5433c0a1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110175
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-11-16 22:52:08 +00:00
dan sinclair c214cbe98b Add a `none` format.
This CL adds a `none` format to the tint command in order to allow
skipping the emission of the resulting program. This adds a `unknown`
format to take the place of the original `none`.

Change-Id: Ib25e933857c0acb26e3cf0e04ed8a5d1cca1e633
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110480
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-11-16 22:29:12 +00:00
Antonio Maiorano 4d89ce1a68 tint/number: add Checked* overloads for f32 and f16
Also add missing unit tests for CheckedMul of floats.

Bug: tint:1581
Bug: tint:1747
Change-Id: I5d0d5d2b010803d6fd65f6feddc619cf1d071fe2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110170
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-11-16 21:51:31 +00:00
Ben Clayton 6be02b607f tint: Fix stability of intrinsic_table.inl
Use a StableSort() to ensure the output is the same between different
versions of golang.

Change-Id: Ic81688d189ce62816ba0aefddcef607b76415a5d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110361
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
2022-11-16 21:30:13 +00:00
dan sinclair 2d90dedea4 Add const-eval for `sqrt`
This CL adds const-eval for `sqrt`.

Bug: tint:1581
Change-Id: I0d109e6439feaf07edb7db4d6a50274c1c4efcae
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110174
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-11-16 21:15:49 +00:00
dan sinclair 92af2b5693 Add const-eval for `trunc`
This CL adds const-eval for `trunc`.

Bug: tint:1581
Change-Id: If58f79ea70fe490746e30ed118d847c61edd8023
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110173
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2022-11-16 20:07:31 +00:00
dan sinclair c6d46994af [ir] Add framework to dump IR to text
This CL adds the framework and `tint` option to write the IR to stdout
as text for debug purposes.

Bug: tint:1718
Change-Id: I05bd83635800fbfe3b65d968a84b30931ec1bdb6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110171
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-11-16 14:36:30 +00:00
Ben Clayton fad31fe74a dawn: fix 'control reaches end of non-void function' warning
Change-Id: I8820df29d84df9151f7992677ca7e926d14ecb08
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/107240
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2022-11-16 14:21:03 +00:00
dan sinclair acce83d109 Add const-eval for `min` and `max`
This CL adds const-eval for `min` and `max`.

Bug: tint:1581
Change-Id: Ica68ba312f21767c46d57d83570ddc72ee857231
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110166
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-11-15 18:39:38 +00:00
Jiawei Shao 6924d6e903 Remove unused function declarations
Bug: dawn:1516
Change-Id: I7a62a80f3377c3b0675520d0eb71caa18c546bfa
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110260
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2022-11-15 16:11:36 +00:00
Jiawei Shao f7e113d47e Add test to reproduce Intel driver issues with CreatePlacedResource()
This patch adds a test to dawn_end2end_tests to reproduce a driver
issue about creating textures with CreatePlacedResource() on Intel
D3D12 drivers.

Bug: chromium:1237175
Test: dawn_end2end_tests
Change-Id: I26fe6c9b827d8a05cfe2336405e43c549e52ea50
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100567
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2022-11-15 01:56:06 +00:00
David Neto 7f06aa06ac spirv-reader: support NumWorkgroups
Fixed: tint:1065
Change-Id: Id2a8af247e7da79933703e634478f1dec25f9145
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110220
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Auto-Submit: David Neto <dneto@google.com>
2022-11-15 01:32:17 +00:00
dan sinclair 267f1748c8 Remove infrastructure for fallthrough
This Cl removes the internal infrastructor and backend code
generation for the fallthrough statement.

Bug: tint:1644
Change-Id: I2a1de7d527865e5a7221074f4e0fb106599f4c57
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/109005
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-11-15 00:30:33 +00:00
dan sinclair bf586f6dfd Remove fallthrough from WGSL parser.
This CL removes the `fallthrough` parsing from the WGSL parser. The
`fallthrough` token is left so we can generate a nicer error message
in the case `fallthrough` is used.

Bug: tint:1644
Change-Id: Ifb23d78d1219cba9c64b80c9b098a248bc68e5c5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/109001
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-11-15 00:20:24 +00:00
dan sinclair d8a986beae Remove fallthrough support from SPIRV-Reader.
This CL removes support for fallthrough from the SPIRV-Reader.

Bug: tint:1644
Change-Id: I80b63d627960a82ba90de83af407c539b0442080
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/109004
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
2022-11-15 00:19:05 +00:00
David Neto 3c32758a0e spirv-reader: Support texture and sampler args to user-defined functions
Fixed: tint:1039
Change-Id: If0cb28679cc73f54025c2c142bdc32852bf4ae28
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/109820
Auto-Submit: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: David Neto <dneto@google.com>
2022-11-14 23:15:51 +00:00
Antonio Maiorano 1db8831be4 tint: fold error cases into regular case in const eval binary op unit tests
This is the same as was done for const eval builtin tests, allowing the
error cases to be defined in the same place as we define the positive
cases.

Also got rid fo the 'overflow' flag, which was used to skip abstract
cases in the unit test. Instead, I modified the tests to only add
overflow cases if not abstract.

This change will make it easier to update tests when we make Inf/NaN
failures for concrete float operations.

Bug: tint:1581
Bug: tint:1747
Change-Id: I7e5d8f9b24ca486aaa03a3b1bd07ccedb09411c9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110043
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2022-11-14 21:20:05 +00:00
David Neto 208fc35471 spirv-reader: refactor getting handle type
Rename ParserImpl::GetTypeForHandleMemObjDecl to
ParserImpl::GetHandleTypeForSpirvHandle

More importantly, it now returns the texture or sampler type rather
than the pointer type to the texture or sampler.

Most usages only wanted the store type.

Change-Id: I875e11d97e6d3ecb10fdb3317b860c05fc5fe406
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/109760
Auto-Submit: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: David Neto <dneto@google.com>
2022-11-14 21:13:30 +00:00
James Price 8cd34f8425 tint: Fix DemoteToHelper for atomicCmpXchgWeak
We cannot explicitly name the result type of this builtin, so we have
to redeclare it manually.

Fixed: oss-fuzz:53347, oss-fuzz:53343
Change-Id: I23816b8b35eb20ae91472143ab30668b573d65bf
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110160
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Auto-Submit: James Price <jrprice@google.com>
2022-11-14 20:30:38 +00:00
Li Hao fbd00b44ee Fix non-inclusive language in toggle name
Use 'Mock' instead of non-inclusive language 'Dummy' in toggle
MetalUseDummyBlitEncoderForWriteTimestamp to pass PRESUBMIT.py check.

Bug: dawn:1250
Change-Id: I47dff4adec08d4d076b5ae5b4e0a521b235d5868
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110060
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2022-11-14 16:57:22 +00:00
Ben Clayton 10fae7ac79 tint: Rename `frexp().sig` to `frexp().fract`
Fixed: tint:1757
Change-Id: Iacce6ab0f08f89abbe5831e6f2285a0c964e74d7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110100
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
2022-11-14 15:29:29 +00:00
Ben Clayton 1ef277db0e tint: Skip e2e test validation for known-good
Cache the hash of the test output, and only re-validate if the output changes.
This speeds up incremental end-to-end testing.

Change-Id: I44bc1eff62320df1e80524e8481d1c012fb67f42
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/109761
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
2022-11-14 13:58:36 +00:00
Wang Qing 09dd5635e4 loongarch: Fix ASSERT() breakpoint support.
Bug: dawn:1506
Change-Id: I79aa5fe75477280570bfced0ee60aac5c18fab6f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/109900
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-11-14 13:07:30 +00:00
Ben Clayton c33d10ae79 tint/resolver: Fix bad pointer deref (UAF)
Passing a dereferenced value from Hashmap::Find() directly into Hashmap::Add() is a potential cause of UAF, as the insertion may reallocate the map, invalidating the input reference.

I'll try to think of ways to make this foot-gun harder to do, but this CL fixes the immediate bug found by fuzzers.

Bug: chromium:1383755
Change-Id: I4f8b2fcb0745b008a47ef9947c330afb9ac4e78f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110020
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-11-13 18:26:25 +00:00
Antonio Maiorano 7338848589 dawn: ouput DXBC literals as hex when dump_shaders is enabled
The DXBC asm listing attempts to be helpful when display literals by
making them human readable,but when it displays values as floats, they
will only have a precision of 6.

For example, 0x09909909 ends up getting displayed as 0.000000 because as
a float, this value is 3.48106525683e-33. FXC has an option to output
literals as hex values, so let's use that.

Change-Id: I2b3017bd834eac89248fe01cae85ba1bb4033e59
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/109582
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2022-11-11 19:33:31 +00:00
Ryan Harrison 4e0eac148d Manual Roll third_party/vulkan-deps/ a7a3fb393..c29c532c9 (71 commits)
https://chromium.googlesource.com/vulkan-deps/+log/a7a3fb39310c..c29c532c92db

$ git log a7a3fb393..c29c532c9 --date=short --no-merges --format='%ad %ae %s'
2022-11-10 chromium-autoroll Roll Vulkan-ValidationLayers from 096b2903118c to f276f028ee79 (1 revision)
2022-11-10 chromium-autoroll Roll Vulkan-ValidationLayers from 45b81b398ab4 to 096b2903118c (2 revisions)
2022-11-10 chromium-autoroll Roll Vulkan-ValidationLayers from 983b408199f2 to 45b81b398ab4 (3 revisions)
2022-11-10 chromium-autoroll Roll Vulkan-Headers from f97f29836cb9 to 29c0457cc167 (1 revision)
2022-11-10 chromium-autoroll Roll Vulkan-Tools from e8234991418c to 3a729c0a9d58 (1 revision)
2022-11-10 chromium-autoroll Roll SPIRV-Tools from aae7d4132571 to 68e8327f2932 (2 revisions)
2022-11-10 chromium-autoroll Roll Vulkan-Loader from 1b40be299b02 to 0df63661a5fa (1 revision)
2022-11-10 chromium-autoroll Roll Vulkan-ValidationLayers from e7380d60c9a6 to 983b408199f2 (8 revisions)
2022-11-10 chromium-autoroll Roll Vulkan-Headers from 689821914113 to f97f29836cb9 (1 revision)
2022-11-10 chromium-autoroll Roll Vulkan-ValidationLayers from afd4e9d82d92 to e7380d60c9a6 (3 revisions)
2022-11-10 chromium-autoroll Roll Vulkan-ValidationLayers from fc9da6832a2b to afd4e9d82d92 (1 revision)
2022-11-10 chromium-autoroll Roll Vulkan-ValidationLayers from 1059ee93ebff to fc9da6832a2b (1 revision)
2022-11-10 chromium-autoroll Roll Vulkan-ValidationLayers from 065b8cbc41cb to 1059ee93ebff (1 revision)
2022-11-09 chromium-autoroll Roll Vulkan-Loader from 7e61110364b4 to 1b40be299b02 (2 revisions)
2022-11-09 chromium-autoroll Roll SPIRV-Tools from 525bc38062ab to aae7d4132571 (1 revision)
2022-11-09 chromium-autoroll Roll Vulkan-Loader from 5b054b4333fd to 7e61110364b4 (1 revision)
2022-11-09 chromium-autoroll Roll Vulkan-ValidationLayers from f162411346bb to 065b8cbc41cb (1 revision)
2022-11-09 chromium-autoroll Roll Vulkan-Tools from 6e5bd86b76c0 to e8234991418c (1 revision)
2022-11-09 chromium-autoroll Roll Vulkan-ValidationLayers from 8a253a6c5b7a to f162411346bb (1 revision)
2022-11-09 chromium-autoroll Roll Vulkan-ValidationLayers from e09172e79c0b to 8a253a6c5b7a (1 revision)
2022-11-08 chromium-autoroll Roll Vulkan-Loader from 6442b72aea02 to 5b054b4333fd (1 revision)
2022-11-08 chromium-autoroll Roll glslang from f4cba22d0824 to 2b2523fb951f (1 revision)
2022-11-08 chromium-autoroll Roll Vulkan-ValidationLayers from 212ea587c100 to e09172e79c0b (1 revision)
2022-11-08 chromium-autoroll Roll Vulkan-Headers from ef96d229cb3d to 689821914113 (1 revision)
2022-11-08 chromium-autoroll Roll SPIRV-Tools from 54d4e77fa559 to 525bc38062ab (1 revision)
2022-11-08 chromium-autoroll Roll glslang from 5e08deae050c to f4cba22d0824 (1 revision)
2022-11-08 chromium-autoroll Roll Vulkan-Headers from 1661f3e962f5 to ef96d229cb3d (3 revisions)
2022-11-08 chromium-autoroll Roll Vulkan-ValidationLayers from 2dbf684715c2 to 212ea587c100 (2 revisions)
2022-11-08 chromium-autoroll Roll SPIRV-Tools from a5e766b2b47c to 54d4e77fa559 (1 revision)
2022-11-08 chromium-autoroll Roll Vulkan-ValidationLayers from bcf3a2bd93f2 to 2dbf684715c2 (1 revision)
2022-11-08 chromium-autoroll Roll SPIRV-Cross from abc31207bffb to edd66a2fc9e9 (1 revision)
2022-11-08 chromium-autoroll Roll Vulkan-ValidationLayers from 8382dbcaeb7c to bcf3a2bd93f2 (3 revisions)
2022-11-08 chromium-autoroll Roll Vulkan-ValidationLayers from b5cbd4242593 to 8382dbcaeb7c (2 revisions)
2022-11-08 chromium-autoroll Roll Vulkan-Headers from 91388ba10409 to 1661f3e962f5 (1 revision)
2022-11-07 chromium-autoroll Roll Vulkan-Loader from 6b0551428e57 to 6442b72aea02 (1 revision)
2022-11-07 chromium-autoroll Roll Vulkan-ValidationLayers from 2632b3362f77 to b5cbd4242593 (1 revision)
2022-11-07 chromium-autoroll Roll Vulkan-ValidationLayers from 8a1cdac2bde1 to 2632b3362f77 (1 revision)
2022-11-07 chromium-autoroll Roll Vulkan-ValidationLayers from 94c32cc2541c to 8a1cdac2bde1 (1 revision)
2022-11-07 chromium-autoroll Roll Vulkan-Loader from 8ff839bda370 to 6b0551428e57 (1 revision)
2022-11-07 chromium-autoroll Roll Vulkan-Headers from 52b7c620a540 to 91388ba10409 (1 revision)
2022-11-07 chromium-autoroll Roll Vulkan-ValidationLayers from 62eb78a06365 to 94c32cc2541c (1 revision)
2022-11-07 chromium-autoroll Roll Vulkan-ValidationLayers from 8debb3bd2948 to 62eb78a06365 (2 revisions)
2022-11-07 chromium-autoroll Roll SPIRV-Tools from d35a78db57e6 to a5e766b2b47c (1 revision)
2022-11-05 chromium-autoroll Roll Vulkan-ValidationLayers from 226b595aeec0 to 8debb3bd2948 (1 revision)
2022-11-04 chromium-autoroll Roll Vulkan-Loader from 256a5e3b6d6f to 8ff839bda370 (1 revision)
2022-11-04 chromium-autoroll Roll SPIRV-Tools from c8e1588cfa3f to d35a78db57e6 (1 revision)
2022-11-04 chromium-autoroll Roll Vulkan-ValidationLayers from 37e77914ef0d to 226b595aeec0 (7 revisions)
2022-11-04 chromium-autoroll Roll SPIRV-Headers from 747031e10dea to 47f2465ee3e7 (1 revision)
2022-11-04 chromium-autoroll Roll Vulkan-Loader from 1bc3a2fa8ec1 to 256a5e3b6d6f (8 revisions)
2022-11-04 chromium-autoroll Roll Vulkan-ValidationLayers from a566d5b79346 to 37e77914ef0d (2 revisions)
2022-11-04 chromium-autoroll Roll Vulkan-Loader from 374dbe9df7bd to 1bc3a2fa8ec1 (1 revision)
2022-11-04 chromium-autoroll Roll Vulkan-Headers from ff03306bf986 to 52b7c620a540 (1 revision)
2022-11-04 chromium-autoroll Roll Vulkan-ValidationLayers from e108987ee76c to a566d5b79346 (1 revision)
2022-11-04 chromium-autoroll Roll Vulkan-ValidationLayers from 9a31edfa80d5 to e108987ee76c (7 revisions)
2022-11-04 chromium-autoroll Roll Vulkan-Headers from d4c221772cb2 to ff03306bf986 (1 revision)
2022-11-04 chromium-autoroll Roll Vulkan-ValidationLayers from a38db2b8b172 to 9a31edfa80d5 (1 revision)
2022-11-04 chromium-autoroll Roll Vulkan-ValidationLayers from d5bc5ca269e5 to a38db2b8b172 (1 revision)
2022-11-03 chromium-autoroll Roll glslang from 8da649505887 to 5e08deae050c (1 revision)
2022-11-03 chromium-autoroll Roll Vulkan-Tools from 0bb32875d2e6 to 6e5bd86b76c0 (1 revision)
2022-11-03 chromium-autoroll Roll Vulkan-Loader from da810336e761 to 374dbe9df7bd (1 revision)
2022-11-03 chromium-autoroll Roll SPIRV-Headers from 85a1ed200d50 to 747031e10dea (1 revision)
2022-11-03 chromium-autoroll Roll Vulkan-ValidationLayers from 823f8beb4f70 to d5bc5ca269e5 (2 revisions)
2022-11-03 chromium-autoroll Roll Vulkan-Headers from e12a8f8cde40 to d4c221772cb2 (1 revision)
2022-11-03 chromium-autoroll Roll Vulkan-ValidationLayers from 6d377701f393 to 823f8beb4f70 (1 revision)
2022-11-03 chromium-autoroll Roll Vulkan-Loader from 4f4b32cf7545 to da810336e761 (1 revision)
2022-11-02 chromium-autoroll Roll Vulkan-ValidationLayers from 18a0e59294d1 to 6d377701f393 (2 revisions)
2022-11-02 chromium-autoroll Roll Vulkan-Tools from 292e6ed02141 to 0bb32875d2e6 (1 revision)
2022-11-02 chromium-autoroll Roll Vulkan-Loader from 3f29209dd65d to 4f4b32cf7545 (1 revision)
2022-11-02 chromium-autoroll Roll SPIRV-Tools from a52de681dd17 to c8e1588cfa3f (1 revision)
2022-11-02 chromium-autoroll Roll glslang from 1a8869e4d1be to 8da649505887 (1 revision)
2022-11-02 chromium-autoroll Roll SPIRV-Cross from 744279ec78ff to abc31207bffb (1 revision)

Created with:
  roll-dep third_party/vulkan-deps

Change-Id: I24e8219f2226c6ee76a44bc00bb17b30b7a50d32
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/109740
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2022-11-10 22:21:16 +00:00
David Neto 183b8eb19c spirv-reader: func decl with handle or ptr-to-handle
Support function declarations where formal parameters
are textures, samplers, or pointers to them.

Still need to update call sites.

Bug: tint:1039

Change-Id: I5bb3ca73190b2e27c28205e78aa433108efec252
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/109540
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-11-10 20:52:31 +00:00
dan sinclair b77332edd2 Add const-eval for `tan` and `tanh`
This CL adds const-eval for `tan` and `tanh`.

Bug: tint:1581
Change-Id: I3d3506a6e7462bba1557cb88065d696ddc21b0f6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/109562
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-11-10 15:55:00 +00:00
dan sinclair 02d4ea06b9 Add const-eval for `cos` and `cosh`
This CL adds const-eval for `cos` and `cosh`.

Bug: tint:1581
Change-Id: I8df8f979a7b351288cadccda88940fdb5a20d18f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/109561
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2022-11-10 15:52:41 +00:00
dan sinclair b7868ff3ee Add const-eval for `sin` and `sinh`
This CL adds const-eval for `sin` and `sinh`.

Bug: tint:1581
Change-Id: I96345378c826e2c49ffae688b5185764019967d5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/109560
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-11-10 14:20:36 +00:00
dan sinclair e2fd5e09c6 Implement const-eval for `acosh`
This CL adds const-eval for the `acosh` test case. The generation of
`f16` values into test files is also fixed because `acosh` requires the
value to be `>= 1.0`

Bug: tint:1581
Change-Id: Iba2ca4d9d114034845475679346f042c8c66e571
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/109341
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-11-10 02:39:08 +00:00
Ben Clayton 46ee63933c tint/transform: Implement div / mod polyfill
Prevents UB for divide-by-zero and integer overflow when dividing

Fixed: tint:1349
Change-Id: Ieef66d27d7aec3011628ced076b2bccc7770a8af
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/108925
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-11-09 22:04:11 +00:00
Ben Clayton 9418152d08 tint/resolver: Move from STL to tint::utils containers
Change-Id: I883168a1a84457138de85decb921c5c430c32bd8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/108702
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-11-09 20:55:33 +00:00
Ben Clayton 55a8eace75 tint/resolver: Forbid workgroup pointer parameters
Fixed: tint:1721
Change-Id: I80a2cfc753f928facc165e1c8cd8c5af6c497550
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/108701
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Auto-Submit: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-11-09 20:11:43 +00:00
dan sinclair 5ac2a365d9 Add const-eval for pack and unpack of 2x16float.
This CL adds const-eval for pack and unpack of 2x16 float values.

Bug: tint:1581
Change-Id: I59a1925148124e628c3771ca96d309fad045f27d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/109280
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-11-09 20:04:37 +00:00
dan sinclair 00d0fd5e84 Update f16 to have from_bits
This CL adds a `from_bits` method to the f16 number to allow converting
a uint16_t representation to a f16.

Bug: tint:1581
Change-Id: I80882e74a88411963f0e30423a72cfca40370af1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/109201
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: dan sinclair <dsinclair@google.com>
2022-11-09 20:03:09 +00:00
James Price 744d0eb4aa tint: Use "demote-to-helper" semantics for discard
Discard statements no longer affect the behavior or uniformity
analysis. Update the resolver, validator, and several tests to reflect
this.

Some E2E tests were removed as they had loops that are now considered
to be infinite.

Use the DemoteToHelper transform to emulate the correct semantics on
platforms where discard is (or may) terminate the invocation in a
manner that would affect derivative operations.

We no longer need the UnwindDiscardFunctions transform for HLSL, which
already implements the correct semantics. However, we still run the
DemoteToHelper transform for the HLSL backend due to issues with FXC's
handling of discard statements (see crbug.com/tint/1118).

Fixed: tint:1723
Change-Id: Ib49ff187919ae81c4af8675e1b66acd57e2ff7d2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/109003
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
2022-11-09 19:58:59 +00:00
James Price 78ae4c243b tint: Fix phony assignments in DemoteToHelper
We just need to skip these.

Bug: tint:1723
Change-Id: I311fe0432ecf1f69936eaf08eb57123a6a738175
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/109340
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>
2022-11-09 18:27:12 +00:00
James Price 97519c2cd3 tint: Allow captured pointers as function args
The updated WGSL validation rule now requires that the memory view of
the argument matches its root identifier.

This allows for code like this:
   let p = &v;
   foo(p);

Fixed: tint:1754, tint:1734
Change-Id: I3239ec84e1c06398a6ce5bebb1e0b28986764bc6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/109221
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
2022-11-09 16:47:19 +00:00
James Price 6251598ad2 tint: Add DemoteToHelper transform
This transform implements demote-to-helper semantics for discard
statements, by setting a global flag and masking any writes to
host-visible memory.

Bug: tint:1723
Change-Id: I619c5661c6ffcc6978aa4f7635b0d680d83de3dd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/109002
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>
2022-11-09 15:40:06 +00:00
James Price a7cd3aeff0 tint: Rename SourceVariable() to RootIdentifier()
This is now a well-defined term in the WGSL spec, so we should use it.

Change-Id: Icc46a77f0a465afbfd39cdaec84e506b143c8c0c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/109220
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Auto-Submit: James Price <jrprice@google.com>
2022-11-09 12:16:56 +00:00
Zhaoming Jiang 4f3f45c00f Tint/transform: Fix insertBits polyfill for HLSL
This CL fix insertBits polyfill to handle with the left-shifting
behavior in HLSL, i.e. `(1u << 32u) == (1u << 0u) == 1u` where we want
the result to be `0u`.

Fixed: tint:1743
Change-Id: Ibb82abe4ab2f76dbb0fa06057fb19f15f961d969
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/108166
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-11-09 01:54:08 +00:00
Antonio Maiorano e4270d111b Fix dawn_native MSVC x86 build
Bug: dawn:1590
Change-Id: I4559a664fde1ee0ebcf7eae44a752d1977a63e24
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/109200
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-11-08 23:24:52 +00:00
Antonio Maiorano a70e365313 tint: fix extractBits edge case
If count is highest and offset is non-zero, or vice-versa, we'd overflow
the count + offset > bit-width check. This CL fixes this case.

Bug: tint:1581
Bug: chromium:1381810
Change-Id: I6ee60ec1a13230fca6f4bb6407cd33bcc6730eb7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/109162
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-11-08 18:27:08 +00:00
Jiawei Shao e052683e3f Remove two unused function declarations in wire::client::Device
Bug: dawn:1586
Change-Id: Ic3a7bdedc62ff6765a559f94a7ad379741687fed
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/109080
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-11-08 15:11:31 +00:00
Antonio Maiorano c36417343f tint: const eval of cross
Bug: tint:1581
Change-Id: I63ebb7de3a7d719f2c149715295492f561311579
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/108544
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-11-08 11:42:07 +00:00
David Neto eb949c87ee spirv-reader: use spirv.hpp11
In preparation for SPIRV-Tools change where its internals
use the C++11 headers.

This patch works with SPIRV-Tools using the old C header
and using the C++11 header.

This patch includes some complex machinery inside "three_sided_patch"
namespaces that can be removed after third_party/vulkan-deps/spirv-tools has
fully transitioned into using the C++11 headers.

Change-Id: I36f358fe3edcc5e613625708017fb8d7919c40c6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/108780
Reviewed-by: Alan Baker <alanbaker@google.com>
Commit-Queue: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-11-08 00:17:56 +00:00
dan sinclair 1bdaded736 Implemement const-eval for some unpack routines.
This CL adds const-eval for unpack2x16snorm, unpack2x16unorm,
unpack4x8snorm and unpack4x8unorm.

Bug: tint:1581
Change-Id: Ieda938b797dfe3f8d8046101d12b99da69ad68f4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/108864
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2022-11-07 22:28:01 +00:00
dan sinclair ec4b650adb Remove fallthrough from fuzzer AST mutation.
This CL removes the logic to handle fallthrough in the AST fuzzer.

Bug: tint:1644
Change-Id: Ie636e2377bed8acfd7a644d2af6827efaf37a60e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/109000
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-11-07 20:56:04 +00:00
Ben Clayton ba200e87c5 tint: Bump stack size for MSVC + debug build
Bug: tint:1749
Change-Id: Ic7a87a769ade9c459914ac745b449b4383812753
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/108923
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
2022-11-07 17:24:10 +00:00
dan sinclair 5071a54af4 Make reserved words an error.
This CL moves reserved words from a deprecation to an error.

Bug: tint:1463
Change-Id: I5c66baa15dc748215877c8152171c690495bc0c2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/108861
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-11-07 16:15:55 +00:00
dan sinclair 2d706a0436 Implemement const-eval for some pack routines.
This CL adds const-eval for pack2x16snorm, pack2x16unorm,
pack4x8snorm and pack4x8unorm.

Bug: tint:1581
Change-Id: I58d8f02da32a6a173ca54ee5110ca7be39e2c52f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/108466
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-11-07 14:32:16 +00:00
dan sinclair 3b2b5484e2 Remove module-scope let deprecation.
This CL moves module-scope let from a deprecation to an error.

Change-Id: Iffecbb667cf79515234b6510ce7c5bbbb6e673bc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/108862
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-11-07 14:20:33 +00:00
Antonio Maiorano c027f33cfd tint: Fix gdb and lldb pretty printers for recently updated Hashset and Hashmap
Change-Id: If9aae44b6e58d3ba3be3463306f626ce8c23d4d0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/108723
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Reviewed-by: Ben Clayton <bclayton@chromium.org>
2022-11-07 14:00:53 +00:00
Ben Clayton ca98b1b1b9 tint/resolver: Resolve dependencies of parameter attributes
Fixed: chromium:1381883
Change-Id: If93840977407e349ab8d3ea5a2f51b9e03c7d0e5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/108920
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-11-07 13:15:21 +00:00
dan sinclair 6f799d676d Change default acos test value.
This Cl changes the default acos test value so it equals `cos(.25)`
instead of `cos(.5)`. The `.5` result was slightly different on
various machines.

Bug: tint:1581
Change-Id: I768141ae87a63b2c35ec4d61eb030edad77e11e4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/108863
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2022-11-07 12:06:18 +00:00
dan sinclair f218af0461 Remove the `@stage` attribute
This CL removes the `@stage` attribute.

Bug: tint:1503
Change-Id: I1e31e96056a053f0c1e92b4bfc3c63c3592e9765
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/108860
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-11-07 11:34:34 +00:00
Austin Eng 270c044100 Metal: Implement begin/end access synchronization with MTLSharedEvent
Bug: b/252731382
Change-Id: Ie2bf978c10dcb7b2c03a2c7ff81ddd8b9b77ac20
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/106760
Reviewed-by: Shrek Shao <shrekshao@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2022-11-04 22:06:20 +00:00
Ben Clayton b6903295a8 tint/resolver: Support error cases with const-eval builtin tests
Also:

Print unrepresentable numbers with higher precision - otherwise values can round, and diagnostics can be very confusing.
Improve diagnostic distinction between `( )` `[ ]` interval ranges.

Change-Id: I9269fbf1738f0bce5f2ddb5a387687543fd5d0bb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/108700
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2022-11-04 19:18:55 +00:00
Austin Eng dc819c939b dawn::wire validate that the generation must be strictly increasing
Bug: chromium:1379634
Change-Id: Iaa067a30ac5992adfb5aac168104163a62f8bf9c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/108549
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Jie A Chen <jie.a.chen@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-11-04 15:29:23 +00:00
Antonio Maiorano 6fcc4f3a54 tint: const eval of reverseBits
Bug: tint:1581
Change-Id: I3dd1ea2c774f9fc0dff87b71f25375a469c3d05e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/108300
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-11-04 13:48:26 +00:00
Li Hao 23a35c8a26 Add more tests in white_box/D3D12GPUTimestampCalibrationTests.cpp
Add more coverage for timestamp query on D3D12 backend to make sure
timestamps are converted correctly:
- All timestamp queries inside and outside passes
- The 'disable_timestamp_query_conversion' toggle disabled and enabled

Bug: dawn:1250

Change-Id: Ibdc6b35faed7cc1e1a8b60df4a5032914b411bc1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/108022
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Hao Li <hao.x.li@intel.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-11-04 08:43:57 +00:00
Loko Kung a4314fabb4 Minor build/include fixes for google3 roll.
Change-Id: I2f9ba7f98acdf9441d80d3a1169b36bee44a2e0e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/108545
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Loko Kung <lokokung@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2022-11-04 01:44:43 +00:00
Takahiro e8cd0beb74 GPUBuffer.unmap() shouldn't validate buffer state
WebGPU specification was updated that GPUBuffer.unmap()
shouldn't validate buffer state.

https://github.com/gpuweb/gpuweb/pull/3368

This commit reflects it to the Dawn implementation.

Bug: dawn:1528
Change-Id: Ie66f68214bd6896a4d674ed00addc3ffb539c235
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/106264
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Takahiro <hogehoge@gachapin.jp>
2022-11-04 00:08:27 +00:00
dan sinclair 16b4cf87d0 Template cmake for generated files.
This CL adds a cmake function to make it easier to integrate
files generated from the intrinsics file.

Change-Id: If2a593fad9703075ea91a29f72d482b34cc9dc1d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/108462
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-11-03 21:10:40 +00:00
dan sinclair 6590cc4fd9 Add missing benchmark test.
There is a benchmark test for builtin_value which was not added
into the benchmark code. This cl adds the missing test.

Change-Id: I6fc0eee0a50cad31f516024125be11e434df0ac0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/108461
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-11-03 19:37:49 +00:00
Ben Clayton 8fa6c25b78 tint: Add Initialize() / Shutdown() public APIs
Have Initialize() bind the Program printer - which is helpful for debugging.
Call these from dawn/node.

This allows dawn/node to print programs when things go wrong.

Change-Id: I32d8805381d2939e82dc6ea383b9860fbb5fb69e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/107684
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2022-11-03 19:16:26 +00:00
Ben Clayton 02f04d914d tint/transform: Polyfill bit-shift with RHS modulo
Fixed: tint:1453
Fixed: tint:1543
Change-Id: Idb5af752d7a3bb9e181cc47430ad4ddfb707873d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/108440
Auto-Submit: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
2022-11-03 19:15:17 +00:00
dan sinclair 91e27f25f9 Add const-eval for `floor`.
This Cl adds const-eval for the `floor` builtin.

Bug: tint:1581
Change-Id: I992eba3aa6c66707e923907a4bb912c2f6f8d290
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/108343
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2022-11-03 17:10:49 +00:00
dan sinclair 11cecc1e4f Revert "Add CMake build option to generate intrinsic files."
This reverts commit c22b8b9dc8.

Reason for revert: Cost not worth benefit.

Original change's description:
> Add CMake build option to generate intrinsic files.
>
> This Cl adds an option to cmake to generate the intrinsic files
> as part of the buid.
>
> Change-Id: I785fbaa57b6d3b3ecd16e36b2f2baaa5da3cc9d9
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/108000
> Kokoro: Kokoro <noreply+kokoro@google.com>
> Reviewed-by: Ben Clayton <bclayton@chromium.org>
> Commit-Queue: Dan Sinclair <dsinclair@chromium.org>

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: Idc57ea21d9d9152703e0a6d99fa518e8da079092
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/108460
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2022-11-03 16:28:51 +00:00
dan sinclair abd6a7d9d4 Add const-eval for `ceil`
This CL adds const-eval for the `ceil` builtin

Bug: tint:1581
Change-Id: I32957d17000df1a8a59ce37f49b6177d1087406c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/108342
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-11-03 15:59:23 +00:00
Dan Sinclair 465df13196 Revert "This CL updates the cmake files to use go run directly."
This reverts commit a950d4539e.

Reason for revert: Ran into issues integrating into all the required build environments.

Original change's description:
> This CL updates the cmake files to use go run directly.
>
> Instead of using the tools/run script this CL updates CMake
> to directly invoke go run. This should work around issues
> with multiple writers of the gen binary and fixup windows issues.
>
> Change-Id: Ie27f45a1d132e9ec100cad709bb92da8558b4fb3
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/108045
> Reviewed-by: Ben Clayton <bclayton@google.com>
> Kokoro: Kokoro <noreply+kokoro@google.com>
> Commit-Queue: Dan Sinclair <dsinclair@chromium.org>

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

Change-Id: I10e7796d4f11661f2055c08202c84e56355ec397
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/108420
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-11-03 15:09:03 +00:00
dan sinclair 9cbc7e1e54 Implement const-eval for `acos`
This CL adds const-eval for the `acos` builtin.

Bug: tint:1581
Change-Id: I01c0f48e73eedf87cf9c912715487f8eea44f64e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/108341
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-11-03 14:49:23 +00:00
dan sinclair b3518d8b4d Implement const eval of `abs`
This CL adds const-eval for the `abs` builtin.

Bug: tint:1581
Change-Id: I6ee25c07620990f72a6962441aec62ae7665653e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/108340
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-11-03 14:47:18 +00:00
Dan Sinclair 5ae03c266a Revert "Scaffolding for generation of intrinsics files."
This reverts commit 6c5db2afa6.

Reason for revert: Ran into issues integrating into all the required build environments.

Original change's description:
> Scaffolding for generation of intrinsics files.
>
> This CL sets up the basis for the intrinsic file generation. All of
> the GN and CMake pieces are setup, but they aren't hooked into the
> main build yet. That will be a followup which just enables the
> generation in order to allow easy reverting.
>
> Change-Id: Iccac59377076ed6ac66eeaf0be965be2f49bc738
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/107981
> Kokoro: Kokoro <noreply+kokoro@google.com>
> Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
> Reviewed-by: Ben Clayton <bclayton@google.com>
> Reviewed-by: Ryan Harrison <rharrison@chromium.org>

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: If289cd2769faea6466bcae68c3c58cf416b3567a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/108421
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-11-03 14:25:37 +00:00
Antonio Maiorano 11f0c52bfb tint: const eval of extractBits
Bug: tint:1581
Change-Id: I56e9b7de9aef803eaf6304c122f40e5a0c4dce67
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/108203
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-11-03 13:03:08 +00:00
dan sinclair 58eca19f33 Add const-eval for `all`.
This CL adds const-eval for the `all` builtin.

Bug: tint:1581
Change-Id: Ib1d857ba24114c61e1a90b30dd66d063edfa136d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/107464
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-11-03 12:07:49 +00:00
Ben Clayton aa4b64f4c8 tint/utils: Optimise HashmapBase::Scan()
Avoid an integer modulo for each scan iteration.

Change-Id: Ie80af4620b39769db622b4ab175b5639cf9ade8e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/108260
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
2022-11-03 11:44:15 +00:00
jchen10 61d6d21091 Byte counting WriteBuffer/Texture to submit
Only tag to submit when the total size is larger than the threshold,
so that we can make as few submits as possible meanwhile avoiding OOM.

Bug: chromium:1258986
Change-Id: I7190e1bb942bfaffc5cd424ce4743173735b25e3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/106418
Reviewed-by: Corentin Wallez <cwallez@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>
2022-11-03 09:58:59 +00:00
Yan,Shaobo e8dd681f19 Provide origin info for ExternalTexture
Current ExternalTexture visible related info only contains width and height.

But not all the visible rect started at (0, 0). This CL add visibleOrigin to contain origin info and record (width, height) in
visibleSize

Bug: chromium:1361363
Change-Id: I3d8931e490c97740f152653383f07d0a2d984dd3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/108024
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Shaobo Yan <shaobo.yan@intel.com>
2022-11-03 09:03:01 +00:00
Ben Clayton c6b381495d tint/transform: Refactor transforms
Replace the ShouldRun() method with Apply() which will do the
transformation if it needs to be done, otherwise returns
'SkipTransform'.

This reduces a bunch of duplicated scanning between the old ShouldRun()
and Transform().

This change also adjusts code style to make the transforms more
consistent.

Change-Id: I9a6b10cb8b4ed62676b12ef30fb7764d363386c6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/107681
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
2022-11-03 08:41:19 +00:00
Antonio Maiorano 336f3536e5 tint: const eval of insertBits
Bug: tint:1581
Change-Id: Id89530eb90d3c75bd1f99dd67a78cad1c923c6f0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/107924
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-11-02 20:40:23 +00:00
Ben Clayton e372511e1b tint/utils: Rework Hashmap / Hashset
Previously Hashmap used to internally use a Hashset which held entries
of key-value pairs. This was cute, but meant that a Hashset held mutable
entries, which was a bag-of-bugs waiting to happen (change the entry to
hash as something different and you're now in an entirely broken state).

Pull the complex bits of Hashset out to HashmapBase, and have both
derive from that. I've opted for inheritance over composition here to
reduce the amount of structure chasing you'd have to do without
debugger pretty-printers.

Change-Id: I99e72244b69206a994edabfefd0e28d5d74d08d9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/108240
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2022-11-02 19:46:49 +00:00
Ben Clayton 9535f72209 tint/validator: Hint 'var' instead of 'const'
Involves expanding the source range of a variable declaration so we can point at something that can include the 'const'.

Fixed: tint:1740
Change-Id: Ie8f784de34a1792002aaa708c1b77053be54f1b5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/108120
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-11-02 18:14:59 +00:00
James Price fd9c3fe4bc tint/uniforimty: Remove short-circuit special-case
Now that expressions can only ever have the `Next` behavior,
short-circuiting operators will always reconverge.

Change-Id: Ib9fe4c774191b8a304fa7f7a6eafdfa6c6e6f18a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/108202
Kokoro: Kokoro <noreply+kokoro@google.com>
Auto-Submit: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>
2022-11-02 18:01:31 +00:00
Ben Clayton c81f9dce07 tint: Implement const-eval of quantizeToF16
Bug: tint:1581
Change-Id: I5cf9806bde7875282d3b67731dbb88666523f598
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/108142
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>
2022-11-02 17:29:48 +00:00
Dan Sinclair 749abeaafb Revert "Add GN build option to build using generated files."
This reverts commit 7cd8db1155.

Reason for revert: Breaking the Skia roll.

Original change's description:
> Add GN build option to build using generated files.
>
> This CL hooks the generated files into the GN build
> behind a `tint_build_use_generator` flag.
>
> Change-Id: I4926b2c9c1a349f26be8a1f8a4508e1e31dab813
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/108041
> Kokoro: Kokoro <noreply+kokoro@google.com>
> Reviewed-by: Ben Clayton <bclayton@chromium.org>
> Commit-Queue: Dan Sinclair <dsinclair@chromium.org>

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

Change-Id: I3b920791bc2b6d22d9cbeb1310a2e89fbd1e8cd1
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/108205
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
2022-11-02 17:07:25 +00:00
dan sinclair a950d4539e This CL updates the cmake files to use go run directly.
Instead of using the tools/run script this CL updates CMake
to directly invoke go run. This should work around issues
with multiple writers of the gen binary and fixup windows issues.

Change-Id: Ie27f45a1d132e9ec100cad709bb92da8558b4fb3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/108045
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-11-02 14:53:57 +00:00
Ben Clayton bdd5bbe0c5 tint/transform/utils: HoistToDeclBefore polish
A new HoistToDeclBefore::InsertBefore() overload that takes a statement
builder. Required for supporting multiple clones.

Remove Apply() - it was API smell that wasn't needed.

Spring-clean the implementation

Change-Id: If448d2e1945ad6d988d1bdb30487d89efced2f0e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/104043
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-11-02 13:45:49 +00:00
Ben Clayton 2d63e321fd tint: Add callback overloads to CloneContext::Insert*
Change-Id: I2fc0b93d3ea3ba0d9d64fe575364f188db564b8a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/104041
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2022-11-02 13:40:41 +00:00
Ben Clayton b5c213b995 tint/resolver: Fix failures with no error
Invalid values to @binding(), @group() and @location() would fail resolving without an error diagnostic. This later triggers and ICE.

Refactor duplicate @location resolving in 4 places to a single method.

Canonicalize the diagnostic messages for attributes.

Remove a bunch of TODOs

Bug: chromium:1380212
Bug: tint:1633
Change-Id: Id2cc6ba4b807f12f350a2a31ef87fa0f185b64c3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/108144
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
2022-11-02 07:49:23 +00:00
Zhaoming Jiang 6ab5d3c151 Tint/transform: make AddBlockAttribute always do wrapping if possible
This CL make transform AddBlockAttribute always try to wrap types used
by buffer variables into a struct, in order to generate valid GLSL code
for assigning one buffer struct variable to another buffer struct
variable.

Fixed: tint:1735
Change-Id: I009d8a9ca7ecea1dc0ad6164275c964a18acb33f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/108023
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
2022-11-02 02:25:38 +00:00
Ben Clayton 2bea9055f4 tint: Implement runtime quantizeToF16()
Fixed: tint:991
Fixed: tint:1741
Change-Id: I55dbabce6d28adf5abb710dc1e3e879c5aaa6be5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/108140
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-11-02 00:09:50 +00:00
James Price 35da054624 tint/cmake: Fix test source paths
Change-Id: I69aec703de0ab96175b5ea79f3d0ae4f5ccb9227
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/108201
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
Auto-Submit: James Price <jrprice@google.com>
2022-11-01 21:51:14 +00:00