Commit Graph

31572 Commits

Author SHA1 Message Date
Greg Daniel
c75e0ef2b3 [graphite] Add IndexWriter and UniformWriter classes.
This also adds a base class BufferWriter which Vertex, Index, and
Uniform Writers inherit from

Bug: skia:12466
Change-Id: Icbac1210fbbd07321f9d88728ddde1e761fe4bb0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/463496
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Chris Dalton <csmartdalton@google.com>
2021-10-27 00:20:38 +00:00
John Stiles
14c328247b Update Metal type sizes and alignments.
The original values assumed that `half` types would be sized the same as
a `float`. This is still the case (as skia:12339 is not yet fully
implemented) but this CL now contains the expected half values as well.

Change-Id: I94ff73446d29318f127600fb681c222a759936cc
Bug: skia:12339
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/463736
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2021-10-26 21:51:35 +00:00
Kevin Lubick
97284f255b [infra] Add initial platforms and constraint values
This makes use of Bazel's pre-defined platforms
https://github.com/bazelbuild/platforms
and some of our own defined values (see
//bazel/common_config_settings/BUILD.bazel) to customize
the build rules.

I verified this by building bazel_test locally for
linux x64 as well as using the third_party deps for
a WASM build (using build files not seen in this CL).

Suggested Review Order:
 - https://docs.bazel.build/versions/main/platforms.html if not
   already familiar with Bazel Platforms
 - third_party/BUILD.bazel to see that 1) all globs have
   been removed and 2) select() targets various
   platform constants or groups of constants to control
   sources, headers, and local_defines.
 - common_config_settings/ to see the groups of constraints
   created, as well as new constraint_settings defined
   (skdebug_impl)
 - supported_combinations/ to see how we can define supported
   sets of the constraint values (aka Bazel platforms).
   I imagine expanding this more, so we might have platforms
   named "linux_x64_emptyfontmgr_vulkan" or such.
 - //BUILD.bazel and bazel_test.cpp to see use of SkDebugf.
 - Everything else.

Change-Id: I49e4abdbcf7b76f0674efdbb1f53dc8823d110ee
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/463517
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Leandro Lovisolo <lovisolo@google.com>
Owners-Override: Kevin Lubick <kjlubick@google.com>
2021-10-26 18:27:13 +00:00
Greg Daniel
e82c1c11bc Add support for vk drm format modifiers.
On linux we need to support drm format modifiers on vulkan images. When
we have a modifier it can restrict the allowed usages/features of the
VkImage.

The current use case we have for images coming into skia that have
these modifiers are from video decoders. All these images are only used
as sampled images in draws and they have no filtering applied.
Therefore, for now, instead of tracking all format and modifier pairs
to know what is supported, we internally set these images to be external
which already restricts their use to basic in shader sampling.

Additionally in chrome, all these images are coming in ycbcr conversions
already which we treat as external.

Bug: skia:12336
Change-Id: I59a564f937f49a6d906efe954b24cebe5c7470ff
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441298
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2021-10-26 18:22:07 +00:00
Greg Daniel
4427d1eebf Remove some uses of direct fPtr access in VertexWriter.
Ideally we could move fPtr on VertexWriter to be private to force all
users of VertexWriter to go through the write functions. This CL at
least removes all users that were using fPtr for validity checking of
the VertexWriter.

I also move fPtr to private and added a temporary public getter. This
will allow us to make a base Writer class where fPtr is private and
we'll only expose the getter on the VertexWriter.

Change-Id: Ib389778d0f530fb31cef85460f00bd9f687c5219
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/463456
Commit-Queue: Greg Daniel <egdaniel@google.com>
Auto-Submit: Greg Daniel <egdaniel@google.com>
Reviewed-by: Chris Dalton <csmartdalton@google.com>
2021-10-26 16:54:07 +00:00
John Stiles
f6fb3db1dc Remove GrSL byte types.
Byte types were removed from SkSL in http://review.skia.org/404219.

