Bug: skia:12701
Change-Id: I51bfad4ff61f2ab32753e532eb5b6ee46d765303
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/481737
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Bug: skia:12700
Change-Id: Ie20156e3a7a9dec4524b379a617724cca21402d4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/481998
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Change-Id: I57233c89fb27f09ca22509edeab79ea6b158b3c3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/481281
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Bug: skia:12701
Change-Id: If286f9398c099298b1a543a12d4a28ba70f7a20b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/479062
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Bug: skia:12700
Change-Id: Iea26b6478ce7b23f69f7a39320a40f4cef8231bd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/480399
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Bug: skia:12700
Change-Id: I66bc33c2888c94999dcae9f709a7199208c62af4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/479756
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Change-Id: I793495c2a0c220b919a9f8b2ead2c784548c0211
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/479757
Commit-Queue: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Auto-Submit: Greg Daniel <egdaniel@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Change-Id: I0695614a68a0d05d3a30163b4da5a75486f1d0b5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/479060
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
This also hides the ctors for the respective classes so you can't just
arbitrarily make one outside of the factories.
Change-Id: If31ac8ea9b54c9e10c162081251e77d7e9d07147
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/478956
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
With this CL, rt adjust is handled automatically by the backend of the
CommandBuffer when setViewport is called, so DrawPass and the
CommandBufferTest are updated to configure that (and the geometry of
command buffer test is rewritten to be in Skia's coord system instead
of NDC).
Currently, the metal command buffer uses push constants to set the
rtAdjust uniform. Hypothetically, D3D12 could use the root descriptor,
etc. There is some coupling here between the intrinsics the SkSL
programming environment operates in, and the backends configuring the
pipelines, but I don't think it's unreasonable and it seems cleaner
to me than having DrawPass bind and upload uniforms for all of the
intrinsics.
Cq-Include-Trybots: luci.skia.skia.primary:Test-Mac11-Clang-MacMini9.1-GPU-AppleM1-arm64-Release-All-Graphite,Test-Mac11-Clang-MacMini9.1-GPU-AppleM1-arm64-Debug-All-ASAN_Graphite,Build-Mac-Clang-arm64-Release-iOS_Graphite,Build-Mac-Clang-arm64-Debug-iOS_Graphite,Build-Mac-Clang-arm64-Debug-Graphite_NoGpu,Build-Mac-Clang-arm64-Debug-Graphite,Build-Mac-Clang-arm64-Debug-ASAN_Graphite,Build-Mac-Clang-arm64-Release-Graphite
Bug: skia:12466
Change-Id: Id91e9ffc31688886c5bf3ee6134567070820207a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/478656
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Passes the Transform for each draw to the RenderStep, to both
writeVertices and writeUniforms, since any given RenderStep could
choose to transform vertices on the CPU, pack the matrix as instance
attributes, or upload it as a uniform.
Also updates UniformManager to take the source data as const void*
Cq-Include-Trybots: luci.skia.skia.primary:Test-Mac11-Clang-MacMini9.1-GPU-AppleM1-arm64-Release-All-Graphite,Test-Mac11-Clang-MacMini9.1-GPU-AppleM1-arm64-Debug-All-ASAN_Graphite,Build-Mac-Clang-arm64-Release-iOS_Graphite,Build-Mac-Clang-arm64-Debug-iOS_Graphite,Build-Mac-Clang-arm64-Debug-Graphite_NoGpu,Build-Mac-Clang-arm64-Debug-Graphite,Build-Mac-Clang-arm64-Debug-ASAN_Graphite,Build-Mac-Clang-arm64-Release-Graphite
Bug: skia:12466
Change-Id: I7ac40af0b7c123d068478f5672dda455c0bbbfb5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/478376
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Bug: skia:12466
Change-Id: Id17222170984731eb36b8158c5c97b9880d3a814
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/478496
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
DrawWriter was using == to compare buffer bindings, but that hadn't
actually been added yet.
Cq-Include-Trybots: luci.skia.skia.primary:Test-Mac11-Clang-MacMini9.1-GPU-AppleM1-arm64-Release-All-Graphite,Test-Mac11-Clang-MacMini9.1-GPU-AppleM1-arm64-Debug-All-ASAN_Graphite,Build-Mac-Clang-arm64-Release-iOS_Graphite,Build-Mac-Clang-arm64-Debug-iOS_Graphite,Build-Mac-Clang-arm64-Debug-Graphite_NoGpu,Build-Mac-Clang-arm64-Debug-Graphite,Build-Mac-Clang-arm64-Debug-ASAN_Graphite,Build-Mac-Clang-arm64-Release-Graphite
Bug: skia:12466
Change-Id: I769cd3cb9f58f9ffc1558da9f24b2b6000c27388
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/478262
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Bug: skia:12466
Change-Id: I85d23e73a37a368ed68c81191d072014df110080
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/475645
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Cq-Include-Trybots: luci.skia.skia.primary:Test-Mac11-Clang-MacMini9.1-GPU-AppleM1-arm64-Release-All-Graphite,Test-Mac11-Clang-MacMini9.1-GPU-AppleM1-arm64-Debug-All-ASAN_Graphite,Build-Mac-Clang-arm64-Release-iOS_Graphite,Build-Mac-Clang-arm64-Release-Graphite,Build-Mac-Clang-arm64-Debug-iOS_Graphite,Build-Mac-Clang-arm64-Debug-Graphite_NoGpu,Build-Mac-Clang-arm64-Debug-Graphite,Build-Mac-Clang-arm64-Debug-ASAN_Graphite
Bug: skia:12466
Change-Id: If1d4c29a434a1ad3445ceadb98bd7f3b8abb5ee4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/475639
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Bug: skia:12633
Change-Id: Ida78c4145423376dc0267096a1d758b74144fd0c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/477139
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Also adds a helper class to upload uniform data the first time it's
seen, and then remember the BufferBindInfo for use after sorting.
Cq-Include-Trybots: luci.skia.skia.primary:Test-Mac11-Clang-MacMini9.1-GPU-AppleM1-arm64-Release-All-Graphite,Test-Mac11-Clang-MacMini9.1-GPU-AppleM1-arm64-Debug-All-ASAN_Graphite,Build-Mac-Clang-arm64-Release-iOS_Graphite,Build-Mac-Clang-arm64-Release-Graphite,Build-Mac-Clang-arm64-Debug-iOS_Graphite,Build-Mac-Clang-arm64-Debug-Graphite_NoGpu,Build-Mac-Clang-arm64-Debug-Graphite,Build-Mac-Clang-arm64-Debug-ASAN_Graphite
Bug: skia:12466
Change-Id: I922166a24c5f8417020c0a3288cddf6043573c79
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/475637
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Change-Id: I7fa9b4da48f993143ade3b8030e2c67831cf0ffd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/475257
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Bug: skia:12633
Change-Id: I47310b08f76afc29db56968c4a1abe6567ee40c8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/477136
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Bug: skia:12466
Change-Id: I84d017eda7964a19ddd36570cd46e8d98ba2f50f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/474936
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
RenderSteps expose the uniforms they use for their portion of the
program, and assume will be bound independently of the other uniform
sets needed for the paint, etc.
This wires them up in DrawPass, although the RenderSteps currently don't
define any. At the moment this CL is really just laying out the API and
then it will be tested more thoroughly in a follow up when
CommandBufferTest moves its hard-coded test shaders into the RenderStep
paradigm.
Bug: skia:12466
Change-Id: I8287dadb9a458127ba9f376ba351ca1932788c71
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/474137
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Also renames UniformCache::findOrCreate() to insert(), and has it return
the assigned id. ExtractCombo() now does not take a UniformCache, since
it just has to return the CPU data extracted from the PaintParams. The
caching/id assignment is the responsibility of the DrawPass.
Updates unit tests and DrawPass to use this instead.
Bug: skia:12466
Change-Id: Ib363fcad799f62d0ad31bb9d3e4c995e191cae80
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/475798
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Bug: skia:12466
Change-Id: Ie7414d7417e88249dd9f6421f8069be898adaece
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/474217
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Moves Attribute into its own header. I did not move AttributeSet/Iter
out of GraphicsPipelineDesc because RenderStep should be able to just
rely on SkSpan<Attribute>. Since they are fixed definitions, there
shouldn't be a need to support skipping over uninitialized attrs. Once
GraphicsPipelineDesc just points to a RenderStep, AttributeSet/Iter can
be deleted.
Bug: skia:12466
Change-Id: I3b01b6283669fc02dc9cd0521bb236a9d0daa5eb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/474136
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Change-Id: I94ded218e822fe50687e1efff7d46bcc4c1f1293
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/471780
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
All of the draw variants except drawIndexed support all base arguments
as part of the draw call that is recorded. Updated drawIndexed to use
the "instance" version and draw 1 instance if the baseVertex is not 0.
Previously, if we bound the buffer at a non-zero offset, but then
passed in 0 for the base vertex/instance relative to that, it would
reset the vertex offset to 0. This also cuts down on the number of
commands recorded since draws will only correspond to one command.
Bug: skia:12466
Change-Id: I3eb95b02d33f2d1e9b36991a8b824012383bc192
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/474058
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Previously, while BindBufferInfo had the right offset for binding the
buffers, the writer would always overwrite the contents at the
beginning. Never encountered it because the CommandBufferTest made its
VertexWriters directly, and DrawPass isn't end-to-end yet.
Bug: skia:12466
Change-Id: Ib874006d80a7286fcc3710cd38b3c6141ff928ef
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/474057
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>