Commit Graph

51 Commits

Author SHA1 Message Date
Brian Salomon
d61c9d93b1 Move ref counting out of GrProcessor and into subclasses.
This will allow different subclasses to use different models for lifetime management.

GrXferProcessor moves to simple ref counting since they don't own GrGpuResources.

This also constifies GrXferProcessor factories.

Change-Id: I6bea0ea8de718874063224232f9da50887868b16
Reviewed-on: https://skia-review.googlesource.com/11792
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2017-04-10 15:38:47 +00:00
Brian Salomon
ab015efc48 Move the ability to access textures, buffers, and image storages out from GrProcessor.
GrXferProcessor can no longer use this functionality so it is moved to a new intermediate class inherited by GrFragmentProcessor and GrPrimitiveProcessor.

Change-Id: I4f30c89bdceb2d77b602bf0646107e0780881c26
Reviewed-on: https://skia-review.googlesource.com/11202
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2017-04-04 15:27:44 +00:00
Brian Osman
32342f032e Rebase and fix chromium
Combine texture provider and resource provider

Largely mechanical. Only three places that were calling createApprox
via texture provider (ie without flags), so that was simple.

BUG=skia:

Change-Id: I876367bcdc6a8db736deedab1028de1972015509
Reviewed-on: https://skia-review.googlesource.com/9176
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2017-03-04 13:49:47 +00:00
Robert Phillips
30f9bc69cf Switch GrTextureStripAtlas over to GrTextureProxies
This is split out of: https://skia-review.googlesource.com/c/8823/ (Remove GrFragmentProcessor-derived class' GrTexture-based ctors)

Change-Id: I9f602985b6010fc58b595e2be6d4e67e50179747
Reviewed-on: https://skia-review.googlesource.com/8881
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2017-02-23 15:01:42 +00:00
Ethan Nicholas
3865711259 Replaced all calls to fragmentPosition() with sk_FragCoord
Change-Id: I2ed4558aea74b3ae7ee11dfe4736cdbcb16ae49e
Reviewed-on: https://skia-review.googlesource.com/8278
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2017-02-13 14:49:09 +00:00
Ethan Nicholas
cae3a4c8ab Revert "Replaced all calls to fragmentPosition() with sk_FragCoord"
This reverts commit de4d301881.

Reason for revert: several Chrome rendering bugs on Mac

BUG=skia:

Change-Id: I492082b0b7e7c902ede4b598c5809f604d210ce1
Reviewed-on: https://skia-review.googlesource.com/7887
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2017-02-02 18:34:02 +00:00
Robert Phillips
901f29ad3e Allow GrSingleTextureEffect to take GrTextureProxies
Change-Id: I1dd441a5838f665c6815a5c629f5763f43f66e09
Reviewed-on: https://skia-review.googlesource.com/7429
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2017-01-24 22:03:40 +00:00
Robert Phillips
bc7a4fb067 Make GrYUVEffect take GrTextureProxies
This opens the door for swapping all the effects over to taking GrTextureProxies.

Change-Id: I3b03ba93a68f9945c9a8fee008fd170ed57616eb
Reviewed-on: https://skia-review.googlesource.com/7344
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2017-01-24 12:23:28 +00:00
Ethan Nicholas
de4d301881 Replaced all calls to fragmentPosition() with sk_FragCoord
BUG=skia:

Change-Id: I179576e148ea6caf6e1c40f0a216421898bcb35d
Reviewed-on: https://skia-review.googlesource.com/5941
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2017-01-19 22:36:26 +00:00
Brian Salomon
bc6b99d22e Add test for processor->resource ref/io counts
Change-Id: I63a8cb9f1564bfc15ef98121b77946a647c79f32
Reviewed-on: https://skia-review.googlesource.com/6814
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2017-01-11 16:01:07 +00:00
Brian Salomon
e57194f74d Move resource ref/io manipulation from GrProgramElement to GrProcessor
Change-Id: I783e74107f7d34b57d80b843fe23ce7126b77424
Reviewed-on: https://skia-review.googlesource.com/6816
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2017-01-09 21:51:05 +00:00
Brian Salomon
f9f451213a Reland image storage with fixes.
Revert "Revert "Initial OpenGL Image support.""

This reverts commit 59dc41175d.

BUG=skia:

Change-Id: Ibe3c87ce7f746f065fdbcc5a518388cc291112f5
Reviewed-on: https://skia-review.googlesource.com/5131
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2016-11-29 17:42:53 +00:00
Brian Salomon
59dc41175d Revert "Initial OpenGL Image support."
This reverts commit be34882042.

Reason for revert: Test failures and shader compilation issues on Android.

