summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gpu/GrDrawTarget.cpp3
-rw-r--r--gpu/GrDrawTargetCaps.h4
-rw-r--r--gpu/gl/GrGLCaps.cpp15
-rw-r--r--gpu/gl/GrGpuGL.cpp11
4 files changed, 23 insertions, 10 deletions
diff --git a/gpu/GrDrawTarget.cpp b/gpu/GrDrawTarget.cpp
index 0b4d96af..38a5a60c 100644
--- a/gpu/GrDrawTarget.cpp
+++ b/gpu/GrDrawTarget.cpp
@@ -962,6 +962,7 @@ void GrDrawTarget::initCopySurfaceDstDesc(const GrSurface* src, GrTextureDesc* d
void GrDrawTargetCaps::reset() {
f8BitPaletteSupport = false;
+ fMipMapSupport = false;
fNPOTTextureTileSupport = false;
fTwoSidedStencilSupport = false;
fStencilWrapOpsSupport = false;
@@ -983,6 +984,7 @@ void GrDrawTargetCaps::reset() {
GrDrawTargetCaps& GrDrawTargetCaps::operator=(const GrDrawTargetCaps& other) {
f8BitPaletteSupport = other.f8BitPaletteSupport;
+ fMipMapSupport = other.fMipMapSupport;
fNPOTTextureTileSupport = other.fNPOTTextureTileSupport;
fTwoSidedStencilSupport = other.fTwoSidedStencilSupport;
fStencilWrapOpsSupport = other.fStencilWrapOpsSupport;
@@ -1008,6 +1010,7 @@ SkString GrDrawTargetCaps::dump() const {
SkString r;
static const char* gNY[] = {"NO", "YES"};
r.appendf("8 Bit Palette Support : %s\n", gNY[f8BitPaletteSupport]);
+ r.appendf("MIP Map Support : %s\n", gNY[fMipMapSupport]);
r.appendf("NPOT Texture Tile Support : %s\n", gNY[fNPOTTextureTileSupport]);
r.appendf("Two Sided Stencil Support : %s\n", gNY[fTwoSidedStencilSupport]);
r.appendf("Stencil Wrap Ops Support : %s\n", gNY[fStencilWrapOpsSupport]);
diff --git a/gpu/GrDrawTargetCaps.h b/gpu/GrDrawTargetCaps.h
index e597e099..b316e491 100644
--- a/gpu/GrDrawTargetCaps.h
+++ b/gpu/GrDrawTargetCaps.h
@@ -28,6 +28,9 @@ public:
bool eightBitPaletteSupport() const { return f8BitPaletteSupport; }
bool npotTextureTileSupport() const { return fNPOTTextureTileSupport; }
+ /** To avoid as-yet-unnecessary complexity we don't allow any partial support of MIP Maps (e.g.
+ only for POT textures) */
+ bool mipMapSupport() const { return fMipMapSupport; }
bool twoSidedStencilSupport() const { return fTwoSidedStencilSupport; }
bool stencilWrapOpsSupport() const { return fStencilWrapOpsSupport; }
bool hwAALineSupport() const { return fHWAALineSupport; }
@@ -57,6 +60,7 @@ public:
protected:
bool f8BitPaletteSupport : 1;
bool fNPOTTextureTileSupport : 1;
+ bool fMipMapSupport : 1;
bool fTwoSidedStencilSupport : 1;
bool fStencilWrapOpsSupport : 1;
bool fHWAALineSupport : 1;
diff --git a/gpu/gl/GrGLCaps.cpp b/gpu/gl/GrGLCaps.cpp
index 8d8c0225..8833a05a 100644
--- a/gpu/gl/GrGLCaps.cpp
+++ b/gpu/gl/GrGLCaps.cpp
@@ -285,17 +285,20 @@ void GrGLCaps::init(const GrGLContextInfo& ctxInfo, const GrGLInterface* gli) {
}
if (kDesktop_GrGLBinding == binding) {
- if (ctxInfo.version() >= GR_GL_VER(2,0) ||
- ctxInfo.hasExtension("GL_ARB_texture_non_power_of_two")) {
- fNPOTTextureTileSupport = true;
- } else {
- fNPOTTextureTileSupport = false;
- }
+ SkASSERT(ctxInfo.version() >= GR_GL_VER(2,0) ||
+ ctxInfo.hasExtension("GL_ARB_texture_non_power_of_two"));
+ fNPOTTextureTileSupport = true;
+ fMipMapSupport = true;
} else {
// Unextended ES2 supports NPOT textures with clamp_to_edge and non-mip filters only
// ES3 has no limitations.
fNPOTTextureTileSupport = ctxInfo.version() >= GR_GL_VER(3,0) ||
ctxInfo.hasExtension("GL_OES_texture_npot");
+ // ES2 supports MIP mapping for POT textures but our caps don't allow for limited MIP
+ // support. The OES extension or ES 3.0 allow for MIPS on NPOT textures. So, apparently,
+ // does the undocumented GL_IMG_texture_npot extension. This extension does not seem to
+ // to alllow arbitrary wrap modes, however.
+ fMipMapSupport = fNPOTTextureTileSupport || ctxInfo.hasExtension("GL_IMG_texture_npot");
}
fHWAALineSupport = (kDesktop_GrGLBinding == binding);
diff --git a/gpu/gl/GrGpuGL.cpp b/gpu/gl/GrGpuGL.cpp
index 4b5221c3..7ab4bc1f 100644
--- a/gpu/gl/GrGpuGL.cpp
+++ b/gpu/gl/GrGpuGL.cpp
@@ -2028,11 +2028,14 @@ void GrGpuGL::bindTexture(int unitIdx, const GrTextureParams& params, GrGLTextur
GR_GL_LINEAR,
GR_GL_LINEAR
};
- newTexParams.fMinFilter = glMinFilterModes[params.filterMode()];
- newTexParams.fMagFilter = glMagFilterModes[params.filterMode()];
+ GrTextureParams::FilterMode filterMode = params.filterMode();
+ if (!this->caps()->mipMapSupport() && GrTextureParams::kMipMap_FilterMode == filterMode) {
+ filterMode = GrTextureParams::kBilerp_FilterMode;
+ }
+ newTexParams.fMinFilter = glMinFilterModes[filterMode];
+ newTexParams.fMagFilter = glMagFilterModes[filterMode];
- if (params.filterMode() == GrTextureParams::kMipMap_FilterMode &&
- texture->mipMapsAreDirty()) {
+ if (GrTextureParams::kMipMap_FilterMode == filterMode && texture->mipMapsAreDirty()) {
// GL_CALL(Hint(GR_GL_GENERATE_MIPMAP_HINT,GR_GL_NICEST));
GL_CALL(GenerateMipmap(GR_GL_TEXTURE_2D));
texture->dirtyMipMaps(false);