Commit Graph

7740 Commits

Author SHA1 Message Date
Chris Dalton
3bf2f3a9da Remove DynamicStateArrays from GrProgramInfo and GrPipeline
Every op that updates dynamic state between draws has now been
migrated to explicit binding.

Change-Id: Ibd13c9c0ffb16a205c073dfb4fd21d93f496dc52
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/277493
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-03-17 19:12:18 +00:00
Chris Dalton
be45742933 Change GrProgramInfo::visitProxies to "visitFPProxies"
We are removing dynamic state from the ProgramInfo, so the Ops will
need to invoke visits on their own primProc proxies.

Change-Id: I7ab227ab71208b7c7bcb7a9deb56b9abd556d6aa
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/277236
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-03-17 15:06:55 +00:00
Chris Dalton
765ed36ad4 Delete GrOpsRenderPass::drawMeshes
Everyone is responsible to set up their own scissor and textures now.

Change-Id: Ic3547f00c0e7908409631951de4b7237b9bce23b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/277177
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2020-03-17 15:05:54 +00:00
Michael Ludwig
cd01979004 Refactor GrMemoryPool into reusable GrBlockAllocator
This moves the byte block linked list structure outside of GrMemoryPool
into a new type, GrBlockAllocator. This new type is solely responsible
for managing the byte blocks, tracking where the next allocation
occurs, and creating/destroying the byte blocks. It also tries to
encapsulate all of/most alignment related math, while making it
convenient for clients to add per-allocation padding/metadata.

It has added functionality compared to the original block linked list
that was embedded in GrMemoryPool:
 - Supports resetting the entire allocator
 - Supports resizing the last allocation
 - Is able to rewind an entire stack of allocations, instead of just the
   last allocation.
 - Supports multiple block growth policies instead of just a fixed size.
 - Supports templated alignment, and variable alignment within a single
   GrBlockAllocator
 - Query the amount of available memory
 - Performs as much math as possible in 32-bit ints with static asserts
   that ensure overflow won't happen.

Some of this flexibility was added so that the GrBlockAllocator can be
used to implement an arena allocator similar to SkArenaAlloc, or to
replace the use of SkTArray in GrQuadBuffer. It is also likely possible
that GrAllocator can be written on top of GrBlockAllocator. I will try
to perform these consolidations in later CLs.

Change-Id: Ia6c8709642369b66b88eb1bc46264fb2aa9b62ab
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/262216
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-03-17 14:41:14 +00:00
Mike Klein
6b48e62ed2 remove unused mutate() apis
Whether we should shrink at the end of mutate() turns out to be moot.

:)

Change-Id: Ic29df5734e3057f165f695b2d03f8e7eb0eeb4dd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/277299
Auto-Submit: Mike Klein <mtklein@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2020-03-16 20:44:36 +00:00
Herb Derby
3b946c1618 Check fullness and purge on every strike lookup
In the old code, the cache was checked and perged on every reattach
of a strike. That was left out of the multi-threaded code. Add the
check and purge back in to maintain cache size.

* Removed minimum cache size from setCacheSizeLimit.

Bug: skia:10046
Change-Id: I2438c83f04b6da8133c161a29604c3c3d7f58cd8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/277066
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-03-16 19:59:56 +00:00
Mike Klein
a30aeae875 impl SkTDynamicHash with SkTHashTable
The only vaguely tricky thing to adapt from templating on T to T*.

Don't think there's a need for the unit tests now right?

Bug: skia:9703
Change-Id: Ib8fcebd9e0e35bea5ef23e6fd5962654a28d587b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/277214
Auto-Submit: Mike Klein <mtklein@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2020-03-16 19:59:26 +00:00
Chris Dalton
aa0e45c232 Add pass-through helper methods from GrOpFlushState to GrOpsRenderPass
Change-Id: Ifa18e909978367a4502dbf6b35a62a437e83b5c2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/276842
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2020-03-16 19:53:26 +00:00
Chris Dalton
eb694b767c Rename GrMesh to GrSimpleMesh
Change-Id: Ib164ff3ec41cb798385f2feea8ad09c037dbc30d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/276837
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2020-03-16 16:18:30 +00:00
Chris Dalton
37c7bdda22 Remove GrMesh::setVertexData
Fuses the relevant functionality into the set() calls.

