Commit Graph

1722 Commits

Author SHA1 Message Date
dan sinclair 7b55da5f80 Add GLSL Fract support.
This CL adds Fract into the type determiner.

Bug: tint:5
Change-Id: I616d3259ca903b82339f49317f27966265c3f1d5
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19946
Reviewed-by: David Neto <dneto@google.com>
2020-04-20 15:49:07 +00:00
dan sinclair f1c7f0c779 Add GLSL Ceil support.
This CL adds Ceil support to the type determiner

Bug: tint:5
Change-Id: Iba785dbea412cc94f9b0faa3e6d38f02453d5215
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19945
Reviewed-by: David Neto <dneto@google.com>
2020-04-20 15:48:56 +00:00
dan sinclair d0f0edf8b6 Add GLSL Floor support.
This CL adds Floor into the type determination

Bug: tint:5
Change-Id: I2b9013e073458fbe9f8a9ff657582a715f91c480
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19944
Reviewed-by: David Neto <dneto@google.com>
2020-04-20 15:48:26 +00:00
dan sinclair e9661fbe9b Add GLSL FSign support
This CL adds FSign to the type determination.

Bug: tint:5
Change-Id: I8e3a7e94f367c4aaa510e72f774097946382a968
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19943
Reviewed-by: David Neto <dneto@google.com>
2020-04-20 15:48:20 +00:00
dan sinclair de50e5298d Add GLSL FAbs support
This CL adds FAbs to the type determinator.

Bug: tint:5
Change-Id: I9793f5d469eb5a70f2a024c325e098ed9ca8ea7c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19942
Reviewed-by: David Neto <dneto@google.com>
2020-04-20 15:48:13 +00:00
dan sinclair fa5a66f192 Add GLSL Trunc support.
This CL adds type determination for the Trunc method.

Bug: tint:5
Change-Id: I4f23dad7725f1f076fbbc7da8687de42a02cc482
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19941
Reviewed-by: David Neto <dneto@google.com>
2020-04-20 15:48:03 +00:00
dan sinclair ca1723e990 Add GLSL RoundEven support
This CL adds support for the GLSL RoundEven command in type
determination.

Bug: tint:5
Change-Id: I956ea9532785a42fe51a24b5121ce47cfbc78242
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19940
Reviewed-by: David Neto <dneto@google.com>
2020-04-20 15:47:55 +00:00
dan sinclair fd5d4ca16c [spirv-writer] Add preliminary support for GLSL methods
This CL adds the type determination and builder code to support
outputting the GLSL Round call.

Bug: tint:5
Change-Id: I84dadebaf19aee3361fb13b5f32ce1a9f1b0c421
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19923
Reviewed-by: David Neto <dneto@google.com>
2020-04-20 15:46:18 +00:00
dan sinclair d4d87edc85 Fixup merge conflict.
Change-Id: I4f04677b1c9a4a29157d2940352042802ef88979
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19960
Reviewed-by: David Neto <dneto@google.com>
2020-04-20 15:21:21 +00:00
dan sinclair 50714622b4 Cleanup IdentifierExpression API.
This CL renames the parts of the identifier to segments and then adds a
path() and name() methods to get the respective parts of the identifier.

Change-Id: I1a365df7cb83ac0dd3d6be9ec6ccb83bfc73dd91
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19762
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2020-04-20 14:21:00 +00:00
dan sinclair b950e80a59 [type-determiner] Move ast::Module to constructor.
This CL moves the ast::Module to be provided to the type determiner
constructor so we can access it for things like the imports.

Change-Id: I110fffe669a8a007461bf84d30d85d70405e37be
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19761
Reviewed-by: David Neto <dneto@google.com>
2020-04-20 14:20:01 +00:00
dan sinclair cd077b01a9 Add module to the type determiner test helper
This CL updates the type determiner test helper to have a ast::Module
and updates all tests to use the module. The tests have all be updated
to consistently use the type determiner provided by the helper as well.

