Commit Graph

10840 Commits

Author SHA1 Message Date
John Stiles
5186379e5e Disallow function calls to main().
In practice, calls to main are not meaningful:
- If main is called in live code, it's recursive
- If main is called in dead code, it's eliminated

However, if optimization/dead-stripping is turned off, the dead-code
case emits bad code in our GLSL/Metal backends. Rather than add a
special case to the backends to work around an error in a meaningless
edge case, we now reject the function call entirely.

Prototyping main() is, as far as I can tell, harmless, so this
continues to be allowed.

Change-Id: I69916840c06810cd948bd74ff168ada1c4fc74f8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/557578
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Arman Uguray <armansito@google.com>
Commit-Queue: Arman Uguray <armansito@google.com>
2022-07-11 20:55:12 +00:00
Herb Derby
6aa1170c10 Consolidate glyph attributes in SkGlyphDigest
SkGlyphDigest encompasses glyph attributes used early in the
text drawing stack. This is a newer class, so move functions and
constants  to  SkGlyphDigest that were historically misplaced.

Change-Id: Iec20c9a96fd7f4adf560f0c385dfd90abf13f009
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/557579
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2022-07-11 19:30:12 +00:00
Robert Phillips
fc49c18ca2 Better encapsulate Blend, Color and Empty shaders
Bug: skia:13438
Change-Id: Id1b7e6759144820f200040616deb3a120d809765
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/554405
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2022-07-11 16:37:52 +00:00
John Stiles
efa098c2f0 Require newlines after directives.
The fuzzer has noticed that we didn't enforce this. Now we issue an
error if directives don't have a newline at the end.

Change-Id: I29064bec2a2be628d87b7286cd16ac0089713413
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/557380
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2022-07-11 15:37:29 +00:00
Brian Osman
35af4736c8 Add API to validate an SkRuntimeEffect against SkCapabilities
Leaving this private for now, so we can address all of the testing
issues. Once we decide on the best ergonomics, this can be moved to
a public API.

Bug: skia:11209
Change-Id: I030e223d8cbd16438d9dfd518af41e1a7269b6dc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/550701
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2022-07-11 15:27:09 +00:00
Herb Derby
800633b991 Extract strike reference mechanism for GlyphVector
Extract the functionality of using either SkStrikeForGPU*
or sk_sp<SkStrike> for handling descriptors from either RemoteStrike
or from SkStrike. This will be used by the PathOpSubmitter and
DrawableOpSubmitter in the future.

Change-Id: I672ac9439a62c0485ac44b0a676640c30042e076
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/557056
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2022-07-08 22:05:54 +00:00
Herb Derby
56391549a2 Rename TestingPeer to GlyphVectorTestingPeer
Change-Id: Ie3378350f096e6e8baf96a093df70c7a76683072
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/557057
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2022-07-08 17:46:09 +00:00
Brian Osman
c7fe12e996 Avoid divide by zero in SurfaceContextWritePixelsMipped test
Change-Id: I16544e81c170b38d97a1f7716e4fc5bb4aa05721
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/556607
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2022-07-08 15:35:19 +00:00
Aditya Kushwah
a3e29d2444 Pass optional label param to MakeWrapped.
GrBackendTexture accepts an optional label param. Currently it was
passed only to Gl backend. This CL extends the scope and pass the
optional param, that comes from external clients, to other backends
like Dawn, Mtl, D3D etc.

Bug: chromium:1164111
Change-Id: Ibcaa3f7b3a1e294c5ab68e2a621df43c8c714d7a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/556757
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2022-07-08 14:23:34 +00:00
John Stiles
ca7657b093 Remove RuntimeShader built-in snippet ID.
This has been replaced by findOrCreateRuntimeEffectSnippet.

Change-Id: I26e1f85c74071b14b75ab86410e4cc30a81bf873
Bug: skia:13405
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/552716
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2022-07-08 14:18:19 +00:00
Robert Phillips
6d34ac6778 Limit range of startAngle in SkPath::arcTo
Large startAngle values (combined w/ an almost 360 sweep angle) can
cause an infinite loop in angles_to_unit_vectors in the loop that
tweaks the stop vector.

Bug: oss-fuzz:19916
Bug: oss-fuzz:48241
Change-Id: I914aac45aeeb302f23dc5b4b669182fd985cba4f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/556696
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-07-08 13:54:49 +00:00
Arman Uguray
9c242fff99 [sksl] Eliminate unreachable blocks inside switch cases
Added code to remove code within switch statements due to break, return,
and continue statements. The logic is applied conservatively and only
among the statements of an individual switch-case statement without
affecting other cases.

