Add support for plumbing GrDstSampleType through Ops and Pipeline creation.
This CL adds a new type GrDstSampleType to say how we will sample the dst.
We add tracking of the GrDstSampleType in the recording of GrOps and
then during execution passing the information along to the GrPipeline.
In general the tracking of GrDstSampleType is a global state of a GrOpsTask
so it is kept separate fro the DstProxyView which is more specific to a
single Op on the GrOpsTask.
Bug: skia:10409
Change-Id: Ie843c31f2e48a887daf96cee99ed159b196cb545
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/315645
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/ops/GrAAHairLinePathRenderer.cpp b/src/gpu/ops/GrAAHairLinePathRenderer.cpp
index bd77ece..bc40662 100644
--- a/src/gpu/ops/GrAAHairLinePathRenderer.cpp
+++ b/src/gpu/ops/GrAAHairLinePathRenderer.cpp
@@ -878,15 +878,18 @@
void makeLineProgramInfo(const GrCaps&, SkArenaAlloc*, const GrPipeline*,
const GrSurfaceProxyView* writeView,
const SkMatrix* geometryProcessorViewM,
- const SkMatrix* geometryProcessorLocalM);
+ const SkMatrix* geometryProcessorLocalM,
+ GrXferBarrierFlags renderPassXferBarriers);
void makeQuadProgramInfo(const GrCaps&, SkArenaAlloc*, const GrPipeline*,
const GrSurfaceProxyView* writeView,
const SkMatrix* geometryProcessorViewM,
- const SkMatrix* geometryProcessorLocalM);
+ const SkMatrix* geometryProcessorLocalM,
+ GrXferBarrierFlags renderPassXferBarriers);
void makeConicProgramInfo(const GrCaps&, SkArenaAlloc*, const GrPipeline*,
const GrSurfaceProxyView* writeView,
const SkMatrix* geometryProcessorViewM,
- const SkMatrix* geometryProcessorLocalM);
+ const SkMatrix* geometryProcessorLocalM,
+ GrXferBarrierFlags renderPassXferBarriers);
GrProgramInfo* programInfo() override {
// This Op has 3 programInfos and implements its own onPrePrepareDraws so this entry point
@@ -901,12 +904,14 @@
SkArenaAlloc*,
const GrSurfaceProxyView* writeView,
GrAppliedClip&&,
- const GrXferProcessor::DstProxyView&) override;
+ const GrXferProcessor::DstProxyView&,
+ GrXferBarrierFlags renderPassXferBarriers) override;
void onPrePrepareDraws(GrRecordingContext*,
const GrSurfaceProxyView* writeView,
GrAppliedClip*,
- const GrXferProcessor::DstProxyView&) override;
+ const GrXferProcessor::DstProxyView&,
+ GrXferBarrierFlags renderPassXferBarriers) override;
void onPrepareDraws(Target*) override;
void onExecute(GrOpFlushState*, const SkRect& chainBounds) override;
@@ -990,7 +995,8 @@
const GrPipeline* pipeline,
const GrSurfaceProxyView* writeView,
const SkMatrix* geometryProcessorViewM,
- const SkMatrix* geometryProcessorLocalM) {
+ const SkMatrix* geometryProcessorLocalM,
+ GrXferBarrierFlags renderPassXferBarriers) {
if (fProgramInfos[0]) {
return;
}
@@ -1012,15 +1018,17 @@
SkASSERT(sizeof(LineVertex) == lineGP->vertexStride());
}
- fProgramInfos[0] = GrSimpleMeshDrawOpHelper::CreateProgramInfo(arena, pipeline, writeView, lineGP,
- GrPrimitiveType::kTriangles);
+ fProgramInfos[0] = GrSimpleMeshDrawOpHelper::CreateProgramInfo(
+ arena, pipeline, writeView, lineGP, GrPrimitiveType::kTriangles,
+ renderPassXferBarriers);
}
void AAHairlineOp::makeQuadProgramInfo(const GrCaps& caps, SkArenaAlloc* arena,
const GrPipeline* pipeline,
const GrSurfaceProxyView* writeView,
const SkMatrix* geometryProcessorViewM,
- const SkMatrix* geometryProcessorLocalM) {
+ const SkMatrix* geometryProcessorLocalM,
+ GrXferBarrierFlags renderPassXferBarriers) {
if (fProgramInfos[1]) {
return;
}
@@ -1034,15 +1042,17 @@
this->coverage());
SkASSERT(sizeof(BezierVertex) == quadGP->vertexStride());
- fProgramInfos[1] = GrSimpleMeshDrawOpHelper::CreateProgramInfo(arena, pipeline, writeView, quadGP,
- GrPrimitiveType::kTriangles);
+ fProgramInfos[1] = GrSimpleMeshDrawOpHelper::CreateProgramInfo(
+ arena, pipeline, writeView, quadGP, GrPrimitiveType::kTriangles,
+ renderPassXferBarriers);
}
void AAHairlineOp::makeConicProgramInfo(const GrCaps& caps, SkArenaAlloc* arena,
const GrPipeline* pipeline,
const GrSurfaceProxyView* writeView,
const SkMatrix* geometryProcessorViewM,
- const SkMatrix* geometryProcessorLocalM) {
+ const SkMatrix* geometryProcessorLocalM,
+ GrXferBarrierFlags renderPassXferBarriers) {
if (fProgramInfos[2]) {
return;
}
@@ -1056,8 +1066,9 @@
this->coverage());
SkASSERT(sizeof(BezierVertex) == conicGP->vertexStride());
- fProgramInfos[2] = GrSimpleMeshDrawOpHelper::CreateProgramInfo(arena, pipeline, writeView, conicGP,
- GrPrimitiveType::kTriangles);
+ fProgramInfos[2] = GrSimpleMeshDrawOpHelper::CreateProgramInfo(
+ arena, pipeline, writeView, conicGP, GrPrimitiveType::kTriangles,
+ renderPassXferBarriers);
}
AAHairlineOp::Program AAHairlineOp::predictPrograms(const GrCaps* caps) const {
@@ -1090,7 +1101,8 @@
SkArenaAlloc* arena,
const GrSurfaceProxyView* writeView,
GrAppliedClip&& appliedClip,
- const GrXferProcessor::DstProxyView& dstProxyView) {
+ const GrXferProcessor::DstProxyView& dstProxyView,
+ GrXferBarrierFlags renderPassXferBarriers) {
// Setup the viewmatrix and localmatrix for the GrGeometryProcessor.
SkMatrix invert;
if (!this->viewMatrix().invert(&invert)) {
@@ -1111,15 +1123,18 @@
if (fCharacterization & kLine_Program) {
this->makeLineProgramInfo(*caps, arena, pipeline, writeView,
- geometryProcessorViewM, geometryProcessorLocalM);
+ geometryProcessorViewM, geometryProcessorLocalM,
+ renderPassXferBarriers);
}
if (fCharacterization & kQuad_Program) {
this->makeQuadProgramInfo(*caps, arena, pipeline, writeView,
- geometryProcessorViewM, geometryProcessorLocalM);
+ geometryProcessorViewM, geometryProcessorLocalM,
+ renderPassXferBarriers);
}
if (fCharacterization & kConic_Program) {
this->makeConicProgramInfo(*caps, arena, pipeline, writeView,
- geometryProcessorViewM, geometryProcessorLocalM);
+ geometryProcessorViewM, geometryProcessorLocalM,
+ renderPassXferBarriers);
}
}
@@ -1127,7 +1142,8 @@
void AAHairlineOp::onPrePrepareDraws(GrRecordingContext* context,
const GrSurfaceProxyView* writeView,
GrAppliedClip* clip,
- const GrXferProcessor::DstProxyView& dstProxyView) {
+ const GrXferProcessor::DstProxyView& dstProxyView,
+ GrXferBarrierFlags renderPassXferBarriers) {
SkArenaAlloc* arena = context->priv().recordTimeAllocator();
const GrCaps* caps = context->priv().caps();
@@ -1137,7 +1153,8 @@
// Conservatively predict which programs will be required
fCharacterization = this->predictPrograms(caps);
- this->createProgramInfo(caps, arena, writeView, std::move(appliedClip), dstProxyView);
+ this->createProgramInfo(caps, arena, writeView, std::move(appliedClip), dstProxyView,
+ renderPassXferBarriers);
context->priv().recordProgramInfo(fProgramInfos[0]);
context->priv().recordProgramInfo(fProgramInfos[1]);