Commit Graph

16 Commits

Author SHA1 Message Date
Austin Eng 86a617f110 Add InsertBraces: true to .clang-format
Bug: none
Change-Id: I4b4f2a4abfea7adcea406f458bc4e4a13b0e8c43
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/91000
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: dan sinclair <dsinclair@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2022-05-19 20:08:19 +00:00
Ben Clayton 0a3cda9911 tint: Replace all ProgramBuilder float literals with '_f' suffix
Unsuffixed float literals are currently treated as f32,
but will shortly become AbstractFloat. To keep tests behaving
identically to how they are currently, change all float literals
to explicitly use the f32 '_f' suffix.

Bug: tint:1504
Change-Id: I2a00725ee1b34a6efbe15ac4ba438c00c4416dd8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/89402
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-05-10 17:30:15 +00:00
Ben Clayton 41285aa578 tint: Lex different tokens for float suffixes
Generate different tokens for:
• 'f' suffixed float literals
• unsuffixed integer literals

'f' and unsuffixed are currently both treated as f32 by the resolver,
but this is the first step to supporting abstract floats.

Bug: tint:1504
Change-Id: Id3b1fe420b6eb8901f88d6a5de06ef4f54aa3edf
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/89031
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
2022-05-10 14:55:34 +00:00
Ben Clayton 0ce9ab042e tint: Change all ProgramBuilder literals to 'i' or 'u' suffix
Unsuffixed integer literals are currently treated as i32,
but will shortly become AbstractInteger. To keep tests behaving
identically to how they are currently, change all test literals
to using either 'i' or 'u' suffixes.

Bug: tint:1504
Change-Id: Ic373d18ce1c718a16b6905568aec89da3641d36b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/88845
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-05-05 20:23:40 +00:00
Ben Clayton 06496d4d1a tint/reader/spirv: Generate 'i' suffixed literals
For all i32 literal values.

Reduces risk of the SPIR-V reader producing WGSL that behaves
differently, when abstract-integers are fully implemented.

Bug: tint:1504
Change-Id: Ieaf8afec5b09c7978c75a38c6ed144633ddc017e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/88843
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
2022-05-04 22:25:19 +00:00
Ben Clayton 8822e2966a tint: Merge [S|U]intLiteralExpression
Merge SintLiteralExpression and UintLiteralExpression with
IntLiteralExpression. IntLiteralExpression has a new Suffix field which
indicates whether the literal is either a:
• 'i' suffixed integer literal
• 'u' suffixed integer literal
• no-suffix integer literal

Have the SPIR-V reader produce no-suffixed literals for i32 types, to
keep this change small. In future changes the SPIR-V reader will
produce 'i' suffixed types for these.

Have all consumers of IntLiteralExpression treat unsuffixed integers the
same as 'i'-suffixed literals. Unsuffixed will be treated as abstract in
future changes.

Removed SemHelper::TypeOf(const ast::LiteralExpression* lit).

Fixed: tint:1510
Bug: tint:1504
Change-Id: I443f41984e637ddd948182ee756af1010c5f8226
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/88842
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-05-04 22:18:49 +00:00
dan sinclair 41e4d9a34c Consistent formatting for Dawn/Tint.
This CL updates the clang format files to have a single shared format
between Dawn and Tint. The major changes are tabs are 4 spaces, lines
are 100 columns and namespaces are not indented.

Bug: dawn:1339
Change-Id: I4208742c95643998d9fd14e77a9cc558071ded39
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/87603
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-05-01 14:40:55 +00:00
James Price 26ebe5ec36 tint: Refactor if-else statement representation
Instead of using an `if` node that has a list of `else` statements,
make each `if` statement have a single optional `else` statement,
which may itself be an `if` statement (or just a block statement).

This better matches the WGSL grammar (now that we have removed
`elseif`), and simplifies various pieces of code that handle these
statements.

Change-Id: Ie4272f1422224490ac598a03aa8b4dd00ba03010
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/87940
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: James Price <jrprice@google.com>
2022-04-29 00:14:53 +00:00
Ben Clayton 01004b7732 tint: Remove '_type' suffix from file names
These suffixes existed because the GN build errored when there were two files sets with the same name (ast + sem).
This is no longer required as the GN build splits these into two separate targets.

Change-Id: Ib451da33a5f4aa5c867cb99419dd252766dc3daa
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/88308
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-04-28 18:49:04 +00:00
James Price 0384932f1a tint: Replace smoothStep with smoothstep in tests
There were some tests that were still using the deprecated name, as
was the SPIR-V reader.

Bug: tint:1483
Change-Id: Ie919596712e05340110fbd872470a1b4c9a625c7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86745
Auto-Submit: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>
2022-04-14 19:49:10 +00:00
dan sinclair 258cbafdec Condense namespaces in tint/reader/spirv.
This PR condenses the namespaces in the tint/reader/spirv folder.

Change-Id: I80cf1e7d3587020359d790381d147fde140b0ba5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86033
Reviewed-by: Ben Clayton <bclayton@google.com>
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-04-07 19:01:25 +00:00
Ben Clayton 41f8d2ad52 Use 'final' specifier on leaf classes
Tint makes heavy use of RTTI via virtual methods. Give the compiler the
opportunity to optimize away some of these virtuals.

Bug: tint:1383
Change-Id: I28edfaa0a05bb1a9c506c61c0084542c0aeb37f0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/82745
Reviewed-by: James Price <jrprice@google.com>
Reviewed-by: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-03-07 18:37:46 +00:00
Ben Clayton 2e6269acb0 Use the new Switch() inferred types
Change-Id: I48ecd18957101631caa27480e7b1937a10791118
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/81106
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-02-25 23:02:22 +00:00
Ben Clayton fe08ba4677 builtins: Add insertBits
CTS tests: https://github.com/gpuweb/cts/pull/1012

Bug: tint:1371
Change-Id: Idd55c0bc9dad1dffb558d0bc57d744f65e9041b5
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/81701
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
2022-02-23 21:18:09 +00:00
Ben Clayton d868e860e0 builtins: Add extractBits
CTS tests: https://github.com/gpuweb/cts/pull/1005

Bug: tint:1371
Change-Id: I228c7b2a27c6fbac0653c416fac603a6fb4bff85
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/81640
Reviewed-by: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-02-23 21:18:09 +00:00
Ryan Harrison dbc13af287 tint->dawn: Shuffle source tree in preperation of merging repos
docs/    -> docs/tint/
fuzzers/ -> src/tint/fuzzers/
samples/ -> src/tint/cmd/
src/     -> src/tint/
test/    -> test/tint/

BUG=tint:1418,tint:1433

Change-Id: Id2aa79f989aef3245b80ef4aa37a27ff16cd700b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/80482
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2022-02-21 15:19:07 +00:00