In GrProcessor::TextureSampler drop the "get", it's cleaner

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4962

Change-Id: I55e7f8d1b6e1097fdbe411e9989dd42a03dd5f33
Reviewed-on: https://skia-review.googlesource.com/4962
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
This commit is contained in:
Brian Salomon 2016-11-17 12:48:40 -05:00 committed by Skia Commit-Bot
parent 3a88725d58
commit db4183d227
22 changed files with 47 additions and 48 deletions

View File

@ -203,22 +203,21 @@ public:
GrShaderFlags visibility = kFragment_GrShaderFlag);
bool operator==(const TextureSampler& that) const {
return this->getTexture() == that.getTexture() &&
return this->texture() == that.texture() &&
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; }
GrTexture* texture() const { return fTexture.get(); }
GrShaderFlags visibility() const { return fVisibility; }
const GrTextureParams& params() const { return fParams; }
/**
* For internal use by GrProcessor.
*/
const GrGpuResourceRef* getProgramTexture() const { return &fTexture; }
const GrTextureParams& getParams() const { return fParams; }
const GrGpuResourceRef* programTexture() const { return &fTexture; }
private:

View File

@ -179,7 +179,7 @@ public:
* shader. If the returned texture is NULL then the XP is either not reading the dst or we have
* extentions that support framebuffer fetching and thus don't need a copy of the dst texture.
*/
const GrTexture* getDstTexture() const { return fDstTexture.getTexture(); }
const GrTexture* getDstTexture() const { return fDstTexture.texture(); }
/**
* Returns the offset in device coords to use when accessing the dst texture to get the dst
@ -218,7 +218,7 @@ public:
if (this->fWillReadDstColor != that.fWillReadDstColor) {
return false;
}
if (this->fDstTexture.getTexture() != that.fDstTexture.getTexture()) {
if (this->fDstTexture.texture() != that.fDstTexture.texture()) {
return false;
}
if (this->fDstTextureOffset != that.fDstTextureOffset) {

View File

@ -68,7 +68,7 @@ bool GrAlphaThresholdFragmentProcessor::onIsEqual(const GrFragmentProcessor& sBa
}
void GrAlphaThresholdFragmentProcessor::onComputeInvariantOutput(GrInvariantOutput* inout) const {
GrPixelConfig config = this->textureSampler(0).getTexture()->config();
GrPixelConfig config = this->textureSampler(0).texture()->config();
if (GrPixelConfigIsAlphaOnly(config)) {
inout->mulByUnknownSingleComponent();
} else if (GrPixelConfigIsOpaque(config) && fOuterThreshold >= 1.f) {

View File

@ -170,7 +170,7 @@ public:
const char* name() const override { return "ColorCube"; }
int colorCubeSize() const { return fColorCubeSampler.getTexture()->width(); }
int colorCubeSize() const { return fColorCubeSampler.texture()->width(); }
void onComputeInvariantOutput(GrInvariantOutput*) const override;

View File

@ -625,7 +625,7 @@ void GrGLDisplacementMapEffect::emitCode(EmitArgs& args) {
void GrGLDisplacementMapEffect::onSetData(const GrGLSLProgramDataManager& pdman,
const GrProcessor& proc) {
const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMapEffect>();
GrTexture* colorTex = displacementMap.textureSampler(1).getTexture();
GrTexture* colorTex = displacementMap.textureSampler(1).texture();
SkScalar scaleX = displacementMap.scale().fX / colorTex->width();
SkScalar scaleY = displacementMap.scale().fY / colorTex->height();
pdman.set2f(fScaleUni, SkScalarToFloat(scaleX),

View File

@ -1900,7 +1900,7 @@ void GrGLLightingEffect::onSetData(const GrGLSLProgramDataManager& pdman,
fLight = lighting.light()->createGLLight();
}
GrTexture* texture = lighting.textureSampler(0).getTexture();
GrTexture* texture = lighting.textureSampler(0).texture();
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());

View File

@ -294,7 +294,7 @@ void GrGLMorphologyEffect::GenKey(const GrProcessor& proc,
void GrGLMorphologyEffect::onSetData(const GrGLSLProgramDataManager& pdman,
const GrProcessor& proc) {
const GrMorphologyEffect& m = proc.cast<GrMorphologyEffect>();
GrTexture& texture = *m.textureSampler(0).getTexture();
GrTexture& texture = *m.textureSampler(0).texture();
float pixelSize = 0.0f;
switch (m.direction()) {

View File

@ -181,7 +181,7 @@ static void add_dependencies_for_processor(const GrFragmentProcessor* proc, GrRe
GrFragmentProcessor::TextureAccessIter iter(proc);
while (const GrProcessor::TextureSampler* sampler = iter.next()) {
SkASSERT(rt->getLastOpList());
rt->getLastOpList()->addDependency(sampler->getTexture());
rt->getLastOpList()->addDependency(sampler->texture());
}
}
@ -193,7 +193,7 @@ void GrPipeline::addDependenciesTo(GrRenderTarget* rt) const {
const GrXferProcessor& xfer = this->getXferProcessor();
for (int i = 0; i < xfer.numTextureSamplers(); ++i) {
GrTexture* texture = xfer.textureSampler(i).getTexture();
GrTexture* texture = xfer.textureSampler(i).texture();
SkASSERT(rt->getLastOpList());
rt->getLastOpList()->addDependency(texture);
}

View File

@ -117,7 +117,7 @@ GrProcessor::~GrProcessor() {}
void GrProcessor::addTextureSampler(const TextureSampler* access) {
fTextureSamplers.push_back(access);
this->addGpuResource(access->getProgramTexture());
this->addGpuResource(access->programTexture());
}
void GrProcessor::addBufferAccess(const GrBufferAccess* access) {

View File

@ -45,9 +45,9 @@ static void add_sampler_keys(GrProcessorKeyBuilder* b, const GrProcessor& proc,
int i = 0;
for (; i < numTextureSamplers; ++i) {
const GrProcessor::TextureSampler& textureSampler = proc.textureSampler(i);
const GrTexture* tex = textureSampler.getTexture();
const GrTexture* tex = textureSampler.texture();
k16[i] = sampler_key(tex->texturePriv().samplerType(), tex->config(),
textureSampler.getVisibility(), caps);
textureSampler.visibility(), caps);
}
for (; i < numSamplers; ++i) {
const GrBufferAccess& access = proc.bufferAccess(i - numTextureSamplers);

View File

@ -126,7 +126,7 @@ void GrGLBicubicEffect::emitCode(EmitArgs& args) {
void GrGLBicubicEffect::onSetData(const GrGLSLProgramDataManager& pdman,
const GrProcessor& processor) {
const GrBicubicEffect& bicubicEffect = processor.cast<GrBicubicEffect>();
GrTexture* texture = processor.textureSampler(0).getTexture();
GrTexture* texture = processor.textureSampler(0).texture();
float imageIncrement[2];
imageIncrement[0] = 1.0f / texture->width();
imageIncrement[1] = 1.0f / texture->height();

View File

@ -31,7 +31,7 @@ public:
// compute numbers to be hardcoded to convert texture coordinates from int to float
SkASSERT(cte.numTextureSamplers() == 1);
SkDEBUGCODE(GrTexture* atlas = cte.textureSampler(0).getTexture());
SkDEBUGCODE(GrTexture* atlas = cte.textureSampler(0).texture());
SkASSERT(atlas && SkIsPow2(atlas->width()) && SkIsPow2(atlas->height()));
GrGLSLVertToFrag v(kVec2f_GrSLType);
@ -109,7 +109,7 @@ public:
// Currently we hardcode numbers to convert atlas coordinates to normalized floating point
SkASSERT(gp.numTextureSamplers() == 1);
GrTexture* atlas = gp.textureSampler(0).getTexture();
GrTexture* atlas = gp.textureSampler(0).texture();
SkASSERT(atlas);
b->add32(atlas->width());
b->add32(atlas->height());

View File

@ -98,7 +98,7 @@ void GrGLConvolutionEffect::emitCode(EmitArgs& args) {
void GrGLConvolutionEffect::onSetData(const GrGLSLProgramDataManager& pdman,
const GrProcessor& processor) {
const GrConvolutionEffect& conv = processor.cast<GrConvolutionEffect>();
GrTexture& texture = *conv.textureSampler(0).getTexture();
GrTexture& texture = *conv.textureSampler(0).texture();
float imageIncrement[2] = { 0 };
float ySign = texture.origin() != kTopLeft_GrSurfaceOrigin ? 1.0f : -1.0f;

View File

@ -86,7 +86,7 @@ public:
// compute numbers to be hardcoded to convert texture coordinates from float to int
SkASSERT(dfTexEffect.numTextureSamplers() == 1);
GrTexture* atlas = dfTexEffect.textureSampler(0).getTexture();
GrTexture* atlas = dfTexEffect.textureSampler(0).texture();
SkASSERT(atlas && SkIsPow2(atlas->width()) && SkIsPow2(atlas->height()));
GrGLSLVertToFrag st(kVec2f_GrSLType);
@ -208,7 +208,7 @@ public:
// Currently we hardcode numbers to convert atlas coordinates to normalized floating point
SkASSERT(gp.numTextureSamplers() == 1);
GrTexture* atlas = gp.textureSampler(0).getTexture();
GrTexture* atlas = gp.textureSampler(0).texture();
SkASSERT(atlas);
b->add32(atlas->width());
b->add32(atlas->height());
@ -433,7 +433,7 @@ public:
FPCoordTransformIter&& transformIter) override {
SkASSERT(fTextureSizeUni.isValid());
GrTexture* texture = proc.textureSampler(0).getTexture();
GrTexture* texture = proc.textureSampler(0).texture();
if (texture->width() != fTextureSize.width() ||
texture->height() != fTextureSize.height()) {
fTextureSize = SkISize::Make(texture->width(), texture->height());
@ -595,7 +595,7 @@ public:
// compute numbers to be hardcoded to convert texture coordinates from float to int
SkASSERT(dfTexEffect.numTextureSamplers() == 1);
GrTexture* atlas = dfTexEffect.textureSampler(0).getTexture();
GrTexture* atlas = dfTexEffect.textureSampler(0).texture();
SkASSERT(atlas && SkIsPow2(atlas->width()) && SkIsPow2(atlas->height()));
GrGLSLVertToFrag st(kVec2f_GrSLType);
@ -761,7 +761,7 @@ public:
// Currently we hardcode numbers to convert atlas coordinates to normalized floating point
SkASSERT(gp.numTextureSamplers() == 1);
GrTexture* atlas = gp.textureSampler(0).getTexture();
GrTexture* atlas = gp.textureSampler(0).texture();
SkASSERT(atlas);
b->add32(atlas->width());
b->add32(atlas->height());

View File

@ -129,7 +129,7 @@ void GrGLMatrixConvolutionEffect::GenKey(const GrProcessor& processor,
void GrGLMatrixConvolutionEffect::onSetData(const GrGLSLProgramDataManager& pdman,
const GrProcessor& processor) {
const GrMatrixConvolutionEffect& conv = processor.cast<GrMatrixConvolutionEffect>();
GrTexture* texture = conv.textureSampler(0).getTexture();
GrTexture* texture = conv.textureSampler(0).texture();
float imageIncrement[2];
float ySign = texture->origin() == kTopLeft_GrSurfaceOrigin ? 1.0f : -1.0f;

View File

@ -26,7 +26,7 @@ public:
SkString dumpInfo() const override {
SkString str;
str.appendf("Texture: %d", fTextureSampler.getTexture()->uniqueID().asUInt());
str.appendf("Texture: %d", fTextureSampler.texture()->uniqueID().asUInt());
return str;
}
@ -49,7 +49,7 @@ protected:
* texture.
*/
void updateInvariantOutputForModulation(GrInvariantOutput* inout) const {
GrPixelConfig config = this->textureSampler(0).getTexture()->config();
GrPixelConfig config = this->textureSampler(0).texture()->config();
if (GrPixelConfigIsAlphaOnly(config)) {
inout->mulByUnknownSingleComponent();
} else if (GrPixelConfigIsOpaque(config)) {

View File

@ -229,7 +229,7 @@ GrGLSLFragmentProcessor* GrTextureDomainEffect::onCreateGLSLInstance() const {
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.textureSampler(0).getTexture()->origin());
fGLDomain.setData(pdman, domain, tde.textureSampler(0).texture()->origin());
}
private:
@ -247,7 +247,7 @@ bool GrTextureDomainEffect::onIsEqual(const GrFragmentProcessor& sBase) const {
void GrTextureDomainEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const {
if (GrTextureDomain::kDecal_Mode == fTextureDomain.mode()) {
if (GrPixelConfigIsAlphaOnly(this->textureSampler(0).getTexture()->config())) {
if (GrPixelConfigIsAlphaOnly(this->textureSampler(0).texture()->config())) {
inout->mulByUnknownSingleComponent();
} else {
inout->mulByUnknownFourComponents();
@ -332,7 +332,7 @@ GrGLSLFragmentProcessor* GrDeviceSpaceTextureDecalFragmentProcessor::onCreateGLS
void onSetData(const GrGLSLProgramDataManager& pdman, const GrProcessor& fp) override {
const GrDeviceSpaceTextureDecalFragmentProcessor& dstdfp =
fp.cast<GrDeviceSpaceTextureDecalFragmentProcessor>();
GrTexture* texture = dstdfp.textureSampler(0).getTexture();
GrTexture* texture = dstdfp.textureSampler(0).texture();
fGLDomain.setData(pdman, dstdfp.fTextureDomain, texture->origin());
float iw = 1.f / texture->width();
float ih = 1.f / texture->height();
@ -358,14 +358,14 @@ GrGLSLFragmentProcessor* GrDeviceSpaceTextureDecalFragmentProcessor::onCreateGLS
bool GrDeviceSpaceTextureDecalFragmentProcessor::onIsEqual(const GrFragmentProcessor& fp) const {
const GrDeviceSpaceTextureDecalFragmentProcessor& dstdfp =
fp.cast<GrDeviceSpaceTextureDecalFragmentProcessor>();
return dstdfp.fTextureSampler.getTexture() == fTextureSampler.getTexture() &&
return dstdfp.fTextureSampler.texture() == fTextureSampler.texture() &&
dstdfp.fDeviceSpaceOffset == fDeviceSpaceOffset &&
dstdfp.fTextureDomain == fTextureDomain;
}
void GrDeviceSpaceTextureDecalFragmentProcessor::onComputeInvariantOutput(
GrInvariantOutput* inout) const {
if (GrPixelConfigIsAlphaOnly(this->textureSampler(0).getTexture()->config())) {
if (GrPixelConfigIsAlphaOnly(this->textureSampler(0).texture()->config())) {
inout->mulByUnknownSingleComponent();
} else {
inout->mulByUnknownFourComponents();

View File

@ -154,8 +154,8 @@ void GrGLProgram::bindTextures(const GrProcessor& processor,
int* nextSamplerIdx) {
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()));
fGpu->bindTexture((*nextSamplerIdx)++, sampler.params(),
allowSRGBInputs, static_cast<GrGLTexture*>(sampler.texture()));
}
for (int i = 0; i < processor.numBuffers(); ++i) {
const GrBufferAccess& access = processor.bufferAccess(i);
@ -168,7 +168,7 @@ void GrGLProgram::generateMipmaps(const GrProcessor& processor,
bool allowSRGBInputs) {
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()));
fGpu->generateMipmaps(sampler.params(), allowSRGBInputs,
static_cast<GrGLTexture*>(sampler.texture()));
}
}

View File

@ -245,18 +245,18 @@ void GrGLSLProgramBuilder::emitSamplers(const GrProcessor& processor,
int numTextureSamplers = processor.numTextureSamplers();
for (int t = 0; t < numTextureSamplers; ++t) {
const GrProcessor::TextureSampler& sampler = processor.textureSampler(t);
GrSLType samplerType = sampler.getTexture()->texturePriv().samplerType();
GrSLType samplerType = sampler.texture()->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(sampler.getVisibility(),
this->addFeature(sampler.visibility(),
1 << GrGLSLShaderBuilder::kExternalTexture_GLSLPrivateFeature,
externalFeatureString);
}
name.printf("TextureSampler_%d", outTexSamplers->count());
this->emitSampler(samplerType, sampler.getTexture()->config(),
name.c_str(), sampler.getVisibility(), outTexSamplers);
this->emitSampler(samplerType, sampler.texture()->config(),
name.c_str(), sampler.visibility(), outTexSamplers);
}
if (int numBuffers = processor.numBuffers()) {

View File

@ -128,7 +128,7 @@ public:
void freeAll();
// if getTexture returns nullptr, the client must not try to use other functions on the
// if texture returns nullptr, the client must not try to use other functions on the
// GrBatchFontCache which use the atlas. This function *must* be called first, before other
// functions which use the atlas.
GrTexture* getTexture(GrMaskFormat format) {

View File

@ -428,7 +428,7 @@ sk_sp<GrVkPipelineState> GrVkGpuCommandBuffer::prepareDrawState(
static void prepare_sampled_images(const GrProcessor& processor, GrVkGpu* gpu) {
for (int i = 0; i < processor.numTextureSamplers(); ++i) {
const GrProcessor::TextureSampler& sampler = processor.textureSampler(i);
GrVkTexture* vkTexture = static_cast<GrVkTexture*>(sampler.getTexture());
GrVkTexture* vkTexture = static_cast<GrVkTexture*>(sampler.texture());
SkASSERT(vkTexture);
// We may need to resolve the texture first if it is also a render target
@ -437,7 +437,7 @@ static void prepare_sampled_images(const GrProcessor& processor, GrVkGpu* gpu) {
gpu->onResolveRenderTarget(texRT);
}
const GrTextureParams& params = sampler.getParams();
const GrTextureParams& params = sampler.params();
// Check if we need to regenerate any mip maps
if (GrTextureParams::kMipMap_FilterMode == params.filterMode()) {
if (vkTexture->texturePriv().mipMapsAreDirty()) {

View File

@ -310,9 +310,9 @@ void GrVkPipelineState::writeSamplers(
SkASSERT(fNumSamplers == textureBindings.count());
for (int i = 0; i < textureBindings.count(); ++i) {
const GrTextureParams& params = textureBindings[i]->getParams();
const GrTextureParams& params = textureBindings[i]->params();
GrVkTexture* texture = static_cast<GrVkTexture*>(textureBindings[i]->getTexture());
GrVkTexture* texture = static_cast<GrVkTexture*>(textureBindings[i]->texture());
fSamplers.push(gpu->resourceProvider().findOrCreateCompatibleSampler(params,
texture->texturePriv().maxMipMapLevel()));