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/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;