This CL adds constant id helper methods to the decorated variable class.
Bug: tint:150
Change-Id: Icfdc516f37d4f2680d2b990879bff722085cf732
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/29082
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
This CL adds a buffer array accessor clamping transform to
the available transforms in Tint.
Bug: tint:101
Change-Id: If9d5b0fb2c3adba723ce2185870b0e10981103a6
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28980
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
This CL adds AST support for the constant_id decoration.
Bug: tint:150
Change-Id: Ifde5a5325f770567ea24129e786953d89f3f514b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/29100
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
This was missed in the general removal, cleanup.
Change-Id: I7912bb86e73cd9e38d497fab5995f7740a9dfbc6
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/29000
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: David Neto <dneto@google.com>
This CL adds a test for struct constructors in the SPIR-V backend.
Change-Id: I9ae82ce86cde159b87cce2ee95d0b16910aadc7f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28901
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
This CL emits array type constructors in the SPIR-V backend.
Change-Id: I796e81964df1af39ad1aacdd4ab8181852f661fa
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28900
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
This CL adds the matrix constructors to the SPIR-V output.
Change-Id: I7471700c262b499f843ffa4e3c49bcac0b0c7565
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28881
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
The builting CL accidentally inserted indenting between the name of the
builtin and the opening paren. This CL removes the extraneous spacing.
Change-Id: If684ec6f2fb4bf13b559c16b246f57f7975d019d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28944
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
This CL removes the cast operator and converts the tests over to using
type constructors.
Bug: tint:241
Change-Id: I2526acb61f5624b2e1c068612a2ddcc748c92aed
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28860
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
This CL updates the MSL writer to emit the needed zero initializers for
Private, Function and Output variables.
Bug: tint:172
Change-Id: I73b1c3bb4c87a8ec7b1fb9d17a35e907c9a42095
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28943
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
This Cl prefixes the generated variable names from the vertex pulling
transform to prefix a '_' as you can not have an identifier in WGSL with
a leading '_'
Change-Id: Ic9ad873ac5f3ac25f96013f96e6d9a4c17964f22
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28942
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
This CL moves the transform folder from src/ast to src/. The transforms
operate on the AST, but they aren't part of the AST so I think the top
level folder makes more sense.
This will possibly cause issues when rolling if the transform is being
used.
Change-Id: Ibd7c94474168a7a4bdf38321f4e12ad111c80323
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28941
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
This CL updates the SPIR-V writer to emit the arithmetic right shift if
the LHS of the expression is a signed scalar or vector.
Bug: tint:84
Change-Id: I4ca33a31783e1954515db5f12b2cf1d364aedee4
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28940
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
This CL updates computeboids to use the `for()` sugar instead of the
loop/continuing block.
Change-Id: I13f416624821a87fbfa40b15669980bedc794ed4
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28842
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
The ! operator should emit an OpLogicalNot instead of an OpNot.
Bug: tint:248
Change-Id: I6e404c3286db7819e0692603e3cf9a87a1b37ed9
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28841
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
This Cl updates some of the literals and types in computeboids to be
stricter.
Bug: tint:248
Change-Id: I3bc42b8da7913677675d6e417b7f4ce19366eeb9
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28840
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
This CL updates Tint to use 'bitcast' instead of 'as' for the OpBitcast
conversions.
Bug: tint:241
Change-Id: I53a80de10421b2d9cc009527eebe5ff07e1285c2
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28801
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: David Neto <dneto@google.com>
This CL removes the import mechanism, the identifier paths and updates
all of the standard library methods to be builtins.
Bug: tint:242
Change-Id: If09b98a155ae49ced3986ba2c9b517a060693006
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28720
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
This CL removes the EntryPoint node and transitions everything to the
stage decoration.
Change-Id: Ib2840155905c8fa60ff35870f0c4b6705efb73ff
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28705
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
This CL adds the emission of StageDecoration to entry point functions.
EntryPoint nodes are still emitted. We duplicate the function emission
if there are multiple entry points pointing to the same function.
Change-Id: Icb48a063f5c6a30948bbe2c37c7fce7431af5864
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28665
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
This CL updates the hlsl writer to emit stage decorations.
Change-Id: Ic9ae9fbd47537f141949e27c876d37e6d4dcd97d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28704
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
This CL updates the MSL writer to emit data base on the pipeline stage.
Change-Id: I9fb2e146f0c898d9703d69a6a92f535757106bba
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28703
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
This CL updates the SPIRV-Writer to emit entry point information based
on the function stage as well as EntryPoint nodes.
Change-Id: I1fa937cbb2159b31516b0189216d679e03f0384d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28702
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
This CL updates the wgsl writer to emit the stage decorations.
Change-Id: I0501088e074aa5d027f83fd0a2ac45ba3f36332f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28701
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
This CL converts the validator to work against the pipeline stages
attached to functions instead of entry point nodes.
Change-Id: Ia6274423e49426766c527d1123880ef6e0140959
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28700
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
This Cl updates the type determiner to work with both styles of entry
point definition.
Change-Id: Ic48f1a5f0a5820821f9a74380896426a97483049
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28666
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
This CL adds parsing of the stage decoration to the WGSL parser. The
decoration is not hooked up yet so it's effectively ignored.
Change-Id: I8d86c55cee189f993c10b6da31a9c388ba452021
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28664
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
This CL adds the start of an architecture document which can be expanded
as needed. The document is mostly an architecture diagram of how the
various pieces fit together.
Change-Id: I49b6509b9178928d100aece3c284199060969b6c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28660
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
This Cl fixes the function parsing so the opening brace is required.
This will return an error now. The statement::body_stmt is changed to
make the open paren optional.
Bug: tint:236
Change-Id: I3faee1fd5add19aebcdb86943d6f4190c03d0f7a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28520
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: David Neto <dneto@google.com>
This CL adds a test for multisampled textureLoad and fixes up a few type
determiner issues for multisampled textures.
Bug: tint:237
Change-Id: I5c33797b197b6f092842b22aa93d2076b0779766
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28582
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
This CL removes the complete coverage of the possible input formats
infavor of simpler testing of a few of the inputs. This should be
sufficient coverage and makes the tests easier to read.
The incorrect OpConstantNull for the samplers and textures has also been
removed.
Change-Id: I9cd7d6299f0454bb8e2019968e0422221e4ec183
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28581
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
This CL removes the instantiated test suites, instead it tests each of
the required formats with one texture type and then uses the rest of the
tests to verify the texture type generated is correct.
This makes the tests a lot easier to read as the string generation for
results is removed.
Change-Id: I2c54471a2afc8bf2602ec8e4b50b27ad078dc4ee
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28580
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
This CL fixes and enables the generic generate tests for both the MSL
and HLSL writers.
Bug: tint:7 tint:8
Change-Id: I7a3e76196a7c50bd30dcd55940686dc8269786f1
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28441
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
This CL adds parsing of the `workgroup_size` function decoration.
Change-Id: Ia90efc2c014ac0e1614429280cc903d30cf8171d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28663
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
This CL adds the workgroup_size decoration to functions and emits as
needed from the various backends.
Change-Id: Ifffde239e68047f6419c6980eca70c4efa9822c0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28662
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
This CL updates the variable decorations to require ()'s around
parameters.
Bug: tint:238
Change-Id: I835879f41349756ace553a52fc2d460173e70dce
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28583
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
This CL updates the array decorations to the new syntax requiring ()'s
around parameters.
Bug: tint:238
Change-Id: I5a8b19e302fbd3f78392553d8d1c5e882b900180
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28601
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
This CL extends the function AST object to allow function decorations to
be attached.
Change-Id: I5b16aa2e6927792368b7f88047c0229e258b5bd3
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28661
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
Commit-Queue: Sarah Mashayekhi <sarahmashay@google.com>
This CL updates the parsing of struct decorations to require ()'s around
parameters.
Bug: tint:238
Change-Id: Ia35ca5c260c3c57b5fc95788bd1aef07f75edc39
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28600
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
Commit-Queue: Sarah Mashayekhi <sarahmashay@google.com>
This Cl adds the AST, WGSL-Reader and SPIRV-Writer support for the
`texture_multisampled_2d` type.
Bug: tint:237
Change-Id: Ib3eb831227b49f32162801f1e1b4e474774c78b3
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28480
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
This CL adds texture type emission to the WGSL writer.
Bug: tint:144
Change-Id: I18e40a587b77b953f17a6d0ad1a75a1bc4158ef0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28460
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Currently if the type determiner is determining an identifier it will
wrap it into a pointer if it isn't a constant. This CL updates to make
sure we don't already have a pointer as otherwise we endup with a double
pointer.
Bug: tint:216
Change-Id: I2f8c83bd8680df6c3aef31e1cbb754fdff709b4b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28442
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: David Neto <dneto@google.com>
This CL fills in some of the disabled tests around function entry points
and global variables.
Bug: tint:7
Change-Id: Iff40944fbac9985eeafcc7c8a105652b217ff924
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28440
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
This CL adds wgsl tests for the following rules:
v-switch01: switch statement selector expression must be of a scalar integer type
v-0008: switch statement must have exactly one default clause
v-switch03: the case selector values must have the same type as the selector expression the case selectors for a switch statement
v-switch04: a literal value must not appear more than once in the case selectors for a switch statement
v-switch05: a fallthrough statement must not appear as the last statement in last clause of a switch
Bug: tint: 6
Change-Id: Ia12b7d13d47b01e970a5a1e58d61ef05dd9f3830
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28320
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: David Neto <dneto@google.com>
This CL adds validation for the following rules:
v-switch01: switch statement selector expression must be of a scalar integer type
v-0008: switch statement must have exactly one default clause
v-switch03: the case selector values must have the same type as the selector expression the case selectors for a switch statement
v-switch04: a literal value must not appear more than once in the case selectors for a switch statement
v-switch05: a fallthrough statement must not appear as the last statement in last clause of a switch
Bug: tint: 6
Change-Id: I264d5079cc6cb31075965c8721651dc76f3e2a24
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28062
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: David Neto <dneto@google.com>