Change-Id: Iec726de0be2ce371a20e21638638a495fae282a0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/463498
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-10-26 15:48:09 +00:00
John Stiles
8ed23eb917 Implement array casts in Metal.
These are not very interesting right now, because the in and out types
boil down to the same thing (int/int, float/float). When half-
precision types are enabled, these helpers will be more useful. They
will return an array which casts each element from int-to-short or
float-to-half (or vice versa).

Change-Id: Ida716ddd27d370ba33fd23f17a1b07fa5a201e40
Bug: skia:12339
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/463337
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-10-26 15:26:43 +00:00
John Stiles
b37100de7d Update Metal matrix intrinsic polyfills to allow half.
The inverse, outerProduct and matrixCompMult polyfill functions in Metal
were written assuming that all float matrices would use the `float`
type. They now use a template so that `half` matrices will work too.

Change-Id: I7696c8ad1e4aaffbd71c56b9245485e74cd96c5a
Bug: skia:12339
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/463338
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-10-26 13:18:10 +00:00
John Stiles
2e20e7674c Use virtual method for slotCount.
Using a switch is overkill now that Types are implemented in subclasses.

Change-Id: If7874dfa9a5b02f168ac7c6c3f69a2bd6f9c2a80
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/463156
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-10-25 18:47:10 +00:00
Chris Dalton
52aee23ded GrVertexWriter -> skgpu::VertexWriter
This class can now be shared with Graphite.

Bug: skia:12524
Change-Id: I7841410b3e8e111a12298efe0a1898a33295873a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/462556
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2021-10-25 17:25:02 +00:00
Brian Osman
c00c888db1 Revert "Disable GL_NV_shader_noperspective_interpolation on PowerVR"
This reverts commit 9dd63710f1.

Reason for revert: The actual issue was related to cached shaders recorded on a different device. No evidence of actual driver bug.

Original change's description:
> Disable GL_NV_shader_noperspective_interpolation on PowerVR
>
> There's probably a more specific check we could use, but we're seeing
> shaders fail to compile when enabling this extension on some MediaTek
> devices.
>
> Bug: b/177473804
> Change-Id: Ic91f60c6935386f44d9386c362e9f778c28a4099
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/460576
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>

Bug: b/177473804
Change-Id: Iea36dd74a2a530f8347517bee76d83ceacc262a0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/463057
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-10-25 15:10:38 +00:00
John Stiles
e26e010000 Move GrUniformDataManager setter logic into templates.
This code originally contained 16 extremely similar versions of the same
logic. (set1i, 1iv, 1f, 1fv, 2i, 2iv...)

Now the core logic has been boiled down to two (set, setv) templated
helper functions, one for array and one for non-array uniforms. Template
arguments fill in the minor variations between each type.

Structuring the logic in this way makes it easier to perform sweeping
changes as needed, and guarantees that the setters all work the same.

Change-Id: Iaa74d25c612b12ab26d7f32879c174bca6c850c1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/462099
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-10-21 21:08:37 +00:00
Chris Dalton
6b90705437 Simplify GrVertexWriter::writeQuad
This allows GrQuad to be written as a quad without the header needing
knowledge of it.

Bug: skia:12524
Change-Id: I22f67021877de426f710981d4fa2bd48c88a4d52
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/462319
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-10-21 20:42:37 +00:00
Brian Osman
95a8c4fdc0 Make all shader caps uniquely-owned
Bug: skia:12559
Change-Id: I5775120a826e582e73aab83273e59bc48c057a5b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/462077
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2021-10-21 20:11:03 +00:00
John Stiles
97d9e47e8f Reduce the size of the lexer's data tables.
The lexer uses a matrix of state transition data to parse text. This
matrix was highly sparse and contained large runs of zeros and repeated
values. I found that by transposing the matrix, it became extremely
compressible. In its transposed state, most slices had only 1-3 unique
nonzero values.

