Make SkImage_Gpu and SkImage_GpuYUVA have their own implementations
rather than sharing one in SkImage_GpuBase.
New function takes a GrImageTexGenPolicy to enable caller to
force a new texture to be made and choose it's budgeting status rather
than receive a cached view or a view owned by the image.
It also communicates any color type changes when converting a non-
texture image to a texture.
Bug: skia:11208
Change-Id: I6b389442bf9752276a83b21021070e3190610cd7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/361356
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
We still occasionally downcast, so this is not airtight,
but it (1) allows us to know where we are downcasting and
(2) lets us move away from GrContext (and hopefully remove
it sooner than later.)
All three canaries are currently broken =( so here we go!
Bug: skia:104662
Change-Id: I84efe132574690b62ea512e194e4f9e318e9c050
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/316218
Commit-Queue: Adlai Holler <adlai@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Mechanically updated via Xcode "Replace Regular Expression":
typedef (.*) INHERITED;
-->
using INHERITED = $1;
The ClangTidy approach generated an even larger CL which would have
required a significant amount of hand-tweaking to be usable.
Change-Id: I671dc9d9efdf6d60151325c8d4d13fad7e10a15b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/314999
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Note: The polarity of the staging flag is inverted from usual because
a G3 dependency with no SkUserConfig.h relies on the legacy API.
Once this lands, we will migrate them and others, then remove the
staging API. The inverted staging flag is kind of nice, actually - I may
use that pattern in the future. It means less total CLs and it's just as
easy to flip the bit on or off during debugging.
Bug: skia:104662
Change-Id: I48cba1eeae3e2e6f79918c6d243e0666e68ec71b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/310656
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Adlai Holler <adlai@google.com>
This reverts commit 3eff2459d4.
Reason for revert: did I break abandongpu bot?
Original change's description:
> Never share pixels when we make a subset image
>
> - mostly just affects Lazy images (raster was already always copying)
> - issue with other factories that offer subsetting
> - (e.g. MakeFromGenerator)
> - can we remove those options, and require makeSubset() afterwards?
> - greatly simplifies dealing with mipmaps
>
> Landing this would obsolete
> https://skia-review.googlesource.com/c/skia/+/305960
>
> Related: https://skia-review.googlesource.com/c/skia/+/306136
>
> Related: https://bugs.chromium.org/p/skia/issues/detail?id=10544
>
> Change-Id: I074420543bd2fcd46ed1620bbf0eed00371ab018
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305970
> Commit-Queue: Mike Reed <reed@google.com>
> Reviewed-by: Leon Scroggins <scroggo@google.com>
TBR=mtklein@google.com,bsalomon@google.com,robertphillips@google.com,scroggo@google.com,brianosman@google.com,reed@google.com
Change-Id: Iab2f92855fe61e48f0e432b7257eb7ddef78fcfa
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/306377
Reviewed-by: Mike Reed <reed@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>
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 is part of the effort to replace GrContext with the GrDirectContext/GrRecordingContext pair.
It also tries out, a bit, the context naming proposal (i.e., rContext and dContext).
Change-Id: Ib4d9881f820a7f8a8c525eba7448b1015526400c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303627
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
This reverts commit c80ee456ad.
fix: update flutter's gn file to add guard
Change-Id: Iac5171c8475d9a862d06255dab1c6f38f10de2f2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/291361
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Change-Id: I7d12c81b195144de217c928f5537665cae21c644
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/281580
Commit-Queue: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Auto-Submit: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Bug: skia:10078
Change-Id: I3ce0d97f8ada55403cc3f88bb16659085449ea29
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/281207
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Also strengthens/adds some guarantees about this function:
* Always returns the same image if the original is texture-backed and
compatible with GrMipMapped (WRT HW MIP support)
* If a new texture backed image is returned it is always an uncached
texture that is not shared with another image or owned by an image
generator.
Adds a GrImageTexGenPolicy that allows control through image/bitmap
GrTextureProducers of whether a new texture must be made and whether
that texture should be budgeted or not.
Increases unit test coverage of this API.
Bug: skia:8669
Change-Id: Ifc0681856114a08fc8cfc57ca83d22efb1c1f166
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/274938
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
The only thing that affects the view returned is whether it ought to
be MIP mapped or not. So don't take a whole GrSamplerState.
The view() function won't ever change the colortype so just query
GrTextureProducer rather than having view() return a tuple.
The rest is transitively reaching through callers and callees of
GrTextureProducer::view() to only pass filter or GrMipMapped instead of
GrSamplerState. Also, some params that indicate whether MIPs are
requested are changed from bool to GrMipMapped. And some minor style
stuff (mainly de-yoda-ifying GrMipMapped checks, using
GrSurfaceProxyView operator bool()).
Change-Id: Ia184aa793cf51d42642ea3bb0521ce06da2efb10
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/274205
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
This reverts commit 7fba244ea9.
Reason for revert: See if this is blocking the Chrome roll
Original change's description:
> Remove copies for wrap modes in GrTextureProducer.
>
> GrTextureEffect now supports implementing wrap modes in shaders
> for subsets and texture types with HW sampling restrictions.
>
> Change-Id: I5c93ade044465e13c5f56f7437fbbe288db0a8a8
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/271056
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>
TBR=egdaniel@google.com,bsalomon@google.com
Change-Id: I14397bec8ff4ba165c28faa8f44497f47d865862
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/272522
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
GrTextureEffect now supports implementing wrap modes in shaders
for subsets and texture types with HW sampling restrictions.
Change-Id: I5c93ade044465e13c5f56f7437fbbe288db0a8a8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/271056
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Bug: skia:9556
Change-Id: Ibcdf187021c22290013d99d8684f891576046052
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268937
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
This also changes the SkImage_Base header to return a const& view and
then removes the equivalent version in SkImage_GpuBase.
Bug: skia:9556
Change-Id: Ica096693a22c0fc590786058c055fb28387c80a1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268624
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Auto-Submit: Greg Daniel <egdaniel@google.com>
Additionally this changes updates GrRenderTargetContext drawTexture to take
a view. This was done since there were a bunch of places where the result
of the copy goes straight to the drawTexture call.
Bug: skia:9556
Change-Id: If7094eb51ed343620011d03b86d603e3c6289c17
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/267856
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
This reverts commit 42032cb88f.
Reason for revert: Relanding now that pre CLS that fix initial issue landed
Original change's description:
> Revert "Pass in a SkColorType into SkImage_Gpu ctor."
>
> This reverts commit 1d17543133.
>
> Reason for revert: android bots
>
> Original change's description:
> > Pass in a SkColorType into SkImage_Gpu ctor.
> >
> > This allows us to get rid of using the GrPixelConfig on proxy to create
> > the SkColorType
> >
> > Bug: skia:6718
> > Change-Id: I1758b79152fa1e8a1796e55d19f5e8ca0b0e8b7b
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264396
> > Commit-Queue: Greg Daniel <egdaniel@google.com>
> > Reviewed-by: Robert Phillips <robertphillips@google.com>
>
> TBR=egdaniel@google.com,robertphillips@google.com
>
> Change-Id: I449e6b0750d611346791beb1dd1346106ad01741
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:6718
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264469
> Reviewed-by: Mike Klein <mtklein@google.com>
> Commit-Queue: Mike Klein <mtklein@google.com>
TBR=egdaniel@google.com,mtklein@google.com,robertphillips@google.com
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: skia:6718
Change-Id: I8088b4e96d1f2c73be03d150fb8f8280a21db5de
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265496
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
This allows us to remove looking at the config to infer a color type when
setting up a Surface/RenderTargetContext for the copy.
Bug: skia:6718
Change-Id: I75b63480a84558c96b5eeb248cc6165f96b2a243
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264563
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
This reverts commit 1d17543133.
Reason for revert: android bots
Original change's description:
> Pass in a SkColorType into SkImage_Gpu ctor.
>
> This allows us to get rid of using the GrPixelConfig on proxy to create
> the SkColorType
>
> Bug: skia:6718
> Change-Id: I1758b79152fa1e8a1796e55d19f5e8ca0b0e8b7b
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264396
> Commit-Queue: Greg Daniel <egdaniel@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>
TBR=egdaniel@google.com,robertphillips@google.com
Change-Id: I449e6b0750d611346791beb1dd1346106ad01741
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:6718
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264469
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
This allows us to get rid of using the GrPixelConfig on proxy to create
the SkColorType
Bug: skia:6718
Change-Id: I1758b79152fa1e8a1796e55d19f5e8ca0b0e8b7b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264396
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
constexprify GrSamplerState
pass/return GrSamplerState by value (it's 3 bytes).
Remove unused function from GrTexturePriv
Change-Id: Iffecd941500acf5653f01cc88b42ff1d45678b54
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263346
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Change-Id: I7c672ff6b8eb95ec8c1123a5bfdb202e1644f494
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259281
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
This is a reland of 997b37fdb9
Layout tests have been suppressed.
Original change's description:
> Revert "Revert "Make FP optimizations helpers use SkAlphaType not GrColorType""
>
> This reverts commit 078e8faa26.
>
> Change-Id: I67b2970584db5a1afbf9928b77c5444947ef71a3
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/255897
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>
Change-Id: I6db4cff8b71ef1f29ac47f7729b9514d009f730a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/256225
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Uses SkISize instead of separate width/height variables in many places.
No functional change.
Change-Id: If87b2c57e43d810f0820c4e3c9ef8e6b8ebd10ba
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249886
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
This change also allows for the remove of GrPixelConfigIsOpaque function.
Bug: skia:6718
Change-Id: I7e7b70f02d911eda67640d648fb6348091e0f55d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/248698
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>