Commit Graph

156 Commits

Author SHA1 Message Date
Ben Clayton 6761160dc1 ast: Move Module function methods to FunctionList
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>
2021-01-21 18:45:50 +00:00
Ben Clayton 281b602f59 type::Manager: Simplify interface and use BlockAllocator
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>
2021-01-21 16:35:10 +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
Ben Clayton 0a68b365eb Implement textureNumSamples()
SPIR-V reader TODO

Bug: tint:140
Bug: tint:437
Change-Id: Id95855660680b12e3ff49b6340ef966dfa49f8e4
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/37848
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2021-01-14 18:11:17 +00:00
Ben Clayton d97132028a Implement textureNumLevels()
SPIR-V reader TODO

Bug: tint:140
Bug: tint:437
Change-Id: Icd41b2ef84e62b304e446589eb2e37c38279af35
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/37846
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-01-14 18:06:57 +00:00
Ben Clayton c21f1f92a2 Implement textureNumLayers()
SPIR-V reader TODO

Bug: tint:140
Bug: tint:437
Change-Id: Id397f5f07a2f18f365dc9c2d588e619cea8f89dc
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/37844
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-01-14 16:50:07 +00:00
dan sinclair d50a3041fa Remove access control from StorageTexture.
This CL removes the access control value from the storage textures and,
instead, wraps in an type::AccessControl. This matches the current spec
where the access is an annotation on the type as opposed to part of the
type.

Bug: tint:286
Change-Id: Ia944ed8557fbf490d78db2a1b49c31d0aba08728
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/37740
Auto-Submit: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
2021-01-13 18:48:11 +00:00
dan sinclair 1c200cffd0 Remove outerProduct.
The community decided to remove outerProduct from WGSL. This Cl removes
the pieces from Tint.

Change-Id: Ib1735867e4a7ca852a72549fc8c9bd86e8de22b0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/37600
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>
2021-01-12 22:00:58 +00:00
dan sinclair 987376cd21 Revert the namer changes.
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>
2021-01-12 04:34:53 +00:00
Ben Clayton f6866a2ffc Add std::hash<tint::Symbol> specialization
Allows symbols to be used as keys for std::unordered_map and std::unordered_set.
Replace all map / set use of uint32_t for Symbol, where applicable.

Change-Id: If142b4ad1f0ee65bc62209ae2f277e7746be19bb
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/37262
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
2021-01-11 22:02:42 +00:00
Ben Clayton 4527a512eb TypeDeterminer: Fix type map iterations
`DetermineStorageTextureSubtype()` may add types to the module while these types are being iterated over, leading to UB.

To work around, collect all the storage texture types into a vector first, and iterate over these.

Change-Id: Ib94b1df52d6ccbbf635a6d89eeeabef46ba03416
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/37261
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2021-01-11 21:14:22 +00:00
Ben Clayton 4a0b9f77ef Implement textureDimensions()
SPIR-V reader TODO.

Bug: tint:140
Bug: tint:437
Change-Id: Ia3a6cb0b36142142d3dc8662281e1860c609c82b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/36980
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2021-01-11 21:07:32 +00:00
dan sinclair f74b90b3dd Use a test namer in the MSL generator.
This CL updates the MSL generator to use a test namer, the various
places where the incorrect name was emitted have been fixed.

Change-Id: I20c990bdddc4f0580b09269920abe8376fa3ca07
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/36900
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-01-11 16:24:32 +00:00
dan sinclair e65e4bd2c5 Remove IdentifierExpression::name().
This CL removes the name method from IdentifierExpression. The usages
have been converted over to the symbol.

Change-Id: Id751c2fc4a43bd5414fbaf8a8a66ecffb3838e48
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/36801
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-01-11 16:24:32 +00:00
dan sinclair 4ac6568821 Remove Function::name().
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>
2021-01-11 16:24:32 +00:00
dan sinclair eb737c25db Remove StructMember::name().
This CL removes the name accessor from the struct member. Usages have
been replaced with symbol usages.

Change-Id: Idd9c5b34f0b5503ffee84e0c82d69aa65b1df7ea
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/36820
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2021-01-11 16:24:32 +00:00
dan sinclair 795b6b5a28 Convert ScopeStack over to symbols.
This CL converts the ScopeStack to use a Symbol instead of a string as
the accessor.

