Commit Graph

8203 Commits

Author SHA1 Message Date
James Price fc2083a616 tint: Make CreateScalar and ZeroValue members
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>
2023-02-06 22:01:48 +00:00
James Price 40ffda4b5e tint/const-eval: Add flag to use runtime semantics
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>
2023-02-06 18:52:13 +00:00
Antonio Maiorano b3d5fb19bb Fix dump_shaders for Vulkan backend in CMake build
Change-Id: I6670abe2fbc77418a5923643db0d377d38212288
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/118620
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2023-02-06 18:30:09 +00:00
dan sinclair c1799cc75a Add a `tint_info` command.
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>
2023-02-06 16:28:37 +00:00
Ben Clayton 0b4a2f1f50 tint: Add sem::Expression
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>
2023-02-05 22:59:40 +00:00
Ben Clayton ef1811a18b tint: static_assert that Sem.Get() template arg is needed
Change-Id: I91a73c22bd417fd9f32d45a1c91ffcb8f8d83d82
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/118405
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-02-05 14:33:08 +00:00
Ben Clayton ad3156551c tint/ast: Add AccessorExpression
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>
2023-02-05 12:36:50 +00:00
Ben Clayton 3fb9a3fba1 tint/sem: Rename Expression to ValueExpression
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>
2023-02-04 21:20:26 +00:00
James Price 98dc5a86cc tint/ast: Make DiagnosticControl a plain struct
Introduce DiagnosticDirective, which contains a DiagnosticControl
struct (as does DiagnosticAttribute).

Bug: tint:1809
Change-Id: I204001266ee472d2ee2827614a306acad53f12ba
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/118060
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-02-04 12:20:55 +00:00
David Neto 85e13bcd68 spirv-reader: fix emission of INT_MIN literal
Fixed: tint:1818
Change-Id: Ieb19f874d248a3a1c11c96f5ae06c4db14e0c811
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/118540
Auto-Submit: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: James Price <jrprice@google.com>
2023-02-03 22:00:07 +00:00
Austin Eng 4dffbd3f16 Suppress RegressionDawn1083 with depth32float-stencil8 Mac AMD
Bug: dawn:1651
Change-Id: I2f8977ba5793d90419bd27cb7381fceaa4cb891c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/118601
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2023-02-03 21:14:16 +00:00
James Price 132d8c7a7d Add flag to disable derivative_uniformity for SPIR-V ingestion
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>
2023-02-03 19:38:46 +00:00
Zhaoming Jiang 6315289ee8 Dawn: Make Adapter initialize supported feature never error
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>
2023-02-03 19:13:12 +00:00
Yuly Novikov 76d4892f36 Remove obsolete format of SYNC-HAZARD-WRITE-AFTER-READ messages
Bug: chromium:1412096, dawn:1225
Change-Id: I3734ad139b9e57102cbf8a7ec2bb053c491eb734
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/118503
Auto-Submit: Yuly Novikov <ynovikov@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Yuly Novikov <ynovikov@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2023-02-03 18:21:49 +00:00
Ben Clayton 2117f80f8b tint: Reduce repetition for ty.type_name()
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>
2023-02-03 14:01:43 +00:00
Ben Clayton 2cdf134b2b tint: Add ast::TemplatedIdentifier
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>
2023-02-03 13:24:18 +00:00
Ben Clayton 89a717bacf tint: Have ast::TypeName use ast::Identifier
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>
2023-02-03 13:22:17 +00:00
Ben Clayton 12914eedf6 tint: Have ast::DiagnosticControl use ast::Identifier
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>
2023-02-02 22:20:32 +00:00
Antonio Maiorano f031ca2d44 tint/hlsl: fix assignment to matrix element
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>
2023-02-02 22:16:42 +00:00
Ben Clayton a4117ca21b tint: Have ast::MemberAccessorExpression use ast::Identifier
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>
2023-02-02 20:44:53 +00:00
Ben Clayton 6cba18b0fc tint: Have ast::IdentifierExpression use ast::Identifier
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>
2023-02-02 20:37:19 +00:00
Austin Eng 08027c662e Modernize some internal WGSL syntax
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>
2023-02-02 20:17:46 +00:00
Corentin Wallez 0761764256 BackendVk: Add suppressions for new formatting of VVL errors
Bug: dawn:1225
Change-Id: Icc15a8bdad48d9cabed96af62e011a531ea7f5c9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/118400
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-02-02 17:33:38 +00:00
Ben Clayton 999db74a24 tint: Have ast::CallExpression use ast::Identifier
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>
2023-02-02 15:16:28 +00:00
James Price 6e31bc24b1 tint/parser: Use = for source of assignment
Change-Id: I09ebd529fad775d0ce74fc56e2d7ff161a33f15a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/118380
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-02-02 15:05:21 +00:00
Ben Clayton c87b1fe8c9 tint: Add ast::Identifier
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>
2023-02-02 15:04:31 +00:00
James Price 92226dbfc3 tint/reader/wgsl: Add source info to loop bodies
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>
2023-02-02 13:01:42 +00:00
James Price f6a48ee351 tint/reader/wgsl: Add source info to compound statements
Change-Id: I251dd3d061a32042368b170ba2a38d16e8b2d9dc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/118320
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-02-02 12:40:53 +00:00
James Price 70f968d098 tint: Fix masked ParameterRequiredToBeUniform
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>
2023-02-02 02:28:27 +00:00
James Price 072f83c682 tint/uniformity: filter should not affect result
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>
2023-02-02 00:29:27 +00:00
James Price d9f659670d tint: Handle @diagnostic on block statements
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>
2023-02-01 23:14:10 +00:00
Austin Eng e60a579c19 Add workaround to blit depth to depth
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>
2023-02-01 22:49:39 +00:00
Antonio Maiorano eab1f62629 tint/hlsl: for default-only switch, only emit condition if it has side-effects
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>
2023-02-01 15:46:34 +00:00
Antonio Maiorano 635c5d0f04 tint/spir-v backend: emit OpSRem instead of OpSMod for remainder
operation

