Commit Graph

2225 Commits

Author SHA1 Message Date
Ben Clayton 0aa7edbbd5 transform/spirv: Use InlinePointerLets & Simplify
arrayLength() will take a pointer to a storage buffer array.
This pointer may pass through function scoped let statements.
To make this intrinsic easier to generate, inline the pointer lets and
remove chains of &*&*.

Bug: tint:806
Change-Id: Ib2c79a9c38cba7391cbb4313986af9a72b0f0435
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/54060
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
2021-06-10 17:34:44 +00:00
Ben Clayton 3e59eb0e5c intrinsic_table.def: Support [[deprecated]] on fn
And produce a warning if these are used. Hard to test, as we don't want to introduce fake functions in our definition file.

Also add missing cast in EnumMatcher.

Bug: tint:806
Change-Id: I21f189e4befe419f6d5544acfc52387d9a5da782
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/54001
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-06-10 17:31:54 +00:00
Sarah 06e2e5c2f7 Add unit test to check LHS is not an intrinsic function name
Identifiers cannot be assigned.

Bug: tint:203
Change-Id: Ibe34749264024b690d8a8bd271304f425a2688ed
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/54080
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Auto-Submit: Sarah Mashayekhi <sarahmashay@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Sarah Mashayekhi <sarahmashay@google.com>
2021-06-10 16:06:34 +00:00
Antonio Maiorano b5508fdcb5 Implement vector initialization from single scalar (aka "splat")
Updated spir-v and HSLS backends to emit valid constructors.

Bug: tint:656
Change-Id: I53356945563b633239b12c0f4e207f160dbc23d8
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53780
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@chromium.org>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2021-06-10 13:23:31 +00:00
James Price 5b2f49b5df writer/msl: Fix ignore() test validation failure
Functions cannot be called main, and we do not run the rename reserved
keywords transform as part of the sanitizer.

Change-Id: Iea67fe08c7e94e473d622b7f349caf8d09f41784
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/54101
Auto-Submit: James Price <jrprice@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-06-09 21:56:59 +00:00
Ryan Harrison 3832b8e05d Report referenced pipeline overridable constants
Adding this information to each entry point reported by the inspector.

BUG=tint:855

Change-Id: I043e48afed1503a4267dc4cb198fb86245984551
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53820
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-06-09 20:45:09 +00:00
Antonio Maiorano 14b3403148 Validate function call arguments
- Add resolver/call_test.cc for new unit tests, and move a couple that
were in resolver/validation_test.cc to it

- Fix CalculateArrayLength transform so that it passes the address of
the u32 it creates to the internal function

- Fix tests broken as a result of this change

Bug: tint:664
Change-Id: If713f9828790cd51224d2392d42c01c0057cb652
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53920
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2021-06-09 20:17:59 +00:00
Ben Clayton 1987fd80f4 test-runner: Print results as soon as they're available
Gives feedback much eariler.

Also move the error messages after the table

Change-Id: If462fd9bbc72ff9428d6ee77c8ec6c9338f7f27e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/54000
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
2021-06-09 19:14:09 +00:00
Ben Clayton 9ca78030eb hlsl: Implement modf and frexp
Change-Id: I40b3ad7e2d4811b0a52e75402c7d5ccda090a97c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53809
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-06-09 18:53:57 +00:00
Ben Clayton 241c16d626 resolver: Ensure that decorations aren't duplicated
Fixed: tint:525
Change-Id: I993b60f82ac5d5e07e1c76980604e6aaf1b94fb3
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53806
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
2021-06-09 18:53:57 +00:00
Sarah c58738a49e [validation] v-15001: front_facing builtin must be boolean
To declare a front_facing builtin variable
- declare as a parameter of the entry point function or it can be
- declared as members of structures that are entry point function parameters
The type of the function-parameter/structure-member must be boolean.

Bug: tint:357
Change-Id: I09c380ae5784d29e776e483d966a0f7d8cd2286c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53821
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Sarah Mashayekhi <sarahmashay@google.com>
2021-06-09 16:01:29 +00:00
David Neto 0d6d905bc0 spirv-reader: Avoid struct type dedup confusion
When generating the store type for a variable, follow SPIR-V
instructions directly.  Avoid using the SPIRV-Tools optimizer because
it deduplicates structures that differ only in non-semantic annotation (e.g. member names)

Bug: tint:737
Change-Id: I9503be4ae0a95a517d595da23e6ce2397e4fc9c1
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53560
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>
2021-06-09 14:47:09 +00:00
Ben Clayton 0a2b5f22d4 Add transpose intrinsic
Fixed: tint:860
Change-Id: I899e280807503064fbabaafe02d37de4187b3298
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53805
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-06-09 14:32:14 +00:00
Ben Clayton 950809f534 Rename 'constructed types' to 'type declarartions'
Change-Id: I0c79be17a10a542df602447e555c1344621d2dce
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53803
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2021-06-09 14:32:14 +00:00
Ben Clayton 8758f10a20 ast: Replace NamedType with TypeDecl
TypeDecls (alias, structure) are not a types - they declare types.
ast::TypeName is what's used for a ast::Type.

