Commit Graph

1363 Commits

Author SHA1 Message Date
dan sinclair ea9c3a604b [wgsl-writer] Emit access control type.
This CL updates the WGSL-Writer to emit the access control type.

Bug: tint:287
Change-Id: Ifb42a5ab199f18014c33be62960d078e57df8dba
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/33360
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Auto-Submit: dan sinclair <dsinclair@chromium.org>
2020-11-19 19:40:41 +00:00
dan sinclair 7214f407dc [wgsl-reader] Add support for read only storage buffers.
This Cl adds the necessary infrastructure to parse the access decoration
for storage buffers.

This CL incorporates changes from bclayton@ from
https://dawn-review.googlesource.com/c/tint/+/33202 and
https://dawn-review.googlesource.com/c/tint/+/33201

Bug: tint:287
Change-Id: I7479f2cf7ab794b24c682b9927c4c68f6d325839
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/33161
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Auto-Submit: dan sinclair <dsinclair@chromium.org>
2020-11-19 18:55:01 +00:00
dan sinclair d2f73226bc [hlsl-writer] Use `mul` method where required.
This CL updates the binary operator emission to use the `mul()` method
in the following cases:
 - vector * matrix
 - matrix * vector
 - matrix * matrix

This is because the `*` operator works per-component in HLSL which does
not do the expected multiply.

Bug: tint:301
Change-Id: I0810522ac26fbbea323cf8a05a3ff6f2fb62117e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/33362
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Auto-Submit: dan sinclair <dsinclair@chromium.org>
2020-11-19 18:38:11 +00:00
Ben Clayton 31df1137d4 writer/hlsl: Clean up vector type emission
For HLSL emission instead of:
  `vector<float, N>` emit `floatN`
  `vector<int, N>` emit `intN`
  `vector<uint, N>` emit `uintN`

These are significantly shorter, more idiomatic, and is far easier to read.

Change-Id: Idef8cc550e0b49cc919087e281b72a7a0a0f11bc
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/33424
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2020-11-19 16:49:12 +00:00
David Neto 36d9a061c8 spirv-reader: Rename a test class
Bug: tint:109
Change-Id: I31ce88cc28e38a22cc7f83ad5653109b133d401a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/33440
Auto-Submit: David Neto <dneto@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
2020-11-19 15:36:11 +00:00
David Neto 3bc06e3099 spirv-reader: Convert handle types
Synthesize Tint types for handle variables and function parameters.

Bug: tint:109
Change-Id: I3c155e03b154c5ebf46e79c96a6e2b054dbca9b4
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/33341
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: David Neto <dneto@google.com>
Auto-Submit: David Neto <dneto@google.com>
2020-11-19 15:06:31 +00:00
Ben Clayton aa5f23e1ca reader/wgsl: Improve errors for statements outside functions
Fixes: tint:328
Change-Id: I29c35605c2cf546080e28eaa9d983595b4a8d977
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/33401
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-11-19 14:19:31 +00:00
Ben Clayton f2bfeda1c4 writer/spriv: Move IntrinsicTextureTest to its own file
It's mahoosive, and will only get bigger.

Change-Id: I4593bd5ded9d67a8457676245189638874a8d5b3
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/33420
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-11-19 14:08:51 +00:00
Sarah Mashayekhi 8bea9671d5 [validation] v-0015: runtime arrays cannot be declared in a function body.
Bug: tint:345
Change-Id: I547e8981c2b541979add0a40d7f685b7c7f948aa
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/33320
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
2020-11-19 14:05:01 +00:00
Sarah Mashayekhi d8ea65bb2c [validation] impl v-0015: runtime array may only appear last
This CL adds checks to verify that runtime arrays only appear as the last element of a struct

Bug: tint:345
Change-Id: Ic2930aaf1e24e5c1d116add3a4a6dbdb9eaa02a7
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/33261
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Sarah Mashayekhi <sarahmashay@google.com>
2020-11-18 22:34:30 +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 2f4096b0d7 Move the ast node ownership from Context to Module
Fixes: tint:335
Change-Id: I128e229daa56d43e7227ecab72269be33b3ee012
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/33240
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-11-18 20:58:20 +00:00
Ben Clayton 627732c408 src/reader tests: Have parse() return a unique_ptr
The reason being that some tests called parse() twice, which will silently destruct the first parser.
Once the `Module` owns the AST nodes, the second call will end up deleting all the AST nodes. Tests would then perform use-after-free for the AST nodes belonging to the first parser / module.
There's no reason why the unique_ptr can't be returned, which is cleaner overall.