Change-Id: If47a873c439e5a5019e21679cba957d4c762f4e6
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19780
Reviewed-by: David Neto <dneto@google.com>
2020-04-20 14:19:04 +00:00
dan sinclair ccb52dc547 [type-determiner] Determine call parameter types.
This CL adds type determination for the call parameters.

Bug: tint:5
Change-Id: I488718bd7a4c1f2304a1c17554b8354d184dc159
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19760
Reviewed-by: David Neto <dneto@google.com>
2020-04-20 14:18:54 +00:00
dan sinclair 6ad9f5d1ed [spirv-writer] Move module to SPIR-V builder constructor
This CL moves the ast::Module to the constructor of the SPIR-V builder
class. This allows access to things like the ast::Import from the
builder class.

Bug: tint:5
Change-Id: I0d61b164c1274d006e124dde2cc11f41a2385fc5
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19922
Reviewed-by: David Neto <dneto@google.com>
2020-04-20 14:18:44 +00:00
dan sinclair c954788b59 Move type methods to type class
This CL moves the checks for different types into the type class so it
can be used in both the type determinater and the SPIR-V builder.

Change-Id: I9142adaf5fc1d6048792645d7892f8d8900fcf59
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19921
Reviewed-by: David Neto <dneto@google.com>
2020-04-20 14:07:43 +00:00
dan sinclair 6866cb7677 [spirv-writer] Add initial loop support.
This CL adds the initial generation of a loop construct into the
spirv-writer. This does not support break or continue yet.

Bug: tint:5
Change-Id: I41f5d9b634a1a4120f880c4143feacc7e58e2147
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19620
Reviewed-by: David Neto <dneto@google.com>
2020-04-20 14:07:29 +00:00
David Neto 340a51e787 Add required overrides for virtual destructors
Fixes build on macOS

TBR=rharrison@google.com

Change-Id: I22e463b76074b499187a472649c46ef1b17c77cd
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19880
Reviewed-by: David Neto <dneto@google.com>
2020-04-17 15:52:49 +00:00
Ryan Harrison 0a196c13c8 Adding support for testing BUILD.gn
BUG=tint:50

Change-Id: Ie19a1af6a97a49a67dcc7474991c960b986ddebe
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19782
Reviewed-by: David Neto <dneto@google.com>
2020-04-17 13:18:20 +00:00
dan sinclair 366b74c364 [spirv-writer] Add binary multiplication.
This CL adds binary multiplication generation to the SPIR-V writer.

Bug: tint:5
Change-Id: I668d24035e947c51a9737549fd0841a4e8af1331
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19700
Reviewed-by: David Neto <dneto@google.com>
2020-04-16 14:14:11 +00:00
Ryan Harrison 460345d993 Add support for WGSL writing to BUILD.gn
BUG=tint:49

Change-Id: I4473176d4177a719b7b2659f765b6b467ac43c84
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19682
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-04-15 20:54:10 +00:00
Ryan Harrison 0caab67e6e Add support for WGSL reading to BUILD.gn
BUG=tint:47

Change-Id: Ic50421f4dc712c614cf5783027ba273b53b2bd83
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19681
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-04-15 20:47:55 +00:00
Ryan Harrison 2b45a52cdf Add support for SPIRV writing to BUILD.gn
BUG=tint:48

Change-Id: I6b92bb372b783ad4498fdc4817d0893851b0bb90
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19680
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-04-15 20:37:02 +00:00
Ryan Harrison d1cf8a8ba5 Add support for SPIRV reading to BUILD.gn
BUG=dawn:16

