Commit Graph

7841 Commits

Author SHA1 Message Date
James Price bb0229002d tint/uniformity: Violations are now errors
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>
2023-01-25 01:24:46 +00:00
James Price f38ee3e073 tint/exe: Add --allow-non-uniform-derivatives flag
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>
2023-01-25 01:24:46 +00:00
James Price e657c470bd tint/uniformity: Add derivative_uniformity filter
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>
2023-01-25 01:24:46 +00:00
James Price 5853205342 tint/sem: Record diagnostic severity modifications
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>
2023-01-25 01:24:46 +00:00
James Price 613fbcf79a tint: Add diagnostic and enable to ModuleCloneTest
Bug: tint:1809
Change-Id: I671440bf2b1f988eb39bd476841e92c3a7e58ae7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117600
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-01-24 23:13:38 +00:00
James Price c744a23d77 tint/reader/wgsl: Parse @diagnostic attributes
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>
2023-01-24 21:01:36 +00:00
James Price 75326f88e6 tint/writer/wgsl: Handle diagnostic attributes
Bug: tint:1809
Change-Id: Id2176eff808b24bdb0e31c3eb397c32219ed59e7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117570
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-01-24 21:01:36 +00:00
James Price 8dd35110c2 wgsl/reader: Parse diagnostic directives
Bug: tint:1809
Change-Id: I9f129685f22f51f577b67050edeef8aeea0c0bc5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117569
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-01-24 21:01:36 +00:00
James Price 02855b5060 tint/resolver: Handle diagnostic attributes on functions
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>
2023-01-24 21:01:36 +00:00
James Price e8ea579bce tint/writer: Handle diagnostic directives
The WGSL writer emits them, the other writers ignore them.

Bug: tint:1809
Change-Id: I163d868005c076b8fd4602f13d3e267b16c474c0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117567
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-01-24 21:01:36 +00:00
James Price 81e55754e1 tint/resolver: Handle diagnostic directives
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>
2023-01-24 21:01:36 +00:00
James Price 098e3d8f90 tint/dependency_graph: Handle diagnostic controls
Bug: 1809
Change-Id: I376d0758a09463b37e2d71040cc8add5897ef8bb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117564
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-01-24 21:01:36 +00:00
James Price 15bf15d55f tint/ast: Add global diagnostic controls to Module
Bug: tint:1809
Change-Id: I363abc60597a6c340d5a4b4d147fa7f5747c2d9b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117563
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-01-24 21:01:36 +00:00
Ben Clayton 7d2b192439 tint: rename template argument token strings
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>
2023-01-24 19:31:51 +00:00
Ben Clayton f0d8edecee tint: Fix x86 build
Fixed: tint:1813
Change-Id: I97b7c0c0a4bfdda2f7e63983caddcfb3a1e19c2f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117215
Reviewed-by: dan sinclair <dsinclair@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2023-01-24 19:29:54 +00:00
Ben Clayton 355b70d2be tint/reader/wgsl: Use ClassifyTemplateArguments()
For parsing.

Bug: tint:1810
Change-Id: I189d06136e79615d39c842aaa9ad58595f80283e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117210
Kokoro: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
2023-01-24 19:28:14 +00:00
James Price ef5434dcd1 tint/ast: Add DiagnosticAttribute AST node
Bug: tint:1809
Change-Id: I297d050e001f5177a6697d8332713a1f41899b87
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117562
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
2023-01-24 18:44:27 +00:00
Ben Clayton 4ff2645d16 tint/reader/wgsl: Add ClassifyTemplateArguments()
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>
2023-01-24 17:56:57 +00:00
Brandon Jones 6c8aa8aff9 Resolve some reader/writer dependency issues
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>
2023-01-24 15:16:43 +00:00
Ben Clayton c98d57d662 tint: Rename 'static_assert' to 'const_assert'
Bug: tint:1807
Change-Id: I2c2a205ada01ad14d0bf6620a3dc3ec84dd7ee67
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117212
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2023-01-24 14:59:43 +00:00
Ben Clayton 9dc48bcef3 tint: Rename 'type' to 'alias'
Bug: tint:1812
Change-Id: I50bd8b036b47b4ec223a81eda53bd658d19645e9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117211
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2023-01-24 14:55:17 +00:00
dan sinclair dfb62150df Remove program_builder include from type/
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>
2023-01-23 20:33:42 +00:00
Ben Clayton 6fc130bfcc tint/reader/wgsl/lexer: Make '>>=' splittable
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>
2023-01-23 18:32:41 +00:00
James Price 5f3449f000 tint/ast: Add DiagnosticControl AST node
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>
2023-01-23 17:55:55 +00:00
dan sinclair 3272ac7e17 Pull unicode files out to own target.
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>
2023-01-23 16:27:05 +00:00
dan sinclair 3085e23fc7 Move SamplerKind out of ast and into type.
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>
2023-01-23 16:24:12 +00:00
James Price ffe356d558 tint/lexer: Add 'diagnostic' keyword
Bug: tint:1809
Change-Id: I55ce14b8775a64c4f7ccbbd7e84094e9e4ee19a6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117560
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
2023-01-22 11:00:53 +00:00
dan sinclair 57c0bbc2a5 Move ast/texel_format to type/texel_format.
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>
2023-01-21 23:51:25 +00:00
dan sinclair 61c16eb448 Move ast/access to type/access.
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>
2023-01-21 23:44:38 +00:00
dan sinclair e2ff3431f4 Split transforms out to their on source target.
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>
2023-01-21 23:41:56 +00:00
dan sinclair 18b2158b4e Move ast/address_space to type/
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>
2023-01-21 19:56:49 +00:00
dan sinclair 3cbf3fc4c5 Move TextureDimension to type/
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>
2023-01-21 19:16:15 +00:00
dan sinclair d54dabeab5 Split the reader/ and writer/ out of libtint_core_all_src.
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>
2023-01-21 18:50:20 +00:00
Austin Eng 387d57c805 Metal: set both depth/stencil attachments for combined formats
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>
2023-01-21 02:42:15 +00:00
Zhaoming Jiang 899126f036 Dawn: Fix FeatureState of some features
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>
2023-01-20 08:46:55 +00:00
Austin Eng 785ccde2f5 Expand AllowFormatReinterpretationWithoutFlag to consider ETC2/ASTC
Bug: dawn:1176
Change-Id: Iae674fb1c5198ca8767b71e2d5553e0a4a06b475
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117178
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2023-01-20 01:13:27 +00:00
Brandon Jones 13d14525c4 Fix builds that disable tint_build_spv_reader
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>
2023-01-20 00:11:00 +00:00
Brandon Jones 61d2cf297a Making SPIR-V ingestion and validation optional
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>
2023-01-19 21:17:42 +00:00
Peng Huang e3eb03f8a3 Add the last usage serial in Buffer
Add the last usage serial in Buffer, it is used for optimizing
MapAsync(), so the callback of MapAsync() is called when the last usage
serial is done instead of using the current pending serial when
the MapAsync() is called.

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

Reason for revert: dawn:1619 has been fixed.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Suppress newly added test on Windows ANGLE

Bug: dawn:1389, dawn:1637
Change-Id: Iea03e8f3e5e7f663ffc7b344ab007a73836557cc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116846
Reviewed-by: Loko Kung <lokokung@google.com>
Kokoro: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2023-01-17 19:06:12 +00:00