Commit Graph

756 Commits

Author SHA1 Message Date
dan sinclair a8274b2fef [spirv-writer] Emit entrypoint from function decoration.
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>
2020-09-21 18:49:01 +00:00
dan sinclair 48d08d2147 [wgsl-writer] Emit stage decorations.
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>
2020-09-21 17:59:51 +00:00
dan sinclair 51ac24ab10 [validate] Update to validate pipeline stages.
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>
2020-09-21 17:56:41 +00:00
dan sinclair 0592643782 [type-determiner] Update to work with entry point and function stages.
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>
2020-09-21 17:51:31 +00:00
dan sinclair 767ea855ab [wgsl-reader] Parse stage decoration
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>
2020-09-21 17:42:10 +00:00
dan sinclair cb907b5bc2 [wgsl-reader] Fix issue with missing open brace for functions.
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>
2020-09-21 15:55:32 +00:00
dan sinclair 43d17780ca [spirv-writer] Add multisampled textureLoad test.
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>
2020-09-21 15:52:10 +00:00
dan sinclair 64f9cdec68 [spirv-writer] Simplify the texture intrinsic tests
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>
2020-09-21 15:46:00 +00:00
dan sinclair 4dc0d7d311 Simplify SPIR-V builder texture type tests.
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>
2020-09-21 15:38:10 +00:00
dan sinclair 2dbe9aa784 [hlsl-writer][msl-writer] Enable generate tests.
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>
2020-09-21 15:16:20 +00:00
dan sinclair d05f93fd8e [wgsl-reader] Add workgroup_size parsing
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>
2020-09-21 00:37:08 +00:00
dan sinclair 643827967e [ast][spirv-writer][hlsl-writer][wgsl-writer] Add workgroup_size decoration
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>
2020-09-21 00:28:58 +00:00
dan sinclair 35552f2a48 [wgsl-reader][wgsl-writer] Update variable decorations to new syntax.
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>
2020-09-20 23:02:48 +00:00
dan sinclair 077d16d5e1 [wgsl-reader][wgsl-writer] Update array decorations to new syntax.
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>
2020-09-20 21:28:18 +00:00
dan sinclair 636d588f6e [ast] Add decorations to functions.
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>
2020-09-20 19:18:58 +00:00
dan sinclair 8b685866cd [wgsl-reader][wgsl-writer] Update struct decorations to new syntax.
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>
2020-09-20 19:14:28 +00:00
dan sinclair d3f75ca0e8 Add support for multisampled textures.
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>
2020-09-17 03:53:04 +00:00
dan sinclair 83ed2cc2b9 [wgsl-writer] Emit texture types.
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>
2020-09-17 02:51:03 +00:00
dan sinclair 5e989306e5 [type-determiner] Handle pointer arguments.
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>
2020-09-16 21:20:36 +00:00
Tomek Ponitka 43759bff1c [wgsl-reader] Adding texture_sampler_types to type_decl
Bug: tint:147
Change-Id: Ib806d5c434e98632a83ad8802a3a0aeea609c8c2
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28125
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
2020-09-15 18:35:43 +00:00
dan sinclair 3af512046e [hlsl-writer] Implement some disabled tests.
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>
2020-09-14 19:45:53 +00:00
David Neto 0e70e71a87 [spirv-reader]: entry point names are WGSL identifiers
Bug: tint:233, tint:3
Change-Id: Ib753c47c4a77b852e5065c540da79d8cebe6a100
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28282
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
Commit-Queue: David Neto <dneto@google.com>
2020-09-10 17:01:47 +00:00
David Neto 66dd683148 Fix doxygen: don't describe return of void method
Change-Id: Ib5795e44cbf23155dc2d2a7dcd6466e68dac4e2d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28281
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
Commit-Queue: Sarah Mashayekhi <sarahmashay@google.com>
2020-09-10 16:20:17 +00:00
Sarah Mashayekhi 2e9f1f54c8 [validation] validate switch statement
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>
2020-09-10 14:37:17 +00:00
Tomek Ponitka ed0527a016 Adding a TODO for updating textureLoad on storage images
Change-Id: I1d724a1743caa94ba040aca804dfac6abbb2d6e5
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28360
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Tomek Ponitka <tommek@google.com>
2020-09-10 14:15:37 +00:00
David Neto b6adc5bd42 Simplify getting entry point function
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>
2020-09-08 19:16:05 +00:00
David Neto 0ecac8f6ab Fix GCC warnings
Change-Id: I9c719298a25d28f964c0a987c35fc94426807d51
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28180
Commit-Queue: Sarah Mashayekhi <sarahmashay@google.com>
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
2020-09-08 17:56:55 +00:00
Tomek Ponitka bcb6eb0830 [wgsl-reader] Parsing storage texture type
Bug: tint:147
Change-Id: I446786b529e777d709213e100e57cbae78ded75f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28122
Commit-Queue: Tomek Ponitka <tommek@google.com>
Reviewed-by: David Neto <dneto@google.com>
2020-09-08 16:48:09 +00:00
Tomek Ponitka 03f5e2fc9d [wgsl-reader] Parsing image storage type
Bug: tint:147
Change-Id: I79713b5dfa0a4b219cff7a6bb3c514557cf4f261
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28121
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: David Neto <dneto@google.com>
2020-09-08 16:38:39 +00:00
Tomek Ponitka 4e2d2484f8 [ast] Change intrinsic function names to camel case
Change-Id: I227eade96ccf84a4ed006cc5e98ac9e47f44129a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28163
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: David Neto <dneto@google.com>
2020-09-08 16:30:29 +00:00
Tomek Ponitka cd862fdc7c [spirv-writer] Removing GenerateConstantFloatZeroIfNeeded
Bug: tint:143
Change-Id: I81b4ec280264ec175736bae32bf1826d565ed5c0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28162
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: David Neto <dneto@google.com>
2020-09-08 16:28:59 +00:00
Tomek Ponitka e4f60fa0be [spirv-writer] Fixing memory leaks in texture intrinsics tests
The variables are no longer released.

