blob: d249d58edb4025435ddabf4adb98e4b5fdab0ea0 [file] [log] [blame]
bsalomon@google.comaf84e742012-10-05 13:23:24 +00001/*
egdaniel8dd688b2015-01-22 10:16:09 -08002 * Copyright 2015 Google Inc.
bsalomon@google.comaf84e742012-10-05 13:23:24 +00003 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
egdaniel8dd688b2015-01-22 10:16:09 -08008#include "GrPipelineBuilder.h"
egdaniel3658f382014-09-15 07:01:59 -07009
egdanielb1cff032014-11-13 06:19:25 -080010#include "GrBlend.h"
egdaniel3658f382014-09-15 07:01:59 -070011#include "GrPaint.h"
egdaniel8dd688b2015-01-22 10:16:09 -080012#include "GrPipeline.h"
egdanielb6cbc382014-11-13 11:00:34 -080013#include "GrProcOptInfo.h"
egdaniel378092f2014-12-03 10:40:13 -080014#include "GrXferProcessor.h"
15#include "effects/GrPorterDuffXferProcessor.h"
Brian Salomon89527432016-12-16 09:52:16 -050016#include "ops/GrOp.h"
egdaniel3658f382014-09-15 07:01:59 -070017
Brian Salomon82f44312017-01-11 13:42:54 -050018GrPipelineBuilder::GrPipelineBuilder(GrPaint&& paint, GrAAType aaType)
Brian Salomon0e8fc8b2016-12-09 15:10:07 -050019 : fFlags(0x0)
Brian Salomon92ce5942017-01-18 11:01:10 -050020 , fDrawFace(GrDrawFace::kBoth)
Brian Salomon189098e72017-01-19 09:55:19 -050021 , fUserStencilSettings(&GrUserStencilSettings::kUnused)
Brian Salomon92ce5942017-01-18 11:01:10 -050022 , fProcessors(std::move(paint)) {
Brian Salomon189098e72017-01-19 09:55:19 -050023 if (GrAATypeIsHW(aaType)) {
24 fFlags |= GrPipeline::kHWAntialias_Flag;
25 }
bsalomon@google.comaf84e742012-10-05 13:23:24 +000026}
bsalomon@google.com5b3e8902012-10-05 20:13:28 +000027
bsalomon6a44c6a2015-05-26 09:49:05 -070028bool GrPipelineBuilder::willXPNeedDstTexture(const GrCaps& caps,
Brian Salomon92aee3d2016-12-21 09:20:25 -050029 const GrPipelineAnalysis& analysis) const {
Brian Salomon189098e72017-01-19 09:55:19 -050030 if (fProcessors.xpFactory()) {
31 return fProcessors.xpFactory()->willNeedDstTexture(caps, analysis);
egdanielc4b72722015-11-23 13:20:41 -080032 }
Brian Salomon92aee3d2016-12-21 09:20:25 -050033 return GrPorterDuffXPFactory::SrcOverWillNeedDstTexture(caps, analysis);
egdaniel89af44a2014-09-26 06:15:04 -070034}