The AST only wants expressions, not their result types.
But the SPIR-V reader wants to track the AST type as well.
So introduce a TypedExpression concept for internal use.
Bug: tint:3
Change-Id: Ia832f7422440ef0e8e04630cdca98cae20e18921
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/20040
Reviewed-by: dan sinclair <dsinclair@google.com>
This CL adds type determinater support for Normalize.
Bug: tint:5
Change-Id: Idbea41942172f8404122b7a756ccf1ec5aad2af8
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19950
Reviewed-by: David Neto <dneto@google.com>
This CL adds type determiner support for the Exp, Exp2, Log, Log2, Sqrt
and InverseSqrt GLSL methods.
Bug: tint:5
Change-Id: I3b9e799a8ebe5e8c96c1daf07131feae40e0c54e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19949
Reviewed-by: David Neto <dneto@google.com>
This CL adds support for the GLSL trig functions.
* sin
* cos
* tan
* asin
* acos
* atan
* sinh
* cosh
* tanh
* asinh
* acosh
* atanh
Bug: tint:5
Change-Id: I38c8bf45c3aeeef81711de3a3eca6a9339af146c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19948
Reviewed-by: David Neto <dneto@google.com>
This CL adds support to the type determiner for the GLSL Radians and
Degrees methods. We use the general float calls for this because we only
support FP32 and have plans for FP16. Other floating point sizes are not
supported but we have no support for them..
Bug: tint:5
Change-Id: I38f0551ce5f9ed7dd31496f13880697cd1f21ba4
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19947
Reviewed-by: David Neto <dneto@google.com>
This CL adds Fract into the type determiner.
Bug: tint:5
Change-Id: I616d3259ca903b82339f49317f27966265c3f1d5
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19946
Reviewed-by: David Neto <dneto@google.com>
This CL adds Ceil support to the type determiner
Bug: tint:5
Change-Id: Iba785dbea412cc94f9b0faa3e6d38f02453d5215
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19945
Reviewed-by: David Neto <dneto@google.com>
This CL adds Floor into the type determination
Bug: tint:5
Change-Id: I2b9013e073458fbe9f8a9ff657582a715f91c480
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19944
Reviewed-by: David Neto <dneto@google.com>
This CL adds FSign to the type determination.
Bug: tint:5
Change-Id: I8e3a7e94f367c4aaa510e72f774097946382a968
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19943
Reviewed-by: David Neto <dneto@google.com>
This CL adds FAbs to the type determinator.
Bug: tint:5
Change-Id: I9793f5d469eb5a70f2a024c325e098ed9ca8ea7c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19942
Reviewed-by: David Neto <dneto@google.com>
This CL adds type determination for the Trunc method.
Bug: tint:5
Change-Id: I4f23dad7725f1f076fbbc7da8687de42a02cc482
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19941
Reviewed-by: David Neto <dneto@google.com>
This CL adds support for the GLSL RoundEven command in type
determination.
Bug: tint:5
Change-Id: I956ea9532785a42fe51a24b5121ce47cfbc78242
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19940
Reviewed-by: David Neto <dneto@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 renames the parts of the identifier to segments and then adds a
path() and name() methods to get the respective parts of the identifier.
Change-Id: I1a365df7cb83ac0dd3d6be9ec6ccb83bfc73dd91
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19762
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
This CL moves the ast::Module to be provided to the type determiner
constructor so we can access it for things like the imports.
Change-Id: I110fffe669a8a007461bf84d30d85d70405e37be
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19761
Reviewed-by: David Neto <dneto@google.com>
This CL updates the type determiner test helper to have a ast::Module
and updates all tests to use the module. The tests have all be updated
to consistently use the type determiner provided by the helper as well.
Change-Id: If47a873c439e5a5019e21679cba957d4c762f4e6
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19780
Reviewed-by: David Neto <dneto@google.com>
This CL adds type determination for the call parameters.
Bug: tint:5
Change-Id: I488718bd7a4c1f2304a1c17554b8354d184dc159
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19760
Reviewed-by: David Neto <dneto@google.com>
This CL moves the ast::Module to the constructor of the SPIR-V builder
class. This allows access to things like the ast::Import from the
builder class.
Bug: tint:5
Change-Id: I0d61b164c1274d006e124dde2cc11f41a2385fc5
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19922
Reviewed-by: David Neto <dneto@google.com>
This CL moves the checks for different types into the type class so it
can be used in both the type determinater and the SPIR-V builder.
Change-Id: I9142adaf5fc1d6048792645d7892f8d8900fcf59
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19921
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>
This CL adds binary multiplication generation to the SPIR-V writer.
Bug: tint:5
Change-Id: I668d24035e947c51a9737549fd0841a4e8af1331
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19700
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 adds generation for the OpShiftLeftLogical, OpShiftRightLogical
and OpShiftRightArithmetic expressions.
Bug: tint:5
Change-Id: I3436453350fc9afd3528b1ae238682b7abc6d636
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19508
Reviewed-by: David Neto <dneto@google.com>
This CL adds generation for the OpFDiv, OpSDiv and OpUDiv SPIR-V
instructions.
Bug: tint:5
Change-Id: I9fd875f453dd71857b192a2dad56149bae52caf5
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19507
Reviewed-by: David Neto <dneto@google.com>
This CL adds support for generating the OpSMod, OpUMod and OpFMod SPIR-V
instructions.
Bug: tint:5
Change-Id: I9e2183535ba24a2d0bb4257dd797a62151fe04a1
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19506
Reviewed-by: David Neto <dneto@google.com>
This CL adds generation of the OpFSub and OpISub SPIR-V commands from
the subtraction binary expression.
Bug: tint:5
Change-Id: Ia25a855a972057a4cac70d538946e176e0a0e5c3
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19505
Reviewed-by: David Neto <dneto@google.com>
This CL cleans up some lint errors.
Change-Id: Ibfe9768cc4272d015a35a8d7edde0390b8fc66a5
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19504
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
This CL adds support for having elseif statements after an if statement.
Bug: tint:5
Change-Id: I3cd3c5bddaa57c998b1a3fbee7bd87536533301d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19500
Reviewed-by: David Neto <dneto@google.com>
This CL adds the start of support for else statements.
Bug: tint:5
Change-Id: I742fd4582bfee4f31715b94b7aea6cf8383f4e22
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19412
Reviewed-by: David Neto <dneto@google.com>
This CL adds the code to generate simple if statements.
Bug: tint:5
Change-Id: Ied42ad8b3632d7926ac646d1aa21e190a7a2c07e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19411
Reviewed-by: David Neto <dneto@google.com>
This CL adds bitwise xor support to the spirv writer.
Bug: tint:5
Change-Id: I011283ef12840d25c882b95fc664f2b0dc6003da
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19410
Reviewed-by: Ryan Harrison <rharrison@chromium.org>