Change-Id: I2893003bc119c86c4822732ef36c7393e4be1e79
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/36580
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Auto-Submit: dan sinclair <dsinclair@chromium.org>
2021-01-11 15:10:19 +00:00
dan sinclair a41132fcd8 Add a symbol to the Function AST node.
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>
2020-12-11 18:24:53 +00:00
Ben Clayton 591268db48 Implement textureWrite()
Bug: tint:368
Bug: tint:140
Bug: tint:143
Bug: tint:144
Bug: tint:145
Bug: tint:146
Bug: tint:147
Change-Id: I1b6943d8663fbac8fbaa77a4804afb5a20fdb5e6
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/35320
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-12-10 18:39:41 +00:00
Ben Clayton 7f04e5c1e2 Implement textureLoad()
Bug: tint:140
Bug: tint:143
Bug: tint:144
Bug: tint:145
Bug: tint:146
Bug: tint:147
Change-Id: I8f41abac2e355c121e8868aa708ae51d0db87665
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/34960
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-12-09 15:57:00 +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
dan sinclair 685cb02ea8 Remove internal usage of Context.
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>
2020-12-02 21:17:58 +00:00
Ben Clayton 1b6a8ce165 Post migration to castable cleanup
Change-Id: I5c47b1736bd850548cb1c9c7a6f69242d8626173
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/34460
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-12-01 21:07:27 +00:00
Ben Clayton f1b0e1ee57 ast/type: Remove Type suffix from all types
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>
2020-11-30 23:30:58 +00:00
Ben Clayton 19fe07236e Replace ConstructorExpression::(Is|As)* with Castable
Change-Id: I18e9768fef36b79cb0e65c6eb79fd147013c54f0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/34317
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-11-30 23:30:58 +00:00
Ben Clayton d6ae990811 Replace Expression::(Is|As)* with Castable
Change-Id: I6ab98ed8b198f1b3b42ce1f09a6c4f992d65fe95
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/34316
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-11-30 23:30:58 +00:00
Ben Clayton 1d8098ae94 Replace Statement::(Is|As)* with Castable
Change-Id: I5520752a4b5844be0ecac7921616893d123b246a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/34315
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-11-30 23:30:58 +00:00
Ben Clayton b062bbdce8 Replace TextureType::(Is|As)Sampled with Castable
Change-Id: Id997f118a8ce9f4f7c42bed306368d3f204b6607
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/34279
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-11-30 23:30:58 +00:00
Ben Clayton 1a23756294 Replace TextureType::(Is|As)Storage with Castable
Change-Id: I627304c0b397605f565ae688f2a2b61132c26b9b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/34278
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-11-30 23:30:58 +00:00
Ben Clayton 0441bd1756 Replace TextureType::(Is|As)Multisampled with Castable
Change-Id: I9a0e2ba4c6b0950134cef4b291cd1ba5cae1198c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/34277
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-11-30 23:30:58 +00:00
Ben Clayton 09b8829d8e Replace TextureType::(Is|As)Depth with Castable
Change-Id: I2f1785cec1880f728fbbf0c75762bc957e34ca0a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/34276
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-11-30 23:30:58 +00:00
Ben Clayton 8a083ce9c8 Replace Type::(Is|As)Vector with Castable
Change-Id: Ic838aa783a279d0939a972773206fee2e33c4bff
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/34274
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-11-30 23:30:58 +00:00
Ben Clayton 38409c79dc Replace Type::(Is|As)Texture with Castable
Change-Id: I53bbccc3e1e7b88ad8c201997cf7e2e485ad9c81
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/34272
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-11-30 23:30:58 +00:00
Ben Clayton d734dd0c10 Replace Type::(Is|As)Struct with Castable
Change-Id: I0bc5645d65d7b53058bda7b343a991a9614741be
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/34271
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-11-30 23:30:58 +00:00
Ben Clayton c52f4214ad Replace Type::(Is|As)Pointer with Castable
Change-Id: Ic1b82f1ddc61355021a80d8e72f645f830363c62
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/34269
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-11-30 23:30:58 +00:00
Ben Clayton d8457c15f1 Replace Type::(Is|As)Matrix with Castable
Change-Id: I861aed231604a8bfba1f4cf3659b4863556fc3c4
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/34268
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-11-30 23:30:58 +00:00
Ben Clayton af37c4ae83 Replace Type::(Is|As)Array with Castable
Change-Id: I8d9b916f5977121380325d373c4e2f805b691fae
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/34264
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-11-30 23:30:58 +00:00
Corentin Wallez bed7a32b3b type_determiner: use f32 as the subtype for u/norm storage texture.
Fixes: tint:367
Change-Id: I311f5b9524d6251c88ae774dc8dc80f6d52e457d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/33922
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
2020-11-25 13:58:47 +00:00
Ben Clayton 7e4ffa0064 Add create<T>() method to Module for types
Migrate all uses to use this and the new `unique_type<T>()` and `types()` methods.

