Change-Id: I4086a17eafecccaf0bac34c850c249a5e4efc719
Reviewed-on: https://skia-review.googlesource.com/42524
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Sets the variation position of the SkTypeface on th hb_font. This allows
for correct shaping of variation fonts. This also splits out the
creation of hb_font from SkTypeface for clarity.
Change-Id: I8e3476dea0f18f1f7cb3fe757a04f99f0ab6c0fe
Reviewed-on: https://skia-review.googlesource.com/41742
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
The ubidi code only works with utf16 and SkTextBlob only with utf8. This
requires translating indexes. The current code starts cold when
translating indexes for each run, leading to taking O(n^2) time on the
number of runs. However, since this code is iterating over the runs in
order and each run begins where the last left off, simply keeping the
previous run's utf8 and utf16 end positions and using them as the next
starting position makes this O(N).
Change-Id: I921a87511fb4cdf5f6e92cd483959cf758d95306
Reviewed-on: https://skia-review.googlesource.com/41503
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Change-Id: I06e6b63c2742da069f48ff5d7defafc63a485af7
Reviewed-on: https://skia-review.googlesource.com/41842
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Work on spell-checker
to identify errors and
isolate more concepts
requiring definitions.
Docs-Preview: https://skia.org/?cl=41180
TBR: reed@google.com
Bug: skia: 6898
Change-Id: I0759beb42eaf6095908a9bd7decfcd0026253609
Reviewed-on: https://skia-review.googlesource.com/41180
Reviewed-by: Cary Clark <caryclark@skia.org>
Commit-Queue: Cary Clark <caryclark@skia.org>
Bug: skia:
Change-Id: Ic8b25ca2ecf51cfc190ac01bc9282396905a33b3
Reviewed-on: https://skia-review.googlesource.com/40862
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
We like a LIFO default thread pool in tools like DM for better
memory/time locality... the bots use less memory this way, and
generally run faster.
But most use cases want a FIFO queue, so that they can get going
on the next parts of early work while later work is still running.
This splits the implementation into one using SkTArray and pop_back
for LIFO, and a new one using std::deque and pop_front for FIFO.
Change-Id: Ief203b6869a00f1f8084019431a781d15fc63750
Reviewed-on: https://skia-review.googlesource.com/41849
Commit-Queue: Mike Klein <mtklein@chromium.org>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Yuqian Li <liyuqian@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
On Macs the user process limit is low, in the hundreds, and it's a
little annoying to mysteriously find other programs fail to start
because ok is greedily slurping up all the available process capacity.
On Linux the user process limit is up in the ten-thousands, so I don't
expect this to matter there, even on Android. I haven't seen any
significant speed difference imposing a default ncpus limit.
Change-Id: Id284723808074441710c0436acbd75ab1c6bbbb3
Reviewed-on: https://skia-review.googlesource.com/41840
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
Bug: skia:
Change-Id: I35bc08ad72fb94d8e47fe342d314c4496b954226
Reviewed-on: https://skia-review.googlesource.com/40881
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Chrome would like to perform cpu-side preprocessing for gpu draws in parallel.
They do not want to go through a picture (since they have their own display list format).
The general idea is that we add a new SkDeferredDisplayListRecorder class to
perform all of Ganesh's cpu-side preprocessing ahead of time and in parallel.
The SkDDLRecorder operates like SkPictureRecorder. The user can get an SkCanvas
from the SkDDLRecorder and feed it draw operations. Once finished, the user
calls 'detach' to get an SkDeferredDisplayList. All the work up to and
including the 'detach' call can be done in parallel and will not touch
the GPU. To actually get pixels the client must call SkSurface::draw(SkDDL)
on an SkSurface that is "compatible" with the surface characterization
initially given to the SkDDLMaker.
The surface characterization contains the minimum amount of information Ganesh needs
to know about the ultimate destination in order to perform its cpu-side work
(i.e., caps, width, height, config).
Change-Id: I75faa483ab5a6b779c8de56ea56b9d90b990f43a
Reviewed-on: https://skia-review.googlesource.com/30140
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Change-Id: I0d4166a4e9ea894f479755f9f7137c5941cf8a22
Reviewed-on: https://skia-review.googlesource.com/41081
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
This is portable back to older Android NDK APIs.
Seems to work fine.
Change-Id: I1f121f372d376909011ffd7063b73cbe50402a5f
Reviewed-on: https://skia-review.googlesource.com/40688
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
This adds a fallback backtracer for use on Android where <execinfo.h>
ins't present, instead using <unwind.h> to unwind and <dlfcn.h> to
lookup function names and addresses.
lockf() wasn't available until NDK API 24, so I've just no-op'd file
locking on older targets. I tried switching from lockf() to flock(),
but flock() didn't see to _do_ anything, neither on Android nor on my
Mac laptop. I think I should be able to use the lower-level fcntl()
APIs to restore file locking uniformly in a follow-up. The upshot is
until then, we'll have interlaced logs and stack traces on Android
devices unless you set ndk_api=24 in GN.
We need to add a couple build flags to make backtraces useful:
* -funwind-tables makes the call to _Unwind_Backtrace() actually
traverse the call stack. This is a small extra binary size cost.
* -rdynamic makes symbols linked into the main executable visible
to dladdr(). We do this on Linux already for the same reason.
Here's an example where I made aaxfermodes call SK_ABORT():
650 ok, 1 crashed
caught signal SIGABRT while running 'aaxfermodes'
0x76ed936288 [unknown]+308
0x76eec014e0 [unknown]+510811706592
0x76ed367b2c tgkill+8
0x76ed364f50 pthread_kill+68
0x76ed31ff5c raise+28
0x76ed318814 abort+56
0x76edebd070 sk_out_of_memory()+12
0x76ed99f664 AAXfermodesGM::draw_pass(SkCanvas*, AAXfermodesGM::DrawingPass)+96
0x76ed99f4e4 AAXfermodesGM::onDraw(SkCanvas*)+36
0x76ed9e8550 skiagm::GM::drawContent(SkCanvas*)+224
0x76ed9e82ac skiagm::GM::draw(SkCanvas*)+288
0x76ed93b10c GMStream::GMSrc::draw(SkCanvas*)+96
0x76ed937b08 SWDst::draw(Src*)+284
0x76ed936ca0 [unknown]+112
0x76ed939b4c ForkEngine::spawn(std::function<Status ()>)+88
0x76ed934d00 main+2200
0x76ed316598 __libc_init+92
0x76ed93434c [unknown]+510791992140
Change-Id: Ica4849d99a3b97f48d778f4c15a7fa36275b8133
Reviewed-on: https://skia-review.googlesource.com/40802
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
Re-land of: https://skia-review.googlesource.com/36560
All information needed by the thread is captured by the prepare
callback object, the lambda captures a pointer to that, and does the
mask render. Once it's done, it signals the semaphore (also owned by the
callback). The callback defers the semaphore wait even longer (into the
ASAP upload), so the odds of waiting for the thread are REALLY low.
Also did a bunch of cleanup along the way, and put in some trace markers
so we can monitor how well this is working.
Traces of a GM that includes GPU and SW path rendering (path-reverse):
Original:
https://screenshot.googleplex.com/f5BG3901tQg.png
Threaded, with wait in the callback (notice pre flush callback blocking):
https://screenshot.googleplex.com/htOSZFE2s04.png
Current version, with wait deferred to ASAP upload function:
https://screenshot.googleplex.com/GHjD0U3C34q.png
Bug: skia:
Change-Id: Idb92f385590749f41328a9aec65b2a93f4775079
Reviewed-on: https://skia-review.googlesource.com/40775
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
enforce that param and return
descriptions are phrases (begin
with lower case, no trailing
period).
Docs-Preview: https://skia.org/?cl=40767
Bug: skia: 6898
Change-Id: Ib5f2a02441673f71c0780d81c5e4c61200a678e3
Reviewed-on: https://skia-review.googlesource.com/40767
Commit-Queue: Cary Clark <caryclark@skia.org>
Reviewed-by: Cary Clark <caryclark@skia.org>
Work on SkPath.h documentation; fixed self-consistency
bugs identified by bookmaker. Fixed a couple of
minor typos in SkPath.h itself.
Also brought SkPaint and SkCanvas docs up to date.
TBR=reed@google.com
Docs-Preview: https://skia.org/?cl=39040
Bug: skia: 6898
Change-Id: Id89d4e2fa7fb6ee2e3cbec7ea762e06308b67d8b
Reviewed-on: https://skia-review.googlesource.com/39040
Commit-Queue: Cary Clark <caryclark@skia.org>
Reviewed-by: Cary Clark <caryclark@google.com>
Reviewed-by: Cary Clark <caryclark@skia.org>
Change-Id: Ie69421ed36d596cb8c40f9858fac370ceba18c87
Reviewed-on: https://skia-review.googlesource.com/40022
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Mike Klein <mtklein@chromium.org>
This (plus SW) ensures that we can always draw any path. Changed the path
renderer command line flags so that 'default' means everything but CCPR,
and 'All' really means 'every path renderer'.
Bug: skia:
Change-Id: I2801d1c50ab939f23efb4600e0f90e6add2891b7
Reviewed-on: https://skia-review.googlesource.com/40221
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
This avoids the dangerous overload problem of
growToInclude(0, 0)
matching to (const SkPoint[], count) rather than growToInclude(x, y)
Bug: skia:
Change-Id: Iaba8b1a579638ff363fde62e4e3004052dd2b2ac
Reviewed-on: https://skia-review.googlesource.com/39501
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Mike Reed <reed@google.com>
This was created by looking at warnings produced by clang's
-Wzero-as-null-pointer-constant. This updates most issues in
Skia code. However, there are places where GL and Vulkan want
pointer values which are explicitly 0, external headers which
use NULL directly, and possibly more uses in un-compiled
sources (for other platforms).
Change-Id: Id22fbac04d5c53497a53d734f0896b4f06fe8345
Reviewed-on: https://skia-review.googlesource.com/39521
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
generate method links from
fiddle names to keep them
consistent and unique.
Docs-Preview: https://skia.org/?cl=38727
Bug: skia:6898
Change-Id: I3434801b46002a3a9095e007d456e9e871307304
Reviewed-on: https://skia-review.googlesource.com/38727
Commit-Queue: Cary Clark <caryclark@skia.org>
Reviewed-by: Cary Clark <caryclark@skia.org>
qualify bookmaker links to remove
file reference if intra-file and
add class reference if part of
a class
TBR=caryclark@google.com
Docs-Preview: https://skia.org/?cl=38722
Bug: skia: 6898
Change-Id: Ie0548485a6e3f596efc0f15b819bd5060e983a5b
Reviewed-on: https://skia-review.googlesource.com/38722
Reviewed-by: Cary Clark <caryclark@skia.org>
Commit-Queue: Cary Clark <caryclark@skia.org>
This reverts commit 76323bc061.
Reason for revert: Breaking NUC bots in threaded gm comparison:
https://chromium-swarm.appspot.com/task?id=382e589753187f10&refresh=10
Original change's description:
> Threaded generation of software paths
>
> All information needed by the thread is captured by the prepare
> callback object, the lambda captures a pointer to that, and does the
> mask render. Once it's done, it signals the semaphore (also owned by the
> callback). The callback defers the semaphore wait even longer (into the
> ASAP upload), so the odds of waiting for the thread are REALLY low.
>
> Also did a bunch of cleanup along the way, and put in some trace markers
> so we can monitor how well this is working.
>
> Traces of a GM that includes GPU and SW path rendering (path-reverse):
>
> Original:
> https://screenshot.googleplex.com/f5BG3901tQg.png
> Threaded, with wait in the callback (notice pre flush callback blocking):
> https://screenshot.googleplex.com/htOSZFE2s04.png
> Current version, with wait deferred to ASAP upload function:
> https://screenshot.googleplex.com/GHjD0U3C34q.png
>
> Bug: skia:
> Change-Id: I3d5a230bbd68eb35e1f0574b308485c691435790
> Reviewed-on: https://skia-review.googlesource.com/36560
> Commit-Queue: Brian Osman <brianosman@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>
TBR=egdaniel@google.com,mtklein@google.com,bsalomon@google.com,robertphillips@google.com,brianosman@google.com
Change-Id: Icac0918a3771859f671b69ae07ae0fedd3ebb3db
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/38560
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
also fixed minor bookmaker bugs so canvas
include and online docs are (bookmaker detected)
error-free
TBR=reed@google.com
Docs-Preview: https://skia.org/?cl=37840
Bug: skia:
Change-Id: Ifcec9c751105444047c37d89fd984dbd4dfd1913
Reviewed-on: https://skia-review.googlesource.com/37840
Reviewed-by: Cary Clark <caryclark@google.com>
Commit-Queue: Cary Clark <caryclark@skia.org>
All information needed by the thread is captured by the prepare
callback object, the lambda captures a pointer to that, and does the
mask render. Once it's done, it signals the semaphore (also owned by the
callback). The callback defers the semaphore wait even longer (into the
ASAP upload), so the odds of waiting for the thread are REALLY low.
Also did a bunch of cleanup along the way, and put in some trace markers
so we can monitor how well this is working.
Traces of a GM that includes GPU and SW path rendering (path-reverse):
Original:
https://screenshot.googleplex.com/f5BG3901tQg.png
Threaded, with wait in the callback (notice pre flush callback blocking):
https://screenshot.googleplex.com/htOSZFE2s04.png
Current version, with wait deferred to ASAP upload function:
https://screenshot.googleplex.com/GHjD0U3C34q.png
Bug: skia:
Change-Id: I3d5a230bbd68eb35e1f0574b308485c691435790
Reviewed-on: https://skia-review.googlesource.com/36560
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
This reverts commit 20af6d12ee.
Performance regressions on Android and Flutter
Change-Id: If70edbe85aa251f298eddf18a89ba2cf56ed94fb
Reviewed-on: https://skia-review.googlesource.com/37340
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
There was no way to get this behavior without triggering an error before.
Bug: skia:
Change-Id: Id9cb9090e47226dadad0032f06ec205dd2538dcc
Reviewed-on: https://skia-review.googlesource.com/37001
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Choosing pixel formats is quite slow (depending on driver?). We were
doing this once per context, and it added up. On my desktop windows
machine, this saves another 7 seconds in `dm --config gl --src gm`.
Actual times:
37s -> 30s (not writing PNGs)
47s -> 39.5s (writing PNGs)
We always called this with MSAA sample count set to zero, so I cleaned
up the code to make that clearer. Also included a comment about the
theoretical risk, although I think that outside of a multi-GPU system,
we're fine.
Bug: skia:
Change-Id: I50927ebfaf6fe8d88a63674427fbf9e06e4ab059
Reviewed-on: https://skia-review.googlesource.com/35763
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
This reverts commit 3fd295550f.
Reason for revert: breaking things
Original change's description:
> Add GrTextureOp and use to implement SkGpuDevice::drawImage[Rect]() when possible
>
> This op draws a texture rectangle in src over blending with no edge antialiasing. It less powerful than NonAAFillRectOp/GrPaint but has less CPU overhead.
>
> Change-Id: Ia6107bb67c1c2a83de14c665aff64b0de2750fba
> Reviewed-on: https://skia-review.googlesource.com/33802
> Commit-Queue: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>
TBR=djsollen@google.com,bsalomon@google.com,robertphillips@google.com,brianosman@google.com
Change-Id: I9cdbeeac15b17d2d6b3385560ed826397c0373c6
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/36220
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
This op draws a texture rectangle in src over blending with no edge antialiasing. It less powerful than NonAAFillRectOp/GrPaint but has less CPU overhead.
Change-Id: Ia6107bb67c1c2a83de14c665aff64b0de2750fba
Reviewed-on: https://skia-review.googlesource.com/33802
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Change-Id: I97a844b2f289d2518f60a64f94d60551c4530dd4
Reviewed-on: https://skia-review.googlesource.com/35742
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Catapult (Chrome tracing) has a hard upper limit of 256 MB of JSON data.
This is independent of the number of events, because V8 can't store a
single string longer than that. Before these changes, longer traces
(eg all GL GMs, which was my test case) would be much larger (306 MB).
This CL includes four changes that help to reduce the text size:
1) Offset timestamps (saved 7.3 MB)
2) Limit timestamps and durations to 3 digits (saved 10.7 MB)
3) Shorten thread IDs (saved 7.2 MB)
4) Omit categories from JSON (saved 25.7 MB)
Note that category filtering still works, this just prevents us from
writing the categories to the JSON, which was of limited value.
At this point, my 306 MB file is now 255.3 MB, and loads.
Bug: skia:
Change-Id: Iaafc84025ddd52904f1ce9c1c2e9cbca65113079
Reviewed-on: https://skia-review.googlesource.com/35523
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Brian Osman <brianosman@google.com>
Context is in the below bug
Bug: skia:6918
Change-Id: Ic9048311092bd7e73dd6ee182e79abea79baa07a
Reviewed-on: https://skia-review.googlesource.com/30586
Commit-Queue: Ravi Mistry <rmistry@google.com>
Reviewed-by: Eric Boren <borenet@google.com>
SkFAIL is a legacy macro which is just SK_ABORT. This CL mechanically
changes uses of SkFAIL to SK_ABORT in preparation for its removal. The
related sk_throw macro will be changed independently, due to needing to
actually clean up its users.
Change-Id: Id70b5c111a02d2458dc60c8933f444df27d9cebb
Reviewed-on: https://skia-review.googlesource.com/35284
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Removes the need for strdup with copied strings, paves the way for
more (and richer) payload, and shrinks the average event way down.
Bug: skia:
Change-Id: I9604fe713c34cfc877dce84563af89c579abd65b
Reviewed-on: https://skia-review.googlesource.com/35166
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
After turning on exceptions in test tools,
iOS builds of ok started saying atoi() was not declared.
I don't even want to know.
Change-Id: I52f354a1f25ec042bf2161a4c5dd9276aa25e46a
Reviewed-on: https://skia-review.googlesource.com/34961
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Mike Klein <mtklein@chromium.org>
The only interesting difference here is that I've just skipped
cd_Documents() on Google3 iOS builds rather than adding a new target to
BUILD. We don't run the binary so it's kind of moot what directory it'd
run in.
Change-Id: I1994e0283d24bcc505fa9b2b7b58307eafa5be92
Reviewed-on: https://skia-review.googlesource.com/34742
Reviewed-by: Ben Wagner <benjaminwagner@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
I'm betting big on ok bench. This is a forcing function.
Change-Id: I8c359b7d712e16f8f0cbb90591801e0014073288
Reviewed-on: https://skia-review.googlesource.com/33660
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Mike Klein <mtklein@chromium.org>
This new source acts like other sources (GMs, SKPs) for benchmarks. It
times multiple samples (controlled by samples=N, default 20), and each
of those samples uses the same strategy as monobench, growing loops
exponentially until it runs for at least 10ms.
When done it prints the fastest and the two slowest samples. In
practice the 100th percentile sample is very different from the
next slowest due to caching, and the fastest is always interesting.
Because these benchmarks run in whatever execution engine ok has
selected, on non-Windows platforms you have some real control over the
interaction between benchmarks. In its default "fork" mode each
benchmark runs independently in its own process, so the 100th
percentiles really stand out. The other modes "thread" and "serial"
work as you'd expect too.
Here's an example where you can see how the different interactions work:
out/ok bench:samples=100 8888 filter:search=text_16_AA fork
[text_16_AA_WT] 2.32µs @0 6.23µs @99 24.3ms @100
[text_16_AA_FF] 2.41µs @0 5.7µs @99 23.3ms @100
[text_16_AA_88] 2.55µs @0 5.6µs @99 24.8ms @100
[text_16_AA_BK] 1.97µs @0 5.44µs @99 23.2ms @100
out/ok bench:samples=100 8888 filter:search=text_16_AA thread
[text_16_AA_FF] 2.45µs @0 23.5µs @99 24.8ms @100
[text_16_AA_WT] 2.52µs @0 17.8µs @99 24.7ms @100
[text_16_AA_88] 2.55µs @0 19.7µs @99 25.1ms @100
[text_16_AA_BK] 1.8µs @0 14.7µs @99 25.1ms @100
out/ok bench:samples=100 8888 filter:search=text_16_AA serial
[text_16_AA_88] 2.35µs @0 3.53µs @99 16.7ms @100
[text_16_AA_FF] 2.09µs @0 2.73µs @99 2.91µs @100
[text_16_AA_BK] 1.75µs @0 2.46µs @99 2.65µs @100
[text_16_AA_WT] 2.1µs @0 3.16µs @99 3.17µs @100
In the first "fork" case all runs are independent and have roughly
the same profile. "thread" looks similar except you can see them
contending at the 99th percentile. In "serial", the first bench
warms up the rest, so their 100th percentiles are all much faster.
Change-Id: I01a9f8c54b540221a9f232b271bb8ef3fda2569c
Reviewed-on: https://skia-review.googlesource.com/33585
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
I tried to follow exactly the same strategy as a start.
(Though I did fix the off-by-one dimensions.)
It does rather look like we only need 3D and 4D now
that I've looked at the call sites.
Looks like about a 20% speedup.
Change-Id: I8b1af64750ad1750716ee1ab0767e64591c7206a
Reviewed-on: https://skia-review.googlesource.com/32842
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
This is a stand-alone helper class for writing properly
structured JSON to an SkWStream. It currently solves two
problems (although this CL only uses it in one context):
1) Performance. Writing out JSON this way is about 10x
faster than using JSONCPP. For the large amounts of data
generated by the tracing system, that's a big win.
2) Makes it easy to emit structured JSON from code that's
not fully centralized. We'd like to spit out JSON that
describes a GrContext, GrGpu, GrCaps, etc... Doing that
with simple string manipulation is complex, and spreads
this logic over all those functions. Using JSONCPP adds
yet another (large) third party library dependency (that
we only build into our own tools right now).
This went through several revisions. I originally planned
it as a stateful SkString wrapper, so the user could just
build their JSON as a string. That's O(N^2), though,
because SkString grows by a (small) constant amount. Even
using a better growth strategy still means needing RAM
for all the resulting text, which is usually pointless.
This version has a constant memory cost, so writing huge
amounts of JSON to disk (tracing a long DM run can emit
100's of MBs) doesn't stress resources.
Bug: skia:
Change-Id: Ia716524b246db0f97d332da60d2ce9903069e748
Reviewed-on: https://skia-review.googlesource.com/31204
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@chromium.org>