Commit Graph

108 Commits

Author SHA1 Message Date
dan sinclair 3125a8d73f [ast] Add texture types to the AST.
This CL adds the texture types into the AST.

Bug: tint:141
Change-Id: I8e95aa23849af737e63d9cacc8c57f23aedec73d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/26123
Reviewed-by: David Neto <dneto@google.com>
2020-07-30 23:26:28 +00:00
dan sinclair fe8c59ace9 Add SamplerType to AST.
This CL adds the sampler type into the AST.

Bug: tint:141
Change-Id: Id2f7678a2df677cb7dae47f05543c1e0a1999eed
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/26080
Reviewed-by: David Neto <dneto@google.com>
2020-07-30 22:27:25 +00:00
dan sinclair 8278f2c6f0 [hlsl-writer] Add loop support.
This CL adds support for the LoopStatement emission in HLSL.

Bug: tint:7
Change-Id: Ie42b24abff3a69c9cbfe3d3c8ab6fb9b1823e61d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/25849
Reviewed-by: David Neto <dneto@google.com>
2020-07-30 22:27:09 +00:00
dan sinclair 97bc4ad8d6 [hlsl-writer] Add if/else statements.
This CL adds if/else statement emission to the HLSL writer.

Bug: tint:7
Change-Id: Idd6e6d8c329ed270676fa0276474a68c715dd9eb
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/25847
Reviewed-by: David Neto <dneto@google.com>
2020-07-30 22:26:55 +00:00
dan sinclair cbe0668f9b [hlsl-writer] Emit variable declarations.
This CL adds variable declarations to the HLSL backend.

Bug: tint:7
Change-Id: I5c1e42ca26029f1595bf4f23b3b867a492ddacc1
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/25846
Reviewed-by: David Neto <dneto@google.com>
2020-07-30 22:26:46 +00:00
Ryan Harrison b07cb63896 Add SPIR-V Reader Fuzzer
Also clean up the mess I made of the build rules, so they actually work.

BUG=tint:57

Change-Id: I9c92d043a7be8f51ed7885a29eb153f078cc66d9
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/26125
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-07-30 21:24:29 +00:00
Ryan Harrison 26479f19c7 Remove _exe suffix from sample program
BUG=tint:196

Change-Id: I4fb8fb8f00173743792914eff4427c5725bc9266
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/26122
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-07-30 18:44:14 +00:00
Ryan Harrison 1a50cb9064 Simplify fuzzer targets to ease adding additional targets
BUG=tint:199

Change-Id: Ic42c8e5ea03f012e2be8e9bdbf46490bdc0048a9
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/26120
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-07-30 18:43:48 +00:00
dan sinclair f961850988 [hlsl-writer] Add member accessor emission.
This CL adds emitting MemberAccessorExpressions to the HLSL backend.

Bug: tint:7
Change-Id: Ic6c99232e98322c8145700d5f1a3a8314cf60feb
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/25844
Reviewed-by: David Neto <dneto@google.com>
2020-07-29 19:12:19 +00:00
dan sinclair 7cf1979667 [hlsl-writer] Add AsExpression to the HLSL backend.
This CL adds as casts to the HLSL backend.

Bug: tint:7
Change-Id: I599527d665a3ec1ab6cf80b4f550f7aee8fdf294
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/25843
Reviewed-by: David Neto <dneto@google.com>
2020-07-29 19:11:15 +00:00
dan sinclair d450a920d5 [hlsl-writer] Add BlockStatement support.
This CL adds support for BlockStatement to the HLSL backend.

Bug: tint:7
Change-Id: I953a1b85a05cd84e8e296d677204ae9b5a3ae669
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/25860
Reviewed-by: David Neto <dneto@google.com>
2020-07-29 19:06:46 +00:00
dan sinclair cda5af0fa2 [hlsl-writer] Emit discard.
This CL adds the discard statement to the HLSL writer.

Bug: tint:7, tint:166
Change-Id: I292e9b97a1246c9b79a9660ec229ff7855aeb2a9
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/25842
Reviewed-by: David Neto <dneto@google.com>
2020-07-29 18:56:50 +00:00
dan sinclair ec007b98c7 [hlsl-writer] Emit array accessors.
This CL adds array accessor expressions to the HLSL backend.