Change-Id: I3a764219425c35967942366c60a6b9ee6ec48e11
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/276836
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2020-03-16 14:32:50 +00:00
Mike Klein
cff6396875 begin refactoring SkTDynamicHash and SkTMultiMap
The biggest mismatch between these and SkTHash{Map,Set,Table}
is the old ones provide Iter and ConstIter, the new ones foreach().

This CL,

   - adds foreach() methods to the old types,
   - replaces all uses of ConstIter with foreach(),
   - replaces most uses of Iter with foreach(),

I'm leaving one spot using Iter to walk the table and remove its
elements for its own CL... it'll be a little more complicated to get
that right.

From there it should be straightforward to turn SkTDynamicHash
into a thin wrapper over an SkTHashTable.

Bugs: skia:9703
Change-Id: Ia6ba87c35b89585c42b5b9f118f4cbf3abd04f0d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/277098
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-03-16 14:06:30 +00:00
Mike Klein
16701eecd5 Shrink SkTHashTables
Since we grow when size >= 3/4 cap, shrink when size <= 1/4 cap?

Keeping a minimum table size of 4 preserves the invariant that tables
with non-zero capacity always have at least one empty slot, allowing
find() to determine a particular key is not in the table by stumbling
upon that empty slot on the key's hash chain.  That's effectively what
we're asserting at SkTHash.h:84.