Original change's description:
> Initial OpenGL Image support.
> 
> This change along with recently landed changes is enough to make the new unit test work and not much else. imageLoad is support but not stores or any other image functions (atomics). Barriers in the shading language or the GL API are not yet hooked up.
> 
> GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4182
> 
> Change-Id: I5958b7c89e40ae5ee05f7bbaca3b3738162fe5ce
> Reviewed-on: https://skia-review.googlesource.com/4182
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Reviewed-by: Chris Dalton <csmartdalton@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>
> 

TBR=egdaniel@google.com,bsalomon@google.com,csmartdalton@google.com,reviews@skia.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Change-Id: I29a2502c296ae39ed9a999957800414ae46e6f0f
Reviewed-on: https://skia-review.googlesource.com/5129
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2016-11-23 01:02:57 +00:00
Brian Salomon
be34882042 Initial OpenGL Image support.
This change along with recently landed changes is enough to make the new unit test work and not much else. imageLoad is support but not stores or any other image functions (atomics). Barriers in the shading language or the GL API are not yet hooked up.

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4182

Change-Id: I5958b7c89e40ae5ee05f7bbaca3b3738162fe5ce
Reviewed-on: https://skia-review.googlesource.com/4182
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2016-11-22 21:35:11 +00:00
Brian Salomon
b014cca49d Make GrBufferAccess a nested class of GrProcessor
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4978

Change-Id: I08c24e9183108f4dd6068216488fd3ac9b5f3ec2
Reviewed-on: https://skia-review.googlesource.com/4978
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2016-11-18 17:17:46 +00:00
Brian Salomon
514baff8be Rename GrTextureParams to GrSamplerParams
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4965

Change-Id: I7d52e81c670e92ca96117284f44b274ce3cc3671
Reviewed-on: https://skia-review.googlesource.com/4965
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2016-11-17 21:13:18 +00:00
Brian Salomon
db4183d227 In GrProcessor::TextureSampler drop the "get", it's cleaner
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4962

Change-Id: I55e7f8d1b6e1097fdbe411e9989dd42a03dd5f33
Reviewed-on: https://skia-review.googlesource.com/4962
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2016-11-17 19:35:53 +00:00
Brian Salomon
0bbecb21ab Rename GrTextureAccess to GrProcessor::TextureSampler.
Renames vars and methods that used the work "access" to refer to this type.

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4931

Change-Id: Ibcf488fbd445c5119fc13d190544cd98981bdbee
Reviewed-on: https://skia-review.googlesource.com/4931
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2016-11-17 17:18:53 +00:00
Brian Salomon
55e0346f4b Make addTexture/BufferAccess on GrProcessor non-virtual
Perhaps these needed to be virtual in the past, but no longer.

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4120

Change-Id: I1ba713a1da713f2c7955c0cfc9931917f2719a63
Reviewed-on: https://skia-review.googlesource.com/4120
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2016-10-28 16:01:32 +00:00
mtklein
59c12e3f00 remove non-static uses of SkOncePtr
Still slowly working through all the SK_DECLARE_STATIC_FOO macros.

SkOncePtr is complicating things by having SkOncePtr delete its pointer
and SkBaseOncePtr not.  Simplify things by removing SkOncePtr, leaving
only the leaky SkBaseOncePtr.

We replace SkOncePtr<T> instead with SkOnce and T.  In most cases this
did not need to be a pointer, and in some cases here we're even saving
a few bytes by replacing SkOncePtr<T> with SkOnce and a T.

The dependency map of SK_DECLARE_STATIC_FOO is:
  SkBaseMutex -> SkBaseSemaphore -> SkBaseOncePtr

They're intertwined enough that I think I've got to do all three in one
next CL.

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1939503002

Review-Url: https://codereview.chromium.org/1939503002
2016-05-02 07:19:41 -07:00
cdalton
74b8d32332 Implement texel buffers
Adds a mechanism for processors to add buffer accesses and implements
them in the GL backend.

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1870893002

Review URL: https://codereview.chromium.org/1870893002
2016-04-11 14:47:28 -07:00
cdalton
28f45b949a Add "sample locations" feature to GrProcessor
Adds a "sample locations" feature to GrProcessor. When enabled, this
allows a processor to know inside the shader where all the samples are
located. Also adds various infastructure to query, cache, and identify
multisample data.

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1717393002

Review URL: https://codereview.chromium.org/1717393002
2016-03-07 13:58:26 -08:00
cdalton
87332103c6 Replace fWillReadFragmentPosition with a bitfield
Replaces fWillReadFragmentPosition on GrProcessor with a
"RequiredFeatures" bitfield. This will allow us to add additional
built-in features. Completely removes information about reading the
fragment position from GrPipeline and GrProcOptInfo.

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1734163002

Review URL: https://codereview.chromium.org/1734163002
2016-02-26 12:22:02 -08:00
robertphillips
e004bfc0a5 Increase the amount of debug information printed out by batches
Untangling MDB bugs requires more information. In particular the render targets.

