Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(146)

Unified Diff: src/gpu/glsl/GrGLSLPrimitiveProcessor.h

Issue 2351753002: Revert of Stop flattening GrCoordTransforms in parent GrFragmentProcessors. (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/glsl/GrGLSLGeometryProcessor.cpp ('k') | src/gpu/glsl/GrGLSLPrimitiveProcessor.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/glsl/GrGLSLPrimitiveProcessor.h
diff --git a/src/gpu/glsl/GrGLSLPrimitiveProcessor.h b/src/gpu/glsl/GrGLSLPrimitiveProcessor.h
index d270fa18fe37789e9c79feb01c3df08dcd860485..6f3381f996936df1eea5e4fd9da1701a24918184 100644
--- a/src/gpu/glsl/GrGLSLPrimitiveProcessor.h
+++ b/src/gpu/glsl/GrGLSLPrimitiveProcessor.h
@@ -8,7 +8,6 @@
#ifndef GrGLSLPrimitiveProcessor_DEFINED
#define GrGLSLPrimitiveProcessor_DEFINED
-#include "GrFragmentProcessor.h"
#include "GrPrimitiveProcessor.h"
#include "glsl/GrGLSLProgramDataManager.h"
#include "glsl/GrGLSLSampler.h"
@@ -24,45 +23,14 @@
class GrGLSLPrimitiveProcessor {
public:
- using FPCoordTransformIter = GrFragmentProcessor::CoordTransformIter;
-
virtual ~GrGLSLPrimitiveProcessor() {}
typedef GrGLSLProgramDataManager::UniformHandle UniformHandle;
typedef GrGLSLProgramDataManager::UniformHandle SamplerHandle;
- /**
- * This class provides access to the GrCoordTransforms across all GrFragmentProcessors in a
- * GrPipeline. It is also used by the primitive processor to specify the fragment shader
- * variable that will hold the transformed coords for each GrCoordTransform. It is required that
- * the primitive processor iterate over each coord transform and insert a shader var result for
- * each. The GrGLSLFragmentProcessors will reference these variables in their fragment code.
- */
- class FPCoordTransformHandler : public SkNoncopyable {
- public:
- FPCoordTransformHandler(const GrPipeline& pipeline,
- SkTArray<GrShaderVar>* transformedCoordVars)
- : fIter(pipeline)
- , fTransformedCoordVars(transformedCoordVars) {}
-
- ~FPCoordTransformHandler() { SkASSERT(!this->nextCoordTransform());}
-
- const GrCoordTransform* nextCoordTransform();
-
- // 'args' are constructor params to GrShaderVar.
- template<typename... Args>
- void specifyCoordsForCurrCoordTransform(Args&&... args) {
- SkASSERT(!fAddedCoord);
- fTransformedCoordVars->emplace_back(std::forward<Args>(args)...);
- SkDEBUGCODE(fAddedCoord = true;)
- }
-
- private:
- GrFragmentProcessor::CoordTransformIter fIter;
- SkDEBUGCODE(bool fAddedCoord = false;)
- SkDEBUGCODE(const GrCoordTransform* fCurr = nullptr;)
- SkTArray<GrShaderVar>* fTransformedCoordVars;
- };
+ typedef SkSTArray<2, const GrCoordTransform*, true> ProcCoords;
+ typedef SkSTArray<8, ProcCoords> TransformsIn;
+ typedef SkSTArray<8, SkTArray<GrShaderVar>> TransformsOut;
struct EmitArgs {
EmitArgs(GrGLSLVertexBuilder* vertBuilder,
@@ -76,7 +44,8 @@
const char* distanceVectorName,
const SamplerHandle* texSamplers,
const SamplerHandle* bufferSamplers,
- FPCoordTransformHandler* transformHandler)
+ const TransformsIn& transformsIn,
+ TransformsOut* transformsOut)
: fVertBuilder(vertBuilder)
, fFragBuilder(fragBuilder)
, fVaryingHandler(varyingHandler)
@@ -88,7 +57,8 @@
, fDistanceVectorName(distanceVectorName)
, fTexSamplers(texSamplers)
, fBufferSamplers(bufferSamplers)
- , fFPCoordTransformHandler(transformHandler) {}
+ , fTransformsIn(transformsIn)
+ , fTransformsOut(transformsOut) {}
GrGLSLVertexBuilder* fVertBuilder;
GrGLSLPPFragmentBuilder* fFragBuilder;
GrGLSLVaryingHandler* fVaryingHandler;
@@ -100,7 +70,8 @@
const char* fDistanceVectorName;
const SamplerHandle* fTexSamplers;
const SamplerHandle* fBufferSamplers;
- FPCoordTransformHandler* fFPCoordTransformHandler;
+ const TransformsIn& fTransformsIn;
+ TransformsOut* fTransformsOut;
};
/**
@@ -109,21 +80,20 @@
*/
virtual void emitCode(EmitArgs&) = 0;
- /**
- * 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
- * GrGLSLPrimitiveProcessor.
- * The subclass may use the transform iterator to perform any setup required for the particular
- * set of fp transform matrices, such as uploading via uniforms. The iterator will iterate over
- * the transforms in the same order as the TransformHandler passed to emitCode.
- */
- virtual void setData(const GrGLSLProgramDataManager&, const GrPrimitiveProcessor&,
- FPCoordTransformIter&&) = 0;
+ /** 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 that created this
+ GrGLSLPrimitiveProcessor and to have an identical processor key as the one that created this
+ GrGLSLPrimitiveProcessor. */
+ virtual void setData(const GrGLSLProgramDataManager&, const GrPrimitiveProcessor&) = 0;
static SkMatrix GetTransformMatrix(const SkMatrix& localMatrix, const GrCoordTransform&);
+
+ virtual void setTransformData(const GrPrimitiveProcessor&,
+ const GrGLSLProgramDataManager& pdman,
+ int index,
+ const SkTArray<const GrCoordTransform*, true>& transforms) = 0;
protected:
void setupUniformColor(GrGLSLPPFragmentBuilder* fragBuilder,
« no previous file with comments | « src/gpu/glsl/GrGLSLGeometryProcessor.cpp ('k') | src/gpu/glsl/GrGLSLPrimitiveProcessor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698