Commit Graph

33 Commits

Author SHA1 Message Date
James Price 77daee15bd Remove legacy EmitVertexPointSize transform
This has been moved into the Spirv sanitizer, and Dawn is now using
this path.

Change-Id: Iffcbbc1c84e6bad0ebc51ded82d998bb307e2d6d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50564
Auto-Submit: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-05-11 13:16:10 +00:00
Ryan Harrison 593c87b414 Remove fuzzing for transform::EmitVertPointSize
BUG=tint:753

Change-Id: Idb1f942defe6233421ea735a56bab8da8add8024
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50360
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-05-07 15:48:04 +00:00
Ryan Harrison da43604eab Remove fuzzers for transforms that should only be invoked by sanitizers
Also mark code elements that should be removed as part of
https://crbug.com/tint/753

BUG=tint:722

Change-Id: I52aedeffcb06e302f8399d83986909b36749ca5e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/49560
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-04-29 19:59:55 +00:00
Ryan Harrison 23c73b0b32 Add fuzzing for transform::CanonicalizeEntryPointIO
BUG=tint:722

Change-Id: Id6ca2a8c5b807c84658969a09ca75281f62221d1
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/49381
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-04-28 18:13:03 +00:00
Ryan Harrison be303e9265 Add fuzzing for transform::CalculateArrayLength
BUG=tint:722

Change-Id: Ide83964646f303c03a9cc780f3828f1816baa288
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/49380
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-04-28 17:57:23 +00:00
James Price 0949bdf68f Add transform to strip entry points from a module
Remove the Generator::GenerateEntryPoint() APIs as they were mostly
unimplemented and not used by anything except the Tint sample app,
which now uses the new transform.