Bug: tint:7
Change-Id: I46d60f5d8ef74fee2a2f4da48c2d792969bfa365
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/25820
Reviewed-by: David Neto <dneto@google.com>
2020-07-29 18:56:35 +00:00
dan sinclair 0e48082549 [hlsl-writer] Add alias type support.
This CL adds support for emitting type aliases to the HLSL backend.

Bug: tint:7
Change-Id: Ibd2c2d3bbe6c9a86033e379b4e1cb494259b4df2
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/25800
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
2020-07-29 18:56:25 +00:00
dan sinclair 4a11b5600d [hlsl-writer] Add constructor emission.
This CL adds scalar and type constructor emission to the HLSL backend.

Bug: tint:7
Change-Id: I2b402b7eb66f266c3a111c9b07502ef17cc1a679
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/25726
Reviewed-by: David Neto <dneto@google.com>
2020-07-29 18:50:18 +00:00
dan sinclair 4551a31050 Add hlsl writer tests to BUILD.gn
The check to add the HLSL tests if needed into the BUILD.gn test list
was missing. This CL adds it.

Bug: tint:7
Change-Id: I662bc49fb4f88543cfb9b3b315deb5a678d169b4
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/26001
Reviewed-by: Ryan Harrison <rharrison@google.com>
2020-07-29 18:50:06 +00:00
dan sinclair 8cce7cece8 [hlsl-writer] Add type emission.
This Cl adds the start of type emission to the HLSL backend.

Bug: tint:7
Change-Id: I403635080841c63382afe162ac80ae2be30b4faa
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/25780
Reviewed-by: David Neto <dneto@google.com>
2020-07-29 18:30:44 +00:00
Ryan Harrison 88f0ae369f Get 'gn gen --check' passing
BUG=tint:123

Change-Id: I0b13be1e0ecd4a4fa5a20160276cb9af47495410
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/25862
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-07-28 15:59:17 +00:00
Idan Raiter e018cefdce Fix Tint ninja build
Rebasing I saw chromium style issue with auto pointers and a missing BUILD.gn file.

Change-Id: I7666595664b5eb95f681b3d2edd1d84df7d6fe63
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/25848
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-07-28 15:04:07 +00:00
dan sinclair 0975dd5663 [spirv-writer] Add BlockStatement emission.
This CL adds BlockStatement support to the spirv-writer. The type
determiner is also updated as needed.

Bug: tint:134
Change-Id: I91e08c3acafd67401a010fff21abde7feec46e8e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/25609
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
2020-07-27 15:25:00 +00:00
dan sinclair cd182b137e [msl-writer] Emit BlockStatement.
This CL adds BlockStatement emission to the MSL backend.

Bug: tint:132
Change-Id: Ie64c02b81760787f6d8aa8833b9756ede3deddf9
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/25608
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
2020-07-27 15:25:00 +00:00
dan sinclair 21f8e253a0 [wgsl-writer] Add emission of BlockStatement.
This CL adds BlockStatement writting to the WGSL writer.

Bug: tint:131
Change-Id: I6d1d286134311cea13e19c7381ed344da8205199
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/25607
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
2020-07-27 15:25:00 +00:00
dan sinclair 775cb51794 [ast] Add BlockStatement
This CL adds a BlockStatement to wrap the statements in a given block.

Bug: tint:130
Change-Id: Idc2389e001d9d87ef7f45dcd8aa90bbd27ff7dce
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/25606
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
2020-07-27 15:25:00 +00:00
dan sinclair 99ad0e8c94 [msl-writer] Emit intrinsics.
This CL adds intrinsics to the MSL backend.

Bug: tint:8, tint:159
Change-Id: I03e3c4bdf234ec4ca437ab1b1a0d4835e3342b0c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/25500
Reviewed-by: David Neto <dneto@google.com>
2020-07-25 14:39:23 +00:00
dan sinclair 8f3c6356d4 Remove KillStatement
This CL removes the KillStatement from the AST and replaces all test
usage with DiscardStatement.

Bug: tint:169
Change-Id: Ie68dd3cdd54056f144d10506f05cc1f6903d1cda
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/25605
Reviewed-by: David Neto <dneto@google.com>
2020-07-25 14:33:50 +00:00
dan sinclair d81bebcfcc [wgsl-writer] Add DiscardStatement support
This CL adds the DiscardStatement to the WGSL writer.

