This is a reland of 4e37751693
Original change's description:
> Make it easier to test rectangle textures by using createBackendTexture.
>
> Also allows internal creation of rectangle textures, only used by unit
> tests currently.
>
> Previously GrContext::createBackendTexture() would ignore the request
> for RECTANGLE or EXTERNAL and always make 2D. Now it makes RECTANGLE if
> supported and always fails for EXTERNAL.
>
> Change-Id: Iafbb3f5acddb37bfb8d39740f2590177a07dae78
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/297472
> Commit-Queue: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>
Change-Id: Ibf6921c97278c9f0f71c46883cfbaa04f229affa
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/297865
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
GrReducedClip will now combine both analytic and CCPR FPs using child
FPs instead of via RunInSeries. (There is still an fShader component
which, if present, is combined via RunInSeries for now.)
Change-Id: Ia7e0ced1e64927b94a8e64adfb5a773c2c175963
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/297808
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
So apparently I did all the work to allow us to not submit in
updateBackendTexture, but then I never actually removed the submit...
Bug: chromium:1087124
Change-Id: Id08a9c5e116cff57dbbeada74186f94da6e28656
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/297866
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
This reverts commit 4e37751693.
Reason for revert: breaking some mac test bots
Original change's description:
> Make it easier to test rectangle textures by using createBackendTexture.
>
> Also allows internal creation of rectangle textures, only used by unit
> tests currently.
>
> Previously GrContext::createBackendTexture() would ignore the request
> for RECTANGLE or EXTERNAL and always make 2D. Now it makes RECTANGLE if
> supported and always fails for EXTERNAL.
>
> Change-Id: Iafbb3f5acddb37bfb8d39740f2590177a07dae78
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/297472
> Commit-Queue: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>
TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com
Change-Id: Ia14c60ae996757369f1711ec0851e199cbbd4157
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/297812
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Derek Sollenberger <djsollen@google.com>
Previously the test checked two clones against each other. It seems
more useful to test an original against a clone.
Change-Id: Ie49a39829a0f5ee24724e4acefad50e539104f48
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/297460
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Also allows internal creation of rectangle textures, only used by unit
tests currently.
Previously GrContext::createBackendTexture() would ignore the request
for RECTANGLE or EXTERNAL and always make 2D. Now it makes RECTANGLE if
supported and always fails for EXTERNAL.
Change-Id: Iafbb3f5acddb37bfb8d39740f2590177a07dae78
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/297472
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
This also adds a GPUTEST_FOR_D3D_CONTEXT macro to help with debugging
tests.
Change-Id: I72db01d148755c3bbbbb4d948d441a31dcf9482b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/297717
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Previously, we were limiting our calls to appendVAList to 512-byte
chunks to avoid a potential buffer overflow. This had two problems:
1 - it did not avoid the buffer overflow :(
see chromium:1092743
2 - every call to appendVAList is expensive; it incurs a resize of the
code buffer (alloc new, memcpy, free old)
This CL removes the 512-byte cap as the buffer overflow issue was
resolved at http://review.skia.org/297276
This CL also includes a few more minor improvements.
- `codeAppendf` now uses a raw string so the gencode is easier to read.
- Optimized `SkStringPrintf("%s", foo)` to `SkString(foo)`.
- Optimized `strA = strB` to `strA.swap(strB)` where safe to do so.
Change-Id: Ia0909a68719848dd2ca655066a9bc6929c8fd09f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/297358
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Unit tests for SkString::appendVAList would have preemptively caught the
associated fuzzer failure.
Change-Id: I19a414e5e937f9e3fbe0f75e062b4befa6e2877b
Bug: chromium:1092743
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/297473
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Also remove unused buffers. FPs no longer support reading from buffers.
Bug: skia:10139
Change-Id: Id1e2d7ef2cfa7f11a95cb0ce448c69af755c2b65
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/297176
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
fChildren/fChildCount was replaced with fChildVector and Chromium
migrated to the new API a while back, it's now safe to remove the
older interface.
Bug: chromium:607777
Change-Id: I7311d3b51f1b71209dcc024ae51637536d560619
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/297260
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Plus some minor cleanup and asserts.
Bug: oss-fuzz:23395
Change-Id: I667bee2d7f21864defe2fd97df9eb4e99d69d9ca
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/296451
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Tyler Denniston <tdenniston@google.com>
Commit-Queue: Florin Malita <fmalita@google.com>
This arrangement allows the backend texture to outlive the YCbCr SkImage.
Change-Id: I34939d05bf1091c8efcacb687dc1900729d4cbe5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/296478
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Previously, when REPORTER_ASSERT reported a failure, there was no
additional information describing the FP that could not be cloned in the
error log. Now, we print out a very simple tree of the FP and its
children.
Change-Id: I141cfb17ca431864a6f555d56f0335293f259c4e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/296452
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
In the "ignore input" mode, the input FP contributes nothing and is
never sampled. In the "modulate input" cases, the input FP is sampled
as one would expect.
Change-Id: I96717d63d8e3d7ef6aa4eaaf88154c6e5ce47e55
Bug: skia:10217
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/296299
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
When collapsing static switches, we were not handling the symbol table
in SkSL::Block correctly, which led to assertion failures in some cases.
This CL is based on the fixes in http://review.skia.org/296178
but removes the need to track pointers-to-unique-pointers.
We do this by splitting the work into two parts:
1 - determine range of statements to move
2 - actually move statements
Because the statements are all consecutive, keeping track of this range
is not actually that difficult and we don't need to do any checks twice.
Change-Id: I71ad745ef1e4b4f5f6b753762e65fa49b2399adc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/296440
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
In PDF files, "names" and "strings" are not the same thing, but I was
conflating them. Separate out the interfaces for adding attributes to
PDF struct tree elements so there's a way to add either a name or a string,
and similarly for arrays of names or arrays of strings.
Fix the table test to correctly use a name for the "Scope" attribute
and an array of strings for the "Headers" attribute.
Bug: chromium:607777
Change-Id: Ib30bded2bbcf96e31ba6925fb062615558dea0db
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/296338
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Auto-Submit: Dominic Mazzoni <dmazzoni@chromium.org>
Commit-Queue: Derek Sollenberger <djsollen@google.com>
This will remove common boilerplate from our gen-code, and gives us a
place to put common child-cloning boilerplate.
Change-Id: I6101655af89d4c5844ec908b81ce4f6e5d59f834
Bug: skia:10217
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/296177
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Change-Id: I44f64a8c98c019a8f4878b0b6f6d82489aa8252c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/296179
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Mike Reed <reed@google.com>
We also fix getReadSwizzle with this change.
Change-Id: I1989d8347dc97d7a4c75aa9094a0146419c6d8fa
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295819
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
This new api will eventually replace the version that takes an
SkSurface::BackendAccess.
Change-Id: I48cd013725e14027f386b0b111223459944ac44a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295567
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Options used to rely on an external call to SanitizeOptions to
ensure they were correct. Now that defaults are set directly,
make sure that the values coming in make sense.
Change-Id: If6cfc027722b6a7717a920b482ec5be8f7526367
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/296040
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Herb Derby <herb@google.com>
If GrClips know their dimensions then getConservativeBounds() does not
need any arguments and isRRect() can remove its rtBounds argument.
I also updated GrFixedClip to report the render target bounds as a
degenerate rrect in its isRRect implementation if it was wide open. Its
apply() function was also simplified to take advantage of the prior
GrScissorState work where the rectangle was always valid to access and
contained within the render target bounds.
Change-Id: I627b97976cb176b1c80627462027034b06ad2cb2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/290957
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
This CL is not fully comprehensive; for instance, it does not contain
fixes for backends that don't compile on Mac. But it does resolve the
vast majority of cases that trigger -Wimplicit-fallthrough.
A few minor bugs were found and fixed, but none that were likely to
affect normal operation.
Change-Id: I43487602b0d56200ce8b42702e04f66390d82f60
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295916
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
The old factories (makeShader) will behave as before: they will inherit
the filter-quality from the paint.
The new factory takes an explicit filter setting, and will use that
regardless of the paint.
Big follow-ups:
- update callers to not rely on setting in SkPaint
- revise/enhance settings in imageshader
- settings for scaling up and down
- control over trilerp, etc.
- other: 4x4 kernels? trilerp bias?
- move mipmaps to always be explicit requests a SkImage factory time
Bug: skia:10344
Change-Id: If87b06d4fd6eafd8b9cdecda7c00d69897066ef8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295086
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
This should make the YCbCr sampler helper usable in a GM (with a normal Vk context).
Change-Id: I75451f6ca934f7b59c48349c77234856d0946a12
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295766
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
The GrTextContext::options would flow from the GrRecordingContext to
the GrDrawingManager to the GrTextContext, and finally to the
GrRenderTargetContext.
Just find them on the GrRecording context off the GrRenderTargetContext.
Change-Id: I902481d20072c2470905261ab81c2b6456f25343
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295559
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
The current implementation ignores return value from
`registerChildProcessor` and, surprisingly, assumes that a cloned FP
index will match the original FP index. This version honors the return
value.
(In practice, I have not seen any cases where the current implementation
has caused actual breakage.)
Updating common code-gen had large ripple effects in the SkSL unit
tests. While repairing the tests, I also took the opportunity to use
raw-strings to pass the source SkSL text, and annotated the `expectedH`
and `expectedCPP` blocks to make the tests easier to understand at a
glance.
Change-Id: I71be69d9e4620963b3ef49ad8e0dba3b40af7f4f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295452
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
When collapsing static switches down to a single statement, we detect
break statements and don't copy them. But the logic was broken; we
weren't copying the entire statement in which the break occurred, which
could be a block, causing some of the code to simply be omitted.
Change-Id: Ic5b59c11d12326c93d49080193a0a5297732bfb0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295776
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Bug: skia:10362
Change-Id: I56d1f618dcdf96133f1932b7ac8d4602ddb93a59
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295575
Commit-Queue: Stephen White <senorblanco@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
The aim here is to unify VkTestHelper with the VkYcbcrSamplerHelper's context creation code. AFAICT they have a ~90% overlap.
Change-Id: Iba8d1482b8c1d7164682f90e19d2183d8cfe45d4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295583
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Now that we have the GrContext setBackendTextureState calls we no longer
need these to be on flush.
Bug: skia:10254
Change-Id: I7c44667a327de11dd853e3e71b114959a7bcee86
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295447
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Bug: b/145995037
Bug: skia:5457
Android is switching to the new behavior with ag/10041691, so the
legacy flag is no longer needed.
TBR=djsollen@google.com
Change-Id: I786807e4cb8b4ed4cd41fd2776ae2915f8bc62cc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263176
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
After removing all unused API from SkReader32, it only had a handful
of functions, and it was (rightly) only used by SkReadBuffer. Remove
the temptation to use it by just folding it into SkReadBuffer.
SkWriter32 had some unnecessary functions as well (only used in unit
tests), so those are gone. There is still a strange relationship:
SkWriteBuffer is just an interface - SkReadBuffer is actually the
complement of SkBinaryWriteBuffer/SkWriter32. Those two classes produce
data in the exact same format, but with slightly different interfaces.
(The choice about which one is used is mostly about high-level
serialization vs. low-level helpers).
Change-Id: I1e823755febecd2e053ea732b21295d8f4d9d832
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295557
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
The intent is to reuse this helper to create a YCbCr GM.
Change-Id: I4d6af42745dbf845e28753bec670ad4a75c393b2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295443
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
These are much safer than SkReader32/SkWriter32 (they do validation and
ensure we never read past the end of the buffer).
Where we used to just assert that the contents of the cache were valid,
we now validate everything, and fail gracefully by discarding the cache
contents if it's corrupted or invalid.
Reland includes a new skipByteArray API. The previous technique for
reading into an std::string relied on data(), which doesn't return a
writeable pointer until the C++17 standard library.
Bug: skia:9402
Change-Id: I3b88efbf8ca590c8ad4f8164f7c07eee12696ec6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295441
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
This is currently only supported for the Vulkan backend
Bug: skia:10254
Change-Id: I9274799098dc00dec5abcbcec95ce7cc23fec537
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/293844
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
From what I can tell no one is currently depending on this feature and
continuing to support it is starting to become a pain. Clients will
be able to manually request VkImages (via flush api) go back to their
original queue, so there is a path if someone really needs this.
Bug: skia:10254
Change-Id: I91283bba451fa9bf52b466f587d3f7c5c9365242
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294657
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
This check isn't correct, since most backends will use a fallback path if
writePixels directly to a surface fails.
That fallback path doesn't work for Dawn currently, so skip the test
on the Dawn backend.
Change-Id: I07f9a25640bc579d6b0952e208237368d007b06d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294702
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
Change-Id: I0af800900a7fbd9d16af0058ee0754358ebc3875
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/293562
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Dawn does not support writePixels to a TextureAsRenderTarget, so update its caps to reflect that.
Also update the WritePixelsNonTexture_Gpu test to check the caps.
Bug: skia:10333
Change-Id: I4dcf2e0fecc34cba9586e5cab71739e427301efb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294597
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
Change-Id: Ifbe0f3ae6e01d65f18351903da8aef63170ce6c7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294457
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>