Bug: skia:10041
Change-Id: I4247e4ff155fd11561086547525354365bc69f55
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/277096
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2020-03-16 13:38:10 +00:00
Florin Malita
e05b1b7229 [svgdevice] Handle text path effects
(follow-up to https://skia-review.googlesource.com/c/skia/+/276576)

Force drawing of text as path in the presence of path effects.

Additionally, ensure that all glyph runs are rendered as a single path
(instead of one path per run).

Change-Id: Ibc69b0f93ff09af349f3376f79ed3fce18151a14
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/276956
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-03-13 16:19:06 +00:00
Bryce Thomas
75e29072e7 Implement support for path effects in SkSVGDevice backend.
Bug: NONE
Change-Id: I1559d05a0c126b1c7aa72296f2fdd8f6c93fb46b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/276576
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-03-13 13:20:05 +00:00
Mike Reed
ba96256581 hide getters so we can change the internals of SkVertices
Bug: skia:9984
Change-Id: Id8d8d568fb29b006d19079248c579282207279c1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/275692
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2020-03-13 12:08:12 +00:00
Mike Klein
5caf7dee25 restore Op::round
While I think trunc(mad(x, scale, 0.5)) is fine for doing our float
to fixed point conversions, round(mul(x, scale)) was kind of better
all around:

   - better rounding than +0.5 and trunc
   - faster when mad() is not an fma
   - often now no need to use the constant 0.5f or have it in a register
   - allows the mul() in to_unorm to use mul_f32_imm

Those last two points are key... this actually frees up 2 registers in
the x86 JIT when using to_unorm().

So I think maybe we can resurrect round and still guarantee our desired
intra-machine stability by committing to using instructions that follow
the current rounding mode, which is what [v]cvtps2dq inextricably uses.

Left some notes on the ARM impl... we're rounding to nearest even there,
which is probably the current mode anyway, but to be more correct we
need a slightly longer impl that rounds float->float then "truncates".
Unsure whether it matters in practice.  Same deal in the unit test that
I added back, now testing negative and 0.5 cases too. The expectations
assume the current mode is nearest even.

I had the idea to resurrect this when I was looking at adding _imm Ops
for fma_f32.  I noticed that the y and z arguments to an fma_f32 were by
far most likely to be constants, and when they are, they're by far likely
to both be constants, e.g. 255.0f & 0.5f from to_unorm(8,...).

llvm disassembly for SkVM_round unit test looks good:

~ $ llc -mcpu=haswell /tmp/skvm-jit-1231521224.bc -o -
	.section	__TEXT,__text,regular,pure_instructions
	.macosx_version_min 10, 15
	.globl	"_skvm-jit-1231521224"  ## -- Begin function skvm-jit-1231521224
	.p2align	4, 0x90
"_skvm-jit-1231521224":                 ## @skvm-jit-1231521224
	.cfi_startproc
	cmpl	$8, %edi
	jl	LBB0_3
	.p2align	4, 0x90
LBB0_2:                                 ## %loopK
                                        ## =>This Inner Loop Header: Depth=1
	vcvtps2dq	(%rsi), %ymm0
	vmovupd	%ymm0, (%rdx)
	addl	$-8, %edi
	addq	$32, %rsi
	addq	$32, %rdx
	cmpl	$8, %edi
	jge	LBB0_2
LBB0_3:                                 ## %hoist1
	xorl	%eax, %eax
	testl	%edi, %edi
	jle	LBB0_6
	.p2align	4, 0x90
LBB0_5:                                 ## %loop1
                                        ## =>This Inner Loop Header: Depth=1
	vcvtss2si	(%rsi,%rax), %ecx
	movl	%ecx, (%rdx,%rax)
	decl	%edi
	addq	$4, %rax
	testl	%edi, %edi
	jg	LBB0_5
LBB0_6:                                 ## %leave
	vzeroupper
	retq
	.cfi_endproc
                                        ## -- End function

Change-Id: Ib59eb3fd8a6805397850d93226c6c6d37cc3ab84
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/276738
Auto-Submit: Mike Klein <mtklein@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2020-03-12 21:10:34 +00:00
Chris Dalton
bb7684276a Migrate GrMeshTest to the new bind/draw API
Also adds a drawIndexPattern() helper method to GrOpsRenderPass, and
starts testing a base index with drawIndexedInstanced.

Change-Id: I3fbb1b5a2a1012a4fcbe126c54ddbc8c17ce80b0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/276739
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2020-03-12 19:24:07 +00:00
Robert Phillips
2669a7b74a More programInfo cleanup
This CL moves the boiler-plate implementation of onPrePrepareDraws up to GrMeshDrawOp. This, unfortunately, required the addition of a 'programInfo' virtual but that may go away in the future.


The only GrMeshDrawOp-derived classes left are:
  AAHairlineOp - which has 3 programInfos
  AAFlatteningConvexPathOp - which has >=1 mesh (but just 1 programInfo)
  GrAtlasTextOp - which has inline uploads
  SmallPathOp - which, maybe, has inline uploads
  TextureOp - which has chaining

Bug: skia:9455
Change-Id: Id10f70e764054134751545ad38b99f0a0778de76
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/276642
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-03-12 18:29:37 +00:00
Robert Phillips
6941f4a01d Update three GrMeshDrawOps to surface their programInfos at record time
The lucky three are:

    GrShadowRRectOp
    PrimitiveProcessorTest::Op
    VertexColorSpaceBench::Op

Bug: skia:9455
Change-Id: I7133be41e62aa183b8395f2402f52a6a88191aca
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/276482
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-03-12 15:40:11 +00:00
Brian Osman
f0aee749bf Remove (unused) shader caps from default GP factory functions
Change-Id: Id3313169be2fecfb8a11045f08a55490fbec9b9e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/276486
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-03-12 13:59:40 +00:00
Robert Phillips
4133dc4e0b Clean up programInfo creation in GrMeshDrawOp-derived Ops
This CL:
  Renames the existing createProgramInfo method to onCreateProgramInfo and makes it a virtual on GrMeshDrawOp

  Moves the non-virtual createProgramInfo (helper) calls to GrMeshDrawOp

  Changes onCreateProgramInfo to not return a ProgramInfo*. This is setting up to handle ops that create >1 programInfo (e.g., AAHairlineOp)

This CL leaves the following 8 ops in need of an onCreateProgramInfo implementation:

AAHairlineOp
AAFlatteningConvexPathOp
GrAtlasTextOp
GrShadowRRectOp
SmallPathOp
GrTextureOp
PrimitiveProcessorTest::Op
VertexColorSpaceBench::Op

Bug: skia:9455
Change-Id: Id7e2b8a40cac86ede6bf3c0e544da5500ff47d8a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/276403
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2020-03-12 13:00:40 +00:00
Brian Osman
dafbf121a8 SkVertices: Remove volatile/nonvolatile bit
No one was using this, and it added significant complexity to
GrDrawVerticesOp.

Bug: skia:9984
Change-Id: I23f38b3f5d853a8e531f13b6931cd57b5985a2c8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/276407
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-03-11 17:33:17 +00:00
Mike Reed
fdf94044ff Remove exotic legacy bitmap drawing entry points: Nine, Lattice
follow-ups:
- remove associated virtuals in canvas

Change-Id: I3efa7a88ed0905ebf080712993e7f43148df36dc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/276282
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-03-11 13:11:47 +00:00
Brian Osman
5f6b41e6d8 Runtime effects: Detect calls to undefined functions
Previously, the CPU backend would catch this later (ByteCodeGenerator),
and the GPU backend would assert in expandFormatArgs (out-of-range
function index).

Change-Id: Ib84bf7c477ddcc9fd3091c5b106ebdd654e9a30b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/276000
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-03-10 20:27:10 +00:00
Brian Osman
2e19af063b Revert "Move interpreter disassemble to out-of-line member of ByteCode"
This reverts commit 1b0124fec6.

Reason for revert: Check generated files bot is unhappy.

Original change's description:
> Move interpreter disassemble to out-of-line member of ByteCode
> 
> Now it returns a string (rather than just calling printf).
> 
> Adds GUI view of particle effect byte code (for fun), and fixes the
> unit tests that called ByteCodeFunction::disassemble, which wasn't
> doing anything.
> 
> Change-Id: Ide3fd933cf14832feae7ff9e0fdc1ae8f24a28d4
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/273878
> Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>

TBR=brianosman@google.com,ethannicholas@google.com

Change-Id: I478a93769a3e1a72a339853d6d41865dba8bbe66
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/275800
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-03-07 17:44:05 +00:00
Brian Osman
1b0124fec6 Move interpreter disassemble to out-of-line member of ByteCode
Now it returns a string (rather than just calling printf).

Adds GUI view of particle effect byte code (for fun), and fixes the
unit tests that called ByteCodeFunction::disassemble, which wasn't
doing anything.

Change-Id: Ide3fd933cf14832feae7ff9e0fdc1ae8f24a28d4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/273878
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-03-06 22:16:11 +00:00
Dominic Mazzoni
8f233fc795 Add marked-content ID to PDF images
Previously we only added marked-content IDs to text commands.
Extend this to support marking bitmaps drawn to a PDF document
too, so that images can be tagged with alt text.

Moves the code that outputs the marked content ID and closing
tag into a scoped helper class that outputs the closing sequence
on destruction.

Note: we'll probably want to do this to nearly all drawing
commands, since nearly everything could in theory be tagged.

This change is safe because it's still behind a flag in
Chromium and if the document doesn't have any structure
tree, it won't output anything.

Bug: chromium:607777
Change-Id: I4d7d655857fa7e76c6a6914a2a83097be917d835
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/275517
Commit-Queue: Dominic Mazzoni <dmazzoni@chromium.org>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
2020-03-06 19:48:50 +00:00
Greg Daniel
7c9021185c Remove SkImage getTexture call.
Change-Id: Ib9f3d8c58ee5736bfee03eaedff20f24b51d5ff9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/275625
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2020-03-06 18:53:00 +00:00
Mike Klein
491df6ba72 remove SkTLS
- used for debug lock tracking in SkFont*
  - used for debug logging in SkPathOps
  - genuine use in GLTestContext_cmd_buf?
    switched that to thread_local
  - keep empty SkTLS_{pthread,win}.cpp until
    references to them can be cleaned up

Bug: skia:10006
Change-Id: I195a94c95d3f1a1918ee8c9bc4a15fa5b4344fbc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/275282
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-03-06 14:41:01 +00:00
Mike Klein
7c0332cd35 re-enable fnma
- hook up fmls.4s as fnma_f32
 - add fneg.4s
 - use fneg.4s + fmls.4s to impl fms_f32
 - more tests to exercise these

Change-Id: I60173a5e4618ab968a9361e15334a1d63c001372
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/275412
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2020-03-05 21:58:07 +00:00
Greg Daniel
456f9b5fe9 Reland "Move GrGpuResource GrSurface and GrTexture into src."
This reverts commit f6ed96d1c2.

Reason for revert: google3 change landed

Original change's description:
> Revert "Move GrGpuResource GrSurface and GrTexture into src."
> 
> This reverts commit e5a06ce678.
> 
> Reason for revert: Need to make change in google3 first
> 
> Original change's description:
> > Move GrGpuResource GrSurface and GrTexture into src.
> > 
> > Must land https://chromium-review.googlesource.com/c/chromium/src/+/2087980
> > before this can land.
> > 
> > Bug: skia:7966
> > Change-Id: I60bbb1765bfbb2c96b2bc0c9826b6b9d57eb2a03
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/275077
> > Commit-Queue: Greg Daniel <egdaniel@google.com>
> > Reviewed-by: Robert Phillips <robertphillips@google.com>
> 
> TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com
> 
> Change-Id: Id39e0a351e49a87209de88a6ad9fadb0219db72c
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:7966
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/275216
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Greg Daniel <egdaniel@google.com>

TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com

Change-Id: I746ce739cb084cefc46f9dab24ef773e7c3cc621
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:7966
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/275436
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2020-03-05 19:16:21 +00:00
Robert Phillips
1b1bd4e509 Clarify expected compatibility matrix in CharacterizationFBO0nessTest
Change-Id: I120b5f79588f7300c1ac7e9e699cf2423030b328
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/275338
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-03-05 19:11:18 +00:00
Mike Reed
50c64ab259 expose per-vertex-data variant of SkVertices
Bug: skia:9984
Change-Id: Iaff520c6085303830f14bac4fe56830ba7360f64
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/275218
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-03-05 18:32:08 +00:00
Robert Phillips
2dbcbe8b12 Loosen up SkSurface_Gpu::onIsCompatible a bit wrt FBO0-ness
Change-Id: Ie04f55c9fb94e4e4acd90b96cd7fb0d3c6b72e14
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/275041
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Peng Huang <penghuang@chromium.org>
2020-03-05 17:12:22 +00:00
Robert Phillips
d2f18734aa Surface more programs on DDLs
This CL adds createProgramInfo and onPrePrepareDraws methods to:
   NonAAStrokeRectOp
   AAStrokeRectOp
   NonAARectOp

Bug: skia:9455
Change-Id: Id7c0151d26c5daa390cd51b9c73c95f4f1fc0104
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/275039
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2020-03-05 13:54:01 +00:00
Greg Daniel
f6ed96d1c2 Revert "Move GrGpuResource GrSurface and GrTexture into src."
This reverts commit e5a06ce678.

Reason for revert: Need to make change in google3 first

Original change's description:
> Move GrGpuResource GrSurface and GrTexture into src.
> 
> Must land https://chromium-review.googlesource.com/c/chromium/src/+/2087980
> before this can land.
> 
> Bug: skia:7966
> Change-Id: I60bbb1765bfbb2c96b2bc0c9826b6b9d57eb2a03
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/275077
> Commit-Queue: Greg Daniel <egdaniel@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>

TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com

Change-Id: Id39e0a351e49a87209de88a6ad9fadb0219db72c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:7966
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/275216
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2020-03-05 01:46:51 +00:00
Mike Klein
238105b50c skip dump checks on machines w/o FMAs
They'll never see fma_f32 ops.

Change-Id: I39371606c673fb76bdcbbe08c1b25308675f8f2c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/275151
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-03-04 23:21:02 +00:00
Greg Daniel
e5a06ce678 Move GrGpuResource GrSurface and GrTexture into src.
Must land https://chromium-review.googlesource.com/c/chromium/src/+/2087980
before this can land.

Bug: skia:7966
Change-Id: I60bbb1765bfbb2c96b2bc0c9826b6b9d57eb2a03
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/275077
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-03-04 23:01:31 +00:00
Mike Klein
cb50b117e3 get rid of troublesome Op::round
We really only need to_unorm(),
and that's fine with trunc(mad(x, scale, 0.5)).

Change-Id: I1561c678501963a9ae53c22994fc906159fc7199
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/275075
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-03-04 22:26:01 +00:00
Julia Lavrova
2813d454f3 getRectsForRange results must be adjusted to glyphs.
Bug: skia:9957
Change-Id: I7c8537e8217288bf5d9d38950377cdacae705816
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/274746
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2020-03-04 18:29:02 +00:00
Ben Wagner
a913895468 Check for invalid unicode in fallback.
CFStringCreateWithBytes will return nullptr if the raw string passed is
not valid in the encoding specified. It turns out that in UTF32 the
values between 0xD800 and 0xDFFF and above 0x10FFFF are invalid.

Bug: chromium:1057692
Change-Id: Ic3984d113106cbf8ef393048a97ccc906fb89966
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/274679
Auto-Submit: Ben Wagner <bungeman@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2020-03-03 16:24:21 +00:00
Robert Phillips
b58098f34c Add onPrePrepareDraws & createProgramInfo methods to GrDrawVerticesOp (take 2)
This CL also incidentally adds:

1) a GrMeshDrawOp::Target 'outputView' virtual and switches GrOpFlushState over to overriding it.

