Commit Graph

12 Commits

Author SHA1 Message Date
John Stiles
88a4107967 Add unit tests for global-struct initialization in Metal.
Previously, we had no unit test coverage for the Metal `struct Globals`
object. This CL adds simple tests for numeric globals and samplers.

Change-Id: I259c3cf416d5a1a03b1f815cc4c03891d60cbd08
Bug: skia:10382
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/300616
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2020-07-06 14:55:42 +00:00
John Stiles
1bdafbf016 Reland "Improve matrix construction abilities in Metal codegen."
This is a reland of daa573eb91

Original change's description:
> Improve matrix construction abilities in Metal codegen.
>
> GLSL (and thus SkSL) is flexible about the input parameters to a matrix
> constructor. You can mix vectors and scalars freely, and it will
> populate them into your matrix as if it was a flat list of scalars.
>
> Metal does not natively support this, and requires the proper number of
> floatNs to be passed in. However, the Metal code generator will now emit
> constructor helper functions that will fix this up automatically.
>
> Additionally, this CL simplifies the Metal codegen for single-scalar
> matrix construction. This should create a matrix with the passed-in
> scalar running along the matrix diagonal. The Metal codegen previously
> emitted a helper function to do this work on our behalf. However,
> that's not necessary; Metal already contains a single-argument matrix
> constructor that will do this work automatically for us.
>
> Change-Id: I76901bfe167502797aa4cb98d0e8986d9ebc51e5
> Bug: skia:10280
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/292477
> Auto-Submit: John Stiles <johnstiles@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>
> Reviewed-by: Ethan Nicholas <ethannicholas@google.com>

Bug: skia:10280
Change-Id: If5591392bb96e1cfb643d4e3c19a0ee4affec58d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/292689
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-05-28 22:20:10 +00:00
John Stiles
1fa15b1642 Revert "Improve matrix construction abilities in Metal codegen."
Doesn't build with `skia_compile_processors = true`

This reverts commit daa573eb91.

Reason for revert: <INSERT REASONING HERE>

Original change's description:
> Improve matrix construction abilities in Metal codegen.
> 
> GLSL (and thus SkSL) is flexible about the input parameters to a matrix
> constructor. You can mix vectors and scalars freely, and it will
> populate them into your matrix as if it was a flat list of scalars.
> 
> Metal does not natively support this, and requires the proper number of
> floatNs to be passed in. However, the Metal code generator will now emit
> constructor helper functions that will fix this up automatically.
> 
> Additionally, this CL simplifies the Metal codegen for single-scalar
> matrix construction. This should create a matrix with the passed-in
> scalar running along the matrix diagonal. The Metal codegen previously
> emitted a helper function to do this work on our behalf. However,
> that's not necessary; Metal already contains a single-argument matrix
> constructor that will do this work automatically for us.
> 
> Change-Id: I76901bfe167502797aa4cb98d0e8986d9ebc51e5
> Bug: skia:10280
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/292477
> Auto-Submit: John Stiles <johnstiles@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>
> Reviewed-by: Ethan Nicholas <ethannicholas@google.com>

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

Change-Id: I18610167e980eb1437842930deb9cc7509364f70
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:10280
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/292573
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2020-05-28 17:37:20 +00:00
John Stiles
daa573eb91 Improve matrix construction abilities in Metal codegen.
GLSL (and thus SkSL) is flexible about the input parameters to a matrix
constructor. You can mix vectors and scalars freely, and it will
populate them into your matrix as if it was a flat list of scalars.

Metal does not natively support this, and requires the proper number of
floatNs to be passed in. However, the Metal code generator will now emit
constructor helper functions that will fix this up automatically.

Additionally, this CL simplifies the Metal codegen for single-scalar
matrix construction. This should create a matrix with the passed-in
scalar running along the matrix diagonal. The Metal codegen previously
emitted a helper function to do this work on our behalf. However,
that's not necessary; Metal already contains a single-argument matrix
constructor that will do this work automatically for us.

