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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
- 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>
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>