Rename GrTextureAccess to GrProcessor::TextureSampler.
Renames vars and methods that used the work "access" to refer to this type.
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4931
Change-Id: Ibcf488fbd445c5119fc13d190544cd98981bdbee
Reviewed-on: https://skia-review.googlesource.com/4931
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
diff --git a/experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp b/experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp
index 130e116..3acb74d 100644
--- a/experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp
+++ b/experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp
@@ -683,25 +683,25 @@
: fType(type)
, fNumOctaves(numOctaves)
, fStitchTiles(stitchTiles)
- , fPermutationsAccess(permutationsTexture)
- , fNoiseAccess(noiseTexture)
+ , fPermutationsSampler(permutationsTexture)
+ , fNoiseSampler(noiseTexture)
, fPaintingData(paintingData) {
this->initClassID<GrPerlinNoise2Effect>();
- this->addTextureAccess(&fPermutationsAccess);
- this->addTextureAccess(&fNoiseAccess);
+ this->addTextureSampler(&fPermutationsSampler);
+ this->addTextureSampler(&fNoiseSampler);
fCoordTransform.reset(matrix);
this->addCoordTransform(&fCoordTransform);
}
GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
- SkPerlinNoiseShader2::Type fType;
- GrCoordTransform fCoordTransform;
- int fNumOctaves;
- bool fStitchTiles;
- GrTextureAccess fPermutationsAccess;
- GrTextureAccess fNoiseAccess;
- SkPerlinNoiseShader2::PaintingData *fPaintingData;
+ SkPerlinNoiseShader2::Type fType;
+ GrCoordTransform fCoordTransform;
+ int fNumOctaves;
+ bool fStitchTiles;
+ TextureSampler fPermutationsSampler;
+ TextureSampler fNoiseSampler;
+ SkPerlinNoiseShader2::PaintingData* fPaintingData;
private:
typedef GrFragmentProcessor INHERITED;
@@ -1093,24 +1093,24 @@
const SkMatrix& matrix)
: fOctaves(octaves)
, fZ(z)
- , fPermutationsAccess(permutationsTexture)
- , fGradientAccess(gradientTexture)
+ , fPermutationsSampler(permutationsTexture)
+ , fGradientSampler(gradientTexture)
, fPaintingData(paintingData) {
this->initClassID<GrImprovedPerlinNoiseEffect>();
- this->addTextureAccess(&fPermutationsAccess);
- this->addTextureAccess(&fGradientAccess);
+ this->addTextureSampler(&fPermutationsSampler);
+ this->addTextureSampler(&fGradientSampler);
fCoordTransform.reset(matrix);
this->addCoordTransform(&fCoordTransform);
}
GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
- GrCoordTransform fCoordTransform;
- int fOctaves;
- SkScalar fZ;
- GrTextureAccess fPermutationsAccess;
- GrTextureAccess fGradientAccess;
- SkPerlinNoiseShader2::PaintingData *fPaintingData;
+ GrCoordTransform fCoordTransform;
+ int fOctaves;
+ SkScalar fZ;
+ TextureSampler fPermutationsSampler;
+ TextureSampler fGradientSampler;
+ SkPerlinNoiseShader2::PaintingData* fPaintingData;
private:
typedef GrFragmentProcessor INHERITED;
diff --git a/gn/gpu.gni b/gn/gpu.gni
index cc72f4b..6a52384 100644
--- a/gn/gpu.gni
+++ b/gn/gpu.gni
@@ -35,7 +35,6 @@
"$_include/gpu/GrTexture.h",
"$_include/gpu/GrTextureParams.h",
"$_include/gpu/GrTextureProvider.h",
- "$_include/gpu/GrTextureAccess.h",
"$_include/gpu/GrTestUtils.h",
"$_include/gpu/GrTypes.h",
"$_include/gpu/GrTypesPriv.h",
@@ -204,7 +203,6 @@
"$_src/gpu/GrTextureRenderTargetProxy.cpp",
"$_src/gpu/GrTextureToYUVPlanes.cpp",
"$_src/gpu/GrTextureToYUVPlanes.h",
- "$_src/gpu/GrTextureAccess.cpp",
"$_src/gpu/GrTRecorder.h",
"$_src/gpu/GrUserStencilSettings.h",
"$_src/gpu/GrWindowRectangles.h",
diff --git a/include/gpu/GrFragmentProcessor.h b/include/gpu/GrFragmentProcessor.h
index 28b9e0b..30e92f6 100644
--- a/include/gpu/GrFragmentProcessor.h
+++ b/include/gpu/GrFragmentProcessor.h
@@ -183,10 +183,10 @@
&GrFragmentProcessor::numCoordTransforms,
&GrFragmentProcessor::coordTransform>;
- using TextureAccessIter = FPItemIter<GrTextureAccess,
+ using TextureAccessIter = FPItemIter<TextureSampler,
GrProcessor,
- &GrProcessor::numTextures,
- &GrProcessor::textureAccess>;
+ &GrProcessor::numTextureSamplers,
+ &GrProcessor::textureSampler>;
protected:
/**
diff --git a/include/gpu/GrProcessor.h b/include/gpu/GrProcessor.h
index 7c9662e..3d56bd1 100644
--- a/include/gpu/GrProcessor.h
+++ b/include/gpu/GrProcessor.h
@@ -11,7 +11,6 @@
#include "GrColor.h"
#include "GrProcessorUnitTest.h"
#include "GrProgramElement.h"
-#include "GrTextureAccess.h"
#include "GrBufferAccess.h"
#include "SkMath.h"
#include "SkString.h"
@@ -59,6 +58,8 @@
*/
class GrProcessor : public GrProgramElement {
public:
+ class TextureSampler;
+
virtual ~GrProcessor();
/** Human-meaningful string to identify this prcoessor; may be embedded
@@ -72,14 +73,11 @@
return str;
}
- int numTextures() const { return fTextureAccesses.count(); }
+ int numTextureSamplers() const { return fTextureSamplers.count(); }
/** Returns the access pattern for the texture at index. index must be valid according to
- numTextures(). */
- const GrTextureAccess& textureAccess(int index) const { return *fTextureAccesses[index]; }
-
- /** Shortcut for textureAccess(index).texture(); */
- GrTexture* texture(int index) const { return this->textureAccess(index).getTexture(); }
+ numTextureSamplers(). */
+ const TextureSampler& textureSampler(int index) const { return *fTextureSamplers[index]; }
int numBuffers() const { return fBufferAccesses.count(); }
@@ -125,11 +123,11 @@
/**
* Subclasses call these from their constructor to register sampler sources. The processor
* subclass manages the lifetime of the objects (these functions only store pointers). The
- * GrTextureAccess and/or GrBufferAccess instances are typically member fields of the
+ * TextureSampler and/or GrBufferAccess instances are typically member fields of the
* GrProcessor subclass. These must only be called from the constructor because GrProcessors
* are immutable.
*/
- void addTextureAccess(const GrTextureAccess* textureAccess);
+ void addTextureSampler(const TextureSampler*);
void addBufferAccess(const GrBufferAccess* bufferAccess);
bool hasSameSamplers(const GrProcessor&) const;
@@ -171,12 +169,66 @@
static int32_t gCurrProcessorClassID;
RequiredFeatures fRequiredFeatures;
- SkSTArray<4, const GrTextureAccess*, true> fTextureAccesses;
- SkSTArray<2, const GrBufferAccess*, true> fBufferAccesses;
+ SkSTArray<4, const TextureSampler*, true> fTextureSamplers;
+ SkSTArray<2, const GrBufferAccess*, true> fBufferAccesses;
typedef GrProgramElement INHERITED;
};
GR_MAKE_BITFIELD_OPS(GrProcessor::RequiredFeatures);
+/**
+ * Used to represent a texture that is required by a GrProcessor. It holds a GrTexture along with
+ * an associated GrTextureParams
+ */
+class GrProcessor::TextureSampler : public SkNoncopyable {
+public:
+ /**
+ * Must be initialized before adding to a GrProcessor's texture access list.
+ */
+ TextureSampler();
+
+ TextureSampler(GrTexture*, const GrTextureParams&);
+
+ explicit TextureSampler(GrTexture*,
+ GrTextureParams::FilterMode = GrTextureParams::kNone_FilterMode,
+ SkShader::TileMode tileXAndY = SkShader::kClamp_TileMode,
+ GrShaderFlags visibility = kFragment_GrShaderFlag);
+
+ void reset(GrTexture*, const GrTextureParams&,
+ GrShaderFlags visibility = kFragment_GrShaderFlag);
+ void reset(GrTexture*,
+ GrTextureParams::FilterMode = GrTextureParams::kNone_FilterMode,
+ SkShader::TileMode tileXAndY = SkShader::kClamp_TileMode,
+ GrShaderFlags visibility = kFragment_GrShaderFlag);
+
+ bool operator==(const TextureSampler& that) const {
+ return this->getTexture() == that.getTexture() &&
+ fParams == that.fParams &&
+ fVisibility == that.fVisibility;
+ }
+
+ bool operator!=(const TextureSampler& other) const { return !(*this == other); }
+
+ GrTexture* getTexture() const { return fTexture.get(); }
+ GrShaderFlags getVisibility() const { return fVisibility; }
+
+ /**
+ * For internal use by GrProcessor.
+ */
+ const GrGpuResourceRef* getProgramTexture() const { return &fTexture; }
+
+ const GrTextureParams& getParams() const { return fParams; }
+
+private:
+
+ typedef GrTGpuResourceRef<GrTexture> ProgramTexture;
+
+ ProgramTexture fTexture;
+ GrTextureParams fParams;
+ GrShaderFlags fVisibility;
+
+ typedef SkNoncopyable INHERITED;
+};
+
#endif
diff --git a/include/gpu/GrProcessorUnitTest.h b/include/gpu/GrProcessorUnitTest.h
index 3e9fe5e..d398aae 100644
--- a/include/gpu/GrProcessorUnitTest.h
+++ b/include/gpu/GrProcessorUnitTest.h
@@ -36,7 +36,7 @@
/*
* GrProcessorTestData is an argument struct to TestCreate functions
* fTextures are valid textures that can optionally be used to construct
- * GrTextureAccesses. The first texture has config kSkia8888_GrPixelConfig and the second has
+ * TextureSampler. The first texture has config kSkia8888_GrPixelConfig and the second has
* kAlpha_8_GrPixelConfig. TestCreate functions are also free to create additional textures using
* the GrContext.
*/
diff --git a/include/gpu/GrTextureAccess.h b/include/gpu/GrTextureAccess.h
deleted file mode 100644
index 1b5de0c..0000000
--- a/include/gpu/GrTextureAccess.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright 2012 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef GrTextureAccess_DEFINED
-#define GrTextureAccess_DEFINED
-
-#include "GrGpuResourceRef.h"
-#include "GrTexture.h"
-#include "GrTextureParams.h"
-#include "SkRefCnt.h"
-#include "SkShader.h"
-
-/**
- * Used to represent a texture that is required by a GrProcessor. It holds a GrTexture along with
- * an associated GrTextureParams
- */
-class GrTextureAccess : public SkNoncopyable {
-public:
- /**
- * Must be initialized before adding to a GrProcessor's texture access list.
- */
- GrTextureAccess();
-
- GrTextureAccess(GrTexture*, const GrTextureParams&);
-
- explicit GrTextureAccess(GrTexture*,
- GrTextureParams::FilterMode = GrTextureParams::kNone_FilterMode,
- SkShader::TileMode tileXAndY = SkShader::kClamp_TileMode,
- GrShaderFlags visibility = kFragment_GrShaderFlag);
-
- void reset(GrTexture*, const GrTextureParams&,
- GrShaderFlags visibility = kFragment_GrShaderFlag);
- void reset(GrTexture*,
- GrTextureParams::FilterMode = GrTextureParams::kNone_FilterMode,
- SkShader::TileMode tileXAndY = SkShader::kClamp_TileMode,
- GrShaderFlags visibility = kFragment_GrShaderFlag);
-
- bool operator==(const GrTextureAccess& that) const {
- return this->getTexture() == that.getTexture() &&
- fParams == that.fParams &&
- fVisibility == that.fVisibility;
- }
-
- bool operator!=(const GrTextureAccess& other) const { return !(*this == other); }
-
- GrTexture* getTexture() const { return fTexture.get(); }
- GrShaderFlags getVisibility() const { return fVisibility; }
-
- /**
- * For internal use by GrProcessor.
- */
- const GrGpuResourceRef* getProgramTexture() const { return &fTexture; }
-
- const GrTextureParams& getParams() const { return fParams; }
-
-private:
-
- typedef GrTGpuResourceRef<GrTexture> ProgramTexture;
-
- ProgramTexture fTexture;
- GrTextureParams fParams;
- GrShaderFlags fVisibility;
-
- typedef SkNoncopyable INHERITED;
-};
-
-#endif
diff --git a/include/gpu/GrXferProcessor.h b/include/gpu/GrXferProcessor.h
index 5317c18..3bc9edd 100644
--- a/include/gpu/GrXferProcessor.h
+++ b/include/gpu/GrXferProcessor.h
@@ -277,7 +277,7 @@
bool fWillReadDstColor;
bool fDstReadUsesMixedSamples;
SkIPoint fDstTextureOffset;
- GrTextureAccess fDstTexture;
+ TextureSampler fDstTexture;
typedef GrFragmentProcessor INHERITED;
};
diff --git a/include/gpu/SkGr.h b/include/gpu/SkGr.h
index fae0c76..ffad5cf 100644
--- a/include/gpu/SkGr.h
+++ b/include/gpu/SkGr.h
@@ -9,7 +9,7 @@
#define SkGr_DEFINED
#include "GrColor.h"
-#include "GrTextureAccess.h"
+#include "GrTextureParams.h"
#include "SkColor.h"
#include "SkColorPriv.h"
#include "SkFilterQuality.h"
@@ -19,7 +19,6 @@
class GrColorSpaceXform;
class GrContext;
class GrTexture;
-class GrTextureParams;
class SkBitmap;
////////////////////////////////////////////////////////////////////////////////
diff --git a/src/core/SkLightingShader.cpp b/src/core/SkLightingShader.cpp
index 16b0ddd..51549f5 100644
--- a/src/core/SkLightingShader.cpp
+++ b/src/core/SkLightingShader.cpp
@@ -105,7 +105,6 @@
#include "GrCoordTransform.h"
#include "GrFragmentProcessor.h"
#include "GrInvariantOutput.h"
-#include "GrTextureAccess.h"
#include "glsl/GrGLSLFragmentProcessor.h"
#include "glsl/GrGLSLFragmentShaderBuilder.h"
#include "glsl/GrGLSLProgramDataManager.h"
diff --git a/src/core/SkShadowShader.cpp b/src/core/SkShadowShader.cpp
index 8737b32..9757298 100644
--- a/src/core/SkShadowShader.cpp
+++ b/src/core/SkShadowShader.cpp
@@ -140,8 +140,8 @@
fTexture[fNumNonAmbLights] = sk_sp<GrTexture>(shadowMap->asTextureRef(context,
GrTextureParams::ClampNoFilter(),
SkDestinationSurfaceColorMode::kLegacy));
- fDepthMapAccess[fNumNonAmbLights].reset(fTexture[fNumNonAmbLights].get());
- this->addTextureAccess(&fDepthMapAccess[fNumNonAmbLights]);
+ fDepthMapSampler[fNumNonAmbLights].reset(fTexture[fNumNonAmbLights].get());
+ this->addTextureSampler(&fDepthMapSampler[fNumNonAmbLights]);
fDepthMapHeight[fNumNonAmbLights] = shadowMap->height();
fDepthMapWidth[fNumNonAmbLights] = shadowMap->width();
@@ -628,7 +628,7 @@
bool fIsRadialLight[SkShadowShader::kMaxNonAmbientLights];
SkVector3 fLightDirOrPos[SkShadowShader::kMaxNonAmbientLights];
SkColor3f fLightColor[SkShadowShader::kMaxNonAmbientLights];
- GrTextureAccess fDepthMapAccess[SkShadowShader::kMaxNonAmbientLights];
+ TextureSampler fDepthMapSampler[SkShadowShader::kMaxNonAmbientLights];
sk_sp<GrTexture> fTexture[SkShadowShader::kMaxNonAmbientLights];
int fDepthMapWidth[SkShadowShader::kMaxNonAmbientLights];
diff --git a/src/effects/GrAlphaThresholdFragmentProcessor.cpp b/src/effects/GrAlphaThresholdFragmentProcessor.cpp
index 442acd0..9a131f8 100644
--- a/src/effects/GrAlphaThresholdFragmentProcessor.cpp
+++ b/src/effects/GrAlphaThresholdFragmentProcessor.cpp
@@ -10,7 +10,6 @@
#if SK_SUPPORT_GPU
#include "GrInvariantOutput.h"
-#include "GrTextureAccess.h"
#include "SkRefCnt.h"
#include "glsl/GrGLSLColorSpaceXformHelper.h"
@@ -49,17 +48,17 @@
, fOuterThreshold(outerThreshold)
, fImageCoordTransform(GrCoordTransform::MakeDivByTextureWHMatrix(texture), texture,
GrTextureParams::kNone_FilterMode)
- , fImageTextureAccess(texture)
+ , fImageTextureSampler(texture)
, fColorSpaceXform(std::move(colorSpaceXform))
, fMaskCoordTransform(make_div_and_translate_matrix(maskTexture, -bounds.x(), -bounds.y()),
maskTexture,
GrTextureParams::kNone_FilterMode)
- , fMaskTextureAccess(maskTexture) {
+ , fMaskTextureSampler(maskTexture) {
this->initClassID<GrAlphaThresholdFragmentProcessor>();
this->addCoordTransform(&fImageCoordTransform);
- this->addTextureAccess(&fImageTextureAccess);
+ this->addTextureSampler(&fImageTextureSampler);
this->addCoordTransform(&fMaskCoordTransform);
- this->addTextureAccess(&fMaskTextureAccess);
+ this->addTextureSampler(&fMaskTextureSampler);
}
bool GrAlphaThresholdFragmentProcessor::onIsEqual(const GrFragmentProcessor& sBase) const {
@@ -69,9 +68,10 @@
}
void GrAlphaThresholdFragmentProcessor::onComputeInvariantOutput(GrInvariantOutput* inout) const {
- if (GrPixelConfigIsAlphaOnly(this->texture(0)->config())) {
+ GrPixelConfig config = this->textureSampler(0).getTexture()->config();
+ if (GrPixelConfigIsAlphaOnly(config)) {
inout->mulByUnknownSingleComponent();
- } else if (GrPixelConfigIsOpaque(this->texture(0)->config()) && fOuterThreshold >= 1.f) {
+ } else if (GrPixelConfigIsOpaque(config) && fOuterThreshold >= 1.f) {
inout->mulByUnknownOpaqueFourComponents();
} else {
inout->mulByUnknownFourComponents();
diff --git a/src/effects/GrAlphaThresholdFragmentProcessor.h b/src/effects/GrAlphaThresholdFragmentProcessor.h
index c5b8d4e..9805a22 100644
--- a/src/effects/GrAlphaThresholdFragmentProcessor.h
+++ b/src/effects/GrAlphaThresholdFragmentProcessor.h
@@ -55,11 +55,11 @@
float fInnerThreshold;
float fOuterThreshold;
GrCoordTransform fImageCoordTransform;
- GrTextureAccess fImageTextureAccess;
+ TextureSampler fImageTextureSampler;
// Color space transform is for the image (not the mask)
sk_sp<GrColorSpaceXform> fColorSpaceXform;
GrCoordTransform fMaskCoordTransform;
- GrTextureAccess fMaskTextureAccess;
+ TextureSampler fMaskTextureSampler;
typedef GrFragmentProcessor INHERITED;
};
diff --git a/src/effects/GrCircleBlurFragmentProcessor.cpp b/src/effects/GrCircleBlurFragmentProcessor.cpp
index d5ed6b7..b8b2660 100644
--- a/src/effects/GrCircleBlurFragmentProcessor.cpp
+++ b/src/effects/GrCircleBlurFragmentProcessor.cpp
@@ -92,9 +92,9 @@
: fCircle(circle)
, fSolidRadius(solidRadius)
, fTextureRadius(textureRadius)
- , fBlurProfileAccess(blurProfile, GrTextureParams::kBilerp_FilterMode) {
+ , fBlurProfileSampler(blurProfile, GrTextureParams::kBilerp_FilterMode) {
this->initClassID<GrCircleBlurFragmentProcessor>();
- this->addTextureAccess(&fBlurProfileAccess);
+ this->addTextureSampler(&fBlurProfileSampler);
this->setWillReadFragmentPosition();
}
diff --git a/src/effects/GrCircleBlurFragmentProcessor.h b/src/effects/GrCircleBlurFragmentProcessor.h
index 6607288..73e5d04 100644
--- a/src/effects/GrCircleBlurFragmentProcessor.h
+++ b/src/effects/GrCircleBlurFragmentProcessor.h
@@ -64,7 +64,7 @@
SkRect fCircle;
SkScalar fSolidRadius;
float fTextureRadius;
- GrTextureAccess fBlurProfileAccess;
+ TextureSampler fBlurProfileSampler;
GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
diff --git a/src/effects/SkArithmeticMode_gpu.h b/src/effects/SkArithmeticMode_gpu.h
index 4704399..28351fc 100644
--- a/src/effects/SkArithmeticMode_gpu.h
+++ b/src/effects/SkArithmeticMode_gpu.h
@@ -15,7 +15,6 @@
#include "GrCaps.h"
#include "GrCoordTransform.h"
#include "GrFragmentProcessor.h"
-#include "GrTextureAccess.h"
#include "GrTypes.h"
#include "GrXferProcessor.h"
diff --git a/src/effects/SkBlurMaskFilter.cpp b/src/effects/SkBlurMaskFilter.cpp
index 0a98fa8..84cb201 100644
--- a/src/effects/SkBlurMaskFilter.cpp
+++ b/src/effects/SkBlurMaskFilter.cpp
@@ -825,7 +825,7 @@
SkRect fRect;
float fSigma;
- GrTextureAccess fBlurProfileAccess;
+ TextureSampler fBlurProfileSampler;
GrSLPrecision fPrecision;
GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
@@ -975,10 +975,10 @@
GrSLPrecision precision)
: fRect(rect)
, fSigma(sigma)
- , fBlurProfileAccess(blurProfile)
+ , fBlurProfileSampler(blurProfile)
, fPrecision(precision) {
this->initClassID<GrRectBlurEffect>();
- this->addTextureAccess(&fBlurProfileAccess);
+ this->addTextureSampler(&fBlurProfileSampler);
this->setWillReadFragmentPosition();
}
@@ -1093,7 +1093,7 @@
SkRRect fRRect;
float fSigma;
- GrTextureAccess fNinePatchAccess;
+ TextureSampler fNinePatchSampler;
GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
@@ -1205,9 +1205,9 @@
GrRRectBlurEffect::GrRRectBlurEffect(float sigma, const SkRRect& rrect, GrTexture *ninePatchTexture)
: fRRect(rrect),
fSigma(sigma),
- fNinePatchAccess(ninePatchTexture) {
+ fNinePatchSampler(ninePatchTexture) {
this->initClassID<GrRRectBlurEffect>();
- this->addTextureAccess(&fNinePatchAccess);
+ this->addTextureSampler(&fNinePatchSampler);
this->setWillReadFragmentPosition();
}
diff --git a/src/effects/SkColorCubeFilter.cpp b/src/effects/SkColorCubeFilter.cpp
index 2c8ab6f..2499155 100644
--- a/src/effects/SkColorCubeFilter.cpp
+++ b/src/effects/SkColorCubeFilter.cpp
@@ -170,7 +170,7 @@
const char* name() const override { return "ColorCube"; }
- int colorCubeSize() const { return fColorCubeAccess.getTexture()->width(); }
+ int colorCubeSize() const { return fColorCubeSampler.getTexture()->width(); }
void onComputeInvariantOutput(GrInvariantOutput*) const override;
@@ -201,7 +201,7 @@
GrColorCubeEffect(GrTexture* colorCube);
- GrTextureAccess fColorCubeAccess;
+ TextureSampler fColorCubeSampler;
typedef GrFragmentProcessor INHERITED;
};
@@ -209,9 +209,9 @@
///////////////////////////////////////////////////////////////////////////////
GrColorCubeEffect::GrColorCubeEffect(GrTexture* colorCube)
- : fColorCubeAccess(colorCube, GrTextureParams::kBilerp_FilterMode) {
+ : fColorCubeSampler(colorCube, GrTextureParams::kBilerp_FilterMode) {
this->initClassID<GrColorCubeEffect>();
- this->addTextureAccess(&fColorCubeAccess);
+ this->addTextureSampler(&fColorCubeSampler);
}
GrColorCubeEffect::~GrColorCubeEffect() {
diff --git a/src/effects/SkDisplacementMapEffect.cpp b/src/effects/SkDisplacementMapEffect.cpp
index 8cb610e..b1f46cd 100644
--- a/src/effects/SkDisplacementMapEffect.cpp
+++ b/src/effects/SkDisplacementMapEffect.cpp
@@ -259,10 +259,10 @@
GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
GrCoordTransform fDisplacementTransform;
- GrTextureAccess fDisplacementAccess;
+ TextureSampler fDisplacementSampler;
GrCoordTransform fColorTransform;
GrTextureDomain fDomain;
- GrTextureAccess fColorAccess;
+ TextureSampler fColorSampler;
SkDisplacementMapEffect::ChannelSelectorType fXChannelSelector;
SkDisplacementMapEffect::ChannelSelectorType fYChannelSelector;
SkVector fScale;
@@ -486,19 +486,19 @@
GrTexture* color,
const SkISize& colorDimensions)
: fDisplacementTransform(offsetMatrix, displacement, GrTextureParams::kNone_FilterMode)
- , fDisplacementAccess(displacement)
+ , fDisplacementSampler(displacement)
, fColorTransform(color, GrTextureParams::kNone_FilterMode)
, fDomain(GrTextureDomain::MakeTexelDomain(color, SkIRect::MakeSize(colorDimensions)),
GrTextureDomain::kDecal_Mode)
- , fColorAccess(color)
+ , fColorSampler(color)
, fXChannelSelector(xChannelSelector)
, fYChannelSelector(yChannelSelector)
, fScale(scale) {
this->initClassID<GrDisplacementMapEffect>();
this->addCoordTransform(&fDisplacementTransform);
- this->addTextureAccess(&fDisplacementAccess);
+ this->addTextureSampler(&fDisplacementSampler);
this->addCoordTransform(&fColorTransform);
- this->addTextureAccess(&fColorAccess);
+ this->addTextureSampler(&fColorSampler);
}
GrDisplacementMapEffect::~GrDisplacementMapEffect() {
@@ -625,7 +625,7 @@
void GrGLDisplacementMapEffect::onSetData(const GrGLSLProgramDataManager& pdman,
const GrProcessor& proc) {
const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMapEffect>();
- GrTexture* colorTex = displacementMap.texture(1);
+ GrTexture* colorTex = displacementMap.textureSampler(1).getTexture();
SkScalar scaleX = displacementMap.scale().fX / colorTex->width();
SkScalar scaleY = displacementMap.scale().fY / colorTex->height();
pdman.set2f(fScaleUni, SkScalarToFloat(scaleX),
diff --git a/src/effects/SkLightingImageFilter.cpp b/src/effects/SkLightingImageFilter.cpp
index da6210c..154ebc6 100644
--- a/src/effects/SkLightingImageFilter.cpp
+++ b/src/effects/SkLightingImageFilter.cpp
@@ -1900,7 +1900,7 @@
fLight = lighting.light()->createGLLight();
}
- GrTexture* texture = lighting.texture(0);
+ GrTexture* texture = lighting.textureSampler(0).getTexture();
float ySign = texture->origin() == kTopLeft_GrSurfaceOrigin ? -1.0f : 1.0f;
pdman.set2f(fImageIncrementUni, 1.0f / texture->width(), ySign / texture->height());
pdman.set1f(fSurfaceScaleUni, lighting.surfaceScale());
diff --git a/src/effects/SkMorphologyImageFilter.cpp b/src/effects/SkMorphologyImageFilter.cpp
index cd35d65..6e581cc 100644
--- a/src/effects/SkMorphologyImageFilter.cpp
+++ b/src/effects/SkMorphologyImageFilter.cpp
@@ -294,7 +294,7 @@
void GrGLMorphologyEffect::onSetData(const GrGLSLProgramDataManager& pdman,
const GrProcessor& proc) {
const GrMorphologyEffect& m = proc.cast<GrMorphologyEffect>();
- GrTexture& texture = *m.texture(0);
+ GrTexture& texture = *m.textureSampler(0).getTexture();
float pixelSize = 0.0f;
switch (m.direction()) {
diff --git a/src/effects/SkPerlinNoiseShader.cpp b/src/effects/SkPerlinNoiseShader.cpp
index 0b34d16..dc28e44 100644
--- a/src/effects/SkPerlinNoiseShader.cpp
+++ b/src/effects/SkPerlinNoiseShader.cpp
@@ -548,12 +548,12 @@
: fType(type)
, fNumOctaves(numOctaves)
, fStitchTiles(stitchTiles)
- , fPermutationsAccess(permutationsTexture)
- , fNoiseAccess(noiseTexture)
+ , fPermutationsSampler(permutationsTexture)
+ , fNoiseSampler(noiseTexture)
, fPaintingData(paintingData) {
this->initClassID<GrPerlinNoiseEffect>();
- this->addTextureAccess(&fPermutationsAccess);
- this->addTextureAccess(&fNoiseAccess);
+ this->addTextureSampler(&fPermutationsSampler);
+ this->addTextureSampler(&fNoiseSampler);
fCoordTransform.reset(matrix);
this->addCoordTransform(&fCoordTransform);
}
@@ -564,8 +564,8 @@
GrCoordTransform fCoordTransform;
int fNumOctaves;
bool fStitchTiles;
- GrTextureAccess fPermutationsAccess;
- GrTextureAccess fNoiseAccess;
+ TextureSampler fPermutationsSampler;
+ TextureSampler fNoiseSampler;
SkPerlinNoiseShader::PaintingData *fPaintingData;
private:
diff --git a/src/effects/SkTableColorFilter.cpp b/src/effects/SkTableColorFilter.cpp
index cd786df..90a7856 100644
--- a/src/effects/SkTableColorFilter.cpp
+++ b/src/effects/SkTableColorFilter.cpp
@@ -365,7 +365,7 @@
GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
- GrTextureAccess fTextureAccess;
+ TextureSampler fTextureSampler;
// currently not used in shader code, just to assist onComputeInvariantOutput().
unsigned fFlags;
@@ -485,12 +485,12 @@
ColorTableEffect::ColorTableEffect(GrTexture* texture, GrTextureStripAtlas* atlas, int row,
unsigned flags)
- : fTextureAccess(texture)
+ : fTextureSampler(texture)
, fFlags(flags)
, fAtlas(atlas)
, fRow(row) {
this->initClassID<ColorTableEffect>();
- this->addTextureAccess(&fTextureAccess);
+ this->addTextureSampler(&fTextureSampler);
}
ColorTableEffect::~ColorTableEffect() {
diff --git a/src/effects/gradients/SkGradientShader.cpp b/src/effects/gradients/SkGradientShader.cpp
index 3bf569c..fcd0bd3 100644
--- a/src/effects/gradients/SkGradientShader.cpp
+++ b/src/effects/gradients/SkGradientShader.cpp
@@ -1659,7 +1659,7 @@
if (-1 != fRow) {
fYCoord = fAtlas->getYOffset(fRow)+SK_ScalarHalf*fAtlas->getNormalizedTexelHeight();
fCoordTransform.reset(*args.fMatrix, fAtlas->getTexture(), params.filterMode());
- fTextureAccess.reset(fAtlas->getTexture(), params);
+ fTextureSampler.reset(fAtlas->getTexture(), params);
} else {
sk_sp<GrTexture> texture(GrRefCachedBitmapTexture(
args.fContext, bitmap, params,
@@ -1668,11 +1668,11 @@
return;
}
fCoordTransform.reset(*args.fMatrix, texture.get(), params.filterMode());
- fTextureAccess.reset(texture.get(), params);
+ fTextureSampler.reset(texture.get(), params);
fYCoord = SK_ScalarHalf;
}
- this->addTextureAccess(&fTextureAccess);
+ this->addTextureSampler(&fTextureSampler);
break;
}
diff --git a/src/effects/gradients/SkGradientShaderPriv.h b/src/effects/gradients/SkGradientShaderPriv.h
index 2e447ca..120832f 100644
--- a/src/effects/gradients/SkGradientShaderPriv.h
+++ b/src/effects/gradients/SkGradientShaderPriv.h
@@ -439,7 +439,7 @@
SkShader::TileMode fTileMode;
GrCoordTransform fCoordTransform;
- GrTextureAccess fTextureAccess;
+ TextureSampler fTextureSampler;
SkScalar fYCoord;
GrTextureStripAtlas* fAtlas;
int fRow;
diff --git a/src/gpu/GrPipeline.cpp b/src/gpu/GrPipeline.cpp
index 875c50e..872a7f5 100644
--- a/src/gpu/GrPipeline.cpp
+++ b/src/gpu/GrPipeline.cpp
@@ -176,9 +176,9 @@
static void add_dependencies_for_processor(const GrFragmentProcessor* proc, GrRenderTarget* rt) {
GrFragmentProcessor::TextureAccessIter iter(proc);
- while (const GrTextureAccess* access = iter.next()) {
+ while (const GrProcessor::TextureSampler* sampler = iter.next()) {
SkASSERT(rt->getLastOpList());
- rt->getLastOpList()->addDependency(access->getTexture());
+ rt->getLastOpList()->addDependency(sampler->getTexture());
}
}
@@ -189,8 +189,8 @@
const GrXferProcessor& xfer = this->getXferProcessor();
- for (int i = 0; i < xfer.numTextures(); ++i) {
- GrTexture* texture = xfer.textureAccess(i).getTexture();
+ for (int i = 0; i < xfer.numTextureSamplers(); ++i) {
+ GrTexture* texture = xfer.textureSampler(i).getTexture();
SkASSERT(rt->getLastOpList());
rt->getLastOpList()->addDependency(texture);
}
diff --git a/src/gpu/GrProcessor.cpp b/src/gpu/GrProcessor.cpp
index 7d7ce9b..f2b4998 100644
--- a/src/gpu/GrProcessor.cpp
+++ b/src/gpu/GrProcessor.cpp
@@ -10,6 +10,8 @@
#include "GrGeometryProcessor.h"
#include "GrInvariantOutput.h"
#include "GrMemoryPool.h"
+#include "GrTextureParams.h"
+#include "GrTexturePriv.h"
#include "GrXferProcessor.h"
#include "SkSpinlock.h"
@@ -113,8 +115,8 @@
GrProcessor::~GrProcessor() {}
-void GrProcessor::addTextureAccess(const GrTextureAccess* access) {
- fTextureAccesses.push_back(access);
+void GrProcessor::addTextureSampler(const TextureSampler* access) {
+ fTextureSamplers.push_back(access);
this->addGpuResource(access->getProgramTexture());
}
@@ -132,11 +134,12 @@
}
bool GrProcessor::hasSameSamplers(const GrProcessor& that) const {
- if (this->numTextures() != that.numTextures() || this->numBuffers() != that.numBuffers()) {
+ if (this->numTextureSamplers() != that.numTextureSamplers() ||
+ this->numBuffers() != that.numBuffers()) {
return false;
}
- for (int i = 0; i < this->numTextures(); ++i) {
- if (this->textureAccess(i) != that.textureAccess(i)) {
+ for (int i = 0; i < this->numTextureSamplers(); ++i) {
+ if (this->textureSampler(i) != that.textureSampler(i)) {
return false;
}
}
@@ -150,6 +153,42 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
+GrProcessor::TextureSampler::TextureSampler() {}
+
+GrProcessor::TextureSampler::TextureSampler(GrTexture* texture, const GrTextureParams& params) {
+ this->reset(texture, params);
+}
+
+GrProcessor::TextureSampler::TextureSampler(GrTexture* texture,
+ GrTextureParams::FilterMode filterMode,
+ SkShader::TileMode tileXAndY,
+ GrShaderFlags visibility) {
+ this->reset(texture, filterMode, tileXAndY, visibility);
+}
+
+void GrProcessor::TextureSampler::reset(GrTexture* texture,
+ const GrTextureParams& params,
+ GrShaderFlags visibility) {
+ SkASSERT(texture);
+ fTexture.set(SkRef(texture), kRead_GrIOType);
+ fParams = params;
+ fParams.setFilterMode(SkTMin(params.filterMode(), texture->texturePriv().highestFilterMode()));
+ fVisibility = visibility;
+}
+
+void GrProcessor::TextureSampler::reset(GrTexture* texture,
+ GrTextureParams::FilterMode filterMode,
+ SkShader::TileMode tileXAndY,
+ GrShaderFlags visibility) {
+ SkASSERT(texture);
+ fTexture.set(SkRef(texture), kRead_GrIOType);
+ filterMode = SkTMin(filterMode, texture->texturePriv().highestFilterMode());
+ fParams.reset(tileXAndY, filterMode);
+ fVisibility = visibility;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
// Initial static variable from GrXPFactory
int32_t GrXPFactory::gCurrXPFClassID =
GrXPFactory::kIllegalXPFClassID;
diff --git a/src/gpu/GrProgramDesc.cpp b/src/gpu/GrProgramDesc.cpp
index ea2a528..d9afbac 100644
--- a/src/gpu/GrProgramDesc.cpp
+++ b/src/gpu/GrProgramDesc.cpp
@@ -34,8 +34,8 @@
static void add_sampler_keys(GrProcessorKeyBuilder* b, const GrProcessor& proc,
const GrGLSLCaps& caps) {
- int numTextures = proc.numTextures();
- int numSamplers = numTextures + proc.numBuffers();
+ int numTextureSamplers = proc.numTextureSamplers();
+ int numSamplers = numTextureSamplers + proc.numBuffers();
// Need two bytes per key (swizzle, sampler type, and precision).
int word32Count = (numSamplers + 1) / 2;
if (0 == word32Count) {
@@ -43,14 +43,14 @@
}
uint16_t* k16 = SkTCast<uint16_t*>(b->add32n(word32Count));
int i = 0;
- for (; i < numTextures; ++i) {
- const GrTextureAccess& access = proc.textureAccess(i);
- const GrTexture* tex = access.getTexture();
+ for (; i < numTextureSamplers; ++i) {
+ const GrProcessor::TextureSampler& textureSampler = proc.textureSampler(i);
+ const GrTexture* tex = textureSampler.getTexture();
k16[i] = sampler_key(tex->texturePriv().samplerType(), tex->config(),
- access.getVisibility(), caps);
+ textureSampler.getVisibility(), caps);
}
for (; i < numSamplers; ++i) {
- const GrBufferAccess& access = proc.bufferAccess(i - numTextures);
+ const GrBufferAccess& access = proc.bufferAccess(i - numTextureSamplers);
k16[i] = sampler_key(kBufferSampler_GrSLType, access.texelConfig(),
access.visibility(), caps);
}
diff --git a/src/gpu/GrTextureAccess.cpp b/src/gpu/GrTextureAccess.cpp
deleted file mode 100644
index bddbd5a..0000000
--- a/src/gpu/GrTextureAccess.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright 2012 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "GrTextureAccess.h"
-#include "GrColor.h"
-#include "GrTexture.h"
-#include "GrTexturePriv.h"
-
-GrTextureAccess::GrTextureAccess() {}
-
-GrTextureAccess::GrTextureAccess(GrTexture* texture, const GrTextureParams& params) {
- this->reset(texture, params);
-}
-
-GrTextureAccess::GrTextureAccess(GrTexture* texture,
- GrTextureParams::FilterMode filterMode,
- SkShader::TileMode tileXAndY,
- GrShaderFlags visibility) {
- this->reset(texture, filterMode, tileXAndY, visibility);
-}
-
-void GrTextureAccess::reset(GrTexture* texture,
- const GrTextureParams& params,
- GrShaderFlags visibility) {
- SkASSERT(texture);
- fTexture.set(SkRef(texture), kRead_GrIOType);
- fParams = params;
- fParams.setFilterMode(SkTMin(params.filterMode(), texture->texturePriv().highestFilterMode()));
- fVisibility = visibility;
-}
-
-void GrTextureAccess::reset(GrTexture* texture,
- GrTextureParams::FilterMode filterMode,
- SkShader::TileMode tileXAndY,
- GrShaderFlags visibility) {
- SkASSERT(texture);
- fTexture.set(SkRef(texture), kRead_GrIOType);
- filterMode = SkTMin(filterMode, texture->texturePriv().highestFilterMode());
- fParams.reset(tileXAndY, filterMode);
- fVisibility = visibility;
-}
diff --git a/src/gpu/GrTexturePriv.h b/src/gpu/GrTexturePriv.h
index e8721bc..8d6057e 100644
--- a/src/gpu/GrTexturePriv.h
+++ b/src/gpu/GrTexturePriv.h
@@ -51,7 +51,7 @@
GrSLType samplerType() const { return fTexture->fSamplerType; }
- /** The filter used is clamped to this value in GrTextureAccess. */
+ /** The filter used is clamped to this value in GrProcessor::TextureSampler. */
GrTextureParams::FilterMode highestFilterMode() const { return fTexture->fHighestFilterMode; }
void setMipColorMode(SkDestinationSurfaceColorMode colorMode) const {
diff --git a/src/gpu/GrXferProcessor.cpp b/src/gpu/GrXferProcessor.cpp
index 76e0ba0..2769c18 100644
--- a/src/gpu/GrXferProcessor.cpp
+++ b/src/gpu/GrXferProcessor.cpp
@@ -26,7 +26,7 @@
SkASSERT(willReadDstColor);
fDstTexture.reset(dstTexture->texture());
fDstTextureOffset = dstTexture->offset();
- this->addTextureAccess(&fDstTexture);
+ this->addTextureSampler(&fDstTexture);
this->setWillReadFragmentPosition();
}
}
diff --git a/src/gpu/effects/GrBicubicEffect.cpp b/src/gpu/effects/GrBicubicEffect.cpp
index 737625f..17a492f 100644
--- a/src/gpu/effects/GrBicubicEffect.cpp
+++ b/src/gpu/effects/GrBicubicEffect.cpp
@@ -126,13 +126,13 @@
void GrGLBicubicEffect::onSetData(const GrGLSLProgramDataManager& pdman,
const GrProcessor& processor) {
const GrBicubicEffect& bicubicEffect = processor.cast<GrBicubicEffect>();
- const GrTexture& texture = *processor.texture(0);
+ GrTexture* texture = processor.textureSampler(0).getTexture();
float imageIncrement[2];
- imageIncrement[0] = 1.0f / texture.width();
- imageIncrement[1] = 1.0f / texture.height();
+ imageIncrement[0] = 1.0f / texture->width();
+ imageIncrement[1] = 1.0f / texture->height();
pdman.set2fv(fImageIncrementUni, 1, imageIncrement);
pdman.setMatrix4f(fCoefficientsUni, bicubicEffect.coefficients());
- fDomain.setData(pdman, bicubicEffect.domain(), texture.origin());
+ fDomain.setData(pdman, bicubicEffect.domain(), texture->origin());
if (SkToBool(bicubicEffect.colorSpaceXform())) {
pdman.setSkMatrix44(fColorSpaceXformUni, bicubicEffect.colorSpaceXform()->srcToDst());
}
diff --git a/src/gpu/effects/GrBitmapTextGeoProc.cpp b/src/gpu/effects/GrBitmapTextGeoProc.cpp
index 197ac73..889a085 100644
--- a/src/gpu/effects/GrBitmapTextGeoProc.cpp
+++ b/src/gpu/effects/GrBitmapTextGeoProc.cpp
@@ -30,8 +30,8 @@
varyingHandler->emitAttributes(cte);
// compute numbers to be hardcoded to convert texture coordinates from int to float
- SkASSERT(cte.numTextures() == 1);
- SkDEBUGCODE(GrTexture* atlas = cte.textureAccess(0).getTexture());
+ SkASSERT(cte.numTextureSamplers() == 1);
+ SkDEBUGCODE(GrTexture* atlas = cte.textureSampler(0).getTexture());
SkASSERT(atlas && SkIsPow2(atlas->width()) && SkIsPow2(atlas->height()));
GrGLSLVertToFrag v(kVec2f_GrSLType);
@@ -108,8 +108,8 @@
b->add32(key);
// Currently we hardcode numbers to convert atlas coordinates to normalized floating point
- SkASSERT(gp.numTextures() == 1);
- GrTexture* atlas = gp.textureAccess(0).getTexture();
+ SkASSERT(gp.numTextureSamplers() == 1);
+ GrTexture* atlas = gp.textureSampler(0).getTexture();
SkASSERT(atlas);
b->add32(atlas->width());
b->add32(atlas->height());
@@ -130,7 +130,7 @@
: fColor(color)
, fLocalMatrix(localMatrix)
, fUsesLocalCoords(usesLocalCoords)
- , fTextureAccess(texture, params)
+ , fTextureSampler(texture, params)
, fInColor(nullptr)
, fMaskFormat(format) {
this->initClassID<GrBitmapTextGeoProc>();
@@ -143,7 +143,7 @@
}
fInTextureCoords = &this->addVertexAttrib("inTextureCoords", kVec2us_GrVertexAttribType,
kHigh_GrSLPrecision);
- this->addTextureAccess(&fTextureAccess);
+ this->addTextureSampler(&fTextureSampler);
}
void GrBitmapTextGeoProc::getGLSLProcessorKey(const GrGLSLCaps& caps,
diff --git a/src/gpu/effects/GrBitmapTextGeoProc.h b/src/gpu/effects/GrBitmapTextGeoProc.h
index 226ae77..7e2df0a 100644
--- a/src/gpu/effects/GrBitmapTextGeoProc.h
+++ b/src/gpu/effects/GrBitmapTextGeoProc.h
@@ -53,7 +53,7 @@
GrColor fColor;
SkMatrix fLocalMatrix;
bool fUsesLocalCoords;
- GrTextureAccess fTextureAccess;
+ TextureSampler fTextureSampler;
const Attribute* fInPosition;
const Attribute* fInColor;
const Attribute* fInTextureCoords;
diff --git a/src/gpu/effects/GrConvolutionEffect.cpp b/src/gpu/effects/GrConvolutionEffect.cpp
index 59f7ab1..d8a79d0 100644
--- a/src/gpu/effects/GrConvolutionEffect.cpp
+++ b/src/gpu/effects/GrConvolutionEffect.cpp
@@ -98,7 +98,7 @@
void GrGLConvolutionEffect::onSetData(const GrGLSLProgramDataManager& pdman,
const GrProcessor& processor) {
const GrConvolutionEffect& conv = processor.cast<GrConvolutionEffect>();
- GrTexture& texture = *conv.texture(0);
+ GrTexture& texture = *conv.textureSampler(0).getTexture();
float imageIncrement[2] = { 0 };
float ySign = texture.origin() != kTopLeft_GrSurfaceOrigin ? 1.0f : -1.0f;
diff --git a/src/gpu/effects/GrCustomXfermode.cpp b/src/gpu/effects/GrCustomXfermode.cpp
index 8a54d44..8d5c500 100644
--- a/src/gpu/effects/GrCustomXfermode.cpp
+++ b/src/gpu/effects/GrCustomXfermode.cpp
@@ -14,7 +14,6 @@
#include "GrPipeline.h"
#include "GrProcessor.h"
#include "GrTexture.h"
-#include "GrTextureAccess.h"
#include "SkXfermode.h"
#include "glsl/GrGLSLBlend.h"
#include "glsl/GrGLSLCaps.h"
diff --git a/src/gpu/effects/GrDistanceFieldGeoProc.cpp b/src/gpu/effects/GrDistanceFieldGeoProc.cpp
index 7f9fd85..a99e2af 100644
--- a/src/gpu/effects/GrDistanceFieldGeoProc.cpp
+++ b/src/gpu/effects/GrDistanceFieldGeoProc.cpp
@@ -85,8 +85,8 @@
vertBuilder->codeAppendf("%s = %s;", uv.vsOut(), dfTexEffect.inTextureCoords()->fName);
// compute numbers to be hardcoded to convert texture coordinates from float to int
- SkASSERT(dfTexEffect.numTextures() == 1);
- GrTexture* atlas = dfTexEffect.textureAccess(0).getTexture();
+ SkASSERT(dfTexEffect.numTextureSamplers() == 1);
+ GrTexture* atlas = dfTexEffect.textureSampler(0).getTexture();
SkASSERT(atlas && SkIsPow2(atlas->width()) && SkIsPow2(atlas->height()));
GrGLSLVertToFrag st(kVec2f_GrSLType);
@@ -207,8 +207,8 @@
b->add32(key);
// Currently we hardcode numbers to convert atlas coordinates to normalized floating point
- SkASSERT(gp.numTextures() == 1);
- GrTexture* atlas = gp.textureAccess(0).getTexture();
+ SkASSERT(gp.numTextureSamplers() == 1);
+ GrTexture* atlas = gp.textureSampler(0).getTexture();
SkASSERT(atlas);
b->add32(atlas->width());
b->add32(atlas->height());
@@ -238,7 +238,7 @@
bool usesLocalCoords)
: fColor(color)
, fViewMatrix(viewMatrix)
- , fTextureAccess(texture, params)
+ , fTextureSampler(texture, params)
#ifdef SK_GAMMA_APPLY_TO_A8
, fDistanceAdjust(distanceAdjust)
#endif
@@ -252,7 +252,7 @@
fInColor = &this->addVertexAttrib("inColor", kVec4ub_GrVertexAttribType);
fInTextureCoords = &this->addVertexAttrib("inTextureCoords", kVec2us_GrVertexAttribType,
kHigh_GrSLPrecision);
- this->addTextureAccess(&fTextureAccess);
+ this->addTextureSampler(&fTextureSampler);
}
void GrDistanceFieldA8TextGeoProc::getGLSLProcessorKey(const GrGLSLCaps& caps,
@@ -433,7 +433,7 @@
FPCoordTransformIter&& transformIter) override {
SkASSERT(fTextureSizeUni.isValid());
- GrTexture* texture = proc.texture(0);
+ GrTexture* texture = proc.textureSampler(0).getTexture();
if (texture->width() != fTextureSize.width() ||
texture->height() != fTextureSize.height()) {
fTextureSize = SkISize::Make(texture->width(), texture->height());
@@ -484,7 +484,7 @@
bool usesLocalCoords)
: fColor(color)
, fViewMatrix(viewMatrix)
- , fTextureAccess(texture, params)
+ , fTextureSampler(texture, params)
, fFlags(flags & kNonLCD_DistanceFieldEffectMask)
, fInColor(nullptr)
, fUsesLocalCoords(usesLocalCoords) {
@@ -494,7 +494,7 @@
kHigh_GrSLPrecision);
fInColor = &this->addVertexAttrib("inColor", kVec4ub_GrVertexAttribType);
fInTextureCoords = &this->addVertexAttrib("inTextureCoords", kVec2f_GrVertexAttribType);
- this->addTextureAccess(&fTextureAccess);
+ this->addTextureSampler(&fTextureSampler);
}
void GrDistanceFieldPathGeoProc::getGLSLProcessorKey(const GrGLSLCaps& caps,
@@ -594,8 +594,8 @@
vertBuilder->codeAppendf("%s = %s;", uv.vsOut(), dfTexEffect.inTextureCoords()->fName);
// compute numbers to be hardcoded to convert texture coordinates from float to int
- SkASSERT(dfTexEffect.numTextures() == 1);
- GrTexture* atlas = dfTexEffect.textureAccess(0).getTexture();
+ SkASSERT(dfTexEffect.numTextureSamplers() == 1);
+ GrTexture* atlas = dfTexEffect.textureSampler(0).getTexture();
SkASSERT(atlas && SkIsPow2(atlas->width()) && SkIsPow2(atlas->height()));
GrGLSLVertToFrag st(kVec2f_GrSLType);
@@ -760,8 +760,8 @@
b->add32(key);
// Currently we hardcode numbers to convert atlas coordinates to normalized floating point
- SkASSERT(gp.numTextures() == 1);
- GrTexture* atlas = gp.textureAccess(0).getTexture();
+ SkASSERT(gp.numTextureSamplers() == 1);
+ GrTexture* atlas = gp.textureSampler(0).getTexture();
SkASSERT(atlas);
b->add32(atlas->width());
b->add32(atlas->height());
@@ -786,7 +786,7 @@
uint32_t flags, bool usesLocalCoords)
: fColor(color)
, fViewMatrix(viewMatrix)
- , fTextureAccess(texture, params)
+ , fTextureSampler(texture, params)
, fDistanceAdjust(distanceAdjust)
, fFlags(flags & kLCD_DistanceFieldEffectMask)
, fUsesLocalCoords(usesLocalCoords) {
@@ -797,7 +797,7 @@
fInColor = &this->addVertexAttrib("inColor", kVec4ub_GrVertexAttribType);
fInTextureCoords = &this->addVertexAttrib("inTextureCoords", kVec2us_GrVertexAttribType,
kHigh_GrSLPrecision);
- this->addTextureAccess(&fTextureAccess);
+ this->addTextureSampler(&fTextureSampler);
}
void GrDistanceFieldLCDTextGeoProc::getGLSLProcessorKey(const GrGLSLCaps& caps,
diff --git a/src/gpu/effects/GrDistanceFieldGeoProc.h b/src/gpu/effects/GrDistanceFieldGeoProc.h
index 339c063..68e0a24 100644
--- a/src/gpu/effects/GrDistanceFieldGeoProc.h
+++ b/src/gpu/effects/GrDistanceFieldGeoProc.h
@@ -96,7 +96,7 @@
GrColor fColor;
SkMatrix fViewMatrix;
- GrTextureAccess fTextureAccess;
+ TextureSampler fTextureSampler;
#ifdef SK_GAMMA_APPLY_TO_A8
float fDistanceAdjust;
#endif
@@ -151,7 +151,7 @@
GrColor fColor;
SkMatrix fViewMatrix;
- GrTextureAccess fTextureAccess;
+ TextureSampler fTextureSampler;
uint32_t fFlags;
const Attribute* fInPosition;
const Attribute* fInColor;
@@ -221,7 +221,7 @@
GrColor fColor;
SkMatrix fViewMatrix;
- GrTextureAccess fTextureAccess;
+ TextureSampler fTextureSampler;
DistanceAdjust fDistanceAdjust;
uint32_t fFlags;
const Attribute* fInPosition;
diff --git a/src/gpu/effects/GrMatrixConvolutionEffect.cpp b/src/gpu/effects/GrMatrixConvolutionEffect.cpp
index 5617497..8c67882 100644
--- a/src/gpu/effects/GrMatrixConvolutionEffect.cpp
+++ b/src/gpu/effects/GrMatrixConvolutionEffect.cpp
@@ -129,12 +129,12 @@
void GrGLMatrixConvolutionEffect::onSetData(const GrGLSLProgramDataManager& pdman,
const GrProcessor& processor) {
const GrMatrixConvolutionEffect& conv = processor.cast<GrMatrixConvolutionEffect>();
- GrTexture& texture = *conv.texture(0);
+ GrTexture* texture = conv.textureSampler(0).getTexture();
float imageIncrement[2];
- float ySign = texture.origin() == kTopLeft_GrSurfaceOrigin ? 1.0f : -1.0f;
- imageIncrement[0] = 1.0f / texture.width();
- imageIncrement[1] = ySign / texture.height();
+ float ySign = texture->origin() == kTopLeft_GrSurfaceOrigin ? 1.0f : -1.0f;
+ imageIncrement[0] = 1.0f / texture->width();
+ imageIncrement[1] = ySign / texture->height();
pdman.set2fv(fImageIncrementUni, 1, imageIncrement);
pdman.set2fv(fKernelOffsetUni, 1, conv.kernelOffset());
int kernelCount = conv.kernelSize().width() * conv.kernelSize().height();
@@ -143,7 +143,7 @@
pdman.set4fv(fKernelUni, arrayCount, conv.kernel());
pdman.set1f(fGainUni, conv.gain());
pdman.set1f(fBiasUni, conv.bias());
- fDomain.setData(pdman, conv.domain(), texture.origin());
+ fDomain.setData(pdman, conv.domain(), texture->origin());
}
GrMatrixConvolutionEffect::GrMatrixConvolutionEffect(GrTexture* texture,
diff --git a/src/gpu/effects/GrSingleTextureEffect.cpp b/src/gpu/effects/GrSingleTextureEffect.cpp
index 2683789..929275e 100644
--- a/src/gpu/effects/GrSingleTextureEffect.cpp
+++ b/src/gpu/effects/GrSingleTextureEffect.cpp
@@ -11,10 +11,10 @@
sk_sp<GrColorSpaceXform> colorSpaceXform,
const SkMatrix& m)
: fCoordTransform(m, texture, GrTextureParams::kNone_FilterMode)
- , fTextureAccess(texture)
+ , fTextureSampler(texture)
, fColorSpaceXform(std::move(colorSpaceXform)) {
this->addCoordTransform(&fCoordTransform);
- this->addTextureAccess(&fTextureAccess);
+ this->addTextureSampler(&fTextureSampler);
}
GrSingleTextureEffect::GrSingleTextureEffect(GrTexture* texture,
@@ -22,10 +22,10 @@
const SkMatrix& m,
GrTextureParams::FilterMode filterMode)
: fCoordTransform(m, texture, filterMode)
- , fTextureAccess(texture, filterMode)
+ , fTextureSampler(texture, filterMode)
, fColorSpaceXform(std::move(colorSpaceXform)) {
this->addCoordTransform(&fCoordTransform);
- this->addTextureAccess(&fTextureAccess);
+ this->addTextureSampler(&fTextureSampler);
}
GrSingleTextureEffect::GrSingleTextureEffect(GrTexture* texture,
@@ -33,10 +33,10 @@
const SkMatrix& m,
const GrTextureParams& params)
: fCoordTransform(m, texture, params.filterMode())
- , fTextureAccess(texture, params)
+ , fTextureSampler(texture, params)
, fColorSpaceXform(std::move(colorSpaceXform)) {
this->addCoordTransform(&fCoordTransform);
- this->addTextureAccess(&fTextureAccess);
+ this->addTextureSampler(&fTextureSampler);
}
GrSingleTextureEffect::~GrSingleTextureEffect() {
diff --git a/src/gpu/effects/GrSingleTextureEffect.h b/src/gpu/effects/GrSingleTextureEffect.h
index 12b3a8f..1d34944 100644
--- a/src/gpu/effects/GrSingleTextureEffect.h
+++ b/src/gpu/effects/GrSingleTextureEffect.h
@@ -26,7 +26,7 @@
SkString dumpInfo() const override {
SkString str;
- str.appendf("Texture: %d", fTextureAccess.getTexture()->uniqueID().asUInt());
+ str.appendf("Texture: %d", fTextureSampler.getTexture()->uniqueID().asUInt());
return str;
}
@@ -49,9 +49,10 @@
* texture.
*/
void updateInvariantOutputForModulation(GrInvariantOutput* inout) const {
- if (GrPixelConfigIsAlphaOnly(this->texture(0)->config())) {
+ GrPixelConfig config = this->textureSampler(0).getTexture()->config();
+ if (GrPixelConfigIsAlphaOnly(config)) {
inout->mulByUnknownSingleComponent();
- } else if (GrPixelConfigIsOpaque(this->texture(0)->config())) {
+ } else if (GrPixelConfigIsOpaque(config)) {
inout->mulByUnknownOpaqueFourComponents();
} else {
inout->mulByUnknownFourComponents();
@@ -60,7 +61,7 @@
private:
GrCoordTransform fCoordTransform;
- GrTextureAccess fTextureAccess;
+ TextureSampler fTextureSampler;
sk_sp<GrColorSpaceXform> fColorSpaceXform;
typedef GrFragmentProcessor INHERITED;
diff --git a/src/gpu/effects/GrTextureDomain.cpp b/src/gpu/effects/GrTextureDomain.cpp
index 55d69bf..4418730 100644
--- a/src/gpu/effects/GrTextureDomain.cpp
+++ b/src/gpu/effects/GrTextureDomain.cpp
@@ -229,7 +229,7 @@
void onSetData(const GrGLSLProgramDataManager& pdman, const GrProcessor& fp) override {
const GrTextureDomainEffect& tde = fp.cast<GrTextureDomainEffect>();
const GrTextureDomain& domain = tde.fTextureDomain;
- fGLDomain.setData(pdman, domain, tde.texture(0)->origin());
+ fGLDomain.setData(pdman, domain, tde.textureSampler(0).getTexture()->origin());
}
private:
@@ -242,14 +242,13 @@
bool GrTextureDomainEffect::onIsEqual(const GrFragmentProcessor& sBase) const {
const GrTextureDomainEffect& s = sBase.cast<GrTextureDomainEffect>();
- return this->fTextureDomain == s.fTextureDomain && s.texture(0) == this->texture(0) &&
- s.textureAccess(0).getParams().filterMode() ==
- this->textureAccess(0).getParams().filterMode();
+ return this->fTextureDomain == s.fTextureDomain &&
+ s.textureSampler(0) == this->textureSampler(0);
}
void GrTextureDomainEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const {
if (GrTextureDomain::kDecal_Mode == fTextureDomain.mode()) {
- if (GrPixelConfigIsAlphaOnly(this->texture(0)->config())) {
+ if (GrPixelConfigIsAlphaOnly(this->textureSampler(0).getTexture()->config())) {
inout->mulByUnknownSingleComponent();
} else {
inout->mulByUnknownFourComponents();
@@ -295,10 +294,10 @@
GrDeviceSpaceTextureDecalFragmentProcessor::GrDeviceSpaceTextureDecalFragmentProcessor(
GrTexture* texture, const SkIRect& subset, const SkIPoint& deviceSpaceOffset)
- : fTextureAccess(texture, GrTextureParams::ClampNoFilter())
+ : fTextureSampler(texture, GrTextureParams::ClampNoFilter())
, fTextureDomain(GrTextureDomain::MakeTexelDomain(texture, subset),
GrTextureDomain::kDecal_Mode) {
- this->addTextureAccess(&fTextureAccess);
+ this->addTextureSampler(&fTextureSampler);
fDeviceSpaceOffset.fX = deviceSpaceOffset.fX - subset.fLeft;
fDeviceSpaceOffset.fY = deviceSpaceOffset.fY - subset.fTop;
this->initClassID<GrDeviceSpaceTextureDecalFragmentProcessor>();
@@ -334,14 +333,15 @@
void onSetData(const GrGLSLProgramDataManager& pdman, const GrProcessor& fp) override {
const GrDeviceSpaceTextureDecalFragmentProcessor& dstdfp =
fp.cast<GrDeviceSpaceTextureDecalFragmentProcessor>();
- fGLDomain.setData(pdman, dstdfp.fTextureDomain, dstdfp.texture(0)->origin());
- float iw = 1.f / dstdfp.texture(0)->width();
- float ih = 1.f / dstdfp.texture(0)->height();
+ GrTexture* texture = dstdfp.textureSampler(0).getTexture();
+ fGLDomain.setData(pdman, dstdfp.fTextureDomain, texture->origin());
+ float iw = 1.f / texture->width();
+ float ih = 1.f / texture->height();
float scaleAndTransData[4] = {
iw, ih,
-dstdfp.fDeviceSpaceOffset.fX * iw, -dstdfp.fDeviceSpaceOffset.fY * ih
};
- if (dstdfp.texture(0)->origin() == kBottomLeft_GrSurfaceOrigin) {
+ if (texture->origin() == kBottomLeft_GrSurfaceOrigin) {
scaleAndTransData[1] = -scaleAndTransData[1];
scaleAndTransData[3] = 1 - scaleAndTransData[3];
}
@@ -359,14 +359,14 @@
bool GrDeviceSpaceTextureDecalFragmentProcessor::onIsEqual(const GrFragmentProcessor& fp) const {
const GrDeviceSpaceTextureDecalFragmentProcessor& dstdfp =
fp.cast<GrDeviceSpaceTextureDecalFragmentProcessor>();
- return dstdfp.fTextureAccess.getTexture() == fTextureAccess.getTexture() &&
+ return dstdfp.fTextureSampler.getTexture() == fTextureSampler.getTexture() &&
dstdfp.fDeviceSpaceOffset == fDeviceSpaceOffset &&
dstdfp.fTextureDomain == fTextureDomain;
}
void GrDeviceSpaceTextureDecalFragmentProcessor::onComputeInvariantOutput(
GrInvariantOutput* inout) const {
- if (GrPixelConfigIsAlphaOnly(this->texture(0)->config())) {
+ if (GrPixelConfigIsAlphaOnly(this->textureSampler(0).getTexture()->config())) {
inout->mulByUnknownSingleComponent();
} else {
inout->mulByUnknownFourComponents();
diff --git a/src/gpu/effects/GrTextureDomain.h b/src/gpu/effects/GrTextureDomain.h
index 82ff73c..d557d17 100644
--- a/src/gpu/effects/GrTextureDomain.h
+++ b/src/gpu/effects/GrTextureDomain.h
@@ -225,7 +225,7 @@
}
private:
- GrTextureAccess fTextureAccess;
+ TextureSampler fTextureSampler;
GrTextureDomain fTextureDomain;
SkIPoint fDeviceSpaceOffset;
diff --git a/src/gpu/effects/GrYUVEffect.cpp b/src/gpu/effects/GrYUVEffect.cpp
index cbe25e8..2fd3513 100644
--- a/src/gpu/effects/GrYUVEffect.cpp
+++ b/src/gpu/effects/GrYUVEffect.cpp
@@ -155,21 +155,21 @@
const SkMatrix yuvMatrix[3], GrTextureParams::FilterMode uvFilterMode,
SkYUVColorSpace colorSpace, bool nv12)
: fYTransform(yuvMatrix[0], yTexture, GrTextureParams::kNone_FilterMode)
- , fYAccess(yTexture)
+ , fYSampler(yTexture)
, fUTransform(yuvMatrix[1], uTexture, uvFilterMode)
- , fUAccess(uTexture, uvFilterMode)
- , fVAccess(vTexture, uvFilterMode)
+ , fUSampler(uTexture, uvFilterMode)
+ , fVSampler(vTexture, uvFilterMode)
, fColorSpace(colorSpace)
, fNV12(nv12) {
this->initClassID<YUVtoRGBEffect>();
this->addCoordTransform(&fYTransform);
- this->addTextureAccess(&fYAccess);
+ this->addTextureSampler(&fYSampler);
this->addCoordTransform(&fUTransform);
- this->addTextureAccess(&fUAccess);
+ this->addTextureSampler(&fUSampler);
if (!fNV12) {
fVTransform = GrCoordTransform(yuvMatrix[2], vTexture, uvFilterMode);
this->addCoordTransform(&fVTransform);
- this->addTextureAccess(&fVAccess);
+ this->addTextureSampler(&fVSampler);
}
}
@@ -193,11 +193,11 @@
}
GrCoordTransform fYTransform;
- GrTextureAccess fYAccess;
+ TextureSampler fYSampler;
GrCoordTransform fUTransform;
- GrTextureAccess fUAccess;
+ TextureSampler fUSampler;
GrCoordTransform fVTransform;
- GrTextureAccess fVAccess;
+ TextureSampler fVSampler;
SkYUVColorSpace fColorSpace;
bool fNV12;
@@ -353,7 +353,7 @@
}
GrCoordTransform fTransform;
- GrTextureAccess fAccess;
+ TextureSampler fTextureSampler;
SkYUVColorSpace fColorSpace;
OutputChannels fOutputChannels;
diff --git a/src/gpu/gl/GrGLProgram.cpp b/src/gpu/gl/GrGLProgram.cpp
index 86b2372..006077b 100644
--- a/src/gpu/gl/GrGLProgram.cpp
+++ b/src/gpu/gl/GrGLProgram.cpp
@@ -152,10 +152,10 @@
void GrGLProgram::bindTextures(const GrProcessor& processor,
bool allowSRGBInputs,
int* nextSamplerIdx) {
- for (int i = 0; i < processor.numTextures(); ++i) {
- const GrTextureAccess& access = processor.textureAccess(i);
- fGpu->bindTexture((*nextSamplerIdx)++, access.getParams(),
- allowSRGBInputs, static_cast<GrGLTexture*>(access.getTexture()));
+ for (int i = 0; i < processor.numTextureSamplers(); ++i) {
+ const GrProcessor::TextureSampler& sampler = processor.textureSampler(i);
+ fGpu->bindTexture((*nextSamplerIdx)++, sampler.getParams(),
+ allowSRGBInputs, static_cast<GrGLTexture*>(sampler.getTexture()));
}
for (int i = 0; i < processor.numBuffers(); ++i) {
const GrBufferAccess& access = processor.bufferAccess(i);
@@ -166,9 +166,9 @@
void GrGLProgram::generateMipmaps(const GrProcessor& processor,
bool allowSRGBInputs) {
- for (int i = 0; i < processor.numTextures(); ++i) {
- const GrTextureAccess& access = processor.textureAccess(i);
- fGpu->generateMipmaps(access.getParams(), allowSRGBInputs,
- static_cast<GrGLTexture*>(access.getTexture()));
+ for (int i = 0; i < processor.numTextureSamplers(); ++i) {
+ const GrProcessor::TextureSampler& sampler = processor.textureSampler(i);
+ fGpu->generateMipmaps(sampler.getParams(), allowSRGBInputs,
+ static_cast<GrGLTexture*>(sampler.getTexture()));
}
}
diff --git a/src/gpu/glsl/GrGLSLFragmentProcessor.h b/src/gpu/glsl/GrGLSLFragmentProcessor.h
index d2f00f8..7add1eb 100644
--- a/src/gpu/glsl/GrGLSLFragmentProcessor.h
+++ b/src/gpu/glsl/GrGLSLFragmentProcessor.h
@@ -72,7 +72,7 @@
using TransformedCoordVars = BuilderInputProvider<GrShaderVar, GrFragmentProcessor,
&GrFragmentProcessor::numCoordTransforms>;
using TextureSamplers = BuilderInputProvider<SamplerHandle, GrProcessor,
- &GrProcessor::numTextures>;
+ &GrProcessor::numTextureSamplers>;
using BufferSamplers = BuilderInputProvider<SamplerHandle, GrProcessor,
&GrProcessor::numBuffers>;
@@ -94,7 +94,7 @@
info about its output.
@param transformedCoords Fragment shader variables containing the coords computed using
each of the GrFragmentProcessor's GrCoordTransforms.
- @param texSamplers Contains one entry for each GrTextureAccess of the GrProcessor.
+ @param texSamplers Contains one entry for each TextureSampler of the GrProcessor.
These can be passed to the builder to emit texture reads in the
generated code.
@param bufferSamplers Contains one entry for each GrBufferAccess of the GrProcessor.
diff --git a/src/gpu/glsl/GrGLSLProgramBuilder.cpp b/src/gpu/glsl/GrGLSLProgramBuilder.cpp
index 0862bc4..fc50fa0 100644
--- a/src/gpu/glsl/GrGLSLProgramBuilder.cpp
+++ b/src/gpu/glsl/GrGLSLProgramBuilder.cpp
@@ -96,7 +96,7 @@
SkASSERT(!fGeometryProcessor);
fGeometryProcessor = proc.createGLSLInstance(*this->glslCaps());
- SkSTArray<4, SamplerHandle> texSamplers(proc.numTextures());
+ SkSTArray<4, SamplerHandle> texSamplers(proc.numTextureSamplers());
SkSTArray<2, SamplerHandle> bufferSamplers(proc.numBuffers());
this->emitSamplers(proc, &texSamplers, &bufferSamplers);
@@ -159,7 +159,7 @@
GrGLSLFragmentProcessor* fragProc = fp.createGLSLInstance();
- SkSTArray<4, SamplerHandle> textureSamplerArray(fp.numTextures());
+ SkSTArray<4, SamplerHandle> textureSamplerArray(fp.numTextureSamplers());
SkSTArray<2, SamplerHandle> bufferSamplerArray(fp.numBuffers());
GrFragmentProcessor::Iter iter(&fp);
while (const GrFragmentProcessor* subFP = iter.next()) {
@@ -215,7 +215,7 @@
openBrace.printf("{ // Xfer Processor: %s\n", xp.name());
fFS.codeAppend(openBrace.c_str());
- SkSTArray<4, SamplerHandle> texSamplers(xp.numTextures());
+ SkSTArray<4, SamplerHandle> texSamplers(xp.numTextureSamplers());
SkSTArray<2, SamplerHandle> bufferSamplers(xp.numBuffers());
this->emitSamplers(xp, &texSamplers, &bufferSamplers);
@@ -242,21 +242,21 @@
SkTArray<SamplerHandle>* outTexSamplers,
SkTArray<SamplerHandle>* outBufferSamplers) {
SkString name;
- int numTextures = processor.numTextures();
- for (int t = 0; t < numTextures; ++t) {
- const GrTextureAccess& access = processor.textureAccess(t);
- GrSLType samplerType = access.getTexture()->texturePriv().samplerType();
+ int numTextureSamplers = processor.numTextureSamplers();
+ for (int t = 0; t < numTextureSamplers; ++t) {
+ const GrProcessor::TextureSampler& sampler = processor.textureSampler(t);
+ GrSLType samplerType = sampler.getTexture()->texturePriv().samplerType();
if (kTextureExternalSampler_GrSLType == samplerType) {
const char* externalFeatureString = this->glslCaps()->externalTextureExtensionString();
// We shouldn't ever create a GrGLTexture that requires external sampler type
SkASSERT(externalFeatureString);
- this->addFeature(access.getVisibility(),
+ this->addFeature(sampler.getVisibility(),
1 << GrGLSLShaderBuilder::kExternalTexture_GLSLPrivateFeature,
externalFeatureString);
}
name.printf("TextureSampler_%d", outTexSamplers->count());
- this->emitSampler(samplerType, access.getTexture()->config(),
- name.c_str(), access.getVisibility(), outTexSamplers);
+ this->emitSampler(samplerType, sampler.getTexture()->config(),
+ name.c_str(), sampler.getVisibility(), outTexSamplers);
}
if (int numBuffers = processor.numBuffers()) {
diff --git a/src/gpu/glsl/GrGLSLShaderBuilder.h b/src/gpu/glsl/GrGLSLShaderBuilder.h
index f59edb4..378f523 100644
--- a/src/gpu/glsl/GrGLSLShaderBuilder.h
+++ b/src/gpu/glsl/GrGLSLShaderBuilder.h
@@ -29,7 +29,8 @@
/** Appends a 2D texture sample with projection if necessary. coordType must either be Vec2f or
Vec3f. The latter is interpreted as projective texture coords. The vec length and swizzle
- order of the result depends on the GrTextureAccess associated with the GrGLSLSampler.
+ order of the result depends on the GrProcessor::TextureSampelr associated with the
+ GrGLSLSampler.
*/
void appendTextureLookup(SkString* out,
SamplerHandle,
diff --git a/src/gpu/vk/GrVkGpuCommandBuffer.cpp b/src/gpu/vk/GrVkGpuCommandBuffer.cpp
index 4cbefa6..3f0bd39 100644
--- a/src/gpu/vk/GrVkGpuCommandBuffer.cpp
+++ b/src/gpu/vk/GrVkGpuCommandBuffer.cpp
@@ -12,7 +12,6 @@
#include "GrMesh.h"
#include "GrPipeline.h"
#include "GrRenderTargetPriv.h"
-#include "GrTextureAccess.h"
#include "GrTexturePriv.h"
#include "GrVkCommandBuffer.h"
#include "GrVkGpu.h"
@@ -427,9 +426,9 @@
}
static void prepare_sampled_images(const GrProcessor& processor, GrVkGpu* gpu) {
- for (int i = 0; i < processor.numTextures(); ++i) {
- const GrTextureAccess& texAccess = processor.textureAccess(i);
- GrVkTexture* vkTexture = static_cast<GrVkTexture*>(processor.texture(i));
+ for (int i = 0; i < processor.numTextureSamplers(); ++i) {
+ const GrProcessor::TextureSampler& sampler = processor.textureSampler(i);
+ GrVkTexture* vkTexture = static_cast<GrVkTexture*>(sampler.getTexture());
SkASSERT(vkTexture);
// We may need to resolve the texture first if it is also a render target
@@ -438,7 +437,7 @@
gpu->onResolveRenderTarget(texRT);
}
- const GrTextureParams& params = texAccess.getParams();
+ const GrTextureParams& params = sampler.getParams();
// Check if we need to regenerate any mip maps
if (GrTextureParams::kMipMap_FilterMode == params.filterMode()) {
if (vkTexture->texturePriv().mipMapsAreDirty()) {
diff --git a/src/gpu/vk/GrVkPipelineState.cpp b/src/gpu/vk/GrVkPipelineState.cpp
index ba4f95f..2ca1aaf 100644
--- a/src/gpu/vk/GrVkPipelineState.cpp
+++ b/src/gpu/vk/GrVkPipelineState.cpp
@@ -173,13 +173,14 @@
}
static void append_texture_bindings(const GrProcessor& processor,
- SkTArray<const GrTextureAccess*>* textureBindings) {
- if (int numTextures = processor.numTextures()) {
- const GrTextureAccess** bindings = textureBindings->push_back_n(numTextures);
+ SkTArray<const GrProcessor::TextureSampler*>* textureBindings) {
+ if (int numTextureSamplers = processor.numTextureSamplers()) {
+ const GrProcessor::TextureSampler** bindings =
+ textureBindings->push_back_n(numTextureSamplers);
int i = 0;
do {
- bindings[i] = &processor.textureAccess(i);
- } while (++i < numTextures);
+ bindings[i] = &processor.textureSampler(i);
+ } while (++i < numTextureSamplers);
}
}
@@ -192,7 +193,7 @@
this->setRenderTargetState(pipeline);
- SkSTArray<8, const GrTextureAccess*> textureBindings;
+ SkSTArray<8, const GrProcessor::TextureSampler*> textureBindings;
fGeometryProcessor->setData(fDataManager, primProc,
GrFragmentProcessor::CoordTransformIter(pipeline));
@@ -302,9 +303,10 @@
}
}
-void GrVkPipelineState::writeSamplers(GrVkGpu* gpu,
- const SkTArray<const GrTextureAccess*>& textureBindings,
- bool allowSRGBInputs) {
+void GrVkPipelineState::writeSamplers(
+ GrVkGpu* gpu,
+ const SkTArray<const GrProcessor::TextureSampler*>& textureBindings,
+ bool allowSRGBInputs) {
SkASSERT(fNumSamplers == textureBindings.count());
for (int i = 0; i < textureBindings.count(); ++i) {
diff --git a/src/gpu/vk/GrVkPipelineState.h b/src/gpu/vk/GrVkPipelineState.h
index 63277c0..3b0a6af 100644
--- a/src/gpu/vk/GrVkPipelineState.h
+++ b/src/gpu/vk/GrVkPipelineState.h
@@ -141,7 +141,8 @@
void writeUniformBuffers(const GrVkGpu* gpu);
- void writeSamplers(GrVkGpu* gpu, const SkTArray<const GrTextureAccess*>& textureBindings,
+ void writeSamplers(GrVkGpu* gpu,
+ const SkTArray<const GrProcessor::TextureSampler*>& textureBindings,
bool allowSRGBInputs);
/**
diff --git a/src/gpu/vk/GrVkSampler.cpp b/src/gpu/vk/GrVkSampler.cpp
index 1d4e706..799adc9 100644
--- a/src/gpu/vk/GrVkSampler.cpp
+++ b/src/gpu/vk/GrVkSampler.cpp
@@ -7,7 +7,6 @@
#include "GrVkSampler.h"
-#include "GrTextureAccess.h"
#include "GrVkGpu.h"
static inline VkSamplerAddressMode tile_to_vk_sampler_address(SkShader::TileMode tm) {
diff --git a/src/gpu/vk/GrVkSampler.h b/src/gpu/vk/GrVkSampler.h
index c0f60e4..369b162 100644
--- a/src/gpu/vk/GrVkSampler.h
+++ b/src/gpu/vk/GrVkSampler.h
@@ -12,7 +12,6 @@
#include "vk/GrVkDefines.h"
-class GrTextureAccess;
class GrTextureParams;
class GrVkGpu;
diff --git a/src/image/SkImageShader.cpp b/src/image/SkImageShader.cpp
index eed8175..8f8f6a3 100644
--- a/src/image/SkImageShader.cpp
+++ b/src/image/SkImageShader.cpp
@@ -175,7 +175,6 @@
#if SK_SUPPORT_GPU
-#include "GrTextureAccess.h"
#include "SkGr.h"
#include "SkGrPriv.h"
#include "effects/GrSimpleTextureEffect.h"