Bug: tint:165
Change-Id: I012bc030482e097fd9a957ed96f15d8360f621a5
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/25603
Reviewed-by: David Neto <dneto@google.com>
2020-07-25 14:33:04 +00:00
dan sinclair a9696b511f [msl-writer] Emit DiscardStatement.
This CL adds the DiscardStatement to the MSL backend.

Bug: tint:164
Change-Id: I1e201d3b6a167690af7bb799e1c93e48232f4a0a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/25602
Reviewed-by: David Neto <dneto@google.com>
2020-07-25 14:32:54 +00:00
dan sinclair 6a61d4127e [spirv-writer] Add DiscardStatement support.
This CL updates the spirv-writer to emit the DiscardStatement as an
OpKill.

Bug: tint:163
Change-Id: Ic2514ee8a4ef7ef0220fc2e1145f8df0c3d32069
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/25641
Reviewed-by: David Neto <dneto@google.com>
2020-07-25 14:32:44 +00:00
Ryan Harrison 433670b576 Add usage of main from chromium when part of a chromium build
BUG=tint:123

Change-Id: Ic7a8694cefd0dbee2a1855e84f4ffaaf75ad6e7a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/25520
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2020-07-22 17:36:39 +00:00
Sarah Mashayekhi fbf4506356 [validation] Add a disabled test for assignment statement.
Bug: tint:6
Change-Id: I37fe9f69917a007b9e3325de324e719637b192e8
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/25420
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
2020-07-22 12:59:19 +00:00
dan sinclair a0b73e8aca [hlsl-writer] Add assignment statement.
This CL adds the assign statement emission to the HLSL backend.

Bug: tint:7
Change-Id: I3e46ac09170ea1af7444ae89267a82e1d1c42c52
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/25224
Reviewed-by: David Neto <dneto@google.com>
2020-07-21 15:58:56 +00:00
dan sinclair 41aa1a1ed8 [hlsl-writer] Add switch statement support
This CL adds emission of switch statements to the HLSL backend.

Bug: tint:7
Change-Id: Ie6f41031878a1f5a945f9310429d28fb0e4a98c8
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/25223
Reviewed-by: David Neto <dneto@google.com>
2020-07-21 15:58:50 +00:00
dan sinclair 557a0f8e63 [hlsl-writer] Emit case statements.
This CL adds emission of case statements to the HLSL backend.

Bug: tint:7
Change-Id: I5d0dd7ecfe4ef032a03777c29f3d0d00e584a93a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/25222
Reviewed-by: David Neto <dneto@google.com>
2020-07-21 15:58:43 +00:00
dan sinclair 6dab73b5c6 [hlsl-writer] Emit unary operators.
This CL emits unary operators from the HLSL backend.

Bug: tint:7
Change-Id: I997d89d62d279fc7440ba6045c56e290ec7601c1
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/25221
Reviewed-by: David Neto <dneto@google.com>
2020-07-21 15:58:36 +00:00
dan sinclair abfdd22acc [hlsl-writer] Emit break, return and continue.
This CL updates the HLSL writer to emit break, return and continue
statements.

Bug: tint:7
Change-Id: I03eafc343e57e9e8d1efaf930023099d6f85fc57
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/25220
Reviewed-by: David Neto <dneto@google.com>
2020-07-21 15:58:29 +00:00
dan sinclair dee9136c20 [hlsl-writer] Add binary operator emission.
Emits the binary operators.

Bug: tint:7
Change-Id: I6f4fce3b6fb646b8340e39538b041715a676ac28
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/25164
Reviewed-by: David Neto <dneto@google.com>
2020-07-21 15:58:20 +00:00
dan sinclair fbbc617888 Parse void function call.
This CL updates the WGSL parser to handle a void function call.

Fixes: tint:45
Change-Id: If5b2a4b9e62f0b10e0f2e2e10c0ca2586c5268e8
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/25322
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2020-07-21 15:13:36 +00:00
dan sinclair e5228407f4 [hlsl-writer] Add emission of identifiers
This CL adds identifier emission and an HLSL namer to guard against
names using reserved words.

