Commit Graph

36 Commits

Author SHA1 Message Date
Aditya Kushwah
fe1bc0ae3d Label intermediate Gradient texture.
Label temprory offscreen textures for draws. In this CL, we will
label texture for gradient from GrGradientShader which will help
labeling parts of SkImages too.

Bug: chromium:1164111
Change-Id: Iea49598f7632bb2edfaef21a0956771af5833cc1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/550736
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2022-06-23 13:51:21 +00:00
Greg Daniel
719239cd69 Move all Ganesh source files into ganesh subdirectory.
Change-Id: I238d29ba0250224fa593845ae65192653f58faff
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/528156
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2022-04-07 21:06:50 +00:00
Brian Salomon
9fa47cc1c6 Make class members that are static constexpr also be inline.
This is in prep for compiling with -std=c++14 and -Wno-c++17-extensions
when building with clang. Chrome has encountered problems with
third_party headers that are included both in Skia and other Chrome
sources that produce different code based on whether preprocessor macros
indicate a C++14 or C++17 compilation.

In C++17 they are already inline implicitly. When compiling with C++14
we can get linker errors unless they're explicitly inlined or defined
outside the class. With -Wno-c++17-extensions we can explicitly inline
them in the C++14 build because the warning that would be generated
about using a C++17 language extension is suppressed.

We cannot do this in public headers because we support compiling with
C++14 without suppressing the C++17 language extension warnings.

Bug: chromium:1257145
Change-Id: Iaf5f4c62a398f98dd4ca9b7dfb86f2d5cab21d66
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/457498
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-10-11 16:22:59 +00:00
Robert Phillips
4dca83162b Rename GrSurfaceDrawContext to skgpu::v1::SurfaceDrawContext
This CL is mostly mechanical. It:

replaces "src/gpu/GrSurfaceDrawContext.h" #includes with
         "src/gpu/v1/SurfaceDrawContext_v1.h" and reorders

replaces "class GrSurfaceDrawContext;" with
         "namespace skgpu { namespace v1 { class SurfaceDrawContext; }}"

replaces "GrSurfaceDrawContext*" with "auto" where possible
replaces "rtc" with "sdc"
replaces "surfaceDrawContext" with "sdc"
replaces GrSurfaceDrawContext with skgpu::v1::SurfaceDrawContext
reflows parameters as needed

This CL does not try to:

make skgpu::v1::SurfaceDrawContext V1-only
minimize the skgpu and/or skgpu::v1 prefixes

Those two tasks will be accomplished in follow up CLs. This CL is just trying to get the bulk of the mechanical changes comprehensibly landed.

Bug: skia:11837
Change-Id: I6fe59080249d585df8f5d27c6b67569cdc35842f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/433156
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2021-07-28 20:12:10 +00:00
Robert Phillips
7a0d3c3f12 Revise GM infrastructure to not rely on GrSurfaceDrawContext
The SDC will soon be V1-only. Remove it from the generic testing infrastructure and require each V1-specific GM to explicitly retrieve it.

Bug: skia:11837
Change-Id: I4c904b7e333333382062bde4b17a1f9f81bee6a9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/430425
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2021-07-21 20:59:37 +00:00
Robert Phillips
550de7f872 Depower GrPipeline.h
This is mainly to get GrTextureEffect.h out of this header. Its distribution keeps gumming up efforts to make more classes V1-only.

Bug: skia:11837
Change-Id: I6d5aae20bb20cfe3fb4d93c526efe8cf7e5e0c52
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/425017
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-07-07 13:56:23 +00:00
Brian Salomon
27c4202f4b Remove GrBitmapTextureMaker.
Replace with two methods in SkGr.h that make cached/uncached texture
proxies from SkBitmap. Move code that makes a GrFP from the proxy
to SkImage_Raster::asFragmentProcessor.

