Commit Graph

165 Commits

Author SHA1 Message Date
John Stiles
1f0dc9cd1b Update SkSL type priorities to differentiate signed/unsigned types.
Previously, coercion between a signed type and an unsigned type was
treated as "no cost" because these types shared the exact same priority.
This meant that we couldn't choose the proper overload with function
calls that only differed in signed-ness, like:

  void fn(int4 x);
  void fn(uint4 x);

So we would always choose the int4 version since we encountered it
first. Now, we can choose the correct overload; signed types now have
a slightly elevated priority over unsigned types, allowing coercion
costs to work normally.

Also added some comments to `determineFinalTypes` while trying to see
if that needed some improvements as well, but this turned out to be
a red herring--it didn't need any functional changes.

Change-Id: I334debae9ad0e9b290109658d2fde8f6526770a2
Bug: skia:10999
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/344017
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-12-14 17:29:23 +00:00
John Stiles
86424eb0cf Add Metal support for the findLSB intrinsic.
Change-Id: Id38a3d04fcb1904a4c666d92087b4fe14bd03a27
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/343110
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-12-11 17:19:52 +00:00
John Stiles
ad0571f54a Add support for scalar faceforward intrinsic in Metal.
Change-Id: I8eae896f5a859b59a1ba0b29dc95d5aa070c12ae
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/343102
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-12-11 15:29:50 +00:00
John Stiles
e2d34f8ebf Add Metal support for degrees() and radians() intrinsics.
Change-Id: I4a483c455c9a12c92b717a0c2713d32ab44dcd6f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/343099
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-12-11 14:33:30 +00:00
John Stiles
90227be1bf Add parameter names to FunctionDeclaration descriptions.
Separating this out from landing SkSL DSL, as it's causing unrelated
test churn as the DSL code gets submitted and reverted.

Change-Id: I0d3ade4ca8d1b0c302ccc494f0192a4f5ae67086
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/343109
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-12-11 03:44:19 +00:00
John Stiles
0d19fb474d Fix misspelling of faceforward() intrinsic in SPIR-V.
Change-Id: I0e289a136678fe863445f739f162a718c341977f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/343104
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-12-10 22:49:19 +00:00
Ethan Nicholas
6b07e0eb49 Reland "Reland "Revert "Initial land of SkSL DSL."""
This reverts commit 52e5850065.

Reason for revert: Failing on Build-Debian9-Clang-arm-Release-Flutter_Android_Docker: https://logs.chromium.org/logs/skia/5066a8ed31374c11/+/steps/Run_build_script_in_Docker/0/stdout

Original change's description:
> Revert "Reland "Revert "Initial land of SkSL DSL."""
>
> This reverts commit 53f69f1539.
>
> Change-Id: I374b016c8a08d83c99cbab800f30b882244b87f1
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/342919
> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
> Commit-Queue: John Stiles <johnstiles@google.com>
> Auto-Submit: Ethan Nicholas <ethannicholas@google.com>
> Reviewed-by: John Stiles <johnstiles@google.com>

TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com

# Not skipping CQ checks because this is a reland.

Change-Id: Ia04ee404478314b3ae034e0a7740ef667364b2f8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/343100
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2020-12-10 20:56:09 +00:00
John Stiles
d06d4a983f Fix matrixCompMult halfNxM implementation and add unit tests.
The existing code didn't work properly with half types since the $mat
type encompassed both halfNxM and floatNxM. This was fixed by splitting
the half types out of $mat into a separate $matH generic.

Unit tests now compile properly for GLSL, but generate errors in SPIR-V
and generate Metal code which attempts to call a non-existent intrinsic.

Change-Id: I2fff10f0dd7f00534bf6b1d5b13354543694194e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/342926
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-12-10 20:51:59 +00:00
Ethan Nicholas
52e5850065 Revert "Reland "Revert "Initial land of SkSL DSL."""
This reverts commit 53f69f1539.

Change-Id: I374b016c8a08d83c99cbab800f30b882244b87f1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/342919
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2020-12-10 18:02:38 +00:00
John Stiles
f64e4075f2 Add support for float/int bitcast intrinsics in Metal.
Change-Id: I7af94d89d349b67b2c070179324fcad7b62e0d1e
Bug: skia:11071
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/342758
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-12-10 16:13:38 +00:00
John Stiles
cc9ff0074e Add support for float/int bitcast intrinsics in SPIR-V.
Change-Id: I1d5a056e08ba6e67016e45c52518da6074a62c8f
Bug: skia:11071
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/342759
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-12-10 15:42:18 +00:00
John Stiles
2aa76823b5 Fix floatBitsToInt family of intrinsics and add tests.
floatBitsToUint was missing from our intrinsic list entirely, and
u?intBitsToFloat were misspelled.

These intrinsics aren't implemented in SPIR-V or Metal either, but that
will be handled in followup CLs.

Change-Id: Iaf9b9d5a2e46e25d41eef71903fad8bd1c177d4e
Bug: skia:11071
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/342757
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-12-10 15:33:48 +00:00
John Stiles
01957273e7 Add SPIR-V support for modf intrinsic.
Change-Id: I887e700a7bf11bf2d5359c9721798f72f00e53f3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/342756
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-12-10 14:21:18 +00:00
John Stiles
3679cd1151 Add support for isinf/isnan intrinsics to SPIR-V.
Change-Id: I674d758c11071582e9fbedcda5596c540bfb5f71
Bug: skia:11054
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/342558
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-12-09 22:11:27 +00:00
John Stiles
5f675be193 Add tests for SkSL intrinsic functions.
This does not give us 100% coverage of intrinsics yet, but it is a
pretty good start.

Change-Id: I97d49324db1afd9f2975c2eeafbacdead710d4aa
Bug: skia:11054
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/341977
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2020-12-09 22:02:17 +00:00