27 GP(
const SkMatrix& localMatrix,
bool wideColor)
33 const char*
name()
const override {
return "TestRectOp::GP"; }
41 const auto& gp = geomProc.
cast<
GP>();
42 SetTransform(pdman, shaderCaps, fLocalMatrixUni, gp.fLocalMatrix);
46 void onEmitCode(EmitArgs&
args, GrGPArgs* gpArgs)
override {
47 const auto& gp =
args.fGeomProc.cast<
GP>();
48 args.fVaryingHandler->emitAttributes(gp);
50 args.fVaryingHandler->addVarying(
"color", &colorVarying,
52 args.fVertBuilder->codeAppendf(
"%s = %s;", colorVarying.vsOut(), gp.fInColor.name());
53 args.fFragBuilder->codeAppendf(
"half4 %s = %s;",
54 args.fOutputColor, colorVarying.fsIn());
55 args.fFragBuilder->codeAppendf(
"const half4 %s = half4(1);",
args.fOutputCoverage);
56 WriteOutputPosition(
args.fVertBuilder, gpArgs, gp.fInPosition.name());
57 WriteLocalCoord(
args.fVertBuilder,
61 gp.fInLocalCoords.asShaderVar(),
66 UniformHandle fLocalMatrixUni;
69 return std::make_unique<Impl>();
73 b->add32(ProgramImpl::ComputeMatrixKey(shaderCaps, fLocalMatrix));
94 const char*
name()
const override {
return "TestRectOp"; }
123 bool usesMSAASurface,
151 const auto* caps = context->
priv().
caps();
152 return GrOp::Make<TestRectOp>(context, caps, std::move(
paint), drawRect, localRect, localM);
166TestRectOp::TestRectOp(
const GrCaps* caps,
172 , fDrawRect(drawRect)
173 , fLocalRect(localRect)
174 , fColor(
paint.getColor4f())
175 , fGP(localMatrix, use_wide_color(
paint, caps))
177 this->setBounds(drawRect.
makeSorted(), HasAABloat::kNo, IsHairline::kNo);
180void TestRectOp::onCreateProgramInfo(
const GrCaps* caps,
183 bool usesMSAASurface,
192 std::move(appliedClip),
195 std::move(fProcessorSet),
197 renderPassXferBarriers,
203 QuadHelper helper(
target, fGP.vertexStride(), 1);
210 fMesh = helper.mesh();
215 this->createProgramInfo(flushState);
236 std::unique_ptr<GrFragmentProcessor>
fp,
241 paint.setColorFragmentProcessor(std::move(
fp));
#define DEFINE_OP_CLASS_ID
std::function< void(GrSurfaceProxy *, skgpu::Mipmapped)> GrVisitProxyFunc
@ kFloat2_GrVertexAttribType
@ kUByte4_norm_GrVertexAttribType
static SkPath clip(const SkPath &path, const SkHalfPlane &plane)
const GrCaps * caps() const
bool halfFloatVertexAttributeSupport() const
virtual FixedFunctionFlags fixedFunctionFlags() const
virtual GrProcessorSet::Analysis finalize(const GrCaps &, const GrAppliedClip *, GrClampType)=0
virtual std::unique_ptr< ProgramImpl > makeProgramImpl(const GrShaderCaps &) const =0
static Attribute MakeColorAttribute(const char *name, bool wideColor)
void setVertexAttributesWithImplicitOffsets(const Attribute *attrs, int attrCount)
virtual GrProgramInfo * programInfo()=0
virtual void onCreateProgramInfo(const GrCaps *, SkArenaAlloc *, const GrSurfaceProxyView &writeView, bool usesMSAASurface, GrAppliedClip &&, const GrDstProxyView &, GrXferBarrierFlags renderPassXferBarriers, GrLoadOp colorLoadOp)=0
virtual void onPrepareDraws(GrMeshDrawTarget *)=0
void drawMesh(const GrSimpleMesh &mesh)
void bindPipelineAndScissorClip(const GrProgramInfo &programInfo, const SkRect &drawBounds)
void bindTextures(const GrGeometryProcessor &geomProc, const GrSurfaceProxy &singleGeomProcTexture, const GrPipeline &pipeline)
virtual void onExecute(GrOpFlushState *, const SkRect &chainBounds)=0
static Owner Make(GrRecordingContext *context, Args &&... args)
std::unique_ptr< GrOp > Owner
virtual const char * name() const =0
virtual void visitProxies(const GrVisitProxyFunc &) const
void visitProxies(const GrVisitProxyFunc &) const
Analysis finalize(const GrProcessorAnalysisColor &, const GrProcessorAnalysisCoverage, const GrAppliedClip *, const GrUserStencilSettings *, const GrCaps &, GrClampType, SkPMColor4f *inputColorOverride)
virtual const char * name() const =0
const GrPipeline & pipeline() const
const GrGeometryProcessor & geomProc() const
void visitFPProxies(const GrVisitProxyFunc &func) const
GrRecordingContextPriv priv()
static GrProgramInfo * CreateProgramInfo(const GrCaps *, SkArenaAlloc *, const GrPipeline *, const GrSurfaceProxyView &writeView, bool usesMSAASurface, GrGeometryProcessor *, GrPrimitiveType, GrXferBarrierFlags renderPassXferBarriers, GrLoadOp colorLoadOp, const GrUserStencilSettings *=&GrUserStencilSettings::kUnused)
static const SkMatrix & I()
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
SK_API sk_sp< SkDocument > Make(SkWStream *dst, const SkSerialProcs *=nullptr, std::function< void(const SkPicture *)> onEndPage=nullptr)
sk_sp< SkBlender > blender SkRect rect
GrOp::Owner MakeRect(GrRecordingContext *context, GrPaint &&paint, const SkRect &drawRect, const SkRect &localRect, const SkMatrix &localM)
static const GrUserStencilSettings & kUnused
SkRect makeSorted() const
static TriStrip< float > TriStripFromRect(const SkRect &r)