Bug: tint:143
Change-Id: I56a3edd0e7acb3c729aa82851879d69e510298db
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28164
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Tomek Ponitka <tommek@google.com>
2020-09-07 12:05:28 +00:00
David Neto f51a48dc49 [spirv-reader] Set entry point name
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>
2020-09-03 18:52:47 +00:00
Tomek Ponitka e46282a956 [spirv-writer] Generating texture intrinsic operations
Bug: tint:143
Change-Id: Ibc5b232b952b8ecd8d5d87a7486cdfbc1af29fa4
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/27641
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: David Neto <dneto@google.com>
2020-09-03 17:26:57 +00:00
Sarah Mashayekhi b693b4c10d [validation] add const variables shouldn't have a storage class
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>
2020-09-03 17:20:07 +00:00
Sarah Mashayekhi 75c492a0cc [writer] add a return to convert_image_format_to_spv
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>
2020-09-03 17:17:37 +00:00
dan sinclair e7ec7f1689 [wgsl-writer] Add GenerateEntryPoint
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>
2020-09-03 01:46:36 +00:00
dan sinclair 2dc982f7ea Stub out the method to generate individual entry points.
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>
2020-09-03 01:07:46 +00:00
dan sinclair 0f49753f35 Add reset method to the generators.
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>
2020-09-03 01:02:06 +00:00
dan sinclair 836027e327 Move generators to unique pointers.
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>
2020-09-03 00:58:46 +00:00
Sarah Mashayekhi bab2a4dd96 [validation] Add disabled tests for validating switch statements
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>
2020-09-02 19:58:06 +00:00
Tomek Ponitka fd3ca9ee47 [wgsl-reader] Parsing sampled texture type
Bug: tint:147
Change-Id: I21c864dd63c2003797c78758358ab4134cd8ff31
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28002
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-09-02 15:52:15 +00:00
dan sinclair 17b2b246c1 [hlsl-writer] Simplify generated logical and/or expressions.
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>
2020-09-02 15:13:25 +00:00
dan sinclair 2b5c9b23af [hlsl-writer] Simplify logical and/or code.
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>
2020-09-02 15:09:55 +00:00
dan sinclair 593824c9d3 [hlsl-writer] More logical and/or tests.
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>
2020-09-02 15:06:35 +00:00
dan sinclair b39c77e370 [hlsl-writer] Emit LogicalAnd and LogicalOr operations
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>
2020-09-02 15:02:45 +00:00
dan sinclair a0842b50b9 [hlsl-writer] Support pre stream in if/else statements.
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>
2020-09-02 14:29:05 +00:00
dan sinclair b95fc538ed [hlsl-writer] Emit pre strings
This Cl updates the various statements to emit any pre strings which are
generated when emitting the statements.

