Commit Graph

203 Commits

Author SHA1 Message Date
joshualitt
f78c60c92a Revert of move program descriptor generation to flush (patchset #7 id:120001 of https://codereview.chromium.org/777673003/)
Reason for revert:
breaking linux build

Original issue's description:
> move program descriptor generation to flush
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/829e1b80b1020b17f2078020c990e079b70c077c

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

Review URL: https://codereview.chromium.org/776243005
2014-12-04 06:01:45 -08:00
joshualitt
829e1b80b1 move program descriptor generation to flush
BUG=skia:

Review URL: https://codereview.chromium.org/777673003
2014-12-03 13:57:37 -08:00
joshualitt
2dd1ae016d First step to moving vertex attributes to the geometryProcessor
BUG=skia:

Review URL: https://codereview.chromium.org/761563002
2014-12-03 06:24:10 -08:00
joshualitt
267ce482b5 remove proc key
BUG=skia:

Review URL: https://codereview.chromium.org/755363002
2014-11-25 14:52:21 -08:00
bsalomon
932f866987 Create GrOptDrawState directly in the cmd buffer in GrIODB.
Review URL: https://codereview.chromium.org/746243002
2014-11-24 06:47:48 -08:00
bsalomon
b03c4a35bd Don't use NULL GrOptDrawState to indicate that draw should be skipped.
Review URL: https://codereview.chromium.org/742853002
2014-11-20 09:56:11 -08:00
joshualitt
54e0c12a5a scissor state on optstate
waiting

BUG=skia:

Review URL: https://codereview.chromium.org/742763002
2014-11-19 09:38:51 -08:00
bsalomon
ae59b77612 Create GrOptDrawState before recording draw in GrInOrderDrawBuffer
Review URL: https://codereview.chromium.org/739673002
2014-11-19 08:23:49 -08:00
joshualitt
9853ccef19 Drawstate on stack
BUG=skia:

Review URL: https://codereview.chromium.org/732693002
2014-11-17 14:22:49 -08:00
joshualitt
5478d427c6 Push creation of default GP to the caller
TBR=
BUG=skia:

Review URL: https://codereview.chromium.org/715903002
2014-11-14 16:00:38 -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
joshualitt
2c93efeb6f Clip in grdrawtarget
NOTREECHECKS=true
BUG=skia:

Review URL: https://codereview.chromium.org/685883003
2014-11-06 12:57:13 -08:00
egdaniel
37b4d866b1 Force input coverage to be only a byte in gpu shaders.
Prime coverage invariant output calculations with single component

BUG=skia:

Review URL: https://codereview.chromium.org/649783003
2014-11-03 10:07:07 -08:00
joshualitt
7a6184fdf7 cleanup reentrance logic in CMM
BUG=skia:

Review URL: https://codereview.chromium.org/684223002
2014-10-29 18:29:27 -07:00
joshualitt
79f8faeea2 OptState owns program descriptor
BUG=skia:

Review URL: https://codereview.chromium.org/674543004
2014-10-28 17:59:26 -07:00
bsalomon
f2703d83da rename GrTextureDesc->GrSurfaceDesc, GrTextureFlags->GrSurfaceFlags
Review URL: https://codereview.chromium.org/682223002
2014-10-28 14:33:06 -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
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
bsalomon
d27726eccb Fix leak in GLPrograms test.
TBR=joshualitt@google.com

Review URL: https://codereview.chromium.org/648063002
2014-10-12 05:40:01 -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
1598899975 FPs now use the correct builder types(just a rename)
BUG=skia:

Review URL: https://codereview.chromium.org/648463003
2014-10-09 15:04:05 -07:00
joshualitt
9e87fa7c0e Force linking of static member variables for GLPrograms
BUG=skia:

Review URL: https://codereview.chromium.org/614163002
2014-10-09 13:12:35 -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
47bb382830 Cleanup of shader building system
this is a huge refactor and cleanup of the gl shader building system in
Skia.  The entire shader building pipeline is now part of
GrGLProgramCreator, which takes a gp, and some fps, and creates a
program.  I added some subclasses of GrGLProgram to handle the
eccentricities of Nvpr/Nvpres.  Outside of the builders folder
and GrGLPrograms, this change is basically just a rename

solo gp

BUG=skia:

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

Review URL: https://codereview.chromium.org/611653002
2014-10-07 16:43:25 -07:00
joshualitt
db0d3ca070 Revert of Cleanup of shader building system (patchset #25 id:470001 of https://codereview.chromium.org/611653002/)
Reason for revert:
Seems to have messed up windows 7 gms

Original issue's description:
> Cleanup of shader building system
>
> this is a huge refactor and cleanup of the gl shader building system in
> Skia.  The entire shader building pipeline is now part of
> GrGLProgramCreator, which takes a gp, and some fps, and creates a
> program.  I added some subclasses of GrGLProgram to handle the
> eccentricities of Nvpr/Nvpres.  Outside of the builders folder
> and GrGLPrograms, this change is basically just a rename
>
>
> solo gp
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/fe1233c3f12f81bb675718516bbb32f72af726ec

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

Review URL: https://codereview.chromium.org/635533005
2014-10-07 12:42:26 -07:00
joshualitt
fe1233c3f1 Cleanup of shader building system
this is a huge refactor and cleanup of the gl shader building system in
Skia.  The entire shader building pipeline is now part of
GrGLProgramCreator, which takes a gp, and some fps, and creates a
program.  I added some subclasses of GrGLProgram to handle the
eccentricities of Nvpr/Nvpres.  Outside of the builders folder
and GrGLPrograms, this change is basically just a rename

solo gp

BUG=skia:

Review URL: https://codereview.chromium.org/611653002
2014-10-07 12:16: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
b109ac22b4 Make createOptDrawState return NULL if we would end up not drawing
BUG=skia:

Review URL: https://codereview.chromium.org/630063002
2014-10-07 06:45:44 -07:00
egdaniel
307796bc2e Plumb OptDrawState down to VertexShaderBuilder
BUG=skia:

Review URL: https://codereview.chromium.org/628293002
2014-10-06 12:13:54 -07:00
joshualitt
b0a8a377f8 Patch to create a distinct geometry processor. The vast majority of this patch
is just a rename.  The meat is in GrGeometryProcessor, GrProcessor,
GrGL*Processor, GrProcessorStage, Gr*BackendProcessorFactory,
GrProcessUnitTestFactory, and the builders

BUG=skia:
R=bsalomon@google.com

Author: joshualitt@chromium.org

Review URL: https://codereview.chromium.org/582963002
2014-09-23 09:50:21 -07:00
egdaniel
c06482494d Calculate Primary and Secondary output types in the GrOptDrawState
Follow up CL to https://codereview.chromium.org/545693004/

BUG=skia:
R=bsalomon@google.com

Author: egdaniel@google.com

Review URL: https://codereview.chromium.org/554833002
2014-09-22 13:17:03 -07:00
egdaniel
ae444965c4 Change GrGLProgramDesc header to have DoPathRendering flag instead of RequiresVertexShader
Also update GLProgramTests to fix bug where it would incorrectly try to PathRendering when we did
not want to.

BUG=skia:
R=bsalomon@google.com, joshualitt@chromium.org

Author: egdaniel@google.com

Review URL: https://codereview.chromium.org/586793002
2014-09-22 12:29:52 -07:00
bsalomon
43d361f7fa Stop calling rand() in debug-only code for GLProgramsTest
R=egdaniel@google.com

Author: bsalomon@google.com

Review URL: https://codereview.chromium.org/584913002
2014-09-19 07:47:08 -07:00
egdaniel
a7dc0a83f0 Calculate stage stats in GrOptDrawState
BUG=skia:
R=bsalomon@google.com

Author: egdaniel@google.com

Review URL: https://codereview.chromium.org/545693004
2014-09-17 08:25:05 -07:00
joshualitt
49586bec73 removing GrDrawEffect
BUG=skia:

Committed: https://skia.googlesource.com/skia/+/8ddbe8b9366c8c59c4fb55f01f253de8a0b37d6e

R=bsalomon@google.com

Author: joshualitt@chromium.org

Review URL: https://codereview.chromium.org/571163002
2014-09-16 08:21:42 -07:00
joshualitt
08da4f22d7 Revert of removing GrDrawEffect (patchset #4 id:60001 of https://codereview.chromium.org/571163002/)
Reason for revert:
reverting to unblock another revert

Original issue's description:
> removing GrDrawEffect
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/8ddbe8b9366c8c59c4fb55f01f253de8a0b37d6e

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

Author: joshualitt@chromium.org

Review URL: https://codereview.chromium.org/577593003
2014-09-16 07:17:28 -07:00
joshualitt
8ddbe8b936 removing GrDrawEffect
BUG=skia:
R=bsalomon@google.com

Author: joshualitt@chromium.org

Review URL: https://codereview.chromium.org/571163002
2014-09-16 06:46:30 -07:00
joshualitt
249af15fb8 BUG=skia:
R=bsalomon@google.com, egdaniel@google.com, jvanverth@google.com, robertphillips@google.com

Author: joshualitt@chromium.org

Review URL: https://codereview.chromium.org/543623004
2014-09-15 11:41:14 -07:00
bsalomon
49f085dddf "NULL !=" = NULL
R=reed@google.com

Author: bsalomon@google.com

Review URL: https://codereview.chromium.org/544233002
2014-09-05 13:34:00 -07:00
joshualitt
bd769d0f1c Initial change to create GeometryProcessor
BUG=skia:
R=bsalomon@google.com, robertphillips@google.com, egdaniel@google.com, jvanverth@google.com

Author: joshualitt@chromium.org

Review URL: https://codereview.chromium.org/509153002
2014-09-04 08:56:46 -07:00
kkinnunen
ec56e45454 Implement NV_path_rendering on OpenGL ES
Implement support for NV_path_rendering on OpenGL ES. Use
glProgramPathFragmentInputGenNV function call instead of glPathTexGenNV to
communicate transforms to fragment shader.

The intention is that the NVPR paths will be drawn with the same shader program
as non-NVPR geometry. For NVPR calls, the GPU will skip the vertex shader and
just run the fragment shader.

After program is linked, query the locations of the fragment shader inputs with
glGetResourceLocation. The location will be used to set the transforms with
glProgramPathFragmentInputGenNV.

The functions and their workings are documented in:

glProgramPathFragmentInputGenNV
https://www.opengl.org/registry/specs/NV/path_rendering.txt
(note: addition as of API version 1.3)

glGetResourceLocation
https://www.opengl.org/registry/specs/ARB/program_interface_query.txt
http://www.opengl.org/registry/doc/glspec44.core.pdf
(function is in core Open GL 4.4)

Note: glProgramPathFragmentInputGenNV could be used also for OpenGL. However,
using seems to trigger a bug in the driver. Disable this feature on OpenGL at
least until the driver is fixed and released. The bug manifests in shadertext
test, where the lower-left text pair is missing. Valgrind catches a bad read
for the test and causes the context to OOM reproducibly.

R=bsalomon@google.com, cdalton@nvidia.com, joshualitt@google.com, joshualitt@chromium.org

Author: kkinnunen@nvidia.com

Review URL: https://codereview.chromium.org/367643004
2014-08-25 22:21:16 -07:00
joshualitt
30ba436f04 Initial refactor of shaderbuilder to prepare for geometry shaders
gitignore for eclipse

BUG=skia:
R=bsalomon@google.com, bsalomon@chromium.org

Author: joshualitt@chromium.org

Review URL: https://codereview.chromium.org/491673002
2014-08-21 20:18:45 -07:00
reed
9fa60daad4 Simplify flattening to just write enough to call the factory/public-constructor for the class. We want to *not* rely on private constructors, and not rely on calling through the inheritance hierarchy for either flattening or unflattening(CreateProc).
Refactoring pattern:

1. guard the existing constructor(readbuffer) with the legacy build-flag
2. If you are a instancable subclass, implement CreateProc(readbuffer) to create a new instances from the buffer params (or return NULL).

If you're a shader subclass
1. You must read/write the local matrix if your class accepts that in its factory/constructor, else ignore it.

R=robertphillips@google.com, mtklein@google.com, senorblanco@google.com, senorblanco@chromium.org, sugoi@chromium.org

Author: reed@google.com

Review URL: https://codereview.chromium.org/395603002
2014-08-21 07:59:51 -07:00
egdaniel
02cafcc1bf Remove gpu shader optimatization for solid white or trans black colors
Running test on the added bench which draws a grid of all white paths, all blue paths, or alternating checkered white/blue paths.

With optimization in (ms):
         White       Blue        Checkered
Linux    ~80         ~80         ~160
N7       ~800        ~1100       ~1500
Moto-e   ~830        ~1100       ~2500

Without optimization in (ms):
         White       Blue        Checkered
Linux    ~80         ~80         ~80
N7       ~1100       ~1100       ~1100
Moto-e   ~1100       ~1100       ~1500

BUG=skia:

Committed: https://skia.googlesource.com/skia/+/5f78d2251a440443c9eaa321dad058d7a32bfef7

R=bsalomon@google.com

Author: egdaniel@google.com

Review URL: https://codereview.chromium.org/375823005
2014-07-21 11:37:28 -07:00
bsalomon
e904c09a3a Fix alpha textures in NV ES3 contexts on Windows.
Make unit tests iterate over all the rendering GL context types rather than using kNative.

Fix the extension printing when gStartupSpew is set.

R=jvanverth@google.com

Author: bsalomon@google.com

Review URL: https://codereview.chromium.org/398183002
2014-07-17 10:50:59 -07:00
bsalomon
929f29a5c1 Makes GrGLProgramDesc's key store the lengths as well as offsets of the effect keys.
Makes it possible to use GrBackendEffectFactories other than GrTBEF by moving meta-key generation out of GrTBEF.

Cleans up docs around GrBackendEffectFactory.

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

R=robertphillips@google.com, jvanverth@google.com

Author: bsalomon@google.com

Review URL: https://codereview.chromium.org/379113004
2014-07-17 07:55:11 -07:00
mtklein
7940100fae Revert of Makes GrGLProgramDesc's key store the lengths as well as offsets of the effect keys. (https://codereview.chromium.org/379113004/)
Reason for revert:
Most likely candidate for Valgrind failures:

[21:10:08.755668] ==3036== Use of uninitialised value of size 8
[21:10:08.755753] ==3036==    at 0x734AB2: GrGpuGL::ProgramCache::getProgram(GrGLProgramDesc const&, GrEffectStage const**, GrEffectStage const**) (GrGpuGL_program.cpp:107)
[21:10:08.755788] ==3036==    by 0x734ED2: GrGpuGL::flushGraphicsState(GrGpu::DrawType, GrDeviceCoordTexture const*) (GrGpuGL_program.cpp:253)
[21:10:08.755811] ==3036==    by 0x6E81C2: GrGpu::setupClipAndFlushState(GrGpu::DrawType, GrDeviceCoordTexture const*, GrDrawState::AutoRestoreEffects*, SkRect const*) (GrGpu.cpp:350)
[21:10:08.755837] ==3036==    by 0x6E9BE8: GrGpu::onDraw(GrDrawTarget::DrawInfo const&) (GrGpu.cpp:390)
[21:10:08.755858] ==3036==    by 0x6EEECE: GrInOrderDrawBuffer::flush() (GrDrawTarget.h:506)
[21:10:08.755879] ==3036==    by 0x6D0EB4: GrContext::flush(int) (GrContext.cpp:1327)
[21:10:08.755900] ==3036==    by 0x6D3F8F: GrContext::writeTexturePixels(GrTexture*, int, int, int, int, GrPixelConfig, void const*, unsigned long, unsigned int) (GrContext.cpp:1349)
[21:10:08.755922] ==3036==    by 0x6D39D7: GrContext::writeRenderTargetPixels(GrRenderTarget*, int, int, int, int, GrPixelConfig, void const*, unsigned long, unsigned int) (GrContext.cpp:1632)
[21:10:08.755949] ==3036==    by 0x6FFDF3: GrRenderTarget::writePixels(int, int, int, int, GrPixelConfig, void const*, unsigned long, unsigned int) (GrRenderTarget.cpp:45)
[21:10:08.755978] ==3036==    by 0x735563: SkGpuDevice::onWritePixels(SkImageInfo const&, void const*, unsigned long, int, int) (SkGpuDevice.cpp:280)
[21:10:08.756003] ==3036==    by 0x57A048: SkBaseDevice::writePixels(SkImageInfo const&, void const*, unsigned long, int, int) (SkDevice.cpp:106)
[21:10:08.756025] ==3036==    by 0x56D0AE: SkCanvas::writePixels(SkImageInfo const&, void const*, unsigned long, int, int) (SkCanvas.cpp:700)
[21:10:08.756050] ==3036==    by 0x56D156: SkCanvas::writePixels(SkBitmap const&, int, int) (SkCanvas.cpp:652)
[21:10:08.756077] ==3036==    by 0x5109B6: test_WritePixels(skiatest::Reporter*, GrContextFactory*) (WritePixelsTest.cpp:464)
[21:10:08.756099] ==3036==    by 0x51114C: skiatest::WritePixelsClass::onRun(skiatest::Reporter*) (WritePixelsTest.cpp:361)
[21:10:08.756122] ==3036==    by 0x406BE8: skiatest::Test::run() (Test.cpp:107)
[21:10:08.756145] ==3036==    by 0x4064C2: SkTestRunnable::run() (skia_test.cpp:109)
[21:10:08.756167] ==3036==    by 0x405D1A: tool_main(int, char**) (skia_test.cpp:221)
[21:10:08.756189] ==3036==    by 0x405F75: main (skia_test.cpp:239)
[21:10:08.756211] ==3036==  Uninitialised value was created by a stack allocation
[21:10:08.756233] ==3036==    at 0x734CC8: GrGpuGL::flushGraphicsState(GrGpu::DrawType, GrDeviceCoordTexture const*) (GrGpuGL_program.cpp:213)

Original issue's description:
> Makes GrGLProgramDesc's key store the lengths as well as offsets of the effect keys.
>
> Makes it possible to use GrBackendEffectFactories other than GrTBEF by moving meta-key generation out of GrTBEF.
>
> Cleans up docs around GrBackendEffectFactory.
>
> Committed: https://skia.googlesource.com/skia/+/c0ea398aff8254e31152cbb94c9ab6150428e252

R=robertphillips@google.com, jvanverth@google.com, bsalomon@google.com
TBR=bsalomon@google.com, jvanverth@google.com, robertphillips@google.com
NOTREECHECKS=true
NOTRY=true

Author: mtklein@google.com

Review URL: https://codereview.chromium.org/394213002
2014-07-16 06:16:43 -07:00
bsalomon
c0ea398aff Makes GrGLProgramDesc's key store the lengths as well as offsets of the effect keys.
Makes it possible to use GrBackendEffectFactories other than GrTBEF by moving meta-key generation out of GrTBEF.

Cleans up docs around GrBackendEffectFactory.

R=robertphillips@google.com, jvanverth@google.com

Author: bsalomon@google.com

Review URL: https://codereview.chromium.org/379113004
2014-07-15 19:41:17 -07:00
bsalomon
848faf00ec This moves us towards variable length effect keys. The overall program key now allows for it. After the header it stores an array of offsets to effect keys. This allows us to grab the effect keys to pass to effects when they generate code. It also ensures that we can't get a collision by sets of keys that are different lengths but are the same when appended together.
R=robertphillips@google.com, jvanverth@google.com, egdaniel@google.com

Author: bsalomon@google.com

Review URL: https://codereview.chromium.org/356513003
2014-07-11 10:01:02 -07:00
bsalomon
83d081ae1d Goodbye GrEffectRef.
Also, reworked some var names and comments around SkShader::asNewEffect.

R=robertphillips@google.com

Author: bsalomon@google.com

Review URL: https://codereview.chromium.org/374923002
2014-07-08 09:56:11 -07:00
bsalomon
97b9ab72cd Make GrDrawState and GrPaint take GrEffect* instead of GrEffectRef*.
Make Sk-effect virtuals produce GrEffect* rather than GrEffectRef*

Make GrEffectRef a typedef for GrEffect.

Committed: https://skia.googlesource.com/skia/+/2011fe9cdfa63b83489a146cea6a724cede352c8

R=robertphillips@google.com

Author: bsalomon@google.com

Review URL: https://codereview.chromium.org/377503004
2014-07-08 06:52:35 -07:00
reed
969842ac9c Revert of Make GrDrawState and GrPaint take GrEffect* instead of GrEffectRef*. (https://codereview.chromium.org/377503004/)
Reason for revert:
broke linux builders

Original issue's description:
> Make GrDrawState and GrPaint take GrEffect* instead of GrEffectRef*.
>
> Make Sk-effect virtuals produce GrEffect* rather than GrEffectRef*
>
> Make GrEffectRef a typedef for GrEffect.
>
> Committed: https://skia.googlesource.com/skia/+/2011fe9cdfa63b83489a146cea6a724cede352c8

R=robertphillips@google.com, bsalomon@google.com
TBR=bsalomon@google.com, robertphillips@google.com
NOTREECHECKS=true
NOTRY=true

Author: reed@google.com

Review URL: https://codereview.chromium.org/372053003
2014-07-07 15:17:49 -07:00
bsalomon
2011fe9cdf Make GrDrawState and GrPaint take GrEffect* instead of GrEffectRef*.
Make Sk-effect virtuals produce GrEffect* rather than GrEffectRef*

Make GrEffectRef a typedef for GrEffect.

R=robertphillips@google.com

Author: bsalomon@google.com

Review URL: https://codereview.chromium.org/377503004
2014-07-07 15:11:31 -07:00
bsalomon
f99f884cd8 Remove use of GrEffectRef from draw state and below.
R=robertphillips@google.com

Author: bsalomon@google.com

Review URL: https://codereview.chromium.org/372773002
2014-07-07 11:54:23 -07:00
commit-bot@chromium.org
cac5fd597f Factory methods for heap-allocated SkImageFilter objects.
This is part of an effort to ensure that all SkPaint effects can only be
allocated on the heap.

This patch makes the constructors of SkImageFilter and its subclasses non-public
and instead provides factory methods for creating these objects on the heap. We
temporarily keep constructor of publicly visible classes public behind a flag.

BUG=skia:2187
R=scroggo@google.com, mtklein@chromium.org, reed@google.com, senorblanco@google.com, senorblanco@chromium.org, bsalomon@google.com, sugoi@chromium.org, zork@chromium.org

Author: dominikg@chromium.org

Review URL: https://codereview.chromium.org/182983003

git-svn-id: http://skia.googlecode.com/svn/trunk@13718 2bbb7eff-a529-9590-31e7-b0007b416f81
2014-03-10 10:51:58 +00:00
commit-bot@chromium.org
4324c3ba70 Fix warnings on Ubuntu13
Turn off warnings when building libwebp.
Turn off warnings when building libjpeg.
Initialize some variables immediately.

NOTRY=True
NOTREECHECKS=True

BUG=skia:2213
BUG=skia:2214
R=bsalomon@google.com, halcanary@google.com

Author: scroggo@google.com

Review URL: https://codereview.chromium.org/175383002

git-svn-id: http://skia.googlecode.com/svn/trunk@13545 2bbb7eff-a529-9590-31e7-b0007b416f81
2014-02-21 20:11:42 +00:00
commit-bot@chromium.org
727a352f74 Factory methods for heap-allocated SkColorFilter objects.
This is part of an effort to ensure that all SkPaint effects can only be
allocated on the heap.

This patch makes the constructors of SkColorFilter and its subclasses non-public
and instead provides factory methods for creating these objects on the heap. We
temporarily keep constructor of publicly visible classes public behind a flag.

BUG=skia:2187
R=scroggo@google.com, mtklein@google.com, reed@google.com

Author: dominikg@chromium.org

Review URL: https://codereview.chromium.org/175293002

git-svn-id: http://skia.googlecode.com/svn/trunk@13539 2bbb7eff-a529-9590-31e7-b0007b416f81
2014-02-21 18:46:30 +00:00
commit-bot@chromium.org
8a13588b6f Stop discarding in frag shader when coverage is zero and stencil writes are enabled
This fixes the corruption in the NVPR images here:
http://108.170.217.252:10117/builders/Test-Win8-ShuttleA-GTX660-x86-Debug/builds/251/steps/CompareGMs/logs/stdio

caused by:

https://skia.googlesource.com/skia.git/+/65ee5f424cb4dabd453268902c00086605d77c1d

The stencil path step writes inside and outside the clip when the clip is implemented by
a coverage effect. The path cover step then doesn't write outside of the clip because the FS
discards. This leaves stencil values outside of the clip non-zero which messed up subsequent
path or clip draws to those samples.

R=robertphillips@google.com

Author: bsalomon@google.com

Review URL: https://codereview.chromium.org/154623002

git-svn-id: http://skia.googlecode.com/svn/trunk@13320 2bbb7eff-a529-9590-31e7-b0007b416f81
2014-02-05 16:29:12 +00:00
commit-bot@chromium.org
65ee5f424c Use GrConvexPolyEffect when clip is a single convex polygon
BUG=skia:2051

Committed: http://code.google.com/p/skia/source/detail?r=13286

R=robertphillips@google.com

Author: bsalomon@google.com

Review URL: https://codereview.chromium.org/151523005

git-svn-id: http://skia.googlecode.com/svn/trunk@13306 2bbb7eff-a529-9590-31e7-b0007b416f81
2014-02-04 17:49:48 +00:00
tfarina@chromium.org
8f6884aab8 Cleanup: Sanitize the order of includes under tests/
Initially this was to make sure Test.h appeared after the Sk*.h includes.

Patch generated by the following command line:

$ ~/chromium/src/tools/sort-headers.py tests/*.cpp

BUG=None
TEST=tests
R=robertphillips@google.com

Review URL: https://codereview.chromium.org/145313004

git-svn-id: http://skia.googlecode.com/svn/trunk@13177 2bbb7eff-a529-9590-31e7-b0007b416f81
2014-01-24 20:56:26 +00:00
commit-bot@chromium.org
e2eac8b2fd Move macros from TestClassDef.h to Test.h
Motivation: those macros don't make any sense without the definitions
in Test.h.

BUG=
R=mtklein@google.com

Author: halcanary@google.com

Review URL: https://codereview.chromium.org/138563004

git-svn-id: http://skia.googlecode.com/svn/trunk@13074 2bbb7eff-a529-9590-31e7-b0007b416f81
2014-01-14 21:04:37 +00:00
tfarina@chromium.org
4ee16bfaed Add a DEF_GPUTEST() macro.
This macro is similar to DEF_TEST() and simplifies the process of
setting up a GPU test.

BUG=skia:1952
TEST=tests
R=mtklein@google.com

Review URL: https://codereview.chromium.org/132293005

git-svn-id: http://skia.googlecode.com/svn/trunk@13033 2bbb7eff-a529-9590-31e7-b0007b416f81
2014-01-10 22:08:27 +00:00
commit-bot@chromium.org
9109e188c7 Fix build warnings in SkAlphaThresholdFilter
BUG=None
R=bsalomon@google.com

Author: zork@chromium.org

Review URL: https://codereview.chromium.org/101763010

git-svn-id: http://skia.googlecode.com/svn/trunk@12937 2bbb7eff-a529-9590-31e7-b0007b416f81
2014-01-07 16:04:01 +00:00
commit-bot@chromium.org
40eb3c1000 Add AlphaThreshold filter.
This is based on the Bitmap Alpha Threshold filter, and will be used by Chromium
to implement the window shape API.

R=bsalomon@chromium.org, wez@chromium.org, bsalomon@google.com, reed@google.com

Author: zork@chromium.org

Review URL: https://codereview.chromium.org/115633002

git-svn-id: http://skia.googlecode.com/svn/trunk@12935 2bbb7eff-a529-9590-31e7-b0007b416f81
2014-01-06 23:41:14 +00:00
commit-bot@chromium.org
9cfa287bc7 Remove SkBitmapAlphaThresholdShader
R=bsalomon@google.com

Author: zork@chromium.org

Review URL: https://codereview.chromium.org/108653012

git-svn-id: http://skia.googlecode.com/svn/trunk@12759 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-12-18 21:58:53 +00:00
commit-bot@chromium.org
a34995e18b Implement SkColorFilter as a GrGLEffect
Adds GrEffect::willUseInputColor() which indicates whether or not the
input color affects the output of the effect. This is needed for
certain Xfermodes, such as kSrc_Mode. For these modes the color filter
will not use the input color.

An effect with GrEffect::willUseInputColor() true will cause all color
or coverage effects before it to be discarded, as their computations
cannot affect the output. In these cases program is marked as having
white input color.

This fixes an assert when Skia is compiled in a mode that prefers
using uniforms instead of attributes for constants. (Flags
GR_GL_USE_NV_PATH_RENDERING or GR_GL_NO_CONSTANT_ATTRIBUTES). Using
attributes hides the problem where the fragment shader does not need
input color for color filters that ignore DST part of the filter. The
assert would be hit when uniform manager tries to bind an uniform which
has been optimized away by the shader compiler.

Adds specific GrGLSLExpr4 and GrGLSLExpr1 classes. This way the GLSL
expressions like "(v - src.a)" can remain somewhat readable in form of
"(v - src.a())". The GrGLSLExpr<typename> template implements the
generic functionality, GrGLSLExprX is the specialization that exposes
the type-safe interface to this functionality.

Also adds operators so that GLSL binary operators of the form
"(float * vecX)" can be expressed in C++. Before only the equivalent
"(vecX * float)" was possible. This reverts the common blending
calculations to more conventional order, such as "(1-a) * c" instead of
"c * (1-a)".

Changes GrGLSLExpr1::OnesStr from 1 to 1.0 in order to preserve the
color filter blending formula string the same (with the exception of
variable name change).

Shaders change in case of input color being needed:
 -   vec4 filteredColor;
 -   filteredColor = (((1.0 - uFilterColor.a) * output_Stage0) + uFilterColor);
 -   fsColorOut = filteredColor;
 +   vec4 output_Stage1;
 +   { // Stage 1: ModeColorFilterEffect
 +   output_Stage1 = (((1.0 - uFilterColor_Stage1.a) * output_Stage0) + uFilterColor_Stage1);
 +   }
 +   fsColorOut = output_Stage1;

Shaders change in case of input color being not needed:
 -uniform vec4 uFilterColor;
 -in vec4 vColor;
 +uniform vec4 uFilterColor_Stage0;
  out vec4 fsColorOut;
  void main() {
 -   vec4 filteredColor;
 -   filteredColor = uFilterColor;
 -   fsColorOut = filteredColor;
 +   vec4 output_Stage0;
 +   { // Stage 0: ModeColorFilterEffect
 +   output_Stage0 = uFilterColor_Stage0;
 +   }
 +   fsColorOut = output_Stage0;
  }

R=bsalomon@google.com, robertphillips@google.com, jvanverth@google.com

Author: kkinnunen@nvidia.com

Review URL: https://codereview.chromium.org/25023003

git-svn-id: http://skia.googlecode.com/svn/trunk@11912 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-10-23 05:42:03 +00:00
commit-bot@chromium.org
8e919add40 Fix GrProgramsTest to not generate tests with too many TexCoord references
Make GrProgramsTest check how many texture coordinate sets are
available and select random effects up until the amount runs out.

Otherwise, following effect sequence would fail the shader compilation
when Skia is compiled with nv_path_rendering on (eg. when fixed
function codepath is used):
 * Stage 0: TextureDomain (1 texcoord)
 * Stage 1: Convolution (1 texcoord)
 * Stage 2: Bitmap Alpha Threshold (2 texcoords)
 * Stage 3: DisplacementMap (2 texcoords)
 * Stage 4: Config Conversion (1 texcoords)
 * Stage 5: Two-Point Conical Gradient (2 texcoords)

This would use more texture coordinate sets than 8, which is fairly
common amount currently.

R=bsalomon@google.com, cdalton@nvidia.com

Author: kkinnunen@nvidia.com

Review URL: https://codereview.chromium.org/32403002

git-svn-id: http://skia.googlecode.com/svn/trunk@11881 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-10-21 14:48:23 +00:00
commit-bot@chromium.org
6b30e45740 Use vertexless shaders when NVpr is available
Adds support for vertexless shaders and enables them when
NV_path_rendering is available. This takes a
GrGLFragmentOnlyShaderBuilder class, a GrGLTexGenEffectArray class,
support for setting TexGen and the projection matrix in GrGpuGL, and
code for setting the GL fixed function state where necessary.

R=bsalomon@google.com, kkinnunen@nvidia.com

Author: cdalton@nvidia.com

Review URL: https://codereview.chromium.org/25846002

git-svn-id: http://skia.googlecode.com/svn/trunk@11620 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-10-04 20:02:53 +00:00
commit-bot@chromium.org
949eef0af2 Use explicitly-sized enums in GrGLProgramDesc::KeyHeader
Uses enums explicitly sized to 8 bits in GrGLProgramDesc::KeyHeader,
instead of storing them as uint8_t values. This avoids the need to
static_cast them.

R=bsalomon@google.com

Author: cdalton@nvidia.com

Review URL: https://codereview.chromium.org/23875048

git-svn-id: http://skia.googlecode.com/svn/trunk@11560 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-10-01 18:43:29 +00:00
commit-bot@chromium.org
e0e7cfe44b Change old PRG to be SkLCGRandom; change new one to SkRandom
The goal here is to get people to start using the new random number
generator, while leaving the old one in place so we don't have to 
rebaseline GMs.

R=reed@google.com, bsalomon@google.com

Author: jvanverth@google.com

Review URL: https://chromiumcodereview.appspot.com/23576015

git-svn-id: http://skia.googlecode.com/svn/trunk@11169 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-09-09 20:09:12 +00:00
commit-bot@chromium.org
91a798f121 alpha threshold bitmap shader
Committed: http://code.google.com/p/skia/source/detail?r=11122

R=reed@google.com

Author: bsalomon@google.com

Review URL: https://chromiumcodereview.appspot.com/23707019

git-svn-id: http://skia.googlecode.com/svn/trunk@11131 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-09-06 15:31:06 +00:00
bsalomon@google.com
67db510c9c Revert "alpha threshold bitmap shader"
This reverts commit r11122.

git-svn-id: http://skia.googlecode.com/svn/trunk@11123 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-09-05 22:48:05 +00:00
commit-bot@chromium.org
4ec4cf93b7 alpha threshold bitmap shader
R=reed@google.com

Author: bsalomon@google.com

Review URL: https://chromiumcodereview.appspot.com/23707019

git-svn-id: http://skia.googlecode.com/svn/trunk@11122 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-09-05 21:54:04 +00:00
commit-bot@chromium.org
9188a15f84 Add a GrGpuGL reference for GrGLProgram/GrGLUniformManager
Updates GrGLProgram and GrGLUniformManager to keep a GrGpuGL reference
instead of one for GrGLContextInfo. No change in functionality, this
is in preparation to support fixed function GL calls for vertexless
shaders.

R=bsalomon@google.com

Author: cdalton@nvidia.com

Review URL: https://chromiumcodereview.appspot.com/23636011

git-svn-id: http://skia.googlecode.com/svn/trunk@11111 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-09-05 18:28:24 +00:00
commit-bot@chromium.org
2d3b492013 Remove possiblity of NULL effect in GrEffectStage
R=jvanverth@google.com

Author: bsalomon@google.com

Review URL: https://chromiumcodereview.appspot.com/18295008

git-svn-id: http://skia.googlecode.com/svn/trunk@10075 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-07-15 13:54:06 +00:00
bsalomon@google.com
eb6879f50a Replace fixed-size array of effect stages in GrDrawState with two appendable arrays, one for color, one for coverage.
R=robertphillips@google.com

Review URL: https://codereview.chromium.org/16952006

git-svn-id: http://skia.googlecode.com/svn/trunk@9592 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-06-13 19:34:18 +00:00
bsalomon@google.com
2c84aa3598 separate arrays for color and coverage effects.
R=robertphillips@google.com

Review URL: https://codereview.chromium.org/16180006

git-svn-id: http://skia.googlecode.com/svn/trunk@9465 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-06-06 20:28:57 +00:00
bsalomon@google.com
2db3ded335 Make GrGLProgramDesc's key variable length by compacting the effect key array
R=robertphillips@google.com

Review URL: https://codereview.chromium.org/15252004

git-svn-id: http://skia.googlecode.com/svn/trunk@9239 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-05-22 14:34:04 +00:00
bsalomon@google.com
b515881446 Key shader on whether frag pos read is relative to top-left or bottom-left
R=robertphillips@google.com

Review URL: https://codereview.chromium.org/14633007

git-svn-id: http://skia.googlecode.com/svn/trunk@9113 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-05-13 18:50:25 +00:00
commit-bot@chromium.org
8d47ddc19a Make GrGLShaderBuilder check whether GrEffect advertised that it would require the dst color or fragment position
R=senorblanco@chromium.org, robertphillips@google.com

Author: bsalomon@google.com

Review URL: https://chromiumcodereview.appspot.com/14998007

git-svn-id: http://skia.googlecode.com/svn/trunk@9074 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-05-09 14:55:46 +00:00
bsalomon@google.com
504976ef6f Move loops that chain together effects into GrGLShaderBuilder from GrGLProgram.
R=robertphillips@google.com

Review URL: https://codereview.chromium.org/14925010

git-svn-id: http://skia.googlecode.com/svn/trunk@9073 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-05-09 13:45:02 +00:00
bsalomon@google.com
8da9bc751e Add all remaining separable xfer modes to GPU backend.
Review URL: https://codereview.chromium.org/14189024

git-svn-id: http://skia.googlecode.com/svn/trunk@8768 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-04-19 15:03:21 +00:00
bsalomon@google.com
72993ab542 silence && || parens clang warning.
git-svn-id: http://skia.googlecode.com/svn/trunk@8764 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-04-19 13:25:28 +00:00
bsalomon@google.com
5920ac2768 Perform coverage blend with the dst in the shader when using a dst-reading xfermode.
Review URL: https://codereview.chromium.org/14233006

git-svn-id: http://skia.googlecode.com/svn/trunk@8762 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-04-19 13:14:45 +00:00
skia.committer@gmail.com
05a2ee052c Sanitizing source files in Skia_Periodic_House_Keeping
git-svn-id: http://skia.googlecode.com/svn/trunk@8477 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-04-02 07:01:34 +00:00
jvanverth@google.com
054ae99d93 Take two for r8466:
Replace the old attribute binding and index interface with one where we include the binding as part of the attribute array. Also removed the fixed attribute indices for constant color and coverage attributes, and replaced with dynamic ones based on current attribute set. Removed binding of color and coverage attributes unless they're actually set.

Original author: bsalomon@google.com

Author: jvanverth@google.com

Reviewed By: bsalomon@google.com,robertphillips@google.com

Review URL: https://chromiumcodereview.appspot.com/13296005


git-svn-id: http://skia.googlecode.com/svn/trunk@8468 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-04-01 20:06:51 +00:00
jvanverth@google.com
c7bf2963f0 Rolling back r8466.
Not reviewed.


git-svn-id: http://skia.googlecode.com/svn/trunk@8467 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-04-01 19:29:32 +00:00
commit-bot@chromium.org
fb495b537f Revise attribute binding interface.
Replace the old attribute binding and index interface with one where we include the binding as part of the attribute array. Also removed the fixed attribute indices for constant color and coverage attributes, and replaced with dynamic ones based on current attribute set. Removed binding of color and coverage attributes unless they're actually set.

Original author: bsalomon@google.com

Author: jvanverth@google.com

Reviewed By: bsalomon@google.com,robertphillips@google.com

Review URL: https://chromiumcodereview.appspot.com/13296005

git-svn-id: http://skia.googlecode.com/svn/trunk@8466 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-04-01 19:12:42 +00:00
bsalomon@google.com
b79d865f03 Fix GLPrograms test.
Review URL: https://codereview.chromium.org/13327008

git-svn-id: http://skia.googlecode.com/svn/trunk@8450 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-03-29 20:30:50 +00:00
bsalomon@google.com
31ec7985f2 Move GrGLProgram::Desc out of GrGLProgram.
Review URL: https://codereview.chromium.org/12942014

git-svn-id: http://skia.googlecode.com/svn/trunk@8411 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-03-27 18:14:57 +00:00
skia.committer@gmail.com
37cbc7fd01 Sanitizing source files in Skia_Periodic_House_Keeping
git-svn-id: http://skia.googlecode.com/svn/trunk@8404 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-03-27 07:01:04 +00:00
bsalomon@google.com
26ec00ea1b Fix unit test build break
git-svn-id: http://skia.googlecode.com/svn/trunk@8394 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-03-26 16:49:37 +00:00
bsalomon@google.com
4647f90598 Replace edge types with GrEdgeEffect.
This strips out last of the edge types and the fixed function edge attribute and replaces them with using GrEdgeEffect. Also fixes a minor bug when checking attribute counts -- it was using kAttribIndexCount instead of kVertexAttribCnt. 

Original Author: jvanverth@google.com
Review URL: https://codereview.chromium.org/13069003

git-svn-id: http://skia.googlecode.com/svn/trunk@8392 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-03-26 14:45:27 +00:00
bsalomon@google.com
c26d94fd7d Move nested class GrDrawTarget::Caps out as GrDrawTargetCaps.
Pass caps to GrEffect::TestCreate() functions so that they can return effects that will work with the capabilities.
Review URL: https://codereview.chromium.org/12965018

git-svn-id: http://skia.googlecode.com/svn/trunk@8369 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-03-25 18:19:00 +00:00
bsalomon@google.com
bcce892652 Make GrDrawTarget::Caps ref counted and GrGLCaps derive from it.
Also rename GrDrawTarget::getCaps() -> GrDrawTarget::caps().
Review URL: https://codereview.chromium.org/12843026

git-svn-id: http://skia.googlecode.com/svn/trunk@8364 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-03-25 15:38:39 +00:00
commit-bot@chromium.org
9ae78506bd Stop the GLPrograms unit test from generating out of range attrib indices for effects.
R=jvanverth@google.com

Author: bsalomon@google.com

Reviewed By: jvanverth@google.com

Review URL: https://chromiumcodereview.appspot.com/12834013

git-svn-id: http://skia.googlecode.com/svn/trunk@8298 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-03-21 17:44:39 +00:00
bsalomon@google.com
c78188896e Attempt to reland 8264-5 with warning-as-error fixes.
git-svn-id: http://skia.googlecode.com/svn/trunk@8272 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-03-20 19:19:53 +00:00