Remove the `type_mgr()` accessor. `TypeManager` is now an implementation detail of the module, allowing us to unify the allocation of types and nodes (if we so wish).

Fixes: tint:337
Bug: tint:307
Change-Id: I233fa9dc73d60515dd721f02ea7ba089ef7d374f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/33667
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
2020-11-23 19:58:55 +00:00
Ben Clayton 0fb5168fc7 Move TypeManager from tint::Context to ast::Module
Bug: tint:307
Bug: tint:337
Change-Id: I726cdf89182813ba6f468f8ac35e5d44b22e1e1f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/33666
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
2020-11-23 19:50:55 +00:00
Ben Clayton 3ea3c997b5 Implement textureSample builtins
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>
2020-11-18 21:19:22 +00:00
Ben Clayton b053acf796 Replace use of std::unique_ptr<T> with T* for AST nodes
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>
2020-11-16 16:31:07 +00:00
Sarah Mashayekhi 112314b73d [validation] add error number to invalid member accessor error: v-0007
Bug: tint:6
Change-Id: Ia92ed8a328ff3c7986d8e5298b13f5d1db33935b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/32384
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-11-16 14:35:17 +00:00
dan sinclair d5fd7e02ba Fixup lint errors.
This CL fixes up the various lint errors.

Change-Id: If4d3077b55aadec33980452c43917194d803fac6
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/31680
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
2020-11-03 16:26:09 +00:00
Ben Clayton 5bee67fced Add File & Range information to tint::Source
This is the first step in improving the error messages produced while parsing.

The `line` and `column` information of `Source` has been moved to `Source::Location`.

`Source::Range` has been added that contains a `Location` interval - allowing error messages to highlight the full region of the error.

The `File` information provides an optional file path, and pre-splits the content into lines. These lines can be used to print the full line containing an error.

This CL contains a few temporary changes that help split up this work, and to ease integration with Tint.

Bug: tint:282
Change-Id: I7aa501b0a9631f286e8e93fd7396bdbe38175727
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/31420
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: David Neto <dneto@google.com>
2020-10-30 20:44:53 +00:00
dan sinclair 512ecc2762 Rename unwrap helpers.
With the addition of the AccessControlType we want to look through the
access control as well as the aliases as we work through the type tree.
This CL renames UnwrapAliasesIfNeeded to be UnwrapIfNeeded and
UnwrapAliasPtrAlias to UnwrapAll.

Change-Id: I5b027919c3143a89be24c4d87b8106f70358c03b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/31104
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
Reviewed-by: David Neto <dneto@google.com>
2020-10-28 20:32:22 +00:00
dan sinclair ff267ca60e [type-determiner] Fixup handling of unknown identifiers.
This Cl updates the identifier type determination check to fail if the
identifier is not found and is not an intrinsic method.

Bug: tint:139
Change-Id: I332dd7fb42dae62bdee459c4a8819bdb5685c903
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/30081
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
2020-10-14 18:26:31 +00:00
dan sinclair 4311dd05c8 [spirv-writer] Fix accessing array of non-scalars.
Currently, if we access an array of non-scalar items we'll incorrectly
emit an OpVectorExtractDynamic which will fail as the result is not
scalar.

This CL updates the array accessor code such that if the base array is
an array of non-scalars we'll do load of the array and then access chain
into the loaded variable.

Bug: tint:267
Change-Id: Ia4d7052b57d8b31b835714b7b922c7859e3dce1f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/29844
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: David Neto <dneto@google.com>
2020-10-08 21:34:25 +00:00
dan sinclair 007dc42cbb [type-determiner][spirv-writer] Add arrayLength support
This CL adds support for retrieving the array length of a Runtime Array
in the SPIR-V backend.

Bug: tint:252
Change-Id: Ic13c4a99da5760738d57702c45f52c6a194a172d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/29220
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: David Neto <dneto@google.com>
2020-10-08 17:01:55 +00:00