Commit Graph

7228 Commits

Author SHA1 Message Date
Corentin Wallez 03199c2b44 Protect against aspectReadOnly of unused DS attachements aspects
Unused aspects of depth-stencil attachments that are tagged as read-only
used to leak that read-only state to backends, even if the validation
made it seems like they always match (they only need to match if the
texture has both aspects). This confused backends like Vulkan which
checked for depthReadOnly || stencilReadOnly to choose between code
paths.

Instead reyify the depthStencilAttachement descriptor in the frontend to
protect against garbage values being passed for aspects that aren't
present in the texture.

Adds a regression test, with the caveat that a failure is only shown by
having the VVL output and error in stderr due to an unrelated issue.

Fixed: dawn:1512
Change-Id: I35d5581e46909b7f41ff4c7553d60c6ac844a56b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101121
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-09-26 11:13:35 +00:00
Corentin Wallez ab882c17a5 Vulkan: Fix incorrect barriers for T2T copies of DS.
T2T copies for depth-stencil formats where done one by one. Because
the two per-aspect copies where submitted with no barriers in between
them, incorrect synchronization could occur, making the end state of the
destination texture incorrect.

Fix this by using the combined aspects of the texture to perform copies,
such that depth stencil are copied in a single command instead of two
commands.

Unfortunately the VVLs don't catch this issue, but the reporter of the
issue confirmed that this commit fix the dawn_end2end_tests failures
they were seeing.

Fixed: dawn:1514
Change-Id: I2e1c5f8d9aabeb0119364d26c9d66d0763cfadcf
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/103421
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
2022-09-26 11:07:25 +00:00
Antonio Maiorano 5f33facbc1 tint: const eval of binary left shift
Bug: tint:1581
Change-Id: I8c1b01bcae2a205e712b8004573cc26a3366785a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/103061
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2022-09-23 21:58:29 +00:00
Yunchao He ef6696089d D3D12 Intel: change the driver version for array texture corruption issue
The previous driver version I got from Intel driver team is
not correct. That driver does contain the fix but it is not the
first version with the fix.

Bug: dawn:949, dawn:1507

Change-Id: I0044a181e4266b50f77734bbbf9cc8755a8334d9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/103502
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-09-23 16:03:37 +00:00
Corentin Wallez 05e7332ac8 Rework how combined aspects are handled in TextureVk
At the moment the computations to decide whether aspects should be
combined are executed on every call related to aspect in TextureVk.
These computations never change and can be computed once at the creation
of TextureVk and reused at runtime.

This is meant to be a noop change as a slight rework prior to fixing
depth-stencil T2T copies no using the combined aspects.

Bug: dawn:1514

Change-Id: I1177cdcf42d072bb2bc2c3a2f149dc480fe79f2f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/103420
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-09-23 09:56:06 +00:00
Sunny Sachanandani 85e6337027 d3d12: Move NextSerial out of ExecuteCommandList
Reverts to the code flow before fences were implemented. NextSerial is
now the reponsibility of the caller of ExecutePendingCommandContext like
it was before. We now use GetPendingCommandSerial to store the signal
fence value instead of GetLastSubmittedCommandSerial and check that the
signal fence value was submitted in EndAccess.

Bug: dawn:576
Change-Id: I616840a0932ec17f77fcab38058773006dfae32f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/103501
Commit-Queue: Sunny Sachanandani <sunnyps@chromium.org>
Auto-Submit: Sunny Sachanandani <sunnyps@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-09-23 00:52:56 +00:00
Jiawei Shao 5a0f8d32a2 Support optional query on adapter power preference
This patch adds DawnAdapterPropertiesPowerPreferenceDescriptor for
querying adapter power preference which is useful to distinguish
different logical adapters created on same physical device but with
different power preferences.