Bug: tint:335
Change-Id: I7ff2e9777a7ebeb76702f806294fe4c2c49bd7c9
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/33241
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
2020-11-18 19:40:00 +00:00
Ryan Harrison 40e3ccda33 [transformer] Remove deprecated Manager constructor
Also moves the type determiner call out of the transformers into the
manager.
Cleans up the code to not have anything directly calling
Run() on the transformers other then the manager.

Bug: tint:308
Change-Id: I3343f2ba16dae6fb33f35e390ae4c797f2a05522
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/33262
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-11-18 19:40:00 +00:00
dan sinclair c7f51b7d3c ast: Support decoration kind hierarchies
Instead of just having a single `DecorationKind` for the first
derivation from `Decoration`, have a `DecorationKind` for every
decoration type.

Add `Decoration::IsKind()` to test whether the decoration is of, or
derives from the given kind.

Note, this change is originally by bclayton@ from
https://dawn-review.googlesource.com/c/tint/+/33201

R=bclayton@google.com

Bug: tint:287
Change-Id: I69b51dfaa3f82ef4d61cda383b2f98f401013429
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/33280
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>
2020-11-18 19:33:30 +00:00
Sarah Mashayekhi 038f6d2f37 [validation] unittest v-0015: runtime array may only appear last in a structs
this CL adds disabled tests to validate v-0015.

Bug: tint:345
Change-Id: I39ec9bc3b44f8f9c9fe241d3492de66509722e4c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/33260
Commit-Queue: Sarah Mashayekhi <sarahmashay@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-11-18 18:40:10 +00:00
dan sinclair a7c9391dc6 [spirv-writer] Support optional trailing return.
This CL updates the SPIRV-Writer to inject an OpReturn as the trailing
statement in a function if the function does not end with a `discard` or
a `return` statement.

R=bclayton@google.com, dneto@google.com

Fixes: tint:302
Change-Id: I2e7c7beff15ad30c779c591bb75cf97fc0960bf7
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/33160
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Auto-Submit: dan sinclair <dsinclair@chromium.org>
2020-11-18 18:25:30 +00:00
Ben Clayton 46d9c7745e Fix linter warnings, stdout test spew
Change-Id: I2fed4cf2a052686e2121066588686f05907a169f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/33200
Commit-Queue: Ben Clayton <bclayton@google.com>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-11-18 14:31:00 +00:00
David Neto 5eae9bfaf5 Fix doxygen comment
Change-Id: Ic7778f390324431cc8e517d514e03c74de02ec46
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/33142
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
2020-11-18 03:17:39 +00:00
David Neto 064882de2c spirv-reader: Register usage for handle vars and func parameters
Bug: tint:109
Change-Id: I03b684dc75bf20b95e0bd38a9c5e7b78836ec7db
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/33141
Commit-Queue: David Neto <dneto@google.com>
Auto-Submit: David Neto <dneto@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-11-18 02:57:49 +00:00
David Neto 62c8f07015 spirv-reader: GetMemoryObjectDeclarationForHandl can return null
It's valid to look for but not find an underlying memory object
declaration.

Bug: tint:109
Change-Id: I7296d79550a50050d2438996dc3e0c8d09a6babd
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/33140
Auto-Submit: David Neto <dneto@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
2020-11-18 02:14:09 +00:00
Ryan Harrison 88091d3d17 [transform] Add calling type determiner in manager
This is the first step into migrating away from callers of transforms
knowing that they have to re-run the type determiner.
This CL adds a new constructor that allows the caller to pass in the
context and module and conditionally calling the determiner.
Once downstream users have converted, the old constructor can be
removed, along with hacks to call the determiner in transforms.