Bug: tint:1802
Change-Id: I690ef658874ba8d0d9cd8efa2a91324db175650b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/118100
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: David Neto <dneto@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2023-01-31 19:09:05 +00:00
Austin Eng 3da942086d Expand metal combined ds workaround
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>
2023-01-31 18:13:43 +00:00
Brandon Jones a5f8e8e34a Check to ensure pMessageIdName is not null
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>
2023-01-31 04:11:17 +00:00
Brandon Jones 574b94e566 Change External Texture Rotation To Counter-Clockwise
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>
2023-01-30 18:26:11 +00:00
Austin Eng 00dbf0bf67 Add workarounds to blit a buffer to a depth/stencil texture
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>
2023-01-30 17:13:12 +00:00
dan sinclair f374b819d9 Remove `sig` deprecation.
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>
2023-01-30 15:34:49 +00:00
Corentin Wallez 97ad405216 Fix MSVC 14.29 errors:
- 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>
2023-01-30 14:49:27 +00:00
Zhaoming Jiang a12ff9abd1 Dawn: Deprecate DawnTogglesDeviceDescriptor with DawnTogglesDescriptor
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>
2023-01-30 09:16:51 +00:00
Li Hao e463b1ffd7 Add the device id of Intel Raptor Lake to gpu_info.json
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>
2023-01-28 02:58:52 +00:00
James Price 7ce72de3a5 tint/renamer: Preserve diagnostic control names
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>
2023-01-28 00:37:42 +00:00
Ben Clayton 42c5b2f675 tools/run-cts: Add --validate flag
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>
2023-01-26 16:03:08 +00:00
Ben Clayton 78e4530f59 code-coverage / turbocov fixes
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>
2023-01-26 15:57:27 +00:00
James Price ab52881bb5 tint/validator: Test @diagnostic on invalid places
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>
2023-01-26 13:00:43 +00:00
James Price 2f2400bfdc tint/validator: Check for conflicting diagnostic controls
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>
2023-01-26 12:24:42 +00:00
James Price 2dbb7b4f6a tint/SingleEntryPoint: Handle diagnostic directive
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>
2023-01-26 11:31:19 +00:00
dan sinclair 1226320a5b Move ast_type.cc to type.cc.
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>
2023-01-26 10:49:19 +00:00
dan sinclair 3076a8bf17 Add missing sem headers
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>
2023-01-26 02:15:50 +00:00
Brandon Jones f68f2e06d7 Fix GatherDeviceInfo on Vulkan 1.0 devices
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>
2023-01-26 00:36:16 +00:00
dan sinclair 1a26e80318 Create a libtint_ast_src.
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>
2023-01-25 22:40:28 +00:00
Austin Eng 97f56bd0b8 Clamp the stencil reference to 255
Fixed: dawn:1645
Change-Id: I908fe0a2cb029c7cc6cf94b066f0f842e0f1e224
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117532
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-01-25 20:57:49 +00:00
Peng Huang 8fc1758a3d Append pipeline barrier for mappable buffers for submissions
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>
2023-01-25 19:55:52 +00:00
Austin Eng e8870efb1b Handle Tint inspector reflection of bgra8unorm storage texture
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>
2023-01-25 19:52:32 +00:00
dan sinclair a3e90618dc Remove libtint_core_src.
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>
2023-01-25 19:52:28 +00:00
dan sinclair 186fdaf815 Rename libtint_core_all_src to libtint_syntax_tree_src
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>
2023-01-25 19:22:25 +00:00
dan sinclair d108693b59 Move a few more headers to base_src.
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>
2023-01-25 19:15:42 +00:00
dan sinclair b560dcdb9f Pull inspector out to gn source set.
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>
2023-01-25 18:41:40 +00:00
dan sinclair 2da119a0ce Split constant and type out of libtint_core_all_src
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>
2023-01-25 18:39:00 +00:00
James Price 58dd079e46 tint/resolver: Warn for unknown diagnostic rules
Suggest alternatives in the warning.

