Commit Graph

1276 Commits

Author SHA1 Message Date
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
Ben Clayton 4a0b9f77ef Implement textureDimensions()
SPIR-V reader TODO.

Bug: tint:140
Bug: tint:437
Change-Id: Ia3a6cb0b36142142d3dc8662281e1860c609c82b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/36980
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2021-01-11 21:07:32 +00:00
dan sinclair c3c70f848a Fix const-ness of inspector constructor.
This was changed originally, but we no longer need the module to be
non-const for the Inspector. Set it back to const to fix the Chrome
roll.

Change-Id: I68166a7a687249cab5c344167386144554b7d175
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/37221
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>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2021-01-11 20:01:12 +00:00
David Neto e86fd505e4 Fix doxygen comment
Change-Id: I5977c7fe09f80e9da9438e7842fdfdf44346c839
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/37220
Commit-Queue: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: David Neto <dneto@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-01-11 19:17:59 +00:00
David Neto 3f245ed362 spirv-reader: convert arity of textureLoad on depth texture
Fixed: tint:439
Change-Id: I151e388a1ea11bdcb5cebf0441a73ddcaf8a6f54
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/37063
Commit-Queue: David Neto <dneto@google.com>
Auto-Submit: David Neto <dneto@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-01-11 19:04:49 +00:00
dan sinclair 2dc1ef47e0 Switch default to the MangleNamer.
This Cl updates all of the generators and the inspector to use the
mangle namer by default.

Change-Id: Id6811d76bf2475a2c2a2864fb8fc0f43e95a6e65
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/36944
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2021-01-11 16:24:32 +00:00
dan sinclair a8d9755053 Allow setting the namer into the inspector.
This CL adds an extra constructor to the inspector to change the namer
user. The inspector tests are then updated to use the test namer.

Change-Id: Ibc91de89b52161dc125b38d65e445b5833ad6c18
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/36943
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2021-01-11 16:24:32 +00:00
dan sinclair b920e604b2 Change generators to take a pointer instead of move.
This CL changes the generators so we don't have to move the module into
the generator. This will then allow calling the demangler at a later
point and still having access to the module.

Change-Id: Icad16ddb2b89921cbb174cf7fec520c410139285
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/36942
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-01-11 16:24:32 +00:00
dan sinclair 7d152e0936 Use TestNamer in the SPIR-V backend.
This CL updates the SPIR-V generation tests to use the TestNamer.

Change-Id: I6a1d9a4c41f080ba3518509864bb06f1629ab0a9
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/36941
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-01-11 16:24:32 +00:00
dan sinclair f4bc0e7337 Use TestNamer in HLSL tests.
This CL updates the HLSL tests to use the test namer and fixes up places
where the incorrect name was output.

Change-Id: I8510d1ff5a57f3a0996dc9c7c8478775ef141105
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/36940
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-01-11 16:24:32 +00:00
dan sinclair f74b90b3dd Use a test namer in the MSL generator.
This CL updates the MSL generator to use a test namer, the various
places where the incorrect name was emitted have been fixed.

Change-Id: I20c990bdddc4f0580b09269920abe8376fa3ca07
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/36900
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-01-11 16:24:32 +00:00
dan sinclair c8c31560de Remove name fields
This CL removes the name fields from the various AST nodes now that the
symbols are used everywhere.

Change-Id: I73e8fa8958aa6e6f0159b12b63176b12c418f525
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/36762
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2021-01-11 16:24:32 +00:00
dan sinclair e65e4bd2c5 Remove IdentifierExpression::name().
This CL removes the name method from IdentifierExpression. The usages
have been converted over to the symbol.

Change-Id: Id751c2fc4a43bd5414fbaf8a8a66ecffb3838e48
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/36801
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-01-11 16:24:32 +00:00
dan sinclair 4ac6568821 Remove Function::name().
This CL removes the function name accessor and changes all usages to use
the symbol.

Change-Id: I19b92bf1bc557ba14e68ef8cb381487a4ad1f7ee
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/36821
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-01-11 16:24:32 +00:00
dan sinclair eb737c25db Remove StructMember::name().
This CL removes the name accessor from the struct member. Usages have
been replaced with symbol usages.

Change-Id: Idd9c5b34f0b5503ffee84e0c82d69aa65b1df7ea
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/36820
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2021-01-11 16:24:32 +00:00
dan sinclair e76a86a22c Remove StructType::name()
This CL removes the name accessor from the StructType. All usages are
updated to use the symbol.

