Commit Graph

674 Commits

Author SHA1 Message Date
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
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
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
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 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
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 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 3ffec80c63 Add list helpers
This CL adds various using statements for the

std::vector<std::unique_ptr<CLASS>> constructs found in the AST.
Change-Id: Ic9a2357cd73b2aafd99e961a38727f2f9874cde5
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18920
Reviewed-by: David Neto <dneto@google.com>
2020-04-06 19:37:37 +00:00
Greg Roth 8229360312 Fix compiles on VS2017 and GCC
VS2017 took issue with treating size_t and uint32_t the same. It also
couldn't find various alphanumeric is* functions without the <cctype>
header. Gcc complainted about a variable potentially used uninitialized.

Change-Id: I452b68c6597bae254f32e5a350656e65c8934b6e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18901
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-04-06 17:16:56 +00:00
David Neto cc39bae42c [spirv-reader] Fix SPIR-V assembly, re-enable test
Fix typos in SPIR-V IDs that were causing the optimizer to assert
out when building up its internal data structures.

Bug: tint:3
Change-Id: I27210623b0d3d241dbd6afe6bef63e88a02b390e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18640
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-04-02 03:22:53 +00:00
dan sinclair 66df06817f [spirv-reader] Fix copy elision
This CL removes a std::move which triggers a -Wpessimizing-move error

Change-Id: I378f32a808a86a0944a4bb41f243b7416c10a9fd
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18602
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-04-02 02:35:21 +00:00
David Neto 790b2f6b32 [spirv-reader] Start adding functions
Only emit functions that have bodies.
Don't emit their bodies yet.
Emit them so that callees precede callers.

Bug: tint:3
Change-Id: Ia67ba2fe1d47c7c7d5c290d1d4fc5256fa293b51
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18620
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-04-01 21:21:21 +00:00
David Neto 84f70c0a90 [spirv-reader] Emit module-scope builtin vars
Bug: tint:3
Change-Id: I47ed2e9ed97fd7c45a5aa060a9a6aeaca88092cd
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18500
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-04-01 17:56:18 +00:00
David Neto e0bcb544ac [spirv-reader] Convert builtin enums
Bug: tint:3
Change-Id: I1d94daab782e6e576f4b5a1c7c8816074d3ff307
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18480
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-04-01 17:56:05 +00:00
David Neto 06faf3bd5b [spirv-reader] Emit module-scope variables
Bug: tint:3
Change-Id: I54f35022c86d6c8df635bf86cc7bf39327674f6e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18460
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-04-01 17:55:57 +00:00
David Neto 269a2c6a91 [spirv-reader] Convert pointer type
Bug: tint:3
Change-Id: Ibba1472a1aa3f1399e9596ee6662a29121d88eca
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18420
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-04-01 13:22:34 +00:00
David Neto 0534957e78 [spirv-reader] Convert storage class
Bug: tint:3
Change-Id: Ifb543228a6b32f9afb6c61718a168a0bca4aed14
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18402
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-03-31 20:15:55 +00:00
David Neto a7640d6d4c [spir-reader] Emit alias types (named types)
Bug: tint:3
Change-Id: I4882160d9fe533d956f29ca15e65bf99eb80f5df
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18360
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-03-31 20:02:36 +00:00
dan sinclair 4493d13d49 Fixup shorten64-to-32 warning
Change-Id: I2995d11693f6f49f67b7d3a11dde8e3fdc8dc549
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18401
Reviewed-by: David Neto <dneto@google.com>
2020-03-31 17:45:41 +00:00
dan sinclair e49bd5eeb4 Rename VariableStatement to VariableDeclStatement.
This CL renames VariableStatement to VariableDeclStatement to make it
clearer what it was modeling.

Bug: tint:25
Change-Id: Idd0d27fad7cc402f286e1abad74092c9d1961d91
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18341
Reviewed-by: David Neto <dneto@google.com>
2020-03-30 22:46:48 +00:00
dan sinclair a322f5ddfa Update initializer names.
This Cl updates the names of the initializer expressions to be clearer.

 * InitializerExpression -> ConstructorExpression
 * ConstInitializerExpression -> ScalarConstructorExpression
 * TypeInitializerExpression -> TypeConstructorExpression

Bug: tint:26
Change-Id: Ib046497f589cc65d1d64bc172015588348feeffe
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18340
Reviewed-by: David Neto <dneto@google.com>
2020-03-30 22:46:06 +00:00
David Neto e68c9b4075 [spirv-reader] Convert struct types
Handle as many member decorations as the Tint AST can express right now.
See crbug.com/tint/30

