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>
The get-by-name method on the function stack already
tells us if the name exists. We don't have to check,
and then get it later.
Change-Id: I26a1d395a9986df48f598055c3bc2864d94c87a8
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28260
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
Until now, we were only setting the function name.
Bug: tint:3
Change-Id: I6d82f6e9744201a04cc8969013694e2e8304a928
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28080
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
This CL adds a rule to separate global variables and global consts in regards to storage class:
v-0022: Global variables must have a storage class
v-global01: const variables shouldn't have a storage class
Bug: tint: 225
Change-Id: I53d84afd771c78d91eaf47568e954986abf38e58
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28141
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: David Neto <dneto@google.com>
This CL adds a return to convert_image_format_to_spv function to stop
clang from failing with this error: "control reaches end of non-void
function." because we haven't covered all the enums in the switch.
Change-Id: Ibcb02ff52ca4c6e597a36f5c3d57e41df9e7b02a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28061
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: David Neto <dneto@google.com>
This Cl adds the preliminary GenerateEntryPoint method to the WGSL
writer.
Bug: tint:211
Change-Id: Ib414ff66d482179f10eeeb890f6127bc585cd664
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28045
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: David Neto <dneto@google.com>
This CL adds the stub methods for the various backends to generate
individual <pipeline stage, entry point> pairs.
Bug: tint:211
Change-Id: I7c5c6af4b44cb78976e4388a2b2174ee1a116531
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28044
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: David Neto <dneto@google.com>
This CL allows the backend generators to be reset so they can be re-run
again.
Bug: tint:211
Change-Id: I67b0c650d0ab4615130777becc513099247339c9
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28043
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: David Neto <dneto@google.com>
This Cl will setup the code to allow a Reset method to be added to the
generators.
Bug: tint:211
Change-Id: I41c3aaf0daf832729aea9c76500e297ae32d7f5e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28042
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: David Neto <dneto@google.com>
This CL adds 6 unit tests for validating switch statements.
v-switch01: switch statement selector expression must be of a scalar integer type
v-switch02: switch statement must have exactly one default clause
v-switch03: the case selector values must have the same type as the selector expression
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: I0283afec22e56097b6f63c8455da23b87dfe26dc
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/27740
Commit-Queue: Sarah Mashayekhi <sarahmashay@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
This Cl simplifes the generated code for logical and/or expressions to
assign the LHS and RHS directly instead of using if statements.
Bug: tint:192
Change-Id: I358e07007510cf8df151a100fda678c1c299cf4f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28040
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
This CL unifies the logical and/or HLSL code as it was mostly duplicate
code.
Bug: tint:192
Change-Id: Ied050afb0b054a9ccda1c8896edabf78deaa3709
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/27921
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
This Cl adds more tests for the logical and/or expansion based on the
various statements and expressions where the expansion can happen.
Bug: tint:192
Change-Id: I143cf80402dc70e2fb89b6a41914cbbe167b5a96
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/27920
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
This Cl emits the required code to handle LogicalAnd and LogicalOr short
circuting in HLSL.
Bug: tint:192
Change-Id: I30a88c207f7864e0a3c856d2dae1420c7ff35eb4
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/27782
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: David Neto <dneto@google.com>
This CL updates the if and else statement support to output the pre
streams in the proper places.
Bug: tint:192
Change-Id: If217de7f838fc033823987e20ba7efc5cd6108ff
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/27781
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: David Neto <dneto@google.com>