Commit Graph

588 Commits

Author SHA1 Message Date
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
dan sinclair 0d0d0b290d [spirv-writer] Add binary not equal.
This CL adds support for the not equal comparison.

Bug: tint:5
Change-Id: Idb91a02b546e49d67d6dc8570c754e611643a1f2
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19403
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2020-04-14 15:03:24 +00:00
dan sinclair 07aead8570 [spirv-writer] Adding binary equals generation
This CL adds generation for a == operator.

Bug: tint:5
Change-Id: Ib27836a42153f3732927234cfa9aed342d0f9ac1
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19402
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2020-04-14 15:03:13 +00:00
dan sinclair e9e925d0a0 [spirv-writer] Convert binary tests to parameterized.
This CL changes the binary tests to be paramaterized to make it easier
to add more tests.

Bug: tint:5
Change-Id: Ib4edb3c368c0cba3252dd139841dd5f1be4bc34c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19401
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2020-04-14 14:47:10 +00:00
dan sinclair a28bcceb15 Remove premerge.
This CL removes the premerge statement and replaces it with a `premerge`
reserved word.

Change-Id: Ic9bc13878ed26e1733eb65dd1ba30d9bef095cb6
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19380
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2020-04-14 14:46:58 +00:00
dan sinclair efb5d4e10f Remove regardless.
This CL removes the regardless statement and turns `regardless` into a
reserved word.

Change-Id: I50c521111b90dbadddaeb36674e8c40205186076
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19361
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2020-04-14 14:46:51 +00:00
David Neto 2a3e79cf8c [spirv-reader] Store to module-scope variables
Bug: tint:3
Change-Id: Ib4dbb976268999529c2a1c55531aa8293e565b9c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19222
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-04-14 14:23:59 +00:00
dan sinclair b39dabd0cd Run formatter
TBR=dneto@google.com

Change-Id: Idccbc5eeec6d763cdacd8d050bb396a0c897c7ca
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19400
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-04-12 19:47:16 +00:00
dan sinclair fa3944c3dd [spirv-writer] Add simple identifier support.
This Cl adds the start of issuing loads for IdentifierExpressions. This
does not handle the more complicated cases around pointers and
OpAccessChain yet.

Bug: tint:5
Change-Id: Ic858a7d9200399e3066ca92cd5c130bbe527de76
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19100
Reviewed-by: David Neto <dneto@google.com>
2020-04-12 18:21:59 +00:00
dan sinclair 0e2da73625 More ignores
Change-Id: Ia855252b711cc20d96780b1880eb28ee29d90364
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19360
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-04-12 18:21:02 +00:00
David Neto 3743c5ee65 [spirv-reader] Support IAdd
Also adds generic support for generating a combinatorial value
as a const definition.

Bug: tint:3
Change-Id: Idae758d146264491679710967e48ea270436be91
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19107
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-04-09 20:45:31 +00:00
Ryan Harrison 4d32be4f1b Remove suppressing [chromium-style] errors
Lots of little style nits needed to be fixed for this work.

BUG=tint:44

Change-Id: Ibb45d9e3f6795ee0c09f5eca994bb28e20979d97
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19221
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-04-09 18:52:06 +00:00
David Neto 1234633b32 [spirv-reader] Handle OpLoad
Bug: tint:3
Change-Id: I25fdf086e49426240a771b70306b417cd8012777
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19140
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-04-09 13:29:17 +00:00
Ryan Harrison 2962888b8c Add in basic BUILD.gn and additional DEPS
This is a minimal config that gets us building the tint binary from samples/

BUG=tint:2

Change-Id: Ifafa903e99a34f1c47177eb954df69ecbe70cb36
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19106
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-04-08 20:40:25 +00:00
David Neto a1a86007c9 [spirv-reader] Emit stores
Bug: tint:3
Change-Id: Ibda57e58ac13abb650eb0f3e01adbd40b439a82b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19120
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-04-08 20:06:26 +00:00
dan sinclair 7456f4258a Better type determiner errors.
This CL adds the source info into the type determiner errors so they
will include line and column number if available. If the line number is
0 then it's considered the source info is missing and it is not emitted.

Add line and colummn to type determiner errors

Change-Id: I18764a71db80082fd31c8509c5e9b193800f1d95
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19105
Reviewed-by: David Neto <dneto@google.com>
2020-04-08 19:58:35 +00:00
dan sinclair d5dea224e0 Convert vectors to list aliases
This CL converts a few more std::vector<std::unique_ptr<foo>>'s to
FooList aliases.

Change-Id: If0dd672f11beaeabd9e89e82903c2174b11be6e1
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19103
Reviewed-by: David Neto <dneto@google.com>
2020-04-08 19:58:28 +00:00
dan sinclair ee8ae04472 Set function storage class in type determiner.
If a non-const variable in a function has a kNone storage class we
update it to kFunction. If there is a storage class other then kFunction
we emit an error.