This CL leverages this finding to reduce the matrix data from ~55K to
~10K. A handful of slices do contain a large number of unique values and
continue to be represented as plain 16-bit arrays. Some slices contain
no data at all and were eliminated entirely. The majority of slices are
now represented by a compact two-bit array. Bit pattern 00 always
represents zero. Bit patterns 01, 10 and 11 are translated into values
v0, v1 and v2, which are stored per slice (bit-packed to save a few
extra bytes). This transformation involves a fair amount of bit shifting
and masking, but the generated code will be quite efficient:
https://godbolt.org/z/eTvjr96ez

Change-Id: Iecc67aadd510ccf63b4bcb11ed861d703efefaae
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/461356
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-10-21 19:53:36 +00:00
John Stiles
ff32c42ca3 Simplify matrix uniform data management.
We can use `if constexpr` to avoid the need for a helper function that
uses template specialization, and we can use `getBufferPtrAndMarkDirty`
instead of performing the equivalent operations by hand.

Change-Id: I548c719bae4f215e0a9c658a942deaec38ce27ad
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/462098
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-10-21 19:27:11 +00:00
Chris Dalton
09f4864734 Convert GrVertexWriter to a "stream syntax" API
This helps remove all Ganesh dependencies from GrVertexWriter so it can
be shared with Graphite.

Bug: skia:12466
Change-Id: I1ede1cfc48d501cb1e028bca1e8590e6c92f4e4d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/462316
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-10-21 18:51:00 +00:00
Brian Osman
2d1207acb9 Remove the "in blend modes randomly fail for all zero vec" workaround
At this point, it seems like this was a mis-diagnosis of the underlying
issue around dual-source blending (and its interaction with other blend
state).

Change-Id: I11af0c9b70c32e14c353848db3d6adbfe5f08225
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/462176
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-10-21 16:54:51 +00:00
John Stiles
f08ebb15f0 Add a distinct error message for reserved words.
After reporting the error, we convert the reserved word to an identifier
as this led to the best error reporting. (This avoids double error
reporting or strange cascading errors.)

Change-Id: I67209bc342fe794287baeaaaf34fa77afd4ac26b
Bug: skia:12560
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/462096
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-10-21 14:26:06 +00:00
Brian Osman
e3ff9b1783 Remove GrContextOptions from GrShaderCaps constructor
Bug: skia:12559
Change-Id: I91e0b46702ca361737459d64d1cdb57f8dd2f64e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/461697
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-10-20 22:51:42 +00:00
John Stiles
b19be63810 Fix ODR violation in Metal code.
In places where we use GR_METAL_SDK_VERSION to determine the contents of
a class, it's important to consistently #include the header which sets
the value of GR_METAL_SDK_VERSION.

Change-Id: Ic4824ff36c982d3493ebec03dd38465bb90b287a
Bug: skia:12513
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/461836
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2021-10-20 21:33:32 +00:00
Chris Dalton
dd07eb01c8 Move VectorXform into the wangs_formula namespace
This class is only meant to be used with Wang's formulas, so it
belongs in their name namespace.

Bug: skia:12524
Change-Id: Ib1667781b947a7f052af103b7bf9084d09a690de
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/461567
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-10-20 18:17:48 +00:00
Chris Dalton
49c766732d Delete the skgpu::tess namespace
Tessellation code can just exist in the skgpu namespace.

Bug: skia:12524
Change-Id: I44d473c5f82d608bb6cd3bb9df239c4f4028da4f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/461557
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2021-10-20 18:16:48 +00:00
Brian Osman
cb3c02005c Add SkColorMatrix factories for SkYUVColorSpace
This lets clients access and use the same RGB to YUV matrices that we
use internally.

Inspired by https://crrev.com/c/3223983

Bug: skia:12545
Change-Id: I7f70f56e721819c3d33da447eff2e572b7774c51
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/461476
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-10-20 16:47:03 +00:00
Herb Derby
0edd2c33d3 use faster cases in blitAntiH for SkVMBlitter
Use the coverage from the mask to avoid or reduce blitting.

