Commit Graph

5 Commits

Author SHA1 Message Date
Ben Clayton 4135ea55eb writer/hlsl: Don't wrap arrays in structures
FXC has trouble dealing with these.
This was originally added to handle returning arrays as structures.
HLSL supports typedefs, which is a much simpiler solution, and doesn't upset FXC.

Bug: tint:848
Bug: tint:904
Change-Id: Ie841c9c454461a885a35c41476fd4d05d3f34cbf
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/56774
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-07-05 15:20:57 +00:00
Ben Clayton 2bb45389b7 writer/hlsl: Zero initialize with (T) 0
For structures and arrays.
This behaves identically to the per-element zero-initialization, but can be significantly less verbose.

Change-Id: I380ef86f16c2b3f37a9de2820e707f368955b761
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/56764
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-07-02 19:27:42 +00:00
Ben Clayton 9ef52ffd8c writer/hlsl: Use the WrapArraysInStructs transform
Fixes issues with using arrays as function return types.

Fixed: tint:848
Change-Id: Iee8af0f2cea9d19e448176446c6599be2bd32316
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/54321
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
2021-06-16 09:19:36 +00:00
Ben Clayton 5d2f34ecf2 writer/hlsl: Simplify emission logic, clean up output
And fix issues where global variables would not be emitted unless they were transitively referenced by an entry point.

This change requires crbug.com/tint/697 to be fixed before landing.

Change-Id: I712bd9d369e08c9a3cdfb0f114c3609584f91f28
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/54241
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
2021-06-16 09:19:36 +00:00
Antonio Maiorano 9834fefa7f Implement type inference
Bug: tint:672
Change-Id: I3f586ee867f75427c4e8c309f72fb468643c23c0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53182
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2021-06-04 15:28:47 +00:00