2) a createProgramInfo helper to GrSimpleMeshDrawOpHelper

Bug: skia:9455
Change-Id: I88ce51c585b1458ee79a9aaa7024190e9f19198c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/274506
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-03-03 13:48:41 +00:00
Brian Salomon
71fe945da3 Prevent unbounded listener growth on SkPixelRefs.
Use SkIDChangeListener and update GrBitmapTextureMaker to add listener
to key to deregister if texture is purged before genID changes.

Add a common listener list implementation and replace existing lists.

Change-Id: Ib0c78241eaf59b59b892d8b004b2bb095140bc6d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/274549
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-03-02 22:32:09 +00:00
Robert Phillips
b43cfa4d3f Revert "Add onPrePrepareDraws & createProgramInfo methods to GrDrawVerticesOp"
This reverts commit d3606518fa.

Reason for revert: DDL3 bots are red

Original change's description:
> Add onPrePrepareDraws & createProgramInfo methods to GrDrawVerticesOp
> 
> This CL also incidentally adds:
> 
> 1) a GrMeshDrawOp::Target 'outputView' virtual and switches GrOpFlushState over to overriding it.
> 
> 2) a createProgramInfo helper to GrSimpleMeshDrawOpHelper
> 
> Bug: skia:9455
> Change-Id: Iecd712d3ac76038651bd2e0512134e310930d527
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/274551
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Robert Phillips <robertphillips@google.com>