Bug: tint:192
Change-Id: Ieb2e621a500c5d91a0b6a2938eabe8e2ffdd11d1
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/27800
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: David Neto <dneto@google.com>
2020-09-02 14:21:05 +00:00
dan sinclair ddb05a3679 [hlsl-writer] Update all expressions to take a pre stream.
This Cl updates all of the expression methods to accept a pre stream.
The prestream is used to output code _before_ the statement which is
executing the expression. This will allow for unwrapping logical and and
or expressions and emitting them prior to their expression.

Bug: tint:192
Change-Id: Ifb24e7b8964948a3893185710f17177aaec2a2c9
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/27780
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: David Neto <dneto@google.com>
2020-09-02 14:19:45 +00:00
Tomek Ponitka 4beff41b7d [wgsl-reader] Parsing texture sampler types
Change-Id: I6a29d81deca40e89cf5b8ca95cf0373af3dd16b7
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28005
Commit-Queue: Tomek Ponitka <tommek@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-09-02 14:16:35 +00:00
dan sinclair f6e5c936b9 Fixup doxygen comment
Change-Id: I5ee292a4c408dc7ce368b2f078422ebce61dbf1f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/27860
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2020-09-02 14:16:25 +00:00
Tomek Ponitka cbd1ef8523 [wgsl-reader] Parsing depth texture type
Change-Id: Ie886c85db52b934331abe2d5675d9d0e6cdd7210
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28001
Commit-Queue: Tomek Ponitka <tommek@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-09-02 14:06:45 +00:00
Tomek Ponitka c354200889 [wgsl-reader] Parsing sampler type
Change-Id: I58a3218a5d0b7ccbe6422340c94cdf3dc1bdf17a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28000
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-09-02 13:26:15 +00:00
Tomek Ponitka 18a54647b7 [spirv-writer] Generate sampler type
Change-Id: I587cf7430711d8009becf76f7630091f32ed3490
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/27840
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
2020-09-01 14:20:24 +00:00
David Neto 7653485162 [spirv-reader] Set some source locations
Set source location on function variable declarations, const
declarations, and most normal instructions.

Bug: tint:3
Change-Id: I469afcdf1b7d8f6d1e64617189a6fa329056737f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/27700
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-08-31 18:52:54 +00:00
Tomek Ponitka 3588406b78 [spirv-writer] Generate texture type
Change-Id: I9a3c75af1c5243f400cd98780736860e68b709ea
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/27580
Commit-Queue: Tomek Ponitka <tommek@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-08-31 16:11:44 +00:00
Tomek Ponitka 6803529d58 [spirv-writer] Convert ast image format types to spv
Change-Id: I987e729a607e69294c472b7667eae82c7339a0df
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/27640
Commit-Queue: Tomek Ponitka <tommek@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-08-31 15:49:43 +00:00
Tomek Ponitka 1a61fc4dc7 [type-determination] Adding builtin texture operations
That includes texture_load, texture_sample, texture_sample_level,
texture_sample_bias, texture_sample_compare. Also determining the
result type.

