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>
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>
The auto-generated URL link contains the left parenthesis, which makes
the URL linked to a 404 page.
Fix it by explicit specifying the URL linked.
Change-Id: Ic44a8cb8eecd8bbec6a9ef68b53acf201d739357
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/554817
Commit-Queue: Joe Gregorio <jcgregorio@google.com>
Reviewed-by: Joe Gregorio <jcgregorio@google.com>
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>
In practice we didn't have any code which uses uniform shorts, but
unit testing quickly uncovered that this conversion path was never
written. (In non-Metal layouts, getUniformTypeForLayout will convert
the shorts to 32-bit ints.)
Change-Id: I31985628d7f03e1e6d1ce592d6a4b6eb4598718e
Bug: skia:13478
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/554338
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Mistakenly changed this with the last CL.
Bug: skia:13118
Change-Id: Iadf39a8dc37a7d6bc5ffcc15031ba8c4d8ffec27
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/554340
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Auto-Submit: Jim Van Verth <jvanverth@google.com>
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>
Because glyph dimensions are always forced to integers, using simple
ratios to calculate scaling factors doesn't always create glyphs that
are small enough to fit in the atlas.
Keep reducing the font size until all the glyphs fit in the atlas.
Change-Id: Iac2c75d0e58dfd993ea5e8e356eae762eaa111d4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/554078
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Sets up the matrix that transforms the SubRun data to device space,
and adds a method to get the correct Renderer for a SubRun.
Bug: skia:13118
Change-Id: I6d478af02a5e21635a7ed6c49f1c2a0649937f8b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/553524
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
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>
Internally, uniform gathering used a generic method based on the
SkSLType of the uniform, but the exposed methods only allowed writing
(a subset of) those uniform types, via overloads/type deduction.
It's easiest for Runtime Effects to write the uniforms generically,
using the SkSLType approach.
This CL exposes the SkSLType-based approach publicly, and makes it
work properly with the UniformExpectationValidator.
Change-Id: I7484859fba664bd422e270a57d59fd49cb2c54c0
Bug: skia:13457
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/554079
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
At present, the custom glue code just emits a function that behaves
the same as `sk_runtime_placeholder` (solid magenta). It does
generate a standalone function in the preamble, though, and correctly
passes the local-coords and input color to it.
Change-Id: I0832c406f2273630f853ace420120deb0b7bd745
Bug: skia:13405
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/554080
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Adds SubRunData class to wrap all of the necessary data to be passed
to the text Renderers.
Bug: skia:13118
Change-Id: I0bc9988400817951abc0876dc56197b89ce0bcfd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/553586
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Bug: skia:13477
Change-Id: I524e076282e9dde3a8ad5d39c58e6054f684fbf0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/554376
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
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>
This code has the potential for reuse, and is complex enough to stand on
its own. (I thought I would need to reuse it in a separate CL, but I
eventually realized that I wouldn't need it; still, it's useful to have
prepared.)
Change-Id: I5da1a39d57cd3d4b2504932801002b6eead22915
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/554081
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Currently there are two values:
*Read - map for reading. effect of writes is undefined.
*WriteDiscard - discards previous contents before mapping for writing.
MapType is currently determined by GrGpuBufferType but is nonetheless
communicated to subclass via virtual onMap and onUnmap. Not all
backends actually actively discard with WriteDiscard for all types
of buffers.
Some internal map/unmap functions in GrGpuBuffer subclasses now take
ranges. This is in anticipation of adding an offset param to
updateData. Some backends that use mapping in onUpdateData will be
able to use a more optimal subrange. The exact meaning of the ranges depends on the backend API's mapping semantics (e.g. a range to map,
a range to flush from CPU to GPU, a range to complete gpu writes before
reading).
Bug: skia:13427
Change-Id: I470c70336eef1538855bd4951163fd74b06ea5f4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/553356
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Part of an ongoing effort to move chromium away from SkColor and towards SkColor4f: crbug.com/1308932
Many tests use SkBitmap::getColor to validate pixels, this means that we're now in a state where we draw using float colors but then have to validate the operation with the nearest integer color value. As can be seen in SoftwareRendererTest.SolidColorQuad.
Change-Id: Ic4493e578c8f4066c2439f1e793eef10eb4f4056
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/553797
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Several canvases in the npm_build/example.html demo now use WebGPU if it
is supported by the browser and the CanvasKit build in use.
The examples have been refactored to support both WebGPU and non-WebGPU
mode of usage. Two examples that currently rely on Surface.drawOnce
don't work correctly on WebGPU as the API call may draw to the wrong
swapchain texture ("paths" and "pathperson") and will benefit from a
`WebGPUCanvasContext.drawOnce` function.
Bug: skia:13427
Change-Id: I16dc06a9788cf78e86b2097f44c1f83ca0b2315a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/553637
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Arman Uguray <armansito@google.com>
* The native backend exposes a variant of _MakeGrContext that creates a
GrDirectContext backed by a Dawn wgpu::Device.
* The native backend currently exposes a single API function,
"_MakeGPUTextureSurface" which returns a SkSurface from Dawn backend
render target over a Dawn wgpu::Texture. This function can be used to
draw to any WebGPU texture, including offscreen textures or to a
canvas swapchain texture.
* The MakeGPUDeviceContext, MakeGPUCanvasContext, MakeGPUCanvasSurface
functions are implemented purely in JavaScript.
* The CanvasKit.webgpu property can be used to detect whether WebGPU
support has been compiled in.
Bug: skia:13427
Change-Id: I953f24ca58389d5989a108685abbc02e56d4e18b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/553636
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Arman Uguray <armansito@google.com>
This will keep the runtime effect alive and findable until we are ready
to paint it.
Change-Id: If047dfa8be1376a7a2a092211e0cbbdedfd2faf0
Bug: skia:13405
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/553579
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
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>
We are on C++17 now and already use `if constexpr` where necessary.
Change-Id: Icc780b6e4db7ae6ccc648ea333a172f11bf0581c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/553584
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
The Context is going to have to be able to make some Resources when we
insert a recording onto it. Some examples of this will be discardable
MSAA and Stencil attachments that are shared by all Recordings.
Bug: skia:13357
Change-Id: I9d49f640404176d38416372fd208b591b032d599
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/553581
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
This CL is mostly moving the queue/command buffer systems off of Gpu and
Context and moving them to the QueueManagerClass.
Bug: skia:13357
Change-Id: I0ee5096c84b1210082745fafd2d38791fd9be52e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/549557
Reviewed-by: James Godfrey-Kittle <jamesgk@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>