Change-Id: I1da30fed82a310007674801e3b1e853b25d5b573
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19640
Reviewed-by: dan sinclair <dsinclair@google.com>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2020-04-15 20:35:38 +00:00
David Neto ac3213b4ad [spirv-reader] Add UMod, SMod, FMod
Bug: tint:3
Change-Id: Idd0e5bbc51e05782d3f918e4ffeb83eab52d87d2
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19565
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-04-15 14:02:37 +00:00
David Neto badf99be5d [spirv-reader] Add ISub, IMul, UDiv, SDiv
Bug: tint:3
Change-Id: Id2c9d91742f8bdc712d2dfbda5f4883379a29470
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19564
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-04-15 14:00:57 +00:00
David Neto d4c8ab967b [spirv-reader] Add FOrdEqual, FOrdNotEqual
Unordered equality and inequality is not yet in WGSL
https://github.com/gpuweb/gpuweb/issues/706

Bug: tint:3
Change-Id: I45761ee490829f180110c578283bf136a185de9f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19563
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-04-15 13:59:31 +00:00
David Neto da0a4e9c91 [spirv-reader] Add logical and, logical or
Bug: tint:3
Change-Id: Ia2bde9644a8e3cdd5871570354a380f968760711
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19562
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-04-15 13:58:17 +00:00
David Neto fae8368dfe [spirv-reader] Add bitwise operators
Bug: tint:3
Change-Id: I4ebaafcf2a234dd6c217241f0fb0dd6ee5684a7a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19561
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-04-15 13:57:20 +00:00
David Neto 641208c2b1 [spirv-reader] Add shift operators
Bug: tint:3
Change-Id: I96ba69d35b072712f8c912fd258bca1f32ab5482
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19560
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-04-14 21:02:17 +00:00
David Neto 11d9ac1ee1 [spirv-reader] Add INotEqual
Bug: tint:3
Change-Id: I5de89c15dfdcab1b454e2698244f51b0e2deb4ab
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19541
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-04-14 20:56:14 +00:00
David Neto bd2965858a [spirv-reader] Support OpIEqual
Bug: tint:3
Change-Id: I8d87711dcc0ffd1de3cd4a4874a8bf225c676b30
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19540
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-04-14 20:56:07 +00:00
dan sinclair dc48af981a [spirv-writer] Add shift operators.
This CL adds generation for the OpShiftLeftLogical, OpShiftRightLogical
and OpShiftRightArithmetic expressions.

Bug: tint:5
Change-Id: I3436453350fc9afd3528b1ae238682b7abc6d636
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19508
Reviewed-by: David Neto <dneto@google.com>
2020-04-14 20:48:42 +00:00
dan sinclair 87a3f86155 [spirv-writer] Add divide generation.
This CL adds generation for the OpFDiv, OpSDiv and OpUDiv SPIR-V
instructions.

Bug: tint:5
Change-Id: I9fd875f453dd71857b192a2dad56149bae52caf5
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19507
Reviewed-by: David Neto <dneto@google.com>
2020-04-14 20:32:20 +00:00
dan sinclair e7c23721b9 [spirv-writer] Add modulo generation.
This CL adds support for generating the OpSMod, OpUMod and OpFMod SPIR-V
instructions.

Bug: tint:5
Change-Id: I9e2183535ba24a2d0bb4257dd797a62151fe04a1
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19506
Reviewed-by: David Neto <dneto@google.com>
2020-04-14 20:32:14 +00:00
dan sinclair 35c0d4bbe1 [spirv-writer] Add subtracting generation.
This CL adds generation of the OpFSub and OpISub SPIR-V commands from
the subtraction binary expression.

Bug: tint:5
Change-Id: Ia25a855a972057a4cac70d538946e176e0a0e5c3
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19505
Reviewed-by: David Neto <dneto@google.com>
2020-04-14 20:32:07 +00:00
dan sinclair 266a32954e Cleanup lint errors.
This CL cleans up some lint errors.

Change-Id: Ibfe9768cc4272d015a35a8d7edde0390b8fc66a5
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19504
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2020-04-14 18:16:08 +00:00
dan sinclair f963128c88 [spirv-writer] Add elseif support.
This CL adds support for having elseif statements after an if statement.

