61 const char*
name()
const override {
return "Test Op"; }
64 return GrOp::Make<Op>(rContext, numAttribs);
67 FixedFunctionFlags fixedFunctionFlags()
const override {
78 Op(
int numAttribs) :
INHERITED(ClassID()), fNumAttribs(numAttribs) {
79 this->setBounds(
SkRect::MakeWH(1.f, 1.f), HasAABloat::kNo, IsHairline::kNo);
82 GrProgramInfo* programInfo()
override {
return fProgramInfo; }
84 void onCreateProgramInfo(
const GrCaps* caps,
95 return arena->
make([&](
void* ptr) {
96 return new (ptr)
GP(numAttribs);
100 const char*
name()
const override {
return "Test GP"; }
102 std::unique_ptr<ProgramImpl> makeProgramImpl(
const GrShaderCaps&)
const override {
110 void onEmitCode(EmitArgs&
args, GrGPArgs* gpArgs)
override {
111 const GP& gp =
args.fGeomProc.cast<
GP>();
112 args.fVaryingHandler->emitAttributes(gp);
113 WriteOutputPosition(
args.fVertBuilder, gpArgs, gp.fAttributes[0].name());
115 fragBuilder->
codeAppendf(
"const half4 %s = half4(1);",
args.fOutputColor);
116 fragBuilder->
codeAppendf(
"const half4 %s = half4(1);",
117 args.fOutputCoverage);
121 return std::make_unique<Impl>();
128 GP(
int numAttribs) :
INHERITED(kGP_ClassID), fNumAttribs(numAttribs) {
130 fAttribNames = std::make_unique<SkString[]>(numAttribs);
131 fAttributes = std::make_unique<Attribute[]>(numAttribs);
132 for (
auto i = 0;
i < numAttribs; ++
i) {
133 fAttribNames[
i].printf(
"attr%d",
i);
144 this->setVertexAttributesWithImplicitOffsets(fAttributes.get(), numAttribs);
148 std::unique_ptr<SkString[]> fAttribNames;
149 std::unique_ptr<Attribute[]> fAttributes;
160 std::move(appliedClip),
165 renderPassXferBarriers,
172 this->createProgramInfo(
target);
176 QuadHelper helper(
target, vertexStride, 1);
177 SkPoint* vertices =
reinterpret_cast<SkPoint*
>(helper.vertices());
179 fMesh = helper.mesh();
183 if (!fProgramInfo || !fMesh) {
204 auto dContext = ctxInfo.directContext();
206 GrGpu* gpu = dContext->priv().getGpu();
220 int attribCnt = dContext->priv().caps()->maxVertexAttributes();
225 dContext->flushAndSubmit();
226 dContext->priv().resetGpuStats();
236 sdc->addDrawOp(
Op::Make(dContext, attribCnt));
237 dContext->flushAndSubmit();
242 dContext->priv().resetGpuStats();
243 sdc->addDrawOp(
Op::Make(dContext, attribCnt + 1));
244 dContext->flushAndSubmit();
#define DEFINE_OP_CLASS_ID
@ kFloat2_GrVertexAttribType
@ kFloat_GrVertexAttribType
DEF_GANESH_TEST_FOR_ALL_CONTEXTS(VertexAttributeCount, reporter, ctxInfo, CtsEnforcement::kApiLevel_T)
#define INHERITED(method,...)
#define REPORTER_ASSERT(r, cond,...)
void codeAppendf(const char format[],...) SK_PRINTF_LIKE(2
size_t vertexStride() const
void drawMesh(const GrSimpleMesh &mesh)
void bindPipelineAndScissorClip(const GrProgramInfo &programInfo, const SkRect &drawBounds)
void bindTextures(const GrGeometryProcessor &geomProc, const GrSurfaceProxy &singleGeomProcTexture, const GrPipeline &pipeline)
std::unique_ptr< GrOp > Owner
static constexpr Analysis EmptySetAnalysis()
static GrProcessorSet MakeEmptySet()
const GrPipeline & pipeline() const
const GrGeometryProcessor & geomProc() const
static GrProgramInfo * CreateProgramInfo(const GrCaps *, SkArenaAlloc *, const GrPipeline *, const GrSurfaceProxyView &writeView, bool usesMSAASurface, GrGeometryProcessor *, GrPrimitiveType, GrXferBarrierFlags renderPassXferBarriers, GrLoadOp colorLoadOp, const GrUserStencilSettings *=&GrUserStencilSettings::kUnused)
auto make(Ctor &&ctor) -> decltype(ctor(nullptr))
static void SetRectTriStrip(SkPoint v[], SkScalar l, SkScalar t, SkScalar r, SkScalar b, size_t stride)
static std::unique_ptr< SurfaceDrawContext > Make(GrRecordingContext *, GrColorType, sk_sp< GrSurfaceProxy >, sk_sp< SkColorSpace >, GrSurfaceOrigin, const SkSurfaceProps &)
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)
DEF_SWITCHES_START aot vmservice shared library name
static constexpr SkPoint Make(float x, float y)
static constexpr SkRect MakeWH(float w, float h)