Previously we were trying to automatically convert these to TypeNames in the builder, but having these inherit from ast::Type was extremely error prone.

reader/spirv was actually constructing ast::Structs and using them as types, which is invalid.

Change-Id: I05773ad6d488626606019015b84217a5a55a8e8a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53802
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2021-06-09 14:32:14 +00:00
Ben Clayton 6e7d24d36a Add ProgramBuilder::Alias()
Combines the calls to ty.alias() and AST().AddConstructedType()

Change-Id: I84eaf6275d37141cf8973db7e04d25d9cb9c6351
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53801
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2021-06-09 14:32:14 +00:00
James Price 3b26717377 resolver: Storable types include textures/samplers
Add a Resolver::IsPlain() method to check for plain types, which is
then used instead of IsStorable() for validating array and struct
subtypes.

Remove validation of assignment and constructor RHS types, instead
validating the type of the variable declaration. This catches
additional errors that were previously missed, such as using a pointer
for a var declaration with no constructor.

Change-Id: I5786a262159d2a42cc05b44743c6c26f6b5647c0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53960
Auto-Submit: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-06-09 09:12:57 +00:00
Ben Clayton ad7c2ec355 Implement ignore() intrinsic
Fixed: tint:871
Change-Id: I01e275686094611d67a54735593320bce16705c3
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53681
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-06-09 08:30:57 +00:00
Ben Clayton 6a7a8b42e8 docs: Relax don't-quote-source rule
Change-Id: Iab8412280f5c36a78ce7a972fe5304c14d2dc0bd
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53808
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-06-09 07:48:38 +00:00
Ben Clayton 4d4c1e58d2 Remove test stdout spam
Change-Id: Ie7c14274509a88f9c1aebcf9d12df39ba3d2dafe
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53807
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-06-09 07:48:37 +00:00
Ben Clayton c57f725797 resolver: Enable AST type reachability checks
Required a lot of test fixes.

ProgramBuilder: :ConstructValueFilledWith() was a major source of unreached AST types, and this has been removed with more powerful type-building helpers in resolver_test_helper.h.
Change-Id: I1f2007cdaef7f319ab4ef8b4fb8c37687a0fb5d8
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53800
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-06-09 07:48:17 +00:00
Ryan Harrison fc645f7489 Revert "Invoke some of the Dawn CQ from Tint's"
This reverts commit cebbce0596.

Reason for revert: Test CL failing

Original change's description:
> Invoke some of the Dawn CQ from Tint's
>
> Run some of the debug bots from the Dawn CQ on the Tint one.
>
> This will give us coverage of the unittests on all platforms and the
> end2end tests on linux SwiftShader.
>
> BUG=tint:734
>
> Change-Id: Ib1373c9041d97eec09c605bbd94b6ec023f9938a
> Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53860
> Auto-Submit: Ryan Harrison <rharrison@chromium.org>
> Reviewed-by: Ben Clayton <bclayton@google.com>
> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
> Kokoro: Kokoro <noreply+kokoro@google.com>

TBR=cwallez@chromium.org,rharrison@chromium.org,bclayton@google.com,noreply+kokoro@google.com,tint-scoped@luci-project-accounts.iam.gserviceaccount.com

Change-Id: I430b1abb9c8bb9d78d305e8e5d55b5328218de9c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: tint:734
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53823
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2021-06-08 21:17:58 +00:00
Ryan Harrison cebbce0596 Invoke some of the Dawn CQ from Tint's
Run some of the debug bots from the Dawn CQ on the Tint one.

This will give us coverage of the unittests on all platforms and the
end2end tests on linux SwiftShader.

BUG=tint:734

Change-Id: Ib1373c9041d97eec09c605bbd94b6ec023f9938a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53860
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-06-08 19:59:07 +00:00
Ben Clayton 8abe369bc5 val: Use the metal API to validate MSL shaders, if available
Roughly 4x faster than validating with the MSL executable.

Change-Id: I6566fa29622475c459eb3a988a842a9e19d4be6f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53680
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-06-08 19:38:27 +00:00
Sarah 4634c8b736 [validation] impl v-2000: module-scope variable and function name intersect
bug: tint:260