Bug: tint:5
Change-Id: If45eb91bd0a0095e625eb1d0e1d1e361c784e35d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19102
Reviewed-by: David Neto <dneto@google.com>
2020-04-08 19:58:20 +00:00
Ryan Harrison 9459dbf3ab Use the correct pop pragma
BUG=tint:43

Change-Id: If0f6ff0b65af4c66fe7114eb7160e93ef060fbf9
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19104
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-04-08 18:52:53 +00:00
dan sinclair 719bfe01bf [spirv-writer] Add relational add
This CL adds the relational add expression to the spirv writer.

Bug: tint:5
Change-Id: Ideed225c63e60f53a019b79803809f8e973299c6
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18605
Reviewed-by: David Neto <dneto@google.com>
2020-04-08 17:18:20 +00:00
David Neto 2c60b4c2cc [spirv-reader] use Function storage class on function vars
Change-Id: I22c76ea8bce7d050411b9dd0e283abe1dae8bc6c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19101
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-04-08 17:18:07 +00:00
David Neto d877e8b084 [spirv-reader] Start emitting expression
Bug: tint:3
Change-Id: I2e2fe41c43abbcbbc941968c0115d703f6bff501
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18822
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-04-08 14:24:18 +00:00
David Neto ec322349e2 [spirv-reader] Emit module-scope var initializers
Bug: tint:3
Change-Id: Ifadd7616945e2392d6705746b295448a21366b0f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18821
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-04-08 14:24:06 +00:00
David Neto 4194d0f948 [spirv-reader] Emit function variable initializers
Bug: tint:3
Change-Id: I1c7fa2c282e6dd95ea048df83f608d4462150394
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18820
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-04-08 14:23:42 +00:00
David Neto 4fa1ceb094 [spirv-reader] Emit function vars, no initializers
Bug: tint:3
Change-Id: I64a4a2c675e5440766ffc814867e6cf247d14c13
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18706
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-04-07 20:25:03 +00:00
David Neto 753cdc75c4 [spirv-reader] Test EmitFunctionDeclaration
Tests FunctionEmitter directly.
This is mostly refactoring to be able to selectively run parts of the
parsing flow, and to access relevant internal data.

Bug: tint:3
Change-Id: Ic2b166a2e9623a7e30e6769806088d12e78dcf45
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18704
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-04-07 19:56:02 +00:00
David Neto 574bce6746 [spirv-reader] Split function emission into parts
Bug: tint:3
Change-Id: Ifedf4e00c7d89641496330ab20bf797f656c761c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18703
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-04-07 19:55:54 +00:00
David Neto e70e10953b [spirv-reader] Refactor function emission
Create a FunctionEmitter class.
Move ParserImpl::Name to Namer::Name, and add tests.

Bug: tint:3
Change-Id: I271e8c75f6f5a0edf9d94fe0a4af5a022afac708
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18702
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-04-07 19:54:52 +00:00
dan sinclair cd543df18d Add missing memory include
Change-Id: Icab0d32f199d4b0f95e2c1ebcd9ae9ea9ec7b61c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19020
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2020-04-07 19:42:40 +00:00
dan sinclair 0e9d9ed60f Fill in some disabled tests
This CL completes a few of the DISABLED tests.

Change-Id: I38806fb9381240d6e3da700f1fb2dac5f899ca6d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19000
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2020-04-07 19:27:49 +00:00
dan sinclair 1c9b486d6e Rename RelationalExpression to BinaryExpression.
Match the more common usage for the expression type.

Bug: tint:37
Change-Id: Ia5d48a0444742ec4e304ea1036e499b3d7cad682
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18981
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2020-04-07 19:27:41 +00:00
dan sinclair 327ed1bf8a Add missing break, continue and return tests.
This CL adds tests for break, continue and return without attached
expressions.

Bug: tint:5
Change-Id: I8c4221e787af95f5597db3ea4e42b38962223bf4
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18980
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2020-04-07 19:27:21 +00:00
dan sinclair 0e2576250a Add unary op expresison type determination.
This CL adds type determination for the unary op expression.

Bug: tint:5
Change-Id: I5b9c0c80bb48527f1f26febb2310f9640e5f7849
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18850
Reviewed-by: David Neto <dneto@google.com>
2020-04-07 19:27:11 +00:00
dan sinclair 8dcfd108a9 Add type determination for unary method.
This CL adds the type determination for the unary method expression.

Bug: tint:5
Change-Id: I9f94a79b9715cf74e37c74eb1a612ca84b3c241f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18849
Reviewed-by: David Neto <dneto@google.com>
2020-04-07 19:27:00 +00:00
dan sinclair b173056fca Add unary derivative type determination.
This Cl adds the type determination for unary derivative expressions.

Bug: tint:5
Change-Id: I44ad22733ce6b94e4b6d77b432024bacc110e8af
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18848
Reviewed-by: David Neto <dneto@google.com>
2020-04-07 19:26:49 +00:00