nanobench
desk_chalkboard 51ms -> 38ms.

Change-Id: I58e3ca5f9ef59dbd5b9ceb1a905ea1f3d948fd89
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/461296
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2021-10-20 15:27:35 +00:00
Brian Osman
8095adeebb Reland "Simplify draw_image and paint construction"
This is a reland of c091e48f8f

Reland expands the dual-source blending bug workaround to certain
Adreno6xx GPUs (Pixel 4 and 5), where the unit test for
crbug.com/1241134 began to repro after the FP simplification.

Original change's description:
> Simplify draw_image and paint construction
>
> This inlines the body of SkPaintToGrPaintWithTexture to its one
> call site, and simplifies the resulting FP trees slightly. Also,
> explicitly comment (as with TextureOp and GradientShader) why
> we're *really* doing the OverrideInput "optimization".
>
> Bug: skia:11942
> Change-Id: I0a0e9325a7e47e71e861806519d115054e78e7f0
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/459556
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>

Cq-Do-Not-Cancel-Tryjobs: true
Bug: skia:11942
Bug: chromium:1241134
Change-Id: I67d54788255d36d269114834bfecdb5a57ebe7a4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/460978
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-10-19 17:02:49 +00:00
Ethan Nicholas
0118073cd4 Cleaned up SkSL includes
This removes a bunch of includes from header files and replaces them
with forward declarations.

Change-Id: I14a766b84913817f2989437eb78760cec5f048e4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/460976
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2021-10-19 15:01:29 +00:00
Joe Gregorio
7a6247afd6 Revert "Simplify draw_image and paint construction"
This reverts commit c091e48f8f.

Reason for revert: Failing on Pixel 4 and Pixel 5.

Original change's description:
> Simplify draw_image and paint construction
>
> This inlines the body of SkPaintToGrPaintWithTexture to its one
> call site, and simplifies the resulting FP trees slightly. Also,
> explicitly comment (as with TextureOp and GradientShader) why
> we're *really* doing the OverrideInput "optimization".
>
> Bug: skia:11942
> Change-Id: I0a0e9325a7e47e71e861806519d115054e78e7f0
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/459556
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>

Bug: skia:11942
Change-Id: Id809c724d78d2303ab2ee7dac13b916edb89419d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/460977
Auto-Submit: Joe Gregorio <jcgregorio@google.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2021-10-19 14:19:11 +00:00
Ethan Nicholas
ab0a13d9d9 Removed the final remnants of IRGenerator
This completes the long process of moving all of IRGenerator's code and
data into better homes and finally kills the class altogether. There is
a lot of #include churn here due to poor header hygiene in the past;
IRGenerator.h included a ton of stuff and almost everything included
IRGenerator, allowing us to inadvertently be sloppy with our includes.

Change-Id: I70d854e57dec7bd9a311b72f9f72d978d354da98
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/459936
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2021-10-19 13:17:01 +00:00
Brian Osman
c091e48f8f Simplify draw_image and paint construction
This inlines the body of SkPaintToGrPaintWithTexture to its one
call site, and simplifies the resulting FP trees slightly. Also,
explicitly comment (as with TextureOp and GradientShader) why
we're *really* doing the OverrideInput "optimization".

Bug: skia:11942
Change-Id: I0a0e9325a7e47e71e861806519d115054e78e7f0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/459556
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-10-19 13:04:25 +00:00
Aditya Kushwah
99f23a0309 Add labels to Skia OpenGL backend.
This CL will add labels to Skia OpenGL backend using ANGLE's
labeling API.

Bug: chromium:1164111
Change-Id: I479f273fdeb2ba719831ab3de778716c9157b433
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/455899
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2021-10-19 00:09:29 +00:00
Brian Osman
9dd63710f1 Disable GL_NV_shader_noperspective_interpolation on PowerVR
There's probably a more specific check we could use, but we're seeing
shaders fail to compile when enabling this extension on some MediaTek
devices.