Bug: skia:11877
Change-Id: I51a0ae687561be9b0e44b98ee50f171e42476d94
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/401920
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-04-28 17:24:56 +00:00
Brian Salomon
354147a23c Replace GrConstColorProcessor with a runtime FP
Change-Id: Ie36ea4d5186f6cca341efc6300b813ec8255bdbb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/388457
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-04-14 18:40:18 +00:00
Mike Reed
2ac6ce8e6e Simplify common case for recttorect
Change-Id: I70e295a677b8cac3d578e3cd57472c833af03877
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/354336
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2021-01-15 18:37:46 +00:00
Brian Salomon
1aa1f5fcba whole-word replace renderTargetContext with surfaceDrawContext
TBR:egdaniel@google.com

Change-Id: Ia471dfc1278bcbeb2b485e4deeb3e932060c50a6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/343576
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-12-11 23:24:40 +00:00
Brian Salomon
eebe735dea GrRenderTargetContext->GrSurfaceDrawContext
Just the class/files. variable names and additional comments to follow.

Change-Id: Ic03d07fd5009eaf3d706c2536486a117328963fc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/342617
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2020-12-10 18:51:19 +00:00
Brian Salomon
70fe17e12f Remove GrRenderTargetContextPriv and GrSurfaceContextPriv
I think this is vestigial from some time in the past where RTC was
public.

Also just expose the methods that add ops rather than have so many
friends + testingOnly versions.

Change-Id: I60d9fdff23b2d67039a7b37815da7ff9e73d8999
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/339158
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-11-30 20:13:25 +00:00
Adlai Holler
a069304560 Rename GrContextPriv to GrDirectContextPriv
Change-Id: I3fccadd8a2860dbee73f93f995738146373f8a39
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/326196
Commit-Queue: Adlai Holler <adlai@google.com>
Auto-Submit: Adlai Holler <adlai@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-10-14 16:46:01 +00:00
John Stiles
7571f9e490 Replace 'typedef xxxxx INHERITED' with 'using INHERITED = xxxx;'.
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>
2020-09-03 03:41:26 +00:00
John Stiles
a6841be235 Enable ClangTidy check llvm-namespace-comment.
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>
2020-08-06 19:07:52 +00:00
Brian Salomon
f7353515be Add nearest MIP filtering to GPU and wire up to SkImageShader
Change-Id: I04b949f8962d35aed5c5e8b4d4290dc5157073d2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305404
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2020-07-28 14:04:13 +00:00
Brian Salomon
e69b9efcb3 Separate MIP filtering from min/mag filtering.
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>
2020-07-22 16:05:05 +00:00
Brian Salomon
69100f05bb Rename GrCaps fields and methods from MipMap to Mipmap
Change-Id: I44d151dc80aca8fc6426735ee17224cb5b8aa576
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304603
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-07-21 15:56:21 +00:00
Brian Salomon
7e67dcaea6 Rename GrMipMapped GrMipmapped
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>
2020-07-21 14:06:35 +00:00
Brian Salomon
a3b02f5278 Rename GrSamplerState::Filter::kBilerp to kLinear
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>
2020-07-15 23:14:14 +00:00
Robert Phillips
95c250c247 Downgrade GpuGMs to only receiving a GrRecordingContext
Most of this CL is just noise (i.e., all the header changes) due to the
signature change. The 'discard' GM has some substantive changes but
that's about it.

Change-Id: I72011a442c149b5db93cf8decade6779be4f63d8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/296704
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-06-30 13:02:33 +00:00
Mike Reed
1f60733fb3 Revert "Revert "move onto new factories for SkMatrix""
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>
2020-05-21 16:58:39 +00:00
Mike Reed
c80ee456ad Revert "move onto new factories for SkMatrix"
This reverts commit 046c2b7d90.

Reason for revert: need to update/guard flutter

Original change's description:
> move onto new factories for SkMatrix
> 
> Just rename, no functional changes expected.
> 
> Change-Id: Id77ab1cf6b1cab35087a7c56000750912cf47383
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/290831
> Commit-Queue: Mike Reed <reed@google.com>
> Reviewed-by: Florin Malita <fmalita@chromium.org>

TBR=fmalita@chromium.org,reed@google.com

Change-Id: Ic74f177128913374b8c60b4df88f04cf72fbacb3
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/291359
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-05-21 16:05:20 +00:00
Mike Reed
046c2b7d90 move onto new factories for SkMatrix
Just rename, no functional changes expected.

