Commit Graph

17 Commits

Author SHA1 Message Date
Stephen White bf0180bcee GLSL: only emit default precision qualifier for frag shader.
Other shader types don't need this.
Also fix code style of member var.

Bug: tint:1360
Change-Id: Ic3600ec7c6da9b85b57655fabbf1f2e44b0ea7d3
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/79640
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2022-02-07 18:49:46 +00:00
Stephen White 0b39270e01 GLSL: move entry point handling to CanonicalizeEntryPointIO transform.
Move builtin_to_string() and builtin_type() to
the CanonicalizeEntryPointIO transform. Use the former to
rename entry point IO variables to the gl_ names, and the latter
to cast values to the correct type.

Change-Id: Iddfad574ddd660ff1bfd89a399a001b967b6b67e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/78380
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2022-01-28 22:36:58 +00:00
Stephen White e2f35ba8e0 GLSL: clean up GLSL output whitespace generation.
More line() and less std::endl.
More automated indents and less manual spacing.
Put a single newline after every struct and function declaration.

Note that this does touch every test result, but only affects whitespace.

Change-Id: I7506b9029b79b91fb335911dba44369b36f09bbe
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/78300
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2022-01-26 16:48:55 +00:00
Stephen White 8e01c45e54 GLSL: add location layout qualifier before in/out variables.
Bug: tint:1398
Change-Id: I89c985d01d539ed166661ee5e858247cde4702b3
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/78080
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2022-01-25 19:44:14 +00:00
Stephen White 671d9703f0 GLSL samples: add empty entry point if needed.
If a WGSL test contains no entry points, add an empty one.
In that case, do not pass its name to the generator, so we
generate code for all functions, so they aren't culled for
reachability.

Add new test results for formerly empty tests.

Bug: tint:1376
Change-Id: Ibf371b943fb273d44712dfcc9dc1b7bb4ab071db
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/76540
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2022-01-21 18:40:18 +00:00
Ben Clayton 01e4b6fc18 wgsl: Replace [[decoration]] with @decoration
Deprecate the old syntax. Migrate everything to the new syntax.

Bug: tint:1382
Change-Id: Ide12b2e927b17dc93b9714c7049090864cc568d3
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/77260
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: David Neto <dneto@google.com>
2022-01-19 22:46:57 +00:00
James Price 6b1e5f552b wgsl: Do not require a semicolon after a struct
Don't generate them either, which generated a lot of test churn.

Fixed: tint:1380
Change-Id: I0a7cfdd2ef0ffe8e7fda111fbc57997b36b949e0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/77165
Auto-Submit: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-01-19 18:11:17 +00:00
Stephen White 1704fe53f5 GLSL: implement inf, nan.
Use uintBitsToFloat.

Bug: tint:1306
Change-Id: Ie9a5e14c13c0d63b57c126f16c4e2a5c7a77e3f7
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/69740
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2021-11-18 13:11:43 +00:00
Stephen White 2fe0f4b42b GLSL: add .expected.glsl files for all tests.
Bug: tint:1301
Change-Id: Id3a591a2fa0dfdb112046d5c57defbae07483e0d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/69480
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2021-11-16 15:15:36 +00:00
James Price 11c6fcdb51 spirv: Use generic transform to process shader IO
The refactored CanonicalizeEntryPointIO transform makes it much easier
to handle SPIR-V style IO as well, and doing this removes a lot of
duplicated code. Remove all of the SPIR-V transform code for shader IO
and vertex point size.

Bug: tint:920
Change-Id: Id1b97517619b4d2fd09b45d5aee848259f3dfa77
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/60840
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
Auto-Submit: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-08-05 17:34:19 +00:00
James Price a5d73ce965 transform/shader_io: Generate a wrapper function
This is a major reworking of this transform. The old transform code
was getting unwieldy, with part of the complication coming from the
handling of multiple return statements. By generating a wrapper
function instead, we can avoid a lot of this complexity.

The original entry point function is stripped of all shader IO
attributes (as well as `stage` and `workgroup_size`), but the body is
left unmodified. A new entry point wrapper function is introduced
which calls the original function, packing/unpacking the shader inputs
as necessary, and propagates the result to the corresponding shader
outputs.

The new code has been refactored to use a state object with the
different parts of the transform split into separate functions, which
makes it much more manageable.

Fixed: tint:1076
Bug: tint:920
Change-Id: I3490a0ea7a3509a4e198ce730e476516649d8d96
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/60521
Auto-Submit: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-08-04 22:15:28 +00:00
Antonio Maiorano d388bc9b36 Restore "MSL writer: make signed int overflow defined behaviour"
This reverts commit e33b0baa08.

Added tests/expressions/literals/intmin.wgsl test.

Bug: tint:124
Change-Id: I3d46f939ff20fa377ddb5fcb52f9afe728b8e430
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/60441
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-07-30 18:59:06 +00:00
Ben Clayton 33afd6ce97 Revert "writer/hlsl: Special case negative zero"
This reverts commit efceb83536.

Reason for revert: Possibly broke tint -> dawn roll (again)

Original change's description:
> writer/hlsl: Special case negative zero
>
> Fixed: tint:960
> Change-Id: I04de8713fe299607f32fd93288a22b75a9dff381
> Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58760
> Reviewed-by: Ben Clayton <bclayton@chromium.org>
> Reviewed-by: James Price <jrprice@google.com>
> Commit-Queue: Ben Clayton <bclayton@google.com>
> Kokoro: Kokoro <noreply+kokoro@google.com>

TBR=bclayton@google.com,jrprice@google.com,bclayton@chromium.org,noreply+kokoro@google.com,tint-scoped@luci-project-accounts.iam.gserviceaccount.com

Change-Id: Ic3042dabbd5a399851185714a6dd5e33ba8a5fc6
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/59023
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
2021-07-20 20:35:41 +00:00
Ben Clayton efceb83536 writer/hlsl: Special case negative zero
Fixed: tint:960
Change-Id: I04de8713fe299607f32fd93288a22b75a9dff381
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58760
Reviewed-by: Ben Clayton <bclayton@chromium.org>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-07-20 12:45:30 +00:00
Ben Clayton 5d922d02fc Revert "writer/hlsl: Special case negative zero"
This reverts commit 26b6edc545.

Reason for revert: Seems to be breaking Dawn's tests. Investigation required.

Original change's description:
> writer/hlsl: Special case negative zero
>
> Fixed: tint:960
> Change-Id: I060bc6b7a9ad4d21dd5cadb4b68998c7e54ebaed
> Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/57142
> Kokoro: Kokoro <noreply+kokoro@google.com>
> Commit-Queue: Ben Clayton <bclayton@google.com>
> Auto-Submit: Ben Clayton <bclayton@google.com>
> Reviewed-by: James Price <jrprice@google.com>

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: Ia0b0ec996f2ed6b1599a344c970f155c12314ea9
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/57460
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
2021-07-08 16:49:33 +00:00
Ben Clayton 26b6edc545 writer/hlsl: Special case negative zero
Fixed: tint:960
Change-Id: I060bc6b7a9ad4d21dd5cadb4b68998c7e54ebaed
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/57142
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
2021-07-07 11:19:20 +00:00
Ben Clayton 692fc20797 [writer/hlsl,msl] Correctly generate inf and nan literals
Also add missing msl macros to the renamer.

Bug: tint:951
Change-Id: I543e6eae885c979596ca63f9d6c7378dd5425e8a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/56941
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
2021-07-06 09:43:49 +00:00