Commit Graph

1818 Commits

Author SHA1 Message Date
Ben Clayton 587f387fd9 Add tint::BlockAllocator<T>
A container and allocator of objects of (or deriving from) the template type `T`.

Objects are allocated by calling Create(), and are owned by the BlockAllocator.
When the BlockAllocator is destructed, all constructed objects are automatically destructed and freed.

Objects held by the BlockAllocator can be iterated over using a View or ConstView.

Use this to hold the ast::Nodes in the ast::Module

This is called BlockAllocator as it can be optimized to hold objects in contiguous memory blocks, which will improve cache coherencey. Currently BlockAllocator is a straight port of the vector-of-unique-ptr, taken from ast::Module.

Change-Id: I4bf4d298aec3c70d2ddf833e2f168416cbb024c0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/38001
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-01-21 15:30:10 +00:00
Vasyl Teliman e1abcb4564 wgsl-reader: support multiple case selectors
Bug: tint:454
Change-Id: I5a046e19f66b5807723e96593ea6ba107ef69e6c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/38261
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
2021-01-20 21:53:13 +00:00
Ryan Harrison afb8cfb254 Add location data to input/output variable reflection
Adds this data to the Inspector API, as well as needed internal
utility methods.
Updates and expands tests to cover changes.

BUG=tint:452

Change-Id: I598f8149cb6abd13abf606416ae61e615b99e1e1
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/38200
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2021-01-20 18:58:17 +00:00
David Neto ed14524b1e Refactor getting number of coordinate dimensions
Change-Id: Ibafffb29bc33c722b8a4da25ed7a9c1986d13a24
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/38162
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Auto-Submit: David Neto <dneto@google.com>
2021-01-19 03:29:35 +00:00
David Neto 71012dcc2f validator: Support assignment through pointer
Also enable a test to check assigning to scalar literal.

Fixed: tint:419
Change-Id: Ic565af22c4ef6b60c41faaf9fabe3bd55fe48d2d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/37961
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: David Neto <dneto@google.com>
Auto-Submit: David Neto <dneto@google.com>
2021-01-18 22:17:25 +00:00
Vasyl Teliman 579f6a0450 Fix typos in CMakeLists
Change-Id: Ieeafecd850b9b18e18596fbe6d41df9ff2944b80
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/38102
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
2021-01-18 21:39:14 +00:00
dan sinclair 336bb0b4dd Update storage_buffer storage class.
This Cl updates the `storage_buffer` storage class to just be `storage`.

Change-Id: Ibfaecbb0862bd60d39665eb937c0b6300899e177
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/38161
Auto-Submit: dan sinclair <dsinclair@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
2021-01-18 21:06:34 +00:00
Ryan Harrison 7edf1fbc20 Initialize transform manager to null in fuzzer
BUG=chromium:1167337,chromium:1167634,chromium:1167759

Change-Id: Id7eeab225bd29862e43d18f1e44c6ec8b99e26d2
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/38160
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2021-01-18 19:48:54 +00:00
David Neto 20f4d1daca validator: add IsStorable helper function
Bug: tint:419
Change-Id: Ib15aa819a032d8412fb3bc162b29a02c331f56b8
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/37960
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: David Neto <dneto@google.com>
Auto-Submit: David Neto <dneto@google.com>
2021-01-18 19:45:24 +00:00
dan sinclair d7335fa974 Update builtin idx names.
This CL upldates the vertex_idx, instance_idx and global_invocation_idx
builtins to use the full _index names. The original values still exist
until we can update downstream users.

Change-Id: Icd02601eeb15704d5463158541c07816d98e5383
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/37940
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Auto-Submit: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-01-18 15:51:13 +00:00
Michael Achenbach 4a110c2726 Remove obsolete GN config
Bug: chromium:1164276
Change-Id: Ia5ec6f2d6d93d542e7f25b82ee04561958b7b4c8
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/38000
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
2021-01-18 15:25:23 +00:00
dan sinclair c068cfc139 Support the group decoration.
This CL changes the set decoration to a group decoration. We still parse
`set` until downstream users can be updated.

Bug: tint:338
Change-Id: I610d1ed769b3a26c117ad6d875f8a99a3d5b7754
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/37920
Auto-Submit: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-01-15 12:22:16 +00:00
David Neto 0e17caa361 spirv-reader: expand OuterProduct to primitive ops
Bug: tint:3
Change-Id: Id6de3554d945bc743a484e80b494690c26552079
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/37660
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: David Neto <dneto@google.com>
Auto-Submit: David Neto <dneto@google.com>
2021-01-14 19:01:27 +00:00
Ben Clayton 0a68b365eb Implement textureNumSamples()
SPIR-V reader TODO

