This CL does the following:
* Adds a "transient attachment" bit to texture usage. This bit
specifies that the created texture will be used only during
this render pass.
* Adds a TransientAttachments Feature that gates the usage of
transient attachments.
* Adds support for transient attachments on Metal, where they're
used to create textures as memoryless.
* Adds validation tests and an E2T test of the feature.
A followup CL will add support in Vulkan.
Bug: dawn:1695
Change-Id: I3c7322dd1e4bee113062aae2e0494d292ee8cbc3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/129080
Commit-Queue: Colin Blundell <blundell@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
This CL extends the Symbol class to store if the content of the symbol could parse as a builtin.
Change-Id: I7e14ad944c1c9c43d900f9ccf8be6539ac9ea667
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127460
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
This CL splits the base_src set in the GN build into a symbols_src and a
utils_src.
Change-Id: I39036a4ba5163aa816233b42d9a2ebfe34ddf038
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128361
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
This reverts commit 8cc6205bf7.
Reason for revert: Graphite actually reuses the bind groups between
draw calls using different pipelines and this change prevents it
from happening.
Original change's description:
> Disable frontend cache when implicit device sync is on.
>
> Normal behavior of ApiObjectBase's APIRelease() which only locks the
> device when last ref dropped is not thread safe if the object is cached
> as raw pointers by the device. Example of cached objects: bind group
> layout, pipeline, sampler, shader module.
>
> The following scenario could happen:
> - thread A:
> - shaderModuleA.APIRealease()
> - shaderModuleA.refCount.Decrement() == true (ref count has reached zero)
> - going to call shaderModuleA.LockAndDeleteThis().
> - thread B:
> - device.CreateShaderModule().
> - lock()
> - device.GetOrCreateShaderModule()
> - shaderModuleA is in the cache, so return it.
> - unlock()
> - thread A:
> - starting to call shaderModuleA.LockAndDeleteThis()
> - lock()
> - erase shaderModuleA from the cache.
> - delete shaderModuleA.
> - unlock()
>
> This CL disables caching when ImplicitDeviceSynchronization is turned on
> until we find a better solution.
>
> Bug: dawn:1769
> Change-Id: Ideb2a717ece0a40e18bd1c2bef00817262bd25da
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127900
> Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
> Reviewed-by: Austin Eng <enga@chromium.org>
> Kokoro: Kokoro <noreply+kokoro@google.com>
TBR=cwallez@chromium.org,enga@chromium.org,noreply+kokoro@google.com,dawn-scoped@luci-project-accounts.iam.gserviceaccount.com,lehoangquyen@chromium.org
Change-Id: Ib13bba8005402d06963865fae919388a91e718f0
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: dawn:1769
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128440
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
Normal behavior of ApiObjectBase's APIRelease() which only locks the
device when last ref dropped is not thread safe if the object is cached
as raw pointers by the device. Example of cached objects: bind group
layout, pipeline, sampler, shader module.
The following scenario could happen:
- thread A:
- shaderModuleA.APIRealease()
- shaderModuleA.refCount.Decrement() == true (ref count has reached zero)
- going to call shaderModuleA.LockAndDeleteThis().
- thread B:
- device.CreateShaderModule().
- lock()
- device.GetOrCreateShaderModule()
- shaderModuleA is in the cache, so return it.
- unlock()
- thread A:
- starting to call shaderModuleA.LockAndDeleteThis()
- lock()
- erase shaderModuleA from the cache.
- delete shaderModuleA.
- unlock()
This CL disables caching when ImplicitDeviceSynchronization is turned on
until we find a better solution.
Bug: dawn:1769
Change-Id: Ideb2a717ece0a40e18bd1c2bef00817262bd25da
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127900
Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
This method will return supported usage flags that can be used to create
a swap chain.
Bug: dawn:1760
Change-Id: I7699c2c4ef7142c6bd06e72239d6e4f9112f15a3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127440
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
The Castable class is used by utils/. This Cl moves the implementation
into the utils/ folder. The `Is` and `As` methods are added into the
`tint` namespace to make usage shorter.
Change-Id: I0decedb92ebed01b6aa12d2e3efa7190742e9a33
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127402
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
The demangler is no longer used by the Tint executable, and nothing else
calls it, so delete it.
Change-Id: Ic47238e4a6126e5daacd81dfc6f5986524b648ba
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127280
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
1. Auto-generate mutex locking code in DawnNative's ProcTable's
functions. Using a mutex owned by the related Device.
- Unless the function/class has "no autolock" attribute (new) in
dawn.json. In which cases, no locking code will be auto-generated.
- Currently Instance, Adapter, Surface, Encoder classes and
Reference/Release method have "no autolock".
2. Added Feature::ImplicitDeviceSynchronization to enable Device's
mutex.
- If this feature is disabled, lock/unlock Device's mutex is no-op.
Auto-generated locking code will have no effect. This is the default.
- This approach is used instead of generating two sets of ProcTable
because it's cleaner and the internal code doesn't need to care about
whether there is a mutex being locked or not. Furthermore, if there
were two sets of ProcTable, and user used dawnProcSetProcs() to set
global ProcTable, it would affect all other modules using different
Devices. Even though those modules don't need thread safety.
Bug: dawn:1662
Change-Id: I75f0d28959f333318e4159916b259131581f79f5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/119940
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
The `static_assert` builtin has been replaced with `const_assert`. This
CL removes the deprecation.
Bug: tint:1807
Change-Id: Ibcdc75e167bf6c1a6f74c295d9dcac7fff884d3a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/120580
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
`type` has been deprecated in favour of `alias`. This CL removes the
deprecation warning and moves `type` to a reserved word.
Bug: tint:1812
Change-Id: I05246b9887a0890ae8343a0a132bd6f93353d5ae
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/120540
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
A simple MD file to show the source set hierarchy which constrains where
includes can go in Tint.
Change-Id: Ia360430793faef01503260f29f88ef361bb91611
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/120443
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
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>
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>
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>
Track reads and writes to pointer parameters for each function in the
Resolver, as well as accesses to module-scope variables. At function
call sites, check the root identifiers of each pointer argument to
determine if problematic aliasing occurs.
The MSL backend passes pointers to sub-objects to functions when
handling workgroup storage variables, which triggers the alias
analysis. Add a validation override for this scenario.
Bug: tint:1675
Change-Id: I81a40d1309df65521cc5ad39764d6a09a260f51e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110167
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>
This CL moves reserved words from a deprecation to an error.
Bug: tint:1463
Change-Id: I5c66baa15dc748215877c8152171c690495bc0c2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/108861
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
This CL moves module-scope let from a deprecation to an error.
Change-Id: Iffecbb667cf79515234b6510ce7c5bbbb6e673bc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/108862
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Describe the peculiare mismatches between Vulkan-flavoured
SPIR-V and WGSL that the SPIR-V Reader has to contend with.
Describe the solution in broad terms.
This is likely incomplete, but a good start.
Change-Id: I76992e9b830169d81cb55c46e849d9ad2f55c6c6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/105600
Kokoro: Kokoro <noreply+kokoro@google.com>
Auto-Submit: David Neto <dneto@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: David Neto <dneto@google.com>
This CL starts adding the basics for an IR for Tint. The IR is
a lower level representation then the AST with several of the
restrictions removed. For example, the IR is mutable, is a DAG
instead of a tree, and removes a number of WGSL constructs to
simplify transforms.
Bug: tint:1718
Change-Id: I6a16ac3116cee31410896c3a0424af7b41f958c3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/105800
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
To match the spec.
Also add a bunch of missing texture test cases to
src/tint/ast/builtin_texture_helper_test.cc. Fix all the tests that were
broken because these were not being exercised.
Fixed: tint:1526
Change-Id: I207b51d307bbdc054b595e0e0e0fd3330607e171
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/106681
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
These were quite spectacularly broken.
Also:
* Fix the definition of 'scalar' in `intrinsics.def`. This was in part why conversions were broken, as abstracts were materialized before reaching the converter builtin when they shouldn't have been.
* Implement `ScalarArgsFrom()` helper in `const_eval_test.cc`. This is used by the new conversion tests, and also implements part of the suggestion to improve tint:1709.
Fixed: tint:1707
Bug: tint:1709
Change-Id: Iab962b671305e868f92710912d2ed07e3338c680
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/105261
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
This CL updates the internals to use AddressSpace instead of the old
StorageClass name.
Bug: tint:1404
Change-Id: Iecc208e839453437f4d630f65e0152206a52db7e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/104420
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
These have been warnings for multiple months.
Time to properly turn this on.
Bug: tint:880
Change-Id: I3b38f672309b5acd48c12a38dc5a1675f3c62470
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/103480
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Move notes in M106 which should have been in a new M107 section.
Change-Id: Id3cbe39b4889054d3b23202fb0da1d85afbab48b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/103200
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Auto-Submit: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
This CL updates the origin trial changes list to include the
deprecation of reserved words.
Bug: tint: 1463
Change-Id: I70aef6cdd68573413878d595928a7d92b40a275c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/98064
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
This extension adds support for the push_constant storage class such
that it can be tested with WGSL test files. The real goal is to allow
future transforms that will add push constants that the SPIRV writer
will output.
The extension:
- Adds the `chromium_experimental_push_constant` enable.
- Allows the push_constant storage class for global variables.
- Adds validation that the types are host-shareable for push_constant
variables, and that they don't contain f16 (must be 32bit types
only).
- Validates that at most one push_constant variable is statically used
per entry-point.
- Skips validation that the extension has been enabled if
kIgnoreStorageClass is used.
Tests are added:
- For parsing of var<push_constant>
- Caught a missing conversion.
- For each of the validation rules.
- For the wrapping of push constants in structs if needed by
AddSpirvBlockAttribute.
- For the layout and type rules of the storage class.
- For a shader with multiple entry-points using various push constants.
- Caught a missing reset of the previous push constant variable in
the validation check that at most one is used.
- Caught the missing wrapping in structs that had to be added to
AddSpirvBlockAttribute.
- Caught incorrect logic when adding diagnostics about the call
graph leading to the reference to push constants.
Bug: tint:1620
Change-Id: I04a5d8e5188c0dcef077f2233ba1359d1575bf51
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/96682
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
These were not marked as optional previously because it would mean that
C++ methods would look like void F(a = null, b, c) which is invalid in C++
because default arguments must be contiguous and at the end of the
signature.
This commit adds a special case when optional=true where no_default=true
still marks the argument as optional, but doesn't produce a C++ default
argument.
Fixed: dawn:1502
Change-Id: I1b648d37edb94b8412109fc0a06a91bbbd31b8c4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97002
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Fix TODOs dating back to when types were an AST / SEM hybrid concept.
Bring the `arch.md` to reflect how things work today.
Bug: tint:724
Change-Id: I6bf4174158cf490f2839aeed78164b66e3410f27
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/96141
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>