Commit Graph

5963 Commits

Author SHA1 Message Date
egdaniel
da743935fa Revert of Refactoring of GPU NormalMap handling out into its own class (patchset #7 id:120001 of https://codereview.chromium.org/2043393002/ )
Reason for revert:
Breaking build and deps roll. Need to move include of SkBitmapProcShader in SkLightingShader.cpp from gpu include list to general list.

Original issue's description:
> Refactoring of GPU NormalMap handling out into its own class.
>
> The purpose of this change is to refactor the handling of normal maps out of SkLightingShader, laying the groundwork to eventually allow for multiple normal sources.
>
> What this CL includes:
>
> - Created a new 'NormalMapFP', out of the existing normal map reading behavior in LightingFP.
>
> - Encapsulates this new fragment processor on a new class NormalMapSource.
>
> - Created a NormalSource abstraction that will interface with SkLightingShader.
>
> - Adapted SkLightingShader to use the normals from its NormalSource field ON THE GPU SIDE. No changes done to the CPU side yet.
>
> BUG=skia:
> GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2043393002
>
> Committed: https://skia.googlesource.com/skia/+/87b0dd00cf9409c5fc990f5d0bb7c0df837f08da

TBR=reed@google.com,dvonbeck@google.com
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:

Review-Url: https://codereview.chromium.org/2062133004
2016-06-14 15:30:05 -07:00
dvonbeck
87b0dd00cf Refactoring of GPU NormalMap handling out into its own class.
The purpose of this change is to refactor the handling of normal maps out of SkLightingShader, laying the groundwork to eventually allow for multiple normal sources.

What this CL includes:

- Created a new 'NormalMapFP', out of the existing normal map reading behavior in LightingFP.

- Encapsulates this new fragment processor on a new class NormalMapSource.

- Created a NormalSource abstraction that will interface with SkLightingShader.

- Adapted SkLightingShader to use the normals from its NormalSource field ON THE GPU SIDE. No changes done to the CPU side yet.

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

Review-Url: https://codereview.chromium.org/2043393002
2016-06-14 14:43:52 -07:00
bsalomon
4999616c3a Remove command buffer sample app support.
This hasn't compiled for months. We are deemphasizing SampleApp in favor of viewer. Windowed command buffer is not currently something we currently plan to maintain.

TBR=reed@google.com

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

Review-Url: https://codereview.chromium.org/2061233002
2016-06-14 09:43:52 -07:00
jvanverth
6b6ffc4ab6 Create free list heap for suballocation
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2029763002

Review-Url: https://codereview.chromium.org/2029763002
2016-06-13 14:28:07 -07:00
mtklein
f8f9c07c28 Revert of Update typeface serialization style. (patchset #3 id:40001 of https://codereview.chromium.org/2030683002/ )
Reason for revert:
serialize-8888 broken for typefacestyles on Mac.  (Bold weighting goes missing.)

Original issue's description:
> Update typeface serialization style.
> GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2030683002
>
> Committed: https://skia.googlesource.com/skia/+/7ae1c72e593823e6e300e4199558555765bcec17

TBR=reed@google.com,bungeman@google.com
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Review-Url: https://codereview.chromium.org/2067583002
2016-06-13 11:27:55 -07:00
ericrk
b4da01d8f7 Add prescale option to deferred params
Currently, Skia always uploads GPU textures at full resolution. This
change allows us to pass a pre-scale mip level to the
deferred texture image logic, which causes us to pre-scale the image
to the given mip level, and upload that mip level instead of the full
image.
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2007113008

Review-Url: https://codereview.chromium.org/2007113008
2016-06-13 11:18:14 -07:00
bungeman
7ae1c72e59 Update typeface serialization style.
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2030683002

Review-Url: https://codereview.chromium.org/2030683002
2016-06-13 10:35:05 -07:00
brianosman
fe19987e54 Better (?) interface for controlling sRGB-ness of mipmaps on GrTexture
Switch to new SkSourceGammaTreatment type. Move to a separate setter,
rather than an optional argument to dirty. Set the flag correctly after
uploading CPU-built mips.

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

Review-Url: https://codereview.chromium.org/2058143002
2016-06-13 07:59:48 -07:00
csmartdalton
2b5f2cbf0d Move multisampleDisableSupport into GrCaps
Non-platform code needs this information in order to make rendering
decisions.

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

Review-Url: https://codereview.chromium.org/2062443002
2016-06-10 14:06:32 -07:00
mtklein
f10637f279 Type-erase SkAutoMutexAcquire and SkAutoExclusive.
This is purely for convenience, to not need to write the lock type
in the guard anymore.  This should all inline away.

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

Review-Url: https://codereview.chromium.org/2055023003
2016-06-10 13:56:35 -07:00
reed
6644d9353f respect srgb gamma when building mips
Proposed policy:
- If the target is *legacy* (e.g. L32/PMColor) ignore gamma
- If the target is S32/F16 respect gamma

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

Review-Url: https://codereview.chromium.org/2029373004
2016-06-10 11:41:47 -07:00
csmartdalton
739bbb2dad Fix glDraw*Indirect prototypes
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2050403002

Review-Url: https://codereview.chromium.org/2050403002
2016-06-09 19:42:38 -07:00
mtklein
e18fa440e7 Move immintrin/arm_neon includes to where they are used.
On my Mac (so, immintrin), this improves compile time, both wall and cpu,
by about 16%.  To test I ran this on an SSD with files hot in their caches:

  $ env CC=/usr/bin/clang CXX=/usr/bin/clang++ ./gyp_skia && \
    ninja -C out/Release -t clean && \
    time ninja -C out/Release

  Before: 159 wall / 3367 cpu
          159 wall / 3368 cpu

  After:  137 wall / 2860 cpu
          136 wall / 2863 cpu

I also tried further refining immintrin down to emmintrin / tmmintrin / smmintrin etc.
That made no signficant difference, so I've kept immintrin for its simplicity.

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2045633002
CQ_EXTRA_TRYBOTS=client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot

TBR=reed@google.com
No public API changes.

Committed: https://skia.googlesource.com/skia/+/12dfaaa53c23f3d03050bde8f64136ac1f44164a
Review-Url: https://codereview.chromium.org/2045633002
2016-06-09 13:40:56 -07:00
jbauman
b445a57e6c Add NV12 texture conversion support.
If textures 1 and 2 passed into MakeFromYUVTexturesCopy are the same,
then treat the input as NV12 and sample from the g component of texture
2.

BUG=skia:5209
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2016593002

Review-Url: https://codereview.chromium.org/2016593002
2016-06-09 13:24:48 -07:00
brianosman
9a3fbf7e55 Add control of manual mipmapping to GrContextOptions
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2054623003

Committed: https://skia.googlesource.com/skia/+/97e398d98928f9497063594ebe633efe2d0f4968
Review-Url: https://codereview.chromium.org/2054623003
2016-06-09 13:11:08 -07:00
senorblanco
ea97673563 SkPictureAnalyzer: expose the number of slow GPU commands.
BUG=614724
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2031243003

Review-Url: https://codereview.chromium.org/2031243003
2016-06-09 12:43:30 -07:00
mtklein
e239547269 Revert of Add control of manual mipmapping to GrContextOptions (patchset #2 id:20001 of https://codereview.chromium.org/2054623003/ )
Reason for revert:
https://build.chromium.org/p/client.skia/builders/Test-Ubuntu-GCC-Golo-GPU-GT610-x86_64-Debug-ASAN/builds/3481/steps/test_skia%20on%20Ubuntu/logs/stdio

../../../src/gpu/gl/GrGLCaps.cpp:554:25: runtime error: load of value 187, which is not a valid value for type 'bool'
SUMMARY: AddressSanitizer: undefined-behavior ../../../src/gpu/gl/GrGLCaps.cpp:554:25 in
step returned non-zero exit code: 1

Original issue's description:
> Add control of manual mipmapping to GrContextOptions
>
> BUG=skia:
> GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2054623003
>
> Committed: https://skia.googlesource.com/skia/+/97e398d98928f9497063594ebe633efe2d0f4968

TBR=bsalomon@google.com,brianosman@google.com
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:

Review-Url: https://codereview.chromium.org/2050373002
2016-06-09 12:20:10 -07:00
msarett
804b461bc4 SkPixmap::setColorSpace
Landed for reed@ with bug fix:
Use default copy constructor for SkDraw

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

patch from issue 2057563002 at patchset 1 (http://crrev.com/2057563002#ps1)

Review-Url: https://codereview.chromium.org/2052943002
2016-06-09 11:03:45 -07:00
brianosman
97e398d989 Add control of manual mipmapping to GrContextOptions
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2054623003

Review-Url: https://codereview.chromium.org/2054623003
2016-06-09 09:39:58 -07:00
bungeman
06ca8ec87c sk_sp for Ganesh.
Convert use of GrFragmentProcessor, GrGeometryProcessor, and
GrXPFactory to sk_sp. This clarifies ownership and should
reduce reference count churn by moving ownership.

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

Review-Url: https://codereview.chromium.org/2041113004
2016-06-09 08:01:03 -07:00
csmartdalton
ecbc12b1c1 Replace targetHasUnifiedMultisampling in GrPB constructor
Replaces targetHasUnifiedMultisampling with a simpler "useHWAA". Now
the code that creates a pipeline builder needs to decide on its own
whether it should enable multisampling, rather than relying on the
builder to try and guess.

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

Review-Url: https://codereview.chromium.org/2041283002
2016-06-08 10:08:43 -07:00
halcanary
4dbbd04314 SkLeanWindows.h: #include "Windows.h" fewer places
$ git grep -l '<windows.h>' include src
    include/private/SkLeanWindows.h

    $ git grep -l SkLeanWindows.h | grep '\.h$'
    include/ports/SkTypeface_win.h
    include/utils/win/SkHRESULT.h
    include/utils/win/SkTScopedComPtr.h
    include/views/SkEvent.h
    src/core/SkMathPriv.h
    src/ports/SkTypeface_win_dw.h
    src/utils/SkThreadUtils_win.h
    src/utils/win/SkWGL.h

The same for  `#include <intrin.h>` that was found in SkMath.h.
Those functions that needed it are moved to SkMathPriv.h.

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

CQ_INCLUDE_TRYBOTS=tryserver.chromium.win:win_chromium_compile_dbg_ng,win_chromium_compile_rel_ng

Review-Url: https://codereview.chromium.org/2041943002
2016-06-07 17:21:10 -07:00
mtklein
50bcb189f8 Revert of Move immintrin/arm_neon includes to where they are used. (patchset #2 id:20001 of https://codereview.chromium.org/2045633002/ )
Reason for revert:
Appears to have broken the ARMv7 aspect of the Google3 roll in bizarre seemingly-unrelated ways.

Original issue's description:
> Move immintrin/arm_neon includes to where they are used.
>
> On my Mac (so, immintrin), this improves compile time, both wall and cpu,
> by about 16%.  To test I ran this on an SSD with files hot in their caches:
>
>   $ env CC=/usr/bin/clang CXX=/usr/bin/clang++ ./gyp_skia && \
>     ninja -C out/Release -t clean && \
>     time ninja -C out/Release
>
>   Before: 159 wall / 3367 cpu
>           159 wall / 3368 cpu
>
>   After:  137 wall / 2860 cpu
>           136 wall / 2863 cpu
>
> I also tried further refining immintrin down to emmintrin / tmmintrin / smmintrin etc.
> That made no signficant difference, so I've kept immintrin for its simplicity.
>
> BUG=skia:
> GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2045633002
> CQ_EXTRA_TRYBOTS=client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot
>
> TBR=reed@google.com
> No public API changes.
>
> Committed: https://skia.googlesource.com/skia/+/12dfaaa53c23f3d03050bde8f64136ac1f44164a

TBR=herb@google.com,mtklein@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:

Review-Url: https://codereview.chromium.org/2046213002
2016-06-07 16:46:39 -07:00
mtklein
12dfaaa53c Move immintrin/arm_neon includes to where they are used.
On my Mac (so, immintrin), this improves compile time, both wall and cpu,
by about 16%.  To test I ran this on an SSD with files hot in their caches:

  $ env CC=/usr/bin/clang CXX=/usr/bin/clang++ ./gyp_skia && \
    ninja -C out/Release -t clean && \
    time ninja -C out/Release

  Before: 159 wall / 3367 cpu
          159 wall / 3368 cpu

  After:  137 wall / 2860 cpu
          136 wall / 2863 cpu

I also tried further refining immintrin down to emmintrin / tmmintrin / smmintrin etc.
That made no signficant difference, so I've kept immintrin for its simplicity.

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2045633002
CQ_EXTRA_TRYBOTS=client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot

TBR=reed@google.com
No public API changes.

Review-Url: https://codereview.chromium.org/2045633002
2016-06-07 09:35:28 -07:00
bsalomon
ee295645bd Make GrShape track the winding direction and starting point for rrect types.
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2042813002

Review-Url: https://codereview.chromium.org/2042813002
2016-06-06 14:01:25 -07:00
brianosman
982eb7f377 Add new SkSourceGammaTreatment enum, used in situations like mipmap construction, where we need to know if we should respect (vs. ignore) the gamma encoding of sRGB tagged images. Plumb that extensively.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2037413002

Review-Url: https://codereview.chromium.org/2037413002
2016-06-06 13:10:58 -07:00
scroggo
d8d6855345 Revert of Make SkPngCodec decode progressively. (patchset #26 id:520001 of https://codereview.chromium.org/1997703003/ )
Reason for revert:
Still causing problems in Google3, e.g.

https://test.corp.google.com/ui#cl=124138817&flags=CAMQBQ==&id=OCL:124138817:BASE:124139560:1465227435491:219ffbdb&t=//third_party/skia/HEAD:dm

Original issue's description:
> Make SkPngCodec decode progressively.
>
> This is a step towards using SkCodec in Chromium, where progressive
> decoding is necessary.
>
> Switch from using png_read_row (which expects all the data to be
> available) to png_process_data, which uses callbacks when rows are
> available.
>
> Create a new API for SkCodec, which supports progressive decoding and
> scanline decoding. Future changes will switch the other clients off of
> startScanlineDecode and get/skip-Scanlines to the new API.
>
> Remove SkCodec::kNone_ScanlineOrder, which was only used for interlaced
> PNG images. In the new API, interlaced PNG fits kTopDown. Also remove
> updateCurrScanline(), which was only used by the old implementation for
> interlaced PNG.
>
> DMSrcSink:
> - In CodecSrc::kScanline_Mode, use the new method for scanline decoding
> for the supported formats (just PNG and PNG-in-ICO for now).
>
> fuzz.cpp:
> - Remove reference to kNone_ScanlineOrder
>
> SkCodec:
> - Add new APIs:
>     - startIncrementalDecode
>     - incrementalDecode
> - Remove kNone_SkScanlineOrder and updateCurrScanline()
>
> SkPngCodec:
> - Implement new APIs
> - Switch from sk_read_fn/png_read_row etc to png_process_data
> - Expand AutoCleanPng's role to decode the header and create the
>   SkPngCodec
> - Make the interlaced PNG decoder report how many lines were
>   initialized during an incomplete decode
> - Make initializeSwizzler return a bool instead of an SkCodec::Result
>   (It only returned kSuccess or kInvalidInput anyway)
>
> SkIcoCodec:
> - Implement the new APIs; supported for PNG in ICO
>
> SkSampledCodec:
> - Call the new method for decoding scanlines, and fall back to the old
>   method if the new version is unimplemented
> - Remove references to kNone_SkScanlineOrder
>
> tests/CodecPartial:
> - Add a test which decodes part of an image, then finishes the decode,
>   and compares it to the straightforward method
>
> tests/CodecTest:
> - Add a test which decodes all scanlines using the new method
> - Repurpose the Codec_stripes test to decode using the new method in
>   sections rather than all at once
> - In the method check(), add a parameter for whether the image supports
>   the new method of scanline decoding, and be explicit about whether an
>   image supports incomplete
> - Test incomplete PNG decodes. We should have been doing it anyway for
>   non-interlaced (except for an image that is too small - one row), but
>   the new method supports interlaced incomplete as well
> - Make test_invalid_parameters test the new method
> - Add a test to ensure that it's safe to fall back to scanline decoding without
>   rewinding
>
> BUG=skia:4211
>
> The new version was generally faster than the old version (but not significantly so).
>
> Some raw performance differences can be found at https://docs.google.com/a/google.com/spreadsheets/d/1Gis3aRCEa72qBNDRMgGDg3jD-pMgO-FXldlNF9ejo4o/
>
> Design doc can be found at https://docs.google.com/a/google.com/document/d/11Mn8-ePDKwVEMCjs3nWwSjxcSpJ_Cu8DF57KNtUmgLM/
>
> GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1997703003
>
> Committed: https://skia.googlesource.com/skia/+/a4b09a117d4d1ba5dda372e6a2323e653766539e
>
> Committed: https://skia.googlesource.com/skia/+/30e78c9737ff4861dc4e3fa1e4cd010680ed6965
>
> Committed: https://skia.googlesource.com/skia/+/6fb2391b2cc83ee2160b4e994faa8128975acc1f

TBR=reed@google.com,msarett@google.com,scroggo@chromium.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=skia:4211
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2044573002

Review-Url: https://codereview.chromium.org/2044573002
2016-06-06 11:26:17 -07:00
robertphillips
55fdcccf01 Remove GrRenderTarget from GrPipelineBuilder
This used to be "Declassify GrClipMaskManager and Remove GrRenderTarget and GrDrawTarget from GrPipelineBuilder"

but has been split into:
https://codereview.chromium.org/1993263002/ (Make GrAppliedClip friendless)
https://codereview.chromium.org/1997773002/ (Retract GrRenderTarget from GLProgramsTest)
https://codereview.chromium.org/1993403002/ (GrSWMaskHelper and GrSoftwarePathRenderer only need the textureProvider (not GrContext))
https://codereview.chromium.org/2004433002/ (Retract GrRenderTarget from GrTestTarget)
https://codereview.chromium.org/2015333002/ (Change parameters to GrPipelineBuilder's ctor)
https://codereview.chromium.org/2035823002/ (Make GrClipMaskManager stateless and push GrPipelineBuilder construction downstack)

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

Review-Url: https://codereview.chromium.org/1988923002
2016-06-06 06:16:21 -07:00
milko.leporis
401e77cfe1 MIPS32r2: Fix Chromium runtime crash
Crash is caused by ldxc1 instruction, which traps when double values are
not aligned on 8-byte boundaries. Problem was tracked to SkChunkAlloc which
produces pointers aligned on 4-byte boundaries leading to misalignment.

This change makes sure that SkChunkAlloc will produce pointers that are
aligned to 8 bytes.

Appropriate tests are added to tests/MemsetTest.cpp

TEST=Build Chromium with Clang and run on MIPS32r2 platform
TEST=./out/Debug/dm --match Memset
BUG=130022
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1849183004

Review-Url: https://codereview.chromium.org/1849183004
2016-06-05 13:14:21 -07:00
bungeman
69df020625 Remove some uses of SK_SUPPORT_LEGACY_TYPEFACE_PTR.
Some of the deprecated signatures are no longer used by any known
client, so remove them now to prevent future use.

TBR=reed
This doesn't add API, it just removes it.

Review-Url: https://codereview.chromium.org/2036993003
2016-06-03 14:35:06 -07:00
cblume
186d2d430b Plumbing mipmaps to the point of creation.
When creating a DeferredTextureImage we may create mipmaps.
Those mipmaps need to then be passed along for when the texture is
actually created.

R=bsalomon@google.com
BUG=578304
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2031273002

Review-Url: https://codereview.chromium.org/2031273002
2016-06-03 11:17:42 -07:00
robertphillips
976f5f0dc5 Make GrClipMaskManager stateless and push GrPipelineBuilder construction downstack
This will be followed up with a CL to remove the GrRenderTarget from the GrPipelineBuilder.

Split out of:
https://codereview.chromium.org/1988923002/ (Declassify GrClipMaskManager and Remove GrRenderTarget and GrDrawTarget from GrPipelineBuilder)

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

Review-Url: https://codereview.chromium.org/2035823002
2016-06-03 10:59:20 -07:00
robertphillips
adf5afa628 Add SampleApp slide with animating lightmapped objects & transparency
This is pulled out of the drawLitAtlas CL (may it someday land). It does nicely demonstrate animating normal mapped objects and normal maps combined with partially transparent diffuse textures.

It is a crude Asteroids game.

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

TBR=reed@google.com

Review-Url: https://codereview.chromium.org/2026393005
2016-06-03 10:12:08 -07:00
caryclark
ae92262f3b fix windows assert
Windows asserts trigger out of memory stack traces that
are confusing. This permits windows to break more
directly, stopping the IDE at the assert and providing
a less confusing stacktrace outside of the IDE.

R=reed@google.com,herb@google.com
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2039443002

Review-Url: https://codereview.chromium.org/2039443002
2016-06-03 09:42:53 -07:00
csmartdalton
1897cfd7a6 Abandon offset support with texel buffers
We don't seem to require nonzero offsets for texel buffers at this
point in time, and requiring this feature greatly reduces the number
of desktop clients that can use texel buffers. If we find a use for
offsets later we can always add it back as a separate feature.

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

Review-Url: https://codereview.chromium.org/2036953002
2016-06-03 08:50:54 -07:00
csmartdalton
5cebf8c82d Support ARB extensions for indirect drawing
Adds support for the ARB extensions and fixes incorrect logic that was
being used on the GL version for indirect drawing.

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

Review-Url: https://codereview.chromium.org/2038743002
2016-06-03 08:28:47 -07:00
msarett
2cee902847 Add color correction benchmark - with comparison to qcms
--colorImages is empty by default so this won't affect the runtime of
the bots.  To run locally, use --colorImages <path> and
--benchType skcolorcodec.

Two takeaways so far:
Color correction is (currently) slower than jpeg decodes.
Our reference solution is slower than qcms.

TBR=reed@google.com
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2035793002

Review-Url: https://codereview.chromium.org/2035793002
2016-06-03 08:25:22 -07:00
scroggo
6fb2391b2c Make SkPngCodec decode progressively.
This is a step towards using SkCodec in Chromium, where progressive
decoding is necessary.

Switch from using png_read_row (which expects all the data to be
available) to png_process_data, which uses callbacks when rows are
available.

Create a new API for SkCodec, which supports progressive decoding and
scanline decoding. Future changes will switch the other clients off of
startScanlineDecode and get/skip-Scanlines to the new API.

Remove SkCodec::kNone_ScanlineOrder, which was only used for interlaced
PNG images. In the new API, interlaced PNG fits kTopDown. Also remove
updateCurrScanline(), which was only used by the old implementation for
interlaced PNG.

DMSrcSink:
- In CodecSrc::kScanline_Mode, use the new method for scanline decoding
for the supported formats (just PNG and PNG-in-ICO for now).

fuzz.cpp:
- Remove reference to kNone_ScanlineOrder

SkCodec:
- Add new APIs:
    - startIncrementalDecode
    - incrementalDecode
- Remove kNone_SkScanlineOrder and updateCurrScanline()

SkPngCodec:
- Implement new APIs
- Switch from sk_read_fn/png_read_row etc to png_process_data
- Expand AutoCleanPng's role to decode the header and create the
  SkPngCodec
- Make the interlaced PNG decoder report how many lines were
  initialized during an incomplete decode
- Make initializeSwizzler return a bool instead of an SkCodec::Result
  (It only returned kSuccess or kInvalidInput anyway)

SkIcoCodec:
- Implement the new APIs; supported for PNG in ICO

SkSampledCodec:
- Call the new method for decoding scanlines, and fall back to the old
  method if the new version is unimplemented
- Remove references to kNone_SkScanlineOrder

tests/CodecPartial:
- Add a test which decodes part of an image, then finishes the decode,
  and compares it to the straightforward method

tests/CodecTest:
- Add a test which decodes all scanlines using the new method
- Repurpose the Codec_stripes test to decode using the new method in
  sections rather than all at once
- In the method check(), add a parameter for whether the image supports
  the new method of scanline decoding, and be explicit about whether an
  image supports incomplete
- Test incomplete PNG decodes. We should have been doing it anyway for
  non-interlaced (except for an image that is too small - one row), but
  the new method supports interlaced incomplete as well
- Make test_invalid_parameters test the new method
- Add a test to ensure that it's safe to fall back to scanline decoding without
  rewinding

BUG=skia:4211

The new version was generally faster than the old version (but not significantly so).

Some raw performance differences can be found at https://docs.google.com/a/google.com/spreadsheets/d/1Gis3aRCEa72qBNDRMgGDg3jD-pMgO-FXldlNF9ejo4o/

Design doc can be found at https://docs.google.com/a/google.com/document/d/11Mn8-ePDKwVEMCjs3nWwSjxcSpJ_Cu8DF57KNtUmgLM/

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

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

Committed: https://skia.googlesource.com/skia/+/30e78c9737ff4861dc4e3fa1e4cd010680ed6965

Review-Url: https://codereview.chromium.org/1997703003
2016-06-02 14:16:43 -07:00
reed
fbce71f1ae add MakeS32 helper to SkImageInfo, fix named-gamma constructor bug
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2035813003

Review-Url: https://codereview.chromium.org/2035813003
2016-06-02 12:40:22 -07:00
bungeman
da1aedaf13 Remove SK_SUPPORT_LEGACY_TYPEFACE_MAKE_FROM_NAME.
The define SK_SUPPORT_LEGACY_TYPEFACE_MAKE_FROM_NAME is no longer used
by any clients and the code it guards can now be removed as well.

TBR=reed
This just removes dead code.

Review-Url: https://codereview.chromium.org/2030983002
2016-06-02 10:47:19 -07:00
brianosman
33f6b3f6ee Manually generated sRGB mipmaps, with successively smaller draws.
Dirty GL-generated mipmaps whenever an sRGB texture is used with a new
value for TEXTURE_SRGB_DECODE. Add a new test rectangle to the gamma GM
that tests that textures are correctly converted to linear before
filtering when generating mipmaps.

Added a new unit test that alternates how a texture is interpreted (sRGB
or not), to verify that we rebuild mipmaps when needed, and that we get
the correct results out in both modes.

This test originally failed on four of our bots producing incorrect mips
in three different ways. I'm not real surprised, but it looks like
we can't rely on glGenerateMipmap to do the right thing, in conjunction
with TEXTURE_SRGB_DECODE.

Instead, actually create mip-chains using a series of draw calls.
(My first attempt used glBlitFramebuffer, and that still had bugs on
several bots). This approach appears to work correctly on any device
that fully supports sRGB.

Because the mipmap draws are fairly destructive to state, I had to
hoist them out of bindTexture. That means adding a second pass over
the texture accesses in the processor, at the very beginning of flush.

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

Review-Url: https://codereview.chromium.org/2007973002
2016-06-02 05:49:21 -07:00
msarett
9876ac5b30 Create SkColorSpaceXform to handle color conversions
Also adds testing of qcms color correction, so we can compare
SkColorSpaceXform outputs to qcms outputs.

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

Committed: https://skia.googlesource.com/skia/+/740cc88ee3d63c75e52d31238f2a32600cc57a8c

Review-Url: https://codereview.chromium.org/1952063002
2016-06-01 14:47:18 -07:00
scroggo
26694c32d2 Revert of Make SkPngCodec decode progressively. (patchset #24 id:480001 of https://codereview.chromium.org/1997703003/ )
Reason for revert:
Still breaking Google3 e.g.:

https://sponge.corp.google.com/target?id=9261d31b-34fc-4f0f-981e-f92f7c5cea2c&target=//third_party/skia/HEAD:dm#shard=1|run=1|attempt=1|page=-1

https://test.corp.google.com/ui#cl=123773095&flags=CAMQBQ==&id=OCL:123773095:BASE:123773415:1464804876959:b0ea9b1c&t=//third_party/skia/HEAD:dm

Original issue's description:
> Make SkPngCodec decode progressively.
>
> This is a step towards using SkCodec in Chromium, where progressive
> decoding is necessary.
>
> Switch from using png_read_row (which expects all the data to be
> available) to png_process_data, which uses callbacks when rows are
> available.
>
> Create a new API for SkCodec, which supports progressive decoding and
> scanline decoding. Future changes will switch the other clients off of
> startScanlineDecode and get/skip-Scanlines to the new API.
>
> Remove SkCodec::kNone_ScanlineOrder, which was only used for interlaced
> PNG images. In the new API, interlaced PNG fits kTopDown. Also remove
> updateCurrScanline(), which was only used by the old implementation for
> interlaced PNG.
>
> DMSrcSink:
> - In CodecSrc::kScanline_Mode, use the new method for scanline decoding
> for the supported formats (just PNG and PNG-in-ICO for now).
>
> fuzz.cpp:
> - Remove reference to kNone_ScanlineOrder
>
> SkCodec:
> - Add new APIs:
>     - startIncrementalDecode
>     - incrementalDecode
> - Remove kNone_SkScanlineOrder and updateCurrScanline()
>
> SkPngCodec:
> - Implement new APIs
> - Switch from sk_read_fn/png_read_row etc to png_process_data
> - Expand AutoCleanPng's role to decode the header and create the
>   SkPngCodec
> - Make the interlaced PNG decoder report how many lines were
>   initialized during an incomplete decode
> - Make initializeSwizzler return a bool instead of an SkCodec::Result
>   (It only returned kSuccess or kInvalidInput anyway)
>
> SkIcoCodec:
> - Implement the new APIs; supported for PNG in ICO
>
> SkSampledCodec:
> - Call the new method for decoding scanlines, and fall back to the old
>   method if the new version is unimplemented
> - Remove references to kNone_SkScanlineOrder
>
> tests/CodecPartial:
> - Add a test which decodes part of an image, then finishes the decode,
>   and compares it to the straightforward method
>
> tests/CodecTest:
> - Add a test which decodes all scanlines using the new method
> - Repurpose the Codec_stripes test to decode using the new method in
>   sections rather than all at once
> - In the method check(), add a parameter for whether the image supports
>   the new method of scanline decoding, and be explicit about whether an
>   image supports incomplete
> - Test incomplete PNG decodes. We should have been doing it anyway for
>   non-interlaced (except for an image that is too small - one row), but
>   the new method supports interlaced incomplete as well
> - Make test_invalid_parameters test the new method
> - Add a test to ensure that it's safe to fall back to scanline decoding without
>   rewinding
>
> BUG=skia:4211
>
> The new version was generally faster than the old version (but not significantly so).
>
> Some raw performance differences can be found at https://docs.google.com/a/google.com/spreadsheets/d/1Gis3aRCEa72qBNDRMgGDg3jD-pMgO-FXldlNF9ejo4o/
>
> Design doc can be found at https://docs.google.com/a/google.com/document/d/11Mn8-ePDKwVEMCjs3nWwSjxcSpJ_Cu8DF57KNtUmgLM/
>
> GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1997703003
>
> Committed: https://skia.googlesource.com/skia/+/a4b09a117d4d1ba5dda372e6a2323e653766539e
>
> Committed: https://skia.googlesource.com/skia/+/30e78c9737ff4861dc4e3fa1e4cd010680ed6965

TBR=reed@google.com,msarett@google.com,scroggo@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:4211

Review-Url: https://codereview.chromium.org/2026383002
2016-06-01 12:08:23 -07:00
jvanverth
1e305ba0d6 Add offset to memory allocations
This is setting up for suballocations within one large
allocation

BUG=skia:5031
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2018933004
TBR=bsalomon@google.com

Review-Url: https://codereview.chromium.org/2018933004
2016-06-01 09:39:15 -07:00
msarett
4a603fc591 Revert of Create SkColorSpaceXform to handle color conversions (patchset #10 id:260001 of https://codereview.chromium.org/1952063002/ )
Reason for revert:
Google3 can't find qcms

Original issue's description:
> Create SkColorSpaceXform to handle color conversions
>
> Also adds testing of qcms color correction, so we can compare
> SkColorSpaceXform outputs to qcms outputs.
>
> BUG=skia:
> GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1952063002
>
> Committed: https://skia.googlesource.com/skia/+/740cc88ee3d63c75e52d31238f2a32600cc57a8c

TBR=reed@google.com,scroggo@google.com,mtklein@google.com,herb@google.com,brianosman@google.com
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:

Review-Url: https://codereview.chromium.org/2023093004
2016-06-01 09:16:04 -07:00
msarett
740cc88ee3 Create SkColorSpaceXform to handle color conversions
Also adds testing of qcms color correction, so we can compare
SkColorSpaceXform outputs to qcms outputs.

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

Review-Url: https://codereview.chromium.org/1952063002
2016-06-01 07:55:30 -07:00
scroggo
30e78c9737 Make SkPngCodec decode progressively.
This is a step towards using SkCodec in Chromium, where progressive
decoding is necessary.

Switch from using png_read_row (which expects all the data to be
available) to png_process_data, which uses callbacks when rows are
available.

Create a new API for SkCodec, which supports progressive decoding and
scanline decoding. Future changes will switch the other clients off of
startScanlineDecode and get/skip-Scanlines to the new API.

Remove SkCodec::kNone_ScanlineOrder, which was only used for interlaced
PNG images. In the new API, interlaced PNG fits kTopDown. Also remove
updateCurrScanline(), which was only used by the old implementation for
interlaced PNG.

DMSrcSink:
- In CodecSrc::kScanline_Mode, use the new method for scanline decoding
for the supported formats (just PNG and PNG-in-ICO for now).

fuzz.cpp:
- Remove reference to kNone_ScanlineOrder

SkCodec:
- Add new APIs:
    - startIncrementalDecode
    - incrementalDecode
- Remove kNone_SkScanlineOrder and updateCurrScanline()

SkPngCodec:
- Implement new APIs
- Switch from sk_read_fn/png_read_row etc to png_process_data
- Expand AutoCleanPng's role to decode the header and create the
  SkPngCodec
- Make the interlaced PNG decoder report how many lines were
  initialized during an incomplete decode
- Make initializeSwizzler return a bool instead of an SkCodec::Result
  (It only returned kSuccess or kInvalidInput anyway)

SkIcoCodec:
- Implement the new APIs; supported for PNG in ICO

SkSampledCodec:
- Call the new method for decoding scanlines, and fall back to the old
  method if the new version is unimplemented
- Remove references to kNone_SkScanlineOrder

tests/CodecPartial:
- Add a test which decodes part of an image, then finishes the decode,
  and compares it to the straightforward method

tests/CodecTest:
- Add a test which decodes all scanlines using the new method
- Repurpose the Codec_stripes test to decode using the new method in
  sections rather than all at once
- In the method check(), add a parameter for whether the image supports
  the new method of scanline decoding, and be explicit about whether an
  image supports incomplete
- Test incomplete PNG decodes. We should have been doing it anyway for
  non-interlaced (except for an image that is too small - one row), but
  the new method supports interlaced incomplete as well
- Make test_invalid_parameters test the new method
- Add a test to ensure that it's safe to fall back to scanline decoding without
  rewinding

BUG=skia:4211

The new version was generally faster than the old version (but not significantly so).

Some raw performance differences can be found at https://docs.google.com/a/google.com/spreadsheets/d/1Gis3aRCEa72qBNDRMgGDg3jD-pMgO-FXldlNF9ejo4o/

Design doc can be found at https://docs.google.com/a/google.com/document/d/11Mn8-ePDKwVEMCjs3nWwSjxcSpJ_Cu8DF57KNtUmgLM/

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

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

Review-Url: https://codereview.chromium.org/1997703003
2016-06-01 07:31:28 -07:00
sdefresne
e3fa811657 [GN] Add support for disabling opts via SK_BUILD_NO_OPTS define.
When targetting iOS and using gyp to generate the build files, it is not
possible to select files to build depending on the architecture. Due to
that, the skia code was disabling all optimisation when SK_BUILD_FOR_IOS
was defined.

Since it is possible to select the correct optimised version when using
gn, this pessimisation is hurting the build. Introduce a new define to
disable the optimisation SK_BUILD_NO_OPTS. It will be used by Chromium
when building skia for iOS with gyp but not gn.

Define SK_BUILD_NO_OPTS along-side SK_BUILD_FOR_IOS for all files that
look like build configuration (Xcode projects, gyp configuration files,
public.bzl) in order to avoid introducing breakage on those builds.

BUG=607933
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2002423002

Review-Url: https://codereview.chromium.org/2002423002
2016-06-01 07:08:56 -07:00
scroggo
9a89a0966b Revert of Make SkPngCodec decode progressively. (patchset #18 id:340001 of https://codereview.chromium.org/1997703003/ )
Reason for revert:
This is failing tests and then crashing on Google3 [1]. The crashes are fixed by crrev.com/2026873002, but to fix the builder we'll need to upgrade its version of libpng.

[1] https://sponge.corp.google.com/target?id=e545ef55-4da4-4931-9524-1ac92acb61b1&target=//third_party/skia/HEAD:dm#shard=1|run=1|attempt=1|page=-1

Original issue's description:
> Make SkPngCodec decode progressively.
>
> This is a step towards using SkCodec in Chromium, where progressive
> decoding is necessary.
>
> Switch from using png_read_row (which expects all the data to be
> available) to png_process_data, which uses callbacks when rows are
> available.
>
> Create a new API for SkCodec, which supports progressive decoding and
> scanline decoding. Future changes will switch the other clients off of
> startScanlineDecode and get/skip-Scanlines to the new API.
>
> Remove SkCodec::kNone_ScanlineOrder, which was only used for interlaced
> PNG images. In the new API, interlaced PNG fits kTopDown. Also remove
> updateCurrScanline(), which was only used by the old implementation for
> interlaced PNG.
>
> DMSrcSink:
> - In CodecSrc::kScanline_Mode, use the new method for scanline decoding
> for the supported formats (just PNG and PNG-in-ICO for now).
>
> fuzz.cpp:
> - Remove reference to kNone_ScanlineOrder
>
> SkCodec:
> - Add new APIs:
>     - startIncrementalDecode
>     - incrementalDecode
> - Remove kNone_SkScanlineOrder and updateCurrScanline()
>
> SkPngCodec:
> - Implement new APIs
> - Switch from sk_read_fn/png_read_row etc to png_process_data
> - Expand AutoCleanPng's role to decode the header and create the
>   SkPngCodec
> - Make the interlaced PNG decoder report how many lines were
>   initialized during an incomplete decode
> - Make initializeSwizzler return a bool instead of an SkCodec::Result
>   (It only returned kSuccess or kInvalidInput anyway)
>
> SkIcoCodec:
> - Implement the new APIs; supported for PNG in ICO
>
> SkSampledCodec:
> - Call the new method for decoding scanlines, and fall back to the old
>   method if the new version is unimplemented
> - Remove references to kNone_SkScanlineOrder
>
> tests/CodecPartial:
> - Add a test which decodes part of an image, then finishes the decode,
>   and compares it to the straightforward method
>
> tests/CodecTest:
> - Add a test which decodes all scanlines using the new method
> - Repurpose the Codec_stripes test to decode using the new method in
>   sections rather than all at once
> - In the method check(), add a parameter for whether the image supports
>   the new method of scanline decoding, and be explicit about whether an
>   image supports incomplete
> - Test incomplete PNG decodes. We should have been doing it anyway for
>   non-interlaced (except for an image that is too small - one row), but
>   the new method supports interlaced incomplete as well
> - Make test_invalid_parameters test the new method
> - Add a test to ensure that it's safe to fall back to scanline decoding without
>   rewinding
>
> BUG=skia:4211
>
> The new version was generally faster than the old version (but not significantly so).
>
> Some raw performance differences can be found at https://docs.google.com/a/google.com/spreadsheets/d/1Gis3aRCEa72qBNDRMgGDg3jD-pMgO-FXldlNF9ejo4o/
>
> Design doc can be found at https://docs.google.com/a/google.com/document/d/11Mn8-ePDKwVEMCjs3nWwSjxcSpJ_Cu8DF57KNtUmgLM/
>
> GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1997703003
>
> Committed: https://skia.googlesource.com/skia/+/a4b09a117d4d1ba5dda372e6a2323e653766539e

TBR=reed@google.com,msarett@google.com,scroggo@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:4211

Review-Url: https://codereview.chromium.org/2023103002
2016-05-31 13:52:48 -07:00
mboc
ee6a9919a3 SkTypeface::MakeFromName to take SkFontStyle.
SkTypeface::MakeFromName currently takes SkTypeface::Style,
which is quite limited. This starts the transition to this
function taking SkFontStyle instead.

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

TBR=reed
He said it sounded like a good idea.

Review-Url: https://codereview.chromium.org/1818043002
2016-05-31 11:42:37 -07:00