Change-Id: I1ccb303d6c3aa15e622c193d33b753e22bf39a95
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/49160
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>
2021-04-28 15:33:03 +00:00
Antonio Maiorano aea9c68de9 Move type/* files to sem/ directory
Bug: tint:724
Change-Id: I45d83d32dbce1fbee265810615c18219ef879b20
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/48363
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-04-19 22:54:43 +00:00
James Price f8f31a458f Automatically run entry point IO canonicalization
Avoids the need for downstream users to manually run this transform.

Change-Id: I0c63e2fd8b6ad49b752ed1757370e386171481cb
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/47440
Commit-Queue: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-04-09 13:50:38 +00:00
Antonio Maiorano 71512e30ca Remove validator.h
With this change, the Validator is fully removed from Tint, including
from it's public API.

Fix: tint:642
Change-Id: Id4867cc3866bb2ea09eff499537d58b938d18f43
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/47125
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-04-09 13:26:38 +00:00
James Price dc8f08a782 [msl-writer] Use entry point interface canonicalization transform
This replaces the entry point IO component of the MSL sanitizing
transform, and completes support for the new entry point IO syntax.

Struct emission in the MSL writer is updated to use the correct
attributes depending on the pipeline stage usage.

Fixed: tint:510
Change-Id: I7ace33568c5a6e1bbf5c90f67b920579ba14be78
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/46520
Auto-Submit: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
2021-03-31 18:42:12 +00:00
Ben Clayton e0c1221b37 Add transform::BindingRemapper
A transform to replace binding points and access control flags.

Required by Dawn for the HLSL and MSL backends

Fixed: tint:104
Fixed: tint:621
Fixed: tint:671
Change-Id: Ic6ccc4a8a7724697cc4af0fad25394a1973eeb22
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/46262
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-03-29 21:25:45 +00:00
Ben Clayton d1781fd0af Remove tint::Namer
Replaced with tint::transform::Rename and was never used.

Bug: tint:273
Change-Id: Icf0b19b389377f3c9a6efcf3ca232ba294775f9b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/43981
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2021-03-04 21:00:15 +00:00
Ben Clayton e18a18bc1c Add transform::Renamer
Renames symbols.
Currently only supports renaming to a symbol with a monotonic increasing suffix.

Change-Id: I7ae67a7b1740ac0e83c1821643cf7b8b1959f84d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/42842
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
2021-03-04 11:12:45 +00:00
Ben Clayton 5bde7c054a tint.h: Remove the type_determiner.h include
This is no longer public-api

Change-Id: I030d37b0d1dbd38ea3ec6d19c47b15d7ce9d0667
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/41482
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2021-02-10 21:48:55 +00:00
Ben Clayton 2101c35f3b Stub sanitizer transforms for the hlsl, msl & spirv writers
These transforms will perform work to massage the Program into something consumable by the given writer.

Change-Id: I8989e8d4bc1a9cae7ce1f8764c8f3811db3bd04d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/41483
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2021-02-10 21:22:03 +00:00
Ben Clayton 207b5e2de1 Move tint::ast::type to tint::type
Despite `tint::ast::type::Type` being in the AST namespace, these classes are clearly not AST nodes:
* They don't derive from ast::Node
* They're deduplicated by the type manager
* None of the types have an Source - they have no lexical declaration point
* The fact we have `ast::Struct` and `ast::type::Struct` clearly demonstrates what is an AST node, and what is a type.
* We have code scattered in the codebase (TypeDeterminer, writers, etc) that create new types after parsing - so clearly not part of the original syntax tree.

Types in tint are closer to being semantic info, but due to the parse-time generation of types, and tight dependency of ast::Nodes to types, I'd be reluctant to class these as semantic info. Instead, put these into a separate root level `tint::type` namespace and `src/tint` directory.

The fact that types exist in the ast::Module has already caused bugs (https://dawn-review.googlesource.com/c/tint/+/37261). This is a first step in separating out types from the ast::Module.

Bug: tint:390
Change-Id: I8349bbbd1b19597b8e6d51d5cda0890de46ecaec
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/38002
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2021-01-21 15:42:10 +00:00
David Neto 995516e0e2 Add --demangle option to command example
The --demangle option preserves original source names
when dumping the AST or emitting text-based shader languages.

Change-Id: Iac450158c6b9f0ac780b7e5580cb02c41dd5df17
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/36480
Commit-Queue: David Neto <dneto@google.com>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Auto-Submit: David Neto <dneto@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2021-01-05 22:45:50 +00:00
Enrico Galli 3d449d2be5 [transform] Add first index offset transform
Adding new transform to workaround D3D's vertex/instance_index always
starting from 0

Bug: dawn:548
Change-Id: I048f39e76e236570f3ce337a77d804384ee659a4
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/34600
Commit-Queue: Enrico Galli <enrico.galli@intel.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-12-08 21:07:24 +00:00
dan sinclair c35176eadf Remove the context object.
This CL strips the context object out of Tint.

Change-Id: Id0dcb9c557b217c03a8d9ac08fc9fe1c799f3fdc
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/34742
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2020-12-07 16:03:54 +00:00
Ben Clayton 00b77a80ab Rework all transforms to transform-on-copy
instead of transform-in-place.

This is a public API breaking change, so I've added the `DAWN_USE_NEW_TINT_TRANSFORM_API` define which is used by Dawn to know which API to use.

As we're going to have to go through the effort of an API breaking change, use this as an opportunity to rename Transformer to Transform, and remove 'Transform' from each of the transforms themselves (they're already in the transform namespace).

Bug: tint:390
Bug: tint:389
Change-Id: I1017507524b76bb4ffd26b95e550ef53ddc891c9
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/34800
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2020-12-04 09:06:09 +00:00
Ben Clayton 76d12f0f5a Add EmitVertexPointSizeTransform
EmitVertexPointSizeTransform is a Transformer that adds a PointSize builtin global output variable to the module which is assigned 1.0 as the new first statement for all vertex stage entry points.

If the module does not contain a vertex pipeline stage entry point then then this transformer is a no-op.

Bug: tint:321
Change-Id: I0e01236339d9fa1ceab3622af0931a1199c33b99
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/34561
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-12-03 14:54:09 +00:00
Ben Clayton 3e67c5dba6 Move type_manager to the ast dir/namespace
First step to moving this to the `ast::Module`.

Also remove a bunch of redundant includes to `type_manager.h` as this is already included in `context.h`

Bug: tint:307
Bug: tint:337
Change-Id: Ic4baffa7b76ddefa29f56f758c25b1003ef40888
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/33665
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
2020-11-23 19:30:55 +00:00
dan sinclair 196e097730 Place the namer into the context object.
This CL moves the namer into the context object and makes it a parameter
to the various generators. The old constructor is maintained until we've
updated downstream repos.

Bug: tint:273
Change-Id: I49b2519c4250be21fb73374b16e7c702b727078f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/32580
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
2020-11-13 18:13:24 +00:00
Sarah Mashayekhi 34f90a0097 [validation] make validator directory
Change-Id: Ia5caea84b48b37f0bee9582ee4c8514da4ee3978
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/31981
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: David Neto <dneto@google.com>
2020-11-06 17:31:15 +00:00
Ryan Harrison 4735f01193 Move diagnostic/printer.h into the public API
Bug: None
Change-Id: I6dc33f3e589de80b225199fb01a0d80df774ada3
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/31740
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
2020-11-03 19:13:50 +00:00
Ryan Harrison 8904253837 Add getting constant ID information from Inspector
This also involves a reorganization of the code into its own
subdirectory.

BUG=tint:253

Change-Id: If05018da2662e923e659b485576704f3a6bcd062
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/30340
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-10-16 02:26:54 +00:00
dan sinclair 70b4c3baad [transform] Add transforms to the sample app.
This CL extends the sample app to allow running the bound array accessor
transform.

Bug: tint:206
Change-Id: I226a947a2e0a9e0945aa044b2847b4fd62b7c277
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/29122
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2020-09-30 00:05:23 +00:00
dan sinclair 5c948e4f8f [transform] Move the transform folder
This CL moves the transform folder from src/ast to src/. The transforms
operate on the AST, but they aren't part of the AST so I think the top
level folder makes more sense.

This will possibly cause issues when rolling if the transform is being
used.

Change-Id: Ibd7c94474168a7a4bdf38321f4e12ad111c80323
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28941
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2020-09-24 14:30:34 +00:00
dan sinclair e7ec7f1689 [wgsl-writer] Add GenerateEntryPoint
This Cl adds the preliminary GenerateEntryPoint method to the WGSL
writer.

Bug: tint:211
Change-Id: Ib414ff66d482179f10eeeb890f6127bc585cd664
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28045
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: David Neto <dneto@google.com>
2020-09-03 01:46:36 +00:00
Idan Raiter 63551e3b2f Add vertex pulling transform
Adds a first-pass version of vertex pulling. This is missing several important things such as buffer offsets, support for more types, and clamping.

Bug: dawn:480, tint:206
Change-Id: Ia8a3abc446bca4c5a40e064f85fb59de1c3f5af9
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/26260
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
2020-08-12 17:23:58 +00:00
dan sinclair feffa9d887 [hlsl-writer] Scaffold the HLSL backend.
This CL adds the scaffolding for the HLSL backend.

Bug: tint:7
Change-Id: Iaf9f5159bc409f3ac71fcec281229258bdfa021b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/25000
Reviewed-by: David Neto <dneto@google.com>
2020-07-20 22:13:37 +00:00
dan sinclair 2a59901483 [metal-writer] Stub out the Metal Shading Language backend.
This CL adds the basis of the Metal Shading Language backend.

Bug: tint:8
Change-Id: I85976250eb41ac12203a5db116444e993c3d09d4
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/23700
Reviewed-by: David Neto <dneto@google.com>
2020-06-23 17:48:40 +00:00
Ryan Harrison be45ff5081 Create tint.h for external users
tint.h selectively includes headers depending on what features are enabled. It
is based off of the original sample code, so should give users access to all of
the functionality demonstrated in there.

This is located in include/tint/, so that users can have a pretty include of
tint/tint.h.

BUG=tint:87

Change-Id: I8659c789c154349e4e8e7730dc334da4fb6eba70
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/23124
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-06-11 19:35:20 +00:00