Bug: tint:7
Change-Id: Id3d73ff683048c26ac99451d21c3dd7ef3c620a3
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/25001
Reviewed-by: David Neto <dneto@google.com>
2020-07-21 14:51:33 +00:00
dan sinclair 2e40491467 Add a call ast statement.
This CL adds CallStatement to the AST to allow wrapping a CallExpression
into a statement.

Bug: tint:45
Change-Id: I5a9525514344fcc2cf9900eb2cd78c1fb94ca2ef
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/25320
Reviewed-by: David Neto <dneto@google.com>
2020-07-21 13:42:05 +00:00
David Neto c29bad28ad [spirv-reader] Support function calls, except returning void
Functions returning void are blocked on https://crbug.com/tint/45

Change-Id: I15ec9cf0e267571bbfab921c678a59e25d0e3619
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/25280
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-07-20 22:19:01 +00:00
dan sinclair feffa9d887 [hlsl-writer] Scaffold the HLSL backend.
This CL adds the scaffolding for the HLSL backend.

Bug: tint:7
Change-Id: Iaf9f5159bc409f3ac71fcec281229258bdfa021b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/25000
Reviewed-by: David Neto <dneto@google.com>
2020-07-20 22:13:37 +00:00
dan sinclair 26c8a216e8 [msl-writer] Add import emission.
This CL adds emission of import function calls to the MSL backend.

Bug: tint:8
Change-Id: Ib8b8638b11caee2ff3557d551447b215ef2a4c69
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/25262
Reviewed-by: David Neto <dneto@google.com>
2020-07-20 22:13:00 +00:00
Ryan Harrison c8af502c01 Fix issues with BUILD.gn
Couple of little style issues, and a path to a file that was incorrect.

Change-Id: I21d1a4ca41bc36163602378086989ac712f54469
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/25265
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-07-20 19:54:23 +00:00
Ryan Harrison 31cfdb111e Clean up how deps are defined in BUILD.gn
gn gen --check is failing in chromium due to how includes are propagated
out of deps. Re-organizing them to resolve this.

Change-Id: I3c21bbb0cb8b5bc5bdad4ab97d557d718a3cdc33
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/25120
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-07-16 20:13:16 +00:00
dan sinclair 4264af9d3d [msl-writer] Emitting of program constants.
This CL adds code to emit program constants in the MSL backend.

Bug: tint:8
Change-Id: I63e40983253349d2e293904fbe9b6f543b885b34
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/24940
Reviewed-by: David Neto <dneto@google.com>
2020-07-16 17:54:26 +00:00
dan sinclair c5a5f9666f [msl-writer] Handle emitting user function calls.
This CL adds support for calling user defined functions from the MSL
backend. Intrinsics and imports are not handled yet.

Bug: tint:8
Change-Id: I45c3078d014ab89cc0eec76dd626759077e1a890
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/24763
Reviewed-by: David Neto <dneto@google.com>
2020-07-14 20:37:38 +00:00
dan sinclair a2eb8c52b2 [msl-writer] Generate input/output structs
This CL adds generation of the input/output structures for entry points.

Bug: tint:8
Change-Id: I93942496bcea0a2eea944e5e1cd0baf383530f5e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/24721
Reviewed-by: David Neto <dneto@google.com>
2020-07-14 20:37:20 +00:00
dan sinclair 45101598a1 [msl-writer] Add variable declarations.
This CL adds variable declarations to the MSL backend.

Bug: tint:7
Change-Id: Icf63ad44a217213e5036eb76429e25a3031822eb
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/24540
Reviewed-by: David Neto <dneto@google.com>
2020-07-08 20:52:46 +00:00
Ryan Harrison 7b819aa162 Multiple fixes to get BUILD.gn builds working again
Change-Id: I00c8050d85e25c4e926c06b4df1381434de92f34
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/24460
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-07-07 19:11:07 +00:00
dan sinclair 6002a3345f [msl-writer] Add namer class.
This CL adds a namer class to prevent collisions with builtin names in
MSL. The MSL generator has been updated to use the namer anywhere that
names are emitted.

Bug: tint:8
Change-Id: I820f226a7286be1d5b0d613bd0fa41b68cb9f8ba
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/24184
Reviewed-by: David Neto <dneto@google.com>
2020-07-02 20:53:45 +00:00