FreeType reports that the type of a font is TrueType when the font is
logically TrueType. However, the underlying data may not be TrueType and
may be encoded in woff or woff2. The raw woff or woff2 data should not
be embedded in the PDF. If the tables are accessed individually it is
possible to subset them into a TrueType font. However, the subsetters
are not currently capable of handling a font as tables so fall back to
Type3 for now.
Change-Id: I5235ad02fd73fd88759dc30adfcf80aa0e4d2feb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/543921
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
This reverts commit 9da66d2a57.
Reason for revert: Seeing if this is blocking the G3 roll
Original change's description:
> [ganesh][dawn] Use GrRingBuffer for uniform buffer allocation
>
> The Dawn backend used its own GrDawnRingBuffer type to manage uniform
> buffer slices which always made new wgpu::Buffer allocations on-demand.
> It now uses the GrRingBuffer type for this purpose.
>
> While the Dawn backend does not use mapped buffers for uniform data
> uploads and buffers are ref-counted and freed by Dawn automatically
> after use, using GrRingBuffer allows it to share the same
> GrResourceProvider infrastructure as the other backends.
>
> Change-Id: Id2697f306f9ce3d5c6c85745b135585b092b6fb0
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/553525
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Arman Uguray <armansito@google.com>
Change-Id: Id9960b0b2bdf9ecab5889ef2050425e422e86090
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/556079
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Exit early if there will be a divide by zero or if no pixels are
to be drawn. Report that some glyphs have been excluded.
Bug: oss-fuzz:48695
Bug: oss-fuzz:48690
Change-Id: Ifdb0fad656ffc27bac7253035c7cd05ee96c274c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/556018
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
While reading through this code, I realized we implemented the same
function-argument stringizing loop three times. (A fourth version in
`description()` is similar, but prints the expressions, not types.)
Change-Id: I78610cdf6412b2d08984ac701e6421c356f25a83
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/556076
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
SkTypes.h was found exporting <stddef.h> and <stdint.h>.
Thus if a Skia file includes SkTypes.h, it did not need
to include either of those files to use things like
size_t or uint8_t respectively. [1]
This also resulted in strange IWYU warnings like:
warning: size_t is defined in "include/core/SkTypes.h", which isn't directly #included.
Thus, this CL removes those additional exports, and as a result,
adds many more includes of <cstddef> and <cstdint>.
The second change this CL is to not use the default IWYU
mappings which are hard-coded into IWYU [2]. These defaults
are valid, but make suggestions for the C version of
headers and not the C++ ones (i.e. <stddef.h> over <cstddef>).
To make these recommendations align better with our preferred
style (the C++ ones), we use IWYU with --no_default_mappings
and then have to expand our existing mappings to better deal
with how IWYU would resolve some of these headers.
[1] https://codereview.chromium.org/1207893002/#msg49
[2] 4c0f396159/iwyu_include_picker.cc (L1221-L1234)
Change-Id: Iafebe190f8f3e86f252147b9f538c182bcc34af4
Bug: skia:13052
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/555516
Auto-Submit: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
The fuzzer managed to create a NaN using a carefully-crafted mix of
intrinsics and constant folding. (`cosh(421)` is a very large double,
which becomes +Inf when cast to float, which is then multiplied by 0;
zero times infinity is NaN.)
Our code which checked to see if a value is in range of an int did not
consider NaNs and their always-false behavior, so it incorrectly
decided that NaN was in range. This CL reverses the check so that a NaN
will not pass, but all other values will behave the same.
Followup CLs should probably also tighten up the folding/optimizer
behavior so that NaNs/Infs are not created at all.
Change-Id: Idd2b0447ebe115e00bdba63ca7ff655f6c902fc6
Bug: oss-fuzz:48592
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/555009
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
The UniformManager would previously assert if it detected an alignment
error, but did not actually have any mechanism for automatically adding
padding between misaligned elements. If a user specifies a uniform
layout like `uniform float a; uniform float4 b;`, we now insert padding
between `a` and `b` so that `b` will be properly aligned. (This reuses
the logic that was originally used to trigger the alignment assertion.)
This CL fixes the bug and adds a test. The test is only active for
elements of matching size; mixed half- and full-precision elements
will need improved test logic.
Change-Id: I8c04eb6350fa73bdbcd1a08e1a45b17fee0d4194
Bug: skia:13478
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/555440
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Also expose a size() function on the public IB and VB types.
Bug: skia:12720
Change-Id: Ibeccf6d2d6ba411e9e77be582d0cb1622bc76ccd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/555005
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
The Dawn backend used its own GrDawnRingBuffer type to manage uniform
buffer slices which always made new wgpu::Buffer allocations on-demand.
It now uses the GrRingBuffer type for this purpose.
While the Dawn backend does not use mapped buffers for uniform data
uploads and buffers are ref-counted and freed by Dawn automatically
after use, using GrRingBuffer allows it to share the same
GrResourceProvider infrastructure as the other backends.
Change-Id: Id2697f306f9ce3d5c6c85745b135585b092b6fb0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/553525
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Arman Uguray <armansito@google.com>
This is set up to eliminate SkComposeShader.h and SkColorShader.h
Bug: skia:13438
Change-Id: I16d3ea233220061559f5499fb0824dba1e3e699d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/555160
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
No-Try: true
Change-Id: I98ca99508f25dde7dc6c63b5cb38b0f7382bd762
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/555517
Reviewed-by: Heather Miller <hcm@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Uses Transform::Identity() and preTranslate() in places to simplify code
and reduce matrix copying/multiplications.
Reworks DirectMaskSubRun's boundsAndTransform() function to use
preTranslate() and concatInverse() to similarly reduce matrix copies
and multiplications. It keeps fInitialPositionMatrix as an SkMatrix as
long as possible, and similarly does not copy localToDevice until its
determined that concatInverse() and preTranslate() need to be used
(vs. the integer-only translation).
Change-Id: Ia2ba266f952d3c71fb3afc30f3ba0b904bb4bede
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/555002
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
This is a reland of commit f838f6f62f
Original change's description:
> Replace SK_ARRAY_COUNT with std::size() all the rest
>
> Added changes to IWYU_mapping.imp to allow std::size. This
> requires multiple entries because std::size can be defined from
> any number of files. Please see the following for reference:
> https://en.cppreference.com/w/cpp/iterator/size
>
> Please check that I got all the includes from the documented list.
>
> Change-Id: I8346834ea7f37128f2dc50f238af0665a1fcfd8d
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/550696
> Reviewed-by: John Stiles <johnstiles@google.com>
> Reviewed-by: Kevin Lubick <kjlubick@google.com>
> Commit-Queue: Herb Derby <herb@google.com>
Change-Id: I4c50340ac2a970de479da57d7d1b55bbf267b617
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/555004
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
This is a reland of commit a9b52ca52a
Original change's description:
> Add option to GrGpuBuffer::updateData to *not* discard non-updated area.
>
> Also support minimal map region in Dawn implementation when onUpdateBuffer uses mapping.
>
> Bug: skia:13427
> Change-Id: I5c8a2872b520e04f8a55085c86430e635da2f43f
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/553585
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>
Bug: skia:13427
Change-Id: I04e8a4cba5dd3d77e457a4df2d8c20397c2ae760
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/554997
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
This reverts commit f838f6f62f.
Reason for revert: Breaks G3 Roll and MSVC compiler
Original change's description:
> Replace SK_ARRAY_COUNT with std::size() all the rest
>
> Added changes to IWYU_mapping.imp to allow std::size. This
> requires multiple entries because std::size can be defined from
> any number of files. Please see the following for reference:
> https://en.cppreference.com/w/cpp/iterator/size
>
> Please check that I got all the includes from the documented list.
>
> Change-Id: I8346834ea7f37128f2dc50f238af0665a1fcfd8d
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/550696
> Reviewed-by: John Stiles <johnstiles@google.com>
> Reviewed-by: Kevin Lubick <kjlubick@google.com>
> Commit-Queue: Herb Derby <herb@google.com>
Change-Id: I6282aeac9dacb31f753acb57d196a88447bce761
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/555003
Auto-Submit: Herb Derby <herb@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Doesn't handle the transformed case, for the moment.
Bug: skia:13118
Change-Id: I8f792713b224f2b153903f1e65cbb1707e36ca31
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/554343
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Change-Id: I028bd133778d14edcb22ccef0c35c5a8e3d7d552
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/554516
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
The Stride() function in the UniformManager, when given a matrix type,
was intended to return the stride of a single matrix column. However, it
accidentally called `Stride(1)` instead of `Stride(kNonArray)`, which
meant that it was returning the stride for a `vec2[1]` (four floats)
instead of the stride of a `vec2` (two floats). Interestingly, this
still returned the correct answer for mat3 and mat4, because `vec3`,
`vec4`, `vec3[1]` and `vec4[1]` all have the same stride--four floats.
This CL fixes the bug and adds a test.
Change-Id: I9c06b7da7253a86c1d9545c7e177bc916b49c9b9
Bug: skia:13478
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/555161
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Added changes to IWYU_mapping.imp to allow std::size. This
requires multiple entries because std::size can be defined from
any number of files. Please see the following for reference:
https://en.cppreference.com/w/cpp/iterator/size
Please check that I got all the includes from the documented list.
Change-Id: I8346834ea7f37128f2dc50f238af0665a1fcfd8d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/550696
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Without this fix, a Pipeline created for an attachment with one
sampleCount could be found and used for an attachment with a different
sampleCount, which is invalid.
Change-Id: Ibab0736e0e8dd7b920485eec54d70f00ab8507c5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/554999
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
If the font produces glyphs that won't fit in the atlas then:
Given the original font as a starting point, find a smaller font
where the maximum glyphs size will fit in the atlas with room for
padding.
From that new font size, calculate a scale factor that will
make the smaller glyphs the same size as the original font.
This is the second attempt at this code.
Change-Id: I2add9a8e9bae59546b7e8c3bbd5c17eb48d90f65
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/554401
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Using flat interpolation is slow with ANGLE's metal backend,
so not using it.
Bug: chromium:1340620
Change-Id: I91ff04a975ca9778690c6372d240028f24b7c2a0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/554976
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
std140, std430, and Metal all agree that non-array vec3 types should
pack like the equivalent vec4.
std140: http://screen/5NHiYze3sk4CbWv
std430: http://screen/8G6CuomyEkxge5t
Metal: http://screen/7t9LfvmuZmtJ4zq
Our Stride() function in the UniformManager, however, did not pad out
vec3 types. This would manifest as an assertion when the _next_
uniform was added; we would assert because get_ubo_aligned_offset
would mismatch our expected values.
This CL fixes the bug and adds a test.
Change-Id: I33f04f37d68b0099236576f69250ed73d9e010cd
Bug: skia:13478
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/554404
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
The pattern of treating Metal half-precision uniforms differently was
affecting both existing and upcoming tests, so it's factored out to a
helper function.
Also, added in calls to `doneWithExpectedUniforms`--these aren't
required, but it will give us more thorough test coverage.
Change-Id: I3f76a775816242cd1e5de9be1a96486738ddb12f
Bug: skia:13478
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/554998
Reviewed-by: James Godfrey-Kittle <jamesgk@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: James Godfrey-Kittle <jamesgk@google.com>
The tools in genrules [1] correspond to the HOST's version, which
is a problem if we are doing cross-platform builds. In this case,
when I was using my M1 Mac to run on a Linux RBE platform, the
Mac's python binaries (e.g. python3_9_aarch64-apple-darwin/bin/python3)
were being uploaded to RBE and attempted to be used, which resulted
in OSError: [Errno 8] Exec format error because the won't run
on the Linux RBE machine.
Thanks to tjgq@, I learned about exec_tools [2], which will use
the version of the tools for the EXECUTION platform, which
is exactly what we want.
While debugging this, I added a minimal reproduction case in
//experimental/bazel_test and updated the py_tools version
in an effort to diagnose the issue further.
We will need to contribute similar fixes to @spirv_tools
[1] https://bazel.build/reference/be/general#genrule.tools
[2] https://bazel.build/reference/be/general#genrule.exec_tools
Bug: skia:12541
Change-Id: Ib14deb4e326d3103fd08c21e93afe342d751c17a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/554518
Reviewed-by: Jorge Betancourt <jmbetancourt@google.com>
Similar to floats, Metal expects short-int uniforms to be passed in 16
bits, but other layouts always use 32 bits for integers.
Change-Id: I99575349d8547876ab6dab00f393158fbeea5385
Bug: skia:13478
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/554345
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Bug: skia:13430
Change-Id: I4958b0d14f7805889ed2061fe929778f69d40c48
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/549566
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Also support minimal map region in Dawn implementation when onUpdateBuffer uses mapping.
Bug: skia:13427
Change-Id: I5c8a2872b520e04f8a55085c86430e635da2f43f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/553585
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Change-Id: Ie54eae222c65a30225ce0dc5514908e1395299eb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/554402
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
This test verifies that float scalars and vectors can be added as
uniforms. In Metal, this is a particularly interesting challenge because
we represent half values as 16-bit floats.
Change-Id: I4ce2280a61afee905ac5980792b6dbe6e4be572f
Bug: skia:13478
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/554344
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
This reverts commit 6c05f9064f.
Reason for revert: fixed in release
Original change's description:
> Revert "Create simple unit test for UniformManager types and layouts."
>
> This reverts commit c42782ad74.
>
> Reason for revert: breaks in release
>
> Original change's description:
> > Create simple unit test for UniformManager types and layouts.
> >
> > The first test is an extremely simple check (can we create a uniform of
> > every allowed type in every layout?) and already uncovered a bug, so
> > we're off to a good start.
> >
> > Change-Id: If9d6aa9c0845727c5422185094711734951c2e0a
> > Bug: skia:13478
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/554339
> > Reviewed-by: Michael Ludwig <michaelludwig@google.com>
> > Auto-Submit: John Stiles <johnstiles@google.com>
> > Commit-Queue: Michael Ludwig <michaelludwig@google.com>
> > Commit-Queue: John Stiles <johnstiles@google.com>
>
> Bug: skia:13478
> Change-Id: I75c051c3daee63cad0ffd55e3823d9eb333980ee
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/554398
> Auto-Submit: John Stiles <johnstiles@google.com>
> Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bug: skia:13478
Change-Id: Ic8fafda7c2149cbb07e3469fe7165787e110114e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/554400
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
In release, these methods are no-ops: all code is either assertions, or
wrapped in #ifdef SK_DEBUG or SkDEBUGCODE(...). In release, any calls to
these methods should be trivially eliminated by LTO.
This change makes it easier to use the class. Previously, UniformManager
required a call to `setExpectedUniforms` before passing in uniforms, or
it would immediately assert, but this method did not exist in release.
This made UniformManager impossible to use without SkDEBUGCODE.
Change-Id: I638843b4413b0ee10d00238c96fe07b0e4e17eb5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/554399
Reviewed-by: Robert Phillips <robertphillips@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
The `encode` method of SkImage is renamed to `encodeToData` in
6409f84fc3.
We also don't use GrContext anymore. According to the file we included,
we should use GrDirectContext instead now.
This patch should make the code in the documentation buildable.
Change-Id: I07d27c5686673e17afb8a893b1c1c238fa84ecff
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/554816
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
This reverts commit c42782ad74.
Reason for revert: breaks in release
Original change's description:
> Create simple unit test for UniformManager types and layouts.
>
> The first test is an extremely simple check (can we create a uniform of
> every allowed type in every layout?) and already uncovered a bug, so
> we're off to a good start.
>
> Change-Id: If9d6aa9c0845727c5422185094711734951c2e0a
> Bug: skia:13478
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/554339
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>
> Auto-Submit: John Stiles <johnstiles@google.com>
> Commit-Queue: Michael Ludwig <michaelludwig@google.com>
> Commit-Queue: John Stiles <johnstiles@google.com>
Bug: skia:13478
Change-Id: I75c051c3daee63cad0ffd55e3823d9eb333980ee
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/554398
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>