aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gpu/gl/GrGLCaps.cpp9
-rw-r--r--src/gpu/gl/GrGLCaps.h3
-rw-r--r--src/gpu/gl/GrGLGpu.cpp19
3 files changed, 23 insertions, 8 deletions
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index 132e9b217c..22aa13f0ab 100644
--- a/src/gpu/gl/GrGLCaps.cpp
+++ b/src/gpu/gl/GrGLCaps.cpp
@@ -52,6 +52,7 @@ GrGLCaps::GrGLCaps(const GrContextOptions& contextOptions,
fSRGBWriteControl = false;
fRGBA8888PixelsOpsAreSlow = false;
fPartialFBOReadIsSlow = false;
+ fMipMapLevelAndLodControlSupport = false;
fBlitFramebufferSupport = kNone_BlitFramebufferSupport;
@@ -246,6 +247,14 @@ void GrGLCaps::init(const GrContextOptions& contextOptions,
}
}
+ if (kGL_GrGLStandard == standard) {
+ fMipMapLevelAndLodControlSupport = true;
+ } else if (kGLES_GrGLStandard == standard) {
+ if (version >= GR_GL_VER(3,0)) {
+ fMipMapLevelAndLodControlSupport = true;
+ }
+ }
+
#ifdef SK_BUILD_FOR_WIN
// We're assuming that on Windows Chromium we're using ANGLE.
bool isANGLE = kANGLE_GrGLDriver == ctxInfo.driver() ||
diff --git a/src/gpu/gl/GrGLCaps.h b/src/gpu/gl/GrGLCaps.h
index 724bab6258..06deaafae1 100644
--- a/src/gpu/gl/GrGLCaps.h
+++ b/src/gpu/gl/GrGLCaps.h
@@ -342,6 +342,8 @@ public:
*/
bool srgbWriteControl() const { return fSRGBWriteControl; }
+ bool mipMapLevelAndLodControlSupport() const { return fMipMapLevelAndLodControlSupport; }
+
/**
* Returns a string containing the caps info.
*/
@@ -418,6 +420,7 @@ private:
bool fExternalTextureSupport : 1;
bool fRectangleTextureSupport : 1;
bool fTextureSwizzleSupport : 1;
+ bool fMipMapLevelAndLodControlSupport : 1;
BlitFramebufferSupport fBlitFramebufferSupport;
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index 29841331c0..dc50c1429c 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -3344,14 +3344,17 @@ void GrGLGpu::bindTexture(int unitIdx, const GrTextureParams& params, GrGLTextur
GL_CALL(TexParameteri(target, GR_GL_TEXTURE_MIN_FILTER, newTexParams.fMinFilter));
}
if (setAll || newTexParams.fMaxMipMapLevel != oldTexParams.fMaxMipMapLevel) {
- if (newTexParams.fMaxMipMapLevel != 0) {
- this->setTextureUnit(unitIdx);
- GL_CALL(TexParameteri(target, GR_GL_TEXTURE_MIN_LOD, 0));
- GL_CALL(TexParameteri(target, GR_GL_TEXTURE_BASE_LEVEL, 0));
- GL_CALL(TexParameteri(target, GR_GL_TEXTURE_MAX_LOD,
- newTexParams.fMaxMipMapLevel));
- GL_CALL(TexParameteri(target, GR_GL_TEXTURE_MAX_LEVEL,
- newTexParams.fMaxMipMapLevel));
+ // These are not supported in ES2 contexts
+ if (this->glCaps().mipMapLevelAndLodControlSupport()) {
+ if (newTexParams.fMaxMipMapLevel != 0) {
+ this->setTextureUnit(unitIdx);
+ GL_CALL(TexParameteri(target, GR_GL_TEXTURE_MIN_LOD, 0));
+ GL_CALL(TexParameteri(target, GR_GL_TEXTURE_BASE_LEVEL, 0));
+ GL_CALL(TexParameteri(target, GR_GL_TEXTURE_MAX_LOD,
+ newTexParams.fMaxMipMapLevel));
+ GL_CALL(TexParameteri(target, GR_GL_TEXTURE_MAX_LEVEL,
+ newTexParams.fMaxMipMapLevel));
+ }
}
}
if (setAll || newTexParams.fWrapS != oldTexParams.fWrapS) {