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

Unified Diff: src/gpu/glsl/GrGLSLGeometryProcessor.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/GrGLSLFragmentProcessor.cpp ('k') | src/gpu/glsl/GrGLSLGeometryProcessor.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/glsl/GrGLSLGeometryProcessor.h
diff --git a/src/gpu/glsl/GrGLSLGeometryProcessor.h b/src/gpu/glsl/GrGLSLGeometryProcessor.h
index 6777620a880eed87d730fce8b0720f57c2a00d87..d1e715f78a7846c65935be341e6a3374a3a80f06 100644
--- a/src/gpu/glsl/GrGLSLGeometryProcessor.h
+++ b/src/gpu/glsl/GrGLSLGeometryProcessor.h
@@ -22,11 +22,31 @@
/* Any general emit code goes in the base class emitCode. Subclasses override onEmitCode */
void emitCode(EmitArgs&) override;
+ // By default we use the identity matrix
+ void setTransformData(const GrPrimitiveProcessor&,
+ const GrGLSLProgramDataManager& pdman,
+ int index,
+ const SkTArray<const GrCoordTransform*, true>& transforms) override {
+ this->setTransformDataHelper(SkMatrix::I(), pdman, index, transforms);
+ }
+
protected:
// A helper which subclasses can use if needed and used above in the default setTransformData().
void setTransformDataHelper(const SkMatrix& localMatrix,
const GrGLSLProgramDataManager& pdman,
- FPCoordTransformIter*);
+ int index,
+ const SkTArray<const GrCoordTransform*, true>& transforms) {
+ SkTArray<TransformUniform, true>& procTransforms = fInstalledTransforms[index];
+ int numTransforms = transforms.count();
+ for (int t = 0; t < numTransforms; ++t) {
+ SkASSERT(procTransforms[t].fHandle.isValid());
+ const SkMatrix& transform = GetTransformMatrix(localMatrix, *transforms[t]);
+ if (!procTransforms[t].fCurrentValue.cheapEqualTo(transform)) {
+ pdman.setSkMatrix(procTransforms[t].fHandle.toIndex(), transform);
+ procTransforms[t].fCurrentValue = transform;
+ }
+ }
+ }
// Emit a uniform matrix for each coord transform.
void emitTransforms(GrGLSLVertexBuilder* vb,
@@ -34,9 +54,10 @@
GrGLSLUniformHandler* uniformHandler,
const GrShaderVar& posVar,
const char* localCoords,
- FPCoordTransformHandler* handler) {
+ const TransformsIn& tin,
+ TransformsOut* tout) {
this->emitTransforms(vb, varyingHandler, uniformHandler,
- posVar, localCoords, SkMatrix::I(), handler);
+ posVar, localCoords, SkMatrix::I(), tin, tout);
}
// Emit pre-transformed coords as a vertex attribute per coord-transform.
@@ -46,7 +67,8 @@
const GrShaderVar& posVar,
const char* localCoords,
const SkMatrix& localMatrix,
- FPCoordTransformHandler*);
+ const TransformsIn&,
+ TransformsOut*);
struct GrGPArgs {
// The variable used by a GP to store its position. It can be
@@ -81,7 +103,7 @@
SkMatrix fCurrentValue = SkMatrix::InvalidMatrix();
};
- SkTArray<TransformUniform, true> fInstalledTransforms;
+ SkSTArray<8, SkSTArray<2, TransformUniform, true> > fInstalledTransforms;
typedef GrGLSLPrimitiveProcessor INHERITED;
};
« no previous file with comments | « src/gpu/glsl/GrGLSLFragmentProcessor.cpp ('k') | src/gpu/glsl/GrGLSLGeometryProcessor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698