Fixed several other places that were regenerating the `preLocal` matrix
name from scratch, instead of using the passed-in name.
Change-Id: I11824a31b6d3eba9944c6166b11bfd1ccb2f50ed
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/558303
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Previously, `generate_default_before_children_glue_code` would create
a new variable but wouldn't actually return its name. This made it
difficult to use in several ways:
- The caller would need to manually regenerate the variable name
- We may just want the matrix expression, not a whole new variable
(in the context of a runtime effect, we might not have the luxury of
freely inserting new statements into the code)
We now have a function `pre_local_matrix_for_entry` which returns the
pre-local matrix expression but does not assign it to a variable at
all. This simplifies our implementation of `emit_glue_code_for_entry`
because we no longer need to recreate the variable name.
Change-Id: Ib5e32db1543b34d154c7df6b31140564f888f584
Bug: skia:13405
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/558298
Reviewed-by: Robert Phillips <robertphillips@google.com>
Previously, `emitGlueCodeForEntry` assumed that every child should be
invoked exactly once, and those values should be passed into the shader
snippet.
This model does not work for Runtime Effects. A runtime effect is
free to invoke its children multiple times, or not at all. Now,
glue code generators can choose to call `emit_child_glue_code` and get
the old behavior, or they can handle children their own way as
needed. In practice, GenerateDefaultGlueCode uses this function, but
no other glue-code generators currently use children or have a need
to call it.
This CL also changes `emitGlueCodeForEntry` into a free function
instead of a private method. This makes it possible for us to use
this function from the glue-code generators, which are not part of
SkShaderInfo. SkShaderInfo is documented as a "simple collection
object," so this is probably the right design anyway.
Change-Id: I6975ca92df8a71942f09d7d9ea6f146d9eb3b9ab
Bug: skia:13508
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/558157
Reviewed-by: Robert Phillips <robertphillips@google.com>
Bug: skia:13438
Change-Id: Iba09a04f648f4a11a18e3dd82a257036e311a167
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/555636
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
While at the moment we only support a single camera layer, we're still
parsing all cameras (in case they are being used as parent layers).
Remove the assert in getParentTransform() and check for camera layers
explicitly instead, to avoid crashing in debug builds.
Bug: skia:13515
Change-Id: Iaaec828941d206a6e02c5921a7d26a75ad899832
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/557897
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Jorge Betancourt <jmbetancourt@google.com>
Bug: skia:11301
Change-Id: Ie6a5ef920093b63983d8dbbdbaa94960fa7af83c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/558304
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Moved sktext::gpu::StrikeRef to sktext::StrikeRef in the file
StrikeForGPU.h. The move required a strangely large number of
header fixing up.
StrikeRef will be returned by StrikeForGPUCacheInterface in
future CLs.
Change-Id: I7f71cec586d4d9ed66b2b7adb5c848ca1fe273de
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/558077
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
The glue-code functions don't do anything useful if we have disabled
SkSL or Graphite.
Change-Id: I67db1dcd202528769e643671e9b269a853fc93f9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/558296
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
With the removal of CommandBufferTest this is no longer needed.
Bug: skia:13357
Change-Id: Id7d4afadf5559f651cac14bcdc5f30f91e065443
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/555078
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Comment explains the rationale - even in the presence of divide by zero,
we will produce the correct answer.
Bug: oss-fuzz:48607
Change-Id: I2a2ebe5ecdd8eefa76b3b3d93d3065c38e4dc750
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/558076
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
This should save a few kilobytes of space for our non-Graphite clients.
Change-Id: I1528450963c77329e37451ef935a6ffd80999cfa
Bug: chromium:1343014
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/557902
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
This change has the potential to break existing clients if they pass
nullptr as the childShaderName, which used to be supported. To fix
this breakage, pass the empty string instead of null.
Change-Id: I984ec0e12be5bb0a82ec5b719fec48ee7d577dc4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/557898
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
This will move it to the .rodata section.
Change-Id: I5a88cb198180a8e8e02fe506fe716df56034a39c
Bug: chromium:1343014
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/557899
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
This is a straight up mechanical rename and split.
Bug: skia:13438
Change-Id: I860b5d537924e1f872ce502477beefaae1fcb2f9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/557896
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
This was only used in one place, and the input FP was always nullptr. In
that situation, it just returns 'args.fDestColor'. Given that, rename
it, and remove the argument.
Change-Id: I8507f9f93b3010beea87d344c8346aa771b875e6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/557840
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Notes to reviewer:
- modules/canvaskit/npm_build/types/canvaskit-wasm-tests.ts
is not actual test code that is executed. It is parsed with
our types (index.d.ts) only, as a way to make sure the
declared types match up with how one would write code.
- MakeDisplacementMap looked a bit strange when I tried to
use it. It might be easiest to debug if we land as is,
so we can use jsfiddle to test dynamic parameters.
- modules/canvaskit/package-lock.json was updated by running
npm audit fix.
- There are two copies of the test cases, one for the old
way, and one for Bazel. Getting Bazel on the CI is currently
blocked (http://review.skia.org/547576)
- I am adding all the image filters in by default for now,
we can measure code size and adjust them if needed later.
Change-Id: I2f4eae71de7ee5d53f0c74147d0662f156522d18
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/555596
Owners-Override: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
PredefinedColorSpace was not available before then.
To upgrade the package-lock.json, I deleted the node_modules
folder in npm_build and the existing package-lock.json,
then ran `npm install` (using npm 7.20.6, along with node
14.15.0).
There was still an issue with the order of types in
the type union for readPixels. Apparently, TS changed
this slightly in a version upgrade. To address this,
I added an "or" to that type assertion, along with
a comment.
I double-checked the necessity of reference types="@webgpu/types"
and this is needed to use things like GPUTexture and
GPUDevice.
Change-Id: I7044ae562c155ad4405dbc0e3d647601014fefdc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/557738
Reviewed-by: Arman Uguray <armansito@google.com>
Change-Id: I294453bb18b9ecd46a84cdfaac831679437a4fe2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/557589
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
When allocating memory with malloc(), allocators can provide a larger
size than requested. SkArenaAlloc tries to guess what jemalloc would
return, and align its allocation requests on the to-be-provided
size. Some platforms (e.g. glibc or bionic with malloc_usable_size(),
macOS with malloc_size()) can provide the actual value.
This CL adds support to skia's malloc() wrappers to get this data, and
to SkArenaAlloc to use it. Note that as is, this is a no-op in skia
proper. Indeed, clients can (and do, for instance Chromium does)
override sk_malloc() (and friends), so Skia cannot assume that
sk_malloc() memory comes from malloc().
To implement this, a client needs to override sk_malloc_usable_size() to
return the actual value.
Bug: chromium:1335342
Change-Id: Id8ea177e9adccc9c4446fe379b6f05e726ea07ce
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/549516
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Change-Id: I07c0cb63286cb2c74853a49a44a9ee5ae7b994c9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/557102
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Bug: skia:13118
Change-Id: I94131b9d05f73445def32d9e880a6048a23de74d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/557585
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Includes a unit test that we handle ES3 effects correctly
on all devices.
Bug: skia:11209
Change-Id: Ib99bc91b0d1f09dc523db5cbea78613fc1e63b04
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/550702
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
SkSL versioning was originally based on a binary "strict ES2" versus
"everything else" split, but now we have an SkSL::Version enum which
gives us more fine-grained control.
Change-Id: Ic7e26381cc3c4c1868bd6ee48d4f44d704dae119
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/557378
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
This CL adds two new APIs to SkCanvas: getBaseProps, and getTopProps.
SkCavas::getBaseProps is functionally identical to getProps, but returns
the SkSurfaceProps by value, rather than via an 'out' parameter.
SkCanvas::getProps is now considered deprecated.
SkCanvas::getTopProps returns the 'currently active' SkSurfaceProps,
i.e., it returns the props from the "top device". This is useful
because the SkSurfaceProps can change when creating new layers.
Bug: skia:13483
Change-Id: Ia1d9a10ffdd929427f1f2c0a7c4ba6965d4bd3c0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/554736
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: Ian Prest <iapres@microsoft.com>
As we fully encapsulate the gradient derived classes they are going to
need access to their shared utilities.
I will follow up w/ a CL splitting SkGradientShaderBase out into its
own header and .cpp file.
Bug: skia:13438
Change-Id: I305e06ab3b3dfac384bc1151a58906f6a3c0c496
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/557637
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Its defined in the header file though.
Bug: skia:13329
Change-Id: I5f9551aea269af1295c8c04433f813e8ff2fcec5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/557737
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
This will work fine with existing call sites passing a const char*,
and unlocks the ability for passing string_views when we don't have
null-terminated text handy.
Change-Id: I4e69b1cbccceba19bc77d70a48c6fc9dff8ba87e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/557587
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Change-Id: I5bda64c41119222a144b085910a0127f2e16a65d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/557588
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
This will let us pass in string_views as labels even if they aren't
zero-terminated.
Change-Id: Iee941528e041531d5d63a05d760d1c77e9c7769d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/557099
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
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>
In GLES 3.0+ even though HALF_FLOAT is a valid type it is not listed as
a valid type combination with LUMINANCE. Thus we need to still use the
type from the extension HALF_FLOAT_OES in combination with LUMINANCE.
Bug: b/238170249
Change-Id: I2adba67fa98a8adac0345f0af9783e299674f9c0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/557580
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
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>
Bug: skia:13446
Change-Id: If1cb6a27858cfcee10439c70cdac2e66761e05a3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/557392
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Many runtime shaders are now able to render something in Graphite.
Child effects are not supported, so effects which rely on these will
not work properly.
Change-Id: I19190161b641420be3b813a518b80ebbb5f6b500
Bug: skia:13405
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/557097
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
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>
At long last, we can retrieve our SkRuntimeEffect from within the
Graphite glue code. In this CL, we simply assert that it can be found
in the dictionary.
Change-Id: I43e8296a0138b6dddae78fd4fbc80c8f5afa1da5
Bug: skia:13405
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/556797
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Change-Id: I2fdbff5c4d58d5eace99abd809b2c9861c629ce4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/557356
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>