All includes from .cc to .h are preserved, even when transitively included.
It's clear that there are far too many includes in header files, and we should be more aggressive with forward declarations. tint:532 will continue to track this work.
There are, however, plenty of includes that have accumulated over time which are no longer required directly or transitively, so this change starts with a clean slate of *required* includes.
Bug: tint:532
Change-Id: Ie1718dad565f8309fa180ef91bcf3920e76dba18
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/44042
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Move out of the src root and into its own subdirectory
Rename methods to remove the 'Determine' prefix.
Fixed: tint:529
Change-Id: Idf89d647780f8a2e7495c1c9e6c402e00ad45b7c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/44041
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
BUG=tint:527
Change-Id: I4f017993ffa85515b5b646bd9cf15c4b6d50c441
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/43700
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
WGSL recently removed this concept, since it didn't exist in WebGPU,
so excising it from the code.
BUG=tint:515
Change-Id: Ibbca6bd643fd96c2fb10bd33f471c9e9e58de535
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/42320
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Change-Id: I4e3b22e64554427f341a1bb260d72aa202c6b53c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/42027
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Some comments from https://dawn-review.googlesource.com/c/tint/+/42060
were not addressed before it landed, this is a follow-up to address
them.
BUG=tint:489
Change-Id: Ieafe143e867ce0f5edf6cf2258db3ed12ffc13fb
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/42080
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
BUG=tint:489
Change-Id: I03a15fdd156bf0c85b1afebb6e0e26fd44dff51f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/42060
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Use a type alias for the most common and lengthy return type.
Drop the `const` from the return type - it is (or at least should be) meaningless.
Fix `auto& referenced_variables =` local variable declaration in inspector.cc.
You cannot take a reference to a non-ref return value of a function.
I have no idea why the compiler wasn't erroring about this.
Change-Id: Icc0b4a9bf4b4c9d03b44670eda27214ef04ad41c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/42021
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Storage classes are unused for constants.
Also trim extra arguments to these variable constructor functions that are already defaulted to the same value.
Change-Id: Ia0b44364de000bfb8799de15827ce08fcce5f5be
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/41541
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
Move the storage parameter after type.
Const() has no use for storage classes, so this parameter will be removed in the next change.
This reordering keeps Var() and Const() parameter types identical for the first two non-optional fields
Change-Id: I66669d19fa2175c4f10f615941e69efcab4c23e1
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/41540
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
inspector_test.cc: Remove unused method
test_helper.h: Fix comment type on member
Change-Id: I53b1392fa1fa8154efdcd471d1df1bbf27e04dc9
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/41728
Commit-Queue: Ben Clayton <bclayton@google.com>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
BUG=tint:489
Change-Id: I28e4b0e568aea463971e9d2f5a04f04e942e2564
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/41600
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Also adds to the binding struct what type of resource it is.
BUG=tint:489
Change-Id: I8ce56a1a613b330150545781cb42d2afeaa69375
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/41460
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
textureLoad():
* Does not operate on cube textures
* Does not have a `level` parameter for storage textures
* Requires an `array_index` argument for arrayed texture types
textureSample():
* Only supports f32 data types for sampled textures
Bug: tint:449
Change-Id: I30b3a0c32245d5e6c4b1f3aeef112a67ffb1d055
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/40506
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Pull the mutable semantic field from ast::Variable and into a new semantic::Variable node.
Have the TypeDeterminer create these semantic::Variable nodes.
Bug: tint:390
Change-Id: Ia13f5e7b065941ed66ea5a86c6ccb288071feff3
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/40063
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
Make private all TypeDeterminer::DetermineXXX() methods, forcing all tests to use the root-level TypeDeterminer::Determine() method.
Remove TypeDeterminer::RegisterVariableForTesting().
The main use for calling the TypeDeterminer::DetermineXXX() methods was to perform type determination on a partial AST.
This was messy and often resulting in multiple calls into TypeDeterminer. Most tests already perform a full TypeDeterminer::Determine() call when the program is built, so many of these were redundant.
The exposure of these internal methods for testing also makes refactoring the TypeDeterminer extremely difficult.
Add a number of ProgramBuilder helper methods for attaching the partial AST in these tests to the root of the AST, greatly simplifying the use of the TypeDeterminer:
* ProgramBuilder::Global() and ProgramBuilder::GlobalConst() are helpers that register the variable returned by ProgramBuilder::Var() and ProgramBuilder::Const(), respectively.
* ProgramBuilder::WrapInFunction() is a variadic function that accepts variables, expressions and statements, attaching these to the root of the AST via a dummy function.
Most test classes now no longer use their own TypeDeterminer, and instead properly depend on the automatic type determination performed at Program build time.
Bug: tint:390
Change-Id: Ie901890420c5de170cdf2a7aaef9b96fc3bebd60
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/40062
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
Pull the mutable semantic fields from ast::Function and into a new semantic::Function node.
Have the TypeDeterminer create these semantic::Function nodes.
Bug: tint:390
Change-Id: I237b1bed8709dd9a3cfa24d85d48fc77b7e532da
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/39902
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
With the ast::Module::Functions().
Also remove pointless calls to td.Determine() that will automatically be
done when the program is built.
Change-Id: Ia7506e430b04d91d4f6b02fb6b678d0ea9912bcd
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/39900
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Removes the need for Dawn to use the TypeDeterminer directly.
TypeDeterminer errors will be added to the Program diagnostics list.
Change-Id: I4cfb405e7e6b0e94727296eea872a3ddc4412b66
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/38921
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
By putting diagnostics into the program, we can hold all the diagnostic messages for parsing and type determination in one place.
This also means that we can simplify the public WGSL and SPIR-V Parser interfaces to a single function.
Change-Id: Ib6ab5fa180addd45c4aaf0c6b192d47182ffb50a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/38920
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Program is now immutable*, and remains part of the public Tint
interface.
ProgramBuilder is the mutable builder for Programs, and is not part of
the public Tint interface. ast::Builder has been folded into
ProgramBuilder.
Immutable Programs can be cloned into a mutable ProgramBuilder with
Program::CloneAsBuilder().
Mutable ProgramBuilders can be moved into immutable Programs.
* - mostly immutable. It still has a move constructor and move
assignment operator - required for practical usage - and the
semantic information on AST nodes is still mutable.
Bug: tint:390
Change-Id: Ia856c50b1880c2f95c91467a9eef5024cbc380c6
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/38240
Reviewed-by: dan sinclair <dsinclair@chromium.org>
This builder will be merged into ProgramBuilder, where these will become methods.
To breakup this change, perform the refactoring as a separate change.
Bug: tint:390
Change-Id: I2c9151cd9f198e99d88eaf296dd994293df6c425
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/38720
Reviewed-by: dan sinclair <dsinclair@chromium.org>
This is required in order to support move operators for TypesBuilder.
Bug: tint:390
Change-Id: I9667bda5f5be267df092f5cd94dc40db053ae6e2
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/38555
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Enforce all places where Dawn passes in or returns a ast::Module, now takes a `const Program* ` or returns a `Program`.
As the end goal of all this is to have immutable Programs, all Program inputs take a pointer instead of moving the actual object.
As consumers of a Program are now all const, we have to const_cast to work around all the places we've been incorrectly mutating a ast::Module.
These const_casts are temporary, and will be fixed in the next set of changes.
Depends on https://dawn-review.googlesource.com/c/dawn/+/38522
Bug: tint:390
Change-Id: Ie05b112b16134937d1b601e9b713ea4ec4e1c677
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/38541
Reviewed-by: dan sinclair <dsinclair@chromium.org>
BUG=tint:456
Change-Id: I941b25dd5bf5e758d5fdecf379137d92d5db8556
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/38460
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
`tint::Program` will become the new public API object for a parsed shader program.
For now, have Program be a simple wrapper around ast::Module so we can migrate Dawn's use of the public tint API.
Add new Program variants of public APIs for places that returned or took a Module.
Remove Reset() methods from Generators, they aren't used, and make the migration harder.
Change-Id: Ic5bee46ceb109ea591ba7fec33685220b244a1ae
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/38540
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Module will be split into Module (immutable) and ModuleBuilder (mutable).
By moving these methods to the FunctionList, we can deduplicate a bunch of common logic.
Bug: tint:390
Change-Id: I3fd85200aae4e8dc3d5afce8c9aaa6512809a3a0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/38363
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Internally use BlockAllocator to allocate the types.
When we optimize the allocation patterns of BlockAllocator, this will now benefit both AST nodes and types.
Remove Reset(). It was not used.
Remove type::Manager::Get(std::unique_ptr<type::Type>) - this was used (via Module::unique_type) in one place, which has easily been migrated to using the standard Module::create<>.
Replace all remaining uses of std::unique_ptr<> of types in tests with the standard create<> so we can guarantee uniqueness of the types.
Change-Id: Ib0e1fe94e492b31816450df5de0c839a0aefcb9e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/38362
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
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>
Adds this data to the Inspector API, as well as needed internal
utility methods.
Updates and expands tests to cover changes.
BUG=tint:452
Change-Id: I598f8149cb6abd13abf606416ae61e615b99e1e1
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/38200
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
This Cl updates the `storage_buffer` storage class to just be `storage`.
Change-Id: Ibfaecbb0862bd60d39665eb937c0b6300899e177
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/38161
Auto-Submit: dan sinclair <dsinclair@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
This CL changes the set decoration to a group decoration. We still parse
`set` until downstream users can be updated.
Bug: tint:338
Change-Id: I610d1ed769b3a26c117ad6d875f8a99a3d5b7754
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/37920
Auto-Submit: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
This CL reverts the changes to use the top level namer in the various
backends. This is causing issues when rolling into Dawn in the case
where the tint generator is used to create SPIR-V which is sent to
SPIRV-Cross but then generator and inspector aren't used. The entry
points end up being incorrect as SPIRV-Cross gets the renamed entry
points.
Change-Id: I4749e1d773f2bd9edcce83e63555f07a443d5ca5
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/37342
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
This was changed originally, but we no longer need the module to be
non-const for the Inspector. Set it back to const to fix the Chrome
roll.
Change-Id: I68166a7a687249cab5c344167386144554b7d175
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/37221
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
This Cl updates all of the generators and the inspector to use the
mangle namer by default.
Change-Id: Id6811d76bf2475a2c2a2864fb8fc0f43e95a6e65
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/36944
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
This CL adds an extra constructor to the inspector to change the namer
user. The inspector tests are then updated to use the test namer.
Change-Id: Ibc91de89b52161dc125b38d65e445b5833ad6c18
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/36943
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
This CL removes the function name accessor and changes all usages to use
the symbol.
Change-Id: I19b92bf1bc557ba14e68ef8cb381487a4ad1f7ee
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/36821
Reviewed-by: Ben Clayton <bclayton@google.com>
This CL removes the name getter from the Variable class. All usages are
updated to use the symbol.
Change-Id: I3e4d86d2124d39023cad6113c62230c1757ece71
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/36780
Reviewed-by: Ben Clayton <bclayton@google.com>
This CL adds the namer to the Inspector when getting the remapped name.
Change-Id: Ic5ed8c50a24b7a1cc303767d049a358181d27603
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/36661
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Change-Id: Icea3b4acfa407110d9ae078e9b3ea13fb13ca31e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/32561
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
This CL goes through and converts things which call RegisterSymbol to
use the helper builders. Several variables are also updated to use the
helper as it will need RegisterSymbol in the near future.
Change-Id: Ib5a8e8be54c1eaad123384fab09f6625421d9fcd
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/35880
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Commit-Queue: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
Auto-Submit: dan sinclair <dsinclair@chromium.org>
This CL adds a Func helper to the ast builder class. The helper is then
used through the various files to simplify function creation.
Change-Id: Ie93777586e9311d82cff5932dfba2c4ca763ae08
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/35823
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
This CL updates the ast::Builder to provide help creating struct members
and decorations. The helpers are then used throughout the various files
to simplify the code.
Change-Id: I53af4578190499d9ae2623073f8a44182954e5d9
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/35821
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Auto-Submit: dan sinclair <dsinclair@chromium.org>
This CL adds the symbol to the struct member. The name will eventually
be removed when the symbol is used everywhere.
Change-Id: Ie97f61509804992b44b22396773a635efbc4458e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/35780
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Auto-Submit: dan sinclair <dsinclair@chromium.org>
This consistency can be utilized by the ast::Builder to inject the source parameter if it isn't provided.
Bug: tint:396
Bug: tint:390
Change-Id: I2f19002131e79daae799b8cbe918eb192d6bfc75
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/35503
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
This CL adds a Symbol to the struct type along side the name. The name
will be removed in a future CL when the symbol is used everywhere.
Change-Id: I6c355908651ba0a155a1e0c9ed1192313a405568
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/35620
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
And swap the `decorations` and `members` parameters, as decorations come last for other constructors.
Parsers need fixing up.
Bug: tint:396
Bug: tint:390
Change-Id: Ie9b814c1de24b6c987f0fbb9e6f92da7c352caa2
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/35163
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
This CL adds a Symbol to the identifier to represent the name. The name
still exists but will be removed in a future CL when the namers are in
place.
Change-Id: Ic3cc8ad0d99e3bea6eb1ff1ce212e7de67991aec
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/35460
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Auto-Submit: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
This Cl adds a Symbol representing the function name to the function
AST. The symbol is added alongside the name for now. When all usages of
the function name are removed then the string version will be removed
from the constructor.
Change-Id: Ib2450e5fe531e988b25bb7d2937acc6af2187871
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/35220
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Auto-Submit: dan sinclair <dsinclair@chromium.org>
Remove all Variable setters (with exception to set_storage_class() which is called by the TypeDeterminer)
Bug: tint:390
Change-Id: I172667e21e2b02e85dcea6703aa1e608ec718250
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/35015
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
set_source() will be removed, so sources will only be specifiable at construction time.
Bug: tint:390
Change-Id: I2b81929e362ccf75145ebc45028dd973a77ae068
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/35010
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
set_source() will be removed, so sources will only be specifiable at construction time.
Bug: tint:390
Change-Id: I5c79efd3fa501ebd9308f7f93cfb77bc12198047
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/35009
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Move them to the constructor
Bug: tint:390
Change-Id: I30bb6a1de060b790bf5202194d020d4e3889a307
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/35008
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
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>
This CL removes all internal usage of the Context object. It is still
accepted as a parameter until we update Dawn, but all usage is removed.
The namer has been removed from the SPIR-V backend with this change and
the emitted names reverted to their non-modified version.
Change-Id: Ie6c550fab1807b558182cd7188ab6450a627f154
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/34740
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Auto-Submit: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
They already exist in a `ast::type` namespace, so `ast::type::BlahType` is just stuttering.
This is more important now that Is<> and As<> use the full type name.
Change-Id: I7c661fe58cdc33ba7e9a95c82c996a799786661f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/34321
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Handle wsgl parsing and spirv writing of:
textureSample(), textureSampleBias(), textureSampleLevel(),
textureSampleGrad(), textureSampleCompare()
Handle the different signature for array texture types.
Includes offset overloads.
Change-Id: I6802d97cd9a7083f12439b32725b9a4b666b8c63
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/32985
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Remove all redundant std::move()s. I've also removed calls to
std::move() in tests, even if they act as an optimization. This is for
two reasons:
(a) Performance is not important for testing, and this helps with
readability.
(b) A whole bunch tests were relying on std::move() clearing vectors so
they can be repopulated and used again. This is undefined behavior:
> Objects of types defined in the C++ standard library may be moved from
> (12.8). Move operations may be explicitly specified or implicitly
> generated. Unless otherwise specified, such moved-from objects shall
> be placed in a valid but unspecified state.
All of these UB cases have been fixed.
Removed all duplicate variables left over from:
`auto* foo_ptr = foo.get()`
which became:
`auto* foo_ptr = foo`
Bug: tint:322
Change-Id: Ibd08a2379671382320fd4d8da296ccc6a378b8af
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/32900
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
This is a minimal effort to fix up the code. There's substantial code
cleanup which can now be done, which is done in the next change.
Bug: tint:322
Change-Id: Iafcf5e814837d9534889e8c21333de4931a19cfa
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/32864
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
In a near-future change, AST nodes, such as ast::BlockStatement will no longer
be std::unique_ptrs, and will have to be constructed and owned by an external
class. This means AST nodes can no longer allocate default child nodes.
Bug: tint:322
Change-Id: Iddb5605b9bc0de80ad2710ced0e429f89410af2f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/32675
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
create() is currently just a simple forwarder to std::make_unique<>, but
will be later replaced with a function that returns a raw pointer,
and owned by the context.
Bug: tint:322
Change-Id: Ibb9f437b9cb8b9883e05d1a266fa69141dc200d0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/32668
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
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>
This is a temporary fix to get Tint rolling into Dawn again and will
be removed in a future patch.
BUG=tint:273
Change-Id: I632e71711146eb4055f46c1bebfbd6d3ff5772fa
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/32520
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Add remapped_name to entry point structure, also supply method to find
the remapped name for individual entry points.
BUG=tint:312
Change-Id: I5f2cc02bc37c17e99c453b16108bc8e10c602fba
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/32383
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Change-Id: Idf831d3b6b4c6e97191ebead9fd503d4a15db9e3
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/32380
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
BUG=tint:257
Change-Id: I146591d052edfc959df33ccf235ea466cb59e59d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/32260
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
This Cl hashes the OpName, OpEntryPoint and OpMemberName strings so we
are no longer passing user provided strings through into the resulting
SPIR-V binary.
Bug: tint:273
Change-Id: I0ca2c65d0cd2800c54d867ab698c7751c341778c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/32061
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
Adds in method to get resource binding information for comparison
samplers along with tests.
BUG=tint:257
Change-Id: I60f675347d2b9596308b1599d0a9b846615d547e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/31980
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: David Neto <dneto@google.com>
Adds in method to get resource binding information for non-comparison
samplers along with tests. Additionally some of the infrastructure for
implementing an equivalent comparison sampler code path is included.
BUG=tint:257
Change-Id: I5775bbd6233e1014bea54c5281d460544ab8383d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/31920
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Updates the extraction code to assume that the StructType will be
wrapped by an AccessControlType. Tests are changed to match this
behaviour, and some minor naming clean up occured.
BUG=tint:257
Change-Id: I888ac2fae228531e956437afb937082a142d5736
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/31780
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
BUG=tint:257
Change-Id: Ie9486726b2a164971d720f4496a87a0bd118ebde
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/31760
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>