This CL removes the following AST nodes:
* ast::Array
* ast::Atomic
* ast::Matrix
* ast::MultisampledTexture
* ast::Pointer
* ast::SampledTexture
* ast::Texture
* ast::TypeName
* ast::Vector
ast::Type, which used to be the base class for all AST types, is now a
thin wrapper around ast::IdentifierExpression. All types are now
referred to using their type name.
The resolver now handles type resolution and validation of the types
listed above based on the TemplateIdentifier arguments.
Other changes:
* ProgramBuilder has undergone substantial refactoring.
* ProgramBuilder helpers for type inferencing is now more explicit.
Instead of passing 'nullptr', a new 'Infer' template argument is
passed.
* ast::CheckIdentifier() is used for more tests that check identifiers,
including types.
Bug: tint:1810
Change-Id: I8e739ef49435dc1c20a462f3ec5ba265661a7edb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/118723
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>
Will be generated for expressions that resolve to functions.
Bug: tint:1810
Change-Id: I334729c9499be7b1c4ab229c1845a4d5f06fa107
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/119701
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
This patch adds the support of the optional feature "bgra8unorm-storage"
on D3D12 when the platform allows using DXGI_FORMAT_B8G8R8A8_UNORM as
UAVs.
According to D3D12 documents, enabling the flag
D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS when creating textures requires
"either the texture format must support unordered access capabilities at
the current feature level. Or, when the format is a typeless format, a
format within the same typeless group must support unordered access
capabilities at the current feature level".
Bug: dawn:1641
Test: dawn_end2end_tests
Change-Id: If16271b5da52423e73ad4f7ba258af83dbf66dd2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/119345
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
This patch implements the optional feature "bgra8unorm-storage" on
Vulkan. As SPIR-V doesn't support 'bgra8' as a valid image format,
we have to create an image view with RGBA8Unorm format on the
BGRA8Unorm texture when we want to use it as a storage texture.
Bug: dawn:1641
Test: dawn_end2end_tests
Change-Id: I4aeea96ae872fe4e6367c535afb6ab896b952453
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/118021
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>
This test sees flaky failures.
- Check the entire checkerboard texture contents to get more
information.
- Add a test which uses seperate sampling states to see if DX12
driver has difficulty sampling multi-planar formats using a
single sampler.
- Also, double check support for the NV12 format in case
something in the driver flakily exposes support.
From https://dawn-review.googlesource.com/c/dawn/+/47660
Bug: dawn:733
Change-Id: I766907ff648f1dc35387902a70c3fb65debcaecd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/119343
Commit-Queue: Austin Eng <enga@chromium.org>
Kokoro: Austin Eng <enga@chromium.org>
Reviewed-by: Shrek Shao <shrekshao@google.com>
These textures still have some outstanding issues on both Intel and AMD,
where the wrong subresource can be read from.
Zero-initialization workarounds have been enabled to ensure that even
when the wrong subresource is read, uninitialized data is not read.
Bug: dawn:704, dawn:791, dawn:838
Change-Id: Ib118eff0c5ed5e7812fa70e88ece5317c1af13b0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116849
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Adds a basic adapter blocklist and adds two cases to it.
By default, the blocklist is disabled until Chromium can enable it
explicitly - perhaps based on --enable-unsafe-webgpu or some other
flag. It will be switched to default to true in the future.
about://gpu would disable the blocklist so all the adapters are
visible there, but WebGPU would enable it. Trusted users of Dawn
that are aware of potential bugs may also disable it.
One downside is that about://gpu won't surface directly that an
adapter is on the system, but blocklisted for WebGPU. Something
like that can be added in the future, if necessary.
In the future, this should probably be merged with Chromium's
software_rendering_list.json, but that list doesn't support
multi-adapter systems well (for blocklisting just one adapter),
and it doesn't understand all the information we need for the
current blocklist.
Bug: dawn:1254, dawn:1196, tint:1753
Change-Id: I992bcd10dd5d3f5b23319fc4ec699b06bb1117da
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/119061
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Still a missing condition to enable timestamp period calculation at
device initialization on Metal.
Refactor GPUTimestampCalibrationTests.cpp to check timestamp query
correctness on both D3D12 and Metal backends.
Bug: dawn:1193
Change-Id: I69feeaea0df309e15c008647d76b11899dcdc727
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/119320
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Hao Li <hao.x.li@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This patch adds the support of the optional feature "bgra8unorm-storage"
and enable it on Metal.
Bug: dawn:1641
Test: dawn_end2end_tests
Change-Id: Id58cefd8735f46b8d1807376ebcfada10df2890e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111380
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
To avoid uninitialized reads of depth stencil data, where the Metal
driver incorrectly binds/loads the wrong depth stencil subresource,
always keep all depth stencil subresources initialized. This means
that textures are initialized on creation, and StoreOp::Discard is
never used - Store is used instead.
Texture initialized state is still set as-if the Discard occured, so
Dawn will try to zero-initialize the subresource if it is read from.
In many cases, this will work correctly, and the application will
read back 0, as expected. In some cases, Metal will bind the wrong
subresource, and the previous contents will be read. This is wrong,
but at least it is not uninitialized data.
Bug: dawn:838
Change-Id: I3cc87073d52de60283e3b683bbee7809db803018
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/119344
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Shrek Shao <shrekshao@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Instead use ast::TypeName.
Also improve the validation and diagnostics around providing template
arguments to types that do not accept them.
Bug: tint:1810
Change-Id: I4241d50ce0425ab721157686889e918993482876
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/119284
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
This CL refactor the logic adapter creating device toggles set when
creating device and the way device holding its toggles. This CL also
introduce the concept "toggle stage", currently "device stage" only but
in future will add "instance stage" and "adapter stage" for instance and
adapter toggles. No changes on Dawn API.
More details:
1. Introduce `TogglesState` objects that represent the complete toggles
state of a device (and will used for instance and adapter in future).
2. When creating a device, adapter set up a TogglesState object for it
in `AdapterBase::CreateDeviceInternal` and
`Adapter::SetupBackendDeviceToggles`, no other place would change
the device's toggles state. This change simplify the logic.
3. Introduce the `ToggleStage` enum for every toggle and `TogglesState`
object. Currently we only have `Device` toggle stage, but in future
will have `Instance` and `Adapter` for instance and adapter toggles.
Bug: dawn:1495
Change-Id: Ifafac6a6a075b5b9a733159574ae5b6d4f3ebde9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/118030
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
Instead use ast::TypeName for all of these.
Bug: tint:1810
Change-Id: Ie51a69bf40648a9da73c0a1de2cd96a93d4eac76
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117892
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Tint used to validate that type initializers and conversions were not
used as statements. The WGSL specification has been recently updated to
allow this, but Tint requires more work to correctly handle these as
statements.
For now, restore the validation.
Bug: tint:1836
Bug: chromium:1414489
Change-Id: I9f6aabece26c30b0a0d789ae0dfa10d6f43ee4dc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/119360
Commit-Queue: Ben Clayton <bclayton@google.com>
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@chromium.org>
Dawn was using a hard-coded constant for the Windows SDK version number
but that makes upgrading the Windows SDK to build Chromium impossible.
This change uses the newly created $windows_sdk_version to solve this
problem.
This new variable was added in crrev.com/c/4234366
Bug: tint:1719
Change-Id: I6a9f74f542d3517c046d74178a41e1e4d5887e7f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/119340
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Change Resolver::Expression() and Resolver::Identifier() to return a
sem::Expression instead of a sem::ValueExpression.
This is required as IdentifierExpressions may resolve to non-values.
Handle expressions that resolve to types, when they are expected to
resolve to a value.
Bug: tint:1810
Change-Id: I1cb069e3e736fc85af7bc395b388abe153b1f65a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/118500
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Take advantage of the fact that all AST nodes now use an
`ast::Identifier` instead of directly using Symbols.
This will be important for ensuring that un-keyworded identifiers will
be preserved.
Bug: tint:1810
Change-Id: If5c3e9f00b4c1c14a6f11bd617bd8b895250fb7e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/119285
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
A bunch of template magic to recursively test that an identifier (and
template arguments) matches the given values. Will be heavily used for
AST and parser tests.
Bug: tint:1810
Change-Id: I8d83090352c345f0ce1ac7840e163eea96eac8a2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/119124
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
The goal here is to have all AST nodes use an identifier instead of
symbols directly. This will greatly simplify the renamer transform,
and gives the symbol a Source location, which is helpful for
diagnostics and tooling.
Change-Id: I8b3e05d05886c6caa16513a5cfb45d30f7a8d720
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/119283
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Ben Clayton <bclayton@google.com>
Variable::name is an ast::Identifier.
The goal here is to have all AST nodes use an identifier instead of
symbols directly. This will greatly simplify the renamer transform,
and gives the symbol a Source location, which is helpful for
diagnostics and tooling.
Change-Id: I71fe3e8df3d22b12d4a3430c41f236ddf5bc0b9e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/119282
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
StructMember::name is an ast::Identifier.
The goal here is to have all AST nodes use an identifier instead of
symbols directly. This will greatly simplify the renamer transform,
and gives the symbol a Source location, which is helpful for
diagnostics and tooling.
Change-Id: I1156653a48b02997ec0a9077b174401f65a13457
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/119281
Kokoro: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Function::name is an ast::Identifier.
The goal here is to have all AST nodes use an identifier instead of
symbols directly. This will greatly simplify the renamer transform,
and gives the symbol a Source location, which is helpful for
diagnostics and tooling.
Change-Id: I723a9a104668758db2cb32051efa1f6d3c105913
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/119280
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Add scaffolding for structured Dawn wire fuzzer.
This CL contains a basic fuzzer for Dawn wire server
that shows some simple design ideas:
1) A basic protobuf spec that is generated using dawn.json
2) conversion from protobuf message to a dawn wire server
command.
This is not the complete implementation and serves as a
foundation for the fuzzer so that subsequent CLs will be
easier to review.
Bug: chromium:1374747
Change-Id: Ife1642dda13d01d3308bdd5fe56cf85978399fd3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/109406
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Brendon Tiszka <tiszka@chromium.org>
Add ResolvedIdentifier to hold the resolved AST node, sem::BuiltinType
or type::Builtin.
Reduces duplicate builtin symbol lookups in Resolver.
Bug: tint:1810
Change-Id: Idde2b5f6fa22804b5019adc14c717bebd8342475
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/119041
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Instead of having the stride be yet another integer argument, make the
stride explicit by adding an attribute list parameter. This is more
consistent with other nodes.
Bug: tint:1810
Change-Id: I916d810f29afd172b878ded48b6701e8b299b13f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/119040
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
- Removes remaining usages of the values in Dawn and removes tests.
- Note that the values will be removed from the JSON entirely in
follow up CL after Chromium side changes.
Change-Id: I30ccb3c412cd97047065ad515f6a5ff4de642420
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117593
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Loko Kung <lokokung@google.com>
This belongs on Block(), not Func().
Also make Func() smarter about the `body` argument, allowing the caller
to pass an ast::BlockStatement*, ast::Statement* or nullptr.
Change-Id: I8ac6c1598b37f2a94615b452c5eb37671b4305fa
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/118982
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
WGSL does not have a void type. Functions that do not return a value
simply omit the return type from the function signature.
Change-Id: Id45adc008dce46115552e7dc401a2e27ae10eeb4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/118981
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
Once all ast::Type derived classes are removed, there will be no
distinction between a type initializer / conversion and a function call.
Bug: tint:1810
Change-Id: Ic10fd1a0364a564d24dbe2499af0f1424641596c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/118980
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
This patch adds a workaround on Intel Gen9.5 and Gen11 GPUs to always
allocate renderable 2D textures as committed resources instead of
placed resources to mitigate a driver bug about CreatePlacedResource().
Bug: dawn:1628
Change-Id: I38062115d94933bd58e571c812ff6888e9781df6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100640
Commit-Queue: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
These will include the builtin language types.
Bug: tint:1810
Change-Id: I695a9ee833e1035eb1d17913d709038ae4c561d8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/118502
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
With this CL, GL backend and other backends will use the similar way
to track buffer usage, so the GL MapAsync(Write) will not synchronize
GL commands anymore.
Change-Id: I9f8dfeb58faaed09ed62550371a30a680cd607d5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/118140
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Peng Huang <penghuang@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
This avoids the need to pass the `use_runtime_semantics_` flag at each
callsite.
Change-Id: I2cce3f147226e1295b5dfa0239beeacd519d5bb4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/118641
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Add a flag to resolver::ConstEval to turn all overflow and range
errors into warnings, and return a valid (usually zero) value instead
of utils::Failure as defined by the WGSL spec for expressions
evaluated at runtime.
Change-Id: Icdce512306aabe717591134a1b4ba2d9c668f29c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/118640
Commit-Queue: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
This CL adds a second command `tint_info`. The `tint_info` command can
be used to dump information about a WGSL program to the console. This
includes things like the inputs and outputs to an entrypoint along
with structure information like offsets and alignments.
Bug: 1825
Change-Id: Ia2fb4be08b39c1a592f78a388d34edf9af8b6a0e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/118643
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
A new base class for sem::ValueExpression, which other types of
expression can derive from.
Example: sem::TypeExpression - an expression that resolves to a type.
Bug: tint:1810
Change-Id: I90dfb66b265b67d9fdf0c04eb3dce2442c7e18ea
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/118404
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
New base class to IndexAccessorExpression and MemberAccessorExpression.
Simplfies code that operates on both of these.
Change-Id: I02ce2e8180d7c1836f0b4d8e629e707e19e3539e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/118403
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
ast::IdentifierExpression may also resolve to a type or core enumerator
Bug: tint:1810
Change-Id: I85e3bea67e1146215079ec47430784f2fb39043d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/118402
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Add a chained struct for Dawn-specific options for SPIR-V ingestion to
contain this new flag.
Bug: tint:1890
Change-Id: I1332ff20c91f29a84c21550a37f11bc7d9c956ce
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/118421
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
This CL make vulkan adapter checks essential Vulkan extensions and
features in InitializeImpl rather than InitializeSupportedFeaturesImpl.
This change makes InitializeSupportedFeaturesImpl never result in Error
for all backend, and this CL change the return type of
InitializeSupportedFeaturesImpl from MaybeError to void.
Bug: dawn:1495
Change-Id: If59c5aa5281776226c157451ee5119052d33ac24
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/118031
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Rename the type_name() method with operator().
`ty.type_name("blah")` becomes `ty("blah")`
Change-Id: Ia0b2bc304e7bb208c2e40a469332044b394535d9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/118401
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Ben Clayton <bclayton@chromium.org>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Will be used to replace all type identifiers that take templated arguments.
Bug: tint:1810
Change-Id: I31ad8dc4826375a783143cc33f336d8a4860613c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117893
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Ben Clayton <bclayton@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Consistency with the other AST nodes.
Change-Id: I8db3d237c27fea44c80101ed3d24b62832d45c18
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/118360
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Reviewed-by: James Price <jrprice@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Ben Clayton <bclayton@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Instead of ast::IdentifierExpression.
The name is not an expression.
Fixed: tint:1257
Change-Id: I3161d20f584bfedf730b9257233f9dfcb064298a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/118344
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>
Kokoro: Ben Clayton <bclayton@google.com>
When calling the generated helper, the column and row arguments were
swapped.
Improved the unit tests to actually show this, rather than passing in a
single value for both column and row.
Bug: tint:1824
Bug: tint:1333
Change-Id: I32a92dec5e594dabd9d8d2b08474c0d6f3645520
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/118420
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Instead of ast::IdentifierExpression
The member is not an expression, but a name.
Fixed: tint:1257
Change-Id: I879ddf09c3e521a18cef85422bb2f8fe78cddf5b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/118343
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
The additional nesting is somewhat unfortunate for pointer
indirection overhead, but this simplfies logic like
transform::Renamer, which can continue to find all the
identifier nodes in the program.
Bug: tint:1257
Change-Id: I8d51dd80dc4c51ef59238959029b8511f1edf70d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/118342
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Change-Id: I4706e517608d436fa646537fec9e930ae47d1c40
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/118029
Commit-Queue: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Loko Kung <lokokung@google.com>
Instead of ast::IdentifierExpression.
The name is not an expression, as it resolves to a function, builtin or
type.
Bug: tint:1257
Change-Id: I13143f2bbc208e9e2934dad20fe5c9aa59520b68
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/118341
Kokoro: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: James Price <jrprice@google.com>
An identifier node that is not an expression.
Will be used by:
* CallExpression
* DiagnosticControl
* IdentifierExpression
* MemberAccessorExpression
* TypeName
Bug: tint:1257
Bug: tint:1810
Change-Id: I1de719d8c570992fed08789c35ca6c4409789520
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/118340
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: James Price <jrprice@google.com>
Also for continuing blocks.
Change-Id: Ic4a5f30fc0b882f1051c4995bd2b228c5ccc6d17
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/118321
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
Reset the visited state of nodes before traversing to determine a
parameters requirements with respect to the function return value,
otherwise we may not capture a parameter->retval relationship
correctly.
Fixed: tint:1822
Change-Id: I9802a89fe1c8331b2f9dae594ccb045f339396fd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/118080
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
A derivative_uniformity diagnostic filter should not affect the
uniformity of the return value of a derivative builtin.
Fixed: tint:1815
Change-Id: I58e714978dab747598af5136dc9808a5a658c60e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/118001
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Use expect_compound_statement() in all the places that use
compound_statement in the WGSL grammar.
Handle attributes on statements inside Resolver::StatementScope, so
that the logic can be reused for the various places where block
statements are used. This will also make it easier to reuse this logic
when we allow these attributes on other types of statement in the
future.
Add an `EmitBlockHeader()` helper to the WGSL writer to reuse the
logic for emitting attributes on block statements for all the places
that use them.
Bug: tint:1809
Change-Id: Iac3bb01f5031e6134c1798ddafdad080412c8bef
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/118000
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>
Fixes T2T depth copies on Mac Intel where the destination
subresource is a non-zero mip/layer.
Fixed: dawn:1083
Change-Id: If344b46c3fd436d857906850fc0ac5ccb4b93e1d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117592
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
This fixes edge-cases, like the condition expression being a type-cast,
which DXC apparently sees as a variable re-declaration. Example:
fn foo(x : f32) {
switch (i32(x)) {
default {
}
}
}
was emitted as HLSL:
void foo(float x) {
int(x);
do {
} while (false);
}
The `int(x)` is seen as a re-declaration of `x` by DXC.
We fix this by only emitted the condition expression if it has
side-effects (which currently means it contains a call expression).
Bug: tint:1820
Change-Id: I7e4320fa09ea2d634c9e324cb0b752b0ee7dcde9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/118161
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
This workaround is needed unless the system is MacOS 13.1+
with architecture at least AMD gcn-4.
Bug: dawn:1389
Change-Id: I3a85be150a0c5ca8b0b74e4b097906f278dd3049
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/118023
Reviewed-by: Loko Kung <lokokung@google.com>
Kokoro: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Previously we were checking against a list of skipped messages using
both the pMessageIdName and pMessage from a Vulkan debug info callback.
The spec, however, indicates that the pMessageIdName may be NULL.
This change checks to see if that value is NULL before doing any further
checks, and if so always indicates that the message should not be
skipped. (No other code in Dawn references the pMessageIdName.)
See the appropriate page of the Vulkan spec for details:
https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkDebugUtilsMessengerCallbackDataEXT.html
Change-Id: Idd8bf312db31d6cea8e6ce42a47254f182b1070e
Bug: chromium:1411047
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117594
Kokoro: Kai Ninomiya <kainino@chromium.org>
Kokoro: Brandon Jones <bajones@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
When rotation metadata is added to videos by ffmpeg, it is specified as counter-clockwise. Dawn should follow this format to avoid confusion during integration.
Bug: chromium:1316671
Change-Id: I99ff30bffb1664aafd060d9a5bb1b15845388386
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117912
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Brandon1 Jones <brandon1.jones@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Works around issues on Metal Intel where CopyB2T and WriteTexture
with depth/stencil textures do not work correctly.
Fixes test failures with depth16unorm in the CTS.
Deletes UseTempTextureInStencilTextureToBufferCopy in favor of
the stencil blit. The former supposedly fixes a problem where
the stencil data is not flushed into the real stencil texture
by performing another T2T copy. This only works because the Metal
Intel backend also happens to allocate s8 as d32s8. Copying
the depth aspect as well seems to make the driver remember to
flush the data.
The stencil blit is a better fix for the problem since entirely
avoids getting the driver into a bad state where the stencil data
is not in sync.
Fixed: dawn:1389
Change-Id: If34b1d58996157036c164a5bc329e38b5e53f67a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117910
Reviewed-by: Loko Kung <lokokung@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
This CL removes support for the `sig` member in `frexp`. It is now an
error if `sig` is used, the deprecation is removed.
`fract` should be used instead.
Bug: tint:1766
Change-Id: I991544b675caf31f22c8c9472a60c77811ff4efd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117920
Kokoro: Ben Clayton <bclayton@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
- It doens't know which operator == to use when there is using
EnumClassBitmask that looks like (a & b) == 0. Instead use just
the form (a & b).
- It doesn't do automatic capture of constexpr variables in lambdas so
turn a couple constexpr into regular const.
- It (correctly) warns that if constexpr (std::is_constant_evaluated())
is always true, so remove the constexpr keyword.
Bug: None
Change-Id: If7857abd1c30acb0736557844ff13f32a19d54cf
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117888
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Corentin Wallez <cwallez@chromium.org>
This CL deprecates DawnTogglesDeviceDescriptor and replace it with
DawnTogglesDescriptor, which will be also used to provide instance
and adapter toggles with future CLs.
Bug: dawn:1495
Change-Id: I5f5cfdf38dcbcd237727a7f921462597b9301f1f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117174
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Kokoro: Zhaoming Jiang <zhaoming.jiang@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
CopyToDepthStencilTextureAfterDestroyingBigBufferTests and
DepthTextureClearTwiceTest fail on Windows Intel Raptor Lake due to the
GPU device id is not in Intel Gen12 GPU list, so the toggle
D3D12ForceClearCopyableDepthStencilTextureOnCreation is not enabled.
Change-Id: I28ec0ad2e2fa4e351077e7c74fcbdbd43d255ed3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117173
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: yang gu <yang.gu@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Add a Dawn E2E test to make sure that diagnostic controls work through
the whole shader compilation flow.
Bug: tint:1809
Fixed: chromium:1410930
Change-Id: Icea31cfadbbc182008a8a07efcddb402954dd1c7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117980
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>
Default to no-validation.
Change-Id: I4b3506e2addf580256175b13efbeb47f8ef96aaf
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117881
Kokoro: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Common:
* The turbocov build target (somehow) never got hooked up to the root CMakeLists.txt file. This is now fixed.
macOS:
* Emit coverage for 'AppleClang' compiler.
* Have run-cts find the tucked-away `llvm-profdata` executable.
Windows:
* Various fixes for building with clang
* Fix turbocov stdout CRLF corruption
* Fix bad JSON with backslashes
Change-Id: I481cceafe2e72b544e13168172fc1456e5df2005
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117880
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
It was already being rejected everywhere it should be, but now we
actually test this to make sure.
Bug: tint:1809
Change-Id: I07f1d24b12e9e41a162e0d19194d4897c33b5324
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117802
Kokoro: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>
Two diagnostic controls conflict if they have the same rule name and
different severities.
This change also allows duplicate diagnostic attributes.
Bug: tint:1809
Change-Id: I7622dd947ffa03292ad3340161688e00862d5b24
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117801
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>
Add some E2E tests to make sure that we actually produce valid code
for each backend when diagnostic filtering is present.
Bug: tint:1809
Change-Id: I5e903ac0d2ca385967211bb889f86cb85de8f418
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117590
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
This file is already in the ast/ folder, and has been marked as a TODO
to move for a while. Actually move.
Change-Id: I697ff903fc9906921e2768243bdfba581cf18d4e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117589
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
This CL is based off of https://dawn-review.googlesource.com/c/dawn/+/113561
and adds the updates into `libtint_syntax_parser_src` to allow the
resolver to build correctly when the headers are added.
Change-Id: I5d14a88111ea1bf87bb2155d066b95378163e451
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117588
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
A bad assert was causing devices that only supported Vulkan 1.0, such as
the Nexus 5X, to crash when querying information about adapter
properties and features. This change removes the need for the ASSERT.
(Note that this does not guarantee WebGPU support on Vulkan 1.0 devices.
For example, the Nexus 5X does not have the fragmentStoresAndAtomics
feature, which is required for WebGPU.)
Bug: dawn:286
Change-Id: I7f884290f29ae7e9607933f6186feac2ce8af540
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117840
Commit-Queue: Brandon Jones <bajones@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
This CL moves the ast files into a libtint_ast_src source set. Similar
to sem, the headers are duplicated into the libtint_syntax_tree_src due
to the dependencies with program_builder.
This makes the sem and ast source sets be setup the same.
Change-Id: If51fac6fab6763c4dcf729061de6ef983a94063a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117587
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
So the next MapAsync() call, doesn't need to record pipeline barrier
command into the pending command buffer, submit it, and wait for it
completion.
Bug: b/265152896
Change-Id: Ied7cbca24a7b1bc81c0a6402179452599aabfe9b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116920
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Peng Huang <penghuang@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
The fuzzer produced a shader with this format and hit an UNREACHABLE
in Dawn.
Bug: dawn:1641, chromium:1410048
Change-Id: Ia5ba66a18fc718f7e6dd803f4229ecb12b02753e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117531
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
This CL removes `libtint_core_src` and folds the dependencies into
`libtint`. Uses have been updated to require the specific libraries they
depend on.
Change-Id: I91118cc9db376c53597a8e588db654b3a4105386
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117586
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
This CL renames the source set to make it clear it does not include all
files in tint.
Change-Id: Ib37603ca8d46e2920d3f3c6d79a59a292493c3fd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117585
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
This cl moves a couple more files up to `base_src` and splits tint.cc
out to a separate `initializer` source set.
Change-Id: I65347ac182f3434a57cc49f0eeb1024f6adb52b0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117584
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
This CL extracts the inspector from libtint_core_all_src and into a
libtint_inspector_src.
Change-Id: I0b138cc2e47526b8575b6f31cc3e15fc8bd92545
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117583
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
This CL moves the constant and type headers out of the
`libtint_core_all_src` target. In order to do so a `libtint_base_src`
target is created with the bits of core_all that are required to build
constant/ and type/ along with all the util/ files.
Change-Id: Idb016f51e9dcaa84b6d7a14e4e5f62d4a46a4161
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117582
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
This will be used for suggesting alternative diagnostic rule names in
the Resolver.
Bug: tint:1809
Change-Id: Icc9af02937326f6f774fbaf2aeaa9314c88fdea6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117565
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Switch the default severity for all uniformity violations to errors.
We now have an opt-out mechanism for deriviative operations (via
diagnostic filters), and a `workgroupUniformLoad()` builtin for
compute shaders.
Bug: tint:1809
Change-Id: I666c706d6195ca0d24ead14c4709e7f646bfcc64
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117741
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
When used with the SPIR-V reader, this will insert a module-scope
diagnostic directive to suppress uniformity violations for derivative
operations.
Bug: tint:1809
Change-Id: I2305265231ccffad49461d194669ba598484e8e0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117740
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Add additional `RequiredToBeUniform` nodes for each severity
level. When processing a call to a derivative builtin, look up the
severity from the semantic info for that AST node, and add an edge to
the corresponding `RequiredToBeUniform` node.
Propagate the severities to the callsite and parameter tags for a
function that contains a builtin.
Traverse that graph from each `RequiredToBeUniform` node to look for
violations at each severity level, starting with the most severe. Only
stop the analysis if an error is found, otherwise report the violation
and keep going.
Bug: tint:1809
Change-Id: I4ac838e85da3f4fb3d63f4892dce7f12b096f74b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117602
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Each sem::Node has a map which stores the diagnostic modifications
applied to that node. The sem::Info class provides a query to get the
diagnostic severity for a given AST node, by walking up the semantic
tree to find the tightest diagnostic severity modification. The
default severity is used if it was not overridden.
This allows components outside of the Resolver/Validator to determine
the diagnostic severity while walking the AST, which is required for
the uniformity analysis.
Bug: tint:1809
Change-Id: I4caf99d7412fb22fb1183b2c8cfde349da2fefd3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117601
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Future patches will expand the places where they can be used.
Bug: tint:1809
Change-Id: I74d87ce5164119ae1351380041f9ef4b1091d854
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117571
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Push a new diagnostic filter scope at the start of resolving a
function and process function attributes immediately.
Bug: tint:1809
Change-Id: I8a7f4a29e4b7556d0721ed28c49d795c166fea00
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117568
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
The Resolver parses the diagnostic rule and sets the updated severity
in a ScopeStack, which is stored in the Validator.
Automatically generate the diagnostic rule enum and its parsing logic
using intrinsics.def.
Add a "chromium_unreachable_code" diagnostic rule to test this.
Bug: tint:1809
Change-Id: Ia94db4321b8019f01d31a84da0fda25dfdf72f5c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117566
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Drop the `(opening|closing template argument list)` bit. It makes for messy diagnostics.
Change-Id: I92d29ece8a012362dd16da297089aab908571415
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117213
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Ben Clayton <bclayton@google.com>
Applies a heuristic to disambiguate less-than / greater-than from template argument lists.
This function is not currently used by the parser.
Bug: tint:1810
Change-Id: Ibd72dbae53b3159282177bf79c00ad0808b123a2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117208
Kokoro: Ben Clayton <bclayton@chromium.org>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
The HLSL/MSL includes in data_builder.h appear unused, but gn was
flagging them as problematic when attempting to build with the
corresponding tint_build flags disabled.
module_clone_test.cc is dependent on the WGSL reader and writer, but
was not gated on the corresponding tint_build flags in BUILD.gn.
tint_unittests_transform and tint_unittests_glsl_writer were both
dependent on the WGSL reader/writer, so added it as an explicit
dependency.
Bug: dawn:286
Change-Id: I20906414e8173065eef9403c9e9c05286afeaee9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117580
Auto-Submit: Brandon Jones <bajones@chromium.org>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
The type/ folder had a hold over include of program_builder. The builder
isn't actually used in the types so this CL removes the include and adds
the relevant includes to fix building.
Change-Id: I787b398fe149f483d007bb623ab3ed42850875c5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117581
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Could be split when matching template argument lists.
Bug: tint:1810
Change-Id: I34421d2a27a8b2294fa0201793e7340c0f172df7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117209
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Automatically generate the diagnostic severity enum and its parsing
logic using intrinsics.def.
Bug: tint:1809
Change-Id: Ia7cc59202b389eeea49fd582f5821d271978f233
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117561
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>
This cl pulls the text/ files out of the all source list and into a
libtint_text_src source set.
Change-Id: I7f7e5d764e0590b07ee21a7e4510dbd5c2decce4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117620
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
This CL moves the SamplerKind enum out of ast/sampler and into
type/sampler_kind. This breaks the dependency on ast from type.
Change-Id: Icaf82dd1cca5782bf66993441c7b478332bb76a2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117607
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
This CL moves the texel_format code from ast to type to remove the
dependency on ast from type.
Change-Id: Ie075b2315360dc782284a7b4b55a817a9de31d78
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117606
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
This CL moves the ast/access files into type/access to resolve the type
dependency on ast
Change-Id: Ic0973c5ad162166736abb07cf9bbed7efa91695b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117605
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
This CL moves the transforms out of the `libtint_core_all_src` and into
a `libtint_transform_src` build target.
Change-Id: I44ac4d4a3da9f66b4b7f9e821ecced87d8b227f0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117243
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
This CL moves the ast/address_space to type/address_space. This breaks
the type dependency on ast for AddressSpace.
Change-Id: Icb48e7423e18904865ec735024eb3b9864c947c2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117604
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
This cl pulls TextureDimension out of ast/texture and into
type/texture_dimension removing a type dependency on ast.
Change-Id: Icf06ec32ee9051286f169ae9538c48416f513039
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117603
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
This CL splits the code in `reader/` and `writer/` out of the
`libtint_core_all_src` target and into individual `libtint_reader_src`
and `libtint_writer_src` targets. The various readers and writers are
updated to have the specific target as dependencies.
The `deps` are moved to being private from `public_deps`. The places
where dependencies were missing are updated.
Change-Id: I4e30113cdc6b1e1941efa34ce6579f8f501201ad
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117242
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Adds a toggle to workaround another issue where Metal fails to set
the depth/stencil attachment correctly for a combined depth stencil
format if just one of the attachments is used. The workaround forces
both attachments to be set, giving the unused one LoadOp::Load and
StoreOp::Store so its contents are preserved.
Bug: dawn:1389
Change-Id: Iacbefcc57b33bf11ca8fcacb03506301646fe59d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117175
Reviewed-by: Loko Kung <lokokung@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
This CL fix FeatureState for some experimental features to prepare for
refactoring adapter creation with adapter toggles. This CL also fix the
related unittests.
Bug: dawn:1495
Change-Id: Ibf043ed74c0bfc79c64986f2f96135d92adf3930
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116841
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Auto-Submit: Zhaoming Jiang <zhaoming.jiang@intel.com>
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
If tint_build_spv_reader = false is set in a Chrome's build_overrides
then the tint_unittests_spv_reader_src begins failing with a bunch of
missing spvtools identifiers.
Most uses of spv_reader_src include it as a conditional dependency only
when tint_build_spv_reader is true, Chrome's `all` target always builds
it. This causes problems when critical includes are excluded due to the
tint_build_spv_reader setting. The solution is to not make use of the
TINT_BUILD_SPV_READER define at all in this subdirectory and instead
assume that the entire directory will be included or excluded as needed
at a higher level.
Additionally, one switch statement in tint_common_fuzzer needed to have
the scope of it's TINT_BUILD_SPV_READER exclusion reduced so that it
wouldn't trigger warnings that not all enum values were covered.
Bug: dawn:286
Change-Id: I53518e2fda497fe976721b5f087e2e21a170f5dd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117244
Reviewed-by: dan sinclair <dsinclair@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Brandon Jones <bajones@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Browsers won't be exposing the ability to pass SPIR-V shaders, and the
ability to consume and validate them is adding a non-trivial amount to
the browser binary size on platforms like Android. To avoid that
overhead, this change puts those features behind a flag so that browser
usage can easily omit them.
Bug: dawn:286
Change-Id: Idf70683f2c4ccf479b723c00ba6914e27e4f765f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117241
Commit-Queue: Brandon Jones <bajones@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
* 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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>