Fuse GrPrimitiveProcessor & GrGeometryProcessor into a new GrGeometryProcessor
With the removal of NVPR we no longer need this distinction.
Bug: skia:11760
Change-Id: I225a4feb764395fb72aca3ffc8b6d05396bf0b1e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/386890
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
diff --git a/src/gpu/GrDefaultGeoProcFactory.cpp b/src/gpu/GrDefaultGeoProcFactory.cpp
index 7e8aa9f..4e47697 100644
--- a/src/gpu/GrDefaultGeoProcFactory.cpp
+++ b/src/gpu/GrDefaultGeoProcFactory.cpp
@@ -64,7 +64,7 @@
, fCoverage(0xff) {}
void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override {
- const DefaultGeoProc& gp = args.fGP.cast<DefaultGeoProc>();
+ const DefaultGeoProc& gp = args.fGeomProc.cast<DefaultGeoProc>();
GrGLSLVertexBuilder* vertBuilder = args.fVertBuilder;
GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
GrGLSLVaryingHandler* varyingHandler = args.fVaryingHandler;
@@ -159,8 +159,8 @@
}
void setData(const GrGLSLProgramDataManager& pdman,
- const GrPrimitiveProcessor& gp) override {
- const DefaultGeoProc& dgp = gp.cast<DefaultGeoProc>();
+ const GrGeometryProcessor& geomProc) override {
+ const DefaultGeoProc& dgp = geomProc.cast<DefaultGeoProc>();
this->setTransform(pdman, fViewMatrixUniform, dgp.viewMatrix(), &fViewMatrixPrev);
this->setTransform(pdman, fLocalMatrixUniform, dgp.localMatrix(), &fLocalMatrixPrev);
diff --git a/src/gpu/GrPrimitiveProcessor.cpp b/src/gpu/GrGeometryProcessor.cpp
similarity index 74%
rename from src/gpu/GrPrimitiveProcessor.cpp
rename to src/gpu/GrGeometryProcessor.cpp
index b1ae19d..18f772a 100644
--- a/src/gpu/GrPrimitiveProcessor.cpp
+++ b/src/gpu/GrGeometryProcessor.cpp
@@ -5,7 +5,7 @@
* found in the LICENSE file.
*/
-#include "src/gpu/GrPrimitiveProcessor.h"
+#include "src/gpu/GrGeometryProcessor.h"
#include "src/gpu/GrFragmentProcessor.h"
@@ -25,14 +25,14 @@
kPersp_Matrix_Flag = 0b1000, // GrFP::sampleUsage()::fHasPerspective
};
-GrPrimitiveProcessor::GrPrimitiveProcessor(ClassID classID) : GrProcessor(classID) {}
+GrGeometryProcessor::GrGeometryProcessor(ClassID classID) : GrProcessor(classID) {}
-const GrPrimitiveProcessor::TextureSampler& GrPrimitiveProcessor::textureSampler(int i) const {
+const GrGeometryProcessor::TextureSampler& GrGeometryProcessor::textureSampler(int i) const {
SkASSERT(i >= 0 && i < this->numTextureSamplers());
return this->onTextureSampler(i);
}
-uint32_t GrPrimitiveProcessor::ComputeCoordTransformsKey(const GrFragmentProcessor& fp) {
+uint32_t GrGeometryProcessor::ComputeCoordTransformsKey(const GrFragmentProcessor& fp) {
// This is highly coupled with the code in GrGLSLGeometryProcessor::collectTransforms().
uint32_t key = 0;
@@ -68,15 +68,15 @@
return requestedFilter;
}
-GrPrimitiveProcessor::TextureSampler::TextureSampler(GrSamplerState samplerState,
- const GrBackendFormat& backendFormat,
- const GrSwizzle& swizzle) {
+GrGeometryProcessor::TextureSampler::TextureSampler(GrSamplerState samplerState,
+ const GrBackendFormat& backendFormat,
+ const GrSwizzle& swizzle) {
this->reset(samplerState, backendFormat, swizzle);
}
-void GrPrimitiveProcessor::TextureSampler::reset(GrSamplerState samplerState,
- const GrBackendFormat& backendFormat,
- const GrSwizzle& swizzle) {
+void GrGeometryProcessor::TextureSampler::reset(GrSamplerState samplerState,
+ const GrBackendFormat& backendFormat,
+ const GrSwizzle& swizzle) {
fSamplerState = samplerState;
fSamplerState.setFilterMode(clamp_filter(backendFormat.textureType(), samplerState.filter()));
fBackendFormat = backendFormat;
diff --git a/src/gpu/GrGeometryProcessor.h b/src/gpu/GrGeometryProcessor.h
index 6659d47..648687c 100644
--- a/src/gpu/GrGeometryProcessor.h
+++ b/src/gpu/GrGeometryProcessor.h
@@ -8,25 +8,231 @@
#ifndef GrGeometryProcessor_DEFINED
#define GrGeometryProcessor_DEFINED
-#include "src/gpu/GrPrimitiveProcessor.h"
+#include "src/gpu/GrColor.h"
+#include "src/gpu/GrNonAtomicRef.h"
+#include "src/gpu/GrProcessor.h"
+#include "src/gpu/GrShaderVar.h"
+#include "src/gpu/GrSwizzle.h"
+
+class GrGLSLPrimitiveProcessor;
+class GrGLSLUniformHandler;
+
/**
- * A GrGeometryProcessor is a flexible method for rendering a primitive. The GrGeometryProcessor
- * has complete control over vertex attributes and uniforms (aside from the render target) but it
- * must obey the same contract as any GrPrimitiveProcessor, specifically it must emit a color and
- * coverage into the fragment shader. Where this color and coverage come from is completely the
- * responsibility of the GrGeometryProcessor.
+ * The GrGeometryProcessor represents some kind of geometric primitive. This includes the shape
+ * of the primitive and the inherent color of the primitive. The GrGeometryProcessor is
+ * responsible for providing a color and coverage input into the Ganesh rendering pipeline. Through
+ * optimization, Ganesh may decide a different color, no color, and / or no coverage are required
+ * from the GrGeometryProcessor, so the GrGeometryProcessor must be able to support this
+ * functionality.
+ *
+ * There are two feedback loops between the GrFragmentProcessors, the GrXferProcessor, and the
+ * GrGeometryProcessor. These loops run on the CPU and to determine known properties of the final
+ * color and coverage inputs to the GrXferProcessor in order to perform optimizations that preserve
+ * correctness. The GrDrawOp seeds these loops with initial color and coverage, in its
+ * getProcessorAnalysisInputs implementation. These seed values are processed by the
+ * subsequent stages of the rendering pipeline and the output is then fed back into the GrDrawOp
+ * in the applyPipelineOptimizations call, where the op can use the information to inform
+ * decisions about GrGeometryProcessor creation.
*
* Note that all derived classes should hide their constructors and provide a Make factory
- * function that takes an arena (except for CCPR-specific classes). This is because
- * GrGeometryProcessor's are not ref-counted to must have some other mechanism for managing
- * their lifetime. In particular, geometry processors can be created in either the
- * record-time or flush-time arenas which defined their lifetimes (i.e., a DDLs life time in
- * the first case and a single flush in the second case).
+ * function that takes an arena (except for Tesselation-specific classes). This is because
+ * geometry processors can be created in either the record-time or flush-time arenas which
+ * define their lifetimes (i.e., a DDLs life time in the first case and a single flush in
+ * the second case).
+ *
+ * TODO: This class does not really need to be ref counted. Instances should be allocated using
+ * GrOpFlushState's arena and destroyed when the arena is torn down.
*/
-class GrGeometryProcessor : public GrPrimitiveProcessor {
+class GrGeometryProcessor : public GrProcessor, public GrNonAtomicRef<GrGeometryProcessor> {
public:
- GrGeometryProcessor(ClassID classID) : INHERITED(classID) {}
+ class TextureSampler;
+
+ /** Describes a vertex or instance attribute. */
+ class Attribute {
+ public:
+ constexpr Attribute() = default;
+ constexpr Attribute(const char* name,
+ GrVertexAttribType cpuType,
+ GrSLType gpuType)
+ : fName(name), fCPUType(cpuType), fGPUType(gpuType) {
+ SkASSERT(name && gpuType != kVoid_GrSLType);
+ }
+ constexpr Attribute(const Attribute&) = default;
+
+ Attribute& operator=(const Attribute&) = default;
+
+ constexpr bool isInitialized() const { return fGPUType != kVoid_GrSLType; }
+
+ constexpr const char* name() const { return fName; }
+ constexpr GrVertexAttribType cpuType() const { return fCPUType; }
+ constexpr GrSLType gpuType() const { return fGPUType; }
+
+ inline constexpr size_t size() const;
+ constexpr size_t sizeAlign4() const { return SkAlign4(this->size()); }
+
+ GrShaderVar asShaderVar() const {
+ return {fName, fGPUType, GrShaderVar::TypeModifier::In};
+ }
+
+ private:
+ const char* fName = nullptr;
+ GrVertexAttribType fCPUType = kFloat_GrVertexAttribType;
+ GrSLType fGPUType = kVoid_GrSLType;
+ };
+
+ class Iter {
+ public:
+ Iter() : fCurr(nullptr), fRemaining(0) {}
+ Iter(const Iter& iter) : fCurr(iter.fCurr), fRemaining(iter.fRemaining) {}
+ Iter& operator= (const Iter& iter) {
+ fCurr = iter.fCurr;
+ fRemaining = iter.fRemaining;
+ return *this;
+ }
+ Iter(const Attribute* attrs, int count) : fCurr(attrs), fRemaining(count) {
+ this->skipUninitialized();
+ }
+
+ bool operator!=(const Iter& that) const { return fCurr != that.fCurr; }
+ const Attribute& operator*() const { return *fCurr; }
+ void operator++() {
+ if (fRemaining) {
+ fRemaining--;
+ fCurr++;
+ this->skipUninitialized();
+ }
+ }
+
+ private:
+ void skipUninitialized() {
+ if (!fRemaining) {
+ fCurr = nullptr;
+ } else {
+ while (!fCurr->isInitialized()) {
+ ++fCurr;
+ }
+ }
+ }
+
+ const Attribute* fCurr;
+ int fRemaining;
+ };
+
+ class AttributeSet {
+ public:
+ Iter begin() const { return Iter(fAttributes, fCount); }
+ Iter end() const { return Iter(); }
+
+ int count() const { return fCount; }
+ size_t stride() const { return fStride; }
+
+ private:
+ friend class GrGeometryProcessor;
+
+ void init(const Attribute* attrs, int count) {
+ fAttributes = attrs;
+ fRawCount = count;
+ fCount = 0;
+ fStride = 0;
+ for (int i = 0; i < count; ++i) {
+ if (attrs[i].isInitialized()) {
+ fCount++;
+ fStride += attrs[i].sizeAlign4();
+ }
+ }
+ }
+
+ const Attribute* fAttributes = nullptr;
+ int fRawCount = 0;
+ int fCount = 0;
+ size_t fStride = 0;
+ };
+
+ GrGeometryProcessor(ClassID);
+
+ int numTextureSamplers() const { return fTextureSamplerCnt; }
+ const TextureSampler& textureSampler(int index) const;
+ int numVertexAttributes() const { return fVertexAttributes.fCount; }
+ const AttributeSet& vertexAttributes() const { return fVertexAttributes; }
+ int numInstanceAttributes() const { return fInstanceAttributes.fCount; }
+ const AttributeSet& instanceAttributes() const { return fInstanceAttributes; }
+
+ bool hasVertexAttributes() const { return SkToBool(fVertexAttributes.fCount); }
+ bool hasInstanceAttributes() const { return SkToBool(fInstanceAttributes.fCount); }
+
+ /**
+ * A common practice is to populate the the vertex/instance's memory using an implicit array of
+ * structs. In this case, it is best to assert that:
+ * stride == sizeof(struct)
+ */
+ size_t vertexStride() const { return fVertexAttributes.fStride; }
+ size_t instanceStride() const { return fInstanceAttributes.fStride; }
+
+ bool willUseTessellationShaders() const {
+ return fShaders & (kTessControl_GrShaderFlag | kTessEvaluation_GrShaderFlag);
+ }
+
+ bool willUseGeoShader() const {
+ return fShaders & kGeometry_GrShaderFlag;
+ }
+
+ /**
+ * Computes a key for the transforms owned by an FP based on the shader code that will be
+ * emitted by the primitive processor to implement them.
+ */
+ static uint32_t ComputeCoordTransformsKey(const GrFragmentProcessor& fp);
+
+ static constexpr int kCoordTransformKeyBits = 4;
+
+ /**
+ * Sets a unique key on the GrProcessorKeyBuilder that is directly associated with this geometry
+ * processor's GL backend implementation.
+ *
+ * TODO: A better name for this function would be "compute" instead of "get".
+ */
+ virtual void getGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const = 0;
+
+
+ void getAttributeKey(GrProcessorKeyBuilder* b) const {
+ // Ensure that our CPU and GPU type fields fit together in a 32-bit value, and we never
+ // collide with the "uninitialized" value.
+ static_assert(kGrVertexAttribTypeCount < (1 << 8), "");
+ static_assert(kGrSLTypeCount < (1 << 8), "");
+
+ auto add_attributes = [=](const Attribute* attrs, int attrCount) {
+ for (int i = 0; i < attrCount; ++i) {
+ const Attribute& attr = attrs[i];
+ b->appendComment(attr.isInitialized() ? attr.name() : "unusedAttr");
+ b->addBits(8, attr.isInitialized() ? attr.cpuType() : 0xff, "attrType");
+ b->addBits(8, attr.isInitialized() ? attr.gpuType() : 0xff, "attrGpuType");
+ }
+ };
+ b->add32(fVertexAttributes.fRawCount, "numVertexAttributes");
+ add_attributes(fVertexAttributes.fAttributes, fVertexAttributes.fRawCount);
+ b->add32(fInstanceAttributes.fRawCount, "numInstanceAttributes");
+ add_attributes(fInstanceAttributes.fAttributes, fInstanceAttributes.fRawCount);
+ }
+
+ /** Returns a new instance of the appropriate *GL* implementation class
+ for the given GrProcessor; caller is responsible for deleting
+ the object. */
+ virtual GrGLSLPrimitiveProcessor* createGLSLInstance(const GrShaderCaps&) const = 0;
+
+ // We use these methods as a temporary back door to inject OpenGL tessellation code. Once
+ // tessellation is supported by SkSL we can remove these.
+ virtual SkString getTessControlShaderGLSL(const GrGLSLPrimitiveProcessor*,
+ const char* versionAndExtensionDecls,
+ const GrGLSLUniformHandler&,
+ const GrShaderCaps&) const {
+ SK_ABORT("Not implemented.");
+ }
+ virtual SkString getTessEvaluationShaderGLSL(const GrGLSLPrimitiveProcessor*,
+ const char* versionAndExtensionDecls,
+ const GrGLSLUniformHandler&,
+ const GrShaderCaps&) const {
+ SK_ABORT("Not implemented.");
+ }
protected:
// GPs that need to use either float or ubyte colors can just call this to get a correctly
@@ -37,8 +243,156 @@
kHalf4_GrSLType };
}
+ void setVertexAttributes(const Attribute* attrs, int attrCount) {
+ fVertexAttributes.init(attrs, attrCount);
+ }
+ void setInstanceAttributes(const Attribute* attrs, int attrCount) {
+ SkASSERT(attrCount >= 0);
+ fInstanceAttributes.init(attrs, attrCount);
+ }
+ void setWillUseTessellationShaders() {
+ fShaders |= kTessControl_GrShaderFlag | kTessEvaluation_GrShaderFlag;
+ }
+ void setWillUseGeoShader() { fShaders |= kGeometry_GrShaderFlag; }
+ void setTextureSamplerCnt(int cnt) {
+ SkASSERT(cnt >= 0);
+ fTextureSamplerCnt = cnt;
+ }
+
+ /**
+ * Helper for implementing onTextureSampler(). E.g.:
+ * return IthTexureSampler(i, fMyFirstSampler, fMySecondSampler, fMyThirdSampler);
+ */
+ template <typename... Args>
+ static const TextureSampler& IthTextureSampler(int i, const TextureSampler& samp0,
+ const Args&... samps) {
+ return (0 == i) ? samp0 : IthTextureSampler(i - 1, samps...);
+ }
+ inline static const TextureSampler& IthTextureSampler(int i);
+
private:
- using INHERITED = GrPrimitiveProcessor;
+ virtual const TextureSampler& onTextureSampler(int) const { return IthTextureSampler(0); }
+
+ GrShaderFlags fShaders = kVertex_GrShaderFlag | kFragment_GrShaderFlag;
+
+ AttributeSet fVertexAttributes;
+ AttributeSet fInstanceAttributes;
+
+ int fTextureSamplerCnt = 0;
+ using INHERITED = GrProcessor;
};
+//////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Used to capture the properties of the GrTextureProxies required/expected by a primitiveProcessor
+ * along with an associated GrSamplerState. The actual proxies used are stored in either the
+ * fixed or dynamic state arrays. TextureSamplers don't perform any coord manipulation to account
+ * for texture origin.
+ */
+class GrGeometryProcessor::TextureSampler {
+public:
+ TextureSampler() = default;
+
+ TextureSampler(GrSamplerState, const GrBackendFormat&, const GrSwizzle&);
+
+ TextureSampler(const TextureSampler&) = delete;
+ TextureSampler& operator=(const TextureSampler&) = delete;
+
+ void reset(GrSamplerState, const GrBackendFormat&, const GrSwizzle&);
+
+ const GrBackendFormat& backendFormat() const { return fBackendFormat; }
+ GrTextureType textureType() const { return fBackendFormat.textureType(); }
+
+ GrSamplerState samplerState() const { return fSamplerState; }
+ const GrSwizzle& swizzle() const { return fSwizzle; }
+
+ bool isInitialized() const { return fIsInitialized; }
+
+private:
+ GrSamplerState fSamplerState;
+ GrBackendFormat fBackendFormat;
+ GrSwizzle fSwizzle;
+ bool fIsInitialized = false;
+};
+
+const GrGeometryProcessor::TextureSampler& GrGeometryProcessor::IthTextureSampler(int i) {
+ SK_ABORT("Illegal texture sampler index");
+ static const TextureSampler kBogus;
+ return kBogus;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Returns the size of the attrib type in bytes.
+ * This was moved from include/private/GrTypesPriv.h in service of Skia dependents that build
+ * with C++11.
+ */
+static constexpr inline size_t GrVertexAttribTypeSize(GrVertexAttribType type) {
+ switch (type) {
+ case kFloat_GrVertexAttribType:
+ return sizeof(float);
+ case kFloat2_GrVertexAttribType:
+ return 2 * sizeof(float);
+ case kFloat3_GrVertexAttribType:
+ return 3 * sizeof(float);
+ case kFloat4_GrVertexAttribType:
+ return 4 * sizeof(float);
+ case kHalf_GrVertexAttribType:
+ return sizeof(uint16_t);
+ case kHalf2_GrVertexAttribType:
+ return 2 * sizeof(uint16_t);
+ case kHalf4_GrVertexAttribType:
+ return 4 * sizeof(uint16_t);
+ case kInt2_GrVertexAttribType:
+ return 2 * sizeof(int32_t);
+ case kInt3_GrVertexAttribType:
+ return 3 * sizeof(int32_t);
+ case kInt4_GrVertexAttribType:
+ return 4 * sizeof(int32_t);
+ case kByte_GrVertexAttribType:
+ return 1 * sizeof(char);
+ case kByte2_GrVertexAttribType:
+ return 2 * sizeof(char);
+ case kByte4_GrVertexAttribType:
+ return 4 * sizeof(char);
+ case kUByte_GrVertexAttribType:
+ return 1 * sizeof(char);
+ case kUByte2_GrVertexAttribType:
+ return 2 * sizeof(char);
+ case kUByte4_GrVertexAttribType:
+ return 4 * sizeof(char);
+ case kUByte_norm_GrVertexAttribType:
+ return 1 * sizeof(char);
+ case kUByte4_norm_GrVertexAttribType:
+ return 4 * sizeof(char);
+ case kShort2_GrVertexAttribType:
+ return 2 * sizeof(int16_t);
+ case kShort4_GrVertexAttribType:
+ return 4 * sizeof(int16_t);
+ case kUShort2_GrVertexAttribType: // fall through
+ case kUShort2_norm_GrVertexAttribType:
+ return 2 * sizeof(uint16_t);
+ case kInt_GrVertexAttribType:
+ return sizeof(int32_t);
+ case kUint_GrVertexAttribType:
+ return sizeof(uint32_t);
+ case kUShort_norm_GrVertexAttribType:
+ return sizeof(uint16_t);
+ case kUShort4_norm_GrVertexAttribType:
+ return 4 * sizeof(uint16_t);
+ }
+ // GCC fails because SK_ABORT evaluates to non constexpr. clang and cl.exe think this is
+ // unreachable and don't complain.
+#if defined(__clang__) || !defined(__GNUC__)
+ SK_ABORT("Unsupported type conversion");
+#endif
+ return 0;
+}
+
+constexpr size_t GrGeometryProcessor::Attribute::size() const {
+ return GrVertexAttribTypeSize(fCPUType);
+}
+
#endif
diff --git a/src/gpu/GrGpu.h b/src/gpu/GrGpu.h
index 1cc3fcc..57f1036 100644
--- a/src/gpu/GrGpu.h
+++ b/src/gpu/GrGpu.h
@@ -33,7 +33,7 @@
class GrPathRenderer;
class GrPathRendererChain;
class GrPipeline;
-class GrPrimitiveProcessor;
+class GrGeometryProcessor;
class GrRenderTarget;
class GrRingBuffer;
class GrSemaphore;
diff --git a/src/gpu/GrOpFlushState.cpp b/src/gpu/GrOpFlushState.cpp
index 80b3036..b79950a 100644
--- a/src/gpu/GrOpFlushState.cpp
+++ b/src/gpu/GrOpFlushState.cpp
@@ -61,7 +61,7 @@
this->colorLoadOp());
this->bindPipelineAndScissorClip(programInfo, chainBounds);
- this->bindTextures(programInfo.primProc(), fCurrDraw->fPrimProcProxies,
+ this->bindTextures(programInfo.geomProc(), fCurrDraw->fGeomProcProxies,
programInfo.pipeline());
for (int i = 0; i < fCurrDraw->fMeshCnt; ++i) {
this->drawMesh(fCurrDraw->fMeshes[i]);
@@ -143,22 +143,22 @@
}
void GrOpFlushState::recordDraw(
- const GrGeometryProcessor* gp,
+ const GrGeometryProcessor* geomProc,
const GrSimpleMesh meshes[],
int meshCnt,
- const GrSurfaceProxy* const primProcProxies[],
+ const GrSurfaceProxy* const geomProcProxies[],
GrPrimitiveType primitiveType) {
SkASSERT(fOpArgs);
SkDEBUGCODE(fOpArgs->validate());
bool firstDraw = fDraws.begin() == fDraws.end();
auto& draw = fDraws.append(&fArena);
GrDeferredUploadToken token = fTokenTracker->issueDrawToken();
- for (int i = 0; i < gp->numTextureSamplers(); ++i) {
- SkASSERT(primProcProxies && primProcProxies[i]);
- primProcProxies[i]->ref();
+ for (int i = 0; i < geomProc->numTextureSamplers(); ++i) {
+ SkASSERT(geomProcProxies && geomProcProxies[i]);
+ geomProcProxies[i]->ref();
}
- draw.fGeometryProcessor = gp;
- draw.fPrimProcProxies = primProcProxies;
+ draw.fGeometryProcessor = geomProc;
+ draw.fGeomProcProxies = geomProcProxies;
draw.fMeshes = meshes;
draw.fMeshCnt = meshCnt;
draw.fOp = fOpArgs->op();
@@ -238,7 +238,7 @@
GrOpFlushState::Draw::~Draw() {
for (int i = 0; i < fGeometryProcessor->numTextureSamplers(); ++i) {
- SkASSERT(fPrimProcProxies && fPrimProcProxies[i]);
- fPrimProcProxies[i]->unref();
+ SkASSERT(fGeomProcProxies && fGeomProcProxies[i]);
+ fGeomProcProxies[i]->unref();
}
}
diff --git a/src/gpu/GrOpFlushState.h b/src/gpu/GrOpFlushState.h
index 77e85d0..29a8989 100644
--- a/src/gpu/GrOpFlushState.h
+++ b/src/gpu/GrOpFlushState.h
@@ -197,11 +197,12 @@
// This is a convenience method for when the primitive processor has exactly one texture. It
// binds one texture for the primitive processor, and any others for FPs on the pipeline.
- void bindTextures(const GrPrimitiveProcessor& primProc,
- const GrSurfaceProxy& singlePrimProcTexture, const GrPipeline& pipeline) {
- SkASSERT(primProc.numTextureSamplers() == 1);
- const GrSurfaceProxy* ptr = &singlePrimProcTexture;
- this->bindTextures(primProc, &ptr, pipeline);
+ void bindTextures(const GrGeometryProcessor& geomProc,
+ const GrSurfaceProxy& singleGeomProcTexture,
+ const GrPipeline& pipeline) {
+ SkASSERT(geomProc.numTextureSamplers() == 1);
+ const GrSurfaceProxy* ptr = &singleGeomProcTexture;
+ this->bindTextures(geomProc, &ptr, pipeline);
}
// Makes the appropriate bindBuffers() and draw*() calls for the provided mesh.
@@ -214,9 +215,10 @@
void setScissorRect(const SkIRect& scissorRect) {
fOpsRenderPass->setScissorRect(scissorRect);
}
- void bindTextures(const GrPrimitiveProcessor& primProc,
- const GrSurfaceProxy* const primProcTextures[], const GrPipeline& pipeline) {
- fOpsRenderPass->bindTextures(primProc, primProcTextures, pipeline);
+ void bindTextures(const GrGeometryProcessor& geomProc,
+ const GrSurfaceProxy* const geomProcTextures[],
+ const GrPipeline& pipeline) {
+ fOpsRenderPass->bindTextures(geomProc, geomProcTextures, pipeline);
}
void bindBuffers(sk_sp<const GrBuffer> indexBuffer, sk_sp<const GrBuffer> instanceBuffer,
sk_sp<const GrBuffer> vertexBuffer,
@@ -272,8 +274,8 @@
// the stack (for CCPR). In either case this object does not need to manage its
// lifetime.
const GrGeometryProcessor* fGeometryProcessor = nullptr;
- // Must have GrPrimitiveProcessor::numTextureSamplers() entries. Can be null if no samplers.
- const GrSurfaceProxy* const* fPrimProcProxies = nullptr;
+ // Must have GrGeometryProcessor::numTextureSamplers() entries. Can be null if no samplers.
+ const GrSurfaceProxy* const* fGeomProcProxies = nullptr;
const GrSimpleMesh* fMeshes = nullptr;
const GrOp* fOp = nullptr;
int fMeshCnt = 0;
diff --git a/src/gpu/GrOpsRenderPass.cpp b/src/gpu/GrOpsRenderPass.cpp
index 663d12f..f408b3f 100644
--- a/src/gpu/GrOpsRenderPass.cpp
+++ b/src/gpu/GrOpsRenderPass.cpp
@@ -11,8 +11,8 @@
#include "src/gpu/GrCaps.h"
#include "src/gpu/GrCpuBuffer.h"
#include "src/gpu/GrDrawIndirectCommand.h"
+#include "src/gpu/GrGeometryProcessor.h"
#include "src/gpu/GrGpu.h"
-#include "src/gpu/GrPrimitiveProcessor.h"
#include "src/gpu/GrProgramInfo.h"
#include "src/gpu/GrRenderTarget.h"
#include "src/gpu/GrScissorState.h"
@@ -64,7 +64,7 @@
// Both the 'programInfo' and this renderPass have an origin. Since they come from the same
// place (i.e., the target renderTargetProxy) they had best agree.
SkASSERT(programInfo.origin() == fOrigin);
- if (programInfo.primProc().hasInstanceAttributes()) {
+ if (programInfo.geomProc().hasInstanceAttributes()) {
SkASSERT(this->gpu()->caps()->drawInstancedSupport());
}
if (programInfo.pipeline().usesConservativeRaster()) {
@@ -91,7 +91,7 @@
this->resetActiveBuffers();
- if (programInfo.primProc().numVertexAttributes() > this->gpu()->caps()->maxVertexAttributes()) {
+ if (programInfo.geomProc().numVertexAttributes() > this->gpu()->caps()->maxVertexAttributes()) {
fDrawPipelineStatus = DrawPipelineStatus::kFailedToBind;
return;
}
@@ -104,7 +104,7 @@
#ifdef SK_DEBUG
fScissorStatus = (programInfo.pipeline().isScissorTestEnabled()) ?
DynamicStateStatus::kUninitialized : DynamicStateStatus::kDisabled;
- bool hasTextures = (programInfo.primProc().numTextureSamplers() > 0);
+ bool hasTextures = (programInfo.geomProc().numTextureSamplers() > 0);
if (!hasTextures) {
programInfo.pipeline().visitProxies([&hasTextures](GrSurfaceProxy*, GrMipmapped) {
hasTextures = true;
@@ -113,9 +113,9 @@
fTextureBindingStatus = (hasTextures) ?
DynamicStateStatus::kUninitialized : DynamicStateStatus::kDisabled;
fHasIndexBuffer = false;
- fInstanceBufferStatus = (programInfo.primProc().hasInstanceAttributes()) ?
+ fInstanceBufferStatus = (programInfo.geomProc().hasInstanceAttributes()) ?
DynamicStateStatus::kUninitialized : DynamicStateStatus::kDisabled;
- fVertexBufferStatus = (programInfo.primProc().hasVertexAttributes()) ?
+ fVertexBufferStatus = (programInfo.geomProc().hasVertexAttributes()) ?
DynamicStateStatus::kUninitialized : DynamicStateStatus::kDisabled;
#endif
@@ -133,14 +133,14 @@
SkDEBUGCODE(fScissorStatus = DynamicStateStatus::kConfigured);
}
-void GrOpsRenderPass::bindTextures(const GrPrimitiveProcessor& primProc,
- const GrSurfaceProxy* const primProcTextures[],
+void GrOpsRenderPass::bindTextures(const GrGeometryProcessor& geomProc,
+ const GrSurfaceProxy* const geomProcTextures[],
const GrPipeline& pipeline) {
#ifdef SK_DEBUG
- SkASSERT((primProc.numTextureSamplers() > 0) == SkToBool(primProcTextures));
- for (int i = 0; i < primProc.numTextureSamplers(); ++i) {
- const auto& sampler = primProc.textureSampler(i);
- const GrSurfaceProxy* proxy = primProcTextures[i];
+ SkASSERT((geomProc.numTextureSamplers() > 0) == SkToBool(geomProcTextures));
+ for (int i = 0; i < geomProc.numTextureSamplers(); ++i) {
+ const auto& sampler = geomProc.textureSampler(i);
+ const GrSurfaceProxy* proxy = geomProcTextures[i];
SkASSERT(proxy);
SkASSERT(proxy->backendFormat() == sampler.backendFormat());
SkASSERT(proxy->backendFormat().textureType() == sampler.backendFormat().textureType());
@@ -164,7 +164,7 @@
// Don't assert on fTextureBindingStatus. onBindTextures() just turns into a no-op when there
// aren't any textures, and it's hard to tell from the GrPipeline whether there are any. For
// many clients it is easier to just always call this method.
- if (!this->onBindTextures(primProc, primProcTextures, pipeline)) {
+ if (!this->onBindTextures(geomProc, geomProcTextures, pipeline)) {
fDrawPipelineStatus = DrawPipelineStatus::kFailedToBind;
return;
}
diff --git a/src/gpu/GrOpsRenderPass.h b/src/gpu/GrOpsRenderPass.h
index 25da976..246cbce 100644
--- a/src/gpu/GrOpsRenderPass.h
+++ b/src/gpu/GrOpsRenderPass.h
@@ -15,7 +15,7 @@
class GrOpFlushState;
class GrGpu;
class GrPipeline;
-class GrPrimitiveProcessor;
+class GrGeometryProcessor;
class GrProgramInfo;
class GrRenderTarget;
class GrScissorState;
@@ -68,7 +68,8 @@
// FP textures from GrPipeline.)
//
// If the current program does not use textures, this is a no-op.
- void bindTextures(const GrPrimitiveProcessor&, const GrSurfaceProxy* const primProcTextures[],
+ void bindTextures(const GrGeometryProcessor&,
+ const GrSurfaceProxy* const geomProcTextures[],
const GrPipeline&);
void bindBuffers(sk_sp<const GrBuffer> indexBuffer, sk_sp<const GrBuffer> instanceBuffer,
@@ -177,8 +178,8 @@
virtual void onEnd() {}
virtual bool onBindPipeline(const GrProgramInfo&, const SkRect& drawBounds) = 0;
virtual void onSetScissorRect(const SkIRect&) = 0;
- virtual bool onBindTextures(const GrPrimitiveProcessor&,
- const GrSurfaceProxy* const primProcTextures[],
+ virtual bool onBindTextures(const GrGeometryProcessor&,
+ const GrSurfaceProxy* const geomProcTextures[],
const GrPipeline&) = 0;
virtual void onBindBuffers(sk_sp<const GrBuffer> indexBuffer, sk_sp<const GrBuffer> instanceBuffer,
sk_sp<const GrBuffer> vertexBuffer, GrPrimitiveRestart) = 0;
diff --git a/src/gpu/GrOpsTask.h b/src/gpu/GrOpsTask.h
index d7d39cd..a70701e 100644
--- a/src/gpu/GrOpsTask.h
+++ b/src/gpu/GrOpsTask.h
@@ -21,7 +21,7 @@
#include "src/core/SkStringUtils.h"
#include "src/core/SkTLazy.h"
#include "src/gpu/GrAppliedClip.h"
-#include "src/gpu/GrPrimitiveProcessor.h"
+#include "src/gpu/GrGeometryProcessor.h"
#include "src/gpu/GrRenderTask.h"
#include "src/gpu/ops/GrDrawOp.h"
#include "src/gpu/ops/GrOp.h"
diff --git a/src/gpu/GrPipeline.h b/src/gpu/GrPipeline.h
index 5f7affe..e93da0b 100644
--- a/src/gpu/GrPipeline.h
+++ b/src/gpu/GrPipeline.h
@@ -30,7 +30,7 @@
/**
* This immutable object contains information needed to set build a shader program and set API
- * state for a draw. It is used along with a GrPrimitiveProcessor and a source of geometric
+ * state for a draw. It is used along with a GrGeometryProcessor and a source of geometric
* data to draw.
*/
class GrPipeline {
diff --git a/src/gpu/GrPrimitiveProcessor.h b/src/gpu/GrPrimitiveProcessor.h
deleted file mode 100644
index 2a3253d..0000000
--- a/src/gpu/GrPrimitiveProcessor.h
+++ /dev/null
@@ -1,390 +0,0 @@
-/*
- * Copyright 2013 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef GrPrimitiveProcessor_DEFINED
-#define GrPrimitiveProcessor_DEFINED
-
-#include "src/gpu/GrColor.h"
-#include "src/gpu/GrNonAtomicRef.h"
-#include "src/gpu/GrProcessor.h"
-#include "src/gpu/GrShaderVar.h"
-#include "src/gpu/GrSwizzle.h"
-
-/*
- * The GrPrimitiveProcessor represents some kind of geometric primitive. This includes the shape
- * of the primitive and the inherent color of the primitive. The GrPrimitiveProcessor is
- * responsible for providing a color and coverage input into the Ganesh rendering pipeline. Through
- * optimization, Ganesh may decide a different color, no color, and / or no coverage are required
- * from the GrPrimitiveProcessor, so the GrPrimitiveProcessor must be able to support this
- * functionality.
- *
- * There are two feedback loops between the GrFragmentProcessors, the GrXferProcessor, and the
- * GrPrimitiveProcessor. These loops run on the CPU and to determine known properties of the final
- * color and coverage inputs to the GrXferProcessor in order to perform optimizations that preserve
- * correctness. The GrDrawOp seeds these loops with initial color and coverage, in its
- * getProcessorAnalysisInputs implementation. These seed values are processed by the
- * subsequent
- * stages of the rendering pipeline and the output is then fed back into the GrDrawOp in
- * the applyPipelineOptimizations call, where the op can use the information to inform decisions
- * about GrPrimitiveProcessor creation.
- */
-
-class GrGLSLPrimitiveProcessor;
-class GrGLSLUniformHandler;
-
-/**
- * GrPrimitiveProcessor defines an interface which all subclasses must implement. All
- * GrPrimitiveProcessors must proivide seed color and coverage for the Ganesh color / coverage
- * pipelines, and they must provide some notion of equality
- *
- * TODO: This class does not really need to be ref counted. Instances should be allocated using
- * GrOpFlushState's arena and destroyed when the arena is torn down.
- */
-class GrPrimitiveProcessor : public GrProcessor, public GrNonAtomicRef<GrPrimitiveProcessor> {
-public:
- class TextureSampler;
-
- /** Describes a vertex or instance attribute. */
- class Attribute {
- public:
- constexpr Attribute() = default;
- constexpr Attribute(const char* name,
- GrVertexAttribType cpuType,
- GrSLType gpuType)
- : fName(name), fCPUType(cpuType), fGPUType(gpuType) {
- SkASSERT(name && gpuType != kVoid_GrSLType);
- }
- constexpr Attribute(const Attribute&) = default;
-
- Attribute& operator=(const Attribute&) = default;
-
- constexpr bool isInitialized() const { return fGPUType != kVoid_GrSLType; }
-
- constexpr const char* name() const { return fName; }
- constexpr GrVertexAttribType cpuType() const { return fCPUType; }
- constexpr GrSLType gpuType() const { return fGPUType; }
-
- inline constexpr size_t size() const;
- constexpr size_t sizeAlign4() const { return SkAlign4(this->size()); }
-
- GrShaderVar asShaderVar() const {
- return {fName, fGPUType, GrShaderVar::TypeModifier::In};
- }
-
- private:
- const char* fName = nullptr;
- GrVertexAttribType fCPUType = kFloat_GrVertexAttribType;
- GrSLType fGPUType = kVoid_GrSLType;
- };
-
- class Iter {
- public:
- Iter() : fCurr(nullptr), fRemaining(0) {}
- Iter(const Iter& iter) : fCurr(iter.fCurr), fRemaining(iter.fRemaining) {}
- Iter& operator= (const Iter& iter) {
- fCurr = iter.fCurr;
- fRemaining = iter.fRemaining;
- return *this;
- }
- Iter(const Attribute* attrs, int count) : fCurr(attrs), fRemaining(count) {
- this->skipUninitialized();
- }
-
- bool operator!=(const Iter& that) const { return fCurr != that.fCurr; }
- const Attribute& operator*() const { return *fCurr; }
- void operator++() {
- if (fRemaining) {
- fRemaining--;
- fCurr++;
- this->skipUninitialized();
- }
- }
-
- private:
- void skipUninitialized() {
- if (!fRemaining) {
- fCurr = nullptr;
- } else {
- while (!fCurr->isInitialized()) {
- ++fCurr;
- }
- }
- }
-
- const Attribute* fCurr;
- int fRemaining;
- };
-
- class AttributeSet {
- public:
- Iter begin() const { return Iter(fAttributes, fCount); }
- Iter end() const { return Iter(); }
-
- int count() const { return fCount; }
- size_t stride() const { return fStride; }
-
- private:
- friend class GrPrimitiveProcessor;
-
- void init(const Attribute* attrs, int count) {
- fAttributes = attrs;
- fRawCount = count;
- fCount = 0;
- fStride = 0;
- for (int i = 0; i < count; ++i) {
- if (attrs[i].isInitialized()) {
- fCount++;
- fStride += attrs[i].sizeAlign4();
- }
- }
- }
-
- const Attribute* fAttributes = nullptr;
- int fRawCount = 0;
- int fCount = 0;
- size_t fStride = 0;
- };
-
- GrPrimitiveProcessor(ClassID);
-
- int numTextureSamplers() const { return fTextureSamplerCnt; }
- const TextureSampler& textureSampler(int index) const;
- int numVertexAttributes() const { return fVertexAttributes.fCount; }
- const AttributeSet& vertexAttributes() const { return fVertexAttributes; }
- int numInstanceAttributes() const { return fInstanceAttributes.fCount; }
- const AttributeSet& instanceAttributes() const { return fInstanceAttributes; }
-
- bool hasVertexAttributes() const { return SkToBool(fVertexAttributes.fCount); }
- bool hasInstanceAttributes() const { return SkToBool(fInstanceAttributes.fCount); }
-
- /**
- * A common practice is to populate the the vertex/instance's memory using an implicit array of
- * structs. In this case, it is best to assert that:
- * stride == sizeof(struct)
- */
- size_t vertexStride() const { return fVertexAttributes.fStride; }
- size_t instanceStride() const { return fInstanceAttributes.fStride; }
-
- bool willUseTessellationShaders() const {
- return fShaders & (kTessControl_GrShaderFlag | kTessEvaluation_GrShaderFlag);
- }
-
- bool willUseGeoShader() const {
- return fShaders & kGeometry_GrShaderFlag;
- }
-
- /**
- * Computes a key for the transforms owned by an FP based on the shader code that will be
- * emitted by the primitive processor to implement them.
- */
- static uint32_t ComputeCoordTransformsKey(const GrFragmentProcessor& fp);
-
- static constexpr int kCoordTransformKeyBits = 4;
-
- /**
- * Sets a unique key on the GrProcessorKeyBuilder that is directly associated with this geometry
- * processor's GL backend implementation.
- *
- * TODO: A better name for this function would be "compute" instead of "get".
- */
- virtual void getGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const = 0;
-
-
- void getAttributeKey(GrProcessorKeyBuilder* b) const {
- // Ensure that our CPU and GPU type fields fit together in a 32-bit value, and we never
- // collide with the "uninitialized" value.
- static_assert(kGrVertexAttribTypeCount < (1 << 8), "");
- static_assert(kGrSLTypeCount < (1 << 8), "");
-
- auto add_attributes = [=](const Attribute* attrs, int attrCount) {
- for (int i = 0; i < attrCount; ++i) {
- const Attribute& attr = attrs[i];
- b->appendComment(attr.isInitialized() ? attr.name() : "unusedAttr");
- b->addBits(8, attr.isInitialized() ? attr.cpuType() : 0xff, "attrType");
- b->addBits(8, attr.isInitialized() ? attr.gpuType() : 0xff, "attrGpuType");
- }
- };
- b->add32(fVertexAttributes.fRawCount, "numVertexAttributes");
- add_attributes(fVertexAttributes.fAttributes, fVertexAttributes.fRawCount);
- b->add32(fInstanceAttributes.fRawCount, "numInstanceAttributes");
- add_attributes(fInstanceAttributes.fAttributes, fInstanceAttributes.fRawCount);
- }
-
- /** Returns a new instance of the appropriate *GL* implementation class
- for the given GrProcessor; caller is responsible for deleting
- the object. */
- virtual GrGLSLPrimitiveProcessor* createGLSLInstance(const GrShaderCaps&) const = 0;
-
- // We use these methods as a temporary back door to inject OpenGL tessellation code. Once
- // tessellation is supported by SkSL we can remove these.
- virtual SkString getTessControlShaderGLSL(const GrGLSLPrimitiveProcessor*,
- const char* versionAndExtensionDecls,
- const GrGLSLUniformHandler&,
- const GrShaderCaps&) const {
- SK_ABORT("Not implemented.");
- }
- virtual SkString getTessEvaluationShaderGLSL(const GrGLSLPrimitiveProcessor*,
- const char* versionAndExtensionDecls,
- const GrGLSLUniformHandler&,
- const GrShaderCaps&) const {
- SK_ABORT("Not implemented.");
- }
-
-protected:
- void setVertexAttributes(const Attribute* attrs, int attrCount) {
- fVertexAttributes.init(attrs, attrCount);
- }
- void setInstanceAttributes(const Attribute* attrs, int attrCount) {
- SkASSERT(attrCount >= 0);
- fInstanceAttributes.init(attrs, attrCount);
- }
- void setWillUseTessellationShaders() {
- fShaders |= kTessControl_GrShaderFlag | kTessEvaluation_GrShaderFlag;
- }
- void setWillUseGeoShader() { fShaders |= kGeometry_GrShaderFlag; }
- void setTextureSamplerCnt(int cnt) {
- SkASSERT(cnt >= 0);
- fTextureSamplerCnt = cnt;
- }
-
- /**
- * Helper for implementing onTextureSampler(). E.g.:
- * return IthTexureSampler(i, fMyFirstSampler, fMySecondSampler, fMyThirdSampler);
- */
- template <typename... Args>
- static const TextureSampler& IthTextureSampler(int i, const TextureSampler& samp0,
- const Args&... samps) {
- return (0 == i) ? samp0 : IthTextureSampler(i - 1, samps...);
- }
- inline static const TextureSampler& IthTextureSampler(int i);
-
-private:
- virtual const TextureSampler& onTextureSampler(int) const { return IthTextureSampler(0); }
-
- GrShaderFlags fShaders = kVertex_GrShaderFlag | kFragment_GrShaderFlag;
-
- AttributeSet fVertexAttributes;
- AttributeSet fInstanceAttributes;
-
- int fTextureSamplerCnt = 0;
- using INHERITED = GrProcessor;
-};
-
-//////////////////////////////////////////////////////////////////////////////
-
-/**
- * Used to capture the properties of the GrTextureProxies required/expected by a primitiveProcessor
- * along with an associated GrSamplerState. The actual proxies used are stored in either the
- * fixed or dynamic state arrays. TextureSamplers don't perform any coord manipulation to account
- * for texture origin.
- */
-class GrPrimitiveProcessor::TextureSampler {
-public:
- TextureSampler() = default;
-
- TextureSampler(GrSamplerState, const GrBackendFormat&, const GrSwizzle&);
-
- TextureSampler(const TextureSampler&) = delete;
- TextureSampler& operator=(const TextureSampler&) = delete;
-
- void reset(GrSamplerState, const GrBackendFormat&, const GrSwizzle&);
-
- const GrBackendFormat& backendFormat() const { return fBackendFormat; }
- GrTextureType textureType() const { return fBackendFormat.textureType(); }
-
- GrSamplerState samplerState() const { return fSamplerState; }
- const GrSwizzle& swizzle() const { return fSwizzle; }
-
- bool isInitialized() const { return fIsInitialized; }
-
-private:
- GrSamplerState fSamplerState;
- GrBackendFormat fBackendFormat;
- GrSwizzle fSwizzle;
- bool fIsInitialized = false;
-};
-
-const GrPrimitiveProcessor::TextureSampler& GrPrimitiveProcessor::IthTextureSampler(int i) {
- SK_ABORT("Illegal texture sampler index");
- static const TextureSampler kBogus;
- return kBogus;
-}
-
-//////////////////////////////////////////////////////////////////////////////
-
-/**
- * Returns the size of the attrib type in bytes.
- * This was moved from include/private/GrTypesPriv.h in service of Skia dependents that build
- * with C++11.
- */
-static constexpr inline size_t GrVertexAttribTypeSize(GrVertexAttribType type) {
- switch (type) {
- case kFloat_GrVertexAttribType:
- return sizeof(float);
- case kFloat2_GrVertexAttribType:
- return 2 * sizeof(float);
- case kFloat3_GrVertexAttribType:
- return 3 * sizeof(float);
- case kFloat4_GrVertexAttribType:
- return 4 * sizeof(float);
- case kHalf_GrVertexAttribType:
- return sizeof(uint16_t);
- case kHalf2_GrVertexAttribType:
- return 2 * sizeof(uint16_t);
- case kHalf4_GrVertexAttribType:
- return 4 * sizeof(uint16_t);
- case kInt2_GrVertexAttribType:
- return 2 * sizeof(int32_t);
- case kInt3_GrVertexAttribType:
- return 3 * sizeof(int32_t);
- case kInt4_GrVertexAttribType:
- return 4 * sizeof(int32_t);
- case kByte_GrVertexAttribType:
- return 1 * sizeof(char);
- case kByte2_GrVertexAttribType:
- return 2 * sizeof(char);
- case kByte4_GrVertexAttribType:
- return 4 * sizeof(char);
- case kUByte_GrVertexAttribType:
- return 1 * sizeof(char);
- case kUByte2_GrVertexAttribType:
- return 2 * sizeof(char);
- case kUByte4_GrVertexAttribType:
- return 4 * sizeof(char);
- case kUByte_norm_GrVertexAttribType:
- return 1 * sizeof(char);
- case kUByte4_norm_GrVertexAttribType:
- return 4 * sizeof(char);
- case kShort2_GrVertexAttribType:
- return 2 * sizeof(int16_t);
- case kShort4_GrVertexAttribType:
- return 4 * sizeof(int16_t);
- case kUShort2_GrVertexAttribType: // fall through
- case kUShort2_norm_GrVertexAttribType:
- return 2 * sizeof(uint16_t);
- case kInt_GrVertexAttribType:
- return sizeof(int32_t);
- case kUint_GrVertexAttribType:
- return sizeof(uint32_t);
- case kUShort_norm_GrVertexAttribType:
- return sizeof(uint16_t);
- case kUShort4_norm_GrVertexAttribType:
- return 4 * sizeof(uint16_t);
- }
- // GCC fails because SK_ABORT evaluates to non constexpr. clang and cl.exe think this is
- // unreachable and don't complain.
-#if defined(__clang__) || !defined(__GNUC__)
- SK_ABORT("Unsupported type conversion");
-#endif
- return 0;
-}
-
-constexpr size_t GrPrimitiveProcessor::Attribute::size() const {
- return GrVertexAttribTypeSize(fCPUType);
-}
-
-#endif
diff --git a/src/gpu/GrProgramDesc.cpp b/src/gpu/GrProgramDesc.cpp
index 84f4ee1..ebe66ff 100644
--- a/src/gpu/GrProgramDesc.cpp
+++ b/src/gpu/GrProgramDesc.cpp
@@ -9,8 +9,8 @@
#include "include/private/SkChecksum.h"
#include "include/private/SkTo.h"
+#include "src/gpu/GrGeometryProcessor.h"
#include "src/gpu/GrPipeline.h"
-#include "src/gpu/GrPrimitiveProcessor.h"
#include "src/gpu/GrProcessor.h"
#include "src/gpu/GrProgramInfo.h"
#include "src/gpu/GrRenderTarget.h"
@@ -53,12 +53,13 @@
return SkToU32(samplerTypeKey | swizzleKey << kSamplerOrImageTypeKeyBits);
}
-static void add_pp_sampler_keys(GrProcessorKeyBuilder* b, const GrPrimitiveProcessor& pp,
- const GrCaps& caps) {
- int numTextureSamplers = pp.numTextureSamplers();
+static void add_geomproc_sampler_keys(GrProcessorKeyBuilder* b,
+ const GrGeometryProcessor& geomProc,
+ const GrCaps& caps) {
+ int numTextureSamplers = geomProc.numTextureSamplers();
b->add32(numTextureSamplers, "ppNumSamplers");
for (int i = 0; i < numTextureSamplers; ++i) {
- const GrPrimitiveProcessor::TextureSampler& sampler = pp.textureSampler(i);
+ const GrGeometryProcessor::TextureSampler& sampler = geomProc.textureSampler(i);
const GrBackendFormat& backendFormat = sampler.backendFormat();
uint32_t samplerKey = sampler_key(backendFormat.textureType(), sampler.swizzle(), caps);
@@ -78,16 +79,16 @@
* Shader code may be dependent on properties of the effect not placed in the key by the effect
* (e.g. pixel format of textures used).
*/
-static void gen_pp_key(const GrPrimitiveProcessor& pp,
- const GrCaps& caps,
- GrProcessorKeyBuilder* b) {
- b->appendComment(pp.name());
- b->addBits(kClassIDBits, pp.classID(), "ppClassID");
+static void gen_geomproc_key(const GrGeometryProcessor& geomProc,
+ const GrCaps& caps,
+ GrProcessorKeyBuilder* b) {
+ b->appendComment(geomProc.name());
+ b->addBits(kClassIDBits, geomProc.classID(), "geomProcClassID");
- pp.getGLSLProcessorKey(*caps.shaderCaps(), b);
- pp.getAttributeKey(b);
+ geomProc.getGLSLProcessorKey(*caps.shaderCaps(), b);
+ geomProc.getAttributeKey(b);
- add_pp_sampler_keys(b, pp, caps);
+ add_geomproc_sampler_keys(b, geomProc, caps);
}
static void gen_xp_key(const GrXferProcessor& xp,
@@ -111,8 +112,8 @@
GrProcessorKeyBuilder* b) {
b->appendComment(fp.name());
b->addBits(kClassIDBits, fp.classID(), "fpClassID");
- b->addBits(GrPrimitiveProcessor::kCoordTransformKeyBits,
- GrPrimitiveProcessor::ComputeCoordTransformsKey(fp), "fpTransforms");
+ b->addBits(GrGeometryProcessor::kCoordTransformKeyBits,
+ GrGeometryProcessor::ComputeCoordTransformsKey(fp), "fpTransforms");
if (auto* te = fp.asTextureEffect()) {
const GrBackendFormat& backendFormat = te->view().proxy()->backendFormat();
@@ -139,7 +140,7 @@
GrRenderTarget* renderTarget,
const GrProgramInfo& programInfo,
const GrCaps& caps) {
- gen_pp_key(programInfo.primProc(), caps, b);
+ gen_geomproc_key(programInfo.geomProc(), caps, b);
const GrPipeline& pipeline = programInfo.pipeline();
b->addBits(2, pipeline.numFragmentProcessors(), "numFPs");
diff --git a/src/gpu/GrProgramInfo.h b/src/gpu/GrProgramInfo.h
index 66907b0..47cdef8 100644
--- a/src/gpu/GrProgramInfo.h
+++ b/src/gpu/GrProgramInfo.h
@@ -9,8 +9,8 @@
#define GrProgramInfo_DEFINED
#include "include/gpu/GrTypes.h"
+#include "src/gpu/GrGeometryProcessor.h"
#include "src/gpu/GrPipeline.h"
-#include "src/gpu/GrPrimitiveProcessor.h"
class GrStencilSettings;
@@ -19,7 +19,7 @@
GrProgramInfo(const GrSurfaceProxyView& targetView,
const GrPipeline* pipeline,
const GrUserStencilSettings* userStencilSettings,
- const GrPrimitiveProcessor* primProc,
+ const GrGeometryProcessor* geomProc,
GrPrimitiveType primitiveType,
uint8_t tessellationPatchVertexCount,
GrXferBarrierFlags renderPassXferBarriers,
@@ -34,7 +34,7 @@
targetView.asRenderTargetProxy()->supportsVkInputAttachment())
, fPipeline(pipeline)
, fUserStencilSettings(userStencilSettings)
- , fPrimProc(primProc)
+ , fGeomProc(geomProc)
, fPrimitiveType(primitiveType)
, fTessellationPatchVertexCount(tessellationPatchVertexCount)
, fRenderPassXferBarriers(renderPassXferBarriers)
@@ -43,7 +43,7 @@
SkASSERT(this->numRasterSamples() > 0);
SkASSERT((GrPrimitiveType::kPatches == fPrimitiveType) ==
(fTessellationPatchVertexCount > 0));
- fRequestedFeatures = fPrimProc->requestedFeatures();
+ fRequestedFeatures = fGeomProc->requestedFeatures();
for (int i = 0; i < fPipeline->numFragmentProcessors(); ++i) {
fRequestedFeatures |= fPipeline->getFragmentProcessor(i).requestedFeatures();
}
@@ -69,7 +69,7 @@
const GrBackendFormat& backendFormat() const { return fBackendFormat; }
GrSurfaceOrigin origin() const { return fOrigin; }
const GrPipeline& pipeline() const { return *fPipeline; }
- const GrPrimitiveProcessor& primProc() const { return *fPrimProc; }
+ const GrGeometryProcessor& geomProc() const { return *fGeomProc; }
GrPrimitiveType primitiveType() const { return fPrimitiveType; }
uint8_t tessellationPatchVertexCount() const {
@@ -109,7 +109,7 @@
const bool fTargetSupportsVkResolveLoad;
const GrPipeline* fPipeline;
const GrUserStencilSettings* fUserStencilSettings;
- const GrPrimitiveProcessor* fPrimProc;
+ const GrGeometryProcessor* fGeomProc;
GrProcessor::CustomFeatures fRequestedFeatures;
GrPrimitiveType fPrimitiveType;
uint8_t fTessellationPatchVertexCount; // GrPrimType::kPatches.
diff --git a/src/gpu/GrSimpleMesh.h b/src/gpu/GrSimpleMesh.h
index af05400..cd246be 100644
--- a/src/gpu/GrSimpleMesh.h
+++ b/src/gpu/GrSimpleMesh.h
@@ -12,7 +12,7 @@
#include "src/gpu/GrGpuBuffer.h"
#include "src/gpu/GrOpsRenderPass.h"
-class GrPrimitiveProcessor;
+class GrGeometryProcessor;
/**
* Used to communicate simple (non-instanced, direct) draws from GrOp to GrOpsRenderPass.
diff --git a/src/gpu/d3d/GrD3DOpsRenderPass.cpp b/src/gpu/d3d/GrD3DOpsRenderPass.cpp
index 8b0611e..8a01c39 100644
--- a/src/gpu/d3d/GrD3DOpsRenderPass.cpp
+++ b/src/gpu/d3d/GrD3DOpsRenderPass.cpp
@@ -219,14 +219,14 @@
d3dTex->setResourceState(gpu, D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE);
}
-bool GrD3DOpsRenderPass::onBindTextures(const GrPrimitiveProcessor& primProc,
- const GrSurfaceProxy* const primProcTextures[],
+bool GrD3DOpsRenderPass::onBindTextures(const GrGeometryProcessor& geomProc,
+ const GrSurfaceProxy* const geomProcTextures[],
const GrPipeline& pipeline) {
SkASSERT(fCurrentPipelineState);
// update textures to sampled resource state
- for (int i = 0; i < primProc.numTextureSamplers(); ++i) {
- update_resource_state(primProcTextures[i]->peekTexture(), fRenderTarget, fGpu);
+ for (int i = 0; i < geomProc.numTextureSamplers(); ++i) {
+ update_resource_state(geomProcTextures[i]->peekTexture(), fRenderTarget, fGpu);
}
pipeline.visitTextureEffects([&](const GrTextureEffect& te) {
@@ -238,7 +238,7 @@
}
// TODO: possibly check for success once we start binding properly
- fCurrentPipelineState->setAndBindTextures(fGpu, primProc, primProcTextures, pipeline);
+ fCurrentPipelineState->setAndBindTextures(fGpu, geomProc, geomProcTextures, pipeline);
return true;
}
diff --git a/src/gpu/d3d/GrD3DOpsRenderPass.h b/src/gpu/d3d/GrD3DOpsRenderPass.h
index d6dfed5..fc2eaa8 100644
--- a/src/gpu/d3d/GrD3DOpsRenderPass.h
+++ b/src/gpu/d3d/GrD3DOpsRenderPass.h
@@ -38,7 +38,8 @@
bool onBindPipeline(const GrProgramInfo&, const SkRect& drawBounds) override;
void onSetScissorRect(const SkIRect&) override;
- bool onBindTextures(const GrPrimitiveProcessor&, const GrSurfaceProxy* const primProcTextures[],
+ bool onBindTextures(const GrGeometryProcessor&,
+ const GrSurfaceProxy* const geomProcTextures[],
const GrPipeline&) override;
void onBindBuffers(sk_sp<const GrBuffer> indexBuffer, sk_sp<const GrBuffer> instanceBuffer,
sk_sp<const GrBuffer> vertexBuffer, GrPrimitiveRestart) override;
diff --git a/src/gpu/d3d/GrD3DPipelineState.cpp b/src/gpu/d3d/GrD3DPipelineState.cpp
index 5a16e7e..0362db8 100644
--- a/src/gpu/d3d/GrD3DPipelineState.cpp
+++ b/src/gpu/d3d/GrD3DPipelineState.cpp
@@ -45,7 +45,7 @@
const GrProgramInfo& programInfo) {
this->setRenderTargetState(renderTarget, programInfo.origin());
- fGeometryProcessor->setData(fDataManager, programInfo.primProc());
+ fGeometryProcessor->setData(fDataManager, programInfo.geomProc());
for (int i = 0; i < programInfo.pipeline().numFragmentProcessors(); ++i) {
auto& fp = programInfo.pipeline().getFragmentProcessor(i);
for (auto [fp, impl] : GrGLSLFragmentProcessor::ParallelRange(fp, *fFPImpls[i])) {
@@ -88,19 +88,20 @@
}
}
-void GrD3DPipelineState::setAndBindTextures(GrD3DGpu* gpu, const GrPrimitiveProcessor& primProc,
- const GrSurfaceProxy* const primProcTextures[],
+void GrD3DPipelineState::setAndBindTextures(GrD3DGpu* gpu,
+ const GrGeometryProcessor& geomProc,
+ const GrSurfaceProxy* const geomProcTextures[],
const GrPipeline& pipeline) {
- SkASSERT(primProcTextures || !primProc.numTextureSamplers());
+ SkASSERT(geomProcTextures || !geomProc.numTextureSamplers());
std::vector<D3D12_CPU_DESCRIPTOR_HANDLE> shaderResourceViews(fNumSamplers);
std::vector<D3D12_CPU_DESCRIPTOR_HANDLE> samplers(fNumSamplers);
unsigned int currTextureBinding = 0;
- for (int i = 0; i < primProc.numTextureSamplers(); ++i) {
- SkASSERT(primProcTextures[i]->asTextureProxy());
- const auto& sampler = primProc.textureSampler(i);
- auto texture = static_cast<GrD3DTexture*>(primProcTextures[i]->peekTexture());
+ for (int i = 0; i < geomProc.numTextureSamplers(); ++i) {
+ SkASSERT(geomProcTextures[i]->asTextureProxy());
+ const auto& sampler = geomProc.textureSampler(i);
+ auto texture = static_cast<GrD3DTexture*>(geomProcTextures[i]->peekTexture());
shaderResourceViews[currTextureBinding] = texture->shaderResourceView();
samplers[currTextureBinding++] =
gpu->resourceProvider().findOrCreateCompatibleSampler(sampler.samplerState());
diff --git a/src/gpu/d3d/GrD3DPipelineState.h b/src/gpu/d3d/GrD3DPipelineState.h
index afaf03c..9bd7499 100644
--- a/src/gpu/d3d/GrD3DPipelineState.h
+++ b/src/gpu/d3d/GrD3DPipelineState.h
@@ -55,9 +55,10 @@
void setAndBindConstants(GrD3DGpu*, const GrRenderTarget*, const GrProgramInfo&);
- void setAndBindTextures(GrD3DGpu*, const GrPrimitiveProcessor& primProc,
- const GrSurfaceProxy* const primProcTextures[],
- const GrPipeline& pipeline);
+ void setAndBindTextures(GrD3DGpu*,
+ const GrGeometryProcessor&,
+ const GrSurfaceProxy* const geomProcTextures[],
+ const GrPipeline&);
void bindBuffers(GrD3DGpu*, sk_sp<const GrBuffer> indexBuffer,
sk_sp<const GrBuffer> instanceBuffer, sk_sp<const GrBuffer> vertexBuffer,
diff --git a/src/gpu/d3d/GrD3DPipelineStateBuilder.cpp b/src/gpu/d3d/GrD3DPipelineStateBuilder.cpp
index dc494ef..cad1923 100644
--- a/src/gpu/d3d/GrD3DPipelineStateBuilder.cpp
+++ b/src/gpu/d3d/GrD3DPipelineStateBuilder.cpp
@@ -217,22 +217,22 @@
SK_ABORT("Unknown vertex attrib type");
}
-static void setup_vertex_input_layout(const GrPrimitiveProcessor& primProc,
+static void setup_vertex_input_layout(const GrGeometryProcessor& geomProc,
D3D12_INPUT_ELEMENT_DESC* inputElements) {
unsigned int slotNumber = 0;
unsigned int vertexSlot = 0;
unsigned int instanceSlot = 0;
- if (primProc.hasVertexAttributes()) {
+ if (geomProc.hasVertexAttributes()) {
vertexSlot = slotNumber++;
}
- if (primProc.hasInstanceAttributes()) {
+ if (geomProc.hasInstanceAttributes()) {
instanceSlot = slotNumber++;
}
unsigned int currentAttrib = 0;
unsigned int vertexAttributeOffset = 0;
- for (const auto& attrib : primProc.vertexAttributes()) {
+ for (const auto& attrib : geomProc.vertexAttributes()) {
// When using SPIRV-Cross it converts the location modifier in SPIRV to be
// TEXCOORD<N> where N is the location value for eveery vertext attribute
inputElements[currentAttrib] = { "TEXCOORD", currentAttrib,
@@ -242,10 +242,10 @@
vertexAttributeOffset += attrib.sizeAlign4();
currentAttrib++;
}
- SkASSERT(vertexAttributeOffset == primProc.vertexStride());
+ SkASSERT(vertexAttributeOffset == geomProc.vertexStride());
unsigned int instanceAttributeOffset = 0;
- for (const auto& attrib : primProc.instanceAttributes()) {
+ for (const auto& attrib : geomProc.instanceAttributes()) {
// When using SPIRV-Cross it converts the location modifier in SPIRV to be
// TEXCOORD<N> where N is the location value for eveery vertext attribute
inputElements[currentAttrib] = { "TEXCOORD", currentAttrib,
@@ -255,7 +255,7 @@
instanceAttributeOffset += attrib.sizeAlign4();
currentAttrib++;
}
- SkASSERT(instanceAttributeOffset == primProc.instanceStride());
+ SkASSERT(instanceAttributeOffset == geomProc.instanceStride());
}
static D3D12_BLEND blend_coeff_to_d3d_blend(GrBlendCoeff coeff) {
@@ -505,10 +505,10 @@
fill_in_depth_stencil_state(programInfo, &psoDesc.DepthStencilState);
- unsigned int totalAttributeCnt = programInfo.primProc().numVertexAttributes() +
- programInfo.primProc().numInstanceAttributes();
+ unsigned int totalAttributeCnt = programInfo.geomProc().numVertexAttributes() +
+ programInfo.geomProc().numInstanceAttributes();
SkAutoSTArray<4, D3D12_INPUT_ELEMENT_DESC> inputElements(totalAttributeCnt);
- setup_vertex_input_layout(programInfo.primProc(), inputElements.get());
+ setup_vertex_input_layout(programInfo.geomProc(), inputElements.get());
psoDesc.InputLayout = { inputElements.get(), totalAttributeCnt };
@@ -581,7 +581,7 @@
}
}
- const GrPrimitiveProcessor& primProc = this->primitiveProcessor();
+ const GrGeometryProcessor& geomProc = this->geometryProcessor();
gr_cp<ID3DBlob> shaders[kGrShaderTypeCount];
if (kHLSL_Tag == shaderType && this->loadHLSLFromCache(&reader, shaders)) {
@@ -616,7 +616,7 @@
return nullptr;
}
- if (primProc.willUseGeoShader()) {
+ if (geomProc.willUseGeoShader()) {
if (!compile(SkSL::ProgramKind::kGeometry, kGeometry_GrShaderType)) {
return nullptr;
}
@@ -663,6 +663,6 @@
std::move(fGeometryProcessor),
std::move(fXferProcessor),
std::move(fFPImpls),
- primProc.vertexStride(),
- primProc.instanceStride()));
+ geomProc.vertexStride(),
+ geomProc.instanceStride()));
}
diff --git a/src/gpu/d3d/GrD3DPipelineStateBuilder.h b/src/gpu/d3d/GrD3DPipelineStateBuilder.h
index bc4c4dc..d3627b9 100644
--- a/src/gpu/d3d/GrD3DPipelineStateBuilder.h
+++ b/src/gpu/d3d/GrD3DPipelineStateBuilder.h
@@ -23,12 +23,12 @@
public:
/** Generates a pipeline state.
*
- * The GrD3DPipelineState implements what is specified in the GrPipeline and
- * GrPrimitiveProcessor as input. After successful generation, the builder result objects are
- * available to be used.
+ * The returned GrD3DPipelineState implements the supplied GrProgramInfo.
+ *
* @return the created pipeline if generation was successful; nullptr otherwise
*/
- static sk_sp<GrD3DPipelineState> MakePipelineState(GrD3DGpu*, GrRenderTarget*,
+ static sk_sp<GrD3DPipelineState> MakePipelineState(GrD3DGpu*,
+ GrRenderTarget*,
const GrProgramDesc&,
const GrProgramInfo&);
diff --git a/src/gpu/dawn/GrDawnOpsRenderPass.cpp b/src/gpu/dawn/GrDawnOpsRenderPass.cpp
index e208c64..245a831 100644
--- a/src/gpu/dawn/GrDawnOpsRenderPass.cpp
+++ b/src/gpu/dawn/GrDawnOpsRenderPass.cpp
@@ -162,10 +162,10 @@
nativeScissorRect.fWidth, nativeScissorRect.fHeight);
}
-bool GrDawnOpsRenderPass::onBindTextures(const GrPrimitiveProcessor& primProc,
- const GrSurfaceProxy* const primProcTextures[],
+bool GrDawnOpsRenderPass::onBindTextures(const GrGeometryProcessor& geomProc,
+ const GrSurfaceProxy* const geomProcTextures[],
const GrPipeline& pipeline) {
- auto bindGroup = fCurrentProgram->setTextures(fGpu, primProc, pipeline, primProcTextures);
+ auto bindGroup = fCurrentProgram->setTextures(fGpu, geomProc, pipeline, geomProcTextures);
if (bindGroup) {
fPassEncoder.SetBindGroup(1, bindGroup, 0, nullptr);
}
diff --git a/src/gpu/dawn/GrDawnOpsRenderPass.h b/src/gpu/dawn/GrDawnOpsRenderPass.h
index e01ddfe..921cf9d 100644
--- a/src/gpu/dawn/GrDawnOpsRenderPass.h
+++ b/src/gpu/dawn/GrDawnOpsRenderPass.h
@@ -39,7 +39,8 @@
void onEnd() override;
bool onBindPipeline(const GrProgramInfo& programInfo, const SkRect& drawBounds) override;
void onSetScissorRect(const SkIRect&) override;
- bool onBindTextures(const GrPrimitiveProcessor&, const GrSurfaceProxy* const primProcTextures[],
+ bool onBindTextures(const GrGeometryProcessor&,
+ const GrSurfaceProxy* const geomProcTextures[],
const GrPipeline&) override;
void onBindBuffers(sk_sp<const GrBuffer> indexBuffer, sk_sp<const GrBuffer> instanceBuffer,
sk_sp<const GrBuffer> vertexBuffer, GrPrimitiveRestart) override;
diff --git a/src/gpu/dawn/GrDawnProgramBuilder.cpp b/src/gpu/dawn/GrDawnProgramBuilder.cpp
index 4b52d27..90091d3 100644
--- a/src/gpu/dawn/GrDawnProgramBuilder.cpp
+++ b/src/gpu/dawn/GrDawnProgramBuilder.cpp
@@ -348,11 +348,11 @@
std::vector<wgpu::VertexBufferLayoutDescriptor> inputs;
std::vector<wgpu::VertexAttributeDescriptor> vertexAttributes;
- const GrPrimitiveProcessor& primProc = programInfo.primProc();
+ const GrGeometryProcessor& geomProc = programInfo.geomProc();
int i = 0;
- if (primProc.numVertexAttributes() > 0) {
+ if (geomProc.numVertexAttributes() > 0) {
size_t offset = 0;
- for (const auto& attrib : primProc.vertexAttributes()) {
+ for (const auto& attrib : geomProc.vertexAttributes()) {
wgpu::VertexAttributeDescriptor attribute;
attribute.shaderLocation = i;
attribute.offset = offset;
@@ -369,9 +369,9 @@
inputs.push_back(input);
}
std::vector<wgpu::VertexAttributeDescriptor> instanceAttributes;
- if (primProc.numInstanceAttributes() > 0) {
+ if (geomProc.numInstanceAttributes() > 0) {
size_t offset = 0;
- for (const auto& attrib : primProc.instanceAttributes()) {
+ for (const auto& attrib : geomProc.instanceAttributes()) {
wgpu::VertexAttributeDescriptor attribute;
attribute.shaderLocation = i;
attribute.offset = offset;
@@ -498,8 +498,8 @@
}
this->setRenderTargetState(renderTarget, programInfo.origin());
const GrPipeline& pipeline = programInfo.pipeline();
- const GrPrimitiveProcessor& primProc = programInfo.primProc();
- fGeometryProcessor->setData(fDataManager, primProc);
+ const GrGeometryProcessor& geomProc = programInfo.geomProc();
+ fGeometryProcessor->setData(fDataManager, geomProc);
for (int i = 0; i < programInfo.pipeline().numFragmentProcessors(); ++i) {
auto& fp = programInfo.pipeline().getFragmentProcessor(i);
@@ -515,19 +515,19 @@
}
wgpu::BindGroup GrDawnProgram::setTextures(GrDawnGpu* gpu,
- const GrPrimitiveProcessor& primProc,
+ const GrGeometryProcessor& geomProc,
const GrPipeline& pipeline,
- const GrSurfaceProxy* const primProcTextures[]) {
+ const GrSurfaceProxy* const geomProcTextures[]) {
if (fBindGroupLayouts.size() < 2) {
return nullptr;
}
std::vector<wgpu::BindGroupEntry> bindings;
int binding = 0;
- if (primProcTextures) {
- for (int i = 0; i < primProc.numTextureSamplers(); ++i) {
- SkASSERT(primProcTextures[i]->asTextureProxy());
- auto& sampler = primProc.textureSampler(i);
- set_texture(gpu, sampler.samplerState(), primProcTextures[i]->peekTexture(), &bindings,
+ if (geomProcTextures) {
+ for (int i = 0; i < geomProc.numTextureSamplers(); ++i) {
+ SkASSERT(geomProcTextures[i]->asTextureProxy());
+ auto& sampler = geomProc.textureSampler(i);
+ set_texture(gpu, sampler.samplerState(), geomProcTextures[i]->peekTexture(), &bindings,
&binding);
}
}
diff --git a/src/gpu/dawn/GrDawnProgramBuilder.h b/src/gpu/dawn/GrDawnProgramBuilder.h
index ffc36fd..d86dd1d 100644
--- a/src/gpu/dawn/GrDawnProgramBuilder.h
+++ b/src/gpu/dawn/GrDawnProgramBuilder.h
@@ -66,10 +66,10 @@
void setRenderTargetState(const GrRenderTarget*, GrSurfaceOrigin);
wgpu::BindGroup setUniformData(GrDawnGpu*, const GrRenderTarget*, const GrProgramInfo&);
- wgpu::BindGroup setTextures(GrDawnGpu* gpu,
- const GrPrimitiveProcessor& primProc,
- const GrPipeline& pipeline,
- const GrSurfaceProxy* const primProcTextures[]);
+ wgpu::BindGroup setTextures(GrDawnGpu*,
+ const GrGeometryProcessor&,
+ const GrPipeline&,
+ const GrSurfaceProxy* const geomProcTextures[]);
};
class GrDawnProgramBuilder : public GrGLSLProgramBuilder {
diff --git a/src/gpu/effects/GrBezierEffect.cpp b/src/gpu/effects/GrBezierEffect.cpp
index d28dc57..0c11e93 100644
--- a/src/gpu/effects/GrBezierEffect.cpp
+++ b/src/gpu/effects/GrBezierEffect.cpp
@@ -25,8 +25,8 @@
GrProcessorKeyBuilder*);
void setData(const GrGLSLProgramDataManager& pdman,
- const GrPrimitiveProcessor& primProc) override {
- const GrConicEffect& ce = primProc.cast<GrConicEffect>();
+ const GrGeometryProcessor& geomProc) override {
+ const GrConicEffect& ce = geomProc.cast<GrConicEffect>();
this->setTransform(pdman, fViewMatrixUniform, ce.viewMatrix(), &fViewMatrix);
this->setTransform(pdman, fLocalMatrixUniform, ce.localMatrix(), &fLocalMatrix);
@@ -63,7 +63,7 @@
void GrGLConicEffect::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) {
GrGLSLVertexBuilder* vertBuilder = args.fVertBuilder;
- const GrConicEffect& gp = args.fGP.cast<GrConicEffect>();
+ const GrConicEffect& gp = args.fGeomProc.cast<GrConicEffect>();
GrGLSLVaryingHandler* varyingHandler = args.fVaryingHandler;
GrGLSLUniformHandler* uniformHandler = args.fUniformHandler;
@@ -168,7 +168,7 @@
//////////////////////////////////////////////////////////////////////////////
-constexpr GrPrimitiveProcessor::Attribute GrConicEffect::kAttributes[];
+constexpr GrGeometryProcessor::Attribute GrConicEffect::kAttributes[];
GrConicEffect::~GrConicEffect() {}
@@ -220,8 +220,8 @@
GrProcessorKeyBuilder*);
void setData(const GrGLSLProgramDataManager& pdman,
- const GrPrimitiveProcessor& primProc) override {
- const GrQuadEffect& qe = primProc.cast<GrQuadEffect>();
+ const GrGeometryProcessor& geomProc) override {
+ const GrQuadEffect& qe = geomProc.cast<GrQuadEffect>();
this->setTransform(pdman, fViewMatrixUniform, qe.viewMatrix(), &fViewMatrix);
this->setTransform(pdman, fLocalMatrixUniform, qe.localMatrix(), &fLocalMatrix);
@@ -259,7 +259,7 @@
void GrGLQuadEffect::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) {
GrGLSLVertexBuilder* vertBuilder = args.fVertBuilder;
- const GrQuadEffect& gp = args.fGP.cast<GrQuadEffect>();
+ const GrQuadEffect& gp = args.fGeomProc.cast<GrQuadEffect>();
GrGLSLVaryingHandler* varyingHandler = args.fVaryingHandler;
GrGLSLUniformHandler* uniformHandler = args.fUniformHandler;
@@ -329,7 +329,7 @@
//////////////////////////////////////////////////////////////////////////////
-constexpr GrPrimitiveProcessor::Attribute GrQuadEffect::kAttributes[];
+constexpr GrGeometryProcessor::Attribute GrQuadEffect::kAttributes[];
GrQuadEffect::~GrQuadEffect() {}
diff --git a/src/gpu/effects/GrBitmapTextGeoProc.cpp b/src/gpu/effects/GrBitmapTextGeoProc.cpp
index a852c93..64fa761 100644
--- a/src/gpu/effects/GrBitmapTextGeoProc.cpp
+++ b/src/gpu/effects/GrBitmapTextGeoProc.cpp
@@ -26,7 +26,7 @@
, fLocalMatrix(SkMatrix::InvalidMatrix()) {}
void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override {
- const GrBitmapTextGeoProc& btgp = args.fGP.cast<GrBitmapTextGeoProc>();
+ const GrBitmapTextGeoProc& btgp = args.fGeomProc.cast<GrBitmapTextGeoProc>();
GrGLSLVertexBuilder* vertBuilder = args.fVertBuilder;
GrGLSLVaryingHandler* varyingHandler = args.fVaryingHandler;
@@ -71,8 +71,9 @@
}
}
- void setData(const GrGLSLProgramDataManager& pdman, const GrPrimitiveProcessor& gp) override {
- const GrBitmapTextGeoProc& btgp = gp.cast<GrBitmapTextGeoProc>();
+ void setData(const GrGLSLProgramDataManager& pdman,
+ const GrGeometryProcessor& geomProc) override {
+ const GrBitmapTextGeoProc& btgp = geomProc.cast<GrBitmapTextGeoProc>();
if (btgp.color() != fColor && !btgp.hasVertexColor()) {
pdman.set4fv(fColorUniform, 1, btgp.color().vec());
fColor = btgp.color();
diff --git a/src/gpu/effects/GrDistanceFieldGeoProc.cpp b/src/gpu/effects/GrDistanceFieldGeoProc.cpp
index 1a307e9..c03be6f 100644
--- a/src/gpu/effects/GrDistanceFieldGeoProc.cpp
+++ b/src/gpu/effects/GrDistanceFieldGeoProc.cpp
@@ -27,7 +27,7 @@
void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override{
const GrDistanceFieldA8TextGeoProc& dfTexEffect =
- args.fGP.cast<GrDistanceFieldA8TextGeoProc>();
+ args.fGeomProc.cast<GrDistanceFieldA8TextGeoProc>();
GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
GrGLSLVertexBuilder* vertBuilder = args.fVertBuilder;
@@ -156,8 +156,9 @@
fragBuilder->codeAppendf("half4 %s = half4(val);", args.fOutputCoverage);
}
- void setData(const GrGLSLProgramDataManager& pdman, const GrPrimitiveProcessor& proc) override {
- const GrDistanceFieldA8TextGeoProc& dfa8gp = proc.cast<GrDistanceFieldA8TextGeoProc>();
+ void setData(const GrGLSLProgramDataManager& pdman,
+ const GrGeometryProcessor& geomProc) override {
+ const GrDistanceFieldA8TextGeoProc& dfa8gp = geomProc.cast<GrDistanceFieldA8TextGeoProc>();
#ifdef SK_GAMMA_APPLY_TO_A8
float distanceAdjust = dfa8gp.getDistanceAdjust();
@@ -319,7 +320,7 @@
void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override{
const GrDistanceFieldPathGeoProc& dfPathEffect =
- args.fGP.cast<GrDistanceFieldPathGeoProc>();
+ args.fGeomProc.cast<GrDistanceFieldPathGeoProc>();
GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
@@ -441,8 +442,9 @@
fragBuilder->codeAppendf("half4 %s = half4(val);", args.fOutputCoverage);
}
- void setData(const GrGLSLProgramDataManager& pdman, const GrPrimitiveProcessor& proc) override {
- const GrDistanceFieldPathGeoProc& dfpgp = proc.cast<GrDistanceFieldPathGeoProc>();
+ void setData(const GrGLSLProgramDataManager& pdman,
+ const GrGeometryProcessor& geomProc) override {
+ const GrDistanceFieldPathGeoProc& dfpgp = geomProc.cast<GrDistanceFieldPathGeoProc>();
// We always set the matrix uniform; it's either used to transform from local to device
// for the output position, or from device to local for the local coord variable.
@@ -587,7 +589,7 @@
void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override{
const GrDistanceFieldLCDTextGeoProc& dfTexEffect =
- args.fGP.cast<GrDistanceFieldLCDTextGeoProc>();
+ args.fGeomProc.cast<GrDistanceFieldLCDTextGeoProc>();
GrGLSLVertexBuilder* vertBuilder = args.fVertBuilder;
GrGLSLVaryingHandler* varyingHandler = args.fVaryingHandler;
@@ -749,10 +751,10 @@
}
void setData(const GrGLSLProgramDataManager& pdman,
- const GrPrimitiveProcessor& processor) override {
+ const GrGeometryProcessor& geomProc) override {
SkASSERT(fDistanceAdjustUni.isValid());
- const GrDistanceFieldLCDTextGeoProc& dflcd = processor.cast<GrDistanceFieldLCDTextGeoProc>();
+ const GrDistanceFieldLCDTextGeoProc& dflcd = geomProc.cast<GrDistanceFieldLCDTextGeoProc>();
GrDistanceFieldLCDTextGeoProc::DistanceAdjust wa = dflcd.getDistanceAdjust();
if (wa != fDistanceAdjust) {
pdman.set3f(fDistanceAdjustUni,
diff --git a/src/gpu/effects/GrShadowGeoProc.cpp b/src/gpu/effects/GrShadowGeoProc.cpp
index ea6cd36..4a812e5 100644
--- a/src/gpu/effects/GrShadowGeoProc.cpp
+++ b/src/gpu/effects/GrShadowGeoProc.cpp
@@ -19,7 +19,7 @@
GrGLSLRRectShadowGeoProc() {}
void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override {
- const GrRRectShadowGeoProc& rsgp = args.fGP.cast<GrRRectShadowGeoProc>();
+ const GrRRectShadowGeoProc& rsgp = args.fGeomProc.cast<GrRRectShadowGeoProc>();
GrGLSLVertexBuilder* vertBuilder = args.fVertBuilder;
GrGLSLVaryingHandler* varyingHandler = args.fVaryingHandler;
GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
@@ -45,8 +45,7 @@
fragBuilder->codeAppendf("half4 %s = half4(factor);", args.fOutputCoverage);
}
- void setData(const GrGLSLProgramDataManager& pdman, const GrPrimitiveProcessor& proc) override {
- }
+ void setData(const GrGLSLProgramDataManager&, const GrGeometryProcessor&) override {}
private:
using INHERITED = GrGLSLGeometryProcessor;
diff --git a/src/gpu/gl/GrGLOpsRenderPass.cpp b/src/gpu/gl/GrGLOpsRenderPass.cpp
index 4869429..57384b8 100644
--- a/src/gpu/gl/GrGLOpsRenderPass.cpp
+++ b/src/gpu/gl/GrGLOpsRenderPass.cpp
@@ -49,12 +49,12 @@
fGpu->flushScissorRect(scissor, fRenderTarget->height(), fOrigin);
}
-bool GrGLOpsRenderPass::onBindTextures(const GrPrimitiveProcessor& primProc,
- const GrSurfaceProxy* const primProcTextures[],
+bool GrGLOpsRenderPass::onBindTextures(const GrGeometryProcessor& geomProc,
+ const GrSurfaceProxy* const geomProcTextures[],
const GrPipeline& pipeline) {
GrGLProgram* program = fGpu->currentProgram();
SkASSERT(program);
- program->bindTextures(primProc, primProcTextures, pipeline);
+ program->bindTextures(geomProc, geomProcTextures, pipeline);
return true;
}
diff --git a/src/gpu/gl/GrGLOpsRenderPass.h b/src/gpu/gl/GrGLOpsRenderPass.h
index 8458d68..1e62b87 100644
--- a/src/gpu/gl/GrGLOpsRenderPass.h
+++ b/src/gpu/gl/GrGLOpsRenderPass.h
@@ -55,8 +55,9 @@
void onEnd() override;
bool onBindPipeline(const GrProgramInfo& programInfo, const SkRect& drawBounds) override;
void onSetScissorRect(const SkIRect& scissor) override;
- bool onBindTextures(const GrPrimitiveProcessor&, const GrSurfaceProxy* const primProcTextures[],
- const GrPipeline& pipeline) override;
+ bool onBindTextures(const GrGeometryProcessor&,
+ const GrSurfaceProxy* const geomProcTextures[],
+ const GrPipeline&) override;
void onBindBuffers(sk_sp<const GrBuffer> indexBuffer, sk_sp<const GrBuffer> instanceBuffer,
sk_sp<const GrBuffer> vertexBuffer, GrPrimitiveRestart) override;
void onDraw(int vertexCount, int baseVertex) override;
diff --git a/src/gpu/gl/GrGLProgram.cpp b/src/gpu/gl/GrGLProgram.cpp
index 3d7e714..bb6a660 100644
--- a/src/gpu/gl/GrGLProgram.cpp
+++ b/src/gpu/gl/GrGLProgram.cpp
@@ -98,7 +98,7 @@
void GrGLProgram::updateUniforms(const GrRenderTarget* renderTarget,
const GrProgramInfo& programInfo) {
- this->setRenderTargetState(renderTarget, programInfo.origin(), programInfo.primProc());
+ this->setRenderTargetState(renderTarget, programInfo.origin(), programInfo.geomProc());
// we set the uniforms for installed processors in a generic way, but subclasses of GLProgram
// determine how to set coord transforms
@@ -106,7 +106,7 @@
// We must bind to texture units in the same order in which we set the uniforms in
// GrGLProgramDataManager. That is, we bind textures for processors in this order:
// primProc, fragProcs, XP.
- fPrimitiveProcessor->setData(fProgramDataManager, programInfo.primProc());
+ fPrimitiveProcessor->setData(fProgramDataManager, programInfo.geomProc());
for (int i = 0; i < programInfo.pipeline().numFragmentProcessors(); ++i) {
auto& fp = programInfo.pipeline().getFragmentProcessor(i);
@@ -122,16 +122,16 @@
fXferProcessor->setData(fProgramDataManager, xp, dstTexture, offset);
}
-void GrGLProgram::bindTextures(const GrPrimitiveProcessor& primProc,
- const GrSurfaceProxy* const primProcTextures[],
+void GrGLProgram::bindTextures(const GrGeometryProcessor& geomProc,
+ const GrSurfaceProxy* const geomProcTextures[],
const GrPipeline& pipeline) {
- for (int i = 0; i < primProc.numTextureSamplers(); ++i) {
- SkASSERT(primProcTextures[i]->asTextureProxy());
- auto* overrideTexture = static_cast<GrGLTexture*>(primProcTextures[i]->peekTexture());
- fGpu->bindTexture(i, primProc.textureSampler(i).samplerState(),
- primProc.textureSampler(i).swizzle(), overrideTexture);
+ for (int i = 0; i < geomProc.numTextureSamplers(); ++i) {
+ SkASSERT(geomProcTextures[i]->asTextureProxy());
+ auto* overrideTexture = static_cast<GrGLTexture*>(geomProcTextures[i]->peekTexture());
+ fGpu->bindTexture(i, geomProc.textureSampler(i).samplerState(),
+ geomProc.textureSampler(i).swizzle(), overrideTexture);
}
- int nextTexSamplerIdx = primProc.numTextureSamplers();
+ int nextTexSamplerIdx = geomProc.numTextureSamplers();
pipeline.visitTextureEffects([&](const GrTextureEffect& te) {
GrSamplerState samplerState = te.samplerState();
@@ -149,8 +149,9 @@
SkASSERT(nextTexSamplerIdx == fNumTextureSamplers);
}
-void GrGLProgram::setRenderTargetState(const GrRenderTarget* rt, GrSurfaceOrigin origin,
- const GrPrimitiveProcessor& primProc) {
+void GrGLProgram::setRenderTargetState(const GrRenderTarget* rt,
+ GrSurfaceOrigin origin,
+ const GrGeometryProcessor& geomProc) {
// Load the RT size uniforms if they are needed
if (fBuiltinUniformHandles.fRTWidthUni.isValid() &&
fRenderTargetState.fRenderTargetSize.fWidth != rt->width()) {
diff --git a/src/gpu/gl/GrGLProgram.h b/src/gpu/gl/GrGLProgram.h
index 83c3e05..75e1695 100644
--- a/src/gpu/gl/GrGLProgram.h
+++ b/src/gpu/gl/GrGLProgram.h
@@ -19,7 +19,7 @@
class GrGLSLPrimitiveProcessor;
class GrGLSLXferProcessor;
class GrPipeline;
-class GrPrimitiveProcessor;
+class GrGeometryProcessor;
class GrProgramInfo;
class GrRenderTarget;
class GrTextureProxy;
@@ -122,7 +122,8 @@
/**
* Binds all primitive processor and fragment processor textures.
*/
- void bindTextures(const GrPrimitiveProcessor&, const GrSurfaceProxy* const primProcTextures[],
+ void bindTextures(const GrGeometryProcessor&,
+ const GrSurfaceProxy* const geomProcTextures[],
const GrPipeline&);
int vertexStride() const { return fVertexStride; }
@@ -156,7 +157,7 @@
int instanceStride);
// Helper for setData() that sets the view matrix and loads the render target height uniform
- void setRenderTargetState(const GrRenderTarget*, GrSurfaceOrigin, const GrPrimitiveProcessor&);
+ void setRenderTargetState(const GrRenderTarget*, GrSurfaceOrigin, const GrGeometryProcessor&);
// these reflect the current values of uniforms (GL uniform values travel with program)
RenderTargetState fRenderTargetState;
diff --git a/src/gpu/gl/builders/GrGLProgramBuilder.cpp b/src/gpu/gl/builders/GrGLProgramBuilder.cpp
index 60c05bf..77103df 100644
--- a/src/gpu/gl/builders/GrGLProgramBuilder.cpp
+++ b/src/gpu/gl/builders/GrGLProgramBuilder.cpp
@@ -119,10 +119,10 @@
}
void GrGLProgramBuilder::computeCountsAndStrides(GrGLuint programID,
- const GrPrimitiveProcessor& primProc,
+ const GrGeometryProcessor& geomProc,
bool bindAttribLocations) {
- fVertexAttributeCnt = primProc.numVertexAttributes();
- fInstanceAttributeCnt = primProc.numInstanceAttributes();
+ fVertexAttributeCnt = geomProc.numVertexAttributes();
+ fInstanceAttributeCnt = geomProc.numInstanceAttributes();
fAttributes = std::make_unique<GrGLProgram::Attribute[]>(
fVertexAttributeCnt + fInstanceAttributeCnt);
auto addAttr = [&](int i, const auto& a, size_t* stride) {
@@ -137,15 +137,15 @@
};
fVertexStride = 0;
int i = 0;
- for (const auto& attr : primProc.vertexAttributes()) {
+ for (const auto& attr : geomProc.vertexAttributes()) {
addAttr(i++, attr, &fVertexStride);
}
- SkASSERT(fVertexStride == primProc.vertexStride());
+ SkASSERT(fVertexStride == geomProc.vertexStride());
fInstanceStride = 0;
- for (const auto& attr : primProc.instanceAttributes()) {
+ for (const auto& attr : geomProc.instanceAttributes()) {
addAttr(i++, attr, &fInstanceStride);
}
- SkASSERT(fInstanceStride == primProc.instanceStride());
+ SkASSERT(fInstanceStride == geomProc.instanceStride());
}
void GrGLProgramBuilder::addInputVars(const SkSL::Program::Inputs& inputs) {
@@ -197,10 +197,10 @@
meta.fSettings = settings;
meta.fHasCustomColorOutput = fFS.hasCustomColorOutput();
meta.fHasSecondaryColorOutput = fFS.hasSecondaryOutput();
- for (const auto& attr : this->primitiveProcessor().vertexAttributes()) {
+ for (const auto& attr : this->geometryProcessor().vertexAttributes()) {
meta.fAttributeNames.emplace_back(attr.name());
}
- for (const auto& attr : this->primitiveProcessor().instanceAttributes()) {
+ for (const auto& attr : this->geometryProcessor().instanceAttributes()) {
meta.fAttributeNames.emplace_back(attr.name());
}
@@ -235,7 +235,7 @@
// compile shaders and bind attributes / uniforms
auto errorHandler = this->gpu()->getContext()->priv().getShaderErrorHandler();
- const GrPrimitiveProcessor& primProc = this->primitiveProcessor();
+ const GrGeometryProcessor& geomProc = this->geometryProcessor();
SkSL::Program::Settings settings;
settings.fFlipY = this->origin() != kTopLeft_GrSurfaceOrigin;
settings.fSharpenTextures =
@@ -260,7 +260,7 @@
// This is very similar to when we get program binaries. We even set that flag, as it's
// used to prevent other compile work later, and to force re-querying uniform locations.
this->addInputVars(precompiledProgram->fInputs);
- this->computeCountsAndStrides(programID, primProc, false);
+ this->computeCountsAndStrides(programID, geomProc, false);
usedProgramBinaries = true;
} else if (cached) {
TRACE_EVENT0_ALWAYS("skia.shaders", "cache_hit");
@@ -292,7 +292,7 @@
}
if (cached) {
this->addInputVars(inputs);
- this->computeCountsAndStrides(programID, primProc, false);
+ this->computeCountsAndStrides(programID, geomProc, false);
}
} else {
cached = false;
@@ -379,14 +379,14 @@
}
// This also binds vertex attribute locations.
- this->computeCountsAndStrides(programID, primProc, true);
+ this->computeCountsAndStrides(programID, geomProc, true);
/*
Tessellation Shaders
*/
- if (fProgramInfo.primProc().willUseTessellationShaders()) {
+ if (fProgramInfo.geomProc().willUseTessellationShaders()) {
// Tessellation shaders are not currently supported by SkSL. So here, we temporarily
- // generate GLSL strings directly using back door methods on GrPrimitiveProcessor, and
+ // generate GLSL strings directly using back door methods on GrGeometryProcessor, and
// pass those raw strings on to the driver.
SkString versionAndExtensionDecls;
versionAndExtensionDecls.appendf("%s\n", this->shaderCaps()->versionDeclString());
@@ -394,7 +394,7 @@
versionAndExtensionDecls.appendf("#extension %s : require\n", extensionString);
}
- SkString tessControlShader = primProc.getTessControlShaderGLSL(
+ SkString tessControlShader = geomProc.getTessControlShaderGLSL(
fGeometryProcessor.get(), versionAndExtensionDecls.c_str(), fUniformHandler,
*this->shaderCaps());
if (!this->compileAndAttachShaders(tessControlShader.c_str(), programID,
@@ -404,7 +404,7 @@
return nullptr;
}
- SkString tessEvaluationShader = primProc.getTessEvaluationShaderGLSL(
+ SkString tessEvaluationShader = geomProc.getTessEvaluationShaderGLSL(
fGeometryProcessor.get(), versionAndExtensionDecls.c_str(), fUniformHandler,
*this->shaderCaps());
if (!this->compileAndAttachShaders(tessEvaluationShader.c_str(), programID,
@@ -418,7 +418,7 @@
/*
Geometry Shader
*/
- if (primProc.willUseGeoShader()) {
+ if (geomProc.willUseGeoShader()) {
if (glsl[kGeometry_GrShaderType].empty()) {
// Don't have cached GLSL, need to compile SkSL->GLSL
std::unique_ptr<SkSL::Program> gs;
@@ -461,10 +461,10 @@
//
// We also can't cache SkSL or GLSL if we were given a precompiled program, but there's not
// much point in doing so.
- if (!cached && !primProc.willUseTessellationShaders() && !precompiledProgram) {
+ if (!cached && !geomProc.willUseTessellationShaders() && !precompiledProgram) {
// FIXME: Remove the check for tessellation shaders in the above 'if' once the back door
// GLSL mechanism is removed.
- (void)&GrPrimitiveProcessor::getTessControlShaderGLSL;
+ (void)&GrGeometryProcessor::getTessControlShaderGLSL;
bool isSkSL = false;
if (fGpu->getContext()->priv().options().fShaderCacheStrategy ==
GrContextOptions::ShaderCacheStrategy::kSkSL) {
diff --git a/src/gpu/gl/builders/GrGLProgramBuilder.h b/src/gpu/gl/builders/GrGLProgramBuilder.h
index 97fd36a..7049832 100644
--- a/src/gpu/gl/builders/GrGLProgramBuilder.h
+++ b/src/gpu/gl/builders/GrGLProgramBuilder.h
@@ -68,7 +68,8 @@
SkTDArray<GrGLuint>* shaderIds,
GrContextOptions::ShaderErrorHandler* errorHandler);
- void computeCountsAndStrides(GrGLuint programID, const GrPrimitiveProcessor& primProc,
+ void computeCountsAndStrides(GrGLuint programID,
+ const GrGeometryProcessor&,
bool bindAttribLocations);
void storeShaderInCache(const SkSL::Program::Inputs& inputs, GrGLuint programID,
const SkSL::String shaders[], bool isSkSL,
diff --git a/src/gpu/glsl/GrGLSLGeometryProcessor.cpp b/src/gpu/glsl/GrGLSLGeometryProcessor.cpp
index c147eae..d0049af 100644
--- a/src/gpu/glsl/GrGLSLGeometryProcessor.cpp
+++ b/src/gpu/glsl/GrGLSLGeometryProcessor.cpp
@@ -28,14 +28,14 @@
SkASSERT(!*args.fFPCoordTransformHandler);
}
- if (args.fGP.willUseTessellationShaders()) {
+ if (args.fGeomProc.willUseTessellationShaders()) {
// Tessellation shaders are temporarily responsible for integrating their own code strings
// while we work out full support.
return;
}
GrGLSLVertexBuilder* vBuilder = args.fVertBuilder;
- if (!args.fGP.willUseGeoShader()) {
+ if (!args.fGeomProc.willUseGeoShader()) {
// Emit the vertex position to the hardware in the normalized window coordinates it expects.
SkASSERT(kFloat2_GrSLType == gpArgs.fPositionVar.getType() ||
kFloat3_GrSLType == gpArgs.fPositionVar.getType());
diff --git a/src/gpu/glsl/GrGLSLPrimitiveProcessor.h b/src/gpu/glsl/GrGLSLPrimitiveProcessor.h
index 2fc7145..0b88f37 100644
--- a/src/gpu/glsl/GrGLSLPrimitiveProcessor.h
+++ b/src/gpu/glsl/GrGLSLPrimitiveProcessor.h
@@ -9,11 +9,11 @@
#define GrGLSLPrimitiveProcessor_DEFINED
#include "src/gpu/GrFragmentProcessor.h"
-#include "src/gpu/GrPrimitiveProcessor.h"
+#include "src/gpu/GrGeometryProcessor.h"
#include "src/gpu/glsl/GrGLSLProgramDataManager.h"
#include "src/gpu/glsl/GrGLSLUniformHandler.h"
-class GrPrimitiveProcessor;
+class GrGeometryProcessor;
class GrGLSLFPFragmentBuilder;
class GrGLSLGeometryBuilder;
class GrGLSLGPBuilder;
@@ -67,7 +67,7 @@
GrGLSLVaryingHandler* varyingHandler,
GrGLSLUniformHandler* uniformHandler,
const GrShaderCaps* caps,
- const GrPrimitiveProcessor& gp,
+ const GrGeometryProcessor& geomProc,
const char* outputColor,
const char* outputCoverage,
const SamplerHandle* texSamplers,
@@ -78,7 +78,7 @@
, fVaryingHandler(varyingHandler)
, fUniformHandler(uniformHandler)
, fShaderCaps(caps)
- , fGP(gp)
+ , fGeomProc(geomProc)
, fOutputColor(outputColor)
, fOutputCoverage(outputCoverage)
, fTexSamplers(texSamplers)
@@ -89,7 +89,7 @@
GrGLSLVaryingHandler* fVaryingHandler;
GrGLSLUniformHandler* fUniformHandler;
const GrShaderCaps* fShaderCaps;
- const GrPrimitiveProcessor& fGP;
+ const GrGeometryProcessor& fGeomProc;
const char* fOutputColor;
const char* fOutputCoverage;
const SamplerHandle* fTexSamplers;
@@ -112,15 +112,15 @@
* A GrGLSLPrimitiveProcessor instance can be reused with any GrGLSLPrimitiveProcessor that
* produces the same stage key; this function reads data from a GrGLSLPrimitiveProcessor and
* uploads any uniform variables required by the shaders created in emitCode(). The
- * GrPrimitiveProcessor parameter is guaranteed to be of the same type and to have an
- * identical processor key as the GrPrimitiveProcessor that created this
+ * GrGeometryProcessor parameter is guaranteed to be of the same type and to have an
+ * identical processor key as the GrGeometryProcessor that created this
* GrGLSLPrimitiveProcessor.
* The subclass should use the transform range to perform any setup required for the coord
* transforms of the FPs that are part of the same program, such as updating matrix uniforms.
* The range will iterate over the transforms in the same order as the TransformHandler passed
* to emitCode.
*/
- virtual void setData(const GrGLSLProgramDataManager&, const GrPrimitiveProcessor&) = 0;
+ virtual void setData(const GrGLSLProgramDataManager&, const GrGeometryProcessor&) = 0;
protected:
void setupUniformColor(GrGLSLFPFragmentBuilder* fragBuilder,
diff --git a/src/gpu/glsl/GrGLSLProgramBuilder.cpp b/src/gpu/glsl/GrGLSLProgramBuilder.cpp
index 43f6a6c..8fd1399 100644
--- a/src/gpu/glsl/GrGLSLProgramBuilder.cpp
+++ b/src/gpu/glsl/GrGLSLProgramBuilder.cpp
@@ -46,7 +46,7 @@
fVS.addFeature(featureBit, extensionName);
}
if (shaders & kGeometry_GrShaderFlag) {
- SkASSERT(this->primitiveProcessor().willUseGeoShader());
+ SkASSERT(this->geometryProcessor().willUseGeoShader());
fGS.addFeature(featureBit, extensionName);
}
if (shaders & kFragment_GrShaderFlag) {
@@ -70,7 +70,7 @@
}
void GrGLSLProgramBuilder::emitAndInstallPrimProc(SkString* outputColor, SkString* outputCoverage) {
- const GrPrimitiveProcessor& proc = this->primitiveProcessor();
+ const GrGeometryProcessor& geomProc = this->geometryProcessor();
// Program builders have a bit of state we need to clear with each effect
AutoStageAdvance adv(this);
@@ -79,9 +79,9 @@
SkASSERT(!fUniformHandles.fRTAdjustmentUni.isValid());
GrShaderFlags rtAdjustVisibility;
- if (proc.willUseGeoShader()) {
+ if (geomProc.willUseGeoShader()) {
rtAdjustVisibility = kGeometry_GrShaderFlag;
- } else if (proc.willUseTessellationShaders()) {
+ } else if (geomProc.willUseTessellationShaders()) {
rtAdjustVisibility = kTessEvaluation_GrShaderFlag;
} else {
rtAdjustVisibility = kVertex_GrShaderFlag;
@@ -89,18 +89,18 @@
fUniformHandles.fRTAdjustmentUni = this->uniformHandler()->addUniform(
nullptr, rtAdjustVisibility, kFloat4_GrSLType, SkSL::Compiler::RTADJUST_NAME);
- fFS.codeAppendf("// Stage %d, %s\n", fStageIndex, proc.name());
- fVS.codeAppendf("// Primitive Processor %s\n", proc.name());
+ fFS.codeAppendf("// Stage %d, %s\n", fStageIndex, geomProc.name());
+ fVS.codeAppendf("// Primitive Processor %s\n", geomProc.name());
SkASSERT(!fGeometryProcessor);
- fGeometryProcessor.reset(proc.createGLSLInstance(*this->shaderCaps()));
+ fGeometryProcessor.reset(geomProc.createGLSLInstance(*this->shaderCaps()));
- SkAutoSTMalloc<4, SamplerHandle> texSamplers(proc.numTextureSamplers());
- for (int i = 0; i < proc.numTextureSamplers(); ++i) {
+ SkAutoSTMalloc<4, SamplerHandle> texSamplers(geomProc.numTextureSamplers());
+ for (int i = 0; i < geomProc.numTextureSamplers(); ++i) {
SkString name;
name.printf("TextureSampler_%d", i);
- const auto& sampler = proc.textureSampler(i);
- texSamplers[i] = this->emitSampler(proc.textureSampler(i).backendFormat(),
+ const auto& sampler = geomProc.textureSampler(i);
+ texSamplers[i] = this->emitSampler(geomProc.textureSampler(i).backendFormat(),
sampler.samplerState(),
sampler.swizzle(),
name.c_str());
@@ -109,12 +109,12 @@
GrGLSLPrimitiveProcessor::FPCoordTransformHandler transformHandler(this->pipeline(),
&fTransformedCoordVars);
GrGLSLGeometryProcessor::EmitArgs args(&fVS,
- proc.willUseGeoShader() ? &fGS : nullptr,
+ geomProc.willUseGeoShader() ? &fGS : nullptr,
&fFS,
this->varyingHandler(),
this->uniformHandler(),
this->shaderCaps(),
- proc,
+ geomProc,
outputColor->c_str(),
outputCoverage->c_str(),
texSamplers.get(),
@@ -123,7 +123,7 @@
// We have to check that effects and the code they emit are consistent, ie if an effect
// asks for dst color, then the emit code needs to follow suit
- SkDEBUGCODE(verify(proc);)
+ SkDEBUGCODE(verify(geomProc);)
}
void GrGLSLProgramBuilder::emitAndInstallFragProcs(SkString* color, SkString* coverage) {
@@ -275,9 +275,9 @@
}
#ifdef SK_DEBUG
-void GrGLSLProgramBuilder::verify(const GrPrimitiveProcessor& gp) {
+void GrGLSLProgramBuilder::verify(const GrGeometryProcessor& geomProc) {
SkASSERT(!fFS.fHasReadDstColorThisStage_DebugOnly);
- SkASSERT(fFS.fUsedProcessorFeaturesThisStage_DebugOnly == gp.requestedFeatures());
+ SkASSERT(fFS.fUsedProcessorFeaturesThisStage_DebugOnly == geomProc.requestedFeatures());
}
void GrGLSLProgramBuilder::verify(const GrFragmentProcessor& fp) {
@@ -338,7 +338,7 @@
void GrGLSLProgramBuilder::finalizeShaders() {
this->varyingHandler()->finalize();
fVS.finalize(kVertex_GrShaderFlag);
- if (this->primitiveProcessor().willUseGeoShader()) {
+ if (this->geometryProcessor().willUseGeoShader()) {
SkASSERT(this->shaderCaps()->geometryShaderSupport());
fGS.finalize(kGeometry_GrShaderFlag);
}
diff --git a/src/gpu/glsl/GrGLSLProgramBuilder.h b/src/gpu/glsl/GrGLSLProgramBuilder.h
index a7114b5..5800102 100644
--- a/src/gpu/glsl/GrGLSLProgramBuilder.h
+++ b/src/gpu/glsl/GrGLSLProgramBuilder.h
@@ -41,7 +41,7 @@
GrSurfaceOrigin origin() const { return fProgramInfo.origin(); }
const GrPipeline& pipeline() const { return fProgramInfo.pipeline(); }
- const GrPrimitiveProcessor& primitiveProcessor() const { return fProgramInfo.primProc(); }
+ const GrGeometryProcessor& geometryProcessor() const { return fProgramInfo.geomProc(); }
GrProcessor::CustomFeatures processorFeatures() const {
return fProgramInfo.requestedFeatures();
}
@@ -164,7 +164,7 @@
bool checkSamplerCounts();
#ifdef SK_DEBUG
- void verify(const GrPrimitiveProcessor&);
+ void verify(const GrGeometryProcessor&);
void verify(const GrFragmentProcessor&);
void verify(const GrXferProcessor&);
#endif
diff --git a/src/gpu/glsl/GrGLSLVarying.cpp b/src/gpu/glsl/GrGLSLVarying.cpp
index 044f86c..4670fcc 100644
--- a/src/gpu/glsl/GrGLSLVarying.cpp
+++ b/src/gpu/glsl/GrGLSLVarying.cpp
@@ -13,7 +13,7 @@
const char* output,
Interpolation interpolation) {
SkASSERT(input.isInitialized());
- SkASSERT(!fProgramBuilder->primitiveProcessor().willUseGeoShader());
+ SkASSERT(!fProgramBuilder->geometryProcessor().willUseGeoShader());
GrGLSLVarying v(input.gpuType());
this->addVarying(input.name(), &v, interpolation);
fProgramBuilder->fVS.codeAppendf("%s = %s;", v.vsOut(), input.name());
@@ -40,7 +40,7 @@
void GrGLSLVaryingHandler::addVarying(const char* name, GrGLSLVarying* varying,
Interpolation interpolation) {
SkASSERT(GrSLTypeIsFloatType(varying->type()) || Interpolation::kMustBeFlat == interpolation);
- bool willUseGeoShader = fProgramBuilder->primitiveProcessor().willUseGeoShader();
+ bool willUseGeoShader = fProgramBuilder->geometryProcessor().willUseGeoShader();
VaryingInfo& v = fVaryings.push_back();
SkASSERT(varying);
@@ -93,7 +93,7 @@
if (const char* extension = caps.noperspectiveInterpolationExtensionString()) {
int bit = 1 << GrGLSLShaderBuilder::kNoPerspectiveInterpolation_GLSLPrivateFeature;
fProgramBuilder->fVS.addFeature(bit, extension);
- if (fProgramBuilder->primitiveProcessor().willUseGeoShader()) {
+ if (fProgramBuilder->geometryProcessor().willUseGeoShader()) {
fProgramBuilder->fGS.addFeature(bit, extension);
}
fProgramBuilder->fFS.addFeature(bit, extension);
diff --git a/src/gpu/glsl/GrGLSLVarying.h b/src/gpu/glsl/GrGLSLVarying.h
index 0c2e570..10d7a6e 100644
--- a/src/gpu/glsl/GrGLSLVarying.h
+++ b/src/gpu/glsl/GrGLSLVarying.h
@@ -130,7 +130,7 @@
void addPassThroughAttribute(const GrGeometryProcessor::Attribute&, const char* output,
Interpolation = Interpolation::kInterpolated);
- void emitAttributes(const GrGeometryProcessor& gp);
+ void emitAttributes(const GrGeometryProcessor&);
// This should be called once all attributes and varyings have been added to the
// GrGLSLVaryingHanlder and before getting/adding any of the declarations to the shaders.
diff --git a/src/gpu/mock/GrMockOpsRenderPass.h b/src/gpu/mock/GrMockOpsRenderPass.h
index 7712fa6..0067caf 100644
--- a/src/gpu/mock/GrMockOpsRenderPass.h
+++ b/src/gpu/mock/GrMockOpsRenderPass.h
@@ -35,8 +35,11 @@
}
bool onBindPipeline(const GrProgramInfo&, const SkRect&) override { return true; }
void onSetScissorRect(const SkIRect&) override {}
- bool onBindTextures(const GrPrimitiveProcessor&, const GrSurfaceProxy* const primProcTextures[],
- const GrPipeline&) override { return true; }
+ bool onBindTextures(const GrGeometryProcessor&,
+ const GrSurfaceProxy* const geomProcTextures[],
+ const GrPipeline&) override {
+ return true;
+ }
void onBindBuffers(sk_sp<const GrBuffer> indexBuffer, sk_sp<const GrBuffer> instanceBuffer,
sk_sp<const GrBuffer> vertexBuffer, GrPrimitiveRestart) override {}
void onDraw(int, int) override { this->dummyDraw(); }
diff --git a/src/gpu/mtl/GrMtlOpsRenderPass.h b/src/gpu/mtl/GrMtlOpsRenderPass.h
index 63f9b18..a5ddd64 100644
--- a/src/gpu/mtl/GrMtlOpsRenderPass.h
+++ b/src/gpu/mtl/GrMtlOpsRenderPass.h
@@ -37,7 +37,8 @@
bool onBindPipeline(const GrProgramInfo&, const SkRect& drawBounds) override;
void onSetScissorRect(const SkIRect&) override;
- bool onBindTextures(const GrPrimitiveProcessor&, const GrSurfaceProxy* const primProcTextures[],
+ bool onBindTextures(const GrGeometryProcessor&,
+ const GrSurfaceProxy* const geomProcTextures[],
const GrPipeline&) override;
void onBindBuffers(sk_sp<const GrBuffer> indexBuffer, sk_sp<const GrBuffer> instanceBuffer,
sk_sp<const GrBuffer> vertexBuffer, GrPrimitiveRestart) override;
diff --git a/src/gpu/mtl/GrMtlOpsRenderPass.mm b/src/gpu/mtl/GrMtlOpsRenderPass.mm
index 0d08961..b4306be 100644
--- a/src/gpu/mtl/GrMtlOpsRenderPass.mm
+++ b/src/gpu/mtl/GrMtlOpsRenderPass.mm
@@ -83,7 +83,7 @@
}
fActivePipelineState->setData(fRenderTarget, programInfo);
- fCurrentVertexStride = programInfo.primProc().vertexStride();
+ fCurrentVertexStride = programInfo.geomProc().vertexStride();
if (!fActiveRenderCmdEncoder) {
fActiveRenderCmdEncoder =
@@ -120,12 +120,12 @@
fOrigin, scissor);
}
-bool GrMtlOpsRenderPass::onBindTextures(const GrPrimitiveProcessor& primProc,
- const GrSurfaceProxy* const primProcTextures[],
+bool GrMtlOpsRenderPass::onBindTextures(const GrGeometryProcessor& geomProc,
+ const GrSurfaceProxy* const geomProcTextures[],
const GrPipeline& pipeline) {
SkASSERT(fActivePipelineState);
SkASSERT(fActiveRenderCmdEncoder);
- fActivePipelineState->setTextures(primProc, pipeline, primProcTextures);
+ fActivePipelineState->setTextures(geomProc, pipeline, geomProcTextures);
fActivePipelineState->bindTextures(fActiveRenderCmdEncoder);
return true;
}
diff --git a/src/gpu/mtl/GrMtlPipelineState.h b/src/gpu/mtl/GrMtlPipelineState.h
index d5c1e17..70d73b8 100644
--- a/src/gpu/mtl/GrMtlPipelineState.h
+++ b/src/gpu/mtl/GrMtlPipelineState.h
@@ -47,7 +47,9 @@
void setData(const GrRenderTarget*, const GrProgramInfo&);
- void setTextures(const GrPrimitiveProcessor&, const GrPipeline&, const GrSurfaceProxy* const[]);
+ void setTextures(const GrGeometryProcessor&,
+ const GrPipeline&,
+ const GrSurfaceProxy* const geomProcTextures[]);
void bindTextures(id<MTLRenderCommandEncoder> renderCmdEncoder);
void setDrawState(id<MTLRenderCommandEncoder>,
diff --git a/src/gpu/mtl/GrMtlPipelineState.mm b/src/gpu/mtl/GrMtlPipelineState.mm
index 53b3824..3807d28 100644
--- a/src/gpu/mtl/GrMtlPipelineState.mm
+++ b/src/gpu/mtl/GrMtlPipelineState.mm
@@ -54,7 +54,7 @@
void GrMtlPipelineState::setData(const GrRenderTarget* renderTarget,
const GrProgramInfo& programInfo) {
this->setRenderTargetState(renderTarget, programInfo.origin());
- fGeometryProcessor->setData(fDataManager, programInfo.primProc());
+ fGeometryProcessor->setData(fDataManager, programInfo.geomProc());
for (int i = 0; i < programInfo.pipeline().numFragmentProcessors(); ++i) {
auto& fp = programInfo.pipeline().getFragmentProcessor(i);
@@ -82,14 +82,14 @@
fStencil = programInfo.nonGLStencilSettings();
}
-void GrMtlPipelineState::setTextures(const GrPrimitiveProcessor& primProc,
+void GrMtlPipelineState::setTextures(const GrGeometryProcessor& geomProc,
const GrPipeline& pipeline,
- const GrSurfaceProxy* const primProcTextures[]) {
+ const GrSurfaceProxy* const geomProcTextures[]) {
fSamplerBindings.reset();
- for (int i = 0; i < primProc.numTextureSamplers(); ++i) {
- SkASSERT(primProcTextures[i]->asTextureProxy());
- const auto& sampler = primProc.textureSampler(i);
- auto texture = static_cast<GrMtlTexture*>(primProcTextures[i]->peekTexture());
+ for (int i = 0; i < geomProc.numTextureSamplers(); ++i) {
+ SkASSERT(geomProcTextures[i]->asTextureProxy());
+ const auto& sampler = geomProc.textureSampler(i);
+ auto texture = static_cast<GrMtlTexture*>(geomProcTextures[i]->peekTexture());
fSamplerBindings.emplace_back(sampler.samplerState(), texture, fGpu);
}
diff --git a/src/gpu/mtl/GrMtlPipelineStateBuilder.h b/src/gpu/mtl/GrMtlPipelineStateBuilder.h
index d21d0da..9151f99 100644
--- a/src/gpu/mtl/GrMtlPipelineStateBuilder.h
+++ b/src/gpu/mtl/GrMtlPipelineStateBuilder.h
@@ -33,9 +33,8 @@
public:
/** Generates a pipeline state.
*
- * The GrMtlPipelineState implements what is specified in the GrPipeline and
- * GrPrimitiveProcessor as input. After successful generation, the builder result objects are
- * available to be used.
+ * The returned GrMtlPipelineState implements the supplied GrProgramInfo.
+ *
* @return the created pipeline if generation was successful; nullptr otherwise
*/
static GrMtlPipelineState* CreatePipelineState(
diff --git a/src/gpu/mtl/GrMtlPipelineStateBuilder.mm b/src/gpu/mtl/GrMtlPipelineStateBuilder.mm
index 77b0c8f..a07d36a 100644
--- a/src/gpu/mtl/GrMtlPipelineStateBuilder.mm
+++ b/src/gpu/mtl/GrMtlPipelineStateBuilder.mm
@@ -176,16 +176,16 @@
SK_ABORT("Unknown vertex attribute type");
}
-static MTLVertexDescriptor* create_vertex_descriptor(const GrPrimitiveProcessor& primProc,
+static MTLVertexDescriptor* create_vertex_descriptor(const GrGeometryProcessor& geomProc,
SkBinaryWriteBuffer* writer) {
uint32_t vertexBinding = 0, instanceBinding = 0;
int nextBinding = GrMtlUniformHandler::kLastUniformBinding + 1;
- if (primProc.hasVertexAttributes()) {
+ if (geomProc.hasVertexAttributes()) {
vertexBinding = nextBinding++;
}
- if (primProc.hasInstanceAttributes()) {
+ if (geomProc.hasInstanceAttributes()) {
instanceBinding = nextBinding;
}
if (writer) {
@@ -196,12 +196,12 @@
auto vertexDescriptor = [[MTLVertexDescriptor alloc] init];
int attributeIndex = 0;
- int vertexAttributeCount = primProc.numVertexAttributes();
+ int vertexAttributeCount = geomProc.numVertexAttributes();
if (writer) {
writer->writeInt(vertexAttributeCount);
}
size_t vertexAttributeOffset = 0;
- for (const auto& attribute : primProc.vertexAttributes()) {
+ for (const auto& attribute : geomProc.vertexAttributes()) {
MTLVertexAttributeDescriptor* mtlAttribute = vertexDescriptor.attributes[attributeIndex];
MTLVertexFormat format = attribute_type_to_mtlformat(attribute.cpuType());
SkASSERT(MTLVertexFormatInvalid != format);
@@ -217,7 +217,7 @@
vertexAttributeOffset += attribute.sizeAlign4();
attributeIndex++;
}
- SkASSERT(vertexAttributeOffset == primProc.vertexStride());
+ SkASSERT(vertexAttributeOffset == geomProc.vertexStride());
if (vertexAttributeCount) {
MTLVertexBufferLayoutDescriptor* vertexBufferLayout =
@@ -230,12 +230,12 @@
}
}
- int instanceAttributeCount = primProc.numInstanceAttributes();
+ int instanceAttributeCount = geomProc.numInstanceAttributes();
if (writer) {
writer->writeInt(instanceAttributeCount);
}
size_t instanceAttributeOffset = 0;
- for (const auto& attribute : primProc.instanceAttributes()) {
+ for (const auto& attribute : geomProc.instanceAttributes()) {
MTLVertexAttributeDescriptor* mtlAttribute = vertexDescriptor.attributes[attributeIndex];
MTLVertexFormat format = attribute_type_to_mtlformat(attribute.cpuType());
SkASSERT(MTLVertexFormatInvalid != format);
@@ -251,7 +251,7 @@
instanceAttributeOffset += attribute.sizeAlign4();
attributeIndex++;
}
- SkASSERT(instanceAttributeOffset == primProc.instanceStride());
+ SkASSERT(instanceAttributeOffset == geomProc.instanceStride());
if (instanceAttributeCount) {
MTLVertexBufferLayoutDescriptor* instanceBufferLayout =
@@ -479,7 +479,7 @@
TRACE_EVENT0("skia.shaders", TRACE_FUNC);
// Geometry shaders are not supported
- SkASSERT(!this->primitiveProcessor().willUseGeoShader());
+ SkASSERT(!this->geometryProcessor().willUseGeoShader());
if (precompiledLibs) {
SkASSERT(precompiledLibs->fPipelineState);
@@ -515,7 +515,7 @@
// Ordering in how we set these matters. If it changes adjust read_pipeline_data, above.
auto pipelineDescriptor = [[MTLRenderPipelineDescriptor alloc] init];
- pipelineDescriptor.vertexDescriptor = create_vertex_descriptor(programInfo.primProc(),
+ pipelineDescriptor.vertexDescriptor = create_vertex_descriptor(programInfo.geomProc(),
writer.get());
MTLPixelFormat pixelFormat = GrBackendFormatAsMTLPixelFormat(programInfo.backendFormat());
diff --git a/src/gpu/ops/GrAAConvexPathRenderer.cpp b/src/gpu/ops/GrAAConvexPathRenderer.cpp
index 3671b3e..9b02412 100644
--- a/src/gpu/ops/GrAAConvexPathRenderer.cpp
+++ b/src/gpu/ops/GrAAConvexPathRenderer.cpp
@@ -566,7 +566,7 @@
GLSLProcessor() {}
void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override {
- const QuadEdgeEffect& qe = args.fGP.cast<QuadEdgeEffect>();
+ const QuadEdgeEffect& qe = args.fGeomProc.cast<QuadEdgeEffect>();
GrGLSLVertexBuilder* vertBuilder = args.fVertBuilder;
GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
GrGLSLVaryingHandler* varyingHandler = args.fVaryingHandler;
@@ -623,8 +623,8 @@
}
void setData(const GrGLSLProgramDataManager& pdman,
- const GrPrimitiveProcessor& gp) override {
- const QuadEdgeEffect& qe = gp.cast<QuadEdgeEffect>();
+ const GrGeometryProcessor& geomProc) override {
+ const QuadEdgeEffect& qe = geomProc.cast<QuadEdgeEffect>();
this->setTransform(pdman, fLocalMatrixUniform, qe.fLocalMatrix, &fLocalMatrix);
}
@@ -777,7 +777,7 @@
}
}
- const size_t kVertexStride = fProgramInfo->primProc().vertexStride();
+ const size_t kVertexStride = fProgramInfo->geomProc().vertexStride();
fDraws.reserve(instanceCount);
@@ -859,7 +859,7 @@
}
flushState->bindPipelineAndScissorClip(*fProgramInfo, chainBounds);
- flushState->bindTextures(fProgramInfo->primProc(), nullptr, fProgramInfo->pipeline());
+ flushState->bindTextures(fProgramInfo->geomProc(), nullptr, fProgramInfo->pipeline());
for (int i = 0; i < fDraws.count(); ++i) {
for (int j = 0; j < fDraws[i].fMeshCount; ++j) {
flushState->drawMesh(fDraws[i].fMeshes[j]);
diff --git a/src/gpu/ops/GrAAHairLinePathRenderer.cpp b/src/gpu/ops/GrAAHairLinePathRenderer.cpp
index 631f20c..912a6b2 100644
--- a/src/gpu/ops/GrAAHairLinePathRenderer.cpp
+++ b/src/gpu/ops/GrAAHairLinePathRenderer.cpp
@@ -1302,7 +1302,7 @@
for (int i = 0; i < 3; ++i) {
if (fProgramInfos[i] && fMeshes[i]) {
flushState->bindPipelineAndScissorClip(*fProgramInfos[i], chainBounds);
- flushState->bindTextures(fProgramInfos[i]->primProc(), nullptr,
+ flushState->bindTextures(fProgramInfos[i]->geomProc(), nullptr,
fProgramInfos[i]->pipeline());
flushState->drawMesh(*fMeshes[i]);
}
diff --git a/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp b/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp
index adef79e..0cee751 100644
--- a/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp
+++ b/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp
@@ -260,7 +260,7 @@
}
}
- size_t vertexStride = fProgramInfo->primProc().vertexStride();
+ size_t vertexStride = fProgramInfo->geomProc().vertexStride();
int instanceCount = fPaths.count();
int64_t vertexCount = 0;
@@ -334,7 +334,7 @@
}
flushState->bindPipelineAndScissorClip(*fProgramInfo, chainBounds);
- flushState->bindTextures(fProgramInfo->primProc(), nullptr, fProgramInfo->pipeline());
+ flushState->bindTextures(fProgramInfo->geomProc(), nullptr, fProgramInfo->pipeline());
for (int i = 0; i < fMeshes.count(); ++i) {
flushState->drawMesh(*fMeshes[i]);
}
diff --git a/src/gpu/ops/GrDashOp.cpp b/src/gpu/ops/GrDashOp.cpp
index d67e1a3..fd0caa3 100644
--- a/src/gpu/ops/GrDashOp.cpp
+++ b/src/gpu/ops/GrDashOp.cpp
@@ -601,7 +601,7 @@
return;
}
- QuadHelper helper(target, fProgramInfo->primProc().vertexStride(), totalRectCount);
+ QuadHelper helper(target, fProgramInfo->geomProc().vertexStride(), totalRectCount);
GrVertexWriter vertices{ helper.vertices() };
if (!vertices.fPtr) {
return;
@@ -661,7 +661,7 @@
}
flushState->bindPipelineAndScissorClip(*fProgramInfo, chainBounds);
- flushState->bindTextures(fProgramInfo->primProc(), nullptr, fProgramInfo->pipeline());
+ flushState->bindTextures(fProgramInfo->geomProc(), nullptr, fProgramInfo->pipeline());
flushState->drawMesh(*fMesh);
}
@@ -867,7 +867,7 @@
const GrShaderCaps&,
GrProcessorKeyBuilder*);
- void setData(const GrGLSLProgramDataManager&, const GrPrimitiveProcessor&) override;
+ void setData(const GrGLSLProgramDataManager&, const GrGeometryProcessor&) override;
private:
UniformHandle fParamUniform;
@@ -892,7 +892,7 @@
}
void GLDashingCircleEffect::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) {
- const DashingCircleEffect& dce = args.fGP.cast<DashingCircleEffect>();
+ const DashingCircleEffect& dce = args.fGeomProc.cast<DashingCircleEffect>();
GrGLSLVertexBuilder* vertBuilder = args.fVertBuilder;
GrGLSLVaryingHandler* varyingHandler = args.fVaryingHandler;
GrGLSLUniformHandler* uniformHandler = args.fUniformHandler;
@@ -942,8 +942,8 @@
}
void GLDashingCircleEffect::setData(const GrGLSLProgramDataManager& pdman,
- const GrPrimitiveProcessor& processor) {
- const DashingCircleEffect& dce = processor.cast<DashingCircleEffect>();
+ const GrGeometryProcessor& geomProc) {
+ const DashingCircleEffect& dce = geomProc.cast<DashingCircleEffect>();
if (dce.color() != fColor) {
pdman.set4fv(fColorUniform, 1, dce.color().vec());
fColor = dce.color();
@@ -1079,7 +1079,7 @@
const GrShaderCaps&,
GrProcessorKeyBuilder*);
- void setData(const GrGLSLProgramDataManager&, const GrPrimitiveProcessor&) override;
+ void setData(const GrGLSLProgramDataManager&, const GrGeometryProcessor&) override;
private:
SkPMColor4f fColor;
@@ -1094,7 +1094,7 @@
GLDashingLineEffect::GLDashingLineEffect() : fColor(SK_PMColor4fILLEGAL) {}
void GLDashingLineEffect::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) {
- const DashingLineEffect& de = args.fGP.cast<DashingLineEffect>();
+ const DashingLineEffect& de = args.fGeomProc.cast<DashingLineEffect>();
GrGLSLVertexBuilder* vertBuilder = args.fVertBuilder;
GrGLSLVaryingHandler* varyingHandler = args.fVaryingHandler;
@@ -1170,8 +1170,8 @@
}
void GLDashingLineEffect::setData(const GrGLSLProgramDataManager& pdman,
- const GrPrimitiveProcessor& processor) {
- const DashingLineEffect& de = processor.cast<DashingLineEffect>();
+ const GrGeometryProcessor& geomProc) {
+ const DashingLineEffect& de = geomProc.cast<DashingLineEffect>();
if (de.color() != fColor) {
pdman.set4fv(fColorUniform, 1, de.color().vec());
fColor = de.color();
diff --git a/src/gpu/ops/GrDefaultPathRenderer.cpp b/src/gpu/ops/GrDefaultPathRenderer.cpp
index 6f4be70..e40ccc0 100644
--- a/src/gpu/ops/GrDefaultPathRenderer.cpp
+++ b/src/gpu/ops/GrDefaultPathRenderer.cpp
@@ -482,7 +482,7 @@
}
flushState->bindPipelineAndScissorClip(*fProgramInfo, chainBounds);
- flushState->bindTextures(fProgramInfo->primProc(), nullptr, fProgramInfo->pipeline());
+ flushState->bindTextures(fProgramInfo->geomProc(), nullptr, fProgramInfo->pipeline());
for (int i = 0; i < fMeshes.count(); ++i) {
flushState->drawMesh(*fMeshes[i]);
}
diff --git a/src/gpu/ops/GrDrawAtlasOp.cpp b/src/gpu/ops/GrDrawAtlasOp.cpp
index 5f59bd1..1138ca8 100644
--- a/src/gpu/ops/GrDrawAtlasOp.cpp
+++ b/src/gpu/ops/GrDrawAtlasOp.cpp
@@ -223,7 +223,7 @@
}
int instanceCount = fGeoData.count();
- size_t vertexStride = fProgramInfo->primProc().vertexStride();
+ size_t vertexStride = fProgramInfo->geomProc().vertexStride();
int numQuads = this->quadCount();
QuadHelper helper(target, vertexStride, numQuads);
@@ -251,7 +251,7 @@
}
flushState->bindPipelineAndScissorClip(*fProgramInfo, chainBounds);
- flushState->bindTextures(fProgramInfo->primProc(), nullptr, fProgramInfo->pipeline());
+ flushState->bindTextures(fProgramInfo->geomProc(), nullptr, fProgramInfo->pipeline());
flushState->drawMesh(*fMesh);
}
diff --git a/src/gpu/ops/GrDrawVerticesOp.cpp b/src/gpu/ops/GrDrawVerticesOp.cpp
index 2b42d08..3cc6514 100644
--- a/src/gpu/ops/GrDrawVerticesOp.cpp
+++ b/src/gpu/ops/GrDrawVerticesOp.cpp
@@ -141,7 +141,7 @@
, fColor(SK_PMColor4fILLEGAL) {}
void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override {
- const VerticesGP& gp = args.fGP.cast<VerticesGP>();
+ const VerticesGP& gp = args.fGeomProc.cast<VerticesGP>();
GrGLSLVertexBuilder* vertBuilder = args.fVertBuilder;
GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
GrGLSLVaryingHandler* varyingHandler = args.fVaryingHandler;
@@ -318,8 +318,8 @@
}
void setData(const GrGLSLProgramDataManager& pdman,
- const GrPrimitiveProcessor& gp) override {
- const VerticesGP& vgp = gp.cast<VerticesGP>();
+ const GrGeometryProcessor& geomProc) override {
+ const VerticesGP& vgp = geomProc.cast<VerticesGP>();
this->setTransform(pdman, fViewMatrixUniform, vgp.viewMatrix(), &fViewMatrix);
@@ -741,7 +741,7 @@
}
flushState->bindPipelineAndScissorClip(*fProgramInfo, chainBounds);
- flushState->bindTextures(fProgramInfo->primProc(), nullptr, fProgramInfo->pipeline());
+ flushState->bindTextures(fProgramInfo->geomProc(), nullptr, fProgramInfo->pipeline());
flushState->drawMesh(*fMesh);
}
diff --git a/src/gpu/ops/GrFillRRectOp.cpp b/src/gpu/ops/GrFillRRectOp.cpp
index d6a8cd8..4ad9752 100644
--- a/src/gpu/ops/GrFillRRectOp.cpp
+++ b/src/gpu/ops/GrFillRRectOp.cpp
@@ -329,7 +329,7 @@
using INHERITED = GrGeometryProcessor;
};
-constexpr GrPrimitiveProcessor::Attribute FillRRectOp::Processor::kVertexAttribs[];
+constexpr GrGeometryProcessor::Attribute FillRRectOp::Processor::kVertexAttribs[];
// Our coverage geometry consists of an inset octagon with solid coverage, surrounded by linear
// coverage ramps on the horizontal and vertical edges, and "arc coverage" pieces on the diagonal
@@ -490,7 +490,7 @@
GrGLSLVertexBuilder* v = args.fVertBuilder;
GrGLSLFPFragmentBuilder* f = args.fFragBuilder;
- const auto& proc = args.fGP.cast<Processor>();
+ const auto& proc = args.fGeomProc.cast<Processor>();
bool useHWDerivatives = (proc.fFlags & ProcessorFlags::kUseHWDerivatives);
SkASSERT(proc.vertexStride() == sizeof(CoverageVertex));
@@ -671,7 +671,7 @@
f->codeAppendf("half4 %s = half4(coverage);", args.fOutputCoverage);
}
- void setData(const GrGLSLProgramDataManager& pdman, const GrPrimitiveProcessor&) override {}
+ void setData(const GrGLSLProgramDataManager&, const GrGeometryProcessor&) override {}
};
@@ -705,7 +705,7 @@
}
flushState->bindPipelineAndScissorClip(*fProgramInfo, this->bounds());
- flushState->bindTextures(fProgramInfo->primProc(), nullptr, fProgramInfo->pipeline());
+ flushState->bindTextures(fProgramInfo->geomProc(), nullptr, fProgramInfo->pipeline());
flushState->bindBuffers(std::move(fIndexBuffer), std::move(fInstanceBuffer),
std::move(fVertexBuffer));
flushState->drawIndexedInstanced(SK_ARRAY_COUNT(kIndexData), 0, fInstanceCount, fBaseInstance,
diff --git a/src/gpu/ops/GrFillRectOp.cpp b/src/gpu/ops/GrFillRectOp.cpp
index cee66c8..57ea5ba 100644
--- a/src/gpu/ops/GrFillRectOp.cpp
+++ b/src/gpu/ops/GrFillRectOp.cpp
@@ -315,7 +315,7 @@
flushState->bindPipelineAndScissorClip(*fProgramInfo, chainBounds);
flushState->bindBuffers(std::move(fIndexBuffer), nullptr, std::move(fVertexBuffer));
- flushState->bindTextures(fProgramInfo->primProc(), nullptr, fProgramInfo->pipeline());
+ flushState->bindTextures(fProgramInfo->geomProc(), nullptr, fProgramInfo->pipeline());
GrQuadPerEdgeAA::IssueDraw(flushState->caps(), flushState->opsRenderPass(), vertexSpec, 0,
fQuads.count(), totalNumVertices, fBaseVertex);
}
diff --git a/src/gpu/ops/GrLatticeOp.cpp b/src/gpu/ops/GrLatticeOp.cpp
index 60f58a7..ab6fbb7 100644
--- a/src/gpu/ops/GrLatticeOp.cpp
+++ b/src/gpu/ops/GrLatticeOp.cpp
@@ -49,15 +49,15 @@
class GLSLProcessor : public GrGLSLGeometryProcessor {
public:
void setData(const GrGLSLProgramDataManager& pdman,
- const GrPrimitiveProcessor& proc) override {
- const auto& latticeGP = proc.cast<LatticeGP>();
+ const GrGeometryProcessor& geomProc) override {
+ const auto& latticeGP = geomProc.cast<LatticeGP>();
fColorSpaceXformHelper.setData(pdman, latticeGP.fColorSpaceXform.get());
}
private:
void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override {
using Interpolation = GrGLSLVaryingHandler::Interpolation;
- const auto& latticeGP = args.fGP.cast<LatticeGP>();
+ const auto& latticeGP = args.fGeomProc.cast<LatticeGP>();
fColorSpaceXformHelper.emitCode(args.fUniformHandler,
latticeGP.fColorSpaceXform.get());
@@ -236,7 +236,7 @@
return;
}
- const size_t kVertexStride = fProgramInfo->primProc().vertexStride();
+ const size_t kVertexStride = fProgramInfo->geomProc().vertexStride();
QuadHelper helper(target, kVertexStride, numRects);
@@ -322,7 +322,8 @@
}
flushState->bindPipelineAndScissorClip(*fProgramInfo, chainBounds);
- flushState->bindTextures(fProgramInfo->primProc(), *fView.proxy(),
+ flushState->bindTextures(fProgramInfo->geomProc(),
+ *fView.proxy(),
fProgramInfo->pipeline());
flushState->drawMesh(*fMesh);
}
diff --git a/src/gpu/ops/GrMeshDrawOp.h b/src/gpu/ops/GrMeshDrawOp.h
index 4704b46..1cef7eb 100644
--- a/src/gpu/ops/GrMeshDrawOp.h
+++ b/src/gpu/ops/GrMeshDrawOp.h
@@ -143,7 +143,7 @@
virtual ~Target() {}
/** Adds a draw of a mesh. 'primProcProxies' must have
- * GrPrimitiveProcessor::numTextureSamplers() entries. Can be null if no samplers.
+ * GrGeometryProcessor::numTextureSamplers() entries. Can be null if no samplers.
*/
virtual void recordDraw(const GrGeometryProcessor*,
const GrSimpleMesh[],
diff --git a/src/gpu/ops/GrOvalOpFactory.cpp b/src/gpu/ops/GrOvalOpFactory.cpp
index ec856bf..2d20e8c 100644
--- a/src/gpu/ops/GrOvalOpFactory.cpp
+++ b/src/gpu/ops/GrOvalOpFactory.cpp
@@ -116,7 +116,7 @@
GLSLProcessor() {}
void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override {
- const CircleGeometryProcessor& cgp = args.fGP.cast<CircleGeometryProcessor>();
+ const CircleGeometryProcessor& cgp = args.fGeomProc.cast<CircleGeometryProcessor>();
GrGLSLVertexBuilder* vertBuilder = args.fVertBuilder;
GrGLSLVaryingHandler* varyingHandler = args.fVaryingHandler;
GrGLSLUniformHandler* uniformHandler = args.fUniformHandler;
@@ -216,9 +216,9 @@
}
void setData(const GrGLSLProgramDataManager& pdman,
- const GrPrimitiveProcessor& primProc) override {
+ const GrGeometryProcessor& geomProc) override {
this->setTransform(pdman, fLocalMatrixUniform,
- primProc.cast<CircleGeometryProcessor>().fLocalMatrix,
+ geomProc.cast<CircleGeometryProcessor>().fLocalMatrix,
&fLocalMatrix);
}
@@ -300,7 +300,7 @@
void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override {
const ButtCapDashedCircleGeometryProcessor& bcscgp =
- args.fGP.cast<ButtCapDashedCircleGeometryProcessor>();
+ args.fGeomProc.cast<ButtCapDashedCircleGeometryProcessor>();
GrGLSLVertexBuilder* vertBuilder = args.fVertBuilder;
GrGLSLVaryingHandler* varyingHandler = args.fVaryingHandler;
GrGLSLUniformHandler* uniformHandler = args.fUniformHandler;
@@ -476,9 +476,9 @@
}
void setData(const GrGLSLProgramDataManager& pdman,
- const GrPrimitiveProcessor& primProc) override {
+ const GrGeometryProcessor& geomProc) override {
this->setTransform(pdman, fLocalMatrixUniform,
- primProc.cast<ButtCapDashedCircleGeometryProcessor>().fLocalMatrix,
+ geomProc.cast<ButtCapDashedCircleGeometryProcessor>().fLocalMatrix,
&fLocalMatrix);
}
@@ -562,7 +562,7 @@
GLSLProcessor() {}
void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override {
- const EllipseGeometryProcessor& egp = args.fGP.cast<EllipseGeometryProcessor>();
+ const EllipseGeometryProcessor& egp = args.fGeomProc.cast<EllipseGeometryProcessor>();
GrGLSLVertexBuilder* vertBuilder = args.fVertBuilder;
GrGLSLVaryingHandler* varyingHandler = args.fVaryingHandler;
GrGLSLUniformHandler* uniformHandler = args.fUniformHandler;
@@ -666,8 +666,8 @@
}
void setData(const GrGLSLProgramDataManager& pdman,
- const GrPrimitiveProcessor& primProc) override {
- const EllipseGeometryProcessor& egp = primProc.cast<EllipseGeometryProcessor>();
+ const GrGeometryProcessor& geomProc) override {
+ const EllipseGeometryProcessor& egp = geomProc.cast<EllipseGeometryProcessor>();
this->setTransform(pdman, fLocalMatrixUniform, egp.fLocalMatrix, &fLocalMatrix);
}
@@ -761,7 +761,7 @@
GLSLProcessor() : fViewMatrix(SkMatrix::InvalidMatrix()) {}
void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override {
- const DIEllipseGeometryProcessor& diegp = args.fGP.cast<DIEllipseGeometryProcessor>();
+ const auto& diegp = args.fGeomProc.cast<DIEllipseGeometryProcessor>();
GrGLSLVertexBuilder* vertBuilder = args.fVertBuilder;
GrGLSLVaryingHandler* varyingHandler = args.fVaryingHandler;
GrGLSLUniformHandler* uniformHandler = args.fUniformHandler;
@@ -859,8 +859,8 @@
}
void setData(const GrGLSLProgramDataManager& pdman,
- const GrPrimitiveProcessor& gp) override {
- const DIEllipseGeometryProcessor& diegp = gp.cast<DIEllipseGeometryProcessor>();
+ const GrGeometryProcessor& geomProc) override {
+ const auto& diegp = geomProc.cast<DIEllipseGeometryProcessor>();
this->setTransform(pdman, fViewMatrixUniform, diegp.fViewMatrix, &fViewMatrix);
}
@@ -1271,7 +1271,7 @@
sk_sp<const GrBuffer> vertexBuffer;
int firstVertex;
- GrVertexWriter vertices{target->makeVertexSpace(fProgramInfo->primProc().vertexStride(),
+ GrVertexWriter vertices{target->makeVertexSpace(fProgramInfo->geomProc().vertexStride(),
fVertCount, &vertexBuffer, &firstVertex)};
if (!vertices.fPtr) {
SkDebugf("Could not allocate vertices\n");
@@ -1396,7 +1396,7 @@
}
flushState->bindPipelineAndScissorClip(*fProgramInfo, chainBounds);
- flushState->bindTextures(fProgramInfo->primProc(), nullptr, fProgramInfo->pipeline());
+ flushState->bindTextures(fProgramInfo->geomProc(), nullptr, fProgramInfo->pipeline());
flushState->drawMesh(*fMesh);
}
@@ -1634,7 +1634,7 @@
sk_sp<const GrBuffer> vertexBuffer;
int firstVertex;
- GrVertexWriter vertices{target->makeVertexSpace(fProgramInfo->primProc().vertexStride(),
+ GrVertexWriter vertices{target->makeVertexSpace(fProgramInfo->geomProc().vertexStride(),
fVertCount, &vertexBuffer, &firstVertex)};
if (!vertices.fPtr) {
SkDebugf("Could not allocate vertices\n");
@@ -1718,7 +1718,7 @@
}
flushState->bindPipelineAndScissorClip(*fProgramInfo, chainBounds);
- flushState->bindTextures(fProgramInfo->primProc(), nullptr, fProgramInfo->pipeline());
+ flushState->bindTextures(fProgramInfo->geomProc(), nullptr, fProgramInfo->pipeline());
flushState->drawMesh(*fMesh);
}
@@ -1964,7 +1964,7 @@
}
}
- QuadHelper helper(target, fProgramInfo->primProc().vertexStride(), fEllipses.count());
+ QuadHelper helper(target, fProgramInfo->geomProc().vertexStride(), fEllipses.count());
GrVertexWriter verts{helper.vertices()};
if (!verts.fPtr) {
SkDebugf("Could not allocate vertices\n");
@@ -2009,7 +2009,7 @@
}
flushState->bindPipelineAndScissorClip(*fProgramInfo, chainBounds);
- flushState->bindTextures(fProgramInfo->primProc(), nullptr, fProgramInfo->pipeline());
+ flushState->bindTextures(fProgramInfo->geomProc(), nullptr, fProgramInfo->pipeline());
flushState->drawMesh(*fMesh);
}
@@ -2234,7 +2234,7 @@
this->createProgramInfo(target);
}
- QuadHelper helper(target, fProgramInfo->primProc().vertexStride(), fEllipses.count());
+ QuadHelper helper(target, fProgramInfo->geomProc().vertexStride(), fEllipses.count());
GrVertexWriter verts{helper.vertices()};
if (!verts.fPtr) {
return;
@@ -2275,7 +2275,7 @@
}
flushState->bindPipelineAndScissorClip(*fProgramInfo, chainBounds);
- flushState->bindTextures(fProgramInfo->primProc(), nullptr, fProgramInfo->pipeline());
+ flushState->bindTextures(fProgramInfo->geomProc(), nullptr, fProgramInfo->pipeline());
flushState->drawMesh(*fMesh);
}
@@ -2645,7 +2645,7 @@
sk_sp<const GrBuffer> vertexBuffer;
int firstVertex;
- GrVertexWriter verts{target->makeVertexSpace(fProgramInfo->primProc().vertexStride(),
+ GrVertexWriter verts{target->makeVertexSpace(fProgramInfo->geomProc().vertexStride(),
fVertCount, &vertexBuffer, &firstVertex)};
if (!verts.fPtr) {
SkDebugf("Could not allocate vertices\n");
@@ -2736,7 +2736,7 @@
}
flushState->bindPipelineAndScissorClip(*fProgramInfo, chainBounds);
- flushState->bindTextures(fProgramInfo->primProc(), nullptr, fProgramInfo->pipeline());
+ flushState->bindTextures(fProgramInfo->geomProc(), nullptr, fProgramInfo->pipeline());
flushState->drawMesh(*fMesh);
}
@@ -2974,7 +2974,7 @@
return;
}
PatternHelper helper(target, GrPrimitiveType::kTriangles,
- fProgramInfo->primProc().vertexStride(),
+ fProgramInfo->geomProc().vertexStride(),
std::move(indexBuffer), kVertsPerStandardRRect, indicesPerInstance,
fRRects.count(), kNumRRectsInIndexBuffer);
GrVertexWriter verts{helper.vertices()};
@@ -3056,7 +3056,7 @@
}
flushState->bindPipelineAndScissorClip(*fProgramInfo, chainBounds);
- flushState->bindTextures(fProgramInfo->primProc(), nullptr, fProgramInfo->pipeline());
+ flushState->bindTextures(fProgramInfo->geomProc(), nullptr, fProgramInfo->pipeline());
flushState->drawMesh(*fMesh);
}
diff --git a/src/gpu/ops/GrQuadPerEdgeAA.cpp b/src/gpu/ops/GrQuadPerEdgeAA.cpp
index 5d8433a..9ad2d57 100644
--- a/src/gpu/ops/GrQuadPerEdgeAA.cpp
+++ b/src/gpu/ops/GrQuadPerEdgeAA.cpp
@@ -600,8 +600,8 @@
class GLSLProcessor : public GrGLSLGeometryProcessor {
public:
void setData(const GrGLSLProgramDataManager& pdman,
- const GrPrimitiveProcessor& proc) override {
- const auto& gp = proc.cast<QuadPerEdgeAAGeometryProcessor>();
+ const GrGeometryProcessor& geomProc) override {
+ const auto& gp = geomProc.cast<QuadPerEdgeAAGeometryProcessor>();
fTextureColorSpaceXformHelper.setData(pdman, gp.fTextureColorSpaceXform.get());
}
@@ -609,7 +609,7 @@
void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override {
using Interpolation = GrGLSLVaryingHandler::Interpolation;
- const auto& gp = args.fGP.cast<QuadPerEdgeAAGeometryProcessor>();
+ const auto& gp = args.fGeomProc.cast<QuadPerEdgeAAGeometryProcessor>();
fTextureColorSpaceXformHelper.emitCode(args.fUniformHandler,
gp.fTextureColorSpaceXform.get());
diff --git a/src/gpu/ops/GrRegionOp.cpp b/src/gpu/ops/GrRegionOp.cpp
index d95979c..5401f47 100644
--- a/src/gpu/ops/GrRegionOp.cpp
+++ b/src/gpu/ops/GrRegionOp.cpp
@@ -122,7 +122,7 @@
return;
}
- QuadHelper helper(target, fProgramInfo->primProc().vertexStride(), numRects);
+ QuadHelper helper(target, fProgramInfo->geomProc().vertexStride(), numRects);
GrVertexWriter vertices{helper.vertices()};
if (!vertices.fPtr) {
@@ -149,7 +149,7 @@
}
flushState->bindPipelineAndScissorClip(*fProgramInfo, chainBounds);
- flushState->bindTextures(fProgramInfo->primProc(), nullptr, fProgramInfo->pipeline());
+ flushState->bindTextures(fProgramInfo->geomProc(), nullptr, fProgramInfo->pipeline());
flushState->drawMesh(*fMesh);
}
diff --git a/src/gpu/ops/GrShadowRRectOp.cpp b/src/gpu/ops/GrShadowRRectOp.cpp
index 7fa5bb1..e24beac 100644
--- a/src/gpu/ops/GrShadowRRectOp.cpp
+++ b/src/gpu/ops/GrShadowRRectOp.cpp
@@ -611,7 +611,7 @@
}
flushState->bindPipelineAndScissorClip(*fProgramInfo, chainBounds);
- flushState->bindTextures(fProgramInfo->primProc(), *fFalloffView.proxy(),
+ flushState->bindTextures(fProgramInfo->geomProc(), *fFalloffView.proxy(),
fProgramInfo->pipeline());
flushState->drawMesh(*fMesh);
}
diff --git a/src/gpu/ops/GrStrokeRectOp.cpp b/src/gpu/ops/GrStrokeRectOp.cpp
index e8a358c..cfad2bd 100644
--- a/src/gpu/ops/GrStrokeRectOp.cpp
+++ b/src/gpu/ops/GrStrokeRectOp.cpp
@@ -201,7 +201,7 @@
this->createProgramInfo(target);
}
- size_t kVertexStride = fProgramInfo->primProc().vertexStride();
+ size_t kVertexStride = fProgramInfo->geomProc().vertexStride();
int vertexCount = kVertsPerHairlineRect;
if (fStrokeWidth > 0) {
vertexCount = kVertsPerStrokeRect;
@@ -241,7 +241,7 @@
}
flushState->bindPipelineAndScissorClip(*fProgramInfo, chainBounds);
- flushState->bindTextures(fProgramInfo->primProc(), nullptr, fProgramInfo->pipeline());
+ flushState->bindTextures(fProgramInfo->geomProc(), nullptr, fProgramInfo->pipeline());
flushState->drawMesh(*fMesh);
}
@@ -568,7 +568,7 @@
return;
}
PatternHelper helper(target, GrPrimitiveType::kTriangles,
- fProgramInfo->primProc().vertexStride(), std::move(indexBuffer),
+ fProgramInfo->geomProc().vertexStride(), std::move(indexBuffer),
verticesPerInstance, indicesPerInstance, instanceCount, maxQuads);
GrVertexWriter vertices{ helper.vertices() };
if (!vertices.fPtr) {
@@ -598,7 +598,7 @@
}
flushState->bindPipelineAndScissorClip(*fProgramInfo, chainBounds);
- flushState->bindTextures(fProgramInfo->primProc(), nullptr, fProgramInfo->pipeline());
+ flushState->bindTextures(fProgramInfo->geomProc(), nullptr, fProgramInfo->pipeline());
flushState->drawMesh(*fMesh);
}
diff --git a/src/gpu/ops/GrTextureOp.cpp b/src/gpu/ops/GrTextureOp.cpp
index c27a8b6..98ad665 100644
--- a/src/gpu/ops/GrTextureOp.cpp
+++ b/src/gpu/ops/GrTextureOp.cpp
@@ -928,7 +928,7 @@
for (unsigned p = 0; p < op.fMetadata.fProxyCount; ++p) {
const int quadCnt = op.fViewCountPairs[p].fQuadCnt;
SkASSERT(numDraws < fDesc->fNumProxies);
- flushState->bindTextures(fDesc->fProgramInfo->primProc(),
+ flushState->bindTextures(fDesc->fProgramInfo->geomProc(),
*op.fViewCountPairs[p].fProxy,
fDesc->fProgramInfo->pipeline());
GrQuadPerEdgeAA::IssueDraw(flushState->caps(), flushState->opsRenderPass(),
diff --git a/src/gpu/ops/GrTriangulatingPathRenderer.cpp b/src/gpu/ops/GrTriangulatingPathRenderer.cpp
index f3b9ef5..54cc75b 100644
--- a/src/gpu/ops/GrTriangulatingPathRenderer.cpp
+++ b/src/gpu/ops/GrTriangulatingPathRenderer.cpp
@@ -594,7 +594,7 @@
}
flushState->bindPipelineAndScissorClip(*fProgramInfo, chainBounds);
- flushState->bindTextures(fProgramInfo->primProc(), nullptr, fProgramInfo->pipeline());
+ flushState->bindTextures(fProgramInfo->geomProc(), nullptr, fProgramInfo->pipeline());
flushState->drawMesh(*fMesh);
}
diff --git a/src/gpu/tessellate/GrDrawAtlasPathOp.cpp b/src/gpu/tessellate/GrDrawAtlasPathOp.cpp
index 56d2dfe..101fa76 100644
--- a/src/gpu/tessellate/GrDrawAtlasPathOp.cpp
+++ b/src/gpu/tessellate/GrDrawAtlasPathOp.cpp
@@ -56,7 +56,7 @@
class DrawAtlasPathShader::Impl : public GrGLSLGeometryProcessor {
void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override {
- const auto& shader = args.fGP.cast<DrawAtlasPathShader>();
+ const auto& shader = args.fGeomProc.cast<DrawAtlasPathShader>();
args.fVaryingHandler->emitAttributes(shader);
GrGLSLVarying atlasCoord(kFloat2_GrSLType);
@@ -99,8 +99,8 @@
}
void setData(const GrGLSLProgramDataManager& pdman,
- const GrPrimitiveProcessor& primProc) override {
- const SkISize& dimensions = primProc.cast<DrawAtlasPathShader>().fAtlasDimensions;
+ const GrGeometryProcessor& geomProc) override {
+ const SkISize& dimensions = geomProc.cast<DrawAtlasPathShader>().fAtlasDimensions;
pdman.set2f(fAtlasAdjustUniform, 1.f / dimensions.width(), 1.f / dimensions.height());
}
diff --git a/src/gpu/tessellate/GrFillPathShader.cpp b/src/gpu/tessellate/GrFillPathShader.cpp
index 48ed630..36d5b76 100644
--- a/src/gpu/tessellate/GrFillPathShader.cpp
+++ b/src/gpu/tessellate/GrFillPathShader.cpp
@@ -15,7 +15,7 @@
class GrFillPathShader::Impl : public GrGLSLGeometryProcessor {
public:
void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override {
- auto& shader = args.fGP.cast<GrFillPathShader>();
+ auto& shader = args.fGeomProc.cast<GrFillPathShader>();
const char* viewMatrix;
fViewMatrixUniform = args.fUniformHandler->addUniform(
@@ -38,15 +38,15 @@
}
void setData(const GrGLSLProgramDataManager& pdman,
- const GrPrimitiveProcessor& primProc) override {
- const GrFillPathShader& shader = primProc.cast<GrFillPathShader>();
+ const GrGeometryProcessor& geomProc) override {
+ const GrFillPathShader& shader = geomProc.cast<GrFillPathShader>();
pdman.setSkMatrix(fViewMatrixUniform, shader.viewMatrix());
const SkPMColor4f& color = shader.fColor;
pdman.set4f(fColorUniform, color.fR, color.fG, color.fB, color.fA);
if (fPathBoundsUniform.isValid()) {
- const SkRect& b = primProc.cast<GrFillBoundingBoxShader>().pathBounds();
+ const SkRect& b = geomProc.cast<GrFillBoundingBoxShader>().pathBounds();
pdman.set4f(fPathBoundsUniform, b.left(), b.top(), b.right(), b.bottom());
}
}
diff --git a/src/gpu/tessellate/GrPathInnerTriangulateOp.cpp b/src/gpu/tessellate/GrPathInnerTriangulateOp.cpp
index a47a3cb..6d29b0a 100644
--- a/src/gpu/tessellate/GrPathInnerTriangulateOp.cpp
+++ b/src/gpu/tessellate/GrPathInnerTriangulateOp.cpp
@@ -265,7 +265,7 @@
for (const GrProgramInfo* fanProgram : fFanPrograms) {
SkASSERT(fFanBuffer);
flushState->bindPipelineAndScissorClip(*fanProgram, this->bounds());
- flushState->bindTextures(fanProgram->primProc(), nullptr, fanProgram->pipeline());
+ flushState->bindTextures(fanProgram->geomProc(), nullptr, fanProgram->pipeline());
flushState->bindBuffers(nullptr, nullptr, fFanBuffer);
flushState->draw(fFanVertexCount, fBaseFanVertex);
}
@@ -273,7 +273,7 @@
if (fFillHullsProgram) {
SkASSERT(fTessellator);
flushState->bindPipelineAndScissorClip(*fFillHullsProgram, this->bounds());
- flushState->bindTextures(fFillHullsProgram->primProc(), nullptr, *fPipelineForFills);
+ flushState->bindTextures(fFillHullsProgram->geomProc(), nullptr, *fPipelineForFills);
fTessellator->drawHullInstances(flushState);
}
}
diff --git a/src/gpu/tessellate/GrStencilPathShader.cpp b/src/gpu/tessellate/GrStencilPathShader.cpp
index b24a8d6e..93d02da 100644
--- a/src/gpu/tessellate/GrStencilPathShader.cpp
+++ b/src/gpu/tessellate/GrStencilPathShader.cpp
@@ -66,7 +66,7 @@
class GrStencilPathShader::Impl : public GrGLSLGeometryProcessor {
protected:
void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override {
- const auto& shader = args.fGP.cast<GrStencilPathShader>();
+ const auto& shader = args.fGeomProc.cast<GrStencilPathShader>();
args.fVaryingHandler->emitAttributes(shader);
auto v = args.fVertBuilder;
@@ -94,8 +94,8 @@
}
void setData(const GrGLSLProgramDataManager& pdman,
- const GrPrimitiveProcessor& primProc) override {
- const auto& shader = primProc.cast<GrStencilPathShader>();
+ const GrGeometryProcessor& geomProc) override {
+ const auto& shader = geomProc.cast<GrStencilPathShader>();
if (!shader.viewMatrix().isIdentity()) {
pdman.setSkMatrix(fViewMatrixUniform, shader.viewMatrix());
}
@@ -348,7 +348,7 @@
class GrMiddleOutCubicShader::Impl : public GrStencilPathShader::Impl {
void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override {
- const auto& shader = args.fGP.cast<GrMiddleOutCubicShader>();
+ const auto& shader = args.fGeomProc.cast<GrMiddleOutCubicShader>();
args.fVaryingHandler->emitAttributes(shader);
args.fVertBuilder->defineConstantf("int", "kMaxVertexID", "%i", 1 << kMaxResolveLevel);
args.fVertBuilder->defineConstantf("float", "kInverseMaxVertexID",
diff --git a/src/gpu/tessellate/GrStrokeTessellateOp.cpp b/src/gpu/tessellate/GrStrokeTessellateOp.cpp
index 16db49b..3eda3f5 100644
--- a/src/gpu/tessellate/GrStrokeTessellateOp.cpp
+++ b/src/gpu/tessellate/GrStrokeTessellateOp.cpp
@@ -265,12 +265,12 @@
void GrStrokeTessellateOp::onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) {
if (fStencilProgram) {
flushState->bindPipelineAndScissorClip(*fStencilProgram, chainBounds);
- flushState->bindTextures(fStencilProgram->primProc(), nullptr, fStencilProgram->pipeline());
+ flushState->bindTextures(fStencilProgram->geomProc(), nullptr, fStencilProgram->pipeline());
fTessellator->draw(flushState);
}
if (fFillProgram) {
flushState->bindPipelineAndScissorClip(*fFillProgram, chainBounds);
- flushState->bindTextures(fFillProgram->primProc(), nullptr, fFillProgram->pipeline());
+ flushState->bindTextures(fFillProgram->geomProc(), nullptr, fFillProgram->pipeline());
fTessellator->draw(flushState);
}
}
diff --git a/src/gpu/tessellate/GrStrokeTessellateShader.cpp b/src/gpu/tessellate/GrStrokeTessellateShader.cpp
index 1d64a5e..705ef61 100644
--- a/src/gpu/tessellate/GrStrokeTessellateShader.cpp
+++ b/src/gpu/tessellate/GrStrokeTessellateShader.cpp
@@ -98,7 +98,7 @@
private:
void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override {
- const auto& shader = args.fGP.cast<GrStrokeTessellateShader>();
+ const auto& shader = args.fGeomProc.cast<GrStrokeTessellateShader>();
auto* uniHandler = args.fUniformHandler;
auto* v = args.fVertBuilder;
@@ -414,8 +414,8 @@
}
void setData(const GrGLSLProgramDataManager& pdman,
- const GrPrimitiveProcessor& primProc) override {
- const auto& shader = primProc.cast<GrStrokeTessellateShader>();
+ const GrGeometryProcessor& geomProc) override {
+ const auto& shader = geomProc.cast<GrStrokeTessellateShader>();
const auto& stroke = shader.fStroke;
if (!shader.hasDynamicStroke()) {
@@ -991,7 +991,7 @@
class GrStrokeTessellateShader::IndirectImpl : public GrGLSLGeometryProcessor {
void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override {
- const auto& shader = args.fGP.cast<GrStrokeTessellateShader>();
+ const auto& shader = args.fGeomProc.cast<GrStrokeTessellateShader>();
SkPaint::Join joinType = shader.fStroke.getJoin();
args.fVaryingHandler->emitAttributes(shader);
@@ -1249,8 +1249,8 @@
}
void setData(const GrGLSLProgramDataManager& pdman,
- const GrPrimitiveProcessor& primProc) override {
- const auto& shader = primProc.cast<GrStrokeTessellateShader>();
+ const GrGeometryProcessor& geomProc) override {
+ const auto& shader = geomProc.cast<GrStrokeTessellateShader>();
const auto& stroke = shader.fStroke;
if (!shader.hasDynamicStroke()) {
@@ -1299,7 +1299,7 @@
GrProcessorKeyBuilder* b) const {
bool keyNeedsJoin = (fMode == Mode::kIndirect) && !(fShaderFlags & ShaderFlags::kDynamicStroke);
SkASSERT(fStroke.getJoin() >> 2 == 0);
- // Attribs get worked into the key automatically during GrPrimitiveProcessor::getAttributeKey().
+ // Attribs get worked into the key automatically during GrGeometryProcessor::getAttributeKey().
// When color is in a uniform, it's always wide. kWideColor doesn't need to be considered here.
uint32_t key = (uint32_t)(fShaderFlags & ~ShaderFlags::kWideColor);
key = (key << 1) | (uint32_t)fMode;
diff --git a/src/gpu/tessellate/GrTessellatingStencilFillOp.cpp b/src/gpu/tessellate/GrTessellatingStencilFillOp.cpp
index 10ac941..71f7b5e 100644
--- a/src/gpu/tessellate/GrTessellatingStencilFillOp.cpp
+++ b/src/gpu/tessellate/GrTessellatingStencilFillOp.cpp
@@ -177,7 +177,7 @@
// Fill in the bounding box (if not in stencil-only mode).
if (fFillBBoxProgram) {
flushState->bindPipelineAndScissorClip(*fFillBBoxProgram, this->bounds());
- flushState->bindTextures(fFillBBoxProgram->primProc(), nullptr,
+ flushState->bindTextures(fFillBBoxProgram->geomProc(), nullptr,
fFillBBoxProgram->pipeline());
flushState->bindBuffers(nullptr, nullptr, nullptr);
flushState->draw(4, 0);
diff --git a/src/gpu/vk/GrVkMSAALoadManager.h b/src/gpu/vk/GrVkMSAALoadManager.h
index dc4940b..0867535 100644
--- a/src/gpu/vk/GrVkMSAALoadManager.h
+++ b/src/gpu/vk/GrVkMSAALoadManager.h
@@ -11,7 +11,6 @@
#include "include/gpu/GrTypes.h"
#include "include/gpu/vk/GrVkTypes.h"
#include "src/gpu/GrNativeRect.h"
-#include "src/gpu/GrPrimitiveProcessor.h"
#include "src/gpu/vk/GrVkDescriptorSetManager.h"
class GrSurface;
diff --git a/src/gpu/vk/GrVkOpsRenderPass.cpp b/src/gpu/vk/GrVkOpsRenderPass.cpp
index c4161df..b082527 100644
--- a/src/gpu/vk/GrVkOpsRenderPass.cpp
+++ b/src/gpu/vk/GrVkOpsRenderPass.cpp
@@ -721,13 +721,13 @@
}
#endif
-bool GrVkOpsRenderPass::onBindTextures(const GrPrimitiveProcessor& primProc,
- const GrSurfaceProxy* const primProcTextures[],
+bool GrVkOpsRenderPass::onBindTextures(const GrGeometryProcessor& geomProc,
+ const GrSurfaceProxy* const geomProcTextures[],
const GrPipeline& pipeline) {
#ifdef SK_DEBUG
SkASSERT(fCurrentPipelineState);
- for (int i = 0; i < primProc.numTextureSamplers(); ++i) {
- check_sampled_texture(primProcTextures[i]->peekTexture(), fRenderTarget, fGpu);
+ for (int i = 0; i < geomProc.numTextureSamplers(); ++i) {
+ check_sampled_texture(geomProcTextures[i]->peekTexture(), fRenderTarget, fGpu);
}
pipeline.visitTextureEffects([&](const GrTextureEffect& te) {
check_sampled_texture(te.texture(), fRenderTarget, fGpu);
@@ -736,7 +736,7 @@
check_sampled_texture(dstTexture, fRenderTarget, fGpu);
}
#endif
- if (!fCurrentPipelineState->setAndBindTextures(fGpu, primProc, pipeline, primProcTextures,
+ if (!fCurrentPipelineState->setAndBindTextures(fGpu, geomProc, pipeline, geomProcTextures,
this->currentCommandBuffer())) {
return false;
}
diff --git a/src/gpu/vk/GrVkOpsRenderPass.h b/src/gpu/vk/GrVkOpsRenderPass.h
index 7cdd1c8..6a490dd 100644
--- a/src/gpu/vk/GrVkOpsRenderPass.h
+++ b/src/gpu/vk/GrVkOpsRenderPass.h
@@ -69,7 +69,8 @@
bool onBindPipeline(const GrProgramInfo&, const SkRect& drawBounds) override;
void onSetScissorRect(const SkIRect&) override;
- bool onBindTextures(const GrPrimitiveProcessor&, const GrSurfaceProxy* const primProcTextures[],
+ bool onBindTextures(const GrGeometryProcessor&,
+ const GrSurfaceProxy* const geomProcTextures[],
const GrPipeline&) override;
void onBindBuffers(sk_sp<const GrBuffer> indexBuffer, sk_sp<const GrBuffer> instanceBuffer,
sk_sp<const GrBuffer> vertexBuffer, GrPrimitiveRestart) override;
diff --git a/src/gpu/vk/GrVkPipeline.cpp b/src/gpu/vk/GrVkPipeline.cpp
index 9a86211..930d7d9 100644
--- a/src/gpu/vk/GrVkPipeline.cpp
+++ b/src/gpu/vk/GrVkPipeline.cpp
@@ -79,8 +79,8 @@
}
static void setup_vertex_input_state(
- const GrPrimitiveProcessor::AttributeSet& vertexAttribs,
- const GrPrimitiveProcessor::AttributeSet& instanceAttribs,
+ const GrGeometryProcessor::AttributeSet& vertexAttribs,
+ const GrGeometryProcessor::AttributeSet& instanceAttribs,
VkPipelineVertexInputStateCreateInfo* vertexInputInfo,
SkSTArray<2, VkVertexInputBindingDescription, true>* bindingDescs,
VkVertexInputAttributeDescription* attributeDesc) {
@@ -505,8 +505,8 @@
}
sk_sp<GrVkPipeline> GrVkPipeline::Make(GrVkGpu* gpu,
- const GrPrimitiveProcessor::AttributeSet& vertexAttribs,
- const GrPrimitiveProcessor::AttributeSet& instanceAttribs,
+ const GrGeometryProcessor::AttributeSet& vertexAttribs,
+ const GrGeometryProcessor::AttributeSet& instanceAttribs,
GrPrimitiveType primitiveType,
GrSurfaceOrigin origin,
const GrStencilSettings& stencilSettings,
@@ -636,12 +636,12 @@
VkPipelineLayout layout,
VkPipelineCache cache,
uint32_t subpass) {
- const GrPrimitiveProcessor& primProc = programInfo.primProc();
+ const GrGeometryProcessor& geomProc = programInfo.geomProc();
const GrPipeline& pipeline = programInfo.pipeline();
return Make(gpu,
- primProc.vertexAttributes(),
- primProc.instanceAttributes(),
+ geomProc.vertexAttributes(),
+ geomProc.instanceAttributes(),
programInfo.primitiveType(),
programInfo.origin(),
programInfo.nonGLStencilSettings(),
diff --git a/src/gpu/vk/GrVkPipeline.h b/src/gpu/vk/GrVkPipeline.h
index b39d084..2f57ea5 100644
--- a/src/gpu/vk/GrVkPipeline.h
+++ b/src/gpu/vk/GrVkPipeline.h
@@ -10,7 +10,7 @@
#include "include/gpu/vk/GrVkTypes.h"
#include "include/private/GrTypesPriv.h"
-#include "src/gpu/GrPrimitiveProcessor.h"
+#include "src/gpu/GrGeometryProcessor.h"
#include "src/gpu/GrXferProcessor.h"
#include "src/gpu/vk/GrVkManagedResource.h"
@@ -27,8 +27,8 @@
class GrVkPipeline : public GrVkManagedResource {
public:
static sk_sp<GrVkPipeline> Make(GrVkGpu*,
- const GrPrimitiveProcessor::AttributeSet& vertexAttribs,
- const GrPrimitiveProcessor::AttributeSet& instanceAttribs,
+ const GrGeometryProcessor::AttributeSet& vertexAttribs,
+ const GrGeometryProcessor::AttributeSet& instanceAttribs,
GrPrimitiveType,
GrSurfaceOrigin,
const GrStencilSettings&,
diff --git a/src/gpu/vk/GrVkPipelineState.cpp b/src/gpu/vk/GrVkPipelineState.cpp
index 9493141..5cd1428 100644
--- a/src/gpu/vk/GrVkPipelineState.cpp
+++ b/src/gpu/vk/GrVkPipelineState.cpp
@@ -78,7 +78,7 @@
GrVkCommandBuffer* commandBuffer) {
this->setRenderTargetState(renderTarget, programInfo.origin());
- fGeometryProcessor->setData(fDataManager, programInfo.primProc());
+ fGeometryProcessor->setData(fDataManager, programInfo.geomProc());
for (int i = 0; i < programInfo.pipeline().numFragmentProcessors(); ++i) {
auto& fp = programInfo.pipeline().getFragmentProcessor(i);
for (auto [fp, impl] : GrGLSLFragmentProcessor::ParallelRange(fp, *fFPImpls[i])) {
@@ -112,11 +112,11 @@
}
bool GrVkPipelineState::setAndBindTextures(GrVkGpu* gpu,
- const GrPrimitiveProcessor& primProc,
+ const GrGeometryProcessor& geomProc,
const GrPipeline& pipeline,
- const GrSurfaceProxy* const primProcTextures[],
+ const GrSurfaceProxy* const geomProcTextures[],
GrVkCommandBuffer* commandBuffer) {
- SkASSERT(primProcTextures || !primProc.numTextureSamplers());
+ SkASSERT(geomProcTextures || !geomProc.numTextureSamplers());
if (fNumSamplers) {
struct SamplerBindings {
GrSamplerState fState;
@@ -125,10 +125,10 @@
SkAutoSTMalloc<8, SamplerBindings> samplerBindings(fNumSamplers);
int currTextureBinding = 0;
- for (int i = 0; i < primProc.numTextureSamplers(); ++i) {
- SkASSERT(primProcTextures[i]->asTextureProxy());
- const auto& sampler = primProc.textureSampler(i);
- auto texture = static_cast<GrVkTexture*>(primProcTextures[i]->peekTexture());
+ for (int i = 0; i < geomProc.numTextureSamplers(); ++i) {
+ SkASSERT(geomProcTextures[i]->asTextureProxy());
+ const auto& sampler = geomProc.textureSampler(i);
+ auto texture = static_cast<GrVkTexture*>(geomProcTextures[i]->peekTexture());
samplerBindings[currTextureBinding++] = {sampler.samplerState(), texture};
}
diff --git a/src/gpu/vk/GrVkPipelineState.h b/src/gpu/vk/GrVkPipelineState.h
index 5cf42b2..e6c474a 100644
--- a/src/gpu/vk/GrVkPipelineState.h
+++ b/src/gpu/vk/GrVkPipelineState.h
@@ -59,8 +59,10 @@
* This must be called after setAndBindUniforms() since that function invalidates texture
* bindings.
*/
- bool setAndBindTextures(GrVkGpu*, const GrPrimitiveProcessor&, const GrPipeline&,
- const GrSurfaceProxy* const primitiveProcessorTextures[],
+ bool setAndBindTextures(GrVkGpu*,
+ const GrGeometryProcessor&,
+ const GrPipeline&,
+ const GrSurfaceProxy* const geomProcTextures[],
GrVkCommandBuffer*);
bool setAndBindInputAttachment(GrVkGpu*, GrVkRenderTarget* renderTarget, GrVkCommandBuffer*);
diff --git a/src/gpu/vk/GrVkPipelineStateBuilder.cpp b/src/gpu/vk/GrVkPipelineStateBuilder.cpp
index ba00b61..c951dc8 100644
--- a/src/gpu/vk/GrVkPipelineStateBuilder.cpp
+++ b/src/gpu/vk/GrVkPipelineStateBuilder.cpp
@@ -277,7 +277,7 @@
&shaders[kFragment_GrShaderType],
&inputs[kFragment_GrShaderType]);
- if (this->primitiveProcessor().willUseGeoShader()) {
+ if (this->geometryProcessor().willUseGeoShader()) {
success = success && this->createVkShaderModule(VK_SHADER_STAGE_GEOMETRY_BIT,
*sksl[kGeometry_GrShaderType],
&shaderModules[kGeometry_GrShaderType],
diff --git a/src/gpu/vk/GrVkPipelineStateBuilder.h b/src/gpu/vk/GrVkPipelineStateBuilder.h
index 09a2a09..6ab3d98 100644
--- a/src/gpu/vk/GrVkPipelineStateBuilder.h
+++ b/src/gpu/vk/GrVkPipelineStateBuilder.h
@@ -25,8 +25,8 @@
public:
/** Generates a pipeline state.
*
- * The GrVkPipelineState implements what is specified in the GrPipeline and GrPrimitiveProcessor
- * as input. After successful generation, the builder result objects are available to be used.
+ * The return GrVkPipelineState implements the supplied GrProgramInfo.
+ *
* @return the created pipeline if generation was successful; nullptr otherwise
*/
static GrVkPipelineState* CreatePipelineState(GrVkGpu*,
diff --git a/src/gpu/vk/GrVkResourceProvider.cpp b/src/gpu/vk/GrVkResourceProvider.cpp
index e8916fb..682ff76 100644
--- a/src/gpu/vk/GrVkResourceProvider.cpp
+++ b/src/gpu/vk/GrVkResourceProvider.cpp
@@ -293,8 +293,8 @@
if (!pipeline) {
pipeline = GrVkPipeline::Make(
fGpu,
- /*vertexAttribs=*/GrPrimitiveProcessor::AttributeSet(),
- /*instanceAttribs=*/GrPrimitiveProcessor::AttributeSet(),
+ /*vertexAttribs=*/GrGeometryProcessor::AttributeSet(),
+ /*instanceAttribs=*/GrGeometryProcessor::AttributeSet(),
GrPrimitiveType::kTriangleStrip,
kTopLeft_GrSurfaceOrigin,
GrStencilSettings(),