Change-Id: I76901bfe167502797aa4cb98d0e8986d9ebc51e5
Bug: skia:10280
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/292477
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2020-05-28 17:03:21 +00:00
Mike Klein
c0bd9f9fe5 rewrite includes to not need so much -Ifoo
Current strategy: everything from the top

Things to look at first are the manual changes:

   - added tools/rewrite_includes.py
   - removed -Idirectives from BUILD.gn
   - various compile.sh simplifications
   - tweak tools/embed_resources.py
   - update gn/find_headers.py to write paths from the top
   - update gn/gn_to_bp.py SkUserConfig.h layout
     so that #include "include/config/SkUserConfig.h" always
     gets the header we want.

No-Presubmit: true
Change-Id: I73a4b181654e0e38d229bc456c0d0854bae3363e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209706
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Hal Canary <halcanary@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2019-04-24 16:27:11 +00:00
Ethan Nicholas
5476f2e9b8 added constant swizzle support for Metal
Bug: skia:
Change-Id: Ia7d81920ddc341aa40da6af534d846f3e805a109
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/192031
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2019-03-07 20:47:04 +00:00
Jim Van Verth
6bc650e9d7 Fix Metal bots.
Disables some invalid tests and re-enables others.
Fixes up a shader issue.

Bug: skia:8243
Change-Id: I03c3685c1f0bc55c435121d659e52115f114ca7f
Reviewed-on: https://skia-review.googlesource.com/c/190300
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2019-02-07 21:00:20 +00:00
Jim Van Verth
3d482995e5 Set correct uniform size for Metal.
There are two fixes here. The first pads out the uniform buffer to
match the alignment of the largest element in the buffer, as required
by Metal. The second ensures that the RTHeight uniform is only added
to the shader if required by the program inputs, as otherwise it wasn't
being included in the uniform data.

Bug: skia:8737
Change-Id: Icbe57456f3ec79faada231278c58137ca9865dd2
Reviewed-on: https://skia-review.googlesource.com/c/189875
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2019-02-07 16:17:24 +00:00
Ethan Nicholas
e1f5502969 Reland "SkSL is now pickier about type conversions"
This is a reland of 91c1d08bc3

Original change's description:
> SkSL is now pickier about type conversions
> 
> Bug: skia:
> Change-Id: I4e8b8f229f4e4344f160b0dbb41832764d0b75bd
> Reviewed-on: https://skia-review.googlesource.com/c/188311
> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>

Bug: skia:
Change-Id: I727cad061afc0a5ee6f4d2df789330d809dd110a
Reviewed-on: https://skia-review.googlesource.com/c/189643
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2019-02-06 02:40:59 +00:00
Ethan Nicholas
c83da98d50 Revert "SkSL is now pickier about type conversions"
This reverts commit 91c1d08bc3.

Reason for revert: breaking everything

Original change's description:
> SkSL is now pickier about type conversions
> 
> Bug: skia:
> Change-Id: I4e8b8f229f4e4344f160b0dbb41832764d0b75bd
> Reviewed-on: https://skia-review.googlesource.com/c/188311
> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>

TBR=bsalomon@google.com,csmartdalton@google.com,ethannicholas@google.com

Change-Id: I670fa9215d3ca0ce738edc24e832b6d968599cb1
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/c/189642
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2019-02-05 21:54:51 +00:00
Ethan Nicholas
91c1d08bc3 SkSL is now pickier about type conversions
Bug: skia:
Change-Id: I4e8b8f229f4e4344f160b0dbb41832764d0b75bd
Reviewed-on: https://skia-review.googlesource.com/c/188311
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2019-02-05 21:36:33 +00:00
Ethan Nicholas
842d31b141 fixed Metal matrix constructors
Bug: skia:8544
Change-Id: Ie1e96ab1ef6e8c032fa510be36c035f91a1f6851
Reviewed-on: https://skia-review.googlesource.com/c/185687
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2019-01-25 18:37:34 +00:00