Change-Id: I65d793e9609a1663facce955bdb89e60f11f382a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/36800
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-01-11 16:24:32 +00:00
dan sinclair 1d967e3228 Remove the AliasType::name() getter.
This CL removes the name() method from AliasType and replaces with
usages through the Symbol.

Change-Id: I50a85e4262e488adf935b9a484214fc85a966301
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/36781
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-01-11 16:24:32 +00:00
dan sinclair 396b02342f Remove Variable::name().
This CL removes the name getter from the Variable class. All usages are
updated to use the symbol.

Change-Id: I3e4d86d2124d39023cad6113c62230c1757ece71
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/36780
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-01-11 16:24:32 +00:00
dan sinclair 197a1b943d Use the top level namer in the SPIR-V backend.
This CL updates the SPIR-V backend to use the top level namer.

Change-Id: I67566d7674d5366c82c99d6fbb985805a2a9a5b4
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/36720
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-01-11 16:24:32 +00:00
dan sinclair f3e3586835 Use namer in the Inspector.
This CL adds the namer to the Inspector when getting the remapped name.

Change-Id: Ic5ed8c50a24b7a1cc303767d049a358181d27603
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/36661
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-01-11 16:24:32 +00:00
dan sinclair 8d6e625ef4 Convert HLSL to higher level namer.
This CL switches the HLSL generator to use the top level UnsafeNamer
instead of a custom namer.

Change-Id: I7643ee6586955ed2bc493104004fb9f9c524e951
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/36660
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-01-11 16:24:32 +00:00
dan sinclair 05b64849b2 Convert MSL generator to unsafe namer.
This Cl updates the MSL generator to use the unsafe namer internally.

Change-Id: Ibeea747da1d7675c05a0dcb2416fbd491bb5d64b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/36581
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-01-11 16:24:32 +00:00
Ryan Harrison 1d9935cf37 Revert 3 fuzzing CLs, since they are preventing rolling into Chromium.
Revert "Adding fuzzing for Transforms"

This reverts commit 4a29008c7e.

Revert "Add fuzzers for various emission paths"

This reverts commit 39545b7e7c.

Revert "Create common utility class for fuzzing"

This reverts commit 766e31d507.

Change-Id: Ia4e4ea2a4a5f423ea5bfa8ca9659c4028b558b45
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/37180
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2021-01-11 15:22:19 +00:00
dan sinclair 795b6b5a28 Convert ScopeStack over to symbols.
This CL converts the ScopeStack to use a Symbol instead of a string as
the accessor.

Change-Id: I2893003bc119c86c4822732ef36c7393e4be1e79
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/36580
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Auto-Submit: dan sinclair <dsinclair@chromium.org>
2021-01-11 15:10:19 +00:00
David Neto f51d965bef spirv-reader: Reject dref sampling with Bias or Grad
Bias and Grad image operands are not supported for
depth-referencde sampling.

Fixed: tint:440
Change-Id: Ic2bf995f7c7b791b8e3a7ceb3514b10220dda8a7
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/37062
Auto-Submit: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-01-11 14:53:29 +00:00
David Neto 9bacbe1b34 Roll third party dependencies
Roll third_party/spirv-tools/ 8f4b35c33..f3ccb633d (11 commits)

8f4b35c332..f3ccb633df

