Commit Graph

1446 Commits

Author SHA1 Message Date
Dan Sinclair 8584c6f7fe Add unit tests for UnaryMethodExpression.
This CL adds unit tests for the UnaryMethodExpression AST element.

Bug: tint:11
Change-Id: I5e99bb15f1333c1fa7ff34efafd86739c6a1d662
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16740
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
2020-03-17 14:20:11 +00:00
Dan Sinclair f4434cd403 Add UnaryDerivativeExpression tests
This CL adds tests for the UnaryDerivativeExpression AST element.

Bug: tint:11
Change-Id: Ieabfdcb7940aedc58a3455b74c0ddb508b4859ff
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16673
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
2020-03-17 03:54:38 +00:00
Dan Sinclair 5ced2178a6 Add TypeInitializerExpression tests
This CL adds unit tests for the TypeInitializerExpression AST element.

Bug: tint:11
Change-Id: I92790563c995038cc5a09afd03e84496b8f41487
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16672
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
2020-03-17 03:54:07 +00:00
Dan Sinclair 43aab39237 Add SwitchStatement tests
This CL adds tests to the SwitchStatement AST element.

Bug: tint:11
Change-Id: I3e12667d14ab31cc15f6ea8595847f9daf55dc46
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16682
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
2020-03-17 03:53:41 +00:00
Dan Sinclair 097c3a544d Add more StructMember tests.
This Cl adds more IsValid tests to the StructMember AST node.

Bug: tint:11
Change-Id: I7fec6fb5e96f025735fd444c74f97d4ded8b3ae6
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16671
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
2020-03-17 03:53:06 +00:00
Dan Sinclair 7c44407cd3 Add Struct IsValid tests.
This Cl adds tests for the Struct::IsValid to make sure struct members
are also valid.

Bug: tint:11
Change-Id: I49d9f1dd6a6d2da8c49a273466316a849e1d28cd
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16670
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
2020-03-17 03:52:21 +00:00
Dan Sinclair 0cef04193d Add SetDecoration to_str test
This CL adds a test for the set decorations to_str method.

Bug: tint:11
Change-Id: I06396c1bf59c90aad6a6851cf9695fbee42546a8
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16669
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
2020-03-17 03:51:55 +00:00
Dan Sinclair 7267a851bf Add ReturnStatement test
This CL adds tests for the ReturnStatement AST node.

Bug: tint:11
Change-Id: Ib20e38e67e07e0ae03d359619cc260bc8d6e3a3b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16668
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
2020-03-17 03:51:29 +00:00
Dan Sinclair 33306e1fd1 Add RelationalExpression tests
This CL adds test for the RelationalExpression AST node.

Bug: tint:11
Change-Id: Id16e97110423dd9d987b045325696227df0d2913
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16667
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
2020-03-17 03:48:36 +00:00
Dan Sinclair baaa2af393 Add tests for RegardlessStatement
This CL adds the test for the RegardlessStatement AST element.

Bug: tint:11
Change-Id: Ide4a126e4fa68e84238985d1379dd80123aea5a8
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16666
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
2020-03-17 03:42:02 +00:00
Dan Sinclair 9964846c98 Add tests for NopStatement.
This CL adds tests for the NopStatement AST node.

Bug: tint:11
Change-Id: I890b7f6bc6347ba4f5a67334385feffd24079d5d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16665
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
2020-03-16 14:31:58 +00:00
Dan Sinclair 3eaf827cc8 More module IsValid tests
Bug: tint:11
Change-Id: I1ce2b930f3dbf40791fa68963037e7b9f122658f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16664
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
2020-03-16 14:17:52 +00:00
Dan Sinclair f300756eff Add MemberAccessorExpression tests
This CL adds unit tests for the MemberArrayExpression.

Bug: tint:11
Change-Id: I790d27018b516b3b2b79b6ed892c1a0e00b65818
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16681
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
2020-03-16 14:17:28 +00:00
Dan Sinclair c99fdb84b5 Add LoopStatement AST tests
This CL adds tests for the loop statement AST node.

Bug: tint: 11
Change-Id: I32a3e1d4d40d21e00f4022bd1a2d03ba2ef4f404
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16563
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
2020-03-16 13:58:53 +00:00
Dan Sinclair baca71db9a Add LocationDecoration ToStr test.
Bug: tint:11
Change-Id: I8327d2f3961e4d8d74c6339b66ba36218126e63e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16562
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
2020-03-16 13:47:24 +00:00
Dan Sinclair ce6f648b9b Add KillStatement AST tests
This CL adds tests for the KillStatement AST element.

Bug: tint:11
Change-Id: I1388051ca0639ddaf6b3f2bd2fa5ea8e492b114c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16561
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
2020-03-16 13:40:11 +00:00
Dan Sinclair bb521c0b24 Add tests for if statement AST
This CL adds tests for the if statement AST node.