Change-Id: I9e6fb19964fa171ee9b0594633b2dfe95e3e38b1
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/27360
Commit-Queue: Tomek Ponitka <tommek@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-08-31 15:24:54 +00:00
Tomek Ponitka a454ef9024 [ast] Determining subtype of StorageTextureType
It's determined at the beginning of TypeDeterminer::Determine().

Bug: tint:141
Change-Id: I761199db0c9813dbd42c6cb4ecb3532d1a39f49f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/27460
Commit-Queue: Tomek Ponitka <tommek@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-08-31 15:11:23 +00:00
dan sinclair 764110d675 [msl-writer][hlsl-writer] Pull loop variables out with continuing.
If there is a continuing block we pull the variables declared in the
loop up into the scope outside the loop. This allows those variables to
be used in the continuing block.

We pull out all variables instead of detecting ones which are only used
in continuing as that's easier and still correct.

Bug: tint:187, tint:186
Change-Id: I1de0e36111a236ff04a323cf9777bc79e67afa77
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/27620
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
Reviewed-by: David Neto <dneto@google.com>
2020-08-31 14:15:51 +00:00
David Neto 5a75a174d6 [spirv-reader] Uses in phis count as uses
This is required so we actually emit values that are only used
in phis.

Bug: tint:3, tint:215
Change-Id: I9d957a697839b8d09246905c3f28064f0bc01731
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/27701
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-08-31 14:05:51 +00:00
David Neto c5d65cc917 [spirv-reader] Don't hoist pointers that are already in scope.
Bug: tint:3, tint:213
Change-Id: I79410c670b8690c1f1ea86b7b9427f272a4ebbbb
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/27720
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
2020-08-29 16:11:02 +00:00
David Neto 6c2a7b712c [spirv-reader] Track line numbers
If OpLine debug instructions are present, use their line and column
numbers.  Otherwise, use the instruction number as the line number, starting
counting from 1.

Bug: tint:3
Change-Id: Ia46c10732922b80b5737b13af1ef71f4259a3555
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/27680
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-08-28 20:38:02 +00:00
David Neto 25b856aa64 [spirv-reader] Avoid certain hoisting cases
If a definition occurs in the first block of an IfSelection or
SwitchSelection, then it should count as belonging to the scope of the
parent of that if or switch selection.  This prevents some bad hoisting
decisions.

Bug: tint:3, tint:213
Change-Id: I89df5e8cbc163577e19e78c2bf393eb1eec4a0aa
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/27660
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: David Neto <dneto@google.com>
2020-08-28 19:58:12 +00:00
David Neto fed63103f5 [spirv-reader] Follow non-canonicalized SPIR-V type for composite extract
Follow the actual SPIR-V type when computing a composite extract
instad of the canonicalized view in the optimizer's type manager.
Do this so we can generate the correct member name for a struct,
rather than using the member name for the other representative
struct type. The optimizer's type canonicalizer is insensitive to
struct member names.

Prompted by tint:213, for which the original case was an
access chain.

Bug: tint:3, tint:213
Change-Id: I8705c7ee655fe47c8b7a3658db524fe18833efdb
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/27603
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-08-28 16:28:42 +00:00
David Neto 53b1c39036 [spirv-reader] Follow non-canonicalized SPIR-V type for access chains
Follow the actual SPIR-V type when computing an access chain expression,
instead of the canonicalized view in the optimizer's type manager.
Do this so we can generate the correct member name for a struct,
rather than using the member name for the other representative
struct type. The optimizer's type canonicalizer is insensitive to
struct member names.

Fixes tint:213