Bug: tint:3
Change-Id: I6d04f1beb438b3d952a76886fbd9c6b7ea701d81
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18160
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-03-30 21:14:28 +00:00
David Neto 4da4c696e2 [spirv-reader] Get decorations
Bug: tint:3
Change-Id: Idfd49c5bfc8629c17f42f954d65c881865548b8a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18140
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-03-30 21:09:59 +00:00
David Neto a8bcec3ac1 [spirv-reader] Add TODO for ArrayStride
Bug: tint:3
Change-Id: I9655ddbe48f2660f88be68bc52c9467d805043ab
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18080
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2020-03-27 21:11:05 +00:00
dan sinclair 136fa11d53 Fixup compilation issues with type manager.
This CL fixes up some issues with the type manager.

TBR=dneto@google.com

Change-Id: I2d05935f26490fd8d20b1b6b1b61692a45e4a0f3
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17940
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-03-27 01:50:13 +00:00
David Neto 288674904d [reader-spirv] Convert array, runtime array types
Bug: tint:3
Change-Id: If0d7d38cc777bce3d86dfd83669c1572331d4ed6
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17800
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-03-27 00:49:03 +00:00
David Neto a8cd18e9e7 Context object owns a TypeManager
Add a Context::Reset method to clear state.

Hide the member behind an accessor.

Change-Id: Iafb7c39249f66f70c5a99a8ed1c69f2c0238834f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17742
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-03-27 00:47:16 +00:00
dan sinclair 113fb07071 [spirv-writer] Generate constants
This CL updates the SPIR-V writer to generate the OpConstantTrue,
OpConstantFalse and OpConstant instructions.

Bug: tint:5
Change-Id: I660554c491e4eb569e3902fce0973fae3f27e6c0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17820
Reviewed-by: David Neto <dneto@google.com>
2020-03-27 00:45:34 +00:00
dan sinclair 989cee6d33 Move tests into anonymous namespace.
This CL moves all test files to the anonymous namespace.

Change-Id: Ie5ae0efe907c03eeb441e90f31c976844172b594
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17900
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2020-03-26 15:31:43 +00:00
dan sinclair f26d9a8f26 Cleanup doc and lint warnings.
This CL fixes up several documentation and linter warnings.

Change-Id: Ic367ba1937f20dfe47a8c8e4035c17e8a3d0f2e8
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17880
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2020-03-26 15:31:36 +00:00
dan sinclair 33d34650e8 [spirv-writer] Emit function signatures.
This CL updates the SPIR-V writer to emit the OpTypeFunction and
OpFunction instructions.

Bug: tint:5
Change-Id: I85ead161ca37304a977213257a825ff268d29f2d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17741
Reviewed-by: David Neto <dneto@google.com>
2020-03-25 19:43:20 +00:00
dan sinclair 9981b63fa4 Use a context object instead of a singleton
This Cl replaces the TypeManager singleton with a context object.

Bug: tint:29
Change-Id: Ia662709db1b562c34955633977ce4363f28f238e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17780
Reviewed-by: David Neto <dneto@google.com>
2020-03-25 19:16:36 +00:00
dan sinclair 0984214d8b [wgsl-writer] Add statement writer helper.
This CL adds a helper to emit a block of statements from the WGSL
writer.

Change-Id: I6fe62d894882c0a0fdc8865967bfa4887f3a65a3
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17761
Reviewed-by: David Neto <dneto@google.com>
2020-03-25 18:54:01 +00:00
David Neto 5e6d033a9e [reader-spirv] Convert vector, matrix types
Bug: tint:3
Change-Id: I4857d36da65fce7a413258f33d7dc4f3d9501c9b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17702
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-03-25 14:33:45 +00:00
David Neto 71e1d81654 Add reader::spirv::ParserImpl::ConvertType
For now, it only handles scalar types

Bug: tint:3
Change-Id: Ic20e18a4f80790e6cd10d4c06dd2abfd8f67a304
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17700
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-03-24 21:42:16 +00:00
David Neto 6cd52e30ef Fix typo
Change-Id: Ic5845cff3e6e708ce88670f3d6038e339a94f33e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17660
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-03-24 19:55:29 +00:00
David Neto 7c6e8ded7d reader::spirv: Fix entry point test fixture name
Bug: tint:3
Change-Id: Ie7cd4f4f45b7be527b8d38a3dd76fac860a65ad8
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17563
Reviewed-by: dan sinclair <dsinclair@google.com>
Commit-Queue: David Neto <dneto@google.com>
2020-03-24 14:39:02 +00:00
David Neto a65ea31910 reader::spirv fix entry point tests
Define the ID targeted by the entry point.  Do this to avoid
asserts in the optimizer code