Bug: tint:11
Change-Id: Ice3f281e1dfd72d76f43767f7b3040af862f4a58
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16540
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
2020-03-16 13:39:44 +00:00
Dan Sinclair 3d1e69767a Add identifier expression tests
This CL adds tests for the identifier expression AST node.

Bug: tint:11
Change-Id: Ie7dd4f1de3d8a23ac7e878285564d8c5fc9e1250
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16502
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
2020-03-16 13:26:10 +00:00
David Neto 9bb0dc543d spv: Build internal representation of the SPIR-V
For convenience, use the SPIRV-Tools' optimizer representation.

Bug: tint:3
Change-Id: I1b046209584e1e907045d496b0f8d7b36fca79bd
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16660
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-03-13 20:21:45 +00:00
David Neto e5dc367a7e spv: reject invalid SPIR-V
Use the SPIRV-Tools validator, with the WebGPU0 environment.

Bug: tint:3
Change-Id: Id1132d209fd939ed68587034761e97da9b35b21d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16821
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-03-13 20:18:06 +00:00
David Neto 1ae7c7dba9 Add SPIR-V parser impl
The parser impl saves a copy of the SPIR-V binary.

Bug: tint:3
Change-Id: I5d61c87123c0bcb417d0c7004e0ef4e3c8fbb027
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16642
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-03-13 20:14:33 +00:00
dan sinclair 306a2f8381 Add IdentifierExpression to WGSL writer.
This CL extends the WGSL writer to output IdentiferExpression and fills
out the variable with initializer test case and implementation.

Bug: tint:4
Change-Id: I9db9affb5ec4c4c109488f60bbc81bf3a96eee35
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16744
Reviewed-by: David Neto <dneto@google.com>
2020-03-12 12:43:05 +00:00
dan sinclair d9e9ff3be5 Start WGSL writer
This CL is the start of a WGSL writer.

Bug: tint:4
Change-Id: Ib2c2580d9e50c36664088556d9b8feec76935211
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16560
Reviewed-by: David Neto <dneto@google.com>
2020-03-12 12:40:01 +00:00
David Neto ab0cdaf652 Add a FailStream error reporting helper
Bug: tint:3
Change-Id: Ie0bb2365a7dd6b2a5e9d0960593fac7586b02922
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16640
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-03-10 22:54:46 +00:00
David Neto f814bdc52a Add stub unit tests for spv parser
Bug: tint:3
Change-Id: I6957cddbdadbcf493fc8f1e3dbe0c6d9037dc56b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16620
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-03-10 22:54:31 +00:00
David Neto bbd8987e71 Instantiate a stubbed SPIR-V parser if file ends in .spv
- spv parser just errors out for now
- link against SPIRV-Tools-opt
- Fixe CMake variable TINT_ENABLE_SPV_PARSER --> TINT_BUILD_SPV_PARSER

Bug: tint:3
Change-Id: Ie4ef9b03e001fca3cc11f65a425612755857feac
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16600
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-03-10 22:54:12 +00:00
Dan Sinclair 49faa4c8d7 Add function tests
This CL adds tests for the function node.

Bug: tint:11
Change-Id: I10b1fb73ae93bf90162948ab42e2a74d4aca7987
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16501
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
2020-03-10 19:19:28 +00:00
Dan Sinclair 9c48ddb917 Add fallthrough statement tests
This CL adds tests for the fallthrough statement.

Bug: tint:11
Change-Id: I1bc8677e00aa9eb446a096bd2600104550480d77
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16500
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
2020-03-10 19:19:18 +00:00
Dan Sinclair cc9d7851e1 Add builtin decoration to_str test.
This CL adds a test for the to_str method of the BuiltinDecoration.

Bug: tint:11
Change-Id: Ia350058fc4f551d62195527f0a6b86751ba92b8c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16481
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
2020-03-10 19:19:06 +00:00
Dan Sinclair d70d07c5b9 Add binding decoration to string test
This CL adds a test for the binding decoration to_str method.

Bug: tint:11
Change-Id: Id9d16bdb68c4b68fb8bd67dae898f8b7a17ee6c9
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16468
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
2020-03-10 19:18:51 +00:00
Dan Sinclair 89b2aa1207 Extend entry point to str testing
This CL adds more tests for the entry point to str method.

Bug: tint:11
Change-Id: I54bb349d606d05221d649215b7b2c6477cca6819
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16480
Reviewed-by: David Neto <dneto@google.com>
2020-03-10 19:18:29 +00:00
Dan Sinclair 18747b657a Extend array accessor validity checks
This Cl extends the array accessor to verify the sub expressions are
also valid.