TBR=egdaniel@google.com,robertphillips@google.com

Change-Id: I6e44ba3bc47df27479af9344af946e27f0a2e937
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:9455
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/274505
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-03-02 20:50:54 +00:00
Robert Phillips
d3606518fa Add onPrePrepareDraws & createProgramInfo methods to GrDrawVerticesOp
This CL also incidentally adds:

1) a GrMeshDrawOp::Target 'outputView' virtual and switches GrOpFlushState over to overriding it.

2) a createProgramInfo helper to GrSimpleMeshDrawOpHelper

Bug: skia:9455
Change-Id: Iecd712d3ac76038651bd2e0512134e310930d527
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/274551
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-03-02 20:26:10 +00:00
Brian Salomon
99a813ca29 Avoid unbounded listener growth on SkImage_Lazy when textures are purged
Generalizes the system used on SkPathRef where a GrTexture's key
destructor signals that a listener on the image can be removed via
the unique key custom data.

Removes texturesAreCacheable() from SkImageGenerator. This was used to
prevent unbounded growth in a narrow situation related to
GrBackendTextureImageGenerator.


Change-Id: I3c605da099acfac94751e793331e356a0979d359
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/274038
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-03-02 18:38:09 +00:00
Brian Salomon
ecbb0fb2d5 Simplify view getters on GrTextureProducer.
The only thing that affects the view returned is whether it ought to
be MIP mapped or not. So don't take a whole GrSamplerState.