Bug: tint:140
Bug: tint:437
Change-Id: Id95855660680b12e3ff49b6340ef966dfa49f8e4
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/37848
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2021-01-14 18:11:17 +00:00
Ben Clayton 6e5b5ecc52 Remove underscores from ValidTextureOverload enum names
For consistency's sake.

Change-Id: I08d0b7a5377fed0075feb7c3a0332cda43fb73bd
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/37847
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2021-01-14 18:09:07 +00:00
Ben Clayton d97132028a Implement textureNumLevels()
SPIR-V reader TODO

Bug: tint:140
Bug: tint:437
Change-Id: Icd41b2ef84e62b304e446589eb2e37c38279af35
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/37846
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-01-14 18:06:57 +00:00
Ben Clayton c21f1f92a2 Implement textureNumLayers()
SPIR-V reader TODO

Bug: tint:140
Bug: tint:437
Change-Id: Id397f5f07a2f18f365dc9c2d588e619cea8f89dc
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/37844
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-01-14 16:50:07 +00:00
Ben Clayton 0f4638b9e4 Revert "Extract demangler out to separate source set"
This reverts commit 2f7fea1f19.

Reason for revert: breaks autorollers

Original change's description:
> Extract demangler out to separate source set
>
> And add this as a dep to libtint_core_src and tint_ast_clone_fuzzer.
>
> Should fix chromium autoroller
>
> Change-Id: Ic5f43bae85e010839a1940c1ae2d570a9613d269
> Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/37708
> Commit-Queue: dan sinclair <dsinclair@chromium.org>
> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
> Reviewed-by: dan sinclair <dsinclair@chromium.org>

TBR=rharrison@chromium.org,dsinclair@chromium.org,bclayton@google.com

Change-Id: If872d1655e13dd5d67f898a3d9a43c76b2866973
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/37845
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-01-14 16:31:05 +00:00
Ben Clayton 8121fe3367 Add missing doxygen comments
Change-Id: Ia4b1a5bc1d046633a7f1f91e23659d237d35e640
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/37842
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2021-01-14 15:52:52 +00:00
Ben Clayton a7b52e33d5 samples: Fix compiler warning
Clang will warn if using #if on an undefined macro

Change-Id: I2db83ccd0304c39dd7328607f4bce6d6f80ee0d6
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/37841
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-01-14 14:29:03 +00:00
Ben Clayton 2f7fea1f19 Extract demangler out to separate source set
And add this as a dep to libtint_core_src and tint_ast_clone_fuzzer.

Should fix chromium autoroller

Change-Id: Ic5f43bae85e010839a1940c1ae2d570a9613d269
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/37708
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2021-01-14 14:15:22 +00:00
Ben Clayton 1f14595723 reader/wgsl: Remove duplicate lexer logic
See:
https://dawn-review.googlesource.com/c/tint/+/37780/1/src/reader/wgsl/lexer.cc#750

Bug: tint:286
Change-Id: I6d39fdfefad619beb65ad1d496b27925da3db8ed
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/37840
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2021-01-14 14:15:02 +00:00
dan sinclair 904c5b9621 Add texture_storage_yy parsing.
This CL adds support for the decorated texture storage tokens. The old
_ro_ and _wo_ tokens still exist until downstream users are updated.

Bug: tint:286
Change-Id: I4ddc50be3b22bd3feeab41b3b4fe4ded63e6e59a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/37780
Auto-Submit: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-01-14 08:34:46 +00:00
Carl Woffenden 90c266de5a Removed Clang-specific pragmas to build with VS2019
When building for Windows with VS2019 (using 'is_clang=false') with the
default "warnings as errors" this occurs multiple times, halting the
build:

../../third_party/tint/samples/main.cc(88): error C2220:
the following warning is treated as an error

../../third_party/tint/samples/main.cc(88): warning C4068:
unknown pragma 'clang'

Since there's no shared macro for marking potential unused params the
simplest route of a (void) cast is chosen.

Bug: dawn:602
Change-Id: I4e6316df97dc3cd7e45260e2f7471cdd5a9b4b94
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/37700
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2021-01-13 22:09:24 +00:00
Ryan Harrison 313ae9e87f Add in Inspector Fuzzer implementation file
It was missed in my previous patch.

BUG=tint:445

Change-Id: I3a71f464d5b3c2f84a3b5e160978c671fadb5bd0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/37760
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2021-01-13 20:15:32 +00:00
Ben Clayton 395ec2c4ae writer/spirv: Add TextureStorageWithDifferentAccess test
Checks that multiple texture_storage types with different access modifiers only produces a single OpTypeImage.

