This CL adds calls to functions to the SPIR-V writer.
Bug: tint:5
Change-Id: Id6f3e41deba937edb85fa6ec2f2db8d1f4241944
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/23621
Reviewed-by: David Neto <dneto@google.com>
This CL adds generation of OpFunctionParameter entries for function
parameters.
Bug: tint:5
Change-Id: I7af6cb756e20674f32737f2ef362fda12c9d2ef2
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/23620
Reviewed-by: David Neto <dneto@google.com>
This CL adds support for the && and || operators to the SPIR-V backend.
Bug: tint:5
Change-Id: I63b23d9904b5b8027e189034d24949df71cbbe42
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/23501
Reviewed-by: David Neto <dneto@google.com>
TODOs in the test file are or were in the function_arithmetic_test.cc
Change-Id: I679dbf0019e12e26488ccc310dfb03a535628e0b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/23462
Reviewed-by: dan sinclair <dsinclair@google.com>
This CL adds support for type determination of the SClamp and UClamp
GLSL methods.
Change-Id: I974e80127f0e256285f126136270ac5131334a92
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/23500
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>
When parsing the `u` in `1024u` we were not advancing the lexer to the
next token which would give parse errors.
Change-Id: I8473b55992ff01d24f9d961878afa6b54d855e68
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/23460
Reviewed-by: David Neto <dneto@google.com>
This CL adds type determination for the MatrixInverse GLSL method call.
Change-Id: I976beb00bb5c869407a0c9f522789112ff22bf6a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/23400
Reviewed-by: David Neto <dneto@google.com>
This CL adds the type determination code for the GLSL determinant call.
Change-Id: I46bc57f4fd5f4f43021b20ee511b0b8fc809f4f8
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/23360
Reviewed-by: David Neto <dneto@google.com>
Currently we will attempt to extract composite values for constant
constructors which may happen outside of a function. This causes issues
as the extract requires us to be in a function.
Change-Id: I5724987542cc7d9d86493363ed4d9a44a391a52f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/23221
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 CL cleans up various formatting and lint errors.
Change-Id: Ieee14db90e36acc8b469d58abb84fcf3595321bb
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/23224
Reviewed-by: David Neto <dneto@google.com>
Add a guard variable for flow control within that if-selection.
Also, the premerge blocks are always surrounded by an if-selection,
to ensure we cause reconvergence at the end of the original if-selection
construct, just like in the original SPIR-V.
Bug: tint:3
Change-Id: I614c6840e539bf9a338058beb5b6f70484e3320a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/23182
Reviewed-by: dan sinclair <dsinclair@google.com>
We've already written those tests.
Bug: tint:3
Change-Id: Ic836be43b5f1220e3563e4d27abd9b5e2ab54460
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/23180
Reviewed-by: dan sinclair <dsinclair@google.com>
This CL adds the ability to attach a stride to an array type and have it
emitted during SPIR-V generation.
Bug: tint:5
Change-Id: I9c0f0a6afef6ae6662b64f4da2c150ba3f8da29f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/23223
Reviewed-by: David Neto <dneto@google.com>
This CL updates the type determination code to determine the types of
module scoped variable constructors.
Bug: tint:89
Change-Id: Icd5d65409fcf17a0cbf0b34b9919f8d9e1577354
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/23220
Reviewed-by: David Neto <dneto@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>
- Avoid redundant switch-break.
WGSL does an implicit break at the end of a switch case, because
it has fallthrough.
TODO: Emit fallthrough
Bug: tint:3
Change-Id: Ida44b13181a01a2c1459c0447dac496ba5b97ffc
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/22961
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>
In BlockInfo, remove the backpointers from true-head, false-head, and
premerge-head to the if-selection header block.
Convert the forward references from if-selection to its internal heads
from pointers to IDs.
Bug: tint:3
Change-Id: Ic931df519795e14374bff4f60ad37a4b32f79c91
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/23140
Reviewed-by: dan sinclair <dsinclair@google.com>
Produce less noise in ASTs for a common case.
Also test that an empty continuing construct doesn't show up in the
AST. That's currently handled by the AST code. We want to keep this
behaviour even if the AST implementation changes. Right now
code change is needed when emitting the start of a continuing
construct.
Bug: tint:3
Change-Id: I96a12087e305c64647561f65d87acda907ae9c42
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/22844
Reviewed-by: dan sinclair <dsinclair@google.com>
This CL adds the type determination for the GLSL methods FindILsb,
FindUMsb, FindSMsb and InterpolateAtCentroid.
Change-Id: I2b1e9d021e6799ffe6b5b71c5cca947b8e6ccfa0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/22843
Reviewed-by: David Neto <dneto@google.com>
This CL adds support for the GLSL cross method.
Change-Id: Ib2e83a2ef2e580c6ca257851a76f3f66fa377d6f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/22842
Reviewed-by: David Neto <dneto@google.com>
This CL adds type determination for the umin, umax, smin and smax GLSL
methods.
Change-Id: Ib301da41baf718e309a940f4a3560088daa10741
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/22841
Reviewed-by: David Neto <dneto@google.com>
This CL adds the SSign and SAbs GLSL methods to the type determination.
Change-Id: If0e25cd153bd3aaef1cb031d647a86e98ff917bf
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/22840
Reviewed-by: David Neto <dneto@google.com>
This Cl cleanups and simplifies the type determination for the GLSL
imports.
Change-Id: I9dd85ac390ef37c91d9493f840f81ceb6736fc06
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/22820
Reviewed-by: David Neto <dneto@google.com>
This emits the equivalent of break-if, break-unless, continue-if,
continue-unless. But we do it via a regular if-then-else.
Adds a test matrix.
Adds all required tests except for those needing OpSwitch.
Bug: tint:3
Change-Id: I960a40aa00f95f394a92a099c8b12104010ad49f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/22603
Reviewed-by: dan sinclair <dsinclair@google.com>
This is a bit pathological.
Bug: tint:3
Change-Id: I448796c712049f88cef9a592c218d94a0daddb75
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/22760
Reviewed-by: dan sinclair <dsinclair@google.com>
Prefix should match a method name on FunctionEmitter
Bug: tint:3
Change-Id: I0af9fb33210d09a59e5cacdade986668fe685682
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/22681
Reviewed-by: dan sinclair <dsinclair@google.com>
A merge block must be dominated by its own header.
This CL checks the cases where that fails because the
merge block is also the:
- the default or case header for a switch (a different header)
- the true-head, false-head, or premerge-head for an if-selection
with a different header
Bug: tint:3
Change-Id: I6dd1fae162e9d33bd9a0b43d3ca9558cebed058b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/22680
Reviewed-by: dan sinclair <dsinclair@google.com>
This is a bit pathological.
Bug: tint:3
Change-Id: I820d7d1bfd298a22be6c6014e7d4d00f1097759e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/22740
Reviewed-by: dan sinclair <dsinclair@google.com>
This fixes the pathological cases nobody wants, and arguably
should be added to the SPIR-V spec.
If we really really want to support these cases, we can revisit.
Bug: tint:3
Change-Id: I0a75490d451676caa0933e3761098ba1fe3f8b60
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/22664
Reviewed-by: dan sinclair <dsinclair@google.com>
This CL simplifies the capabilities code in the SPIR-V builder.
Bug: tint:5
Change-Id: Iff99350b2d6a2534c82ea3d47a0a9186d0dcb6ac
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/22661
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
This CL adds support for generating OpOuterProduct.
Bug: tint:5
Change-Id: Iefbc91807850b7caf5dba393124f97417b7b0b09
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/22660
Reviewed-by: David Neto <dneto@google.com>
This CL adds support for generating the various dpdx, dpdy and fwidth
instructions.
Bug: tint:5
Change-Id: I6d12c738b93931d1e740659d9c1871892b801f71
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/22625
Reviewed-by: David Neto <dneto@google.com>
This CL adds support for generating OpDot.
Bug: tint:5
Change-Id: I5a77e49ff26ff12b4ed7b2b01665f0928e51a568
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/22624
Reviewed-by: David Neto <dneto@google.com>