Use GrTextureType to determine highest supported filter
Change-Id: I8deaa5dea45a2dcc743f781e9ef8f624da1d16c0 Reviewed-on: https://skia-review.googlesource.com/144786 Commit-Queue: Brian Salomon <bsalomon@google.com> Commit-Queue: Greg Daniel <egdaniel@google.com> Auto-Submit: Brian Salomon <bsalomon@google.com> Reviewed-by: Greg Daniel <egdaniel@google.com>
This commit is contained in:
parent
972eba3c5c
commit
e632dfcb36
@ -65,8 +65,7 @@ public:
|
||||
inline const GrTexturePriv texturePriv() const;
|
||||
|
||||
protected:
|
||||
GrTexture(GrGpu*, const GrSurfaceDesc&, GrTextureType, GrSamplerState::Filter highestFilterMode,
|
||||
GrMipMapsStatus);
|
||||
GrTexture(GrGpu*, const GrSurfaceDesc&, GrTextureType, GrMipMapsStatus);
|
||||
|
||||
virtual bool onStealBackendTexture(GrBackendTexture*, SkImage::BackendTextureReleaseProc*) = 0;
|
||||
|
||||
@ -77,7 +76,6 @@ private:
|
||||
void markMipMapsClean();
|
||||
|
||||
GrTextureType fTextureType;
|
||||
GrSamplerState::Filter fHighestFilterMode;
|
||||
GrMipMapsStatus fMipMapsStatus;
|
||||
int fMaxMipMapLevel;
|
||||
friend class GrTexturePriv;
|
||||
|
@ -36,11 +36,8 @@ size_t GrTexture::onGpuMemorySize() const {
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
GrTexture::GrTexture(GrGpu* gpu, const GrSurfaceDesc& desc, GrTextureType textureType,
|
||||
GrSamplerState::Filter highestFilterMode, GrMipMapsStatus mipMapsStatus)
|
||||
: INHERITED(gpu, desc)
|
||||
, fTextureType(textureType)
|
||||
, fHighestFilterMode(highestFilterMode)
|
||||
, fMipMapsStatus(mipMapsStatus) {
|
||||
GrMipMapsStatus mipMapsStatus)
|
||||
: INHERITED(gpu, desc), fTextureType(textureType), fMipMapsStatus(mipMapsStatus) {
|
||||
if (GrMipMapsStatus::kNotAllocated == fMipMapsStatus) {
|
||||
fMaxMipMapLevel = 0;
|
||||
} else {
|
||||
|
@ -44,9 +44,11 @@ public:
|
||||
bool hasRestrictedSampling() const {
|
||||
return GrTextureTypeHasRestrictedSampling(this->textureType());
|
||||
}
|
||||
|
||||
/** The filter used is clamped to this value in GrProcessor::TextureSampler. */
|
||||
GrSamplerState::Filter highestFilterMode() const { return fTexture->fHighestFilterMode; }
|
||||
/** Filtering is clamped to this value. */
|
||||
GrSamplerState::Filter highestFilterMode() const {
|
||||
return this->hasRestrictedSampling() ? GrSamplerState::Filter::kBilerp
|
||||
: GrSamplerState::Filter::kMipMap;
|
||||
}
|
||||
|
||||
static void ComputeScratchKey(const GrSurfaceDesc&, GrScratchKey*);
|
||||
static void ComputeScratchKey(GrPixelConfig config, int width, int height,
|
||||
|
@ -119,16 +119,9 @@ void GrTextureProxyPriv::resetDeferredUploader() {
|
||||
fTextureProxy->fDeferredUploader.reset();
|
||||
}
|
||||
|
||||
// This method parallels the highest_filter_mode functions in GrGLTexture & GrVkTexture.
|
||||
GrSamplerState::Filter GrTextureProxy::highestFilterMode() const {
|
||||
if (fTarget) {
|
||||
return fTarget->asTexture()->texturePriv().highestFilterMode();
|
||||
}
|
||||
|
||||
// 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 GrSamplerState::Filter::kMipMap;
|
||||
return this->hasRestrictedSampling() ? GrSamplerState::Filter::kBilerp
|
||||
: GrSamplerState::Filter::kMipMap;
|
||||
}
|
||||
|
||||
GrMipMapped GrTextureProxy::mipMapped() const {
|
||||
|
@ -41,22 +41,11 @@ static inline GrGLenum target_from_texture_type(GrTextureType type) {
|
||||
return GR_GL_TEXTURE_2D;
|
||||
}
|
||||
|
||||
// This method parallels GrTextureProxy::highestFilterMode
|
||||
static inline GrSamplerState::Filter highest_filter_mode(const GrGLTexture::IDDesc& idDesc,
|
||||
GrPixelConfig config) {
|
||||
if (idDesc.fInfo.fTarget == GR_GL_TEXTURE_RECTANGLE ||
|
||||
idDesc.fInfo.fTarget == GR_GL_TEXTURE_EXTERNAL) {
|
||||
return GrSamplerState::Filter::kBilerp;
|
||||
}
|
||||
return GrSamplerState::Filter::kMipMap;
|
||||
}
|
||||
|
||||
// Because this class is virtually derived from GrSurface we must explicitly call its constructor.
|
||||
GrGLTexture::GrGLTexture(GrGLGpu* gpu, SkBudgeted budgeted, const GrSurfaceDesc& desc,
|
||||
const IDDesc& idDesc, GrMipMapsStatus mipMapsStatus)
|
||||
: GrSurface(gpu, desc)
|
||||
, INHERITED(gpu, desc, TextureTypeFromTarget(idDesc.fInfo.fTarget),
|
||||
highest_filter_mode(idDesc, desc.fConfig), mipMapsStatus) {
|
||||
, INHERITED(gpu, desc, TextureTypeFromTarget(idDesc.fInfo.fTarget), mipMapsStatus) {
|
||||
this->init(desc, idDesc);
|
||||
this->registerWithCache(budgeted);
|
||||
}
|
||||
@ -64,8 +53,7 @@ GrGLTexture::GrGLTexture(GrGLGpu* gpu, SkBudgeted budgeted, const GrSurfaceDesc&
|
||||
GrGLTexture::GrGLTexture(GrGLGpu* gpu, Wrapped, const GrSurfaceDesc& desc,
|
||||
GrMipMapsStatus mipMapsStatus, const IDDesc& idDesc)
|
||||
: GrSurface(gpu, desc)
|
||||
, INHERITED(gpu, desc, TextureTypeFromTarget(idDesc.fInfo.fTarget),
|
||||
highest_filter_mode(idDesc, desc.fConfig), mipMapsStatus) {
|
||||
, INHERITED(gpu, desc, TextureTypeFromTarget(idDesc.fInfo.fTarget), mipMapsStatus) {
|
||||
this->init(desc, idDesc);
|
||||
this->registerWithCacheWrapped();
|
||||
}
|
||||
@ -73,8 +61,7 @@ GrGLTexture::GrGLTexture(GrGLGpu* gpu, Wrapped, const GrSurfaceDesc& desc,
|
||||
GrGLTexture::GrGLTexture(GrGLGpu* gpu, const GrSurfaceDesc& desc, const IDDesc& idDesc,
|
||||
GrMipMapsStatus mipMapsStatus)
|
||||
: GrSurface(gpu, desc)
|
||||
, INHERITED(gpu, desc, TextureTypeFromTarget(idDesc.fInfo.fTarget),
|
||||
highest_filter_mode(idDesc, desc.fConfig), mipMapsStatus) {
|
||||
, INHERITED(gpu, desc, TextureTypeFromTarget(idDesc.fInfo.fTarget), mipMapsStatus) {
|
||||
this->init(desc, idDesc);
|
||||
}
|
||||
|
||||
|
@ -46,8 +46,7 @@ protected:
|
||||
GrMockTexture(GrMockGpu* gpu, const GrSurfaceDesc& desc, GrMipMapsStatus mipMapsStatus,
|
||||
const GrMockTextureInfo& info)
|
||||
: GrSurface(gpu, desc)
|
||||
, INHERITED(gpu, desc, GrTextureType::k2D, GrSamplerState::Filter::kMipMap,
|
||||
mipMapsStatus)
|
||||
, INHERITED(gpu, desc, GrTextureType::k2D, mipMapsStatus)
|
||||
, fInfo(info) {}
|
||||
|
||||
void onRelease() override {
|
||||
|
@ -11,18 +11,13 @@
|
||||
#include "GrMtlUtil.h"
|
||||
#include "GrTexturePriv.h"
|
||||
|
||||
// This method parallels GrTextureProxy::highestFilterMode
|
||||
static inline GrSamplerState::Filter highest_filter_mode(GrPixelConfig config) {
|
||||
return GrSamplerState::Filter::kMipMap;
|
||||
}
|
||||
|
||||
GrMtlTexture::GrMtlTexture(GrMtlGpu* gpu,
|
||||
SkBudgeted budgeted,
|
||||
const GrSurfaceDesc& desc,
|
||||
id<MTLTexture> texture,
|
||||
GrMipMapsStatus mipMapsStatus)
|
||||
: GrSurface(gpu, desc)
|
||||
, INHERITED(gpu, desc, GrTextureType::k2D, highest_filter_mode(desc.fConfig), mipMapsStatus)
|
||||
, INHERITED(gpu, desc, GrTextureType::k2D, mipMapsStatus)
|
||||
, fTexture(texture) {
|
||||
SkASSERT((GrMipMapsStatus::kNotAllocated == mipMapsStatus) == (1 == texture.mipmapLevelCount));
|
||||
this->registerWithCache(budgeted);
|
||||
@ -34,7 +29,7 @@ GrMtlTexture::GrMtlTexture(GrMtlGpu* gpu,
|
||||
id<MTLTexture> texture,
|
||||
GrMipMapsStatus mipMapsStatus)
|
||||
: GrSurface(gpu, desc)
|
||||
, INHERITED(gpu, desc, GrTextureType::k2D, highest_filter_mode(desc.fConfig), mipMapsStatus)
|
||||
, INHERITED(gpu, desc, GrTextureType::k2D, mipMapsStatus)
|
||||
, fTexture(texture) {
|
||||
SkASSERT((GrMipMapsStatus::kNotAllocated == mipMapsStatus) == (1 == texture.mipmapLevelCount));
|
||||
this->registerWithCacheWrapped();
|
||||
@ -45,7 +40,7 @@ GrMtlTexture::GrMtlTexture(GrMtlGpu* gpu,
|
||||
id<MTLTexture> texture,
|
||||
GrMipMapsStatus mipMapsStatus)
|
||||
: GrSurface(gpu, desc)
|
||||
, INHERITED(gpu, desc, GrTextureType::k2D, highest_filter_mode(desc.fConfig), mipMapsStatus)
|
||||
, INHERITED(gpu, desc, GrTextureType::k2D, mipMapsStatus)
|
||||
, fTexture(texture) {
|
||||
SkASSERT((GrMipMapsStatus::kNotAllocated == mipMapsStatus) == (1 == texture.mipmapLevelCount));
|
||||
}
|
||||
|
@ -17,11 +17,6 @@
|
||||
|
||||
#define VK_CALL(GPU, X) GR_VK_CALL(GPU->vkInterface(), X)
|
||||
|
||||
// This method parallels GrTextureProxy::highestFilterMode
|
||||
static inline GrSamplerState::Filter highest_filter_mode(GrPixelConfig config) {
|
||||
return GrSamplerState::Filter::kMipMap;
|
||||
}
|
||||
|
||||
// Because this class is virtually derived from GrSurface we must explicitly call its constructor.
|
||||
GrVkTexture::GrVkTexture(GrVkGpu* gpu,
|
||||
SkBudgeted budgeted,
|
||||
@ -32,7 +27,7 @@ GrVkTexture::GrVkTexture(GrVkGpu* gpu,
|
||||
GrMipMapsStatus mipMapsStatus)
|
||||
: GrSurface(gpu, desc)
|
||||
, GrVkImage(info, std::move(layout), GrBackendObjectOwnership::kOwned)
|
||||
, INHERITED(gpu, desc, GrTextureType::k2D, highest_filter_mode(desc.fConfig), mipMapsStatus)
|
||||
, INHERITED(gpu, desc, GrTextureType::k2D, mipMapsStatus)
|
||||
, fTextureView(view) {
|
||||
SkASSERT((GrMipMapsStatus::kNotAllocated == mipMapsStatus) == (1 == info.fLevelCount));
|
||||
this->registerWithCache(budgeted);
|
||||
@ -48,7 +43,7 @@ GrVkTexture::GrVkTexture(GrVkGpu* gpu,
|
||||
GrBackendObjectOwnership ownership)
|
||||
: GrSurface(gpu, desc)
|
||||
, GrVkImage(info, std::move(layout), ownership)
|
||||
, INHERITED(gpu, desc, GrTextureType::k2D, highest_filter_mode(desc.fConfig), mipMapsStatus)
|
||||
, INHERITED(gpu, desc, GrTextureType::k2D, mipMapsStatus)
|
||||
, fTextureView(view) {
|
||||
SkASSERT((GrMipMapsStatus::kNotAllocated == mipMapsStatus) == (1 == info.fLevelCount));
|
||||
this->registerWithCacheWrapped();
|
||||
@ -64,7 +59,7 @@ GrVkTexture::GrVkTexture(GrVkGpu* gpu,
|
||||
GrBackendObjectOwnership ownership)
|
||||
: GrSurface(gpu, desc)
|
||||
, GrVkImage(info, layout, ownership)
|
||||
, INHERITED(gpu, desc, GrTextureType::k2D, highest_filter_mode(desc.fConfig), mipMapsStatus)
|
||||
, INHERITED(gpu, desc, GrTextureType::k2D, mipMapsStatus)
|
||||
, fTextureView(view) {
|
||||
SkASSERT((GrMipMapsStatus::kNotAllocated == mipMapsStatus) == (1 == info.fLevelCount));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user