aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar brianosman <brianosman@google.com>2016-06-09 09:39:58 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-06-09 09:39:58 -0700
commit97e398d98928f9497063594ebe633efe2d0f4968 (patch)
tree4aa0f595c4cd2d8ea89013db5d2a127571247ab5
parent7ccbc1ad044e774750d44ec00ac9c37857b0c4af (diff)
Add control of manual mipmapping to GrContextOptions
-rw-r--r--include/gpu/GrContextOptions.h5
-rw-r--r--src/gpu/gl/GrGLCaps.cpp3
2 files changed, 7 insertions, 1 deletions
diff --git a/include/gpu/GrContextOptions.h b/include/gpu/GrContextOptions.h
index 7b62c94a44..5950000971 100644
--- a/include/gpu/GrContextOptions.h
+++ b/include/gpu/GrContextOptions.h
@@ -67,6 +67,11 @@ struct GrContextOptions {
/** Force us to do all swizzling manually in the shader and don't rely on extensions to do
swizzling. */
bool fUseShaderSwizzling;
+
+ /** Construct mipmaps manually, via repeated downsampling draw-calls. This is used when
+ the driver's implementation (glGenerateMipmap) contains bugs. This requires mipmap
+ level and LOD control (ie desktop or ES3). */
+ bool fDoManualMipmapping;
};
#endif
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index 260521187a..7ca2bf9a47 100644
--- a/src/gpu/gl/GrGLCaps.cpp
+++ b/src/gpu/gl/GrGLCaps.cpp
@@ -551,7 +551,8 @@ void GrGLCaps::init(const GrContextOptions& contextOptions,
// glGenerateMipmap. Our implementation requires mip-level sampling control. Additionally,
// it can be much slower (especially on mobile GPUs), so we opt-in only when necessary:
if (fMipMapLevelAndLodControlSupport &&
- ((kIntel_GrGLVendor == ctxInfo.vendor()) ||
+ (contextOptions.fDoManualMipmapping ||
+ (kIntel_GrGLVendor == ctxInfo.vendor()) ||
(kNVIDIA_GrGLDriver == ctxInfo.driver() && isMAC) ||
(kATI_GrGLVendor == ctxInfo.vendor()))) {
fDoManualMipmapping = true;