Commit Graph

4 Commits

Author SHA1 Message Date
James Price 851b18b2f2 writer/msl: Emit field designators for structures
This fixes constructors for structures that contain padding members
due to explicit layout attributes.

Also fix one test that was wrongly using an identity type constructor
for a structure.

Fixed: tint:853
Change-Id: I0a3e84fcd7c6a7f2ad92a4970ed11378e6ce2465
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53240
Auto-Submit: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-06-03 18:12:15 +00:00
James Price 42220ba1b2 writer/msl: Hoist array and struct initializers
Pull the HLSL transformation out to a standalone transform that can be
used by both HLSL and MSL.

The new E2E tests do not yet pass for MSL because they produce array
assignments, which will be addressed in the next patch.

Fixed: tint:826
Change-Id: Idc27c81ad45e3d4ab96d82663927d2fc1384618e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/52842
Auto-Submit: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-06-01 12:08:20 +00:00
James Price 6c582778cf writer/msl: Simplify type constructor generation
The special-case for zero-valued constructors is unnecessary, as an
empty initializer list already correctly zero-initializes for all
types. This was causing an additional {} to be emitted for empty
structures, which the MSL compiler rejects.

Fixed: tint:821
Change-Id: Ib48c73eadef15b517e14b248229ecfbbfeb13f81
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/51822
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>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-05-20 16:45:47 +00:00
Ben Clayton d1232670ae test: Generate expected output for all tests
The expected output is far from perfect, and the generated HLSL and MSL
isn't even validated yet, so may be incorrect.

However, by committing the generated output, we get clear examples of
the currently generated output of each backend. As we land fixes and
improvements to each backend, the presubmits will require us to update
the expected test output, and so code reviews will include diffs of
each backend's generated output.

Change-Id: I5c2a9e5b796d0ab75b3ec4c7f8ad00a0a2ab166f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/51224
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
2021-05-18 09:24:18 +00:00