Commit Graph

8 Commits

Author SHA1 Message Date
Ben Clayton f47887d207 tint/writer/msl: Generate an array<T,N> helper
And remove the WrapArraysInStructs transform.

Wrapping arrays in structures becomes troublesome for `const` arrays, as
currently WGSL does not allow `const` structures.

MSL 2.0+ has a builtin array<> helper, but we're targetting MSL 1.2, so
we have to emit our own. Fortunately, it can be done with a few lines of
templated code.

This produces significantly cleaner output.

Change-Id: Ifc92ef21e09befa252a07c856c4b5afdc51cc2e4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/94540
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
2022-06-24 17:01:59 +00:00
jchen10 ef62b58cf9 Skip Gamma and Gamut conversions for BT.709->SRGB
This introduces a new field 'doYuvToRgbConversionOnly' in
ExternalTextureParams to have the WGSL only do yuv->rgb conversion for
better performance. User studies shows that users don't really care
about the Gamma difference between 2.4 and 2.2.
https://source.chromium.org/chromium/chromium/src/+/main:ui/gfx/color_space.cc;l=1022;drc=a1dbb594a6741a400db35fe3678e77bad2504ea4

Bug: dawn:1082
Bug: dawn:1466
Change-Id: I61c0fe65c5969d8a61c267c202c8dd64c259ed8a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/92901
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Jie A Chen <jie.a.chen@intel.com>
2022-06-22 03:14:26 +00:00
Ben Clayton cb6ddd2aa6 tint/writer/msl: Inline constant expressions
This is required to handle materialized values, and for constant
expressions.

Bug: tint:1504
Change-Id: Ic3ac62317241fa6f7009360128f222aeb56f62e4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/92083
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-06-01 10:08:29 +00:00
Brandon Jones 41cbf0279c Reland ExternalTexture Gamma/Gamut Correction
Adds configurable gamma and gamut correction in Tint's external texture
transform. Adds constants in Dawn to perform correct conversion from
BT.709 to sRGB.

Bug: dawn:1082
Change-Id: I68b7ad7ccec29977c637a0a0d4f526cd47fe73d4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/88367
Commit-Queue: Brandon1 Jones <brandon1.jones@intel.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2022-04-29 21:00:14 +00:00
Ben Clayton 1d882f55b7 Revert "Add External Texture Gamma/Gamut Correction"
This reverts commit 857175e59b.

Reason for revert: Suspected change for Dawn -> Chromium roll failures:

* https://chromium-review.googlesource.com/c/chromium/src/+/3607875/
* https://ci.chromium.org/ui/p/chromium/builders/try/mac-rel/982037/overview
* https://chrome-public-gold.skia.org/search?issue=3607875&crs=gerrit&patchsets=3&corpus=chrome-gpu


Original change's description:
> Add External Texture Gamma/Gamut Correction
>
> Adds configurable gamma and gamut correction in Tint's external texture
> transform. Adds constants in Dawn to perform correct conversion from
> BT.709 to sRGB.
>
> Bug: dawn:1082
> Change-Id: Id5eecc37f0224541bf36e2f9757e7e2047e4b66b
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/87666
> Kokoro: Kokoro <noreply+kokoro@google.com>
> Reviewed-by: Ben Clayton <bclayton@google.com>
> Commit-Queue: Brandon1 Jones <brandon1.jones@intel.com>

TBR=cwallez@chromium.org,enga@chromium.org,brandon1.jones@intel.com,bclayton@google.com,noreply+kokoro@google.com,dawn-scoped@luci-project-accounts.iam.gserviceaccount.com

Change-Id: Id3880e506172a18ff1258462c8c4cedb5c51c235
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: dawn:1082
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/88001
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-04-26 12:20:02 +00:00
Brandon Jones 857175e59b Add External Texture Gamma/Gamut Correction
Adds configurable gamma and gamut correction in Tint's external texture
transform. Adds constants in Dawn to perform correct conversion from
BT.709 to sRGB.

Bug: dawn:1082
Change-Id: Id5eecc37f0224541bf36e2f9757e7e2047e4b66b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/87666
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Brandon1 Jones <brandon1.jones@intel.com>
2022-04-25 22:22:51 +00:00
Brandon Jones 6cb57a9847 Change External Texture YUV-to-RGB Conversion to Use Matrix
Changes Dawn and Tint to use a 3x3 matrix for external texture
YUV-to-RGB conversions. This will allow us to use standard matrices
as they exist in SkYuvMath.

Bugs: dawn::1082
Change-Id: I8e0c7c3dc1c085d8f336da956aea9496913b70fa
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86847
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Brandon1 Jones <brandon1.jones@intel.com>
2022-04-21 16:02:36 +00:00
Antonio Maiorano a730eb738e Add option to auto generate bindings for external textures
With this change, the backend sanitizers always run the
MultiplanarExternalTexture transform. If the new option is enabled, it
auto-generates bindings for this transform.

This change also enables this auto-generation for the Tint commandline
application, as well as for the fuzzers.

Bug: chromium:1310623
Change-Id: I3c661c4753dc67c0212051d09024cbeda3939f8c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/85542
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-04-06 13:57:54 +00:00