This is a reland of commit ae5e846047
Original change's description:
> [graphite] Move Graphite into Skia base directories.
>
> Change-Id: Ie0fb74f3766a8b33387c145bd1151344c25808cb
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/528708
> Reviewed-by: Kevin Lubick <kjlubick@google.com>
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Jim Van Verth <jvanverth@google.com>
Change-Id: Ia575fd49206ad0b665a6a9153317e738bb321446
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/529059
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
* Wire up the WGSLCodeGenerator to SkSLCompiler.
* Wire up build rules to generate WGSL from unit tests.
* Include HelloWorld.sksl as the first complete program.
Bug: skia:13092
Change-Id: I283cf5971b6856126b9fc23340afacff5cc54697
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/526760
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Arman Uguray <armansito@google.com>
Bug: skia:12701
Change-Id: Iaac8b6fd0f2d9d1f8d5771f8204047a9127184c1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/528041
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
This reverts commit 6bc4bdf645.
Reason for revert: Android roll
Original change's description:
> [sksl] Make sksl tracing optional
>
> This removes the required dependency on our JSON code. In the Bazel
> rules, this dependency is pushed down into sksl instead of required
> by the cc_binary rules.
>
> It adds a stub version of SkVMDebugTrace.cpp and removes
> SkVMDebugTracePlayer unless the appropriate GN or Bazel flag
> is set (skia_enable_sksl_tracing and enable_sksl_tracing,
> respectively). There was an existing #define that CanvasKit
> used (CK_INCLUDE_SKSL_TRACE) and this was changed to
> SKSL_ENABLE_TRACING.
>
> Users of //:skia_core no longer need to specify a JSON dep,
> if sksl needs it (e.g. for tracing), then it will specify
> the dependency.
>
> Change-Id: I2fcd29cde118fc391c269ba2d8f8a40a6f164c99
> Bug: skia:12541
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/528837
> Reviewed-by: John Stiles <johnstiles@google.com>
> Commit-Queue: Kevin Lubick <kjlubick@google.com>
Bug: skia:12541
Change-Id: Icf75495f19e409d96925ca4dca9e839eca4057ec
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/529129
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
This reverts commit 02986aed2a.
Reason for revert: Android roll
Original change's description:
> [bazel] Unify boolean flags to be enable*
>
> I think they read better when it is enable_foo. I have to
> do less double-negation in my head if they are set to false
> then.
>
> Change-Id: I53bc5575c11d489029904965d991abc5a9d0fd89
> Bug: skia:12541
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/528838
> Reviewed-by: Ben Wagner <bungeman@google.com>
Bug: skia:12541
Change-Id: I63f827c41ddc8a149cd190179ad099ff8671579a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/529128
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
I think they read better when it is enable_foo. I have to
do less double-negation in my head if they are set to false
then.
Change-Id: I53bc5575c11d489029904965d991abc5a9d0fd89
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/528838
Reviewed-by: Ben Wagner <bungeman@google.com>
This removes the required dependency on our JSON code. In the Bazel
rules, this dependency is pushed down into sksl instead of required
by the cc_binary rules.
It adds a stub version of SkVMDebugTrace.cpp and removes
SkVMDebugTracePlayer unless the appropriate GN or Bazel flag
is set (skia_enable_sksl_tracing and enable_sksl_tracing,
respectively). There was an existing #define that CanvasKit
used (CK_INCLUDE_SKSL_TRACE) and this was changed to
SKSL_ENABLE_TRACING.
Users of //:skia_core no longer need to specify a JSON dep,
if sksl needs it (e.g. for tracing), then it will specify
the dependency.
Change-Id: I2fcd29cde118fc391c269ba2d8f8a40a6f164c99
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/528837
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Bug: skia:12698
Change-Id: I326a4bc34fde675e9fc7ad7835558ce6f307d268
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/527842
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Previously, we used unscoped blocks for two similar functions:
- Rewrite one statement as two simpler statements:
`int a, b;` -> `int a; int b;`
- Group together multiple statements without braces. e.g. the inliner
uses unscoped Blocks to rearrange statements.
Conceptually, these are different from the debugger's perspective. The
compound statements should be treated as one unit; the grouped
statements should be treated individually (and the enclosing Block
should be ignored). A Block now contains a BlockKind enum to
distinguish between these cases.
Change-Id: Ie14a570bb46992689fb96b8fd3b67f2ca6e5239f
Bug: skia:13189
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/528655
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Change-Id: If3d7e222023efb957eba66adc1f9ca601c2ffd67
Bug: skia:13189
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/528916
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
This CL defines a const label string in GrSurfaceProxy and have the
constructors accept it. The label string is then plumbed through the
system for other components to accept it.
Bug: chromium:1164111
Change-Id: I5a7f7708707e3d486eb1f8931db4c49afba5a33b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/525236
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Pipeline stage inputs and outputs are not declared in global-scope but
rather as a parameter/return of the program entry point function. Thus
that references any one of these parameters must obtain them via a
function argument.
* All references to pipeline input/output variables are resolved as the
first codegen step. All functions that either reference or call a
function that directly or indirectly references such a variable gets
synthesized input/output parameters.
* Pipeline stage outputs are passed via pointer to allow mutation by
subroutines.
* If the main function requires the SK_MAINCOORDS_BUILTIN, we now make
sure that sk_FragCoords is declared, even if not directly referenced by
code.
Bug: skia:13092
Change-Id: Ie538566a074e8cc9ce8594946a56d311ac5e7270
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/526759
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Arman Uguray <armansito@google.com>
I tried fixing this before, but still had UB because I assigned
the value to the enum before checking the range. Check the range
before assigning the value to the enum.
Bug: oss-fuzz:46251
Change-Id: I7d58d67063896645d7a38453eab1c20b8489afaf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/528881
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Change-Id: Ie0fb74f3766a8b33387c145bd1151344c25808cb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/528708
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
It was decided that being able to report positions from C++ code is not
worth the cost of having all of these captures everywhere.
Change-Id: I94981d9f780bd95df8b56198210c9cdd5f16239c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/528366
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
This ports the GN skia_executable [1] and adds third_party
Bazel rules for spirv_cross, translated from [2]. spirv_cross,
unlike spirv_tools, did not have pre-made Bazel rules.
This binary compiles and links with
bazelisk build //tools/skslc --config=clang
[1] ad324a31e6/BUILD.gn (L712)
[2] ad324a31e6/third_party/spirv-cross/BUILD.gn (L10)
Change-Id: I4abd51889552153fc7e64a5f7f3d9f0f597524e7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/528044
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
`writeComposite` can write and deduplicate constants, so it's preferable
to manually emitting an OpCompositeConstruct opcode.
Change-Id: I0c4ac8f8a456c8561c0b6a90cd316934f20895e8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/528638
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
`writeComposite` can write and deduplicate constants, so it's preferable
to manually emitting an OpCompositeConstruct opcode.
Change-Id: Ie5c23af76822da762eadac8ff0ab0c6cc0febd31
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/528637
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Some GPUs (Adrenos in particular) perform noticeably better when we
use OpConstantComposite instead of OpCompositeConstruct. This also gives
us some deduplication of redundant ops.
Change-Id: I53b7a3e1cf61e51647a661a08ff4c7b53ee60f10
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/528636
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Change-Id: I484067cb1f6025dc9e6770c51c99bfc2c5925652
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/528365
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
This adopts a trick from SkVM to avoid sorting entirely.
Change-Id: I586c8a3613b48241842a7d8eba1c9d68a4717f83
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/528368
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Change-Id: I238d29ba0250224fa593845ae65192653f58faff
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/528156
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Blocks did not previously track their position, creating problems
reporting some errors (which will be improved in followup CLs). Fixing
block positions changed the reporting of do loop errors, requiring do
loop position tracking to be updated as part of this change.
Change-Id: I3bd048a62d912914edf679f42607de1b5eafc2b9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/528045
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Includes a manual roll of Dawn, as well as tweaks to the Tint build
overrides.
Dawn needs git in order to generate a header that has the
version of Dawn compiled in. If we use Dawn's GN rules to
build it, we need git to generate that file.
Our (now updated) Bazel rules to build Dawn do not need to
do this because we (Skia) do not use this file [1]
[1] https://dawn.googlesource.com/dawn/+/088a600b03679cd20991f145173a573ed9c03480/src/dawn/common/BUILD.gn#177
Change-Id: Id19fdbb9b53fdad2397a0044a4a314b1444faeb0
Cq-Include-Trybots: luci.skia.skia.primary:Build-Debian10-Clang-x86_64-Debug-Dawn,Build-Win-Clang-x86_64-Release-Dawn
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/528157
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Caveat: on my machine, Nanobench doesn't detect any change (pro or con)
on this CL.
I'm working under the assumption that function calls have a non-zero
cost--they may be inlined (bloating code size), or not (incurring the
costs of a function call, register push/popping, etc). This CL avoids
making six calls to $blend_set_color_saturation by using two half3
variables. These half3s are used to swizzle the result--they contain two
zeros and a one, so multiplying them by a scalar will put the result in
the desired component. I've also made some very minor simplifications to
the math that were made possible by reordering.
Change-Id: I0c1ef88d165365376078846324be8bb723548512
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/528043
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
This is a reland of commit 6f0d2bf494
Includes a fix for iOS codesigning script to be python3 compatible.
Original change's description:
> Set GN's script_executable to "python3"
>
> In some environments, GN would end up running scripts with python2.
> This change requires that python3 be in the path, but is the safest
> way to guarantee that all scripts are run correctly.
>
> Change-Id: Ifc2601ff9c9f3705ac7f1057a26a87a61211ff67
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/528337
> Reviewed-by: Kevin Lubick <kjlubick@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>
Change-Id: I785909f3c7d51d6fd1c90114d01f114be76981f2
Cq-Include-Trybots: luci.skia.skia.primary:Build-Mac-Clang-arm64-Debug-iOS
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/528441
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Change-Id: I337aebf72715339ec0280bab0916968ccbe7f481
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/528516
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Auto-Submit: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
A ternary of the form `anything ? value : value` can be reduced to a
comma-expression of the form `anything, value`. This seems like a rare
case in real code, but it's easy enough to detect with our existing
toolbox.
The `anything` test-expression will be eliminated from the expression
if it has no side effects, using our existing constant-folding rules
for the comma expression.
Change-Id: I1285b04cd6a08f1bed614aa1aa6f37ea2447de91
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/528439
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Previously, when we vectorized scalars, we would not place them in the
constant buffer, so we could emit simple vectors like (0,0,0) or (1,1,1)
more than once. Now, we use `writeConstructorSplat` to vectorize, which
knows how to write constants.
Change-Id: Ic97c0ce5415fd46ff8c7fb7dac9205844633ef3a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/527921
Reviewed-by: Arman Uguray <armansito@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Found with `MSAN_OPTIONS=poison_in_dtor=1`. Avoid using fields after
`this` has been destroyed.
Change-Id: I3a772ca053c03520268a7e0328402365b5592c40
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/528438
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
GCC warnings caused by missing integer cast from enum class in format
specifier have been fixed.
Original change's description:
> [sksl][wgsl] Implement codegen for simplest complete program
>
> - Implemented much of the statement/expression/program-element
> parsing/dispatch boilerplate with support for only those expressions
> that are necessary to successfully compile shared/HelloWorld.sksl
>
> - Implemented functions and fragment/vertex program entry points
>
> Most of the code for HelloWorld.sksl is now generated, however the
> output program is still missing a correct propagation of varying stage
> inputs and output parameters to subroutines.
>
> Bug: skia:13092
> Change-Id: Ic51af5a041761f58234d45e3746206ed080e0910
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/526758
> Reviewed-by: John Stiles <johnstiles@google.com>
> Commit-Queue: Arman Uguray <armansito@google.com>
Bug: skia:13092
Change-Id: I414f0e8b9bd95bd1a74a9a9eb5ae08fbac13fcae
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/528436
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Arman Uguray <armansito@google.com>
Change-Id: I76a01cf18583fab619459f258119b780ff978be5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/527840
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>