Bug: tint:3, tint:213
Change-Id: I88ec42a4cb049b011a59d5522e4cb39bc181a4fb
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/27602
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
2020-08-28 15:49:31 +00:00
dan sinclair 46252ec3ba [wgsl-parser] Consume empty struct closing brace.
This CL updates the WGSL parser to consume the closing } of an empty
struct.

Bug: tint:218
Change-Id: I0b17d2178b1b4b7f44fcf007da867db07dc2a6ae
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/27600
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
2020-08-27 18:17:10 +00:00
Sarah Mashayekhi 5f915f1f92 [validation] check if at least one of vertex, fragment or compute shader is peresent
Bug: tint: 6
Change-Id: I826d951c374409699082f38fb65225f5b4a83f2d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/27483
Commit-Queue: Sarah Mashayekhi <sarahmashay@google.com>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-08-27 18:05:00 +00:00
Sarah Mashayekhi 4bc38c3f63 [validation] Add a helper function to create a fake entry point
Change-Id: I234c04315bec006597caed38f1872baf348a3651
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/27482
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
2020-08-27 17:59:20 +00:00
dan sinclair 8d72a2bc4e Add missing doc comments.
This cl adds some missing doc comments.

Change-Id: Ic5452c2f9a40ddcc4642062a338f602632f3e057
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/27520
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: David Neto <dneto@google.com>
2020-08-26 20:38:46 +00:00
dan sinclair 63b007d34f [hlsl-writer] Move test helper to a template.
This CL updates TestHelper to be a templated class and converts the test
suites into using statements based off that template.

Bug: tint:7
Change-Id: I747434e7c6a8ecae353df448f06153e982dcec44
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/27500
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
2020-08-26 20:02:26 +00:00
dan sinclair 663be30b55 [hlsl-writer] Support matrices in storage buffers.
This CL adds the needed code to load matrix data from a storage buffer.

Bug: tint:7
Change-Id: I850b03adc7fa957b7babbad40d07ec3544b0617f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/27442
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
2020-08-26 19:55:46 +00:00
dan sinclair fea2636945 [hlsl-writer] Emit numthreads for compute shaders.
This CL adds the numthreads annotation when emitting compute shaders.

Bug: tint:7
Change-Id: Ie0f47adfca0a0684f701f280958163b3da0019b4
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/27480
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
2020-08-26 19:24:26 +00:00
dan sinclair 42b0e2d5af [hlsl-writer] Emit zero matrix values.
This CL extends the zero emission to support matrices.

Bug: tint:7
Change-Id: I7e39a68c83edb096fc4b365c66539e8a8b7cb1db
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/27443
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
Reviewed-by: David Neto <dneto@google.com>
2020-08-26 19:24:16 +00:00
dan sinclair 04746d930d [hlsl-writer] Extract storage buffer index generation.
This CL extracts the index string for a storage buffer access.

Bug: tint:7
Change-Id: Ibc0d7dd5b532bbd6141cce4a82495732452d1414
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/27441
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
Reviewed-by: David Neto <dneto@google.com>
2020-08-26 19:22:56 +00:00
dan sinclair 43915bd0a1 Emit structs when emitting the aliases.
This Cl updates the AST dump command to emit struct members after
emitting the type alias.

Change-Id: I5e0c3d8f2cc56525586646c613839c2e014d471f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/27320
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: David Neto <dneto@google.com>
2020-08-26 19:09:26 +00:00
dan sinclair df503f0e85 [hlsl-writer] Refactor output emission.
This CL updates the HLSL backend to take the output stream as a
parameter. This is needed because there are cases where we have to
generate the resulting stream out of order. This will allow that to
happen.

Bug: tint:7
Change-Id: Id1877a07e536a84da0555f207d1030588d44c034
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/27440
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
2020-08-26 19:05:46 +00:00
dan sinclair bdb86723e8 [hlsl-writer] StorageBuffer support.
This Cl adds support for storage buffers to the HLSL backend.