Bug: tint:330
Change-Id: Iec49e6d27f92a651cb1e46681a3b3f8fae105164
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/33124
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>
2020-11-17 21:40:59 +00:00
David Neto bd7ab2cd5f spirv-reader: Add (handle) Usage abstraction
Bug: tint:109
Change-Id: I5cb8f35636c61cf2f837271a51c4753117b288be
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/32387
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Auto-Submit: David Neto <dneto@google.com>
2020-11-17 18:32:18 +00:00
David Neto cebde298f9 spirv-reader: add GetMemoryObjectDeclarationForHandle
Bug: tint:109
Change-Id: Ifb437ce9a39db7f92ca081e7ea551a576b0ecb2b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/32740
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: David Neto <dneto@google.com>
Auto-Submit: David Neto <dneto@google.com>
2020-11-17 17:59:38 +00:00
Ben Clayton 0ae939bc0c writer/spirv: Refactor builder constructor tests
... using the new ast::Builder.

Also rename the test fixture name to include the common part of the test
names, and prefix with Spv. This makes it possible to run just these
tests with `--gtest_filter=SpvBuilderConstructorTest*`

Change-Id: I82067a551f4bc86847e61cb284a21b0d14536e87
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/32984
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
2020-11-17 17:53:38 +00:00
dan sinclair 8f26453c7d Fixup SPIR-V include of builder
R=kainino@chromium.org, rharrison@chromium.org

Change-Id: I8ff30362a8a26705280510ff5d2867d634b4f483
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/33122
Auto-Submit: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
2020-11-17 17:49:09 +00:00
dan sinclair c2af0a3fba Add missing override
R=bclayton@google.com, rharrison@chromium.org

Change-Id: I3daffbb7bf9b9e74e4bbadca7a62af5ceb6f2475
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/33121
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>
2020-11-17 16:50:59 +00:00
Ben Clayton 655638c4a8 writer/spirv: Inherit TestHelperBase from ast::Builder
Exposes all the AST builder helpers to the spirv writer tests

Change-Id: Ie6709cc9f941a52899285ad476e8b4fc7ee9e4d6
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/32983
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-11-17 16:12:08 +00:00
Ben Clayton 2d86bf4c32 ast::Builder: Add more builder methods
Add matrix types and missing expression overloads.
Tweak the signatures of the vec constructors so they can take mixed parameter types.

Change-Id: I303401e7ba80cbfddd14d9415e586e23eefcdd90
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/32982
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-11-17 15:28:48 +00:00
Ben Clayton 165ff1c978 ast::Builder: Make the interface more fluent
Add C++ aliases for the wgsl types `i32`, `u32` and `f32`.

Separate types out from the builder and into a `Builder::Types` class. An instance of this is now held by the `Builder::ty` field. Makes it clear when you are referencing a `ast::type` instead of a constructor method.

Rework a number of builder methods so they take the type as a template argument instead of a parameter. This more closely resembles wgsl (example: `vec2<i32>(1,2)`)

Use PascalCase for the constructor methods, but keep the wgsl-like constructors lowercase to imitate the language style.

Add `BuilderWithContext` so that `Builder` can be truely immutable, and so we can remove `set_context()`.

Change-Id: Idf2d7d5abe7d11e27671b8e80d3d56d6bc4b3ca2
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/32980
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2020-11-17 15:23:48 +00:00
David Neto 90f3253645 spirv-reader: pretend handles are void
We convert types of samplers, images, and sampled images entirely
differently, but still find it useful to generalize ParserImpl::ConvertType
to cover them.

Fake it: Make ConvertType return void for them.

Bug: tint:109
Change-Id: I0982eb987d0914db8227bc0fce552989831129b9
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/33020
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>
2020-11-16 23:55:19 +00:00
Ryan Harrison 2733c2693b Stop setting mac_xcode_version in DEPS
mac_xcode_version no longer has an effect and we have been
requested to remove it.

Also add updating the mac toolchain.

Bug: chromium:1147839,tint:197
Change-Id: I120c1b4494154c701efcbe70063f35e4f1d373b2
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/33000
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
2020-11-16 21:11:19 +00:00
dan sinclair 33956dc4c4 Fixup include
This Cl fixes the msl/test_helper include to reference the MSL generator
impl.

