Commit Graph

674 Commits

Author SHA1 Message Date
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