Bug: tint:11
Change-Id: Ieaa9643e07deaa8c406743c3bbb6fbe3ca9cb1ef
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16467
Commit-Queue: Sarah Mashayekhi <sarahmashay@google.com>
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
2020-03-10 19:11:35 +00:00
Dan Sinclair adb80f005a Add else statement AST tests
This CL adds tests for the else statement AST node.

Bug: tint:11
Change-Id: I30c024775d188223d5a3875ee973ffc8ac78c645
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16466
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
Commit-Queue: Sarah Mashayekhi <sarahmashay@google.com>
2020-03-10 17:48:25 +00:00
Dan Sinclair 3a1368dead Add DecoratedVariable tests
This CL adds tests for decorated variable and updates the API to be
slightly nicer.

Bug: tint:11
Change-Id: I0bd5b8b6e6f682dc9d405e02e51d5dbcaeccc5f3
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16465
Commit-Queue: Sarah Mashayekhi <sarahmashay@google.com>
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
2020-03-10 17:47:56 +00:00
Dan Sinclair b893115c17 Add ContinueStatement unit test
This CL adds tests for the continue statement AST node.

Bug: tint:11
Change-Id: I6339947c338b4b035f7947cb45e33bf2dcb6fe3e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16464
Commit-Queue: Sarah Mashayekhi <sarahmashay@google.com>
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
2020-03-09 13:23:22 +00:00
Dan Sinclair f981455a1c Add ConstInitializerExpression tests
This CL adds unit tests for the const initializer expression.

Bug: tint:11
Change-Id: I9fb9dd77447ac20921997614816cd75272d4e05a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16463
Reviewed-by: David Neto <dneto@google.com>
2020-03-06 21:18:50 +00:00
Dan Sinclair 11be14076b Add cast expression tests
This CL adds unit tests for the cast expression AST element.

Bug: tint:11
Change-Id: Ia5d82a00ef2a4c16d6591095b7674f1c14a33c5f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16462
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: David Neto <dneto@google.com>
2020-03-06 21:18:19 +00:00
Dan Sinclair a659b2113d Add case statement tests
This Cl adds tests for the case statement class.

Change-Id: I585fdff9631ed44e6fb297328ed164297f5fa8f3
Bug: tint:11
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16421
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
2020-03-06 14:28:01 +00:00
Dan Sinclair 00cf5a4894 Add test for call expression
This CL adds unit tests for the call expression. The IsValid method is
extended to verify none of the provided parameters are a nullptr.

Change-Id: I5dfd3ec1f086ef02ab965218a1d8610a1c212628
Bug: tint:11
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16360
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
Commit-Queue: Sarah Mashayekhi <sarahmashay@google.com>
2020-03-05 20:35:57 +00:00
Dan Sinclair 51c811bfa8 Add BreakStatement test
This CL adds unit tests for the break statement.

Change-Id: I78300ea6661e9c331795aedd344ac74c63dd8e25
Bug: tint:11
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16342
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
Commit-Queue: Sarah Mashayekhi <sarahmashay@google.com>
2020-03-05 20:29:13 +00:00
Dan Sinclair 796f65fb70 Add test for assignment statement.
This CL adds unit tests for the assignment statement methods.

Change-Id: I4aea8f22b530bf43b7dfdc2b82b5414cf6590fea
Bug: tint:11
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16341
Commit-Queue: Sarah Mashayekhi <sarahmashay@google.com>
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
2020-03-05 20:20:39 +00:00
Dan Sinclair 91e57dd7d8 Add unit tests for AsExpression
This CL adds unit tests for the as expression and fixes up a few issues
along the way.

Change-Id: I4591f31c1a48ea5580a87a129c728ef3c9be2c7c
Bug: tint:11
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16340
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
2020-03-05 16:35:40 +00:00
dan sinclair 19e26f2fec Move build_module into an anonymous namespace
This CL moves build_module into an anonymous namespace which fixes up a
build warning about missing prototypes.

Change-Id: I8b2f427e32e7851c24492099103565ab0119f4fa
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16503
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
2020-03-05 16:35:25 +00:00
Sarah Mashayekhi 462dd675e1 v-0001: Only allowed import is GLSL.std.450
Bug: tint:10

Change-Id: I566ff378c4cd72febc0a73434b5dfe1039ef2c42
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16420
Reviewed-by: Dan Sinclair <dsinclair@google.com>
Commit-Queue: Dan Sinclair <dsinclair@google.com>
2020-03-04 20:51:29 +00:00
Dan Sinclair e4b68bafda Add unit test for ArrayAccessorExpression
This CL adds unit tests for the array accessor expression class.

Change-Id: I97a7b366a2303b071040164cbcda404fe0592d90
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16281
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: Dan Sinclair <dsinclair@google.com>
2020-03-03 14:09:27 +00:00
Dan Sinclair 6e581895a5 Initial commit 2020-03-02 15:47:43 -05:00