Move more Ops to skgpu::v1 namespace
Bug: skia:11837 Change-Id: Ia79f76c18587741000367edba303c5f7c0c1087d Reviewed-on: https://skia-review.googlesource.com/c/skia/+/444178 Reviewed-by: Michael Ludwig <michaelludwig@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
This commit is contained in:
parent
ad284fe277
commit
d2f53f9e3e
12
gn/gpu.gni
12
gn/gpu.gni
@ -511,21 +511,21 @@ skia_skgpu_v1_sources = [
|
||||
"$_src/gpu/ops/DashLinePathRenderer.h",
|
||||
"$_src/gpu/ops/DefaultPathRenderer.cpp",
|
||||
"$_src/gpu/ops/DefaultPathRenderer.h",
|
||||
"$_src/gpu/ops/DrawAtlasOp.cpp",
|
||||
"$_src/gpu/ops/DrawAtlasOp.h",
|
||||
"$_src/gpu/ops/DrawVerticesOp.cpp",
|
||||
"$_src/gpu/ops/DrawVerticesOp.h",
|
||||
"$_src/gpu/ops/DrawableOp.cpp",
|
||||
"$_src/gpu/ops/DrawableOp.h",
|
||||
"$_src/gpu/ops/GrAtlasInstancedHelper.cpp",
|
||||
"$_src/gpu/ops/GrAtlasInstancedHelper.h",
|
||||
"$_src/gpu/ops/GrClearOp.cpp",
|
||||
"$_src/gpu/ops/GrClearOp.h",
|
||||
"$_src/gpu/ops/GrDashOp.cpp",
|
||||
"$_src/gpu/ops/GrDashOp.h",
|
||||
"$_src/gpu/ops/GrDrawAtlasOp.cpp",
|
||||
"$_src/gpu/ops/GrDrawAtlasOp.h",
|
||||
"$_src/gpu/ops/GrDrawAtlasPathOp.cpp",
|
||||
"$_src/gpu/ops/GrDrawAtlasPathOp.h",
|
||||
"$_src/gpu/ops/GrDrawOp.h",
|
||||
"$_src/gpu/ops/GrDrawVerticesOp.cpp",
|
||||
"$_src/gpu/ops/GrDrawVerticesOp.h",
|
||||
"$_src/gpu/ops/GrDrawableOp.cpp",
|
||||
"$_src/gpu/ops/GrDrawableOp.h",
|
||||
"$_src/gpu/ops/GrFillRRectOp.cpp",
|
||||
"$_src/gpu/ops/GrFillRRectOp.h",
|
||||
"$_src/gpu/ops/GrFillRectOp.cpp",
|
||||
|
@ -5,7 +5,7 @@
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "src/gpu/ops/GrDrawAtlasOp.h"
|
||||
#include "src/gpu/ops/DrawAtlasOp.h"
|
||||
|
||||
#include "include/core/SkRSXform.h"
|
||||
#include "include/gpu/GrRecordingContext.h"
|
||||
@ -14,7 +14,6 @@
|
||||
#include "src/core/SkRectPriv.h"
|
||||
#include "src/gpu/GrCaps.h"
|
||||
#include "src/gpu/GrDefaultGeoProcFactory.h"
|
||||
#include "src/gpu/GrDrawOpTest.h"
|
||||
#include "src/gpu/GrOpFlushState.h"
|
||||
#include "src/gpu/GrProgramInfo.h"
|
||||
#include "src/gpu/GrRecordingContextPriv.h"
|
||||
@ -23,16 +22,16 @@
|
||||
|
||||
namespace {
|
||||
|
||||
class DrawAtlasOp final : public GrMeshDrawOp {
|
||||
class DrawAtlasOpImpl final : public GrMeshDrawOp {
|
||||
private:
|
||||
using Helper = GrSimpleMeshDrawOpHelper;
|
||||
|
||||
public:
|
||||
DEFINE_OP_CLASS_ID
|
||||
|
||||
DrawAtlasOp(GrProcessorSet*, const SkPMColor4f& color,
|
||||
const SkMatrix& viewMatrix, GrAAType, int spriteCount, const SkRSXform* xforms,
|
||||
const SkRect* rects, const SkColor* colors);
|
||||
DrawAtlasOpImpl(GrProcessorSet*, const SkPMColor4f& color,
|
||||
const SkMatrix& viewMatrix, GrAAType, int spriteCount, const SkRSXform* xforms,
|
||||
const SkRect* rects, const SkColor* colors);
|
||||
|
||||
const char* name() const override { return "DrawAtlasOp"; }
|
||||
|
||||
@ -87,14 +86,12 @@ private:
|
||||
|
||||
GrSimpleMesh* fMesh = nullptr;
|
||||
GrProgramInfo* fProgramInfo = nullptr;
|
||||
|
||||
using INHERITED = GrMeshDrawOp;
|
||||
};
|
||||
|
||||
static GrGeometryProcessor* make_gp(SkArenaAlloc* arena,
|
||||
bool hasColors,
|
||||
const SkPMColor4f& color,
|
||||
const SkMatrix& viewMatrix) {
|
||||
GrGeometryProcessor* make_gp(SkArenaAlloc* arena,
|
||||
bool hasColors,
|
||||
const SkPMColor4f& color,
|
||||
const SkMatrix& viewMatrix) {
|
||||
using namespace GrDefaultGeoProcFactory;
|
||||
Color gpColor(color);
|
||||
if (hasColors) {
|
||||
@ -105,10 +102,11 @@ static GrGeometryProcessor* make_gp(SkArenaAlloc* arena,
|
||||
LocalCoords::kHasExplicit_Type, viewMatrix);
|
||||
}
|
||||
|
||||
DrawAtlasOp::DrawAtlasOp(GrProcessorSet* processorSet, const SkPMColor4f& color,
|
||||
const SkMatrix& viewMatrix, GrAAType aaType, int spriteCount,
|
||||
const SkRSXform* xforms, const SkRect* rects, const SkColor* colors)
|
||||
: INHERITED(ClassID()), fHelper(processorSet, aaType), fColor(color) {
|
||||
DrawAtlasOpImpl::DrawAtlasOpImpl(GrProcessorSet* processorSet, const SkPMColor4f& color,
|
||||
const SkMatrix& viewMatrix, GrAAType aaType, int spriteCount,
|
||||
const SkRSXform* xforms, const SkRect* rects,
|
||||
const SkColor* colors)
|
||||
: GrMeshDrawOp(ClassID()), fHelper(processorSet, aaType), fColor(color) {
|
||||
SkASSERT(xforms);
|
||||
SkASSERT(rects);
|
||||
|
||||
@ -189,7 +187,7 @@ DrawAtlasOp::DrawAtlasOp(GrProcessorSet* processorSet, const SkPMColor4f& color,
|
||||
}
|
||||
|
||||
#if GR_TEST_UTILS
|
||||
SkString DrawAtlasOp::onDumpInfo() const {
|
||||
SkString DrawAtlasOpImpl::onDumpInfo() const {
|
||||
SkString string;
|
||||
for (const auto& geo : fGeoData) {
|
||||
string.appendf("Color: 0x%08x, Quads: %d\n", geo.fColor.toBytes_RGBA(),
|
||||
@ -200,14 +198,14 @@ SkString DrawAtlasOp::onDumpInfo() const {
|
||||
}
|
||||
#endif
|
||||
|
||||
void DrawAtlasOp::onCreateProgramInfo(const GrCaps* caps,
|
||||
SkArenaAlloc* arena,
|
||||
const GrSurfaceProxyView& writeView,
|
||||
bool usesMSAASurface,
|
||||
GrAppliedClip&& appliedClip,
|
||||
const GrDstProxyView& dstProxyView,
|
||||
GrXferBarrierFlags renderPassXferBarriers,
|
||||
GrLoadOp colorLoadOp) {
|
||||
void DrawAtlasOpImpl::onCreateProgramInfo(const GrCaps* caps,
|
||||
SkArenaAlloc* arena,
|
||||
const GrSurfaceProxyView& writeView,
|
||||
bool usesMSAASurface,
|
||||
GrAppliedClip&& appliedClip,
|
||||
const GrDstProxyView& dstProxyView,
|
||||
GrXferBarrierFlags renderPassXferBarriers,
|
||||
GrLoadOp colorLoadOp) {
|
||||
// Setup geometry processor
|
||||
GrGeometryProcessor* gp = make_gp(arena,
|
||||
this->hasColors(),
|
||||
@ -220,7 +218,7 @@ void DrawAtlasOp::onCreateProgramInfo(const GrCaps* caps,
|
||||
colorLoadOp);
|
||||
}
|
||||
|
||||
void DrawAtlasOp::onPrepareDraws(GrMeshDrawTarget* target) {
|
||||
void DrawAtlasOpImpl::onPrepareDraws(GrMeshDrawTarget* target) {
|
||||
if (!fProgramInfo) {
|
||||
this->createProgramInfo(target);
|
||||
}
|
||||
@ -248,7 +246,7 @@ void DrawAtlasOp::onPrepareDraws(GrMeshDrawTarget* target) {
|
||||
fMesh = helper.mesh();
|
||||
}
|
||||
|
||||
void DrawAtlasOp::onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) {
|
||||
void DrawAtlasOpImpl::onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) {
|
||||
if (!fProgramInfo || !fMesh) {
|
||||
return;
|
||||
}
|
||||
@ -258,8 +256,10 @@ void DrawAtlasOp::onExecute(GrOpFlushState* flushState, const SkRect& chainBound
|
||||
flushState->drawMesh(*fMesh);
|
||||
}
|
||||
|
||||
GrOp::CombineResult DrawAtlasOp::onCombineIfPossible(GrOp* t, SkArenaAlloc*, const GrCaps& caps) {
|
||||
DrawAtlasOp* that = t->cast<DrawAtlasOp>();
|
||||
GrOp::CombineResult DrawAtlasOpImpl::onCombineIfPossible(GrOp* t,
|
||||
SkArenaAlloc*,
|
||||
const GrCaps& caps) {
|
||||
auto that = t->cast<DrawAtlasOpImpl>();
|
||||
|
||||
if (!fHelper.isCompatible(that->fHelper, caps, this->bounds(), that->bounds())) {
|
||||
return CombineResult::kCannotCombine;
|
||||
@ -284,12 +284,13 @@ GrOp::CombineResult DrawAtlasOp::onCombineIfPossible(GrOp* t, SkArenaAlloc*, con
|
||||
return CombineResult::kMerged;
|
||||
}
|
||||
|
||||
GrDrawOp::FixedFunctionFlags DrawAtlasOp::fixedFunctionFlags() const {
|
||||
GrDrawOp::FixedFunctionFlags DrawAtlasOpImpl::fixedFunctionFlags() const {
|
||||
return fHelper.fixedFunctionFlags();
|
||||
}
|
||||
|
||||
GrProcessorSet::Analysis DrawAtlasOp::finalize(const GrCaps& caps, const GrAppliedClip* clip,
|
||||
GrClampType clampType) {
|
||||
GrProcessorSet::Analysis DrawAtlasOpImpl::finalize(const GrCaps& caps,
|
||||
const GrAppliedClip* clip,
|
||||
GrClampType clampType) {
|
||||
GrProcessorAnalysisColor gpColor;
|
||||
if (this->hasColors()) {
|
||||
gpColor.setToUnknown();
|
||||
@ -306,21 +307,26 @@ GrProcessorSet::Analysis DrawAtlasOp::finalize(const GrCaps& caps, const GrAppli
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
GrOp::Owner GrDrawAtlasOp::Make(GrRecordingContext* context,
|
||||
GrPaint&& paint,
|
||||
const SkMatrix& viewMatrix,
|
||||
GrAAType aaType,
|
||||
int spriteCount,
|
||||
const SkRSXform* xforms,
|
||||
const SkRect* rects,
|
||||
const SkColor* colors) {
|
||||
return GrSimpleMeshDrawOpHelper::FactoryHelper<DrawAtlasOp>(context, std::move(paint),
|
||||
viewMatrix, aaType,
|
||||
spriteCount, xforms,
|
||||
rects, colors);
|
||||
namespace skgpu::v1::DrawAtlasOp {
|
||||
|
||||
GrOp::Owner Make(GrRecordingContext* context,
|
||||
GrPaint&& paint,
|
||||
const SkMatrix& viewMatrix,
|
||||
GrAAType aaType,
|
||||
int spriteCount,
|
||||
const SkRSXform* xforms,
|
||||
const SkRect* rects,
|
||||
const SkColor* colors) {
|
||||
return GrSimpleMeshDrawOpHelper::FactoryHelper<DrawAtlasOpImpl>(context, std::move(paint),
|
||||
viewMatrix, aaType,
|
||||
spriteCount, xforms,
|
||||
rects, colors);
|
||||
}
|
||||
|
||||
} // namespace skgpu::v1::DrawAtlasOp
|
||||
|
||||
#if GR_TEST_UTILS
|
||||
#include "src/gpu/GrDrawOpTest.h"
|
||||
|
||||
static SkRSXform random_xform(SkRandom* random) {
|
||||
static const SkScalar kMinExtent = -100.f;
|
||||
@ -380,9 +386,9 @@ GR_DRAW_OP_TEST_DEFINE(DrawAtlasOp) {
|
||||
aaType = GrAAType::kMSAA;
|
||||
}
|
||||
|
||||
return GrDrawAtlasOp::Make(context, std::move(paint), viewMatrix, aaType, spriteCount,
|
||||
xforms.begin(), texRects.begin(),
|
||||
hasColors ? colors.begin() : nullptr);
|
||||
return skgpu::v1::DrawAtlasOp::Make(context, std::move(paint), viewMatrix, aaType, spriteCount,
|
||||
xforms.begin(), texRects.begin(),
|
||||
hasColors ? colors.begin() : nullptr);
|
||||
}
|
||||
|
||||
#endif
|
@ -5,19 +5,19 @@
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#ifndef GrDrawAtlasOp_DEFINED
|
||||
#define GrDrawAtlasOp_DEFINED
|
||||
#ifndef DrawAtlasOp_DEFINED
|
||||
#define DrawAtlasOp_DEFINED
|
||||
|
||||
#include "include/core/SkRefCnt.h"
|
||||
#include "include/private/GrTypesPriv.h"
|
||||
#include "src/gpu/ops/GrOp.h"
|
||||
|
||||
class GrDrawOp;
|
||||
class GrPaint;
|
||||
class GrRecordingContext;
|
||||
class SkMatrix;
|
||||
|
||||
namespace GrDrawAtlasOp {
|
||||
namespace skgpu::v1::DrawAtlasOp {
|
||||
|
||||
GrOp::Owner Make(GrRecordingContext*,
|
||||
GrPaint&&,
|
||||
const SkMatrix& viewMatrix,
|
||||
@ -26,6 +26,7 @@ GrOp::Owner Make(GrRecordingContext*,
|
||||
const SkRSXform* xforms,
|
||||
const SkRect* rects,
|
||||
const SkColor* colors);
|
||||
} // namespace GrDrawAtlasOp
|
||||
|
||||
#endif
|
||||
} // namespace skgpu::v1::DrawAtlasOp
|
||||
|
||||
#endif // DrawAtlasOp_DEFINED
|
@ -5,7 +5,7 @@
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "src/gpu/ops/GrDrawVerticesOp.h"
|
||||
#include "src/gpu/ops/DrawVerticesOp.h"
|
||||
|
||||
#include "include/core/SkM44.h"
|
||||
#include "include/effects/SkRuntimeEffect.h"
|
||||
@ -191,16 +191,16 @@ private:
|
||||
using INHERITED = GrGeometryProcessor;
|
||||
};
|
||||
|
||||
class DrawVerticesOp final : public GrMeshDrawOp {
|
||||
class DrawVerticesOpImpl final : public GrMeshDrawOp {
|
||||
private:
|
||||
using Helper = GrSimpleMeshDrawOpHelper;
|
||||
|
||||
public:
|
||||
DEFINE_OP_CLASS_ID
|
||||
|
||||
DrawVerticesOp(GrProcessorSet*, const SkPMColor4f&, sk_sp<SkVertices>,
|
||||
GrPrimitiveType, GrAAType, sk_sp<GrColorSpaceXform>, const SkMatrixProvider&,
|
||||
const SkRuntimeEffect*);
|
||||
DrawVerticesOpImpl(GrProcessorSet*, const SkPMColor4f&, sk_sp<SkVertices>,
|
||||
GrPrimitiveType, GrAAType, sk_sp<GrColorSpaceXform>, const SkMatrixProvider&,
|
||||
const SkRuntimeEffect*);
|
||||
|
||||
const char* name() const override { return "DrawVerticesOp"; }
|
||||
|
||||
@ -293,14 +293,14 @@ private:
|
||||
using INHERITED = GrMeshDrawOp;
|
||||
};
|
||||
|
||||
DrawVerticesOp::DrawVerticesOp(GrProcessorSet* processorSet,
|
||||
const SkPMColor4f& color,
|
||||
sk_sp<SkVertices> vertices,
|
||||
GrPrimitiveType primitiveType,
|
||||
GrAAType aaType,
|
||||
sk_sp<GrColorSpaceXform> colorSpaceXform,
|
||||
const SkMatrixProvider& matrixProvider,
|
||||
const SkRuntimeEffect* effect)
|
||||
DrawVerticesOpImpl::DrawVerticesOpImpl(GrProcessorSet* processorSet,
|
||||
const SkPMColor4f& color,
|
||||
sk_sp<SkVertices> vertices,
|
||||
GrPrimitiveType primitiveType,
|
||||
GrAAType aaType,
|
||||
sk_sp<GrColorSpaceXform> colorSpaceXform,
|
||||
const SkMatrixProvider& matrixProvider,
|
||||
const SkRuntimeEffect* effect)
|
||||
: INHERITED(ClassID())
|
||||
, fHelper(processorSet, aaType)
|
||||
, fPrimitiveType(primitiveType)
|
||||
@ -337,19 +337,20 @@ DrawVerticesOp::DrawVerticesOp(GrProcessorSet* processorSet,
|
||||
}
|
||||
|
||||
#if GR_TEST_UTILS
|
||||
SkString DrawVerticesOp::onDumpInfo() const {
|
||||
SkString DrawVerticesOpImpl::onDumpInfo() const {
|
||||
return SkStringPrintf("PrimType: %d, MeshCount %d, VCount: %d, ICount: %d\n%s",
|
||||
(int)fPrimitiveType, fMeshes.count(), fVertexCount, fIndexCount,
|
||||
fHelper.dumpInfo().c_str());
|
||||
}
|
||||
#endif
|
||||
|
||||
GrDrawOp::FixedFunctionFlags DrawVerticesOp::fixedFunctionFlags() const {
|
||||
GrDrawOp::FixedFunctionFlags DrawVerticesOpImpl::fixedFunctionFlags() const {
|
||||
return fHelper.fixedFunctionFlags();
|
||||
}
|
||||
|
||||
GrProcessorSet::Analysis DrawVerticesOp::finalize(const GrCaps& caps, const GrAppliedClip* clip,
|
||||
GrClampType clampType) {
|
||||
GrProcessorSet::Analysis DrawVerticesOpImpl::finalize(const GrCaps& caps,
|
||||
const GrAppliedClip* clip,
|
||||
GrClampType clampType) {
|
||||
GrProcessorAnalysisColor gpColor;
|
||||
if (this->requiresPerVertexColors()) {
|
||||
gpColor.setToUnknown();
|
||||
@ -368,7 +369,7 @@ GrProcessorSet::Analysis DrawVerticesOp::finalize(const GrCaps& caps, const GrAp
|
||||
return result;
|
||||
}
|
||||
|
||||
GrGeometryProcessor* DrawVerticesOp::makeGP(SkArenaAlloc* arena) {
|
||||
GrGeometryProcessor* DrawVerticesOpImpl::makeGP(SkArenaAlloc* arena) {
|
||||
const SkMatrix& vm = fMultipleViewMatrices ? SkMatrix::I() : fMeshes[0].fViewMatrix;
|
||||
|
||||
sk_sp<GrColorSpaceXform> csxform =
|
||||
@ -380,14 +381,14 @@ GrGeometryProcessor* DrawVerticesOp::makeGP(SkArenaAlloc* arena) {
|
||||
return gp;
|
||||
}
|
||||
|
||||
void DrawVerticesOp::onCreateProgramInfo(const GrCaps* caps,
|
||||
SkArenaAlloc* arena,
|
||||
const GrSurfaceProxyView& writeView,
|
||||
bool usesMSAASurface,
|
||||
GrAppliedClip&& appliedClip,
|
||||
const GrDstProxyView& dstProxyView,
|
||||
GrXferBarrierFlags renderPassXferBarriers,
|
||||
GrLoadOp colorLoadOp) {
|
||||
void DrawVerticesOpImpl::onCreateProgramInfo(const GrCaps* caps,
|
||||
SkArenaAlloc* arena,
|
||||
const GrSurfaceProxyView& writeView,
|
||||
bool usesMSAASurface,
|
||||
GrAppliedClip&& appliedClip,
|
||||
const GrDstProxyView& dstProxyView,
|
||||
GrXferBarrierFlags renderPassXferBarriers,
|
||||
GrLoadOp colorLoadOp) {
|
||||
GrGeometryProcessor* gp = this->makeGP(arena);
|
||||
fProgramInfo = fHelper.createProgramInfo(caps, arena, writeView, usesMSAASurface,
|
||||
std::move(appliedClip), dstProxyView, gp,
|
||||
@ -395,7 +396,7 @@ void DrawVerticesOp::onCreateProgramInfo(const GrCaps* caps,
|
||||
colorLoadOp);
|
||||
}
|
||||
|
||||
void DrawVerticesOp::onPrepareDraws(GrMeshDrawTarget* target) {
|
||||
void DrawVerticesOpImpl::onPrepareDraws(GrMeshDrawTarget* target) {
|
||||
// Allocate buffers.
|
||||
size_t vertexStride = this->vertexStride();
|
||||
sk_sp<const GrBuffer> vertexBuffer;
|
||||
@ -474,7 +475,7 @@ void DrawVerticesOp::onPrepareDraws(GrMeshDrawTarget* target) {
|
||||
}
|
||||
}
|
||||
|
||||
void DrawVerticesOp::onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) {
|
||||
void DrawVerticesOpImpl::onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) {
|
||||
if (!fProgramInfo) {
|
||||
this->createProgramInfo(flushState);
|
||||
}
|
||||
@ -488,9 +489,10 @@ void DrawVerticesOp::onExecute(GrOpFlushState* flushState, const SkRect& chainBo
|
||||
flushState->drawMesh(*fMesh);
|
||||
}
|
||||
|
||||
GrOp::CombineResult DrawVerticesOp::onCombineIfPossible(GrOp* t, SkArenaAlloc*, const GrCaps& caps)
|
||||
{
|
||||
DrawVerticesOp* that = t->cast<DrawVerticesOp>();
|
||||
GrOp::CombineResult DrawVerticesOpImpl::onCombineIfPossible(GrOp* t,
|
||||
SkArenaAlloc*,
|
||||
const GrCaps& caps) {
|
||||
auto that = t->cast<DrawVerticesOpImpl>();
|
||||
|
||||
if (!fHelper.isCompatible(that->fHelper, caps, this->bounds(), that->bounds())) {
|
||||
return CombineResult::kCannotCombine;
|
||||
@ -565,8 +567,6 @@ GrOp::CombineResult DrawVerticesOp::onCombineIfPossible(GrOp* t, SkArenaAlloc*,
|
||||
return CombineResult::kMerged;
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
static GrPrimitiveType SkVertexModeToGrPrimitiveType(SkVertices::VertexMode mode) {
|
||||
switch (mode) {
|
||||
case SkVertices::kTriangles_VertexMode:
|
||||
@ -579,23 +579,29 @@ static GrPrimitiveType SkVertexModeToGrPrimitiveType(SkVertices::VertexMode mode
|
||||
SK_ABORT("Invalid mode");
|
||||
}
|
||||
|
||||
GrOp::Owner GrDrawVerticesOp::Make(GrRecordingContext* context,
|
||||
GrPaint&& paint,
|
||||
sk_sp<SkVertices> vertices,
|
||||
const SkMatrixProvider& matrixProvider,
|
||||
GrAAType aaType,
|
||||
sk_sp<GrColorSpaceXform> colorSpaceXform,
|
||||
GrPrimitiveType* overridePrimType,
|
||||
const SkRuntimeEffect* effect) {
|
||||
} // anonymous namespace
|
||||
|
||||
namespace skgpu::v1::DrawVerticesOp {
|
||||
|
||||
GrOp::Owner Make(GrRecordingContext* context,
|
||||
GrPaint&& paint,
|
||||
sk_sp<SkVertices> vertices,
|
||||
const SkMatrixProvider& matrixProvider,
|
||||
GrAAType aaType,
|
||||
sk_sp<GrColorSpaceXform> colorSpaceXform,
|
||||
GrPrimitiveType* overridePrimType,
|
||||
const SkRuntimeEffect* effect) {
|
||||
SkASSERT(vertices);
|
||||
GrPrimitiveType primType = overridePrimType
|
||||
? *overridePrimType
|
||||
: SkVertexModeToGrPrimitiveType(vertices->priv().mode());
|
||||
return GrSimpleMeshDrawOpHelper::FactoryHelper<DrawVerticesOp>(
|
||||
return GrSimpleMeshDrawOpHelper::FactoryHelper<DrawVerticesOpImpl>(
|
||||
context, std::move(paint), std::move(vertices), primType, aaType,
|
||||
std::move(colorSpaceXform), matrixProvider, effect);
|
||||
}
|
||||
|
||||
} // namespace skgpu::v1::DrawVerticesOp
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if GR_TEST_UTILS
|
||||
@ -714,8 +720,9 @@ GR_DRAW_OP_TEST_DEFINE(DrawVerticesOp) {
|
||||
if (numSamples > 1 && random->nextBool()) {
|
||||
aaType = GrAAType::kMSAA;
|
||||
}
|
||||
return GrDrawVerticesOp::Make(context, std::move(paint), std::move(vertices), matrixProvider,
|
||||
aaType, std::move(colorSpaceXform), &type, nullptr);
|
||||
return skgpu::v1::DrawVerticesOp::Make(context, std::move(paint), std::move(vertices),
|
||||
matrixProvider, aaType, std::move(colorSpaceXform),
|
||||
&type, nullptr);
|
||||
}
|
||||
|
||||
#endif
|
@ -5,21 +5,21 @@
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#ifndef GrDrawVerticesOp_DEFINED
|
||||
#define GrDrawVerticesOp_DEFINED
|
||||
#ifndef DrawVerticesOp_DEFINED
|
||||
#define DrawVerticesOp_DEFINED
|
||||
|
||||
#include "include/core/SkRefCnt.h"
|
||||
#include "include/private/GrTypesPriv.h"
|
||||
#include "src/gpu/ops/GrOp.h"
|
||||
|
||||
class GrColorSpaceXform;
|
||||
class GrDrawOp;
|
||||
class GrPaint;
|
||||
class GrRecordingContext;
|
||||
class SkMatrixProvider;
|
||||
class SkRuntimeEffect;
|
||||
class SkVertices;
|
||||
|
||||
namespace GrDrawVerticesOp {
|
||||
namespace skgpu::v1::DrawVerticesOp {
|
||||
|
||||
/**
|
||||
* Draw a SkVertices. The GrPaint param's color is used if the vertices lack per-vertex color.
|
||||
@ -37,6 +37,6 @@ namespace GrDrawVerticesOp {
|
||||
GrPrimitiveType* overridePrimType,
|
||||
const SkRuntimeEffect*);
|
||||
|
||||
} // namespace GrDrawVerticesOp
|
||||
} // namespace skgpu::v1::DrawVerticesOp
|
||||
|
||||
#endif
|
||||
#endif // DrawVerticesOp_DEFINED
|
@ -5,7 +5,7 @@
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "src/gpu/ops/GrDrawableOp.h"
|
||||
#include "src/gpu/ops/DrawableOp.h"
|
||||
|
||||
#include "include/core/SkDrawable.h"
|
||||
#include "include/gpu/GrRecordingContext.h"
|
||||
@ -14,20 +14,24 @@
|
||||
#include "src/gpu/GrOpsRenderPass.h"
|
||||
#include "src/gpu/GrRecordingContextPriv.h"
|
||||
|
||||
GrOp::Owner GrDrawableOp::Make(
|
||||
GrRecordingContext* context, std::unique_ptr<SkDrawable::GpuDrawHandler> drawable,
|
||||
const SkRect& bounds) {
|
||||
return GrOp::Make<GrDrawableOp>(context, std::move(drawable), bounds);
|
||||
namespace skgpu::v1 {
|
||||
|
||||
GrOp::Owner DrawableOp::Make(GrRecordingContext* context,
|
||||
std::unique_ptr<SkDrawable::GpuDrawHandler> drawable,
|
||||
const SkRect& bounds) {
|
||||
return GrOp::Make<DrawableOp>(context, std::move(drawable), bounds);
|
||||
}
|
||||
|
||||
GrDrawableOp::GrDrawableOp(std::unique_ptr<SkDrawable::GpuDrawHandler> drawable,
|
||||
const SkRect& bounds)
|
||||
: INHERITED(ClassID())
|
||||
DrawableOp::DrawableOp(std::unique_ptr<SkDrawable::GpuDrawHandler> drawable,
|
||||
const SkRect& bounds)
|
||||
: GrOp(ClassID())
|
||||
, fDrawable(std::move(drawable)) {
|
||||
this->setBounds(bounds, HasAABloat::kNo, IsHairline::kNo);
|
||||
}
|
||||
|
||||
void GrDrawableOp::onExecute(GrOpFlushState* state, const SkRect& chainBounds) {
|
||||
void DrawableOp::onExecute(GrOpFlushState* state, const SkRect& chainBounds) {
|
||||
SkASSERT(state->opsRenderPass());
|
||||
state->opsRenderPass()->executeDrawable(std::move(fDrawable));
|
||||
}
|
||||
|
||||
} // namespace skgpu::v1
|
@ -5,18 +5,17 @@
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#ifndef GrDrawableOp_DEFINED
|
||||
#define GrDrawableOp_DEFINED
|
||||
|
||||
#include "src/gpu/ops/GrOp.h"
|
||||
#ifndef DrawableOp_DEFINED
|
||||
#define DrawableOp_DEFINED
|
||||
|
||||
#include "include/core/SkDrawable.h"
|
||||
#include "include/core/SkMatrix.h"
|
||||
#include "src/gpu/GrSemaphore.h"
|
||||
#include "src/gpu/ops/GrOp.h"
|
||||
|
||||
class GrRecordingContext;
|
||||
|
||||
class GrDrawableOp final : public GrOp {
|
||||
namespace skgpu::v1 {
|
||||
|
||||
class DrawableOp final : public GrOp {
|
||||
public:
|
||||
DEFINE_OP_CLASS_ID
|
||||
|
||||
@ -29,7 +28,7 @@ public:
|
||||
private:
|
||||
friend class GrOp; // for ctor
|
||||
|
||||
GrDrawableOp(std::unique_ptr<SkDrawable::GpuDrawHandler>, const SkRect& bounds);
|
||||
DrawableOp(std::unique_ptr<SkDrawable::GpuDrawHandler>, const SkRect& bounds);
|
||||
|
||||
CombineResult onCombineIfPossible(GrOp* that, SkArenaAlloc*, const GrCaps& caps) override {
|
||||
return CombineResult::kCannotCombine;
|
||||
@ -47,9 +46,8 @@ private:
|
||||
void onExecute(GrOpFlushState*, const SkRect& chainBounds) override;
|
||||
|
||||
std::unique_ptr<SkDrawable::GpuDrawHandler> fDrawable;
|
||||
|
||||
using INHERITED = GrOp;
|
||||
};
|
||||
|
||||
#endif
|
||||
} // namespace skgpu::v1
|
||||
|
||||
#endif // DrawableOp_DEFINED
|
@ -40,6 +40,7 @@
|
||||
#include "src/gpu/GrProxyProvider.h"
|
||||
#include "src/gpu/GrRenderTarget.h"
|
||||
#include "src/gpu/GrResourceProvider.h"
|
||||
#include "src/gpu/GrSemaphore.h"
|
||||
#include "src/gpu/GrStencilSettings.h"
|
||||
#include "src/gpu/GrStyle.h"
|
||||
#include "src/gpu/GrTracing.h"
|
||||
@ -52,11 +53,11 @@
|
||||
#include "src/gpu/geometry/GrQuad.h"
|
||||
#include "src/gpu/geometry/GrQuadUtils.h"
|
||||
#include "src/gpu/geometry/GrStyledShape.h"
|
||||
#include "src/gpu/ops/DrawAtlasOp.h"
|
||||
#include "src/gpu/ops/DrawVerticesOp.h"
|
||||
#include "src/gpu/ops/DrawableOp.h"
|
||||
#include "src/gpu/ops/GrClearOp.h"
|
||||
#include "src/gpu/ops/GrDrawAtlasOp.h"
|
||||
#include "src/gpu/ops/GrDrawOp.h"
|
||||
#include "src/gpu/ops/GrDrawVerticesOp.h"
|
||||
#include "src/gpu/ops/GrDrawableOp.h"
|
||||
#include "src/gpu/ops/GrFillRRectOp.h"
|
||||
#include "src/gpu/ops/GrFillRectOp.h"
|
||||
#include "src/gpu/ops/GrLatticeOp.h"
|
||||
@ -989,9 +990,9 @@ void SurfaceDrawContext::drawVertices(const GrClip* clip,
|
||||
SkASSERT(vertices);
|
||||
GrAAType aaType = fCanUseDynamicMSAA ? GrAAType::kMSAA : this->chooseAAType(GrAA::kNo);
|
||||
GrOp::Owner op =
|
||||
GrDrawVerticesOp::Make(fContext, std::move(paint), std::move(vertices), matrixProvider,
|
||||
aaType, this->colorInfo().refColorSpaceXformFromSRGB(),
|
||||
overridePrimType, effect);
|
||||
DrawVerticesOp::Make(fContext, std::move(paint), std::move(vertices), matrixProvider,
|
||||
aaType, this->colorInfo().refColorSpaceXformFromSRGB(),
|
||||
overridePrimType, effect);
|
||||
this->addDrawOp(clip, std::move(op));
|
||||
}
|
||||
|
||||
@ -1012,8 +1013,8 @@ void SurfaceDrawContext::drawAtlas(const GrClip* clip,
|
||||
AutoCheckFlush acf(this->drawingManager());
|
||||
|
||||
GrAAType aaType = this->chooseAAType(GrAA::kNo);
|
||||
GrOp::Owner op = GrDrawAtlasOp::Make(fContext, std::move(paint), viewMatrix,
|
||||
aaType, spriteCount, xform, texRect, colors);
|
||||
GrOp::Owner op = DrawAtlasOp::Make(fContext, std::move(paint), viewMatrix,
|
||||
aaType, spriteCount, xform, texRect, colors);
|
||||
this->addDrawOp(clip, std::move(op));
|
||||
}
|
||||
|
||||
@ -1482,7 +1483,7 @@ void SurfaceDrawContext::drawImageLattice(const GrClip* clip,
|
||||
|
||||
void SurfaceDrawContext::drawDrawable(std::unique_ptr<SkDrawable::GpuDrawHandler> drawable,
|
||||
const SkRect& bounds) {
|
||||
GrOp::Owner op(GrDrawableOp::Make(fContext, std::move(drawable), bounds));
|
||||
GrOp::Owner op(DrawableOp::Make(fContext, std::move(drawable), bounds));
|
||||
SkASSERT(op);
|
||||
this->addOp(std::move(op));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user