Bug: b/177473804
Change-Id: Ic91f60c6935386f44d9386c362e9f778c28a4099
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/460576
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-10-18 21:07:49 +00:00
Ben Wagner
2764d524e7 [pdf] Treat dc:creator as rdf:Seq
Previously dc:creator was treated as an rdf:Bag, but the XMP
specification defines dc:creator as an ordered sequence which should be
stored as an rdf:Seq.

Fixes: skia:12492
Change-Id: Ie0780d281daedbd351101396dcff26a98af6f490
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/459887
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2021-10-18 17:20:29 +00:00
John Stiles
90c86ad06c Report an error when negating or plussing an array of scalars.
Change-Id: I894bfa01e7cf58f140423554d0200b6c66beef35
Bug: oss-fuzz:39998
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/459883
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-10-18 16:04:18 +00:00
John Stiles
9f43ceefa3 Allow vector operator~ in SkSL.
This is supported in GLSL ES3. (Strangely, vector operator! isn't.)
Previously, this was flagged as an error: http://review.skia.org/459885

Change-Id: I2c4299159fff58fefe8bd131c8d317cd82974a62
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/459886
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-10-18 15:03:33 +00:00
Michael Ludwig
75310f0c3f Experimental support for lower-resolution backdrop filter eval
Bug: b/197774543
Change-Id: Ic441387a5a48a4bea7eb508cf53e7f88851ec5f2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/453316
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-10-18 14:46:05 +00:00
John Stiles
9e952b379b Allow const int variables to be used for array sizes.
See http://review.skia.org/460037 for an example of the existing
behavior. Const variables are constant-expressions and should be allowed
here.

Change-Id: I41383d79668785f270b7825485e9f6fa56c553c1
Bug: skia:12549
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/460036
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-10-18 14:23:33 +00:00
Michael Ludwig
5bf1b51e61 Restore aa triangulating path renderer limit to 10 verbs
Bug: skia:12547
Change-Id: Ie55e013c0bf8a3b68267eb319bb75128078078de
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/459716
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2021-10-15 23:29:42 +00:00
Ethan Nicholas
c41ac91167 Removed remaining fields from IRGenerator
This removes all remaining fields from IRGenerator (other than fContext,
which is redundant with the one already in ThreadContext). As
IRGenerator now contains no meaningful data, the remaining work to
finish removing it is trivial, and it will go away as soon as its little
remaining code is re-homed.

Change-Id: I1815f71c14b60383c8e657411a74841386748432
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/459878
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2021-10-15 21:03:48 +00:00
Ethan Nicholas
0e55a137dd Moved SymbolTable from IRGenerator to Compiler
Change-Id: I5971a4650ad9d85e7c9a0420697822dac5d87bc4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/459856
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2021-10-15 16:03:29 +00:00
Ethan Nicholas
4201f90421 Removed fSharedElements field from IRGenerator
Continuing to remove things from IRGenerator. This is another field that
just mirrors state already in ThreadContext.

Change-Id: Ie15842748b55b76ca44c54283b8d9e344f4c670f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/459637
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2021-10-14 19:47:00 +00:00
Ethan Nicholas
64b6af1b1d Removed fProgramElements field from IRGenerator
Continuing the process of removing everything from IRGenerator. This
field just mirrors the one in ThreadContext and so is unnecessary.

Change-Id: I3c6672887a03a83ead46788cf2169c7cfccce2cb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/459636
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2021-10-14 19:39:37 +00:00
Chris Dalton
d0c7f63645 Move Wang's formula back into src/gpu/tessellate
We are making src/gpu/tessellate independent of v1, and more represent
math and types that just know how to tessellate, so this seems like the
right place again for this file.

Bug: skia:12524
Change-Id: I773de3c0f93a57ce7ee16b44480667013f32ebd5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/459136
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2021-10-14 17:34:29 +00:00
Ethan Nicholas
ab19daec3b Moved RTAdjust fixup into FunctionDefinition
Change-Id: Iafbff1bd91ee5c0234f109a514245a35f93eaffe
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/459478
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2021-10-14 16:49:28 +00:00
John Stiles
c8a96076b1 Added four more reserved words to SkSL.
We now detect attribute, varying, precision and invariant as reserved.

Change-Id: I8c90655a70b1bad31bf6143c3fdcb2ce582320b1
Bug: skia:12484
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/459479
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-10-14 16:29:32 +00:00
John Stiles
f7d2673643 Fix up samplerCube/textureCube for ES2 conformance.
`samplerCube` is a type which we don't support at all. It has been added
to the reserved-word list.

`textureCube` was in our list of built-in types, but was not actually
used in any way; it wasn't actually added to the root or private symbol
tables, and was totally unreferenced by the code. It's been deleted.

Change-Id: I4f79ce5d40ac6ebdb2a7067fa60cc79e316b01b6
Bug: skia:12484
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/459123
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-10-14 15:21:31 +00:00
Nico Weber
39edd521a2 Fix Wbitwise-instead-of-logical warnings
`a || b` only evaluates b if a is false. `a | b` always evaluates
both a and b. If a and b are of type bool, `||` is usually what you
want, so clang now warns on `|` where both arguments are of type bool.

In Skia, 3 of 3 uses of `|` were intentional as far as I can tell (one
had an explicit comment, the other two didn't). Rewrite them slightly
to make this intent more clear and to suppress the warning.

There was also one use of `&`. That one looks like a (benign) typo for
`&&`, so change it.

Bug: chromium:1255745
Change-Id: I9ac37075311005c0a8fcb8d1379f516510929423
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/459456
Commit-Queue: Nico Weber <thakis@chromium.org>
Commit-Queue: Florin Malita <fmalita@google.com>
Auto-Submit: Nico Weber <thakis@chromium.org>
Reviewed-by: Florin Malita <fmalita@google.com>
2021-10-14 14:50:09 +00:00
Ethan Nicholas
6cfe358193 Moved CheckModifiers out of IRGenerator
Change-Id: Ic9288665fd31bde986720cd259b132a5cb9d87a6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/459178
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2021-10-14 14:30:01 +00:00
Ben Wagner
8b0ba16043 Speed up DWriteFontTypeface::getGlyphToUnicodeMap
Use IDWriteFontFace1::GetUnicodeRanges to speed up creating the glyph to
unicode map by greatly reducing the number of codepoints to query. Also
batch up calls to GetGlyphIndices instead of calling one codepoint at a
time.

Bug: skia:12537
Change-Id: I53641d563fd7a5b670217590a505dedceabc9d21
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/459179
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2021-10-14 14:21:12 +00:00
John Stiles
21fe518fbb Revert "Disallow matrix ctors which overflow a column."
This reverts commit eb68973c2f.

Reason for revert: ES2 conformance test checks this

Original change's description:
> Disallow matrix ctors which overflow a column.
>
> The GLSL spec allows matrix constructors containing vectors that would
> split between multiple columns of the matrix. However, in practice, this
> does not actually work well on a lot of GPUs!
>
> - "cast not allowed", "internal error":
> 	Tegra 3
> 	Quadro P400
> 	GTX 660
> 	GTX 960
> - Compiles, but generates wrong result:
> 	RadeonR9M470X
> 	RadeonHD7770
>
> Since this isn't a pattern we expect to see in user code, we now report
> it as an error at compile time. mat2(vec4) is treated as an exceptional
> case and still allowed.
>
> Change-Id: Id6925984a2d1ec948aec4defcc790a197a96cf86
> Bug: skia:12443
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/449518
> Commit-Queue: John Stiles <johnstiles@google.com>
> Auto-Submit: John Stiles <johnstiles@google.com>
> Reviewed-by: Ethan Nicholas <ethannicholas@google.com>

Bug: skia:12443
Change-Id: I5a32744c88b9b830ad657488824c8c7dd0b0a652
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/458056
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
2021-10-14 01:30:08 +00:00