Expand GrTextureProxy to handle highestFilterMode
Once TextureProxies aren't instantiated in the TextureSamplers, the they will need to be able to supply this information. split out of: https://skia-review.googlesource.com/c/10484/ (Omnibus: Push instantiation of GrTextures later (post TextureSampler)) Change-Id: I66555c0746131f565862f7a30d54ff1d458d2062 Reviewed-on: https://skia-review.googlesource.com/15819 Commit-Queue: Robert Phillips <robertphillips@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
This commit is contained in:
parent
26368c3300
commit
49081d13ba
@ -26,6 +26,8 @@ public:
|
||||
|
||||
void setMipColorMode(SkDestinationSurfaceColorMode colorMode);
|
||||
|
||||
GrSamplerParams::FilterMode highestFilterMode() const;
|
||||
|
||||
protected:
|
||||
friend class GrSurfaceProxy; // for ctors
|
||||
|
||||
|
@ -245,8 +245,8 @@ void GrResourceIOProcessor::TextureSampler::reset(GrResourceProvider* resourcePr
|
||||
GrTexture* texture = proxy->instantiate(resourceProvider);
|
||||
if (texture) {
|
||||
fTexture.set(SkRef(texture), kRead_GrIOType);
|
||||
fParams.setFilterMode(SkTMin(params.filterMode(),
|
||||
texture->texturePriv().highestFilterMode()));
|
||||
SkASSERT(texture->texturePriv().highestFilterMode() == proxy->highestFilterMode());
|
||||
fParams.setFilterMode(SkTMin(params.filterMode(), proxy->highestFilterMode()));
|
||||
}
|
||||
|
||||
fVisibility = visibility;
|
||||
@ -262,7 +262,8 @@ void GrResourceIOProcessor::TextureSampler::reset(GrResourceProvider* resourcePr
|
||||
GrTexture* texture = proxy->instantiate(resourceProvider);
|
||||
if (texture) {
|
||||
fTexture.set(SkRef(texture), kRead_GrIOType);
|
||||
filterMode = SkTMin(filterMode, texture->texturePriv().highestFilterMode());
|
||||
SkASSERT(texture->texturePriv().highestFilterMode() == proxy->highestFilterMode());
|
||||
filterMode = SkTMin(filterMode, proxy->highestFilterMode());
|
||||
}
|
||||
|
||||
fParams.reset(tileXAndY, filterMode);
|
||||
|
@ -39,6 +39,23 @@ void GrTextureProxy::setMipColorMode(SkDestinationSurfaceColorMode colorMode) {
|
||||
fMipColorMode = colorMode;
|
||||
}
|
||||
|
||||
// This method parallels the highest_filter_mode functions in GrGLTexture & GrVkTexture.
|
||||
GrSamplerParams::FilterMode GrTextureProxy::highestFilterMode() const {
|
||||
if (fTarget) {
|
||||
return fTarget->asTexture()->texturePriv().highestFilterMode();
|
||||
}
|
||||
|
||||
if (GrPixelConfigIsSint(this->config())) {
|
||||
// We only ever want to nearest-neighbor sample signed int textures.
|
||||
return GrSamplerParams::kNone_FilterMode;
|
||||
}
|
||||
|
||||
// In OpenGL, GR_GL_TEXTURE_RECTANGLE and GR_GL_TEXTURE_EXTERNAL (which have a highest filter
|
||||
// mode of bilerp) can only be created via wrapping.
|
||||
|
||||
return GrSamplerParams::kMipMap_FilterMode;
|
||||
}
|
||||
|
||||
size_t GrTextureProxy::onGpuMemorySize() const {
|
||||
if (fTarget) {
|
||||
return fTarget->gpuMemorySize();
|
||||
|
@ -16,6 +16,15 @@
|
||||
|
||||
#define VK_CALL(GPU, X) GR_VK_CALL(GPU->vkInterface(), X)
|
||||
|
||||
// This method parallels GrTextureProxy::highestFilterMode
|
||||
static inline GrSamplerParams::FilterMode highest_filter_mode(GrPixelConfig config) {
|
||||
if (GrPixelConfigIsSint(config)) {
|
||||
// We only ever want to nearest-neighbor sample signed int textures.
|
||||
return GrSamplerParams::kNone_FilterMode;
|
||||
}
|
||||
return GrSamplerParams::kMipMap_FilterMode;
|
||||
}
|
||||
|
||||
// Because this class is virtually derived from GrSurface we must explicitly call its constructor.
|
||||
GrVkTexture::GrVkTexture(GrVkGpu* gpu,
|
||||
SkBudgeted budgeted,
|
||||
@ -24,7 +33,7 @@ GrVkTexture::GrVkTexture(GrVkGpu* gpu,
|
||||
const GrVkImageView* view)
|
||||
: GrSurface(gpu, desc)
|
||||
, GrVkImage(info, GrVkImage::kNot_Wrapped)
|
||||
, INHERITED(gpu, desc, kTexture2DSampler_GrSLType, GrSamplerParams::kMipMap_FilterMode,
|
||||
, INHERITED(gpu, desc, kTexture2DSampler_GrSLType, highest_filter_mode(desc.fConfig),
|
||||
desc.fIsMipMapped)
|
||||
, fTextureView(view)
|
||||
, fLinearTextureView(nullptr) {
|
||||
@ -39,7 +48,7 @@ GrVkTexture::GrVkTexture(GrVkGpu* gpu,
|
||||
GrVkImage::Wrapped wrapped)
|
||||
: GrSurface(gpu, desc)
|
||||
, GrVkImage(info, wrapped)
|
||||
, INHERITED(gpu, desc, kTexture2DSampler_GrSLType, GrSamplerParams::kMipMap_FilterMode,
|
||||
, INHERITED(gpu, desc, kTexture2DSampler_GrSLType, highest_filter_mode(desc.fConfig),
|
||||
desc.fIsMipMapped)
|
||||
, fTextureView(view)
|
||||
, fLinearTextureView(nullptr) {
|
||||
@ -54,7 +63,7 @@ GrVkTexture::GrVkTexture(GrVkGpu* gpu,
|
||||
GrVkImage::Wrapped wrapped)
|
||||
: GrSurface(gpu, desc)
|
||||
, GrVkImage(info, wrapped)
|
||||
, INHERITED(gpu, desc, kTexture2DSampler_GrSLType, GrSamplerParams::kMipMap_FilterMode,
|
||||
, INHERITED(gpu, desc, kTexture2DSampler_GrSLType, highest_filter_mode(desc.fConfig),
|
||||
desc.fIsMipMapped)
|
||||
, fTextureView(view)
|
||||
, fLinearTextureView(nullptr) {
|
||||
|
Loading…
Reference in New Issue
Block a user