[graphite] Start with kDiscard load op in DrawContext; use clear op for floating-point textures

Fixes the rendering failures in https://gold.skia.org/detail?grouping=name%3Dasync_rescale_and_read_dog_up%26source_type%3Dgm&digest=feb321b72d30e2a45ad731ede46e2b4f

Scratch surfaces do not add an initial clear. Originally this meant
the DrawContext defaulted to a load op, but with no prior rendering,
the loaded content could contain nans in floating-point textures.
If blending was enabled (as is the case with kSrc and analytic
coverage), the HW blending would drop pixels where the dst was nan.

This switches DrawContext to start out with the discard op.
Non-scratch surfaces switch to the clear op already since they pass
in true to `addInitialClear`. All draw contexts switch to the load op
once a DrawTask has been snapped, for future render passes.

Added a discard() function to DrawContext so that drawPaint() calls
can discard previous contents if they don't need blending. Logic
within discard() handles switching to a clear() for floating point
targets. Once we support non-AA blits for pixel-aligned rects,
we can look at switching back to a true discard.

Bug: b/333729316
Change-Id: I3cb50a968f29940fba1a1344a3b8ffd1f7cbb68c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/838796
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
4 files changed