Commit Graph

1602 Commits

Author SHA1 Message Date
Greg Daniel
6d1d2c0898 [graphite] Support wrapped Textures in the backends.
Bug: skia:12633
Change-Id: I3e4542e560a2c876b4b35bf340bdb949c4922c65
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/472556
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2021-11-17 16:56:04 +00:00
Brian Salomon
30970525fd At SkDevice level and below use SkBlender instead of SkBlendMode
Draws that take a primitive with colors (vertices, patch, atlas) allow
the user to specify how the primitive color is blended with SkShader.

At the public level the blend is specified as SkBlendMode. This change
moves the implementation at SkDevice level over to SkBlender.

Future changes to the existing APIs or future APIs could allow clients
to specify SkBlenders instead of SkBlendMode. THis would would allow for
programmable blending between shader and primitive color.

SkShader_Blend now recognizes if it was constructed with a Mode blender
and extracts the mode enum.

SkBlender_Base::asFragmentProcessor no longer assumes that the dstFP's
input color should be args.fDestColor. Instead the caller
must configure that if desired. (We don't want this for drawAtlas, etc).

Change-Id: I44085da4ec9f4873428f38d629565f7f42c6be91
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/470458
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-11-17 16:53:28 +00:00
Jim Van Verth
e136c31fe4 [graphite] Add rasterization state methods to CommandBuffer
Bug: skia:12466
Change-Id: Iafd680901e10d1007a16da0112e41af4bf2f2703
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/472445
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2021-11-17 15:45:07 +00:00
Michael Ludwig
78a0a2a93d [graphite] Move VertexAttribTypeSize to DrawTypes.h
Bug: skia:12466
Change-Id: I6d45f297db4be7e41158d87886ef03905e13eb66
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/472437
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2021-11-16 20:11:34 +00:00
Robert Phillips
4f806e0e02 Add UniformSlot to CommandBuffer API
This is split out of Michael's CL:
https://skia-review.googlesource.com/c/skia/+/468459

The CommandBufferTest gets a bit shortchanged in this CL but most of those changes should wait until the GraphicsPipelineDesc is expanded anyways.

Bug: skia:12466
Change-Id: Idba20354a4ab158c2bc46f490da23b8f5fcd55b4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/472336
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-11-16 19:11:21 +00:00
Robert Phillips
80ee93d2f5 Add ShaderType::kSolidColor and make Combinations work w/ PaintParams
This is split out of Michael's CL:
https://skia-review.googlesource.com/c/skia/+/468459

Bug: skia:12466
Change-Id: Ic38ee577553cf2c0d4da8130e80a11422fa2b92e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/472177
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-11-16 16:31:09 +00:00
Greg Daniel
7b64e138b5 [graphite] Remove use of GraphiteTypesPriv and move to *Types in src.
We should only be using include/private for types that actually are
needed in include/ files. I moved everything that was just in src to
new src/*Types.h files. This actually left nothing in GraphiteTypesPriv
for now, so I deleted it. If we actually need private types that are
part of include/ we can add it back later.

Bug: skia:12466
Change-Id: I180fc2032afd47bc6c5e8b9ccd4954b5d2451fc7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/471758
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2021-11-15 20:57:23 +00:00
Greg Daniel
686ccec13f [graphite] Add BackendTexture abstraction for Graphite.
There are definitely some missing getters on other functions we'll need
on BackendTexture. But for this CL I just wanted to get the basics and
ctor working. Other functions can be added as they are needed.

Bug: skia:12633
Change-Id: I668828138df943a432efcec6b1134756e681a582
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/469820
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2021-11-15 18:03:40 +00:00
Jim Van Verth
300f51ac51 [graphite] Be explicit about pending draws on DrawContext destruction
Bug: skia:12466
Change-Id: I266ee1ae865e85f778191c7812b690e203bb4df4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/471096
Auto-Submit: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2021-11-13 00:52:05 +00:00
Jim Van Verth
23dafe81e0 [graphite] Implement fullscreen clear as LoadOp
Bug: skia:12466
Change-Id: Ie8bbacd22375b4cb4a5fe7e39055cdba3a3d0896
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/469519
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2021-11-12 21:20:37 +00:00
Jim Van Verth
5182ed33a9 [graphite] Revise RenderPassTask construction
RenderPassTask should only represent a single RenderPass with possible
subpasses (represented by DrawPasses). This reconstructs the RenderPass
setup to match this thinking. RenderPassDesc now stores TextureProxys for
the attachments, since we may not have instantiated the Textures by the
time we create the RenderPassTask.

Bug: skia:12466
Change-Id: I4f8cab77a297aaf76bea7dd1cc3afd00143b8103
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/470460
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2021-11-12 15:10:24 +00:00
Brian Salomon
384ba65b8d Remove GPU V2
Replaced by Graphite.

Change-Id: Iac0ba212b078904a591677c9ce839a90562d0240
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/470305
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-11-11 17:11:19 +00:00
Jim Van Verth
1c0d713153 [graphite] Add offsets to vertex buffers
Bug: skia:12466
Change-Id: Icf59f2412a66f3f339635014f4b1e4c44d3c1619
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/469523
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2021-11-10 15:13:30 +00:00
Jim Van Verth
9b353b90c6 [graphite] Add commands to CommandBuffer from Tasks
Bug: skia:12466
Change-Id: I1e92dcf66c117ca351cebf20722524672c88e5cd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/469178
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2021-11-09 15:10:22 +00:00
Kevin Lubick
1f8c31b101 [infra] Add initial Bazel rules and files
These rules can be used to build our GMs on WASM+WebGL and
libskia.a with just the CPU backend (and most other features
turned off).

This can be done with the following commands:
  - bazel build //modules/canvaskit:gm-bindings-wasm --gpu_backend=gl_backend --with_gl_standard=webgl_standard
  - bazel build :skia-core --config clang

This pivots slightly from http://review.skia.org/463517
by using config_settings [1] instead of platforms for
the optional features that we control. This pivot was
suggested in [2]

We have BUILD.bazel files in many of the subdirectories
that specify filegroups for the appropriate files. In
an effort to make //BUILD.bazel more readable, it is
the responsibility of these subfolders to deal with
conditionally including certain .h or .cpp files.
This is done using select statements and config_settings
or platform constraints as necessary.

For example, src/gpu/BUILD.bazel will different private
filegroups for each of the supported gpu backends [3]
and a more-visible filegroup called "srcs" that has
the right selection of the private files to be used
for compilation.

An effort has been made to avoid using glob() in our
BUILD.bazel files. These file lists were made by using
`ls -1` and some regex to add in quotes. We might want
to make a helper script to assist with that, if necessary.

To specify which options we have, the settings in
//bazel/common_config_settings/BUILD.bazel have been
redesigned. They make use of a macro `string_flag_with_values`
that removes the boilerplate. Patchset 36 shows what the
file looks like w/o the macro.

The top level BUILD.bazel file will still need to use
some logic to handle defines, because local_defines is
a list of strings, not a list of labels [4].

Suggested Review Order:
  - WORKSPACE.bazel to see the new dependencies on the
    emsdk toolchain and bazel_skylib
  - bazel/common_config_settings/* to see the few settings
    defined (we have more to define, see BUILD.gn and
    //gn/skia.gni for ideas)
  - BUILD.bazel to see the "skia-core" cc_library rule.
    See also "gms" and "tests"
  - modules/canvaskit/BUILD.bazel to see the use of
    the emscripten "wasm_cc_binary" rule, which depends
    on the "skia-core", "gms", and "tests" rule. Note that
    it only builds some of the gms as a proof of concept.
  - The other BUILD.bazel files. Some of these are not
    platform or feature dependent (e.g. pathops). Others
    are (e.g. gpu).
  - All other files.

[1] https://docs.bazel.build/versions/4.2.1/skylark/config.html#user-defined-build-settings
[2] https://github.com/emscripten-core/emsdk/pull/920
[3] In this CL, that's just the webgl one.
[4] https://docs.bazel.build/versions/main/be/c-cpp.html#cc_library.local_defines

Change-Id: Ieecf9c106d5e3a6ae97d13d66be06b4b3c207089
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/458637
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Leandro Lovisolo <lovisolo@google.com>
Owners-Override: Kevin Lubick <kjlubick@google.com>
2021-11-09 12:32:25 +00:00
Michael Ludwig
497ac0fe23 [graphite] Rename RenderPipeline[Desc] to GraphicsPipeline[Desc]
Also updates MtlRenderPipeline to be MtlGraphicsPipeline to match the
type it extends, although we could choose to have it stay matched with
the backend object (MTLRenderPipeline) that it wraps instead.

Bug: skia:12466
Change-Id: Ida118e68a93d737d21edca15a59f5e64e17b5fd0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/467780
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2021-11-05 18:58:15 +00:00
Robert Phillips
f2b5dc8aaf [graphite] Fix MSL FS generation
Bug: skia:12466
Change-Id: Icd23abfa9ab1197a03e5d0f177747ea77b6b77e8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/465391
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-11-04 16:56:02 +00:00
Jim Van Verth
6990ee0dad [graphite] Add RenderPassTask::execute
Bug: skia:12466
Change-Id: Id1e8311cbe5bfbc7a2c9aa9cc106ebef1d363e63
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/467459
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2021-11-03 20:00:21 +00:00
Greg Daniel
5e52389d5f Reland "[graphite] Fill in basic vertex and index buffers."
This is a reland of b95c83353f

Original change's description:
> [graphite] Fill in basic vertex and index buffers.
>
> Bug: skia:12466
> Change-Id: I2398fcabc6c797a0bfc2ebccc0289cbf8fd8c72f
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/466436
> Commit-Queue: Greg Daniel <egdaniel@google.com>
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>

Bug: skia:12466
Change-Id: Iac083c75d15f46ede1c8337da2914ad0161909e0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/466774
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2021-11-02 16:57:14 +00:00
John Stiles
40d5fbb3c7 Add support for half-precision uniforms to Graphite.
If our shaders pass a halfN uniform to Metal, we need to put SkHalf data
into the uniform buffer.

Change-Id: I92324715e7fb64f3b342fdf2c6994ebb86ba1773
Bug: skia:12339
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/465756
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2021-11-02 15:16:46 +00:00
John Stiles
6934766e60 Rename Uint to UInt.
Uint was inconsistent--we had UByte and UShort, so ints should be UInt.

Change-Id: I71fdc3db902cdf62ab1de705dca2b0d069e9effb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/466499
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2021-11-02 15:05:52 +00:00
Robert Phillips
15f17c0576 Revert "[graphite] Fill in basic vertex and index buffers."
This reverts commit b95c83353f.

Reason for revert: Test-Mac11-Clang-MacMini9.1-GPU-AppleM1-arm64-Debug-All-ASAN_Graphite failure

Original change's description:
> [graphite] Fill in basic vertex and index buffers.
>
> Bug: skia:12466
> Change-Id: I2398fcabc6c797a0bfc2ebccc0289cbf8fd8c72f
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/466436
> Commit-Queue: Greg Daniel <egdaniel@google.com>
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>

Bug: skia:12466
Change-Id: I2cd986ef78741e699087a23c4ac963e4ddaa61d4
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/466756
Auto-Submit: Robert Phillips <robertphillips@google.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2021-11-02 00:21:09 +00:00
Greg Daniel
b95c83353f [graphite] Fill in basic vertex and index buffers.
Bug: skia:12466
Change-Id: I2398fcabc6c797a0bfc2ebccc0289cbf8fd8c72f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/466436
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2021-11-01 20:36:51 +00:00
Herb Derby
83e99569bd add constrained_add
This adds check to make sure that the results in the last
add of the lerp are in range. Also, Smooth out types.

Change-Id: I853835e530f6b6790e16464db12964d68ab9ef8d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/453718
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Herb Derby <herb@google.com>
2021-11-01 17:30:16 +00:00
Ben Wagner
8e37086c50 Remove SK_SURFACE_COPY_ON_WRITE_CRASHES
This flag is no longer needed, so remove it and the code it protected.

Change-Id: I679eb3cb4cee81c4205309012931e134e108f232
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/465696
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2021-11-01 15:04:14 +00:00
John Stiles
9b9805959d Reland "Add support for half-precision types in Metal."
This reverts commit 9d24b02c2f.

Reason for revert: needs premul/unpremul conversion fix (http://review.skia.org/465798)

Original change's description:
> Revert "Add support for half-precision types in Metal."
>
> This reverts commit d90e09b1ae.
>
> Reason for revert: MacMini failing CompressedBackendAllocationTest
>
> Original change's description:
> > Add support for half-precision types in Metal.
> >
> > This will hopefully improve performance on lower-end GPUs.
> >
> > Change-Id: I9c2ee6dc31acd08bec0bfb5f59edc3cf90163f9e
> > Bug: skia:12339
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/465078
> > Auto-Submit: John Stiles <johnstiles@google.com>
> > Reviewed-by: Brian Osman <brianosman@google.com>
> > Commit-Queue: John Stiles <johnstiles@google.com>
>
> Bug: skia:12339
> Change-Id: Ic5aa4bef454ca67f5ce26c600444d9565e0158cb
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/465796
> Auto-Submit: Brian Osman <brianosman@google.com>
> Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>

Bug: skia:12339
Change-Id: I53a8a6fef299da15d206d884ba7029820ffcff43
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/465799
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-10-30 14:33:52 +00:00
Brian Osman
9d24b02c2f Revert "Add support for half-precision types in Metal."
This reverts commit d90e09b1ae.

Reason for revert: MacMini failing CompressedBackendAllocationTest

Original change's description:
> Add support for half-precision types in Metal.
>
> This will hopefully improve performance on lower-end GPUs.
>
> Change-Id: I9c2ee6dc31acd08bec0bfb5f59edc3cf90163f9e
> Bug: skia:12339
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/465078
> Auto-Submit: John Stiles <johnstiles@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: John Stiles <johnstiles@google.com>

Bug: skia:12339
Change-Id: Ic5aa4bef454ca67f5ce26c600444d9565e0158cb
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/465796
Auto-Submit: Brian Osman <brianosman@google.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2021-10-29 23:04:09 +00:00
Robert Phillips
60e456ecbb [graphite] Partially connect Recorder, DrawBufferManager, DrawPass, and UniformCache.
Additionally, the default clip state was quick rejecting all the draws.

Bug: skia:12466
Change-Id: I8eaa95418bf24af2a5718c8cf21e97cdd7f80a34
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/465476
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2021-10-29 22:31:34 +00:00
John Stiles
d90e09b1ae Add support for half-precision types in Metal.
This will hopefully improve performance on lower-end GPUs.

Change-Id: I9c2ee6dc31acd08bec0bfb5f59edc3cf90163f9e
Bug: skia:12339
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/465078
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-10-29 19:47:02 +00:00
Greg Daniel
50add5af1a [graphite] Add support for synchronous surface readpixels
Bug: skia:12466
Change-Id: Ia0da94fc300ab678712e9bb79a011694fea8595e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/464677
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2021-10-29 17:43:04 +00:00
Robert Phillips
527d127719 [graphite] Partially connect DrawPass, UniformCache and ProgramCache
Bug: skia:12466
Change-Id: Ib23a501664ebba581376fa0cb1ce5c6537e5d349
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/465136
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2021-10-29 15:58:30 +00:00
Jim Van Verth
b5450fb901 [graphite] Add index buffer support and instanced draws
Bug: skia:12466
Change-Id: I12c64396791d8e0b8891b82927b1c8811a6e164f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/464385
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2021-10-28 21:31:32 +00:00
Robert Phillips
db7f2c67c2 [graphite] Add lookup by unique ID to program and uniform caches
The SortKey will only hold the uniqueID of the program and uniform data. When actually executing the draw we will need to reconnect with the actual data.

Bug: skia:12466
Change-Id: Iea7f0a99d471ea7fe2a3864bdd60255b09289088
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/464926
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-10-28 19:43:00 +00:00
Jim Van Verth
762a01fd99 [graphite] Stub out details of DrawList->DrawPass algorithm
Bug: skia:12466
Change-Id: I3c3eda26d0c09a58108a5b7bdd1bca0e63973f17
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/462887
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-10-28 19:00:25 +00:00
Robert Phillips
8b49157aae [graphite] Move MSL creation into the ProgramInfo
Bug: skia:12466
Change-Id: If31d25a1f4a4805069f6556c6802f33fa0bdfcc1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/464380
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2021-10-28 18:48:40 +00:00
Greg Daniel
391f941949 [graphite] Add a Graphite no Gpu (i.e. Ganesh) build bot
Make sure graphite compiles standalone and not just if ganesh is also
enabled.

Bug: skia:12466
Change-Id: Ic843881a2a88c8d4b62f3a2ea38a10b6a86a12d4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/464817
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2021-10-28 17:58:59 +00:00
Robert Phillips
1fe391f0dc [graphite] Add caches for uniformdata and programs
Bug: skia:12466
Change-Id: Id61b019b583357bb9474c58a81270b0b860c9c4f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/464120
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-10-28 17:02:57 +00:00
Michael Ludwig
8837686752 [graphite] Actually record draws in DrawList
Bug: skia:12466
Change-Id: I91e1e90900997ad1e16710b51fa3dcdde6861d38
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/462886
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-10-28 16:32:35 +00:00
Ben Wagner
4b38d9c437 Reland "Avoid crash when surface CoW allocation fails"
On low memory machines a common cause of crashes is when a draw
operation requires a large layer (or many large layers) because an
implementation of SkSurface_Base::onCopyOnWrite does not actually have
the resources available to do the copy when required by a draw. Allow
this method to fail and percolate up the call chain so that the draw
simply does not happen instead of crashing.

It appears some users are creating their own subclasses of
SkSurface_Base for their tests. Add SK_SURFACE_COPY_ON_WRITE_CRASHES to
keep the old crashy behavior until they can be updated.

Bug: chromium:1116362
Revert: 5b19ebe0c5.
Revert-Change-Id: I2873589f996ded9c9fd6d27b19155ca18d5b5326
Revert-Reviewed-on: https://skia-review.googlesource.com/c/skia/+/463956
Change-Id: Id06d1e6d3aacb409a3b00b9a862bd8ddd1aaa22f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/464456
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2021-10-28 16:32:29 +00:00
Jim Van Verth
66485f9268 [graphite] Add vertex and instance buffer support.
Adds Attributes and supporting types to RenderPipelineDesc so they can
be created for the RenderPipeline.

Bug: skia:12466
Change-Id: I7ed920ea6d44f27f7dace81d35cd967a8dea55de
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/464377
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2021-10-28 14:50:38 +00:00
Greg Daniel
5b19ebe0c5 Revert "Avoid crash when surface CoW allocation fails"
This reverts commit 2e228bb72c.

Reason for revert: breaks android roll

Original change's description:
> Avoid crash when surface CoW allocation fails
>
> On low memory machines a common cause of crashes is when a draw
> operation requires a large layer (or many large layers) because an
> implementation of SkSurface_Base::onCopyOnWrite does not actually have
> the resources available to do the copy when required by a draw. Allow
> this method to fail and percolate up the call chain so that the draw
> simply does not happen instead of crashing.
>
> Bug: chromium:1116362
> Change-Id: I2873589f996ded9c9fd6d27b19155ca18d5b5326
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/463956
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Reviewed-by: Herb Derby <herb@google.com>
> Commit-Queue: Ben Wagner <bungeman@google.com>

Bug: chromium:1116362
Change-Id: I5ab590b6fc14bcb6712c00dda75d1e7cdc931447
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/464077
Auto-Submit: Greg Daniel <egdaniel@google.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2021-10-28 01:51:09 +00:00
Ben Wagner
2e228bb72c Avoid crash when surface CoW allocation fails
On low memory machines a common cause of crashes is when a draw
operation requires a large layer (or many large layers) because an
implementation of SkSurface_Base::onCopyOnWrite does not actually have
the resources available to do the copy when required by a draw. Allow
this method to fail and percolate up the call chain so that the draw
simply does not happen instead of crashing.

Bug: chromium:1116362
Change-Id: I2873589f996ded9c9fd6d27b19155ca18d5b5326
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/463956
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2021-10-27 20:38:44 +00:00
Greg Daniel
6a02277fa2 [graphite] Add DrawBufferManager class.
This class will manage and suballocate all buffers used for draws. This
includes vertex, index, and uniform buffers.

Bug: skia:12466
Change-Id: I30f498fe3465e4cc693b974019dcef27efaa8073
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/462097
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2021-10-27 19:56:06 +00:00
Robert Phillips
b421a71f37 [graphite] Expand shader precompilation placeholder
Bug: skia:12466
Change-Id: If633ce39c8f45b1ee3c042b5b72d7e0f95ca5c19
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/459597
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-10-27 18:43:52 +00:00
Jim Van Verth
f44bc854bf [graphite] Track target TextureProxy for DrawContext and DrawPass
Bug: skia:12466
Change-Id: I3f29f403a3ac91e81f54b0ec3bad19df8dd58739
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/462885
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2021-10-27 13:57:10 +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
Robert Phillips
7898607697 Fix CL collision (rm SLType Byte type usage)
Change-Id: I47ff2b564f4ab785085657f84c095e2a97d65107
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/463737
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-10-26 17:56:38 +00:00
Jim Van Verth
215b48dc23 [graphite] Fix link error in DrawOrder.h
Bug: skia:12466
Change-Id: I1e7812e3600cacc8fe678e924d48c27fb8b88138
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/463716
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Auto-Submit: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2021-10-26 16:54:10 +00:00
Robert Phillips
ef8907c69f [graphite] Rename UniformDataManager to UniformManager and update
Gerrit didn't do so well on this CL. What's changed in the UniformManager is:

a lot of unused stuff was pared out of the UniformDataManager
the Write methods now return the number of bytes written in the call (incl. padding)
all the "#ifdef SK_DEBUG" stuff is new to validate against the prior way of writing uniforms

Bug: skia:12466
Change-Id: I172a74273c774257f751750aef37f4bd4c4e7e7b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/463458
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-10-26 16:26:13 +00:00