uint16_t GrVkSampler::GenerateKey(const GrTextureParams& params, uint32_t mipLevels) { const int kTileModeXShift = 2; const int kTileModeYShift = 4; const int kMipLevelShift = 6; uint16_t key = params.filterMode(); SkASSERT(params.filterMode() <= 3); key |= (params.getTileModeX() << kTileModeXShift); GR_STATIC_ASSERT(SkShader::kTileModeCount <= 4); key |= (params.getTileModeY() << kTileModeYShift); SkASSERT(mipLevels < 1024); key |= (mipLevels << kMipLevelShift); return key; }
GrSingleTextureEffect::GrSingleTextureEffect(GrProcessorDataManager* procDataManager, GrTexture* texture, const SkMatrix& m, const GrTextureParams& params, GrCoordSet coordSet) : fCoordTransform(coordSet, m, texture, params.filterMode()) , fTextureAccess(texture, params) { this->addCoordTransform(&fCoordTransform); this->addTextureAccess(&fTextureAccess); }
bool GrGpu::makeCopyForTextureParams(int width, int height, const GrTextureParams& textureParams, GrTextureProducer::CopyParams* copyParams) const { const GrCaps& caps = *this->caps(); if (textureParams.isTiled() && !caps.npotTextureTileSupport() && (!SkIsPow2(width) || !SkIsPow2(height))) { copyParams->fWidth = GrNextPow2(width); copyParams->fHeight = GrNextPow2(height); switch (textureParams.filterMode()) { case GrTextureParams::kNone_FilterMode: copyParams->fFilter = GrTextureParams::kNone_FilterMode; break; case GrTextureParams::kBilerp_FilterMode: case GrTextureParams::kMipMap_FilterMode: // We are only ever scaling up so no reason to ever indicate kMipMap. copyParams->fFilter = GrTextureParams::kBilerp_FilterMode; break; } return true; } return false; }