This was broken before Ia944ed8

Bug: tint:286
Change-Id: Idbcd0189d46b78b31d5ec38f355d2369cb86327a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/37707
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-01-13 19:28:12 +00:00
dan sinclair d50a3041fa Remove access control from StorageTexture.
This CL removes the access control value from the storage textures and,
instead, wraps in an type::AccessControl. This matches the current spec
where the access is an annotation on the type as opposed to part of the
type.

Bug: tint:286
Change-Id: Ia944ed8557fbf490d78db2a1b49c31d0aba08728
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/37740
Auto-Submit: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
2021-01-13 18:48:11 +00:00
Ben Clayton 57166264e0 Fix ValidTextureOverload enum names for kSampleCompare
For some stupid reason, these were all incorrectly prefixed with kSampleGrad, despite the test data all being correct.

Bug: tint:140
Change-Id: If556194d06c7596419a9e7b83165361bb19c7f44
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/37705
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2021-01-13 16:36:51 +00:00
Ben Clayton 7c5980991a writer/[hlsl,msl]: Emit a implicit return for entrypoints
WGSL no longer requires a return statement at the end of each function, and the generated entrypoint functions are not valid without a return.

Fixed: tint:446
Change-Id: I702e4217f4ac41013e30927d532895c6835f6ca9
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/37704
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-01-13 16:34:51 +00:00
Ryan Harrison 1870a48d5f Add fuzzer for Inspector
BUG=tint:445

Change-Id: Ic342c7e83827bcc57bfd134dec92b03cb9708a70
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/37540
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2021-01-13 15:50:11 +00:00
Ryan Harrison f813959302 Convert libtint deps to be public
This removes the requirement of targets that depend on libtint needing
to include the transitive deps to access somethings like headers.

BUG=tint:447

Change-Id: I52a86b93e517f2745f04711f508a838f8f6850b6
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/37720
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2021-01-13 15:42:51 +00:00
dan sinclair 1c200cffd0 Remove outerProduct.
The community decided to remove outerProduct from WGSL. This Cl removes
the pieces from Tint.

Change-Id: Ib1735867e4a7ca852a72549fc8c9bd86e8de22b0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/37600
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-01-12 22:00:58 +00:00
Ben Clayton 8f4784006e writer/spirv: Validate SPIRV for all texture intrinsic functions
Finds brokenness.

Change-Id: I1280d456dfe0e4296100e40eef4fb0a17d3d047a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/37450
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-01-12 21:52:50 +00:00
Ben Clayton 72114bd61b writer/spriv: Cast level parameter to f32 for depth texture sampling
SPIR-V expects a f32, while WGSL has an i32 type for these.

Bug: tint:143
Change-Id: I8e724f24f12154f57cddfd01dfd727e440ca8450
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/37449
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-01-12 21:42:28 +00:00
Ben Clayton 9a9aa58ddd writer/spriv: Extract first element from depth texture reads
These operations return a vec4, when WGSL expects a single float scalar.

Fixed: tint:438
Change-Id: I4e16190155f80481897ad7db8b96ed3e58a7bfe3
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/37448
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-01-12 21:39:19 +00:00
Ben Clayton ecad052dac writer/spirv: Use ConstOffset instead of Offsets
Offset requires the ImageGatherExtended capability, where as ConstOffset does not. WGSL enforces the offset range required by SPIRV.

Bug: tint:143
Change-Id: Ia098010ecdb8a4a01999b4e9a6faabf3f4d1251f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/37447
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-01-12 21:37:28 +00:00
Ben Clayton 2dbd556a18 writers: Duplicate cube height for textureDimensions()
All shader backend languages describe cubes as width / height, but give no way to query depth. WGSL however returns a vec3<i32> for cube textures when calling textureDimensions().
As cube textures must be square (width == height == depth), just replicate the height for the depth.

See https://github.com/gpuweb/gpuweb/issues/1345

Bug: tint:140
Bug: tint:437
Change-Id: I76ef18ee4bd8b53d5f9d9d3f1c10c3f7cb23e137
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/37446
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-01-12 21:20:48 +00:00
Ben Clayton ecc2cdfb61 writer/spirv: Use OpImageQuerySizeLod for non-MS images
Fixes validation error:
`Image must have either 'MS'=1 or 'Sampled'=0 or 'Sampled'=2`

Bug: tint:140
Bug: tint:437
Change-Id: If6d7e86aeb7767b212debf94bcae9ee2ce8ad209
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/37445
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-01-12 21:18:58 +00:00
Ben Clayton d1aef67011 writer/spirv: Fix storage class and add decorations for texture test cases
These are required for correct SPIR-V emission.