The view() function won't ever change the colortype so just query
GrTextureProducer rather than having view() return a tuple.

The rest is transitively reaching through callers and callees of
GrTextureProducer::view() to only pass filter or GrMipMapped instead of
GrSamplerState. Also, some params that indicate whether MIPs are
requested are changed from bool to GrMipMapped. And some minor style
stuff (mainly de-yoda-ifying GrMipMapped checks, using
GrSurfaceProxyView operator bool()).

Change-Id: Ia184aa793cf51d42642ea3bb0521ce06da2efb10
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/274205
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-03-01 00:32:04 +00:00
Herb Derby
c02a41f0e6 SkVM implement min max
Change-Id: I225e8f7395e58a4ca3c1c151d8711796e6a56939
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/274185
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-02-28 21:26:15 +00:00
Mike Klein
5a8404c93e sqrt
- test sqrt
  - impl. sqrt for llvm

Change-Id: I38a06ee57bf4d50e7d068321ab765ede3d1d73bc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/274183
Commit-Queue: Mike Klein <mtklein@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2020-02-28 20:55:06 +00:00
Mike Klein
14548b94c3 index
- test index
  - impl. index in llvm
  - convert to loop counter from uint64_t -> int32_t
    to match how we use it in other backends

Change-Id: Iee371d67eddaace068906b861292eb5ed3d74c95
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/274135
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2020-02-28 20:33:57 +00:00