$ git log 8f4b35c33..f3ccb633d --date=short --no-merges --format='%ad %ae %s'
2021-01-07 dneto use std::string::empty() to test for emptiness (#4098)
2021-01-07 46493288+sfricke-samsung spirv-val: Label standalone Vulkan VUID (#4091)
2021-01-06 46493288+sfricke-samsung spirv-val: Add Vulkan decroation VUID (#4090)
2021-01-06 stevenperron Fix binding number calculation in desc sroa (#4095)
2021-01-06 stevenperron Build deps: dump ini from 1.3.5 to 1.3.7 in tools/sva (#4092)
2021-01-06 46493288+sfricke-samsung spirv-val: Add Vulkan FP Mode VUID (#4088)
2021-01-06 46493288+sfricke-samsung spirv-val: Fix Vulkan image sampled check (#4085)
2021-01-06 46493288+sfricke-samsung spirv-val: Add Vulkan ForwardPointer VUID (#4089)
2021-01-06 46493288+sfricke-samsung spirv-val: Add Vulkan ImageTexelPointer format check (#4087)
2021-01-05 46493288+sfricke-samsung spirv-val: Add Vulkan Group Operation VUID (#4086)
2020-12-17 46493288+sfricke-samsung spirv-val: Add first StandAlone VUID 04633 (#4077)

Created with:
  roll-dep third_party/spirv-tools

Change-Id: Ia8b6b998358881be7c48f84a6a046827d09d7743

Roll third_party/gpuweb-cts/ 46c7b591c..1ba84a62a (12 commits)

46c7b591c2..1ba84a62ae

$ git log 46c7b591c..1ba84a62a --date=short --no-merges --format='%ad %ae %s'
2021-01-07 kainino Organize and rename some tests (#429)
2021-01-07 kainino Add plans for texture view reads/writes (#430)
2021-01-07 9856269+sarahM0 [wgsl] Add validation test - v-0033: If  the initializer is present, it's store type must match the store type of the variable. (#418)
2021-01-07 9856269+sarahM0 [wgsl] Add validation test - v-0034: The access decoration must only appear on a type used as the store type for a variable in the storage storage class. (#420)
2021-01-06 9856269+sarahM0 [wgsl] add validation test - v-0035: The access decoration is required for variables in the storage storage class. (#421)
2021-01-06 9856269+sarahM0 [wgsl] Add validation test - v-0036: Module scope variable must not be in the function storage class.
2021-01-06 9856269+sarahM0 [wgsl] Add validation test - v-0037: Module scope variables must be declared with an explicit storage class decoration.
2021-01-06 9856269+sarahM0 [wgsl] Add validation test - v-0032: constraints on module variables with an initializers (#417)
2020-12-23 jiawei.shao Add T2T operation tests for all the compressed color formats (#412)
2020-12-22 kainino Catch exceptions in expectValidationError (#416)
2020-12-21 kainino clarify pull request template
2020-12-18 kainino Test fixes found by Chromium automated testing (#415)

Created with:
  roll-dep third_party/gpuweb-cts

Change-Id: I9ce04555e4f34259ad501fdae5bda0a8a146a9a8

Roll third_party/googletest/ 18f8200e3..389cb68b8 (3 commits)

18f8200e30..389cb68b87

$ git log 18f8200e3..389cb68b8 --date=short --no-merges --format='%ad %ae %s'
2020-12-21 absl-team Googletest export
2020-12-15 dmauro Googletest export
2020-10-30 chuck.atkins Bump CMake minimum to 2.8.12

Created with:
  roll-dep third_party/googletest

Change-Id: Id4aaff4448fdc6f40c2364ead8ebdc7fe8f699f2
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/37060
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: David Neto <dneto@google.com>
2021-01-08 18:44:54 +00:00
David Neto 1e01c2c116 spirv-reader: rename variable
Rename the state variable describing whether the "Level"
suffix should be used to indicate the level-of-detail variant
of a texture builtin.

Bug: tint:3
Change-Id: I21fdfcace06575e7f9586d7bfc22200f9c1176fa
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/37004
Commit-Queue: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: David Neto <dneto@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-01-08 15:44:44 +00:00
Ryan Harrison 4a29008c7e Adding fuzzing for Transforms
Fuzz all transforms being applied together, and fuzz each transform
separately.

BUG=tint:436

Change-Id: I53cf2e05c69f495f27bfa428f55ec033a85a612a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/36945
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2021-01-08 02:42:43 +00:00
Ryan Harrison 39545b7e7c Add fuzzers for various emission paths
BUG=tint:58,tint:59,tint:194,tint:195

Change-Id: Ibca5efbcd608489dcb7c6c45a5fcf596b97165dc
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/36901
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
2021-01-07 20:33:22 +00:00
Ryan Harrison 766e31d507 Create common utility class for fuzzing
This moves the usage of Tint in the fuzzers into a single class. This
will be expanded in the future to support emitting shaders, so fuzzing
tests, just need to indicate which reader & writer they want to use,
instead of having each test implement all of the API usage logic
directly.

BUG=tint:199

Change-Id: Id081a374014b7640a07b267e544ddeba3e6329dd
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/36760
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
2021-01-07 16:20:32 +00:00
Ben Clayton 718975958b Add tool to check the WGSL spec examples compile
Automatically fetches the spec from the web, runs tint for all compilable examples.
Displays all examples that don't compile or compile when they shouldn't

Change-Id: I4718dd45ddec7f191ceed937ecb1c384d77d0eb5
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/36722
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2021-01-07 01:44:11 +00:00
David Neto 8144af91b4 spirv-reader: ignore PointSize builtin declared at module-scope
Fixed: tint:434
Change-Id: Ia29d0f7227e838fc5f9dd4ca521b5fd6b9a88637
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/36761
Auto-Submit: David Neto <dneto@google.com>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2021-01-07 01:38:41 +00:00
Ben Clayton 9bbf8252a9 wgsl: Treat // as comment
Also support # as comments for now while we migrate.

See:
https: //github.com/gpuweb/gpuweb/issues/1262
https: //github.com/gpuweb/gpuweb/pull/1326
Change-Id: I3547f575c35f4fd46b95f0f2d8b79f4015364c83
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/36680
Commit-Queue: Ben Clayton <bclayton@google.com>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Auto-Submit: Ben Clayton <bclayton@google.com>
2021-01-06 19:54:01 +00:00
Ben Clayton 40b4928a73 Implement clamping of runtime array accesses
Bug: tint:252
Change-Id: I2b32ab9d69ca39b6178fc4e94ccd090516a37c98
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/36620
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
2021-01-06 14:33:31 +00:00
Ben Clayton 6653c13a75 Fix ast_clone_fuzzer tests
Demangle the printed AST before comparing.

Many to_str() methods on AST nodes will print the symbol numerical identifiers, which is not guaranteed to be stable between clones.
By comparing the demangled AST, these should be stable.

Fixed: chromium:1160099
Change-Id: I4e62adbccc690a1531f78dc70cef8480ed6f3f2c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/36621
Commit-Queue: Ben Clayton <bclayton@google.com>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2021-01-06 14:30:11 +00:00
Ben Clayton e9d7f7e640 src/transform: Reimplement tests in WGSL
Easier to read and write, and ensures that the tests exercise valid AST instead of synthetic structures that can never exist.

Change-Id: I5d361ef96383c71943a424f5765952f21d740042
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/36422
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
2021-01-06 12:57:41 +00:00
David Neto 995516e0e2 Add --demangle option to command example
The --demangle option preserves original source names
when dumping the AST or emitting text-based shader languages.

Change-Id: Iac450158c6b9f0ac780b7e5580cb02c41dd5df17
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/36480
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-05 22:45:50 +00:00
David Neto 6cad63c2ad spirv-reader: support OpArrayLength
Fixed: tint:431
Change-Id: I727ca8200118e0b93b42c5f7d9e97bc4afd97830
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/36460
Commit-Queue: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: David Neto <dneto@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-01-05 21:21:50 +00:00
Ben Clayton 9894867678 reader/wgsl: Fix parsing of matrices.
https://gpuweb.github.io/gpuweb/wgsl.html#matrix-types :
"matNxM<T>	Matrix of N columns and M rows"

Fixed: tint:432
Change-Id: Ib8fdb836b02c5e6be87acea850f095355545adbd
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/36421
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2021-01-05 20:53:10 +00:00
David Neto a35b57f91f spirv-reader: rename to isNan, isInf
Fixed: tint:418
Change-Id: I09185880c838d437f84c4ef85528b4d807c0b340
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/36440
Commit-Queue: David Neto <dneto@google.com>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Auto-Submit: David Neto <dneto@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2021-01-05 19:22:30 +00:00
Ben Clayton ca2c1ed370 Validate that runtime arrays aren't used as parameters
Remove the logic around `arrayLength()` being passed anything but a member accessor. Runtime arrays types cannot be used for variables nor parameters.

Add validator logic and test for runtime array parameters.

Adjust the validator error message so it doesn't include the field / variable name. This read weird, and the same information is already provided by the source.

Bug: tint:266
Bug: tint:252
Change-Id: Iecedb0524e10a67b4f8ad15635d67fe61e9d69d9
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/36420
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2021-01-05 18:20:40 +00:00
David Neto 938ff5f482 spirv-reader: ImageQuerySize can be on readonly image
Fix how handle usage is collected.  OpImageQuerySize
is usable for *any* image that is either MS=1 or Sampled=0 or 2.
(Sampled=0 is not allowed by Vulkan).
So it's usable by storage images or multisampled image.

OpImageQuerySizeLod is usable by Sampled=1 MS=0 images, ie. sampled
images.

Fixed: tint:422
Change-Id: Ibfbcab2daa8b38f17758a0428a08cb9660496bac
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/36061
Auto-Submit: David Neto <dneto@google.com>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2021-01-05 16:10:40 +00:00
Ben Clayton 1637cbb868 cleanup: Refactor tests to use ast::Builder helpers
Change-Id: I5bf1dac217c9c6192c0637d98c4a38196d41cbe8
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/36382
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2021-01-05 15:44:39 +00:00