https://clang.llvm.org/extra/clang-tidy/checks/bugprone-suspicious-string-compare.html
Find suspicious usage of runtime string comparison functions.
This check is valid in C and C++.
Checks for calls with implicit comparator and proposed to
explicitly add it:
if (strcmp(...)) // Implicitly compare to zero
if (!strcmp(...)) // Won't warn
if (strcmp(...) != 0) // Won't warn
Checks that compare function results (i,e, strcmp) are compared to valid
constant. The resulting value is
< 0 when lower than,
> 0 when greater than,
== 0 when equals.
A common mistake is to compare the result to 1 or -1:
if (strcmp(...) == -1) // Incorrect usage of the returned value.
Additionally, the check warns if the results value is implicitly cast
to a suspicious non-integer type. It’s happening when the returned
value is used in a wrong context:
if (strcmp(...) < 0.) // Incorrect usage of the returned value.
Change-Id: I001b88d06cc4f3eb5846103885be675f9b78e126
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/310761
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Previously, the inner type was ignored.
Change-Id: I51d251fc38358ef889b5a3f85d5f2d23bd8cf4c5
Bug: skia:10615
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/310657
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
These tests verify that switches and enums only work with constant
integral values. Floats or uniforms should be rejected with an easy-to-
understand error message.
Change-Id: Ib634cb1ca1734a4b66ba53a3476e9ee539a63e3e
Bug: oss-fuzz:24889, skia:10615
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/310396
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
It's possible to construct a case value expression that's a compile time
constant, but fails to produce a value from getConstantInt. MSAN noticed
us using the uninitialized integer. It's now initialized, but also never
used in the failure case: We make getConstantInt return status, and give
better error messages in the two places it's used.
Bug: oss-fuzz:24889
Change-Id: I88e4e5b7bd1caeea1cf53f9b1d6f345dd8a5326f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/310296
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Auto-Submit: Brian Osman <brianosman@google.com>
Inlined return statements emit two statements--an assignment, then a
break. If scope braces are otherwise missing, the break statement will
end up in the wrong place. i.e.:
Mistranslated:
if (foo) return bar; --> if (foo) out = bar; break;
Translated properly:
if (foo) return bar; --> if (foo) { out = bar; break; }
Change-Id: Id992abf64ad09e6752f64c71cb556f05c868a453
Bug: skia:10607
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/310177
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-override.html
Adds override (introduced in C++11) to overridden virtual functions and
removes virtual from those functions as it is not required.
virtual on non base class implementations was used to help indicate to
the user that a function was virtual. C++ compilers did not use the
presence of this to signify an overridden function.
Change-Id: If66d8919358f72a4035190caf8d7569268037a9a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/310160
Commit-Queue: Mike Klein <mtklein@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
The new unit test SkASSERT()s a hash collision at head
(but passes in release builds) and does not SkASSERT()
with this patch to SkColorSpace.cpp.
Bug: chromium:1113865
Change-Id: Ibc05af4145a92bbd15c7d5e06ece9d269bd7a242
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/310110
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
We do not have a good mechanism to break out of a nested for/while loop
or switch statement. Our inlining approach generates incorrect code in
those cases, and there's no apparent fix, since we don't have a
mechanism for subverting control flow like 'goto'. When we detect this
case, disable inlining for that function.
Change-Id: Ic4180b367a3895806b0cc36872155185138826e1
Bug: skia:10606
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/310063
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Prior to this CL, if we failed to create the DDL Recorder's target
proxy while creating the target surface we could create an invalid
DDL.
The specific repro case involved too big of an target proxy but
many other scenarios could result in the same behavior.
Bug: 1105903
Change-Id: I519a072600c168aa590fbe920f4029d08fe29e6f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309777
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Bug: skia:10369
Add SkEncodeImageWithNDK, mirroring the CG and WIC versions, for
encoding with the NDK APIs added to R.
Rename SK_ENABLE_NDK_DECODING to SK_ENABLE_NDK_IMAGES and use it for
both encoding and decoding.
Move code for converting to/from NDK types into a common location.
Update encode_platform.cpp to use NDK encoding APIs when available and
to use both types of webp (lossy and lossless). Add tests specifically
for the new implementation.
Update NdkDecodeTest to use ToolUtils::equal_pixels for comparing
pixels.
Change-Id: Ic62f89af27372ccce90b8e028e01c388a135a68c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308800
Commit-Queue: Leon Scroggins <scroggo@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
`onXxxxx` methods in Skia generally appear to be non-public, which I did
not realize until after originally implementing this task.
Followup CLs will update the non-gencode `onDumpInfo` methods to be
private as well.
Change-Id: I807eee132b080f72f6b040e1ca7f687be25dff11
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309883
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
This CL also marks `GrProcessor::dumpInfo` as final. This prevents a
subclass from mistakenly overriding `dumpInfo` instead of `onDumpInfo`.
`onDumpInfo` is responsible for providing the same data as `dumpInfo`,
except that the FP name is automatically prepended.
Change-Id: I2b44c30a01bc65e9d88321cc21651a94e20074c6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309793
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
and
"Guard gencode dumpInfo() calls with GR_TEST_UTILS, instead of SK_DEBUG"
and
"Remove dumpInfo() entirely when GR_TEST_UTILS is off."
This is a reland of 26900788ef
and b5e8a2533a
and d7b09c4c3a
and unit tests are now fixed.
Original change's description:
> Guard dumpInfo() calls with GR_TEST_UTILS, instead of SK_DEBUG.
>
> (One exception: the `dumpInfo` in GrVkCommandPool is wrapped with
> SK_TRACE_MANAGED_RESOURCES to match its peers in GrVkManagedResource.)
>
> Change-Id: I6cf55fa2bb5687f79a2cc0c2a9c02a629bfd4f8e
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309556
> Commit-Queue: John Stiles <johnstiles@google.com>
> Auto-Submit: John Stiles <johnstiles@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>
Change-Id: I16e6606082a814b4fa5ef58d1096fc915f5ac704
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309721
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Forgot to add these when I fixed the bug. Verified that these tests
failed without the fix.
Bug: skia:10593
Change-Id: Ia20fad3cd8e5b0f63ca19946b8314eed49bec2bf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309716
Auto-Submit: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
I created this problem with my fix to crbug.com/1108475
Bug: 1112259
Change-Id: Ieb001fa61bd9ed68dcae43e7d511b4581f16ef0f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308638
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
These radii are treacherous.
Added a regression test derived from the path found by the fuzzer.
Bug: chromium:1111169
Change-Id: I92fde0c31057ea8adc864336438c0af2869b0374
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309306
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Reed <reed@google.com>
SkRRect::computeType() can fail to produce an isValid() SkRRect,
with the regression test added here.
We can...
- land something like this that forces a good rect value,
- drop the assert,
- or maybe explore deeper and fix this?
Change-Id: I6d7402a0a4af2141ce45e82d287bfb4806aeb0ec
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309379
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
This is a reland of a1df23c8b7
Original change's description:
> Implement `dumpInfo` for .fp files.
>
> Change-Id: I40f6c1a02e194f090e67a0e3f2d7d83cd2317efd
> Bug: skia:8434
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309139
> Commit-Queue: Brian Osman <brianosman@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>
> Auto-Submit: John Stiles <johnstiles@google.com>
Bug: skia:8434
Change-Id: If485635440b800f8a282c871a1c5f2801608d3c7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309660
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>
This reverts commit a1df23c8b7.
Reason for revert: Needs c++17 library as written
Original change's description:
> Implement `dumpInfo` for .fp files.
>
> Change-Id: I40f6c1a02e194f090e67a0e3f2d7d83cd2317efd
> Bug: skia:8434
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309139
> Commit-Queue: Brian Osman <brianosman@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>
> Auto-Submit: John Stiles <johnstiles@google.com>
TBR=brianosman@google.com,johnstiles@google.com
Change-Id: I09b98e83735bc30ec8a2e313e4b76a9eb6a7631a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:8434
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309656
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Change-Id: I40f6c1a02e194f090e67a0e3f2d7d83cd2317efd
Bug: skia:8434
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309139
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
These doubles are sometimes used as doubles and sometimes floats,
but it doesn't make sense to use values that can't be a float as one.
Just skip those in the test combinatorics.
Change-Id: Ibfdb699cac80b260258b164f95361110eb85c152
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309483
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
These should work fine through SkVMBlitter,
and I'm not really sure why we didn't add them
to SkRasterPipeline.
Bug: chromium:1113777
Change-Id: Id89f82e6a53bd49d88a9562309acf0ab53ea5ec5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309472
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Profiling showed that repeated calls to `input_texel_color` were
actually a very expensive part of the test. Fortunately, we can expose
the texture's pixel buffer to the unit test method and easily reclaim
that performance.
Change-Id: I2c1cdd57a3e14dc859bdf03d8131137ca81364ff
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309437
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>
The fuzzer has a found a pathological case where the maxRadius
needs to be reduce by 17 ulps.
Reduce the larger radius an ulp at a time until the sum fits.
Change-Id: I9cc4528667e7f9e902eff34d447fd4040a09742e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309417
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
This is a net reduction in code size because this idea was already
implemented separately in two places:
- dump_fragment_processor_tree (GrProcessorSet)
- describe_fp (ProcessorTest)
This consolidates the implementations. This CL also fixes a handful of
dumpInfo() methods that were not sufficiently descriptive--e.g. the FP
name was missing, or the implementation was just buggy.
Change-Id: If34ac46c97e9ae431c7c64b1247fc619703580b2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309324
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
This reverts commit d169e1915c.
Reason for revert: broke chrome via code generator
Original change's description:
> Migrate GrSurfaceContext readPixels to take direct context
>
> After this lands we'll proceed up the stack and add the direct
> context requirement to the public API and SkImage.
>
> Bug: skia:104662
> Change-Id: I4b2d779a7fcd65eec68e631757821ac8e136ddba
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309044
> Commit-Queue: Adlai Holler <adlai@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>
TBR=robertphillips@google.com,adlai@google.com
Change-Id: I6126f2dca4bc902c903512ac486e22841cc472e5
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:104662
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309281
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Adlai Holler <adlai@google.com>
Runtime effects previously allowed two kinds of global input variables:
'in' variables could be bool, int, or float. 'uniform' could be float,
vector, or matrix. Uniform variables worked like you'd expect, but 'in'
variables were baked into the program statically. There was a large
amount of machinery to make this work, and it meant that 'in' variables
needed to have values before we could make decisions about program
caching, and before we could catch some errors. It was also essentially
syntactic sugar over the client just inserting the value into their SkSL
as a string. Finally: No one was using the feature.
To simplify the mental model, and make the API much more predictable,
this CL removes 'in' variables entirely. We no longer need to
"specialize" runtime effect programs, which means we can catch more
errors up front (those not detected until optimization). All of the API
that referred to "inputs" (the previous term that unified 'in' and
'uniform') now just refers to "uniforms".
Bug: skia:10593
Change-Id: I971f620d868b259e652b3114f0b497c2620f4b0c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309050
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
After this lands we'll proceed up the stack and add the direct
context requirement to the public API and SkImage.
Bug: skia:104662
Change-Id: I4b2d779a7fcd65eec68e631757821ac8e136ddba
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309044
Commit-Queue: Adlai Holler <adlai@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
This is causing failures on the status dashboard.
Change-Id: I29e8fb5bef72282dbe6fafb5402607ed48aae707
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309136
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Opted the Galaxy S20 out of the test to allow Tryjobs to pass.
Change-Id: I8d4637a23f36edb012c96b7059b184c231c0436d
Bug: skia:10384, skia:10595
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309119
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Previously, MakeChildFP avoided infinite recursion by rejecting any FP
that took inputs. MakeChildFP now generates random inputs up to a
user-supplied tree depth.
The ProcessorOptimizationValidationTest test has been updated to
test up to a tree depth of 3. The ProcessorCloneTest has been left at
a tree depth of 1 due to a bug that only appears on Galaxy S20/Mali G77.
The Mali bug doesn't appear to be related to FP cloning, but probably
deserves further analysis. (It appears that on this device, these
processors hooked together in sequence render a tiny bit differently
each time: DitherEffect -> RectBlurEffect -> ImprovedPerlinNoise. By
visual inspection it looks like the dither varies on each draw.)
Change-Id: Ib8f619eb7a8a9c9254080303504c20065ff35453
Bug: skia:10384, skia:10595
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308556
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Previously, this test would synthesize a random FP, call clone(), render
both, and the compare the results and report differences.
Now, if a difference is discovered, this test will re-synthesize the
originally-created random FP from scratch without using clone().
Instead, we call TestCreate again using the same random seed.
Then we can render and compare that output against the original as well.
This will allow to better differentiate failures that were actually
caused by clone(), versus failures caused by other types of
inconsistency.
If the regenerated version still mismatches, there are a variety of
potential explanations:
- the FP's TestCreate() does not always generate the same FP from a
given seed
- the FP's Make() does not always generate the same FP when given the
same inputs
- the FP itself generates inconsistent pixels (shader UB?)
- the driver has a bug
Change-Id: I71701c0f3d33a08f6ee926313782620487d336bd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309076
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
https://clang.llvm.org/extra/clang-tidy/checks/performance-unnecessary-copy-initialization.html
Finds local variable declarations that are initialized using the copy
constructor of a non-trivially-copyable type but it would suffice to
obtain a const reference.
The check is only applied if it is safe to replace the copy by a const
reference. This is the case when the variable is const qualified or when
it is only used as a const, i.e. only const methods or operators are
invoked on it, or it is used as const reference or value argument in
constructors or function calls.
Change-Id: I1261410deccd8ea64e85edec53fbd5360940e587
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308759
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Follow-on CLs will push higher up in SkDraw, so that everywhere today
we have to cons-up (with the associated mallocs) a temp SkPath we can
replace it with a stack-based SPath...
- drawRect
- drawOval
- drawRRect
- drawLine(s)
(similar to how this CL already handled quads and triangles)
Bug: skia:10566
Change-Id: I882b4f4c60e80235ca83c86c926e905b269a7afd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/307784
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Reed <reed@google.com>
SkArenaAlloc has three fields that are used only for reset. Make a
subclass called SkArenaAllocWithReset which has the three
fields, and has the reset functionality.
An example of a reset() that is used instead of using a better scope
is PathOpsAngleAfter in PathOpsAngleTest.cpp.
Change-Id: Ie1965d128dfb7df9e022f4d18460d3f75f33e1a6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/307348
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Herb Derby <herb@google.com>
https://clang.llvm.org/extra/clang-tidy/checks/readability-const-return-type.html
`const` on a non-pointer/reference return type typically doesn't add
value and can have negative side effects. (i.e., returning a
`const std::string` isn't meaningfully different from returning a
`std::string`, but can sometimes inhibit move-related optimizations.)
In Skia's case, the priv() functions are a notable exception where const
return types are intentional and valuable. These calls have been marked
with NOLINT to exclude them from the check.
This check does not affect pointer and reference returns, where
constness is important.
Change-Id: I86cab92332f164e5ab710b4127182eec99831d7d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308564
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Discovered via ClangTidy `readability-static-accessed-through-instance`.
Change-Id: I646e3293853e65b5cc2419c8687c035aab4b669a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308659
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Unlike GLSL/SkSL, Metal does not natively support casting an array from
one size to another; we need to synthesize a helper function which will
assemble a new matrix from the values in the old matrix and the
identity.
Previously, our matrix-conversion helpers understood how to glom
together an arbitrary collection of scalars/vectors/matrices into a
matrix containing a matching number of scalars, but it would fail when
given a matrix of unequal size.
Change-Id: I35eb161ed7c17b982b00ecceb7b525cbfb8f3bcb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308190
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
This fixes a large number of SkSL namespaces which were labeled as if
they were anonymous, and also a handful of other mislabeled namespaces.
Missing namespace-end comments have been added throughout.
A number of diffs are just indentation-related (adjusting 1- or 3-
space indents to 2-space).
Change-Id: I6c62052a0d3aea4ae12ca07e0c2a8587b2fce4ec
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308503
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
We were only respecting this feature in runtime shaders. Note that use
of any tagged matrices will cause color filter creation to fail, but
color transformation is a totally sensible thing to want in a color
filter.
Change-Id: I482226b287ab794cb341367fce453381cb581966
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308507
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Some of these checks are currently redundant (we don't allow color
filters to have children right now). But the next CL will re-add that
capability, and the unit tests here will ensure we don't re-break things
by allowing child-sampling to violate the color filter invariant.
Change-Id: I54c10d8b1d1e376c13347296765185d42b9f644a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308285
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Android migration landed in Android CL 12234077
Chrome migration is landing in Chrome CL 2335812
Note: makeFromCompressedTexture is not used by Chrome.
Bug: skia:104662
Change-Id: Ibbe6d412cf22e87188926383d10b21f780208e48
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305102
Commit-Queue: Adlai Holler <adlai@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Auto-Submit: Adlai Holler <adlai@google.com>
This function isn't used by Chrome so we migrate directly.
Flutter migration is at https://github.com/flutter/engine/pull/20235
Bug: skia:104662
Change-Id: I9d875acdbd162f50a6d86b3a4cae3f400e4dd38f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305180
Commit-Queue: Adlai Holler <adlai@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Change-Id: I9ed98859814e462c63ab29b94f0365ccc57d2e9b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/307706
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Chris Dalton <csmartdalton@google.com>
This reverts commit 07438b0cda.
Bug: skia:10369
Bug: skia:10371
This will allow Skia clients developing for Android 11+ to rely on
Android's NDK APIs for decoding, which will allow them to decode
without including their own decoding libraries (e.g. libjpeg-turbo).
Using these APIs also provides support for static HEIF images.
Run ImageGenSrc in kPlatform_Mode on Android to verify decoding
visually.
Add tests and a grayscale png.
Update some test bots running Android R to specify ndk_api so they will
run the new code.
Change-Id: I4ca07d832dbd6a9d8cff0faea975fd70da00718f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308185
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
This reverts commit cfef980939.
Reason for revert: Breaking Google3 roll
Original change's description:
> Add an SkImageGenerator that uses NDK APIs
>
> Bug: skia:10369
> Bug: skia:10371
>
> This will allow Skia clients developing for Android 11+ to rely on
> Android's NDK APIs for decoding, which will allow them to decode
> without including their own decoding libraries (e.g. libjpeg-turbo).
> Using these APIs also provides support for static HEIF images.
>
> Run ImageGenSrc in kPlatform_Mode on Android to verify decoding
> visually.
>
> Add tests and a grayscale png.
>
> Update some test bots running Android R to specify ndk_api so they will
> run the new code.
>
> Change-Id: Ica782339b2414d472ede0b61729a127ce41892a5
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305689
> Reviewed-by: Mike Klein <mtklein@google.com>
> Commit-Queue: Leon Scroggins <scroggo@google.com>
TBR=djsollen@google.com,mtklein@google.com,scroggo@google.com,brianosman@google.com,reed@google.com
Change-Id: Ifed506a76a0ff5903d101c1bf7330d319b8376a6
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:10369
Bug: skia:10371
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308180
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
Bug: skia:10369
Bug: skia:10371
This will allow Skia clients developing for Android 11+ to rely on
Android's NDK APIs for decoding, which will allow them to decode
without including their own decoding libraries (e.g. libjpeg-turbo).
Using these APIs also provides support for static HEIF images.
Run ImageGenSrc in kPlatform_Mode on Android to verify decoding
visually.
Add tests and a grayscale png.
Update some test bots running Android R to specify ndk_api so they will
run the new code.
Change-Id: Ica782339b2414d472ede0b61729a127ce41892a5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305689
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
SkFontDescriptor and its serialization and usage are updated to better
reflect how variations should be serialized. In addition this begins
teasing apart SkFontData since it is now mostly an artifact of how the
FreeType port works than anything else.
This also removes SkTypeface::MakeFromFontData since it is no longer
used and since SkFontData (which it takes as a parameter) was never
public. SkFontMgr::makeFromFontData now only exists to support older
skps and may be removed in the future.
Change-Id: I266bd5e87de85788661cdf5c571592ea1f2ae669
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/307344
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
RRect needs 8 radii, 4 corners x XY, so should pass 8 values, not 4.
Change-Id: I997cbf2a61e6ffb32e4a13d5c95d16cb172152be
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/307789
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Change-Id: I68bb6bb239074d7cf657f56acf6c970771af62f8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/307717
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
This adds support for things like "foo.xxx1", which is equivalent to
"float4(foo, foo, foo, 1)".
Change-Id: Id52111917e30d7dd8ba2e0633074b64d7ac6c72a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/306727
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
The majority of existing call sites were automatically updated using
clang-tidy -fix. A small handful required a manual update,
e.g. CppCodeGen.
This check is a bit lenient, and in particular will not flag cases like
`std::unique_ptr<Base>(new Derived())` which is still pretty common
throughout our codebase. This CL does not attempt to replace all the
cases that ClangTidy does not flag.
Change-Id: I5eba48ef880e25d22de80f321a68c389ba769e36
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/307459
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Need to notify the underlying pathref if we've made oval or rrect
Bug: skia:9000
Change-Id: I57a801f1fb446b99634d7b028249a812a5a978f1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/307516
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
We only want SkSL to contain fp variables at global scope, and to sample
directly from references to those global variables. Anything else will
confuse our sample-usage analysis, and often leads to asserts in the CPP
or pipeline-stage generators.
Bug: skia:10514
Change-Id: Ie1ef10821c1b2a946a92d050fea45d95569bc934
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304599
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
The repro case for this bug is where we have ~700 non-AA texture ops
with a few coverage-AA texture ops sprinkled throughout. In the old
system this could result in the quad limits being exceeded bc the
AA type for the entire run was believed to be non-AA during the creation
phase only to find that it was actually coverage-AA at execution time.
This problem manifested in both the bulk creation method and the
1-by-1/chaining creation method.
Note: in the original repro case every texture op has its own separate
texture so the problem manifests in the chaining case.
Bug: 1108475
Change-Id: I8f08fa4d5db5dbfe4a28145737895b655a145b08
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/306605
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Change-Id: I82f9bffc73dcc4c07050199c755120cc964b7198
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304858
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
This speeds up compiler construction, because we no longer have to parse
and process a bunch of SkSL source code during startup.
Change-Id: I6d6bd9b5ce78b1661be691708ab84bf399c6df8b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305717
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
This will allow us to enable the ClangTidy check
performance-for-range-copy.
Change-Id: I11f152ffe458f5f353da8715ffd2fd47cf4e71a7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/306946
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Added vpinsrd to make it easy, and fixed a comment on vpinsrb's tests.
Nothing too tricky, just the naive implementations.
The hardest part was getting all the data to the right places.
No diffs!
Change-Id: Ie4c1f1e429abfa75ca80a93d108061287d5ace80
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/306872
Commit-Queue: Herb Derby <herb@google.com>
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Herb Derby <herb@google.com>
This noop refactor ports the lane-immediate idea to the 64-bit loads and
to 128-bit stores, and renames to simple load64, load128, store128.
The store128 part of this change is _slightly_ sneaky in that we pack
the argument pointer index and the lane both into int immz, but there's
plenty of space there: lane needs 1 bit, and the argument pointer index
needs maybe 3 or 4 max.
Change-Id: I3fa01bf31312b8a69c7e287d649470ba15a8ea40
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/306810
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
More recontexting for SkImage. Chrome flag in CL 2323135.
Flutter migration landed in https://github.com/flutter/engine/pull/19962
Bug: skia:104662
Change-Id: Id725eb130310639457ba90f378ecdb334dd5f3cd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/306182
Auto-Submit: Adlai Holler <adlai@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
This allows us to JIT functions taking one more argument.
Our x86 JIT was the weak link: LLVM handles arbitrary numbers
of arguments, and our aarch64 JIT handles up to seven already.
I plan to pass one more source varying sometimes, and in extremely
unusual cases it we could need six pointers:
1) uniforms
2) destination
3) 8-bit coverage plane
4) 8-bit multiply plane
5) 8-bit add plane
6) source varying
Those varyings 3-5 are all indexable off the coverage pointer 3) if we
know the dimensions, so I could be convinced that we should only pass
one there, making our maximum number of arguments four. I'll be looking
at that independently, but it doesn't hurt to have our capability to go
up to six either way.
Change-Id: Id7a5b88e382a95bb560633e95c5be273b7ea67d1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/306241
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
The 3 bits that represent rsp are used as a signaling mechanism to
choose between compact base + disp encoding and full base + disp +
scale*index encoding, one byte longer. If a base is encoded as rsp in
the MOD R/M byte, an SIB byte follows.
r12 shares its 3 bottom bits with rsp, so we need to treat it like rsp
when deciding whether or not we need an SIB byte. (As usual registers
r8-15's distinguishing upper bit is carried by a REX/VEX prefix.)
rsp is also treated as a special signal in the index field of the SIB
byte, meaning essentially scale=0, and as a result it's not possible to
use rsp as an index. It _is_ possible to use r12 as an index, with a
test added here. This worked without any code change. It seems the
index=rsp -> scale=0 signal is triggered by all four bits of the index
registger, including the X upper bit from REX/VEX.
I have found these charts useful:
https://wiki.osdev.org/X86-64_Instruction_Encoding#32.2F64-bit_addressing_2
Looking at those charts I noticed that rbp/r13 are also special cases,
so I'm eyeing them warily and will avoid using them for now.
Change-Id: Id78f826a39c060b03000eae7c50c642ef44d57db
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/306237
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Since subsetting may require rasterizing/resolving the generator, we may
also need access to the GrDirectContext. To simplify apis, rely on
makeSubset() for that.
Related: https://skia-review.googlesource.com/c/skia/+/305970
Change-Id: I1980e3c823fb6cf54f197c350942c2f82b03e20f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/306136
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Bug: chromium:1101491
Bug: b/161896447
Found using
git grep -wiEIl \ '(he)|(she)|(his)|(hers)|(him)|(her)|(guy)|(guys)'
Change-Id: I6b91853de067fd4c2e84f7ec70275522ce6c8bfc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/306186
Commit-Queue: Leon Scroggins <scroggo@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Auto-Submit: Leon Scroggins <scroggo@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
They have been replaced with equivalent constants (and given the
requisite k prefix).
Change-Id: I70907eec234e0861cc97aac1ca03086faca42f9a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/306160
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
No longer needed as GrSurface and GrRenderTarget are private.
Change-Id: I2ec653b2d9daa115233bb7eaa1f2b7f880772c0a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305730
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Bug: chromium:1101491
Bug: b/161896447
Switch to more inclusive language, like "main", or remove where
simply unnecessary.
Change-Id: I36ef6ec631eb991f54f42b98887333f07c0984c2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/306060
Commit-Queue: Leon Scroggins <scroggo@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
It's hard to imagine a scenario where it makes sense to recompile a
shader for every possible point or rect.
Change-Id: Ic4ca9a4826c4ae4b604705549170503c8ec580a6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/306075
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Previously, floats would be converted to int32 using a C-style cast when
added to a processor key, truncating any fractional component of the
value. This would cause two processors compiled with different floats to
generate the same key.
The float is now sk_bit_cast to a uint32 instead; this will preserve the
uniqueness of all values.
Additionally, the CPP generator will now abort if asked to add an
unsupported type to the processor key. Previously, it would do a C-style
cast to int32 for all unrecognized types and hope for the best.
Change-Id: I270ae8b3036497a9e9a77747255f763d9aad1927
Bug: skia:10486
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305572
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
This should be the last batch of tests. All the remaining uses of
GrContext should be resolved when SkImage no longer requires a context.
Change-Id: I47eeb3b74c28f483c20d9bec4daecbdb6d2cb982
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305541
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
We seed the builder with the imageinfo of an image, but after it is
built we then have to "attach" it to an image (or more than one).
Check that the mip chain is compatible with the parent image we are
attaching to.
Change-Id: Iead6aee54861fdd4910f38f89a0364ed80c341d8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305680
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Fixes a bug with name conflicts in the final SkSL.
Bug: skia:10526
Change-Id: Ic238f89dd778c186e775ecbaabfbaed9e426274f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305563
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Change-Id: Iaa0829d72d0da1469df2da23102ff0e3572b641b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305556
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
This existed because GrTexture used to be public.
Change-Id: I5e507084ae12058a20481b517b9130b41c793d29
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305521
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
* Combine find and makeMRU.
* Switch from SkMutex to SkSpinLock
In the gm 'paragraph_$' this reduces acquiring the lock from 1.2% to 0.7%
as measured by instruments and nanobench.
Change-Id: I33e3af31825f175c9de42f001acf68ffe3623a8a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305564
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
GrTAllocator implies relatively limited use cases, while GrTBlockLinkedList
helps clarify the underlying data structure (and its associated advantages
and disadvantages). I am not beholden to the name, so am happy to have
a discussion on alternatives like GrTLinkedList or GrTBlockList or
GrTBlockArray.
Change-Id: I5b10801d8593991d5e804c4074a81efb1dd110ee
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304396
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Only works on raster backend for the now.
Bug: skia:10344
Change-Id: I2c82d5345ae83a2bb2744ab27e3d971c57ea989e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303271
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Did some cleanup to remove repetition that was distracting from the
thing being tested.
Change-Id: Ie385c6ec2d1325a1bd0ba5c2270e7f2ddd1d24b2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305076
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: Brian Osman <brianosman@google.com>
vpermps (added here) makes this very easy,
with an index controlling what 32-bit values go where.
A index of the form {0,2,4,6|?,?,?,?} will put the 4 low 32-bit halves
of 4 64-bit values in lanes 0,1,2,3. We can use that twice to get all 8
low halves, then our new vperm2f128 to put them together. Conveniently
vpermps can also load directly from memory:
vpermps (%rdi), {0,2,4,6|?,?,?,?}, lo
vpermps 32(%rdi), {0,2,4,6|?,?,?,?}, hi
vperm2f128 0x20, lo,hi, dst
We don't care what those top four indices are for load64_lo, so we'll
use them as the indices for load64_hi. That makes the full index
{0,2,4,6|1,3,5,7}, and load64_hi will just vpermf128 the other 128-bits
of lo/hi:
vpermps (%rdi), {?,?,?,?|1,3,5,7}, lo
vpermps 32(%rdi), {?,?,?,?|1,3,5,7}, hi
vperm2f128 0x31, lo,hi, dst
vpermps needs its index in a register, so we use a temporary for that.
Our logical lo can alias dst, and hi can alias that index, so it's just
one extra temporary register in the end.
Change-Id: Ie6a4efbf12ddada45dd09c0f580fa7350cf3019e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305171
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Add some packing instructions to make it possible.
The gist is that we've got
r(x) = {a,b,c,d|e,f,g,h}
r(y) = {i,j,k,l|m,n,o,p}
where r(x) holds each low 32-bit half of a 64-bit value,
and r(y) holds the high halves. We want to write
a,i,b,j,c,k,d,l,e,m,...
So first the vpunpck[lh]dq instructions produce
L = {a,i,b,j|e,m,f,n}
H = {c,k,d,l|g,o,h,p}
which gets us halfway there. The vperm2f128s select the low (0x20) or
high (0x31) 128-bit halves of L/H, so we end up writing to memory
dst+0: a,i,b,j,c,k,d,l
dst+32: e,m,f,n,g,o,h,p
Existing tests cover that store64 works.
Change-Id: Ic00ad9bdb448b79867584c27cf0114a42ed32379
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305156
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Does not add kNearest as a mip map mode yet.
Bug: skia:10344
Change-Id: Ida80cbf19e2b1eed5209d0680837fb45e54b4261
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303481
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Change-Id: Ic44e24057b95bb014504f02a736fb4341afc8971
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304856
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Change-Id: I82276e38ea4a5524127176eb5a34066b6cb06d88
Bug: skia:10217
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304799
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
This reverts commit 423dd689df.
Reason for revert: had missed corner case when tail block was empty
Original change's description:
> Revert "Support moving blocks from one allocator to another"
>
> This reverts commit 0f064041bf.
>
> Reason for revert: unit test failures on some windows bots
>
> Original change's description:
> > Support moving blocks from one allocator to another
> >
> > Uses this new capability and the previously implemented reserve()
> > feature to implement efficient concatenation of GrTAllocators.
> >
> > Change-Id: I2aff42eaf75e74e3b595d3069b6a271fa7329465
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303665
> > Commit-Queue: Michael Ludwig <michaelludwig@google.com>
> > Reviewed-by: Robert Phillips <robertphillips@google.com>
>
> TBR=robertphillips@google.com,csmartdalton@google.com,michaelludwig@google.com
>
> Change-Id: I931f2462ecf6e04d40a671336d0de7d80efd313d
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304604
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>
> Commit-Queue: Michael Ludwig <michaelludwig@google.com>
TBR=robertphillips@google.com,csmartdalton@google.com,michaelludwig@google.com
# Not skipping CQ checks because this is a reland.
Change-Id: Ia793c2f0e7ab2f3fd437871fa7fb4f56979f9ceb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304739
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Change-Id: Ic7799b3c5f4294cba9ff72f8c11a2ad285ab189f
Bug: skia:10217
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304738
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Change-Id: Ia92dc2be9a25f334bdbc098564cf2332496677fa
Bug: skia:10217
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304296
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Three TODOs, all basically the same idea: divide-by-zero is not the only
way to produce non-finite results from a division. You can also divide
by very-near-zero, and maybe some other ways.
Added is_finite() to make this clear. is_finite() is almost as cheap as
the comparisons it replaces, so performance shouldn't be affected.
Change-Id: I0a803e9ab4e3286f4e10a13d3aacee370eaaa803
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304669
Commit-Queue: Mike Klein <mtklein@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Also mipMapped params to GrBackendTexture functions to mipmapped
GrBackendTexture::hasMipMaps -> GrBackendTexture::hasMipmaps
Misc test vars fMipMapped -> fMipmapped
Change-Id: Ic0651d14fc106c21b0ab45529875b95ed8dc2dfd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304598
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
This reverts commit 0f064041bf.
Reason for revert: unit test failures on some windows bots
Original change's description:
> Support moving blocks from one allocator to another
>
> Uses this new capability and the previously implemented reserve()
> feature to implement efficient concatenation of GrTAllocators.
>
> Change-Id: I2aff42eaf75e74e3b595d3069b6a271fa7329465
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303665
> Commit-Queue: Michael Ludwig <michaelludwig@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>
TBR=robertphillips@google.com,csmartdalton@google.com,michaelludwig@google.com
Change-Id: I931f2462ecf6e04d40a671336d0de7d80efd313d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304604
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
For consistency with other enums and public APIs.
Change-Id: I026da5529f11051693cae5691c7ad92fad5ed446
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304597
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Uses this new capability and the previously implemented reserve()
feature to implement efficient concatenation of GrTAllocators.
Change-Id: I2aff42eaf75e74e3b595d3069b6a271fa7329465
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303665
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Change-Id: Ia2cfbca8982b57399b6681cbb4501c2933ab4df7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304576
Auto-Submit: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
This can optimize cases in a allocate-release loop that moves back
and forth across the end of one block and the start of another. Before
this would malloc a new block and then delete it.
It also enables reserve() in higher-level data collections w/o blocking
bytes left in the current tail block.
Change-Id: Ide16e9038384fcb188164fc9620a8295f6880b9f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303268
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Previously, these would produce a "valid" effect object, but it wouldn't
draw anything.
Bug: oss-fuzz:24070
Change-Id: I17d0ed1710196853da0694cac9f4c260312700a9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304064
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
The current algorithm runs an exponentially-increasing number of trials
based on the number of children supported by the fragment processor and
has become a large drag on test times. This version runs a fixed number
of trials to determine which optimization bits are able to appear, and
then continues running trials until each potential optimization has been
demonstrated successfully five times.
The algorithm doesn't attempt to check interactions between the various
optimization bits (e.g. a hypothetical bug that might only occur when
two optimizations interact with one another) but hopefully the minimum
of 100 successful trials is enough to shake out most issues.
Change-Id: I4eba7ace84739027a5aea8f8f895b44c4532b816
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304059
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
To extract metadata and validate the shader, we've added several
iterations over all program elements. This CL rearranges things
to iterate once (*). Variable conversion is moved to a separate
loop later, to help with nesting and readability.
Removes hard-to-read asserts. These were validating things enforced
by both the IR generator and unit tests.
*: Technically, there are additional implicit iterations when we call
SkSL::Analysis functions. Folding all of this into a single pass
would be even better, but much more complicated.
Change-Id: I4f5aa649e74094e94c365ad20ef2ac96082285cd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303924
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Mostly this is a lot of plumbing of sk_sp around instead of const*.
This does allow the d3d and vk backends to hold refs to the GrBuffers that
are bound on a command buffer. This means that our buffer alloc pools will
not try to reuse this buffers until the gpu is done with them. Previously
vk and d3d will sniff out if one of these buffers was being used again
while still active on the gpu and rip out the internal backend buffer and
allocate a new one which is not cheap. We see a lot of perf wins from
not doing this.
Change-Id: I9ffe649151ee43066dce620bd3e2763b029a9811
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303583
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Previously, this test layered its paints by calling
`addColorFragmentProcessor` multiple times. We intend to remove support
for multiple color FPs on a GrPaint in the near future, so we use input
fragment processors instead to generate the same result.
Change-Id: I33e82ce0067183189e69b2af0fe0c228d1d60f14
Bug: skia:10217
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303479
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
The helper class allows us to regenerate a "random" fragment processor
with the same seed as many times as desired. This lets us check the
`compatibleWithCoverageAsAlpha` optimization without needing to clone
the input FP; instead, we can actually generate the FP under test three
times in a row, with the same random seed.
In a followup CL (http://review.skia.org/303479/) we will also leverage
this helper class to regenerate the FP under test with the same random
seed, but with a different input.
Change-Id: I1cd83082a949d555f7898970c8a1cc3002818286
Bug: skia:10384
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303657
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
This adds load/store ops for 64-bit values, with two load64 instructions
returning the low and high 32-bits each, and store64 taking both.
These are implemented in the interpreter and tested but not yet JIT'd
or hooked up for loading and storing 64-bit PixelFormats. Hopefully
those two CLs to follow shortly.
Change-Id: I7e5fc3f0ee5a421adc9fb355d0b6b661f424b505
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303380
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Everything was pretty much already plumbed through using
SkRasterPipeline, with a few key connections made here.
This support is mostly useful for differentially debugging my CLs
stacked on top of it.
Change-Id: I9c2f2ea6cd8890c057890409f21c7698857c599a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303651
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Previously, the blocks owned by a GrBlockAllocator provided block-level
metadata that users could control to track within a block. For types
like GrTAllocator (and a collection coming down the pipe), they need
to store a total count of allocations.
Since GrBlockAllocator is max-aligned, having them hold on to a single
extra int adds 4 to 12 bytes of padding for 8 and 16byte aligned
platforms. But, the old Block size already has 4 bytes of extra padding
since it was 28 bytes packed. This had been allowed to be allocation
data, for requests that were 4-byte aligned or less.
In practice, I think it's better to use that space for allocator-level
metadata so that a total count, or other high-level data, can be
packed into the data already held by GrBlockAllocator. Now GrTAllocator
instances should be 8-16 bytes smaller on those same platforms. Also
no longer writing into the struct-padded nether-realm, which is probably
just a good thing on principle.
Also cleans up how GrTAllocator's push_back() and emplace_back() are
tested to make sure all options are clearly covered.
Change-Id: If1da29132f3ec8df7a4056fcd834f760eb4693f5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303267
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Change-Id: I5bf9470a3d7822ea1edee7abf693037322e5d4e6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303265
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Change-Id: I00a00e62dfb2021a2c380ef4217c1acec1f07672
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303258
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
This is part of a larger effort to force SkImage users to specify
the direct context they want to use when manipulating GPU images.
Chrome CL 2299194 (landed) enables the staging flag.
bug: skia:10466
Change-Id: I959db57dd8dca5c2622eb5ffaa7de161c4d6d8f0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302643
Commit-Queue: Brian Salomon <bsalomon@google.com>
Auto-Submit: Adlai Holler <adlai@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
This CL tries to remove all uses of GrContext - replacing them with
either GrDirectContext or GrRecordingContext. Preferring the recording
context wherever possible.
Change-Id: I61af94928aa37bc82ff9923acffd57586610f695
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302904
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Adlai Holler <adlai@google.com>
Change-Id: I166755b3e385fcea919a6daad8cc8407fda8c27a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303016
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Aligning with SkSamplingMode.
Bug: skia:10344
Change-Id: Ie303c3ca1d664d4c23f779b84c9a661076bd74d4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303022
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
- add f32<->f16 functions to skvx
- add f32<->f16 x86 instructions to skvm::Assembler
- add f32<->f16 ops to skvm,
using the skvx functions in the interpreter
Still TODO:
use the new x86 instructions in the JIT
(For now like in many other ways, the aarch64 JIT
continues to languish. Will pick that back up one day.)
Change-Id: Ib8dc1ccdc75ecb23769ea4947d66d3ab22520f23
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302942
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Herb Derby <herb@google.com>
The current serialization format for variations stores only the values
(without the axis names) and relies on the order of the axes for
deserialization. Even after this deficiency is corrected, it will still
be needed for legacy skps.
Add a real test which ensures variable font printing works correctly
in Chromium. The old test was essentially testing MakeFromFontData
against itself instead of creating a font with variations as a user
would.
Bug: chromium:1070089
Change-Id: Ia6eaac91b2ac58795b7ba61c2b52b2f22ef079bd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299457
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Herb Derby <herb@google.com>
This makes reset() a little easier to follow, and enables more complex
use cases on top of GrBlockAllocator down the road.
Change-Id: Id79d20e2b394248c997259d6d5b5494fc1456acc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302678
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
This allows the iterator type/boilerplate to be reused for any other
data collection that sits above GrBlockAllocator, as long as its a fixed
"type" with indices into a block.
Also adds reverse iteration (which is useful for stack-like use cases).
Change-Id: Id9a205e8fb396a8558e360439240fd20c92c9700
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302665
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
This is just minor little stuff I've been meaning to do,
with essentially no impact anywhere.
- Add an easy-to-flip switch to disable the JIT.
- Stop checking so carefully whether we hasJIT()
in test_jit_and_interpreter(). This was helpful
for making progress but now just gets in the way.
Change-Id: I08065ba1f42700f9d7d63f8303af357ec5fe11ae
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302944
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Herb Derby <herb@google.com>
With this change if a backend Gr*Gpu wants to using staging buffers
they just add a generic GrStagingBufferManager member object. This
object can be used to get slices of upload buffers. Then they just need
to implement the virtual for taking ownership of buffers during submit.
We rely on our GrResourceCache to handle caching and reuse of these
buffers.
This change allows us to remove all other virtuals on GrGpu around
managing staging buffers.
Change-Id: I5db9a3c52133978ea89d6c0de440f434fbf91a51
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/300226
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Stephen White <senorblanco@google.com>
This reverts commit a56da9ee92.
Reason for revert: UBSAN complains in Vulkan OOPRDDL mode
Original change's description:
> Add a direct context arg to makeColorTypeAndColorSpace
>
> This is part of a larger effort to de-power SkImage and force users to
> specify the GPU context for all new images.
>
> Staging flag landed in Chrome CL 2296632.
>
> Bug: skia:10466
> Change-Id: I6b7bbec10369f7d8ee884dd1bcc234d332c30a6c
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302290
> Commit-Queue: Adlai Holler <adlai@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>
TBR=bsalomon@google.com,robertphillips@google.com,adlai@google.com
Change-Id: Ide36bed6966d3d92ad6b8d05f897d22d287b40b1
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:10466
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302824
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Adlai Holler <adlai@google.com>
This is part of a larger effort to de-power SkImage and force users to
specify the GPU context for all new images.
Staging flag landed in Chrome CL 2296632.
Bug: skia:10466
Change-Id: I6b7bbec10369f7d8ee884dd1bcc234d332c30a6c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302290
Commit-Queue: Adlai Holler <adlai@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
C++ algorithms have largely standardized on a [begin, end) half-open
range, as seen in standard library containers. SkTQSort now adheres to
this model, and takes vec.begin() and vec.end() as its inputs.
To avoid confusion between inclusive and half-open ranges inside the
implementation, internal helper functions now take "left" and "count"
arguments instead of "left"/"right" or "begin"/"end". This avoids any
ambiguity.
(Although performance was not the main goal, this CL appears to
slightly improve our sorting benchmark on my machine.)
Change-Id: I5e96b6730be96cf23d001ee0915c69764b2c024a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302579
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
We now rely on GrTextureEffect and GrBicbicEffect
to determine if shader-based tiling is required.
GrTextureProducer is still responsible for noticing that
the proxy is approximate because GrTextureEffect doesn't
consider that in its basic Make() factory (as opposed to
MakeSubset()).
Change-Id: I8e1aeb9edbcfa73ea0bf80b5256ee1ca21fe9c81
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/301985
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
This simplifies things like ConstantOutputForConstantInput and
invokeChild. It also removes the need for child indices: generated
FPs now directly refer to their children by slot number.
Change-Id: I69bbb042d5d72d21b999256f969c467702d0774d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302436
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Change-Id: If51be35205b40c4a22979a4b49b031126af1dde7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302500
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
In order to stage the transition from GrContext to GrDirectContext, both
of them will have to have the factories for a while.
This CL also removes all internal uses of the old (GrContext) factories.
Change-Id: Ibe1edd0818ea23a0d54257c55f35f12526047ef3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302263
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Adlai Holler <adlai@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
This reverts commit 70474c1cb0.
Reason for revert: bot build failure
Original change's description:
> Remove custom SkSort algorithms.
>
> SortBench shows that SkTQSort and SkTHeapSort are inferior to std::sort.
> The difference is small on randomized inputs, but quite significant for
> semi-ordered inputs (forward/backward/repeated). There doesn't seem to
> to be any compelling advantage to SkTQSort.
>
> Nanobench results: https://screenshot.googleplex.com/9JOLV1d6Z0u
>
> (These performance numbers are from an optimized build my local machine;
> it's possible that we might see different results on the test bots.)
>
> Change-Id: Iaf19563041547eae7de2953be249129108f093b1
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302295
> Commit-Queue: John Stiles <johnstiles@google.com>
> Reviewed-by: Mike Klein <mtklein@google.com>
TBR=mtklein@google.com,brianosman@google.com,johnstiles@google.com
Change-Id: I1126dd4cda95716dac225ad32d5b0e5cf3f09421
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302447
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
SortBench shows that SkTQSort and SkTHeapSort are inferior to std::sort.
The difference is small on randomized inputs, but quite significant for
semi-ordered inputs (forward/backward/repeated). There doesn't seem to
to be any compelling advantage to SkTQSort.
Nanobench results: https://screenshot.googleplex.com/9JOLV1d6Z0u
(These performance numbers are from an optimized build my local machine;
it's possible that we might see different results on the test bots.)
Change-Id: Iaf19563041547eae7de2953be249129108f093b1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302295
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
ConstColorProcessor contained three separate InputModes with their own
unique behaviors, but every (non-test) call site simply hardcoded one of
the InputModes.
This change also allows the actual const-color processor to remove the
inputFP entirely; it is never sampled.
The GM slide has been split into three separate slides as well.
Change-Id: I2b77f4eab4d655f06e3704fb6fde8d4f8c70a075
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/301987
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
This is part of a larger effort to force users to provide a context
when manipulating GPU images which may be shared, instead of having
images themselves retain powerful context pointers.
Chrome flag landed in Chrome CL 2292800
Bug: skia:10466
Change-Id: Ic530a2c5eb1f4399db899d243ea944760fdf2055
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/300707
Commit-Queue: Adlai Holler <adlai@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
While testing on Linux with a configuration like
skia_enable_fontmgr_custom_directory=false
skia_enable_fontmgr_custom_embedded=false
skia_enable_fontmgr_custom_empty=true
skia_enable_gpu=true
skia_use_fontconfig=false
skia_use_freetype=true
skia_use_system_freetype2=false
the default typeface will be an empty typeface with no glyphs. This of
course leads to many test failures, which is fine.
However, this also leads to crashes when testing GPU Ops since the Op
factories may return nullptr to indicate no-op but the callers of those
factories currently do not expect nullptr or handle it as a no-op.
Change the callers of Op factories to treat nullptr as no-op.
Change-Id: I9eb1dfca4a8a9066a9cfb4c902d1f52d07763667
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/301586
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
This makes batch texture ops consistent with singleton texture ops, and
images drawn through a texture producer.
Bug: chromium:1102578
Change-Id: I490b20940ef6f1899396b786369271ce7130e8a9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/301540
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Change-Id: I9fa9f8785f48e884cf296a638347003d1687e7c0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/301536
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Change-Id: Ice75d0caa7b4beb2d982be094d62b54e71b45045
Bug: chromium:1101491
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/301456
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
The SkPDFDocument::fTagTree::fRoot is set at document creation time.
This root will initially always be discardable, since no annotations
have been made. As a result it does not make sense to assert on it being
non-discardable, since it should be possible to create a PDF which just
happens to have no annotations added to it.
Change-Id: I2fe336c872805b6937f7c8ea275c0cb4d3438682
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/301383
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Dominic Mazzoni <dmazzoni@chromium.org>
We are replacing GrContext with the GrDirectContext/GrRecordingContext
pair. This starts making that change visible to clients (and weaning
Skia off of GrContext).
Change-Id: I00cc9bf208499984de855a1646229bd7557fc925
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/300706
Reviewed-by: Adlai Holler <adlai@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Bug: skia:10416
Change-Id: I0ca7535a0e6507e6b2a9f4682788826972c5f3b8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/300296
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
This reverts commit c8b721b086.
Reason for revert: Looks like it's causing build failures around
MakeRenderTargetContext on the roll.
Original change's description:
> Make SkGpuDevice hold a GrRecordingContext
>
> This makes the code reflect what is actually going on. During DDL
> recording the SkGpuDevice only holds a recording context.
>
> This can't land until the following Chrome-side CL lands:
>
> https://chromium-review.googlesource.com/c/chromium/src/+/2277964 (Add GrContext.h include to skia renderer for upcoming Skia roll)
>
> Change-Id: I69cfa744226c315c25f68fc509b7b59ec38bbf31
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299867
> Commit-Queue: Robert Phillips <robertphillips@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Adlai Holler <adlai@google.com>
TBR=bsalomon@google.com,robertphillips@google.com,adlai@google.com
Change-Id: I6a362daf7c40e36ed9f068c5b2d477c16a3f778e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/300853
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
This makes the code reflect what is actually going on. During DDL
recording the SkGpuDevice only holds a recording context.
This can't land until the following Chrome-side CL lands:
https://chromium-review.googlesource.com/c/chromium/src/+/2277964 (Add GrContext.h include to skia renderer for upcoming Skia roll)
Change-Id: I69cfa744226c315c25f68fc509b7b59ec38bbf31
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299867
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Adlai Holler <adlai@google.com>
defines one method that is never used.
Change-Id: If8522c5f1ac7447b0d5584e76cdbd2f7d127036b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/300259
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Auto-Submit: Brian Salomon <bsalomon@google.com>
All coord transforms were identity, so this enshrines that
knowledge, then transitively removes a large amount of code.
Bug: skia:10416
Change-Id: Iae4af9ca21590bced1ce9fce3ab807f6cceaebd4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/300234
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
This CL makes it explicit that the unit tests always get a direct context.
It is mainly a mechanical CL.
Change-Id: I49e0628851d9c81eb47386ef978edf905c6469d8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299866
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
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>
GM was updated in:
https://skia-review.googlesource.com/c/skia/+/300172 (Make GM::onGpuSetup take a GrDirectContext)
This CL updates: skpbench, nanobench, and some testing infrastructure.
Only minor changes were made to the unit tests as they will be updated
en masse in a follow up cl.
Change-Id: Ieffc98865d4c9fc73e292d3c807ed4ae2081745a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/300220
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
External clients will need access to these classes once GrContext
goes away.
This is a purely mechanical CL.
Bug: skia:10441
Change-Id: I7ffeb29d88bcc0f012412fba911e8362d046e24a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/300206
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
It now tracks all sample calls of a child (matrix, explicit coords,
pass through). There is now just one registerChild() call, and the
sampling pattern of that child is fully determined by the SampleUsage
parameter.
Change-Id: Iaadcd325fca64a59f24192aadd06923c66362181
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299875
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
External clients will eventually have to call this to get access
to a direct context from an SkCanvas or SkSurface (which will
only have 'recordingContext' accessors).
Bug: skia:10441
Change-Id: I10e34081277b685fa59d03e1fce1887f3524e0fa
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/300178
Reviewed-by: Adlai Holler <adlai@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Just a little follow up, adding a mem->xmm vmovups
instruction to make it possible. Nothing tricky.
Change-Id: I319e11839e44ccda46e664c82fb858a18499f9be
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299883
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Herb Derby <herb@google.com>
This is a reland of 9716414e93
Original change's description:
> Simplify GrClip API
>
> Removes quickContains(SkRect), quickContains(SkRRect), and isRRect().
> Replaces these three functions with preApply() that conservatively
> determines the clip effect up to a single rrect intersection. The major
> motivation for this is the new GrClipStack implementation. preApply()
> and apply() will be able to reuse much more code compared to separating
> the preApply functionality across the older three functions that were
> removed. Additionally, preApply is able to convey more information for
> less work, since it can usually determine being skipped or unclipped while
> determining if the clip is a single rrect.
>
> As part of using this API, the attemptQuadOptimiziation and the equivalent
> rrect optimization are overhauled. Hopefully legibility is improved, and
> the rrect case is now applied outside of the android framework (but with
> tighter AA requirements).
>
> Bug: skia:10205
> Change-Id: I33249dd75a28a611495f87b211cb7ec74ebb7ba4
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/298506
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Chris Dalton <csmartdalton@google.com>
> Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Bug: skia:10205, 10456
Change-Id: I500eeda36ea50e95eb8cb658b36aa2373d5166c0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/298823
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
This also adds back default flush() calls which simply do a flush
without any submit.
Change-Id: Ia8c92bbdecd515d871abfa6364592f502e98656b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/298818
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Previously, we had separate "ComposeOne" and "ComposeTwo" fragment
processors. These performed extremely similar roles, but varied in
the number of child FPs used, and treatment of the input color's alpha
channel.
This CL combines these two FPs into a single unified "Compose" fragment
processor. To avoid breaking many existing GMs, the semantics of the
prior FPs have been preserved as closely as possible. (Specifically, the
FP treads very carefully to ensure that the alpha channel handling
matches the old code, as dozens of GMs fail otherwise.)
Change-Id: I7ab453f3313e70ae25e5e70f86373a64ff02072f
Bug: skia:10217
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299703
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
isConstant really means "has a known value at compile time", but for
variables declared with "const", the two meanings had been conflated.
There were several ways for this to produce surprising error messages.
The included unit test crashed before removing the override, and now
passes.
Change-Id: I49b926e51c421db93240cbbf42231de0444358d6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299860
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
This removes the code generation support for @coordTransform and sk_TransformedCoords2D
when processing .fp files. Instead, the main() function can optionally add a float2
parameter. This is marked as the SK_MAIN_COORDS builtin, just like the main function
for a runtime pipeline stage.
Bug: skia:10416
Change-Id: I0c192d890bb798a1167bc445003f6ddffe6118f0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299687
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
This reverts commit ca5b36c474.
Reason for revert: This may be blocking the Chrome roll
Original change's description:
> Add storage on the surface for its last render task
>
> Let's land this and see if it gets us back to baseline on the
> lastRenderTask regression from the bug. If it doesn't, we'll revert it
> since the extra complexity won't have been worth it.
>
> Bug: skia:10372
> Change-Id: I9d5ae93435b833d575afdc7f219dc8e7c453c92b
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/297836
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Commit-Queue: Adlai Holler <adlai@google.com>
TBR=robertphillips@google.com,adlai@google.com
Change-Id: Id418d042d1123d946cd99b7b1ba438211cb628ec
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:10372
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299763
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
I will follow this up with a Chrome-side CL to fix the call sites of the following factories:
MakeFromCompressedTexture
MakeFromTexture
MakeFromYUVATexturesCopyWithExternalBackend
MakeFromYUVTexturesCopyWithExternalBackend
MakeFromNV12TexturesCopyWithExternalBackend
Here is the Chrome-side CL: https://chromium-review.googlesource.com/c/chromium/src/+/2264598/ (Skia's SkImage::Make* factories now guarantee cleanup)
Here is the Chrome-side CL that adds the guard flag:
https://chromium-review.googlesource.com/c/chromium/src/+/2273067/ (Add flag in order to roll a Skia CL into Chrome)
TBR=bsalomon@google.com
Bug: 1097484
Change-Id: Ic2fcdc116f0f866b33d752b6d5abc784c7f65be6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299663
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
At this point, every created instance of GrCoordTransform is an identity
so can be removed. Adding it manually using addCoordTransforms() is no
different than relying on the (current) implicitly returned coord
transform if the FP calls setUsesSampleCoordsDirectly().
Removing the addCoordTransform() lets us enforce that this remains the
case and this CL also deletes all of those members that were previously
used to provide access to the sample coordinates.
As part of this, GrFragmentProcessor.h and many other files no longer
need to include GrCoordTransform.h. This exposed a surprising popularity on
SkMatrixPriv.h so I updated those files to include that header directly.
Technically, a .fp file can still have an @coordTransform section and
the sksl generator will try and call addCoordTransform, which will then
fail to build. A follow up CL removes that support in .fp generation.
Bug: skia:10416
Change-Id: I5e4d2bb49ee6d7e56ac75ca00be5631106fec20b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299291
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
This will not be landed until chrome CL 2269958 lands.
Bug: skia:10425
Change-Id: I2a5081201ca3faed5232e8540086bd4c6f865767
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299292
Commit-Queue: Adlai Holler <adlai@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Let's land this and see if it gets us back to baseline on the
lastRenderTask regression from the bug. If it doesn't, we'll revert it
since the extra complexity won't have been worth it.
Bug: skia:10372
Change-Id: I9d5ae93435b833d575afdc7f219dc8e7c453c92b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/297836
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Adlai Holler <adlai@google.com>
If the backend doesn't support mipmaps, skip the test cases which
only differ by the mips flag.
Bug: skia:10361
Change-Id: I05e3bc59c2d9d1af6b5cb3659a7a346f2cdc8b82
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299558
Commit-Queue: Stephen White <senorblanco@chromium.org>
Commit-Queue: Stephen White <senorblanco@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>