BUG=skia:4094
TBR=bsalomon@google.com

Review URL: https://codereview.chromium.org/1443763002
2015-11-16 09:06:59 -08:00
mdempsky
38f1f6f9e5 Remove overly complicated GR_CREATE_STATIC_PROCESSOR macro
This macro was responsible for producing code like:

    static SkAlignedStorage<sizeof(Foo)> g_gFoo_Storage;
    static Foo* gFoo = new(g_gFoo_Storage.get()) Foo;
    static SkAutoTDestroy<Foo> gFoo_ad(gFoo);

which would allocate static storage for an object of type Foo
(g_gFoo_Storage), lazily instantiate the object in that memory (via
gFoo's initializer), and then ensure that at global destruction time
the object is destroyed (via gFoo_Ad's destructor).

However, the exact same effect is achieved by just writing:

    static Foo gFoo;

Review URL: https://codereview.chromium.org/1314763009
2015-08-27 12:57:01 -07:00
wangyix
93ab254b7e This change is in preparation for updating how processor keys and meta keys are generated for frag procs.
BUG=skia:4182

Review URL: https://codereview.chromium.org/1298233002
2015-08-19 08:23:12 -07:00
wangyix
58d890bd45 All child GrFragmentProcs' transforms and textures will be stored in the root GrFragmentProc in preorder
Changed childProcessor(i) to return const referencd

Fixed rootProc/parentProc offset issues; renamed a few things.

added nonempty check to gatherTransforms to avoid segfault

removed recursive append_gr_coord_transforms() from GrGLProgramBuilder

BUILDS! Changed num*includeProc() calls to num() calls

added gatherCoordTransforms(). added coordTransforms() for root proc only

Modified GrFragmentProcessor to append child proc transforms and textures to root proc's arrays.

BUG=skia:4182

Review URL: https://codereview.chromium.org/1275853005
2015-08-12 09:40:47 -07:00
mtklein
2766c00fc0 remove SkInstCnt
It's been outclassed by Valgrind and leak sanitizer,
and it seems to be causing problems for external folks building Skia.

I'm not sure why our own builds seem unaffected.

Latest thread:
https://groups.google.com/forum/#!topic/skia-discuss/oj9FsQwwSF0

BUG=skia:

Review URL: https://codereview.chromium.org/1217573002
2015-06-26 11:45:03 -07:00
joshualitt
56995b5cc0 Remove GP from drawstate, revision of invariant output for GP
BUG=skia:

Committed: https://skia.googlesource.com/skia/+/c6bc58eded89b0c0a36b8e20e193c200f297a0da

Review URL: https://codereview.chromium.org/791743003
2014-12-11 15:44:02 -08:00
joshualitt
8c0f615fdd Revert of Remove GP from drawstate, revision of invariant output for GP (patchset #9 id:160001 of https://codereview.chromium.org/791743003/)
Reason for revert:
breaks mac

Original issue's description:
> Remove GP from drawstate, revision of invariant output for GP
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/c6bc58eded89b0c0a36b8e20e193c200f297a0da

TBR=bsalomon@google.com,egdaniel@google.com,joshualitt@chromium.org
NOTREECHECKS=true
NOTRY=true
BUG=skia:

Review URL: https://codereview.chromium.org/794843002
2014-12-10 14:12:22 -08:00
joshualitt
c6bc58eded Remove GP from drawstate, revision of invariant output for GP
BUG=skia:

Review URL: https://codereview.chromium.org/791743003
2014-12-10 13:48:57 -08:00
joshualitt
eb2a676165 Remove backend factories
BUG=skia:

Review URL: https://codereview.chromium.org/778453002
2014-12-04 11:35:34 -08:00
egdaniel
605dd0fbce Move GrInvariantOutput out of GrProcessor and into its own class.
This will help with the ability to subclass, add to, etc. GrInvariantOutput. Also it was simply
getting a little too big to be a "supporting" subclass
BUG=skia:

Review URL: https://codereview.chromium.org/699943003
2014-11-12 08:35:25 -08:00
bsalomon
420d7e9a79 Auto-compare GrProcessors' texture accesses in isEqual().
R=joshualitt@google.com

Review URL: https://codereview.chromium.org/654313002
2014-10-16 09:18:09 -07:00
egdaniel
9e4d6d180f Move willUseInputColor check to computeInvariantOutput
BUG=skia:

Review URL: https://codereview.chromium.org/656503002
2014-10-15 13:49:02 -07:00
bsalomon
b762cb548b More effect->processor cleanup
R=joshualitt@google.com

Review URL: https://codereview.chromium.org/660563003
2014-10-15 11:25:21 -07:00
bsalomon
98b33ebe6f Some cleanup in processor header files.
R=joshualitt@google.com

Review URL: https://codereview.chromium.org/659803004
2014-10-15 11:05:26 -07:00
bsalomon
6251d17dfa Split GrFragmentProcessor into its own header
Review URL: https://codereview.chromium.org/660573002
2014-10-15 10:50:36 -07:00
bsalomon
0e08fc17e4 Push isEqual/onIsEqual down from GrProcessor to subclasses.
R=joshualitt@google.com

Review URL: https://codereview.chromium.org/654273002
2014-10-15 08:19:04 -07:00
egdaniel
ab84fae29f Track if all stages modulate inputColor in computeInvariantOutput
BUG=skia:

Review URL: https://codereview.chromium.org/647863002
2014-10-14 06:48:46 -07:00
egdaniel
ccb2e384a0 Create helper functions to use in computeInvariantOutput calls
BUG=skia:

Review URL: https://codereview.chromium.org/643743003
2014-10-13 12:53:46 -07:00
joshualitt
a5305a110a Opt state takes a GP instead of a GeometryStage
BUG=skia:

Committed: https://skia.googlesource.com/skia/+/71856d520461ae025a0332aa0ce9735a096d9baf

Review URL: https://codereview.chromium.org/637003003
2014-10-10 17:47:00 -07:00
joshualitt
89c7a2ec3e Revert of Opt state takes a GP instead of a GeometryStage (patchset #18 id:1500001 of https://codereview.chromium.org/637003003/)
Reason for revert:
Revert because this may be causing a break in a chrome gpu test

Original issue's description:
> Opt state takes a GP instead of a GeometryStage
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/71856d520461ae025a0332aa0ce9735a096d9baf

TBR=bsalomon@google.com,egdaniel@google.com,danakj@chromium.org
NOTREECHECKS=true
NOTRY=true
BUG=skia:

Review URL: https://codereview.chromium.org/647183002
2014-10-10 14:11:59 -07:00
joshualitt
71856d5204 Opt state takes a GP instead of a GeometryStage
BUG=skia:

Review URL: https://codereview.chromium.org/637003003
2014-10-10 09:56:55 -07:00
joshualitt
651713408c gl programs rewrite
BUG=skia:

Committed: https://skia.googlesource.com/skia/+/07a255310aca9f3e83bf741dc663a58818ad681c

Review URL: https://codereview.chromium.org/628633003
2014-10-09 07:25:36 -07:00
joshualitt
d909759832 Revert of gl programs rewrite (patchset #10 id:180001 of https://codereview.chromium.org/628633003/)
Reason for revert:
breaks angle bot

Original issue's description:
> gl programs rewrite
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/07a255310aca9f3e83bf741dc663a58818ad681c

TBR=bsalomon@google.com,egdaniel@google.com
NOTREECHECKS=true
NOTRY=true
BUG=skia:

Review URL: https://codereview.chromium.org/631183003
2014-10-07 08:37:36 -07:00
joshualitt
07a255310a gl programs rewrite
BUG=skia:

Review URL: https://codereview.chromium.org/628633003
2014-10-07 08:05:21 -07:00
egdaniel
1a8ecdfb73 Add isSingleComponent bool to getConstantColorComponent
Initial step to allowing effects to use/output 1 or 4 color/coverage components. This cl doesn't change any current logic and all effects still assume they are working with 4 components.

BUG=skia:

Committed: https://skia.googlesource.com/skia/+/3b8af078281a5a20f951b9fd84f38d92b8f6217b

Review URL: https://codereview.chromium.org/608253002
2014-10-03 06:24:12 -07:00
robertphillips
b4b7a4c9ea Revert of Add isSingleComponent bool to getConstantColorComponent (patchset #6 id:100001 of https://codereview.chromium.org/608253002/)
Reason for revert:
Changing some GMs

Original issue's description:
> Add isSingleComponent bool to getConstantColorComponent
>
> Initial step to allowing effects to use/output 1 or 4 color/coverage components. This cl doesn't change any current logic and all effects still assume they are working with 4 components.
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/3b8af078281a5a20f951b9fd84f38d92b8f6217b

TBR=joshualitt@chromium.org,bsalomon@google.com,reed@google.com,egdaniel@google.com
NOTREECHECKS=true
NOTRY=true
BUG=skia:

Review URL: https://codereview.chromium.org/617853003
2014-10-02 12:12:48 -07:00
egdaniel
3b8af07828 Add isSingleComponent bool to getConstantColorComponent
Initial step to allowing effects to use/output 1 or 4 color/coverage components. This cl doesn't change any current logic and all effects still assume they are working with 4 components.

BUG=skia:

Review URL: https://codereview.chromium.org/608253002
2014-10-02 09:57:48 -07:00