Bug: skia:13484
Change-Id: Id5b936ca91e562a5180a31a039a85de9e093961d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/556376
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Arman Uguray <armansito@google.com>
2022-07-07 21:23:54 +00:00
Brian Osman
4008acdc7c Fix a subtle bug with blend-mode blenders used from runtime effects
The FP factory would apply optimizations based on the mode, and return
one of the passed-in FPs. We use 'nullptr' as the 'src' FP when
constructing the blender's FP in make_effect_fp. This means that we get
back 'nullptr' from a src-mode blender. Later, we interpret that as
src-over (the default for an unset blender). Oops.

The new test variant would previously fail, before the fix to the FP.
The tweak to the FP technically eliminates an optimization, but it's one
that only applies to blending happening in the shader (eg, compose
shader, or runtime effects using a blender), and only when the blender
is one of the trivial modes. The resulting shader will still optimize
down, it just involves a bit of extra work before that happens. This
shouldn't have any long-term performance impact, particularly on
important scenarios.

Change-Id: Id5c6a6ca8a263b35c2dca3c41171748cffd41adb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/556599
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2022-07-07 19:46:38 +00:00
Aditya Kushwah
cb44bf6246 Label external texture.
Pass an optional label parameter to GrBackendTexture and pass
it to MakeWrapped of GrGLTexture because almost all textures
that are coming clients are things where the client owns the
gl texture and passes it into Skia as a wrapped texture via a
GrBackendTexture.

Bug: chromium:1164111
Change-Id: I4bfddda956c72b53d0070595ef3268ee1a2b747f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/555597
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2022-07-07 19:20:59 +00:00
John Stiles
2d6e13210d Add UniformManager tests for matrix/vector padding.
This checks the padding of a matrix followed by a scalar/vector, and the
padding of a scalar/vector followed by a matrix. The checks support
all mixes of 16- and 32-bit sized elements.

After some investigation, this CL also removes some TODOs in
`get_ubo_aligned_offset`. Our uniform system does not support structs,
which is a large source of disparity between layouts. With structs
removed from the equation, the only difference between layouts seems to
be related to std140 array padding. (std430 and Metal seem to be
entirely the same.)

Change-Id: I76c48ae1e597b98aad8a8f8495ab4a8ad262845b
Bug: skia:13478
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/556356
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2022-07-07 17:14:11 +00:00
Brian Osman
680633d465 Runtime effects: Restrict uniform matrices to be square
The fuzzer figured out that #version 300 would let you declare a
nonsquare matrix uniform. Quite a bit of downstream code isn't ready for
that, yet. For now, just tighten things up so the var declaration checks
match the types supported by SkRuntimeEffect::Uniform.

Bug: oss-fuzz:48829
Change-Id: I63daf3dfa7deb795901f19553805cf2351378620
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/556359
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2022-07-07 15:21:01 +00:00
Greg Daniel
884a5240f6 Fix freeing of resources on imported AHB in MultiPictureDocumentTest.
Bug: skia:13445
Change-Id: Idab8d0fb581df75dc87785991e1bb2b5af303c05
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/556023
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2022-07-07 14:40:47 +00:00
Greg Daniel
6db6110a10 Have all vulkan android bots use API 26.
We have unit tests that require api 26 to run, but we have no vulkan
bots that would run them. API 26 is supported on all O devices and I
don't think we'll ever want to run Vulkan on previous android devices.
So I think it is fine for us to just test at api 26 for all our test
bots.

Change-Id: I8f92af6504960b7b688281ad71f5f307fdf57f49
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/556028
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2022-07-07 13:19:58 +00:00
Herb Derby
45600771c2 Add STSubRunAllocator, an inline SubRunAllocator
Bug: oss-fuzz:48695
Bug: oss-fuzz:48690
Change-Id: I9fb634df54f8e1e7dee84036e2be2512d7a395d8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/556030
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2022-07-07 00:42:22 +00:00
John Stiles
f0f4277443 Add UniformManager tests for mixed 16/32-bit scalar/vector packing.
Thankfully, this was already working; no changes in the uniform manager
were needed.

Change-Id: Ic2c4807e8efa63a05127d6f96d8a58ce785bbc1e
Bug: skia:13478
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/556316
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2022-07-06 20:59:25 +00:00
John Stiles
db253e24a2 Do not optimize away intrinsics with non-finite results.
Previously, we would treat double values outside [-FLT_MAX, FLT_MAX]
as finite. In practice, this introduces many hazards; any place in the
code which handled the double value as a float would silently convert
the value to infinity. This includes high-traffic calls like
Literal::MakeFloat.