Bug: tint:7
Change-Id: I7adb655de8ccfcb6771fa661ff205c543b4efe66
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/27001
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
2020-08-25 21:22:37 +00:00
Sarah Mashayekhi fc1327f1d9 [validation] implement the pair of entry point stage and name must be unique
This CL implements the following rule:
v-0020: The pair of <entry point name, pipeline stage> must be unique in the module

Bug: tint: 6
Change-Id: Id0c50438861b251d48a9f8dcb8a23556327c965c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/27380
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Sarah Mashayekhi <sarahmashay@google.com>
2020-08-25 21:22:07 +00:00
Sarah Mashayekhi 6a0e28b624 [valdiation] Add disable test for v-0020, the <entry point name, pipeline stage> must be unique
Bug: tint: 6
Change-Id: I3fa9c1427ee99c9a442369516ddef0c11f33304f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/27280
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
2020-08-25 16:06:24 +00:00
Sarah Mashayekhi 4fb431c90e [validation] validates if global variables have a storage class
This CL moves the global variables checks to a function
Adds tests and checks for validation rule v-0022:
Global variables must have a storage class.

Bug: tint: 6
Change-Id: I2f2cd7df6e849bfd1ddfbca35568c6fc3345efa6
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/27283
Commit-Queue: Sarah Mashayekhi <sarahmashay@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-08-25 15:04:53 +00:00
dan sinclair deea295fc1 [wgsl-parser] Set max recursion depth on const_expr
The `const_expr` can recurse into itself if there are type declarations
inside the const_expr (e.g. vec2<f32>(f32(1.0), f32(2.0))). Currently
there is no limit on the amount of recursion which can be triggered.

This CL sets a limit of 128 nested type declarations at which point an
error will be emitted.

Bug: chromium:1112144
Change-Id: Ifae45034dc9de35aed78ba8eddf584a46c7a55ce
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/27340
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
2020-08-25 14:58:33 +00:00
Ryan Harrison a291fc1e7f Ran 'git cl format' over an empty CL
Change-Id: Ied8585a4d266900925a81836db45f7525cd5f628
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/27181
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-08-25 14:55:53 +00:00
Sarah Mashayekhi 3765a24060 [validation] clean up: using ValidatorImpl member instead of creating one
Change-Id: I9a35319a33b5c9c0508d1fdc38c8678ca204b4ce
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/27285
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-08-25 14:09:03 +00:00
Sarah Mashayekhi 3fad211a8f [validation] Add a validator test helper class
Change-Id: I12d225dbbda3ceffda6f0f0dbf264a6a6b249fb2
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/27284
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-08-25 14:06:05 +00:00
Tomek Ponitka 63a5aa7d58 [wgsl-reader] Adding for loops
Implementing ParserImpl::for_stmt(). Also adding
for_stmt and body_stmt to ParserImpl::statement().

Bug: tint:138
Change-Id: Idc3f901648ca115f4d94b3614a940263ef841282
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/27261
Commit-Queue: Tomek Ponitka <tommek@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-08-24 18:22:22 +00:00
Sarah Mashayekhi f70065f622 [validation] Validate if entry point functions accept parameters
Bug: tint: 6
Change-Id: I7e9f50759e65ed6ef3dc25a6c004bec3dfbd4648
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/27122
Commit-Queue: Sarah Mashayekhi <sarahmashay@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-08-24 16:03:36 +00:00
Sarah Mashayekhi c3038ddfa6 [validation] Adds disable test for v-0023, entry point functions accept no params
Bug: tint: 6
Change-Id: I7ea874e90f4dbd213ff35275823342027340e348
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/27121
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
2020-08-24 15:00:46 +00:00
Tomek Ponitka 43c2a6c7d4 [wgsl-reader] Adding body_statement to statement grammar
Block statements will now be parsed in ParserImpl::statement()