Bug: tint:444
Change-Id: I6d25dcc6e06af7f9ca9f250758b7901171923773
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/37444
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-01-12 20:14:18 +00:00
Ben Clayton 50c5fa1100 writer/spirv: Refactor IntrinsicTextureTest.OutsideFunction_IsError
Use the same builder helpers as IntrinsicTextureTest.Call, significantly reducing boilerplate

Change-Id: Idb37a1704b9ed76c3872d14003ff279b2955d18b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/37443
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-01-12 20:09:42 +00:00
David Neto 559f4e66d5 Remove stdout output from test
Change-Id: If1c4b72f636f7aa9d8fac81b5172dd050b06dc32
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/37500
Commit-Queue: David Neto <dneto@google.com>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Auto-Submit: David Neto <dneto@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2021-01-12 18:25:58 +00:00
dan sinclair 42e873c6f6 Update comments in test WGSL files.
This CL updates the test WGSL files to use // for comments instead of #.

Change-Id: I5ba31cfe15e9f293bcb82f82e2a3dbe6f6e61e96
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/37480
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-01-12 18:13:28 +00:00
Ryan Harrison 0b5d1dd5d8 Re-land fuzzing work with fix
Revert "Revert 3 fuzzing CLs, since they are preventing rolling into Chromium."

This reverts commit 1d9935cf37.

Also adjusts BUILD.gn file, so that Chromium build can find all the
needed symbols.

BUG=tint:58,tint:59,tint:193,tint:194,tint:199,tint:436

Change-Id: I3fe71ff52c8156f30fccfaab0bf7f647f158aea4
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/37460
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2021-01-12 16:23:48 +00:00
David Neto 4651a6ee8b spirv-reader: explicitly reject combined-image-sampler
This was already rejected, but with a not-very-useful message.
Error out more consciously and issue a higher level, more informative
error message.

Fixed: tint:442
Change-Id: I3643b98d17f55b44b9dcf86aa828010bb39fcd8e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/37242
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: David Neto <dneto@google.com>
Auto-Submit: David Neto <dneto@google.com>
2021-01-12 15:24:18 +00:00
dan sinclair 987376cd21 Revert the namer changes.
This CL reverts the changes to use the top level namer in the various
backends. This is causing issues when rolling into Dawn in the case
where the tint generator is used to create SPIR-V which is sent to
SPIRV-Cross but then generator and inspector aren't used. The entry
points end up being incorrect as SPIRV-Cross gets the renamed entry
points.

Change-Id: I4749e1d773f2bd9edcce83e63555f07a443d5ca5
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/37342
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
2021-01-12 04:34:53 +00:00
dan sinclair b91e8a9fbe Add a Unsafe SPIR-V generate call.
Currently Dawn may use the tint generator or the SPIRV-Cross generator.
In the case of SPIRV-Cross, we need to generate the SPIR-V with the
original names otherwise SPIRV-Cross won't be able to match up the entry
point name with the names in the shader.

Change-Id: Ica473030009b282fee352f2d1c1acc93f1db592c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/37222
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
2021-01-12 02:59:12 +00:00
dan sinclair 03f38e0cd9 Update new entry points to use correct namer.
This CL fixes up a merge conflict which accidentally used the Unsafe
namer instead of the Mangle namer for the temporary API to allow rolling
into Chrome.

Change-Id: Id3b932d29fe15ab64347350f5b36b3d9efeffbdf
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/37300
Auto-Submit: dan sinclair <dsinclair@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
2021-01-11 22:07:02 +00:00
Ben Clayton f6866a2ffc Add std::hash<tint::Symbol> specialization
Allows symbols to be used as keys for std::unordered_map and std::unordered_set.
Replace all map / set use of uint32_t for Symbol, where applicable.

Change-Id: If142b4ad1f0ee65bc62209ae2f277e7746be19bb
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/37262
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
2021-01-11 22:02:42 +00:00
Ben Clayton 4527a512eb TypeDeterminer: Fix type map iterations
`DetermineStorageTextureSubtype()` may add types to the module while these types are being iterated over, leading to UB.

To work around, collect all the storage texture types into a vector first, and iterate over these.

Change-Id: Ib94b1df52d6ccbbf635a6d89eeeabef46ba03416
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/37261
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2021-01-11 21:14:22 +00:00
Ben Clayton d221738e20 Add diag::Formatter::Style::print_newline_at_end
Automatically prints a newline at the end of the last diagnostic in a list. Defaults to true.

Disabled for many tests that assume no newline at end of string.

Change-Id: Id1c2f7771f03f22d926fafc2bebebcef056ac5e8
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/37260
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-01-11 21:09:22 +00:00