49 return arena->
make([&](
void* ptr) {
return new (ptr) AttributeTestProcessor(
mode); });
52 const char*
name() const final {
return "AttributeTestProcessor"; }
55 b->add32(
static_cast<uint32_t
>(
fMode));
58 std::unique_ptr<ProgramImpl> makeProgramImpl(
const GrShaderCaps&)
const final;
61 AttributeTestProcessor(AttrMode
mode)
68 this->setVertexAttributesWithImplicitOffsets(fAttributes.data(),
71 case AttrMode::kManual:
76 this->setVertexAttributes(fAttributes.data(), fAttributes.size(), 12);
78 case AttrMode::kWacky:
87 this->setVertexAttributes(fAttributes.data(), fAttributes.size(), 20);
94 std::vector<Attribute> fAttributes;
99std::unique_ptr<GrGeometryProcessor::ProgramImpl> AttributeTestProcessor::makeProgramImpl(
108 void onEmitCode(EmitArgs&
args, GrGPArgs* gpArgs)
override {
109 const AttributeTestProcessor& proc =
args.fGeomProc.cast<AttributeTestProcessor>();
110 args.fVaryingHandler->emitAttributes(proc);
111 if (proc.fMode == AttrMode::kWacky) {
112 args.fVertBuilder->codeAppend(
"float2 pos = pos0 + pos1;");
114 args.fFragBuilder->codeAppendf(
"half4 %s;",
args.fOutputColor);
118 args.fFragBuilder->codeAppendf(
"const half4 %s = half4(1);",
args.fOutputCoverage);
122 return std::make_unique<Impl>();
125class AttributeTestOp :
public GrDrawOp {
130 return GrOp::Make<AttributeTestOp>(context,
mode, r);
135 this->setBounds(
fRect, HasAABloat::kNo, IsHairline::kNo);
138 const char*
name()
const override {
return "AttributeTestOp"; }
147 bool usesMSAASurface,
154 return sk_gpu_test::CreateProgramInfo(caps,
158 std::move(appliedClip),
163 renderPassXferBarriers,
168 return this->createProgramInfo(&flushState->
caps(),
184 SkArenaAlloc* arena = context->priv().recordTimeAllocator();
192 fProgramInfo = this->createProgramInfo(context->priv().caps(),
196 std::move(appliedClip),
198 renderPassXferBarriers,
201 context->priv().recordProgramInfo(fProgramInfo);
206 v[0].p = {
rect.left() ,
rect.top() };
207 v[1].p = {
rect.right(),
rect.top() };
208 v[2].p = {
rect.left() ,
rect.bottom()};
209 v[3].p = {
rect.right(),
rect.bottom()};
221 if (
fMode == AttrMode::kWacky) {
229 this->makeVB<V>(flushState,
rect);
235 this->makeVB<V>(flushState,
fRect);
245 fProgramInfo = this->createProgramInfo(flushState);
250 flushState->
draw(4, 0);
254 const AttrMode
fMode;
279 SkISize getISize()
override {
return {120, 340}; }
286 *errorMsg = kErrorMsg_DrawSkippedGpuOnly;
294 for (AttrMode
m : {AttrMode::kAuto, AttrMode::kManual, AttrMode::kWacky}) {
304DEF_GM(
return new AttributesGM(); )
#define DEFINE_OP_CLASS_ID
@ kStatic_GrAccessPattern
@ kFloat2_GrVertexAttribType
@ kUByte4_norm_GrVertexAttribType
@ kSrcOver
r = s + (1-sa)*d
constexpr SkPMColor4f SK_PMColor4fBLACK
constexpr SkColor SK_ColorYELLOW
constexpr SkColor SK_ColorMAGENTA
constexpr SkColor SK_ColorRED
constexpr SkColor SK_ColorGREEN
static SkPath clip(const SkPath &path, const SkHalfPlane &plane)
#define INHERITED(method,...)
sk_sp< const GrBuffer > fVertexBuffer
GrLoadOp colorLoadOp() const final
const GrDstProxyView & dstProxyView() const final
GrXferBarrierFlags renderPassBarriers() const final
SkArenaAlloc * allocator() override
void bindBuffers(sk_sp< const GrBuffer > indexBuffer, sk_sp< const GrBuffer > instanceBuffer, sk_sp< const GrBuffer > vertexBuffer, GrPrimitiveRestart primitiveRestart=GrPrimitiveRestart::kNo)
const GrSurfaceProxyView & writeView() const final
GrResourceProvider * resourceProvider() const final
GrAppliedClip detachAppliedClip() final
const GrCaps & caps() const final
void bindPipeline(const GrProgramInfo &programInfo, const SkRect &drawBounds)
void draw(int vertexCount, int baseVertex)
bool usesMSAASurface() const final
std::unique_ptr< GrOp > Owner
static constexpr Analysis EmptySetAnalysis()
sk_sp< GrGpuBuffer > createBuffer(size_t size, GrGpuBufferType, GrAccessPattern, ZeroInit)
GrRenderTargetProxy * asRenderTargetProxy() const
auto make(Ctor &&ctor) -> decltype(ctor(nullptr))
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
T __attribute__((ext_vector_type(N))) V
SK_API sk_sp< SkDocument > Make(SkWStream *dst, const SkSerialProcs *=nullptr, std::function< void(const SkPicture *)> onEndPage=nullptr)
sk_sp< SkBlender > blender SkRect rect
DEF_SWITCHES_START aot vmservice shared library name
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive mode
SurfaceDrawContext * TopDeviceSurfaceDrawContext(const SkCanvas *canvas)
DEF_GM(return F(C(clipbox), 0.0f, 0.0f, {})) DEF_GM(return F(C(clipbox)
SkScalar fBottom
larger y-axis bounds
SkScalar fLeft
smaller x-axis bounds
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
SkScalar fRight
larger x-axis bounds
SkScalar fTop
smaller y-axis bounds