Bug: tint:5
Change-Id: I3cd3c5bddaa57c998b1a3fbee7bd87536533301d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19500
Reviewed-by: David Neto <dneto@google.com>
2020-04-14 16:53:27 +00:00
dan sinclair 631a7ac72b [spirv-writer] Add else support.
This CL adds the start of support for else statements.

Bug: tint:5
Change-Id: I742fd4582bfee4f31715b94b7aea6cf8383f4e22
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19412
Reviewed-by: David Neto <dneto@google.com>
2020-04-14 16:47:12 +00:00
dan sinclair 79448a34a0 [spirv-writer] Simple if statements.
This CL adds the code to generate simple if statements.

Bug: tint:5
Change-Id: Ied42ad8b3632d7926ac646d1aa21e190a7a2c07e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19411
Reviewed-by: David Neto <dneto@google.com>
2020-04-14 16:40:30 +00:00
David Neto 74d97e7282 [spirv-reader] Add FDiv
Change-Id: Ie24bb91276340afd77009165af471ce0f53cca39
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19503
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-04-14 16:27:26 +00:00
David Neto 5ef27afbfb [spirv-reader] Add FMul
Bug: tint:3
Change-Id: I2f7f9f451889d394b22bc297d511ee5fe92b7a85
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19502
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-04-14 16:27:01 +00:00
David Neto 31d9036769 [spirv-reader] Add FSub
Bug: tint:3
Change-Id: I6e79e19bf5feb9e0223d770f718a0d0bd9b5b147
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19501
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-04-14 16:26:29 +00:00
David Neto 79797490d8 [spirv-reader] Support OpFAdd
Bug: tint:3
Change-Id: I22a6ff13d3777544101fa8334d598e5a2524caec
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19223
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-04-14 16:16:09 +00:00
dan sinclair a51d697f8c [spirv-writer] Handle output of bitwise xor.
This CL adds bitwise xor support to the spirv writer.

Bug: tint:5
Change-Id: I011283ef12840d25c882b95fc664f2b0dc6003da
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19410
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2020-04-14 15:04:22 +00:00
dan sinclair 2de7cb978d [spirv-writer] Handle bitwise or expression.
This CL adds output of the bitwise or command.

Bug: tint:5
Change-Id: Iad9bafaa0a8394494615922c14c2d33d2d5701bb
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19409
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2020-04-14 15:04:11 +00:00
dan sinclair f95862b806 [spirv-writer] Handle binary and expression.
This CL updates the binary expression to handle the bitwise and command.

Bug: tint:5
Change-Id: I64d53d6aaa1de2fd9ec7959bf084f30736146d78
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19408
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2020-04-14 15:04:03 +00:00
dan sinclair f558809b54 [spirv-writer] Add binary greater than equal comparison.
This CL adds generation for the binary greater than or equal comparison.

Bug: tint:5
Change-Id: I5c81b7d142d29f388800d8b576ec69dc260b243e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19407
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2020-04-14 15:03:55 +00:00
dan sinclair d7e2add6f3 [spirv-writer] Add binary less than equal.
This CL adds generation for the less than equal binary operator.

Bug: tint:5
Change-Id: Ic9d0eb107079c29b2ca1b0eb088e3b2eb7531e1e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19406
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2020-04-14 15:03:47 +00:00
dan sinclair 6b9587b697 [spirv-writer] Add binary greater than comparison.
This CL adds the binary greater then comparison output.

Bug: tint:5
Change-Id: I86fa90b3d98f3ee81174edafb188c445b94f9d29
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19405
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2020-04-14 15:03:39 +00:00
dan sinclair f30c212987 [spirv-writer] Add binary less than comparison
This CL adds support for the less than comparison operator.

Bug: tint:5
Change-Id: Ibfca48652ff0817bacd2badca183cb87f8c8ed31
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19404
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2020-04-14 15:03:31 +00:00