Note that the if checks are structured in a slightly awkward way to
ensure that NaNs are treated as non-finite.

The original buggy behavior can be seen at http://review.skia.org/556078

Change-Id: Ic126afe57c3d6c7aa3edf9c8f7e339abc5f77739
Bug: oss-fuzz:48592
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/556080
Reviewed-by: Arman Uguray <armansito@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2022-07-06 20:37:29 +00:00
Arman Uguray
bed73de474 [sksl][spirv] Prevent unreachable blocks in loops
- Do not output statements that follow a continue/break statement
  inside loop block.
- Avoid writing an unreachable block when writing do-while statements.

Bug: skia:13484
Change-Id: Ifeac58b6dbd58e2fab7ca7b0233676f2b4bc0260
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/555657
Commit-Queue: Arman Uguray <armansito@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2022-07-06 18:50:38 +00:00
John Stiles
48b27317b4 Fix fuzzer-discovered error with range checks.
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>
2022-07-06 14:24:59 +00:00
John Stiles
d1578cfe9b Add padding to properly align mixed-size uniforms.
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>
2022-07-02 20:19:12 +00:00
Brian Salomon
b8c26f8bfe Reland "Add option to GrGpuBuffer::updateData to *not* discard non-updated area."
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>
2022-07-01 15:45:07 +00:00
John Stiles
987901fa3f Fix uniform manager handling of mat2 types.
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>
2022-07-01 13:47:31 +00:00
John Stiles
143f191edd Fix uniform manager handling of vec3 types.
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>
2022-06-30 20:26:44 +00:00
John Stiles
cb7bfa28fd Simplify unit test logic around Metal half-precision uniforms.
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>
2022-06-30 19:24:43 +00:00
John Stiles
9a9a6925ac Add unit test verifying int encoding of uniforms.
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>
2022-06-30 16:41:04 +00:00
Brian Salomon
f6a84dfb53 Revert "Add option to GrGpuBuffer::updateData to *not* discard non-updated area."
This reverts commit a9b52ca52a.

Reason for revert: breaking non-apple mac gms?

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: Ifc9fb9311b19887a8dd14ea6b43709b5a814b766
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/554996
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: Brian Salomon <bsalomon@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2022-06-30 15:56:12 +00:00
Robert Phillips
3c4759d04c [graphite] Add runtime effects to new API proposal
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>
2022-06-30 15:23:13 +00:00
Brian Salomon
a9b52ca52a 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>
2022-06-30 15:05:44 +00:00
Ethan Nicholas
26afe80a62 Fix assertion failure with 'uniform texture2D'
Bug: oss-fuzz:48371
Change-Id: Ia92a652022985ea738791f3e2e57d360a04b05bd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/554517
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2022-06-30 14:48:48 +00:00
John Stiles
eb35a3783e Add unit test verifying float encoding of uniforms.
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>
2022-06-30 14:06:26 +00:00
John Stiles
91c25e9b05 Reland "Create simple unit test for UniformManager types and layouts."
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>
2022-06-30 14:03:22 +00:00
John Stiles
6c05f9064f 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>
2022-06-30 12:09:18 +00:00
Kevin Lubick
52904d35ab Make copy of skcms checkout in //modules/skcms
This will make our Bazel rules in G3 easier to use.

We will have to clean up a lot of clients (and this still
might require a manual G3 roll to land to account for the
source files).

Eventually, we will be able to delete the old one
//include/third_party/skcms and //third_party/skcms

Bug: skia:12451, b/237076898
Change-Id: I9fd55607cbb7e1196d175aa8f140e99a73505c89
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/554056
Reviewed-by: Brian Salomon <bsalomon@google.com>
2022-06-30 12:05:13 +00:00
John Stiles
c42782ad74 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>
2022-06-30 01:43:37 +00:00
Greg Daniel
bf65800589 [Graphite] Store Task Graph on Recording.
Bug: skia:13357
Change-Id: Ib2566e9c38f667368b20f18ed2b1851615602cad
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/548480
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2022-06-29 20:42:49 +00:00
Robert Phillips
c0cd71d4fd [graphite] Add compile guards to precompile system (take 2)
Bug: skia:13430
Change-Id: I64d6049fec8cc942a8f7c56c01ba292cc8f3835c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/554378
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2022-06-29 19:37:15 +00:00
Brian Salomon
9666709f37 Add offset parameter to GrGpuBuffer::updateData.
Bug: skia:13427
Change-Id: I05e538bb9464d32817a39c8d38e53c2b284c2960
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/553357
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2022-06-29 19:21:55 +00:00
Ethan Nicholas
4d378b4b9f Added threadgroup modifier to compute shaders
Change-Id: I3a244bcd25994217d5107de98c24c144f2dabdf0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/543076
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2022-06-29 18:06:28 +00:00
Kevin Lubick
187340c89e Revert "[graphite] Add compile guards to precompile system"
This reverts commit 1da712adda.