Bug: tint:1809
Change-Id: If55f162fbd44a1987b573888ca7cc02490f8b05e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117800
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-01-25 14:10:04 +00:00
James Price f629770bcd tint: Move "suggest alternatives" logic to utils
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>
2023-01-25 14:10:04 +00:00
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
Yan,Shaobo 9b6f01d603 Fix flipY logic in CopyTextureForBrowser()
CopyTextureForBrowser() handles flipY by flipping source texture then
applying copy op. But this is not correct. Instead
it should find the copy rect and apply flipY op in copy rect only,
which is the same as WebGPU GPUImageCopyExternalImage.flipY definition
(https://www.w3.org/TR/webgpu/#dom-gpuimagecopyexternalimage-flipy).

This CL fixed the issue and updated related end2end tests.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Make "--verbose" print the picked adapter.

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

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

Fixes a spurious crash when emitting lots of text.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Use the BuiltinPolyfill transform to implement it for all backends.

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

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

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

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

Reenables relevant CTS tests that were suppressed on Vulkan.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

The arrayLength builtin no longer needs special-casing.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Replace some use of SFINAE with constexpr.

Also fixes a build failure for x86.

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

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

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

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

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

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

Bug: dawn:1507

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

The package move allows transforms to use these enums.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Ensure that these are correctly stripped.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

3c4734b09c...0f5fc665a0

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

Created with:
  roll-dep third_party/gpuweb

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Change-Id: I1d9fabcb1a89df1bc23a1e8805e5fd1caa68500b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112285
Kokoro: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-11-30 01:16:53 +00:00
Ben Clayton d205b716ca tint/resolver: forbid spelling non-instantiable pointer types
Fixed: tint:1553
Change-Id: Ib77777a7142d302fe2d0d083de601f7b5042ad6a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111881
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
2022-11-30 01:13:35 +00:00