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>
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>
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>
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>
10x speed improvement on my 3990x machine
Change-Id: Ie4b2377719e9a25860ec05bb7649aa652d26ccf0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113022
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Ben Clayton <bclayton@google.com>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>