This CL updates the WGSL parser to handle a void function call.
Fixes: tint:45
Change-Id: If5b2a4b9e62f0b10e0f2e2e10c0ca2586c5268e8
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/25322
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
This CL adds identifier emission and an HLSL namer to guard against
names using reserved words.
Bug: tint:7
Change-Id: Id3d73ff683048c26ac99451d21c3dd7ef3c620a3
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/25001
Reviewed-by: David Neto <dneto@google.com>
This CL adds emission of CallStatement to the various backends.
Bug: tint:45
Change-Id: Ia2bdf0433f136c516ecccdcbc64a5365094220af
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/25281
Reviewed-by: David Neto <dneto@google.com>
This CL adds type determination for the call statement.
Bug: tint:45
Change-Id: I2460fe6c6103bdf7e5d0367cded1d78ca5d671d6
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/25321
Reviewed-by: David Neto <dneto@google.com>
This CL adds CallStatement to the AST to allow wrapping a CallExpression
into a statement.
Bug: tint:45
Change-Id: I5a9525514344fcc2cf9900eb2cd78c1fb94ca2ef
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/25320
Reviewed-by: David Neto <dneto@google.com>
Still TODO: OpSelect over arrays and structures, as permitted in SPIR-V 1.4
Bug: tint:3, tint:99
Change-Id: I70f6c8a43ea3339cd715813c6eb0128d66ff0df8
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/25301
Reviewed-by: dan sinclair <dsinclair@chromium.org>
This CL adds the scaffolding for the HLSL backend.
Bug: tint:7
Change-Id: Iaf9f5159bc409f3ac71fcec281229258bdfa021b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/25000
Reviewed-by: David Neto <dneto@google.com>
This Cl adds the emission of storage buffers to the MSL backend.
Bug: tint:8
Change-Id: I6923926b36e73f2e351443cf1d2bf6d70873bc9a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/25264
Reviewed-by: David Neto <dneto@google.com>
This CL adds emission of import function calls to the MSL backend.
Bug: tint:8
Change-Id: Ib8b8638b11caee2ff3557d551447b215ef2a4c69
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/25262
Reviewed-by: David Neto <dneto@google.com>
Couple of little style issues, and a path to a file that was incorrect.
Change-Id: I21d1a4ca41bc36163602378086989ac712f54469
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/25265
Reviewed-by: dan sinclair <dsinclair@chromium.org>
This CL cleans up some interfaces and methods in the MSL generator and
generator impl classes.
Bug: tint:8
Change-Id: I9aabeb1ecb69baeaa9cb6bbc15e313806923dddc
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/25163
Reviewed-by: David Neto <dneto@google.com>
This CL adds support for handling uniform data. Currently the uniform is
added to a buffer where the number is the binding value. This will need
to be updated to accept the correct mapping from the embedder.
Bug: tint:8
Change-Id: Icccccbe599a9555defa6136e384745f4093df020
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/25104
Reviewed-by: David Neto <dneto@google.com>
Old way:
- struct decorated with BufferBlock
- Uniform storage class
New way
- struct decorated with Block
- StorageBuffer storage class
Also fixes the result type for an access chain.
Bug: tint:99
Change-Id: I2324ba94bb19b369d206313de798bdfec6099fe0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/24605
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Emits it as a module-level variable. Deconstruct and throw away
the gl_PerVertex struct.
Not handled: unusual patterns that are technically valid but
which don't occur in practice:
- loading, storing, or producing intermediate values of the whole structure.
- multiple definitions of the per-vertex structure (e.g. if someone had
put both a vertex shader and a tessellation shader in the same
module.)
Bug: tint:3, tint:99
Change-Id: I3ad9ff6ab780a002367f01f385bfa7d6ddba6db9
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/24880
Reviewed-by: dan sinclair <dsinclair@chromium.org>
This CL adds code to emit program constants in the MSL backend.
Bug: tint:8
Change-Id: I63e40983253349d2e293904fbe9b6f543b885b34
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/24940
Reviewed-by: David Neto <dneto@google.com>
This CL fixes up the array constructors to emit `{}` instead of
`<type>[<size>]()`. The matrix example is also updated to have the
correct data format for WGSL matrices which fixes the MSL output.
Bug: tint:8
Change-Id: I3a08a8814d4b8b38a57b6324e2182a271c958ef3
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/25060
Reviewed-by: David Neto <dneto@google.com>
This CL adds a `_stride_` into the array type name to differentiate an
array of 8 elements and a runtime array of stride 8.
Bug: tint:102
Change-Id: Iaf10fe5957acde16a9ccdf2a0fd8a83e47bb57bc
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/24962
Reviewed-by: David Neto <dneto@google.com>
This CL adds support for injecting padding into structs in the MSL
backend.
Bug: tint:8
Change-Id: I83631a71ce4a2f00b61974ee2c0c7ca1b97f3028
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/24601
Reviewed-by: David Neto <dneto@google.com>
This CL extends module scoped variables to include support for builtins.
Bug: tint:8
Change-Id: I9e4363be32401bfdd45ad5d1727d9432aca206fe
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/24786
Reviewed-by: David Neto <dneto@google.com>
This CL adds a helper to get referenced builtins and referenced
locations from the ast::Function.
Change-Id: I95cf7efd6b0fe9569c5e514d3245112e78147ffe
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/24783
Reviewed-by: David Neto <dneto@google.com>
This CL cleans up some of the entry point variable code.
Bug: tint:8
Change-Id: Ic89ff3608d34af26eeb9fe9408cdbd5c7de22dda
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/24782
Reviewed-by: David Neto <dneto@google.com>
This CL generates entry point functions and duplicate functions as
needed to call from the entry points.
Bug: tint:8
Change-Id: I8092ce463248e7a887c26ae05b0774e8fa21ab94
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/24764
Reviewed-by: David Neto <dneto@google.com>
This CL adds support for calling user defined functions from the MSL
backend. Intrinsics and imports are not handled yet.
Bug: tint:8
Change-Id: I45c3078d014ab89cc0eec76dd626759077e1a890
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/24763
Reviewed-by: David Neto <dneto@google.com>
A given caller should inherit the globals referenced from a callee. This
way, a given entry point will have a list of all the variables used up
the stack which it needs to reference.
Change-Id: Ib6efcdd5c3347749ad2d54aecfa425bd966a62fd
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/24762
Reviewed-by: David Neto <dneto@google.com>
This CL adds generation of the input/output structures for entry points.
Bug: tint:8
Change-Id: I93942496bcea0a2eea944e5e1cd0baf383530f5e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/24721
Reviewed-by: David Neto <dneto@google.com>
This Cl updates the type determiner to annotate each function with the
name of any entry points which call into the given function. This will
allow determining in the backends if we need to duplicate the function
due to differing entry point parameter requirements.
Bug: tint:8
Change-Id: Icd7c4ccab72dd6eabcf0abaf1159319949c4ecf5
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/24760
Reviewed-by: David Neto <dneto@google.com>
Take the type of a const-definition (or a write to a hoisted variable)
from the generated expression rather than the directly-converted type
from the SPIR-V ID.
This prepares the way for remapping storage buffers from
Uniform/BufferBlock to StorageBuffer/Block representation.
Bug: tint:99
Change-Id: I6104d8ad96312053562468a3cdb247932c1cb6cb
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/24604
Reviewed-by: dan sinclair <dsinclair@chromium.org>
This CL fixes the output of multi-dimentional arrays in the MSL backend.
Bug: tint:7, tint:100
Change-Id: I8fe925145973555f77673e9db97f150077e2471f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/24560
Reviewed-by: David Neto <dneto@google.com>
This CL adds variable declarations to the MSL backend.
Bug: tint:7
Change-Id: Icf63ad44a217213e5036eb76429e25a3031822eb
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/24540
Reviewed-by: David Neto <dneto@google.com>
If the statement or expression being emitted is not implemented this
will now output the failed statement.
Bug: tint:7
Change-Id: I8a359abd369067540d503a1facbee018e91e8666
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/24523
Reviewed-by: David Neto <dneto@google.com>
Need the algorithm include to build on Windows.
Bug: tint:7
Change-Id: I5691c9e30c762271c767934921fe925120a67e01
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/24522
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
If the remapper give an ident a new name which collides with a future
ident name we need to rename the future name to not collide.
Bug: tint:7
Change-Id: I162a3071f75ed714cee730b78aebefa8c75c77de
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/24521
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Use the fact that in WGSL the scope corresponding to the loop construct
encloses the scope for its associated continue construct.
In our construct data structure, the two are adjacent but not
overlapping.
This improvement means that when a definition is in a loop construct,
but used only in the loop or associated continue construct, then no
hoisting is required.
Bug: tint:3
Change-Id: I8d33b8f76303ab2868306847e846b4c26899e746
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/24420
Reviewed-by: dan sinclair <dsinclair@google.com>
When we hoist a variable out of a continue construct, put it
in associated loop construct, if it exists. This reduces its
lifetime in WGSL, and easier to understand as a code reader.
Change-Id: I8f0cc37640bfe67874cbc27b55029e79e9a8992c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/24321
Reviewed-by: dan sinclair <dsinclair@google.com>
The special case is not "single-block-loop" but rather the
case where a continue target is also its own loop header.
This can occur for single-block loops and multi-block loops.
Bug: tint:3
Change-Id: I4af1410793caf8b26a1f781e221fc0b395f07aa3
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/24320
Reviewed-by: dan sinclair <dsinclair@google.com>
For each OpPhi, make a variable to carry values from predecessor blocks
to the OpPhi. Declare the variable at the smallest scope enclosing all
the predecessor blocks (where we write to it), and the OpPhi (where we
read from it).
Bug: tint:3
Change-Id: I7898b4b903d9ee1a25a7466e3c5aaf6840550e2d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/24181
Reviewed-by: dan sinclair <dsinclair@google.com>
This CL adds the metal_stdlib include to the MSL generator.
Bug: tint:8
Change-Id: Ie80a7aa3921e2c4594cb7dc5a69d1b04a253c752
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/24185
Reviewed-by: David Neto <dneto@google.com>
This CL adds a namer class to prevent collisions with builtin names in
MSL. The MSL generator has been updated to use the namer anywhere that
names are emitted.
Bug: tint:8
Change-Id: I820f226a7286be1d5b0d613bd0fa41b68cb9f8ba
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/24184
Reviewed-by: David Neto <dneto@google.com>
This CL adds support for switch and case statements into the MSL writer.
Bug: tint:8
Change-Id: Ib51f943e8476c0ecfd45e9131404f96934c6e21f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/24180
Reviewed-by: David Neto <dneto@google.com>