Change-Id: Ic9858b47db460ccfadad3961ecc518ad3a040972
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/32960
Auto-Submit: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2020-11-16 20:13:27 +00:00
David Neto a0b6796687 spirv-reader: better message for unknown SPIR-V type
Change-Id: I56a314d0c4eb1f1dfdb8804024a5824e5456356c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/32940
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>
2020-11-16 17:35:57 +00:00
David Neto df2d92d5bb spirv-reader: add conversions for image Dim and Format
Change-Id: I9ad499aaa4683ce9a3ed702f21babaf24a15a8e8
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/32741
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Auto-Submit: David Neto <dneto@google.com>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
2020-11-16 16:44:17 +00:00
Ben Clayton 4bfe461646 Big cleanup now that AST nodes are raw pointers
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>
2020-11-16 16:41:47 +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
Ben Clayton 0613890eed Replace remaining std::make_unique<T> -> create<T> for ast::Nodes
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: I9d85e925538789d9b58f32c2bba32a05e22aea1c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/32863
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-11-16 16:24:37 +00:00
Ben Clayton 0575449b82 src/transform: Replace std::make_unique<T> -> create<T>
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: I4d0c3a6b471c559617538bda90a5a991c71045a9
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/32862
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-11-16 16:13:49 +00:00
Ben Clayton f65799e7da reader/wgsl: Replace std::make_unique<T> -> create<T>
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: I281fe91864a98365db5ccd40e264d042e6476172
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/32861
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2020-11-16 16:11:19 +00:00
dan sinclair 75b740c4ae [spirv-writer] Fixup generation of temporary variable.
When extracting values out of constant arrays we sometimes generate a
temporary variable. That generation was over eager in the creation of
the variable and was also creating it for constant vector extractions
where it was providing the wrong souce type.

Bug: tint:318
Change-Id: I8d16182fd1fcf7d7aba0b0e1b7d947137efc136b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/32801
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Auto-Submit: dan sinclair <dsinclair@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
2020-11-16 15:34:07 +00:00
Ben Clayton 307919dba9 reader/spirv: Replace std::make_unique<T> -> create<T>
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: I72558482c4b6aff7a655087ee010b3e16b006192
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/32860
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-11-16 15:21:07 +00:00
Ben Clayton eeac0c5f63 ast: Remove no-arg constructor for ast::IfStatement
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: I36a1cf55c31a1dabccde272b2be415f98c16b18f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/32677
Commit-Queue: Ben Clayton <bclayton@google.com>
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-11-16 15:15:37 +00:00
dan sinclair aa57015db4 [spirv-writer] Generate loads for const constructors.
When building a const variable from a pointer we need to make sure to
load the value and use the loaded ID as the constant Id.

Bug: tint:310
Change-Id: Ia544fd69f3d2ae13e9ff9a983935ddc332d8d6ff
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/32800
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: David Neto <dneto@google.com>
Auto-Submit: dan sinclair <dsinclair@chromium.org>
2020-11-16 15:06:37 +00:00
dan sinclair d9496f35d0 Add language check
This Cl adds a PRESUBMIT check for non-inclusive language.

Change-Id: I052f1813700e5af29d2204ec59d82b2bcdc44578
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/32840
Auto-Submit: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2020-11-16 15:01:27 +00:00
dan sinclair 80598edf78 [ast] Add the result_type into the AST dump
This CL adds the result_type type_name into the AST dump if available.

Bug: tint:310, tint:308
Change-Id: Iea678fd4f7a2dadbfca86f29043c75459c421cb3
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/32780
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
2020-11-16 14:46:27 +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
Ben Clayton 4ad0019df0 ast: Remove no-arg constructor for ast::CastStatement
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: I2a571d0a4727d6dc3d6c38e8b6602e131292f49c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/32676
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
2020-11-16 14:25:27 +00:00
Ben Clayton e5e9617220 ast: Remove no-arg constructor for ast::ElseStatement
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: I6173a63a243fdcbdd8a53c91010e2f628248298f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/32678
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-11-14 09:53:12 +00:00
Ben Clayton 6a788df30e ast: Remove no-arg constructor for ast::LoopStatement
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: I3db9b3c037896f07b84b14b7b8d4da0f066b69b0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/32679
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-11-14 09:52:25 +00:00