Bug: tint:3
Change-Id: Idbd4c8a058f2d51ff44696d2029502044d01b424
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17562
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-03-24 12:46:20 +00:00
David Neto a14fec951e readers::spirv: Emit entry points
Bug: tint:3
Change-Id: I66b99ad6ecb3f409f9df7bfa9aa6c4da65e3f66b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17582
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-03-23 22:54:36 +00:00
David Neto 14cfcd707d Add conversion of SpvExecutionModel
Bug: tint:3
Change-Id: I2b1a12beea9343ab3a8db50308e2f6fd790c654b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17581
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-03-23 22:53:42 +00:00
David Neto 1ae8e85144 reader::spirv::Parser: register user names
Bug: tint:3
Change-Id: I4391aa733079d24fb19ff2cba9f612406e63a203
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17580
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-03-23 21:40:23 +00:00
David Neto 23dceb46fc Add reader::spv::ResolveMemberNamesForStruct
Bug: tint:3
Change-Id: If778e98416c19c518261c68d4afdfdc99724967f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17440
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-03-23 16:48:03 +00:00
David Neto ad90ee2ec3 Add reader::spirv:SuggestSanitizedMemberName
Also reader::spirv::GetMemberName

Bug: tint:3
Change-Id: I4cf2dce0703eb17a9d49452294ed0c28ea158a07
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17423
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-03-23 16:45:57 +00:00
David Neto ca8e6dd48d Add reader::spv::SuggestSanitizedName
Bug: tint:3
Change-Id: Ie53bbb7a0b2523a2098b485b6a5bb3d5fa4e52f9
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17422
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-03-23 16:45:01 +00:00
David Neto 8af12f7503 Add reader::spv::Namer::FindUnusedDerivedName
Bug: tint:3
Change-Id: I0a0e5646d7bcdc89fdaaf8b956dd61ed6148c7e9
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17421
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-03-23 16:43:41 +00:00
David Neto bd1d142134 Add reader::spv::Namer::Sanitize
Bug: tint:3
Change-Id: I4d554755dacecac0f2dacf191d85f8e339e87923
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17420
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-03-23 16:42:21 +00:00
David Neto d854fc1543 Rename method RegisterExtendedInstructionImports
Bug: tint:3
Change-Id: If92bd97f9a71bd676ba40430fd736cf721c38747
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17360
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-03-20 19:24:48 +00:00
David Neto be4c89a4d2 Add reader::spirv::Namer
A Namer is a place for saving and looking up names
based on SPIR-V IDs.

Bug: tint:3
Change-Id: I6aeb2f5f7ba63c2e0a816dcbac88f964beafabc6
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17284
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-03-20 19:24:23 +00:00
David Neto 4a19eeff2c Fixing include-what-you-use in SPIR-V parser
Change-Id: If9eeb92dd50bd88e3dcc8b0a8966812a96a153a2
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17287
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-03-18 20:32:49 +00:00
dan sinclair 4b71b9ed2b Expand build flags for Tint.
This CL extends the build options to Tint to make the various readers
and writers all optional.

Change-Id: I913e1830b1bb2243eff5deb4b8079ba592dd52e1
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16801
Reviewed-by: David Neto <dneto@google.com>
2020-03-18 14:08:48 +00:00
dan sinclair e4392c9ab5 Create SPIR-V writer skeleton.
This CL creates the skeleton for the SPIR-V writer.

Bug: tint:5
Change-Id: I849d8766d32d48314a51096710272f9821e2c1c4
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16641
Reviewed-by: David Neto <dneto@google.com>
2020-03-17 21:00:22 +00:00
David Neto 881cdede29 Fix include guards for SPV -> SPIRV
Bug: tint:3
Change-Id: I34a7c8e7dd0116968d2614441b3bcb81d7e5c4e7
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17202
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-03-17 20:08:25 +00:00
David Neto 4df5d409c4 Rename tint::reader::spv -> tint::reader::spirv
Bug: tint:3
Change-Id: Iabee55bc75f60c04d00cd1560721def903052359
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17001
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-03-17 20:08:06 +00:00
David Neto 4e7f7da729 Rename reader/spv to reader/spirv
Bug: tint:3
Change-Id: I7707e2f9e51c1574e5dde18c83957573671dac70
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17000
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-03-17 20:07:41 +00:00
David Neto 3ac99398b5 spv: Parse OpExtInst for GLSL.std.450
It will always use the "std::glsl" import name.

Remember all the IDs of such imports.

Never add more than one GLSL.std.450 import to the AST.

Also refactor the Assemble test helper into its own file.

Bug: tint:3
Change-Id: I5b2b70ea0f00d44aacf553aa009756dff2a4cecf
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16662
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-03-17 16:14:10 +00:00
dan sinclair c83578038a Disable lint warnings in fail stream test.
This CL marks the specific `bool` test as NOLINT in fail_stream to stop
the linter from emitting errors.

Change-Id: Ifa3d9b0a2e0f06bcd0d48cbe79f8dbe91fe7b4ef
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17061
Reviewed-by: David Neto <dneto@google.com>
2020-03-17 16:13:31 +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
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 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 6e581895a5 Initial commit 2020-03-02 15:47:43 -05:00