Change-Id: I28f63d4a53c85c0306c57df545f78b4562c6ea7b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/27262
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
2020-08-24 13:43:16 +00:00
David Neto c189b1d479 Re-enable float emission tests
Test a value that should stably convert to decimal exponent
representation.  This might be working around a bug in the MSVC runtime
library.

Bug: tint:201
Change-Id: I37200cef815cafc35284c8c873dfbb8a5312360e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/27160
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2020-08-21 21:19:33 +00:00
Sarah Mashayekhi e871e48df0 [validation] validate if entry point functions return void
This CL validates following validation rule:
v-0024: Entry point functions return void

Bug: tint: 6
Change-Id: I420781008016af110cb0d3d65fc018a1301efeae
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/27120
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: David Neto <dneto@google.com>
2020-08-21 15:40:43 +00:00
Sarah Mashayekhi 1026fe3d27 [validation] Add disabled test for v-0024-entry point functions return void
Bug: tint: 6
Change-Id: Iae865125b30952a9422261fbfe14e9b6fb74e16f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/27101
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: David Neto <dneto@google.com>
2020-08-20 21:51:39 +00:00
Sarah Mashayekhi 3c9fee13b9 [validation] checks if function used in entry point exists
This CL check validation rule v-0019: Functions used in entry points must exist.

Bug: tint: 6
Change-Id: Ic4d4702cac53dcdaa1207425a6214d53cacb2442
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/27100
Commit-Queue: Sarah Mashayekhi <sarahmashay@google.com>
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-08-20 21:25:39 +00:00
Sarah Mashayekhi 255cfe829f [validation] Add disabled test for v-0019-entry point functions must exist
Bug: tint: 6
Change-Id: I303fab6e0cd4a807173bef8f69e14220480fbb9a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/27080
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: David Neto <dneto@google.com>
2020-08-20 20:52:29 +00:00
Sarah Mashayekhi 8db00dffa2 [validation] Checks if recursions exist
This CL validates the following rule. ie. As functions must be defined before use (v-0005), self-recursion is only case that has to be invalidated.
v-0004: Recursions are not allowed.

Bug: tint: 6
Change-Id: Icfb040907c5ea0abb6359dade74dcfc30a0db7d9
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/26980
Commit-Queue: Sarah Mashayekhi <sarahmashay@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-08-20 17:00:09 +00:00
dan sinclair d38df397e3 [hlsl-writer] Add support for import statements.
This Cl adds support for imported methods to the HLSL backend.

Bug: tint:7
Change-Id: Ib906542915670dcc916d48d9e5d64d7032ba829a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/26928
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
2020-08-19 19:19:04 +00:00
dan sinclair a1087ee513 [hlsl-writer] Generate intrinsics.
This CL adds the beginning of intrinsic emission for the HLSL backend.
The `outer_product`, `is_normal` and `select` intrinsics are currently
missing.

Bug: tint:7
Change-Id: Ice7a2b285eeb52041e3accd9751e127d6c5a0177
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/26927
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
2020-08-19 19:17:54 +00:00
dan sinclair 3739a23f24 [hlsl-writer] Emit cast expressions.
This CL adds support for cast expressions to the HLSL backend.

Bug: tint:7
Change-Id: Ie7e180dc89abf137ab7d9b8790cc4206b3d5a672
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/26926
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
2020-08-19 19:14:44 +00:00
dan sinclair 10585f0ac3 [hlsl-writer] Add tests for entry point data.
This CL adds the missing tests for emission of Entry Point Data
structures.

Bug: tint:7
Change-Id: If21071b07584780243ccd0629a92efa653640251
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/26925
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
2020-08-19 19:04:54 +00:00
dan sinclair 6fdc77a966 [hlsl-writer] Emit module constants.
This CL adds emission of module constants to the HLSL backend.

Bug: tint:7
Change-Id: Iff07b0c0de7351f400dc35ca2ac07b44b22f8499
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/26924
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
2020-08-19 19:03:24 +00:00