Change-Id: Ib282b77f475ed3ef4f8096229a41b1bd58342c5a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53121
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Sarah Mashayekhi <sarahmashay@google.com>
2021-06-08 17:06:02 +00:00
David Neto 9ef9a10a23 spirv-reader: dereference the base pointer for access chain, if needed
Bug: tint:737
Change-Id: I36588ee54ea014e55d3dcc9a54e8d3835c1e83bc
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53540
Auto-Submit: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: James Price <jrprice@google.com>
2021-06-08 14:42:52 +00:00
Sarah 3a472bc5c2 [validation] v-2000: Add disabled test for module-scope variable and function
name intersect

v-2000: Function names must not have any intersect with module-scope
variable names.
A declaration must not introduce a name when that identifier is already
in scope with the same end scope as another instance of that name.
A module-scope variable and a function have the same end scope ie.
end of the program.

bug: tint:260

Change-Id: I95321d3e6c04b0344c3acfb7b77cb483b3659728
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/52820
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@chromium.org>
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
Commit-Queue: Sarah Mashayekhi <sarahmashay@google.com>
2021-06-08 14:19:01 +00:00
David Neto edb644c821 spirv-reader: Make SPIR-V unit tests valid for WebGPU
- Add missing DescriptorSet and Binding decorations.
- Add missing Phi inbound edge
- Add a preamble with an OpMemoryModel instruction
- Add a preamble and an empty entry point that is not involved with the
  test (sometimes)
- Disable dumping of test with known bad output (tint:863, tint:98)
- Fix storage classes on variables

Bug: tint:863, tint:98
Change-Id: I56b92e8951f5749e094424f8e2da1a2396b5c10c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53261
Auto-Submit: David Neto <dneto@google.com>
Commit-Queue: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
2021-06-07 20:40:04 +00:00
David Neto 9566742f2a spirv-reader: ignore RelaxedPrecision on struct members
Bug: tint:737
Change-Id: Ic9a37e70ad1e6c1aa49aa49fe37a842361e306e1
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53440
Auto-Submit: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: James Price <jrprice@google.com>
2021-06-07 20:36:54 +00:00
Ben Clayton dfcc7b5714 writer/spirv: Fix emission of select()
The argument order between WGSL and SPIR-V is different (condition is first in SPIR-V, last in WGSL)

Fixed: tint:560
Change-Id: I56c659c441292e05f71a24d96dbc9f93f25b71f0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53620
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
2021-06-07 20:01:54 +00:00
Ben Clayton d7255e37f6 writer/hlsl: Emit vector-of-bool as boolN
Much like uintN, intN, floatN - boolN is far more common, and easier to read than vector<bool, N>