Reason for revert: Breaking G3

Original change's description:
> [graphite] Add compile guards to precompile system
>
> Bug: skia:13430
> Change-Id: I6c577b459bc3a699e6c660d21d2b119643fe1f88
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/553877
> Reviewed-by: Eric Boren <borenet@google.com>
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Robert Phillips <robertphillips@google.com>

Bug: skia:13430
Change-Id: I2fd518c9b7950e362e8c27cc74811f840887c7fa
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/554377
Owners-Override: Kevin Lubick <kjlubick@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2022-06-29 14:58:21 +00:00
Robert Phillips
1da712adda [graphite] Add compile guards to precompile system
Bug: skia:13430
Change-Id: I6c577b459bc3a699e6c660d21d2b119643fe1f88
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/553877
Reviewed-by: Eric Boren <borenet@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-06-29 13:48:45 +00:00
Ethan Nicholas
0360b2798b Require compute shader in/out arrays to be unsized
Turns out sized arrays don't work currently; the path of least
resistance is simply disabling them for now. See bug for explanation.

Bug: skia:13471
Change-Id: I90e321ccae199ac5697d1d9a63f73e30554e2981
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/553583
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Arman Uguray <armansito@google.com>
2022-06-28 20:03:12 +00:00
John Stiles
af348ef4b0 Create SkUniform data in findOrCreateRuntimeEffectSnippet.
Graphite expects uniforms to be passed in as a span of SkUniforms.
When making a runtime effect, we now convert the SkRuntimeEffect's
`Uniform` data into SkUniforms as well.

I briefly looked at sharing a single uniform type, but
SkRuntimeEffect::Uniform is public API, so changing it is non-trivial,
and Uniform would not be usable as a direct replacement for SkUniform.
(Uniform is non-POD since it contains an SkString; SkUniform is POD
and we declare a bunch of them at global scope. Also, each class
represents types using a separate enum.)

Change-Id: Idef2141d3a4860529719382840a157b7b0c41643
Bug: skia:13457
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/553595
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2022-06-28 18:45:48 +00:00
John Stiles
280987977c Split ArenaAlloc test into separate tests with narrower scope.
The tests themselves are the same, just split up into their logical
groupings. http://go/unit-testing-overview#properties

"Focused. Above all, unit tests are narrow in scope, validating the
correctness of individual pieces of code rather than the correctness of
the system as a whole."

Change-Id: I6149536e84763abc98dfe243d4090bb25a555525
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/553592
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2022-06-28 18:20:57 +00:00
John Stiles
27e5eb1281 Add SkRuntimeEffect flag indicating half-precision uniforms.
Graphite's uniforms (SkUniform) distinguish between "Float" and "Half"
as separate types, so we now preserve this information in a Uniform
flag. We didn't have any tests verifying the behavior of Uniform flags
in SkRuntimeEffect at all, so I added a test here.

Change-Id: If6323ce26eeca2ef7da6c7424ad7350c6a0b7362
Bug: skia:13405
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/553594
Reviewed-by: Brian Salomon <bsalomon@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2022-06-28 17:11:31 +00:00
Herb Derby
d8e179fba2 Remove maximum glyph dimension tracking from buffers
Change-Id: I7abba20991482d72ca90b52a92034b9875be4098
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/553578
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2022-06-28 15:09:42 +00:00
John Stiles
908cc8071c Revert "experimental alternative isconvex"
This reverts commit 64284e1482.

Reason for revert: unused code

Original change's description:
> experimental alternative isconvex
>
> Bug: skia:
> Change-Id: I55175a95d37aad9a656cd211fc6c7238bdb7d674
> Reviewed-on: https://skia-review.googlesource.com/c/173361
> Commit-Queue: Mike Reed <reed@google.com>
> Reviewed-by: Mike Reed <reed@google.com>

Change-Id: Ib00acfc0964ecfd2fe01689c0d46d0773d5c5258
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/553588
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2022-06-28 13:29:31 +00:00