Bug: dawn:1516
Test: dawn_unittests
Change-Id: I12ed6e370f8b57c860520154565765f0ee894831
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/102780
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2022-09-23 00:29:46 +00:00
Loko Kung 3354bf0d91 Add cleanup when encoding indirect draw validations.
- Cleanup is necessary because otherwise encoded render commands may be
  leaked if the validation encoding fails. (The leaked render commands
  can then trigger an assert in ~Device::Cache because the commands can
  hold a ref to an AttachmentState that was not destroyed, and hence
  still be in the device cache.
- Added explicit check in EncoderIndirectDrawValidationCommands for
  device 'alive-ness' since it may create new objects later and hit the
  same error later on anyways.
- Added regression test.

Fixed: chromium:1365011
Change-Id: I342479a4227fc43d82ea35f662d049e6db2b1740
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/103340
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Loko Kung <lokokung@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-09-22 23:45:36 +00:00
Ben Clayton c4ebf2cc57 tint: Implement textureSampleBaseClampToEdge
Fixed: tint:1671
Change-Id: Iaae5b5d571a4401c0255de727245bf8dbbe06740
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/102642
Reviewed-by: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-09-22 22:59:16 +00:00
dan sinclair 78f8067fd5 Fix overrides in array size.
This CL fixes the usage of overrides in array sizes. Currently
the usage will generate a validation error as we check that the
array size is const.

Bug: tint:1660
Change-Id: Ibf440905c30a73b581d55b0c071b8621b61605e6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101900
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: dan sinclair <dsinclair@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
2022-09-22 22:28:21 +00:00
Austin Eng 534a198f88 Validate that the device is alive when wrapping external images
Will be tested in Chromium's webgpu_mailbox_unittest.cc

Bug: chromium:1359106
Change-Id: I8a9bf01cd593f2835e2876fa04139fd3afda9b2e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/103462
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2022-09-22 22:10:56 +00:00
Takahiro d4dd547bae Implement "rg11b10ufloat-renderable" feature
Implement "rg11b10ufloat-renderable" feature that allows
the RENDER_ATTACHMENT usage on textures with format
"rg11b10ufloat", and also allows textures of that format
to be multisampled.

Bug: dawn:1518
Change-Id: I4109dc0e9d90f4c0803219292edea554927a187a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/102000
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-09-22 16:38:06 +00:00
Li Hao cbd3ef4bb9 Suppress TimestampQueryTests.ResolveTwiceToSameBuffer/D3D12 on Intel Gen12
This is a D3D driver regression on Intel Gen12 GPUs, the test could pass
on old driver version and pass with disable_timestamp_query_conversion
toggle on latest driver.

Bug: dawn:1546
Change-Id: I8cf63824d5147bb78f53a284cada8efdc653a3ce
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/103380
Commit-Queue: Hao Li <hao.x.li@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-09-22 09:52:35 +00:00
Ben Clayton 490d9889a7 tint: Simplify workgroup size resolving
A `@workgroup_size()` value must be a constant or override expression.
There's nothing specific here about literals or variable expressions.

Remove the semantic tracking of override variables, as these can be override expressions.
The backends will require the `SubstituteOverride` transform to be run, so gut the workgroup_size override handling from the backends.

Bug: tint:1633
Change-Id: Ib3ff843fc64a3595d49223c661b4d58130c0ab30
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100142
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
2022-09-21 21:05:45 +00:00
Austin Eng 45a2c5193a Return false from IsTextureSubresourceInitialized for error textures
Otherwise, callers of this method will hit an ASSERT for error
textures.

Bug: chromium:1359106
Change-Id: I2602d209d837b3b27916221578f9ac4041f8848b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/103281
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-09-21 20:18:30 +00:00
Ben Clayton f92830b623 dawn: Enable OpenGLBackend for ComputeLayoutMemoryBufferTests
The layout issues should now be fixed with the Std140 transform.

Bug: dawn:942
Change-Id: I714c2edb39f27b39f66c1e913f22232ad7908896
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/103000
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Auto-Submit: Ben Clayton <bclayton@google.com>
2022-09-21 18:13:14 +00:00
Brandon Jones 773800b68d Reland "Implement maxBindingsPerBindGroup limit"
This is a reland of commit 4d67a883b6
Underlying issue fixed in https://dawn-review.googlesource.com/c/dawn/+/102461

Original change's description:
> Implement maxBindingsPerBindGroup limit
>
> Bug: dawn:1523
> Change-Id: Ifcf83f6836a5d7ed447080ccb033e4163970432e
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100706
> Reviewed-by: Kai Ninomiya <kainino@chromium.org>
> Reviewed-by: Austin Eng <enga@chromium.org>
> Kokoro: Kokoro <noreply+kokoro@google.com>
> Commit-Queue: Brandon Jones <bajones@chromium.org>

Bug: dawn:1523
Change-Id: If0824b6f8fcb7c152feceb95a2709d0a3b8ce582
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/103280
Reviewed-by: Brandon Jones <bajones@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-09-21 17:42:24 +00:00
Ben Clayton 4953dabab7 dawn/tests: Remove OverridesWithZeroDefault test
It's not invalid to have create a shader module using zero-defaulted `override`s as workgroup size parameters.
These can be initialized with non-zero pipeline override values.

Bug: dawn:1504
Change-Id: I2636cbe2d26a6604735b0c8b0f5526bbc14e8ce2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/103220
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Shrek Shao <shrekshao@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-09-21 16:42:34 +00:00
dan sinclair 1662f5578e Fixup some grammar.
This Cl updates some double negative grammar to be a bit more readable.

Change-Id: Id5d9c64acc1dd8422b8116d8a6c1bf149f99e592
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/103260
Auto-Submit: 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>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-09-21 14:44:33 +00:00
Corentin Wallez 30f51b94da Delete the remove_stale_autogen_files mechanism.
Previously when moving around directories for generated files, Dawn ran
into an issue where stale files where #included instead of the new ones,
causing compilation failures. To get around this a
remove_stale_autogen_files mechanism was added that scans the gen/
directory for files not in an allow-list of directories.

This mechanism is now causing problems for bringing up Dawn standalone
tests on Android as these test also generate files in Dawn's gen/
directories, and their files get deleted by remove_stale_autogen_files.

We are not foresseing any additional shuffling of directories and it's
safe to expect that all stale files have been removed from CI builder
caches at this time. So remove_stale_autogen_files can go. This is what
this CL does.

Fixed: dawn:1543
Change-Id: I7dbf1eae6c55b7659f3837b6d4a565052001ce57
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/103040
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-09-20 17:28:33 +00:00
Corentin Wallez eebb7d5e52 Fix leak of the eager exportable VkSemaphore.
Exporting an exportable VkSemaphore doesn't implicitly destroy the
VkSemaphore object. So instead of Detach()ing the VkSemaphore when it is
first consumed, just let it go out of the scope and be destroyed with
RAII. This also fixes the RAII by not destroying the VkSemaphore
immediately and instead wait until it becomes unused.

Found by running dawn_end2end_tests with the VVLs.

Bug: chromium:1258986
Change-Id: I858839b3094eee0f575c07a8f18504680afb53e3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/103024
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2022-09-20 17:02:32 +00:00
Corentin Wallez 1d100e4270 Dedent OnDebugUtilsCallback
While trying to debug why VVL failures don't cause test failures I
reworked this code a little bit. There is not CL that fixes the
behavior, but the code is marginally better with less indentation so
here's a CL to check that in.

Bug: None
Change-Id: I6fc460c4b4b7959ae405219615a03230bfb9847a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/103022
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-09-20 16:01:31 +00:00
Corentin Wallez 9a6ca2878e Fix deprecation warnings of module-scope lets
By promoting them to "const" as the deprecation warning suggests.

Bug: None
Change-Id: I7110b8d38754a0785d7fd56343c2c905dc491e1a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/103023
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-09-20 15:58:27 +00:00
David Neto 7d9140feb9 spirv-reader: Refactor tracking of locally-defined values
Based on suggestions from bclayton to use std::optional

Change-Id: I372472dbd5e239713eee5c2ec6ae6ea05fc384fa
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/102660
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-09-20 15:37:19 +00:00
Corentin Wallez 6270ea7675 Suppress unnecessary VVL warning.
WebGPU allows having fragment outputs that don't match any attachments
so suppress this warning from the VVLs.

Bug: None
Change-Id: I49d3d876fdbc9e25ff71fd763593c7d810cb248c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/103021
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-09-20 14:40:22 +00:00
Corentin Wallez 19826c30c1 Update the matchers for skipped VVL messages
The casing of some of the messages was updates in the Vulkan Validation
Layers which made the suppression in the Vulkan backend not match
anymore.

Bug: dawn:1225
Change-Id: I58c23986dce96453ded5b573bccee0ec90dcad91
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/103020
Commit-Queue: Austin Eng <enga@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2022-09-20 14:05:42 +00:00
Ben Clayton e68d4506c0 tint/resolver: Consistently use utils::Result in ConstEval
Instead of using builder.Diagnostics().contains_errors()

Produces cleaner code and reduces scope of error handling.

Bug: tint:1661
Change-Id: I35af5ad1c6553f2cf74d1ce92dc14984f93b9db4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/102161
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-09-20 09:26:21 +00:00
dan sinclair 65edd3d23e Run SubstituteOverrides in fuzzers if needed.
With the change to remove support for `Override` in the various
backends, it is now possible for the fuzzers to send invalid programs
through to the generators by creating overrides.

This CL adds the `SubstituteOverride` transform into the fuzzers and
defaults any non-initialized override to 0. The transform is run
separate from the other transforms used by the fuzzers as the fuzzers
don't have to add transforms, this makes sure the substitution always
happens, regardless of other transform configuration.

Bug: chromium:1362815
Change-Id: I3c57128d24c5613079a62309f5d5edefa28e8413
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/102840
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-09-19 18:59:41 +00:00
Alastair Donaldson b7da8f612e Fix out-of-bounds access in regex fuzzer
Fixes the regex fuzzer so that when searching for an operator to
replace, it takes account of the fact that the string being searched may
be very small, avoiding an issue where unsigned integer underflow would
occur.

Bug: crbug.com/1359193
Change-Id: I653a20429dc20385a64f8d684c81d023702458e6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/102641
Kokoro: Kokoro <noreply+kokoro@google.com>
Auto-Submit: Alastair Donaldson <afdx@google.com>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2022-09-19 15:47:32 +00:00
Antonio Maiorano e14a27bc7f tint: remove LoopToForLoop and FoldTrivialSingleUseLets transforms for HLSL and GLSL
Change-Id: I18c807b2449dc2842cb9dbfaeba98dae640d2355
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/102621
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-09-19 14:05:21 +00:00
Ben Clayton 90b29e500a tint/transform/std140: Correctly handle nested / bare matrices
Fixed tint:1673
Fixed tint:1674

Change-Id: Ifa5d2a69131cc1e4679d4d43143f857c7ba46dbd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/102640
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-09-17 01:47:59 +00:00
Ben Clayton 84b43d61fa tint/writer: Handle unnested, uniform matCx2 matrices
Shuffle the transform orders to ensure that these are embedded in a structure before running the Std140 transform.

Add more end-to-end tests for these.

As pointed out in tint:1673, arrays of matrices are not correctly decomposed by the Std140 transform.
This will be addressed by a later change.

Bug: tint:1673
Change-Id: I47c93e458ff48578922d576819792e8ed3a5723c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/102541
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Zhaoming Jiang <zhaoming.jiang@intel.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
2022-09-17 00:38:19 +00:00
David Neto a3f2bf6c60 spirv-reader: phis as a particular case of hoisting to a var
We already compute the "first" and "last" basic block that
uses a value, so we could know when to hoist a value into
a var declaration. You have to do this sometimes to make
sure all uses are in scope of the declaration.

Until now we tracked Phis with an entirely different mechanism.
But there are cases which broke down. That's what happens
in crbug.com/tint/1649.

Additionally, GraphicsFuzz cases generarte similar weirdness.

Also, be more careful about ensuring that the assignments
generated to feed phis behave as if they occur in parallel.
Within a single batch of such assignments, generate and
use intermediate let-declarations for phis that that batch
will overwrite.

Also, unwrap-references when rectifying the signedness of
binary operators.

Skip tests that fail due to crbug.comt/tint/98:
  test/tint/bug/tint/749.spvasm.*

Fixed: tint:1649
Change-Id: I7314c351b74a10bfa9a18011f3d80a520568011c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101220
Auto-Submit: David Neto <dneto@google.com>
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-09-16 20:18:39 +00:00
Antonio Maiorano ebc5bba671 tint: const eval of binary XOR
Bug: tint:1581
Change-Id: I5605426f0c4b9447ce770092de4ab2f639d0218d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/102580
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-09-16 17:16:38 +00:00
Austin Eng d41981b5cc Deprecate sampleType "float" with multisampled textures
Bug: dawn:1540
Change-Id: I27608cc88c677205a2a41a5b041d2360f43d14f9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/102620
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Shrek Shao <shrekshao@google.com>
2022-09-16 16:33:28 +00:00
Li Hao 92182412b8 Implement timestampWrites on Metal
Metal configures the query set and query index for the beginning and end
of passes in pass descriptor when beginning a pass encoder, so we need
to record all timestamp writes information in BeginXxxPassCmd. For the
platfroms that support timestamp query, it must support timestamp write
at command boundary or stage boundary, if the stage boundary is
supported, use sampleBufferAttachments API for Metal implementation,
otherwise simulate timestamp write using sampleCountersInBuffer API
after begining a pass and before ending a pass.

Bug: dawn:1250
Change-Id: I462cb05a0102521cd2df4db3ac6f71863419b933
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/93940
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Hao Li <hao.x.li@intel.com>
2022-09-16 15:00:19 +00:00
Austin Eng 505e1a9368 Revert "Make it invalid to use sampleType "float" with multisampled textures"
This reverts commit 9b2f273d36.

Reason for revert: Breaking change needs deprecation period.

Original change's description:
> Make it invalid to use sampleType "float" with multisampled textures
>
> Fixed: dawn:1540
> Change-Id: I31f197d802c20ed7e6ef2ae00d4e107ab6f94278
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/102420
> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
> Kokoro: Kokoro <noreply+kokoro@google.com>
> Commit-Queue: Austin Eng <enga@chromium.org>

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

Change-Id: I5ac4b5691b0c4fb0ce76223c1997855e1b3485f3
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/102500
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
2022-09-16 01:14:28 +00:00
Jiawei Shao 233d64066c Make the validation on inter-stage shader variables match latest WebGPU SPEC
This patch updates the validations on the inter-stage shader variables to
match the latest WebGPU SPEC (in chapter "validating-inter-stage-interfaces").

With this patch the below validation tests in WebGPU CTS will pass:
- render_pipeline,inter_stage:max_shader_variable_location:*
- render_pipeline,inter_stage:max_components_count,*

Fixed: dawn:1448
Test: dawn_unittests
Change-Id: I3e4d98f03ec18e5d1642a4d7ecd3eed1b7ae04d0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/102104
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-09-16 00:30:38 +00:00
Austin Eng 9b2f273d36 Make it invalid to use sampleType "float" with multisampled textures
Fixed: dawn:1540
Change-Id: I31f197d802c20ed7e6ef2ae00d4e107ab6f94278
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/102420
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2022-09-15 23:03:38 +00:00
Loko Kung 18dfc4797c Track TextureViews in Textures so that they can be chain-destroyed.
- Adds Prepend function to LinkedList to avoid directly using the
  insert functions on the LinkNodes. (And tests for this as well.)
- Adds ApiObjectList class for tracking lists of objects for
  destruction.
- Renames and virtualizes some tracking interfaces so that they can be
  overriden for the TextureView/Texture cases.
- Removes explicit destroying of TextureViews from Device since
  destroying Textures will destroy TextureViews now.

Fixed: dawn:1355
Change-Id: I3522383ea7724d6e41ac0c805793a6c34d9bec27
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101762
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Loko Kung <lokokung@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-09-15 21:06:51 +00:00
Antonio Maiorano 6ab02659de tint/spirv-reader: add support for GLSLstd450MatrixInverse
Bug: tint:1670
Change-Id: I2faaec03117a00f55624c9a51419eb79cc6da40f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/102261
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Arman Uguray <armansito@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-09-15 17:22:25 +00:00
Austin Eng 44754c529f Revert "Remove code to set Vulkan backend debug labels"
This reverts commit c1f5112462.

Reason for revert: underyling issue in crbug.com/dawn/1539 fixed

Original change's description:
> Remove code to set Vulkan backend debug labels
>
> This is hitting a memory corruption issue inside the NVIDIA driver.
> Speculatively delete the code in the Vulkan backend until further
> analysis finds the root cause.
>
> Bug: dawn:1539
> Change-Id: Ie7bf5bed31976da5f13325c81033e787c4d376b9
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/102100
> Reviewed-by: Loko Kung <lokokung@google.com>
> 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:1539
Change-Id: Ic1e4c4ad05abd6f2e244e4a5364bf54e6288cffb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/102107
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
2022-09-14 18:36:18 +00:00
Austin Eng 945e2642d6 Fix race with FencedDeleter and VkShaderModule labels in async creation
FencedDeleter does not need to be used at all since we were deleting
a yet-to-be-used VkShaderModule.

Also, set the VkShaderModule label before cache deduplication since to
avoid a race where the VkShaderModule is in use by another thread.
The other thread may also be setting the label, or using it in a
pipeline creation.

Bug: dawn:1539
Change-Id: I5e3d7ce214c4c089c9cc3272f373aa8233017965
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/102105
Commit-Queue: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Loko Kung <lokokung@google.com>
2022-09-14 18:13:17 +00:00
Jiawei Shao 060137a712 Replace NULL with nullptr
This patch replaces NULL with nullptr as nullptr is preferred as null
pointers in Chromium coding style.

Bug: None
Change-Id: Ie6ab9d606d791bad2c50001815062c22e9ec0d25
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/102102
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-09-14 14:39:37 +00:00
Wang Qing cd86adaf41 loongarch: Add ASSERT() breakpoint support on loongarch architecture.
Bug: dawn:1506
Change-Id: Icff59529676c1f2ad3b9e1779577cad467866797
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/102146
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-09-14 13:31:37 +00:00
Shrek Shao b74ca3f8e0 Block NaN and Inf constants value as invalid
Bug: chromium:1362412
Change-Id: Ie3b8c447677ebb4bc12177a5dc4fd92d9033a359
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/102280
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Auto-Submit: Shrek Shao <shrekshao@google.com>
2022-09-14 13:13:07 +00:00
Ben Clayton 751e6686aa tint/intrinsics.def: Implement saturate()
Fixed: tint:1591
Change-Id: I0b1397d74abd49cd44caf326a2063e50c5cf07de
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101480
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-09-13 22:57:52 +00:00
Ben Clayton f3d9ea4bea tint: Error if statically indexing out of bounds.
Fixed: tint:1665
Change-Id: Icd5f24f3b4d6ebbdc18b536dc426da92558a3a4b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101183
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-09-13 22:47:12 +00:00
Stephen White 05d8b02b0f GLSL: implement host-visible memory padding.
Since GLSL ES does not support the offset= attribute, struct members
with explicit @align or @size attributes require adding explicit
padding members.  This in turn requires rewriting any constructor
calls to initialize the new padding to zero, handled in the same
transform.

Note that this is currently overly-verbose, and will add padding where
GLSL doesn't technically need it (e.g., padding a vec3 out to 16 bytes).

Bug: tint:1415
Change-Id: Ia9ba513066a0e84f4c43247fcbbe02f5fadd6630
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101720
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-09-13 19:48:51 +00:00
Ben Clayton e667d777ac tint/fuzzers/tint_concurrency_fuzzer: Reduce number of threads
Should reduce memory and improve performance.

Bug: chromium:1360731
Bug: chromium:1357188
Change-Id: I94c3653f6d61db9d949ad27d8b666688ccad86dd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/102182
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: 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-09-13 18:24:02 +00:00
Antonio Maiorano 0dfbaa9ef9 tint: Make ForEachElemPair return value an enum instead of a bool
Bug: tint:1581
Change-Id: Ia16a548c03f7dff4ebc45599e20c0004834da6ae
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/102121
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2022-09-13 18:16:11 +00:00
Antonio Maiorano e53b6f9502 tint: const eval of binary bitwise AND and OR
Bug: tint:1581
Change-Id: Id6a7a1c8e45ee91bede8014dca03a59035b29678
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/102060
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-09-13 18:13:01 +00:00
Antonio Maiorano 5b3707a2d7 tint: Implement const eval of unary not
Bug: tint:1581
Change-Id: If0a74b1f6739725a2284678aab97baf737d96937
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101761
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-09-13 17:32:17 +00:00
Antonio Maiorano 8175cff07b tint/const_eval_test: factor out testing framework from binary tests to use with unary tests
Bug: tint:1581
Change-Id: I55c46123f5adfcd9b48ef03f62ceb68a1d7aca58
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101760
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-09-13 17:18:02 +00:00
Austin Eng c1f5112462 Remove code to set Vulkan backend debug labels
This is hitting a memory corruption issue inside the NVIDIA driver.
Speculatively delete the code in the Vulkan backend until further
analysis finds the root cause.

Bug: dawn:1539
Change-Id: Ie7bf5bed31976da5f13325c81033e787c4d376b9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/102100
Reviewed-by: Loko Kung <lokokung@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2022-09-12 21:43:21 +00:00
Brian Sheedy 3ada731606 Expand Mac Metal Intel suppression
Expands a couple of existing suppressions to also apply to Mac 12.5, as
the issue still occurs after the upgrade from Mac 12.4 to 12.5.

Bug: dawn:1462
Change-Id: Iba0041fd0f9deafeb3fb770867ffa2e2e4d12553
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101901
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Brian Sheedy <bsheedy@google.com>
Auto-Submit: Brian Sheedy <bsheedy@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2022-09-09 21:26:19 +00:00
Ben Clayton 4b70776aed tint: Fix transform errors when calling arrayLength() as a statement
Bug: chromium:1360925
Change-Id: If60fa4bb1cf4981c10dd15f8814c0aed70c0066e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101780
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-09-09 20:42:29 +00:00
dan sinclair 3526bc4f42 Remove GLSL override generation
This CL removes the override emission from the GLSL backend. The
override should be removed by the substitute_override transform
before making it to the backend.

Bug: tint:1155
Change-Id: Ic95413cfedaf417f54cab80aef413f745ccf3bfa
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101664
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-09-09 16:55:58 +00:00
dan sinclair e1854b2d72 Remove SPIR-V override generation
This CL removes the override emission from the SPIR-V backend. The
override should be removed by the substitute_override transform
before making it to the backend.

Bug: tint:1155
Change-Id: Id00a58d497988908e15e3746ea05b57838acc8ba
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101740
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-09-09 16:18:48 +00:00
dan sinclair f6a9404978 Remove HLSL override generation
This CL removes the override emission from the HLSL backend. The
override should be removed by the substitute_override transform
before making it to the backend.

Bug: tint:1155
Change-Id: I6fecf47a5f5616a81281b179853e0f00ba31011f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101663
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-09-09 16:16:19 +00:00
dan sinclair 5432767a04 Remove MSL override generation
This CL removes the override emission from the MSL backend. The
override should be removed by the substitute_override transform
before making it to the backend.

Bug: tint:1155
Change-Id: I9d3852a7e20b258a2f0af200bff6268037eaa0b5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101662
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-09-09 16:14:10 +00:00
dan sinclair 93df967003 Update StructMember{Offset,Size}Attribute to expressions.
This CL updates the StructMember Offset and Size attributes to
store expressions instead of uint32_t values.

Bug: tint:1633
Change-Id: I771b64fbd27a398ffbcb3f8cc2cbb7fa2606983e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101640
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-09-09 14:49:09 +00:00
shrekshao 14579b9da3 Add Overrides implementation for OpenGL/OpenGLES backend
As we are using SubstituteOverride, it is easy to add
overridable constants support for OpenGL/OpenGLES.

Also add validate workgroup size for null backend.

Bug: dawn:1537, dawn:1504
Change-Id: I293f10b9a6c606aee6c0ed25b1d966bc56a0b88d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101800
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Shrek Shao <shrekshao@google.com>
2022-09-09 00:49:08 +00:00
Brandon Jones 7edef20bdd Add AHardwareBuffer support
Initial pass at adding AHardwareBufferSupport so that Dawn can display
content on Android. Confirmed that this will allow many WebGPU pages to
render when paired with
https://chromium-review.googlesource.com/c/chromium/src/+/3877262

Bug: dawn:286
Change-Id: I627fa2ab71f85bd3cb7ea21b0588dbd2089cdf5f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101460
Commit-Queue: Brandon Jones <bajones@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-09-08 23:03:28 +00:00
dan sinclair c4e076ffe6 Rename attribute values.
This CL renames the attributes to store `expr` instead of `value`.
This closer matches what is stored.

Bug: tint:1633
Change-Id: If1db34d1f9186afa111c394f18ed049dd2f56f91
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101525
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-09-08 01:04:34 +00:00
Zhaoming Jiang 7ca82ac4d0 dawn: Refactor device creation and add shader-f16 feature
This CL modifies the way adapter creating devices, adds `shader-f16`
feature, and deprecates the `dawn-shader-float16` feature which is no
longer used.
Details:
1. Parse the toggles chained with device descriptor in
`adapter::CreateDeviceInternal`, which are then used to validate
features requirement within `CreateDeviceInternal` and passed to device
constructor as initializer.
2. When creating device, validate features requirement in
`CreateDeviceInternal` with toggles known, make sure to fail the device
creation if a required feature is not supported by adapter or is guarded
by certain toggles which were not enabled/disabled. Feature ShaderF16
and ChromiumExperimentalDp4a are validated in this way. Unittest is
added to check creating devices with toggles-guarded features required.
3. Add `shader-f16` feature, which allow `using f16;` in WGSL code.
End-to-end tests are added to test a trival f16 WGSL shader could be
used if and only if the device has `shader-f16` feature.
4. Deprecate the `dawn-shader-float16` feature, which will be completely
removed after cleaning up Blink code.

Bug: dawn:1510
Change-Id: I6cb2dcbe1ee584fdd6131c62df1ee850b881dbd2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100802
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2022-09-08 00:11:04 +00:00
dan sinclair f9eeed6106 Convert `@location` to store expression internally.
This CL updates the internal storage for a `@location` attribute
to store the `Expression` instead of a raw `uint32_t`. The current
parser is updated to generate an `IntLiteralExpression` so we still
parse as a `uint32_t` at the moment.

Bug: tint:1633
Change-Id: I2b9684754a657b39554160c81727cf1541bee96c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101461
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-09-07 22:25:24 +00:00
shrekshao 145337f309 Use SubstituteOverride transform to implement overrides
Remove the old backend specific implementation for
overrides. Use tint SubstituteOverride transform to replace
overrides with const expressions and use the updated program
at pipeline creation time.

This CL also adds support for overrides used as workgroup size
and related tests. Workgroup size validation now happens
in backend code and at compute pipeline creation time.

Bug: dawn:1504
Change-Id: I7df1fe9c3e358caa23235eacd6d13ba0b2998aec
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99821
Commit-Queue: Shrek Shao <shrekshao@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-09-07 20:09:54 +00:00
dan sinclair 23cf74c30e Allow sem::GlobalVariable to hold a location.
During some transforms we may move an entry point parameter to
a global variable. This means the global may now have a Location
attached where it isn't permitted by the WGSL spec.

This CL adds a `location` to the GlobalVariable sem value and
populates it in the resolver.

Bug: tint:1633
Change-Id: I684f715fe52d39a0f890fe76c627c1ae543fc746
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101462
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
2022-09-07 20:05:54 +00:00
Sunny Sachanandani 5881e735f9 d3d12: External image import using multiple wait fences and signal fence
To support concurrent readers on multiple command queues/devices, Dawn
must support importing via wait multiple fences and also export a signal
fence. The previous implementation of using a single fence for waiting
and signaling doesn't work for concurrent reads across queues.

This CL adds support for specifying multiple wait fences for
ExternalImageDXGI via a BeginAccess method that's meant to replace
ProduceTexture. There's also an EndAccess method that returns a signal
fence for the client.

For performance reasons, we use the same fence as the signal fence that
the Device uses internally, and record its value on the texture after
ExecuteCommandLists. Therefore, the CL also makes the Device's internal
fence a shared fence so that we can export it to the client.

This CL also expands the ConcurrentExternalImageReadAccess test so that
it tests fence synchronization across multiple devices. A number of test
helpers also now take an optional device parameter so that we can use
pixel value expectations with secondary devices.

Bug: dawn:576
Change-Id: I6bc86808ede9b5aacf87667106cbd16731a12516
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99746
Commit-Queue: Sunny Sachanandani <sunnyps@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-09-07 19:48:45 +00:00
Antonio Maiorano 29aa613dcf tint: const eval of comparison operations
Change-Id: Iec6e78dbe00baaed8c90e709447a20f6c8ac9fb0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101304
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-09-07 19:34:44 +00:00
Brandon Jones 567f06849b Add the "internal" error type
Currently only raised if Tint produces an Internal Compiler Error
(ICE). These were previously surfaced as validation errors.

Bug: dawn:1531
Change-Id: I9a10549b3e0bc2cbf962c99d157aa6dbe8032a3c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101500
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Brandon Jones <bajones@chromium.org>
2022-09-07 14:14:14 +00:00
Ben Clayton eeda18d55e tint::transform::SingleEntryPoint: Preserve global 'const's
These can be used in all sorts of places which are not tracked by sem::Function::TransitivelyReferencedGlobals().
As they're not emitted as variables by any backend, just preserve them.

Fixed: tint:1598
Change-Id: I2696486cb2ffe8408bd5dd3090d7d600ca1d170f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101481
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Auto-Submit: Ben Clayton <bclayton@google.com>
2022-09-07 13:05:24 +00:00
Jiawei Shao 72c042db41 Disable toggle D3D12DontSetClearValueOnDepthTextureCreation on Intel Gen11
This patch disables Toggle::D3D12DontSetClearValueOnDepthTextureCreation
on Intel Gen11 GPUs as we find it not needed after further tests.

Bug: dawn:1487
Test: dawn_end2end_tests
Change-Id: I2c378568328b758e83484cff514073b052cf5004
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101300
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2022-09-07 00:57:23 +00:00
Brandon Jones 8f3d7711d9 Add Vulkan extensions for AHardwareBuffer support
Just adds the appropriate extensions for AHardwareBuffer support on
Android doesn't yet attempt to expose any.

Bug: dawn:286
Change-Id: I1345d98044bbcaf91cb31235bffbdc28a163c6e0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101440
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Brandon Jones <bajones@chromium.org>
2022-09-06 22:40:13 +00:00
Antonio Maiorano 11e2571aed tint: Minor improvements
I forgot to fold this into crbug.com/tint/100861

Bug: tint:1581
Change-Id: I8f8faef7765b525316e2c927504cce88a93d24ee
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101303
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-09-06 18:40:33 +00:00
Austin Eng 185fd3deca Add go tests to presubmit
Change-Id: I2d56a463cecf0b1bcb96c51ae134c6fa07d87b21
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100560
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2022-09-06 18:20:33 +00:00
Ben Clayton 8b4ed5093e tint: Fix / remove tests that access OOB
With constant indices.
Also fix the SPIR-V builder tests that did something completely different from the test name / comment.

Bug: tint:1665
Change-Id: I83537cf6e44ffcb14d54de52649d1f9da1ef7e1b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101182
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-09-06 17:43:23 +00:00
Brandon Jones 2b0fce7071 Revert "Implement maxBindingsPerBindGroup limit"
This reverts commit 4d67a883b6.

Reason for revert: Seems to be causing MSAN issues with the Dawn/Chromium roll?

Original change's description:
> Implement maxBindingsPerBindGroup limit
>
> Bug: dawn:1523
> Change-Id: Ifcf83f6836a5d7ed447080ccb033e4163970432e
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100706
> Reviewed-by: Kai Ninomiya <kainino@chromium.org>
> Reviewed-by: Austin Eng <enga@chromium.org>
> Kokoro: Kokoro <noreply+kokoro@google.com>
> Commit-Queue: Brandon Jones <bajones@chromium.org>

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

Bug: dawn:1523
Change-Id: I757457089be6af18dfce7f64c0da5d310351cece
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101401
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Brandon Jones <bajones@chromium.org>
Reviewed-by: Shrek Shao <shrekshao@google.com>
Commit-Queue: Brandon Jones <bajones@chromium.org>
2022-09-06 17:38:03 +00:00
dan sinclair 72340d00ce Add location into `sem::Parameter`.
This CL adds a `location` value into the `Parameter` sem object.
This will be set if the parameter has an `@location` attribute
applied.

Bug: tint:1633
Change-Id: I55cb5cbda951f70d071ebe1400865b63af1fb20a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101065
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-09-06 16:05:54 +00:00
dan sinclair 766a458f53 Store location value into `sem::Function`.
This CL adds an optional location value to the `sem::Function`
which will store the resolved `@location` value.

Bug: tint:1633
Change-Id: I95130858d8a1cecae1389be74120da29fec2b448
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101063
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-09-06 16:00:13 +00:00
Ben Clayton c8278e5cbd tint/transform: Fix hasher return type
These should return `size_t`, not `uint64_t`.
Fixes x86 build.

Change-Id: I83125afc3bce9a9dab7d53c4818f9de3daf4cfb2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101320
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Auto-Submit: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-09-06 14:53:33 +00:00
dan sinclair 97c9e0ba9f Store struct member location into the sem.
This CL adds the `@location` of a Struct Member into the
`StructMember` sem object as a `std::optional<uint32_t>`. The
resolver then populates the location value if an attribute is
found during resolution.

This will provide a place to store the evaluated expression value
for a location in the future.

Bug: tint:1633
Change-Id: I6f696968dddf95af1f933d96cdb4a7630badac2e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101062
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-09-06 14:41:16 +00:00
Ben Clayton d7d71889d8 tint: Add FriendlyName() to Program
Use this instead of ProgramBuilder::FriendlyName() in the Std140 transform.
If this were called, we'd ICE that the program ids wouldn't match the type, as the type belongs to the source program, not the target program builder.

Change-Id: I29066b18789493c231a89f7ee1dbc24d7e66d33f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101180
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2022-09-05 20:51:23 +00:00
Ben Clayton 0cd830c571 tint: Fix type is_signed_integer helpers which were ignoring abstracts
Abstracts are now considered scalars, so these should be returning true for abstract-integers.

Change-Id: If15f87932d412663d2aef4f9737675a8ece9e551
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101181
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-09-05 10:43:03 +00:00
Antonio Maiorano 3740ac6092 tint: implement const eval of binary divide
Bug: tint:1581
Change-Id: I72f7f34046086ad00d3bf8f21d67db831903d60b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100861
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-09-03 22:42:51 +00:00
Antonio Maiorano 679cf4f351 tint: HLSL and GLSL backends now emit 0 for inf and nan
Bug: tint:1581
Change-Id: I62dcde177c3b82408cd8d737526d10d481b48a17
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101240
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-09-03 21:43:01 +00:00
Antonio Maiorano 1741f4443e tint: add CheckedDiv for abstract numbers
Bug: tint:1581
Change-Id: Iafed168a916ac3a1062bcf53299e8ff17fc389fb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101041
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-09-03 21:31:23 +00:00
Robert Stewart 89dd52881c spirv-reader: Fix for SelectUsingReferenceVariable
Started from https://dawn-review.googlesource.com/c/dawn/+/99220/2

Fixed: tint:1650
Change-Id: Ic5e097135a54c68e2cb9736198082179b522a4ba
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101069
Commit-Queue: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2022-09-03 00:10:30 +00:00
Antonio Maiorano 8478dfca56 tint: improve error message for const eval operator overflow
Bug: tint:1581
Change-Id: I112c7981d6b1998dd8133d1f80409fdc12a16a21
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101042
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-09-02 23:01:00 +00:00
Stephen White 863d9edf59 GLSL: Change Add[Spirv]BlockAttribute to support GLSL
Modify the AddSpirvBlockAttribute transform to fix top-level structure
access of uniform, storage and push-constant buffers for use in the
GLSL backend. The small change to the transform makes the transform
wrap host-sharable buffers, if they're also used as a
non-host-sharable structure. Also rename the transform to
AddBlockAttrbibute in order to reflect its wider applicability.

Change-Id: Ib2bf4ebf6bce72790791dbae9387032be765e4b9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101061
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2022-09-02 19:19:10 +00:00
David Neto 822de46c74 spirv-reader: fix image write texel conversion for scalar integer cases
Started with https://dawn-review.git.corp.google.com/c/dawn/+/98980,
then took ownership to add tests and land.

Change-Id: I8da4d5e626be3a5cadc6addb36cdbe00a87b8a3c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101064
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: David Neto <dneto@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2022-09-02 18:09:30 +00:00
Robert Stewart ece807852d spirv-reader: Fix texel type confusion in loop
Started from https://dawn-review.googlesource.com/c/dawn/+/99001

Fixed: tint:1642
Change-Id: Ia5d7e45dc3de5de8303a2f161c9bf365227f9b5e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101068
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-09-02 16:48:32 +00:00
Stephen White ae4d073b49 Revert "Skip tests about writeonly storage texture In render pass on ANGLE"
This reverts commit d144805688.

Reason for revert: offending ANGLE problem should be fixed now

ANGLE bug was fixed here: https://chromium-review.googlesource.com/c/angle/angle/+/3790473

Original change's description:
> Skip tests about writeonly storage texture In render pass on ANGLE
>
> StorageTextureTests.WriteonlyStorageTextureInFragmentShader and
> StorageTextureZeroInitTests.
> WriteonlyStorageTextureClearsToZeroInRenderPass starts to fail on
> the bots after the latest roll of ANGLE, so we have to temporarily
> suppress them.
>
> Bug: dawn:1503
> Test: dawn_end2end_tests
> Change-Id: Id8abf7c0a5bd30e5de12c838f871e1ab896ab4fd
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97127
> Reviewed-by: Ben Clayton <bclayton@google.com>
> Kokoro: Kokoro <noreply+kokoro@google.com>
> Commit-Queue: Ben Clayton <bclayton@google.com>

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

Bug: dawn:1503
Change-Id: I339eb503b2f8156899b7db3358c9948d58de308d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101066
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-09-02 14:05:20 +00:00
Ben Clayton 8b30ca3efa tint/transform: Fix FoldTrivialSingleUseLet for abstracts
If the let initializer was an abstract numeric that was implicitly materialized to a concrete type, then we could inlining the initializer into the use without the implicit materialization cast.
This could lead to validation errors, and subtly different results in the program.

In this situation, add an explicit cast to keep the types the same before and after inlining.

Fixed: tint:1664
Change-Id: Icca980cf8af74673906ad6c681a6b07d0c1932fd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101160
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-09-02 13:58:00 +00:00
Robert Stewart 188be384f7 spirv-reader: UnwrapRef on image coords
The coordinate value may have been hoisted into a 'var'.
So when inspecting the coordinate type, UnwrapRef first.

Fixed: tint:1646
Change-Id: I713018e1dc37d820fdda5694fa214db84cad8ac3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101067
Kokoro: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: David Neto <dneto@google.com>
Auto-Submit: David Neto <dneto@google.com>
2022-09-02 13:52:25 +00:00
Ben Clayton 648bd7b4be tint: Add TINT_REFLECT() & ForeachField()
This uses template and macro magic to reflect the fields of a class.

Dawn:
* Reflect the fields of the types that are used by Dawn's stream::Stream<T> specializations, and use tint::ForeachField() to call StreamIn().

Fuzzers:
* Replace tint::fuzzers::DataBuilder::BuildImpl<T> specializations with the new reflection system.
* static_assert that the type is either POD or reflected. Add a specialization for std::optional which was missing.

Move tint::transform::BindingPoints into MultiplanarExternalTexture, as this is only used by MultiplanarExternalTexture.

All this reduces fragility of the struct declarations slipping out of sync with the uses.

Bug: tint:1640
Change-Id: I08729c1c356f1b427e85983efe3c2678fc2ce717
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101001
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
2022-09-02 11:40:19 +00:00
Ben Clayton 657e61d43d tint: Add and use new Std140 transform
This transform breaks up matNx2<f32> matrices used in uniform buffers
into column vectors, which fixes std140 layout rules.

Used by the SPIR-V and GLSL backends.

Re-enable tests that were disabled for these cases.

Bug: tint:1632
Change-Id: I596d016582b4189a0b413d762b3e7eabd3504b22
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100907
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
2022-09-01 22:12:19 +00:00
dan sinclair 644d23b3f8 Update sample code WGSL.
This CL fixes up the sample code to use ',' instead of ';' for
struct members. This allows the Animometer and ComputeBoids samples
to execute again after the Tint change.

Change-Id: I96fae4fe3b96b0a6cc596edfd73013f2aa6ef0da
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101060
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-09-01 18:19:19 +00:00
Ben Clayton 655db07022 tint/sem: Rename sem::Manager to TypeManager
This used to live in a `type` namespace, and wasn't prefixed when types were moved to sem.

Change-Id: Ic7a08c2fb40aff034247524c755d9f66157e4da2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101000
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-09-01 17:35:39 +00:00
Antonio Maiorano c20c5dfb4a tint: Implement const eval of binary multiply
Bug: tint:1581
Change-Id: I70ff40ed4d8faf0a665824fef936ffbafb3f0948
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99362
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2022-09-01 14:57:39 +00:00
Ben Clayton 2b47c21640 tint/sem: Add Find() to the type manager
Lets you lookup a type without modifying anything.

Change-Id: I7a37d37f1c49c7f37f96c35b8e73a66743d9000a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100906
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-09-01 09:15:20 +00:00
Zhaoming Jiang 426b47e481 tint: add missing F16 conversion expression support
This CL add missing type conversions for f16, especially for SPIRV
backend which require special handling. A transform,
VectorizeMatrixConversions, are also added for SPIRV to replace a matrix
conversion to a matrix construction with converted column vectors.
Unittests for the transform and SPIRV writer, and end-to-end tests for
all conversion rules are added.

Bug: tint:1473, tint:1502, chromium:1356215
Change-Id: Iaff125e5dd295d35c4ab74757eb56b642802a51a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100483
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-09-01 03:08:20 +00:00
Brandon Jones 0df4e4aea3 Disabled Swiftshader for Android Builds.
Currently fails to build with the following error:

../../third_party/swiftshader/src/Vulkan/VkImage.hpp:24:11:
  fatal error: 'vulkan/vk_android_native_buffer.h' file not found

Bug: dawn:286
Change-Id: I7daa992ba775621524ae936e9fa6ed4ee8a5727a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100940
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Brandon Jones <bajones@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2022-09-01 00:04:39 +00:00
Ben Clayton 0c7c23b9c4 tint: Misc hash / container contract improvements
Add a hash implementation to tint::Number.
Add a utils::Hasher specialization for std::variant.
Add an operator!= for Vector. Needed for std::variants.
Drop the need for explicit on Vector constructors from refs.

These all help general usage with STL and util containers.

Change-Id: I1e594edf532e78f531062c534dacaee7616cded5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100905
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-08-31 23:51:48 +00:00
Ben Clayton 6a17e33f3d tint/writer: Remove spirv::Operand hasher
It's not used any more. utils::Hasher is specialized for vectors.

Change-Id: Ic7c6978ae1f54b608b4dba98abeac077c1be9567
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100904
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-08-31 23:51:18 +00:00
Ben Clayton b04d992f83 tint/utils: Fix Hashmap::GetOrCreate() for map mutation in create
Its not unreasonable for the create callback to mutate the map. If this
happened, the map would be corrupted.
This change fixes this.

Change-Id: I2bb3820061c741c6da36ebe3667cb6b878515a27
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100903
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-08-31 23:15:38 +00:00
Antonio Maiorano b6d524380e tint: Improve resolver test helper to specify more than one expression arg
Bug: tint:1581
Change-Id: Ie77c56c15a5965b20008036cd99a81cbabd86988
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100340
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-08-31 22:59:08 +00:00
Ben Clayton cd716e6f01 tint::CloneContext: Use Hashmap::Generation()
Instead of tracking its own generation.

Change-Id: Iea9710fd6665cfc13fb72741b8a80c6dde4f64e9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100902
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-08-31 19:43:48 +00:00
Ben Clayton 4e0335c5af tint/utils: Add Generation() to Hashmap and Hashset.
Useful for knowing if you have to look up an entry again since the last
lookup.

Change-Id: Ib0374627ef5cd7fcff7fa2d9e72b4214260b2df3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100901
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
2022-08-31 19:04:28 +00:00
Brandon Jones 4d67a883b6 Implement maxBindingsPerBindGroup limit
Bug: dawn:1523
Change-Id: Ifcf83f6836a5d7ed447080ccb033e4163970432e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100706
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Brandon Jones <bajones@chromium.org>
2022-08-31 17:01:58 +00:00
Antonio Maiorano ff0295ebd8 tint: Fix AInt -> AFloat implicit conversion from construction
Bug: tint:1581
Change-Id: I8c6a1e375130ab38ef52cb0d8dddaca03cc098da
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100800
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-08-31 13:48:41 +00:00
dan sinclair 5361d9e778 Convert @id to an expression.
This CL updates the @id AST nodes to store an expression instead
of a literal value. This is in anticipation of the parser updates
for ID expressions.

Bug: tint:1633
Change-Id: I4dd626007dd1f9093999a0236e220ffdbc9e62db
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100760
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-08-31 13:39:48 +00:00
jchen10 fb2c8fb6a1 Enable gbm VideoViewsTests
When writting texels into the mapped texture, we need to take
'stride' into consideration.

chromium:1258986

Change-Id: Icc892d4ce324539e6280307d1699599d59204a9d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100480
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Jie A Chen <jie.a.chen@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-08-31 01:16:47 +00:00
Ben Clayton 54bcbdbbf3 tint/resolver: Fix intrinsic table matching of AInt as AFloat
An AInt argument can be passed to a parameter of type AFloat.
Fix the matcher for AFloat so that it includes AInts.

Change-Id: I6aeebb567b6176b146920a2035f09cd07c11c014
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100780
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-08-31 01:06:28 +00:00
Corentin Wallez ef8b50f9d2 Suppress an additional OOM allocation test on M1.
Bug: dawn:1506
Change-Id: I0ebd89c17284ff724a5cf8b875fbb01d2366f3e5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100703
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2022-08-31 00:49:18 +00:00
dan sinclair 7b332abc82 Remove cmake visibility flags.
This Cl removes the visiblity flags from the CMake file. In both
Debug and Release mode on OSX setting these flags caused piles
of warnings about mis-matched visibility settings throughout the
third_party libraries.

This CL fixes that by removing the flags. This maynot be the right
way to fix this, but it does fix the warnings. We need to decide
if we want to hide symbols by default and, if so, figure out how
to fix the downstream projects.

Change-Id: I8ee7422cfa2aec3715dba226da58e974f39e0d18
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100420
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-08-30 20:42:48 +00:00
Corentin Wallez 1105ec78fe Merge DAWN_FORMAT_VALIDATION_ERROR in DAWN_VALIDATION_ERROR.
Done with changes to Error.h and the following command:
git grep -l DAWN_FORMAT_VALIDATION_ERROR | xargs sed -i "" "s/DAWN_FORMAT_VALIDATION_ERROR/DAWN_VALIDATION_ERROR/"
then fixing compilation errors in ErrorTests.cpp, Pipeline.cpp and
CommandEncoder.cpp.

Bug: dawn:563
Change-Id: I081a514d662e81f4842b6d7fadfcea67c12720d6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100468
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2022-08-30 13:39:47 +00:00
Corentin Wallez 1eb6d2dd02 Convert a few remaining DAWN_VALIDATION_ERROR.
There are still DAWN_VALIDATION_ERROR occurences left but they don't use
any format string so it is fine to merge DAWN_FORMAT_VALIDATION_ERROR
into DAWN_VALIDATION_ERROR in follow-up CLs.

Bug: dawn:563
Change-Id: Ic1ba1de44216b36ef6a972712b957685e0ee193e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100467
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-08-30 13:33:37 +00:00
Corentin Wallez 7143450998 Remove support for snake_case wgpu::Features.
Chromium has been updated so the fallback is no longer needed.

Bug: dawn:550
Change-Id: I25b054617fc054926e0eb850229f244ddc51bb61
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100470
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2022-08-30 01:00:50 +00:00
Corentin Wallez 5fee3f93aa Remove ToSampleTypeBit as it is unused.
Bug: dawn:527
Change-Id: I09ce1e7e30b7d1329e3e42db9308f7220199cdd8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100469
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-08-30 00:57:33 +00:00
Corentin Wallez 59b2ccc09a Remove TODO that's already done.
Bug: None
Change-Id: Iee58a385868e46879bb003b7e1fa8b39e9812fc3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100471
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-08-30 00:51:30 +00:00
Loko Kung 3a53edcf18 Promote LoseForTesting to ForceLoss device so that user agents can use.
Bug: chromium:1356738
Change-Id: I348837ad4224124d9adba1ecf69a05b2060760c9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100566
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Loko Kung <lokokung@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2022-08-29 22:33:50 +00:00
dan sinclair be4c9f48aa Convert @group to an expression
This CL updates the group attribute to store an expression
instead of a single value. The parser always produces an
IntLiteralExpression at the moment.

Bug: tint:1633
Change-Id: Ice05c26d652c7f5c21825f745f270e96e3d88e08
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100441
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-08-29 21:22:31 +00:00
dan sinclair f9b831c39a Convert @binding to an expression
This CL updates the binding attribute to store an expression
instead of a single value. The parser always produces an
IntLiteralExpression at the moment.

Bug: tint:1633
Change-Id: I14b2a61b5bcdea66e9e24df7afbb55fb60be785e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100440
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-08-29 21:13:00 +00:00
Antonio Maiorano cbe8b36256 tint: spir-v reader: add support for GLSLstd450Determinant
Bug: tint:1061
Change-Id: I18f6d0726c2fac192b8893f35dcbf45bf4a3d752
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100466
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-08-29 20:52:00 +00:00
Austin Eng c165937955 Return false from IsDeviceIdle if there are pending callback tasks
Fixes a race where async pipeline compilations could never see their
callbacks called because Chromium stopped calling device.Tick().

Fixed: dawn:1527
Change-Id: I273409d427ef02a7a6817647eb38564adfdf0da8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100565
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Loko Kung <lokokung@google.com>
2022-08-29 18:46:10 +00:00
Corentin Wallez bc93cbc2a2 Correctly print backend type in DiscoverAdapters logs.
Bug: chromium:1348664
Change-Id: Id2eaf25a9f46b1f6614d80642dc7f8e8aef09b9e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100520
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2022-08-29 16:38:39 +00:00
Yunchao He 81d62d7ca9 Texture corruption issue: add tests for a few rendering types
The original tests for texture corruption only contain WriteTexture
and B2TCopy, this change adds more write types like rendering a
constant color, rendering from texture sampling, and rendering
from textureLoad, all of which need a render pipeline and shaders.

The new tests manifest that:
For a given 2d-array texture dimension, if WriteTexture and B2TCopy
fail, rendering, sampling and textureLoad also fail, and vice versa.

Bug: dawn:949, dawn:1507

Change-Id: I28035fe3dd84d36c01befd7fd8ff9d78b312446a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100061
Commit-Queue: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-08-26 21:23:47 +00:00
Ben Clayton 92943b2831 dawn: Fix unreachable code warning
Change-Id: I98fd18b4747365c6474dc1ca1f9003464d171ec7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100580
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-08-26 20:52:53 +00:00
Jiawei Shao 8b99a54b26 Call ExecutePendingCommandContext() in ExternalImageDXGIImpl::Destroy()
Before destroying ExternalImageDXGI we should execute all the pending
commands before calling NextSerial(), or the device will be lost as
the CommandAllocator will be destroyed before the pending commands are
executed.

Bug: dawn:576
Test: dawn_end2end_tests
Change-Id: I6e291586cd78a7e0feaf2f8dfee87a289ec27f77
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100100
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2022-08-26 03:08:28 +00:00
Corentin Wallez 667db19838 Build with -Wextra-semi
Bug: chromium:1355871
Change-Id: Id6c9774e7f7a86837f02cddfea0b36724e7c609e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100343
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-08-25 13:17:31 +00:00
dan sinclair 7517e213cf Update `workgroup_size` to use `expression`.
This CL updates the `workgroup_size` attribute to use `expression`
values instead of `primary_expression`.

Bug: tint:1633
Change-Id: I0afbabd8ee61943469f04a55d56f85920563e2da
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99960
Reviewed-by: Ben Clayton <bclayton@chromium.org>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-08-24 21:31:45 +00:00
dan sinclair 436b4a2bd0 Drop `maybe_` from method names.
With the old grammar elements removed, rename the new elements and
drop the `maybe_` prefixes.

Bug: tint:1633
Change-Id: Iafe223546f8af1ddd8a4b60572a106160a226b72
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99921
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-08-24 19:11:55 +00:00
dan sinclair 202362f47d Convert to new expression grammar
This CL moves all the grammar rules to use the new
`maybe_expression` rules. All of the old `expression` rules
are removed.

Bug: tint:1633
Change-Id: I29637a4c6fcd200650a2b57011b6539c66be942a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99920
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-08-24 18:05:26 +00:00
dan sinclair acdf6e1a53 Remove `ast::VariableBindingPoint` in favour of `sem::BindingPoint`.
This CL removes `VariableBindingPoint`. The `Variable` object has a
`has_binding_point` method added which returns true if there is
_both_ a `Group` and `Binding` attribute. Code has all been updated
to use the `sem::BindingPoint` which is populated during the resolve.

Bug: tint:1633
Change-Id: I79a0da662be61d5fb1c1b61342ab239cc4c66809
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100240
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-08-24 15:47:25 +00:00
Tom Anderson a85290b909 Fix build with -Wextra-semi
Change-Id: I48b8ca89dfe90e138fb6d9c00a69353a05f19cd2
Bug: chromium:1355871
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100241
Auto-Submit: Tom Anderson <thomasanderson@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Brandon Jones <bajones@chromium.org>
Commit-Queue: Brandon Jones <bajones@chromium.org>
2022-08-24 00:03:35 +00:00
Ben Clayton 93c2d559a1 tint/utils: Default to using Hasher instead of std::hash
STL std::hash<T*> implementations have a tendency of just reinterpreting the
pointer as a size_t. This is fast, but produces a bad hash, as most pointers
tend to be 4 or 16 byte aligned. The lack of entropy in the LSBs causes
clustering of hashmap slots. Use tint::utils::Hasher to get better hashes.

Change-Id: Ife768d573cd1875e746ca9d77a4ac19e43b06aca
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99281
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-08-23 19:09:34 +00:00
Ben Clayton 18dc315ccb tint::CloneContext: Use utils::Hashset and utils::Hashmap
For fewer heap allocations, faster lookups.

Also use a generational counter to cache `ListTransforms` map lookups between clones. Reduces repeated map lookups in super-hot code.

Change-Id: I34865bb39c756129be845b1eb6255ce436e275f7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99280
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
2022-08-23 18:38:35 +00:00
Ben Clayton b90b6bff1d tint: Minor no-op cleanup changes
Change-Id: I91ad6044e7809ed2deab0fbd4417da90c7870d81
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99705
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-08-23 16:23:05 +00:00
Ben Clayton e3f2005b2d tint/utils: Cleanup & optimize hash utilities
Do less work for single-value hashes.
Specialize pointer hashing to improve hash quality.

Change-Id: I2f3839d15754543735728814c7f54a5e7ac81569
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99282
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
2022-08-23 16:10:35 +00:00
Ben Clayton e5d337171a tint: Castable - optimize IsAnyOf()
`HashCodeOf()` sets two bits in the mask to `1`.
We can check for two bits set, after masking, to quickly eliminate impossible Is() tests.

Change-Id: I8d9c1ece87b714e83bd292d02e02274d42e143ef
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/92664
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-08-23 15:39:15 +00:00
Ben Clayton cdcc85973b tint: Clean up AddSpirvBlockAttribute
* Walk the sem type list, instead of all AST nodes to just find the
  types.
* Walk the AST global list, instead of all declarations, then filtering
  to globals.
* Use the ast::IsHostSharable() helper where possible.
* Only lookup the sem node once instead of twice, per global.
* Use the new utils::Hashmap and utils::Hashset containers instead of
  std::unordered_map and std::unordered_set.

Change-Id: Idb47c855ae9dfd27515774a89cedb7ed06e07035
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100140
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-08-23 14:30:24 +00:00
dan sinclair 4964d9bc20 Convert `@align` to hold an expression.
With the updated WGSL grammar the `@align` attribute takes an
expression instead of a value. This CL updates the internal data
structures to store an expression instead of an integer value.

The parser still only parses integers, they're just turned into
`IntLiteralExpressions` at the moment.

Bug: tint:1633
Change-Id: If34901798ed6ceaced354bc06ae9b6df875b700e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99980
Reviewed-by: Ben Clayton <bclayton@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-08-23 13:28:44 +00:00
dan sinclair 64b09959f7 Update `type_decl` and `primary_expression`
This CL updates the `type_decl` and `primary_expression` rules
to the new WGSL grammar.

Bug: tint:1633
Change-Id: Ifc457e01f43fe33e083fc8f9e316fdd02bfd87c3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99881
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-08-22 19:42:14 +00:00
dan sinclair 08d735e6a9 Add missing relational_expression.post.unary_expression checks.
This CL adds the missing checks and tests for `==` and `!=` into
the `relational_expression.post.unary_expression` grammar elements.

Bug: tint:1633
Change-Id: Ib5fbb42994ea12af133ca531989421fddc2393f2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99940
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-08-22 19:23:24 +00:00
dan sinclair a838e34954 Handle peeking past placeholder elements.
Currently when peeking, if there is placeholder then anything after
the `peek(0)` will be off by 1 position as the placeholder will
end up included in the index count.

This CL updates the peek routine to correctly skip over any
placeholder element between the current index and the requested
peek token.

Bug: tint:1633
Change-Id: Idd2905cc3b9c0a0dcbbcc94c0f6dd349b569ec3e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99900
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-08-22 19:19:44 +00:00
dan sinclair 393de082d3 Add `mat_prefix`, `vec_prefix`, `callable` and `type_decl_without_ident`
This CL adds the `mat_prefix`, `vec_prefix`, `callable` and
`type_decl_without_ident` constructuctions.

Bug: tint:1633
Change-Id: Id1fb0417f522b7da2ac6bd4441d17b0a35ae5f14
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99880
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-08-22 16:15:04 +00:00
dan sinclair 9284f8ab55 Add test for let with complex constructor
This CL adds a let unittest with a complex constructor. The test
verifies the entire statement is parsed.

Bug: tint:1633
Change-Id: I56bb7c009efb5668aa41c9b7ec80dcde65c4ec40
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99863
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-08-22 16:02:19 +00:00
dan sinclair 96a7d5a6bd Add some parenthesis.
With the upcoming expression changes we need to put parenthesis around
boolean expressions which mix `&&` and `||`.

Bug: tint:1633
Change-Id: I7a304e5a23998d9977630c2d4466312be7ae169e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99862
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-08-22 15:59:34 +00:00