Change-Id: Id77ab1cf6b1cab35087a7c56000750912cf47383
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/290831
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2020-05-21 15:04:09 +00:00
Brian Salomon
bc074a68df Add SkBudgeted parameter to SkImage::makeTextureImage().
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>
2020-03-18 17:27:41 +00:00
Brian Salomon
ecbb0fb2d5 Simplify view getters on GrTextureProducer.
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>
2020-03-01 00:32:04 +00:00
Brian Salomon
b3779f53f5 Remove GrTextureEffect::MakeTexelSubset.
Originally there was a distinction WRT half pixel insetting, but as I
learned more about what the call sites expected the distinction was
erased. Callers with a SkIRect can just convert to SkRect.

Change-Id: Ib1e117baffdb532ba09a668da7f851d02c2c5206
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/270941
Commit-Queue: Brian Salomon <bsalomon@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Auto-Submit: Brian Salomon <bsalomon@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2020-02-14 18:32:05 +00:00
Brian Salomon
f46f19b98c Add support for implementing ShaderMode::kRepeat with MIPs in GrTextureEffect.
Change-Id: I12ea00b35967f13e81410c584e34b62eea6c2ffe
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/270445
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2020-02-14 13:52:27 +00:00
Brian Salomon
53c909e05f Support bilerp filtering for all ShaderModes in GrTextureEffect.
Support MIP map for all but kRepeat.

Update texel_subset_ GMs to exercise newly supported modes.

Also makes GrTextureEffect do shader wrap modes for rectangle/
external textures even when not subsetted.

Change-Id: Ie2d299106120b5c6cc40365e8f300cc426dd5489
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268163
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-02-14 01:49:35 +00:00
Brian Salomon
16033c9cc1 Update texel_subset_* GMs.
Draw placeholder gray rectangles rather than omitting cols/rows.

Swap x and y mode iteration so they correspond with GM layout.

Change-Id: I3c2d95bcd5d684f5a5a99cb677c326864e13f252
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/270641
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2020-02-13 18:50:05 +00:00
Greg Daniel
d2ccbb522e Have GrTextureEffect factories take a view as input.
Bug: skia:9556
Change-Id: I06fd7e9bc7e370a5b8891220308a6d362336be9e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268632
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2020-02-05 16:19:57 +00:00
Greg Daniel
c61d7e3d6e Rename various getters related to GrSurfaceProxyView.
Bug: skia:9556
Change-Id: Ib418beeb6c62854462a6023ebe410c7ca76e6dec
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268620
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Auto-Submit: Greg Daniel <egdaniel@google.com>
2020-02-05 14:29:08 +00:00
Greg Daniel
cc104db12c Have GrTextureProducer return views instead of proxies.
Bug: skia:9556
Change-Id: Ieedb9c48914c637278203d4d462c19b2d85b27d4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268396
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2020-02-03 20:42:21 +00:00
Brian Salomon
63a04a8701 Choose a less evil scale factor texel_subset_nearest_upscale decal tests
The existing scale factor put the decal edge exactly on a pixel center
causing some jaggies as different row columns has slightly different
interpolated values and fell on different sides of the decal edge,

Change-Id: I396395f68366e3cfc3b0c0ce11466c43dd4e60ea
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268306
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-02-03 19:21:21 +00:00
Brian Salomon
f1e316ff39 Make lines in texel_subset GM be at half pixel offsets
As it stands they're at integers and so snap differently on different
GPUs.

Change-Id: I80b955a728aa590af12d9307ba2c36731d333594
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268170
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-02-02 13:23:52 +00:00
Brian Salomon
f033404de8 Improvements to texture_domain GMs
Rename to texel_subset.

Test different x/y wrap modes.

Use a real image that is non-square.

Add dividers to group MakeTexelSubset() with Make() reference draw.

Use a smaller image, fewer matrices, and only one subset rect to
make room for the additional mode combinations.

Change-Id: I3fab54cb7f160b92c7e5192e64a8a09f5c837492
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/267976
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-02-01 22:27:31 +00:00