This CL adds the assign statement emission to the HLSL backend.
Bug: tint:7
Change-Id: I3e46ac09170ea1af7444ae89267a82e1d1c42c52
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/25224
Reviewed-by: David Neto <dneto@google.com>
This CL adds emission of switch statements to the HLSL backend.
Bug: tint:7
Change-Id: Ie6f41031878a1f5a945f9310429d28fb0e4a98c8
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/25223
Reviewed-by: David Neto <dneto@google.com>
This CL adds emission of case statements to the HLSL backend.
Bug: tint:7
Change-Id: I5d0dd7ecfe4ef032a03777c29f3d0d00e584a93a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/25222
Reviewed-by: David Neto <dneto@google.com>
This CL emits unary operators from the HLSL backend.
Bug: tint:7
Change-Id: I997d89d62d279fc7440ba6045c56e290ec7601c1
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/25221
Reviewed-by: David Neto <dneto@google.com>
This CL updates the HLSL writer to emit break, return and continue
statements.
Bug: tint:7
Change-Id: I03eafc343e57e9e8d1efaf930023099d6f85fc57
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/25220
Reviewed-by: David Neto <dneto@google.com>
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 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>
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 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>
gn gen --check is failing in chromium due to how includes are propagated
out of deps. Re-organizing them to resolve this.
Change-Id: I3c21bbb0cb8b5bc5bdad4ab97d557d718a3cdc33
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/25120
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 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>
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 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>
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>
This CL adds the code to convert a loop/continuing statement into MSL.
Bug: tint:8
Change-Id: I9fa595908c6d834d9543b583c8baf8c19f8cae6c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/24122
Reviewed-by: David Neto <dneto@google.com>
This CL adds writting of break and continue statements to the MSL
backend.
Bug: tint:8
Change-Id: If2443c036fa82f54708d209d924192ee7a159e76
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/24121
Reviewed-by: David Neto <dneto@google.com>
This CL adds emission of member accessor expressions to the MSL writer.
Bug: tint:8
Change-Id: I21d8564880c44d719c89dca2a10cd97ccb1e2cd7
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/24120
Reviewed-by: David Neto <dneto@google.com>
This CL adds emission of alias types to the MSL writer. They are output
as `typedef`s.
Bug: tint:8
Change-Id: I18b839ed0238c4636e3975f35f5d88badd412fe4
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/24001
Reviewed-by: David Neto <dneto@google.com>
This CL adds the code to emit array accessors from the MSL backend..
Bug: tint:8
Change-Id: Ia6b49c11602d39aa559feac31fcfd592ab54928c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/24000
Reviewed-by: David Neto <dneto@google.com>
This CL adds emission of the unary `-` and `!` operators.
Bug: tint:8
Change-Id: I9dda066111cc8f115b593127cf070c6ca37bdc66
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/23842
Reviewed-by: David Neto <dneto@google.com>
This Cl adds emission of the Kill statement as `discard_fragment`. This
may need to be revised when the semantics of Kill are agreed upon.
Bug: tint:8
Change-Id: I2d09f09143b2acd0139d876e873e3c70abbc84a3
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/23841
Reviewed-by: David Neto <dneto@google.com>
This Cl adds emission of `if`, `else if` and `else` statements to the
MSL backend.
Bug: tint:8
Change-Id: I8c22d70f2afa0a1d86cf475f5c98127504a6dc0e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/23840
Reviewed-by: David Neto <dneto@google.com>
This CL adds conversion of casts to MSL.
Bug: tint:8
Change-Id: Iecfb9a5b413b1d10372b4d2fec31c0956b1475a0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/23822
Reviewed-by: David Neto <dneto@google.com>
This CL adds the MSL conversion of as casts to `as_cast`.
Bug: tint:8
Change-Id: Iaa8ee1fa3077e4471bbead9d24fcf1e2d68998b0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/23821
Reviewed-by: David Neto <dneto@google.com>
This Cl adds the code to emit scalar and type constructors from the
Metal backend.
Bug: tint:8
Change-Id: I95c713568ae3a73b82f8c9e10119e29e3469893e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/23707
Reviewed-by: David Neto <dneto@google.com>
This CL adds emission of binary operations to the Metal backend.
Bug: tint:8
Change-Id: I797daadd238b718b081842b63ccefab3294bc20c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/23706
Reviewed-by: David Neto <dneto@google.com>
This CL adds assignment statements to the Metal backend.
Bug: tint:8
Change-Id: Iaf4faa62124948fd0e785d5bebd20aae778ba050
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/23705
Reviewed-by: David Neto <dneto@google.com>
This Cl adds the code to emit functions from the metal writer. Note,
this does not handle entry points yet.
Bug: tint:8
Change-Id: Ie665771169261f6839de5eb1b66dc511bf47616a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/23704
Reviewed-by: David Neto <dneto@google.com>
This CL adds the start of identifier expressions to the Metal backend.
Identifiers with paths are currently not supported.
Bug: tint:8
Change-Id: I4df8b6a3c32251d454d3dae5fa8933dad36094f8
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/23703
Reviewed-by: David Neto <dneto@google.com>
This CL adds generation of the return statement.
Bug: tint:8
Change-Id: Iffee600e77a485649b987d39aab47742968e438e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/23702
Reviewed-by: David Neto <dneto@google.com>
This CL adds the start of type emission for the Metal backend. A few
types like pointers and structs aren't complete yet.
Bug: tint:8
Change-Id: I648e9275ef1b9dc6fa63b6ab328fe018a5f620ea
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/23701
Reviewed-by: David Neto <dneto@google.com>
This CL adds the basis of the Metal Shading Language backend.
Bug: tint:8
Change-Id: I85976250eb41ac12203a5db116444e993c3d09d4
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/23700
Reviewed-by: David Neto <dneto@google.com>
This CL adds the conversion of `as<f32>(b)` to SPIR-V.
Bug: tint:5
Change-Id: If1e04db2fe5520940527f4dcf52a89628b11b518
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/23461
Reviewed-by: David Neto <dneto@google.com>
This is needed to allow users to actually use tint/tint.h
BUG=tint:87
Change-Id: I70c9397a0497feca88ccf8879a3d0e8a03ab8471
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/23260
Reviewed-by: dan sinclair <dsinclair@google.com>
This supports the extended instructions used by the compute_boids
example.
Bug: tint:3
Change-Id: I364c343217139e489377dd2a9330058114023caa
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/23126
Reviewed-by: dan sinclair <dsinclair@google.com>
tint.h selectively includes headers depending on what features are enabled. It
is based off of the original sample code, so should give users access to all of
the functionality demonstrated in there.
This is located in include/tint/, so that users can have a pretty include of
tint/tint.h.
BUG=tint:87
Change-Id: I8659c789c154349e4e8e7730dc334da4fb6eba70
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/23124
Reviewed-by: dan sinclair <dsinclair@google.com>
This CL adds the necessary code to generate an OpAny instruction.
Bug: tint:5
Change-Id: I558b2cbf4bade3b4ab17997d24dcffddc32e2b41
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/22620
Reviewed-by: David Neto <dneto@google.com>
The `unless` statement was removed from the WGSL grammar so remove it
from Tint.
Change-Id: I31a185f5c5e3e88b667caea1c9a88aee80c0b810
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/22581
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
This CL removes the conditional forms of the break and continue
statements as they are no longer in the WGSL spec.
Change-Id: I46224d6cb5ce706cfc95d35ab0a4eea46abf62a9
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/22580
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
This CL adds a parent class for the type types of interger literals for
the cases where we can have either.
Change-Id: I61b540bedd49a6cf5a899e6864e2ea6f140cd2be
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/22541
Reviewed-by: David Neto <dneto@google.com>
This Cl clarifies that IntLiteral is a signed value, which matches with
the usage of UintLiteral.
Change-Id: Ic8f0e2382cb66eb6b09daed096886dcc55e6b0f0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/22540
Reviewed-by: David Neto <dneto@google.com>
This CL adds switch support to the SPIR-V writer.
Bug: tint:5
Change-Id: I8a6ad40cb2d344c87abdf842194b60afb1b4c96e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/22165
Reviewed-by: David Neto <dneto@google.com>
This Cl adds preliminary support for generating Kill commands. This may
change in the future if the semantics of kill are set in WGSL to not
match OpKill.
Bug: tint:5
Change-Id: Id466a1b26b37867a26373b93f56d627a0491f47f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/22240
Reviewed-by: David Neto <dneto@google.com>
The intrinsic methods were removed from the WGSL grammar and are treated
as builtin functions. This Cl updates Tint to match.
Bug: tint:41
Change-Id: I3f9ff6c17f1ca57ad159d883fd5a966657caeb4f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/22301
Reviewed-by: David Neto <dneto@google.com>
This CL removes the builtin_decoration from the parser in favour of
using IDENT tokens for builtins. We still convert to an enum in the
parser and validate the value provided.
Bug: tint:41
Change-Id: If5dc3844e3325c75951e7b320c123cf66cb8e106
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/22300
Reviewed-by: David Neto <dneto@google.com>
The NOP command was added for complete SPIR-V bijectivity which is no
longer a goal of WGSL. The NOP command has been removed from the spec,
so remove from Tint.
Change-Id: Ic640d9d3b987a19668dc169ff549444921c5bbb8
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/22160
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Dawn has issues with building tint targets without these specified. Putting them
in public_deps doesn't resolve the linking issue.
Change-Id: Ib99f2d4a74cbb3a33c0aa9e47e5eb788ef01a7e8
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/21280
Reviewed-by: dan sinclair <dsinclair@google.com>
The WGSL spec requires initializers for Output, Private and Function
variables. This CL adds initializers where needed.
Bug: tint:75
Change-Id: Id97f85a67ead2ffc41d6bdd1b71bf7034b04502a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/20980
Reviewed-by: David Neto <dneto@google.com>
This CL starts support for the cast expression. It adds the i32 to f32
conversion path.
Bug: tint:5
Change-Id: Id1eafc38592060c4b5b91964302d79a847e2edaf
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/20628
Reviewed-by: David Neto <dneto@google.com>
Label basic blocks with:
- their nearest enclosing structured control flow constructs.
- their nearest enclosing continue construct, if any
- their nearest enclosing loop construct, if any
A construct consists of a span of blocks in the computed block order.
It knows its parent construct, if any, and its nesting depth.
Bug: tint:3
Change-Id: Ia945706e8ea2435d6c40fb4e36dc2daeeb9780d0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/20421
Reviewed-by: dan sinclair <dsinclair@google.com>
TEST=Built fuzzer in local checkout of Chromium with tint integrated.
BUG=dawn:14
Change-Id: I84aacd41f893070c3af40f5e640361e177689f9e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/20343
Reviewed-by: dan sinclair <dsinclair@google.com>
This Cl adds the code for the ArrayAccessor generation. Some of the
MemberAccessor code is included, but tests are coming in a later Cl.
Bug: tint:5
Change-Id: Id7d006ab4a82c1d31d8036d141c83d0d61f9bea5
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/20180
Reviewed-by: David Neto <dneto@google.com>
This CL adds the code to generate the negation and not operators.
Bug: tint:5
Change-Id: Ibb4d374586e1415a2a678e375c64ba69bbc20367
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/20143
Reviewed-by: David Neto <dneto@google.com>
This CL updates the expression class to set the alias value instead of
an alias as the result type.
Change-Id: If19ae394a09ba0dc76380514e53a488bbb5a7292
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/20140
Reviewed-by: David Neto <dneto@google.com>
Separate them into different test files, to match SPIR-V spec sections
Bug: tint:3
Change-Id: I89fe76230740da060d57ac23870069a5483b2d7d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/20043
Reviewed-by: dan sinclair <dsinclair@google.com>
Test non-nested sequences and selections.
Bug: tint:3
Change-Id: Ibbbcd428d701d9e7d4da1682f94c2bdbef00121b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19920
Reviewed-by: dan sinclair <dsinclair@google.com>
This CL adds the type determination and builder code to support
outputting the GLSL Round call.
Bug: tint:5
Change-Id: I84dadebaf19aee3361fb13b5f32ce1a9f1b0c421
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19923
Reviewed-by: David Neto <dneto@google.com>
This CL adds the initial generation of a loop construct into the
spirv-writer. This does not support break or continue yet.
Bug: tint:5
Change-Id: I41f5d9b634a1a4120f880c4143feacc7e58e2147
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19620
Reviewed-by: David Neto <dneto@google.com>
BUG=dawn:16
Change-Id: I1da30fed82a310007674801e3b1e853b25d5b573
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19640
Reviewed-by: dan sinclair <dsinclair@google.com>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
This CL removes the regardless statement and turns `regardless` into a
reserved word.
Change-Id: I50c521111b90dbadddaeb36674e8c40205186076
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19361
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Lots of little style nits needed to be fixed for this work.
BUG=tint:44
Change-Id: Ibb45d9e3f6795ee0c09f5eca994bb28e20979d97
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19221
Reviewed-by: dan sinclair <dsinclair@google.com>
This is a minimal config that gets us building the tint binary from samples/
BUG=tint:2
Change-Id: Ifafa903e99a34f1c47177eb954df69ecbe70cb36
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19106
Reviewed-by: dan sinclair <dsinclair@google.com>