Change-Id: I51f9edc003c590266316d3eba286ca2f6882da10
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53390
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: James Price <jrprice@google.com>
2021-06-07 20:01:54 +00:00
Antonio Maiorano 7dbc4baa71 Kokoro Windows: run test-all.sh
Bug: tint:872
Change-Id: I019a0898a61c3932a0320c8c438996fe44ac9d6c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53480
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2021-06-07 19:49:24 +00:00
Antonio Maiorano a84edaa4a4 Kokoro-Windows: use latest DXC artifact
Rather than use the latest release, use the latest AppVeyor build
artifact (see
https://github.com/microsoft/DirectXShaderCompiler#downloads)

Latest release doesn't support tint's generated HLSL.

Bug: tint:872
Change-Id: Icfe5cc20647775cfae032407ae3e298c5519fbe1
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53602
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2021-06-07 19:46:54 +00:00
Antonio Maiorano 089c9e34a5 test-runner: on Windows, use forward slash separators in paths passed to tint
This ensures that we don't fail when comparing against expected output
that contains paths in them.

Bug: tint:872
Change-Id: I93d4b940eae2c22175ef3add94bb28f907156ca0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53600
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-06-07 19:43:04 +00:00
Ben Clayton 2d9ba5d8ad writer/hlsl: Implement select()
Fixed: tint:304
Change-Id: I8821bc6e4bfa0487161b8d915a6a107afd474105
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53389
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-06-07 19:17:34 +00:00
Ryan Harrison 53426a4538 Remove old infra configuration files
BUG=tint:693

Change-Id: I51512924b9bcec5cb71e6ce5abed9444768d73b8
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53640
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-06-07 17:09:21 +00:00
Ben Clayton b2a7d8b9b0 diagnostic: Fix stupid bug in Formatter::format
That would cause OOB reads.

Fixed: tint:836
Change-Id: I6e44ab5d140e99a701c190c13ed6aaba762e19d4
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53660
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-06-07 16:53:32 +00:00
Ben Clayton 224ce729cc resolver: Add more inferred access tests
The tests that were in ptr_ref_* should have been in var_let_*. Move these to the right place, and add more tests that actually test the pointer access.

Bug: tint:846
Change-Id: I383fcbf7eeb4a1428cf50c52bc2958720458adcb
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53388
Auto-Submit: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-06-07 16:51:02 +00:00
Ben Clayton fb6a6185fa test: SKIP deprecated/access_deco for MSL backend
This does not pass validation.

Change-Id: I3e63ad899d346321a4dea13f3a681d01546ed2bb
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53621
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-06-07 16:50:22 +00:00
Antonio Maiorano 6a665d1b85 test-runner: allow using '/' in filter on Windows, and fix using '\'
Change-Id: I635952a6c04bc305a896143333b2ae141bb6a2b0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53400
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2021-06-07 14:51:22 +00:00
Ben Clayton 6b358c3f21 Fix tint fuzzer build
Enable the fuzzers for Kokoro presubmits so we can actually know when we break it.

Change-Id: I7270390045353f79c27a7f661afcc7e888628fcd
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53385
Kokoro: Kokoro <noreply+kokoro@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2021-06-07 08:07:11 +00:00
Ben Clayton 03d10721e7 Stop tint.h from including program_builder.h
ProgramBuilder is about as internal as you can get - this really should not be public.

MSVC seems to try an instantiate some of the template methods in ProgramBuilder when it is included externally (for PCH or DLL exports perhaps?), and failing with bizzare error messages that contain no point-of-instantiation.

As this header was never intended to be public in the first place, detect and error if the tint.h include guard is found while processing program_builder.h, and fix up the couple of bad transitive includes.

Fixes tint -> dawn autoroller

Change-Id: Ic9a81a44ab1b4a29a7297b94bbf85bcfdb1310b5
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53384
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
2021-06-05 12:45:50 +00:00
Ben Clayton 1858854f7e Add optional access to ptr<>
This also completes the work to resolve the access controls for each
storage type.

Fixed: tint:846
Change-Id: Iab24057ec14620a2978ec63c4a91ba12d1bc6e9b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53381
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
2021-06-04 22:17:37 +00:00
Ben Clayton 3db1820f0b test-runner: Don't overwrite SKIPs with --generate-expected
Unless the test also passed validation.
Prevents clobbering expected validation failures when you've only checked tint didn't error.

Change-Id: I44be0c8b1f9ef1a0df51bba81f5ad694715204b8
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53383
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2021-06-04 21:58:07 +00:00
Ben Clayton 93e8f527ee wgsl: Deprecate [[access]] decorations
Handle access control on var declarations instead of via [[access]]
decorations. This change does the minimal work to migrate the WGSL
parser over to the new syntax. Additional changes will be needed
to correctly generate defaulted access qualifiers, as well as
validating access usage.

The [[access]] decorations are still supported by the WGSL parser,
with new deprecated warnings, but not for aliases. Example:
   var x : [[access(x)]] alias_to_struct;

Making this work is far more effort than I want to dedicate to backwards
compatibility, and I do not beleive any real-world usage will be doing
this.

Still TODO:
* Adding access control as the optional, third parameter to ptr<>.
* Calculating default accesses for the various storage types.
* Validating usage of variables against the different accesses.

Bug: tint:846
Change-Id: If8ca82e5d16ec319ecd01f9a2cafffd930963bde
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53088
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Reviewed-by: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-06-04 20:41:47 +00:00
Ben Clayton b175d91c7e test-runner: Pass a relative path to tint
Avoids absolute paths being emitted in diagnostics

Change-Id: Ic62af27e079ceac8d89735486edcaca75014b8c9
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53382
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-06-04 20:02:45 +00:00
Ben Clayton 620d77e480 PB: Make Var() and Global() params optional
and allow them in any order.

We're about to add Yet Another optional parameter - access control.
For style, we probably want this field before the decorations, however
that means adding more default values for all the cases where we don't
need to specify the access control.

Instead use some template magic to allow extra parameters to be
specified in any order, and entirely optional, with sensible defaults.
This keeps things readable and without huge code refactorings.

Bug: tint:846
Change-Id: I4f61eb765de63ad98ae786d187d2bd1b42942756
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53087
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-06-04 19:55:08 +00:00
James Price 9fd3befa17 tools: Return position from generated vertex shaders
This is required to generate valid MSL code, and will soon be
validated by Tint too.

Change-Id: I4c5f5c4ecb1c91131c934de1132217d9f6be1f8e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53420
Auto-Submit: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-06-04 17:31:48 +00:00
David Neto 6b22219798 spirv-writer: Fix | and & on bool and bool-vec
Fixed: tint:861
Change-Id: Ib9709b3793fb5c405f4ba519c189295999f556ee
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53280
Auto-Submit: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: James Price <jrprice@google.com>
2021-06-04 16:25:27 +00:00
Antonio Maiorano 9834fefa7f Implement type inference
Bug: tint:672
Change-Id: I3f586ee867f75427c4e8c309f72fb468643c23c0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53182
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2021-06-04 15:28:47 +00:00