aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar bsalomon <bsalomon@google.com>2016-05-05 14:40:03 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-05-05 14:40:03 -0700
commit4017007b288087c07c596baa9fe8ecf485bca1c3 (patch)
treeaf53b6d3b654cc3afd5c8b2be364de2ada777ec7 /src
parent6c0f5d91e20eacb031e0981ca9841e26d7636a6d (diff)
Fix unit test crash caused by OSMesa not supporting rendering to GL_ALPHA8
Diffstat (limited to 'src')
-rw-r--r--src/gpu/gl/GrGLCaps.cpp5
-rw-r--r--src/gpu/gl/GrGLUtil.cpp4
-rw-r--r--src/gpu/gl/GrGLUtil.h1
3 files changed, 8 insertions, 2 deletions
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index ebfbf6a065..9870a92c14 100644
--- a/src/gpu/gl/GrGLCaps.cpp
+++ b/src/gpu/gl/GrGLCaps.cpp
@@ -1586,8 +1586,11 @@ void GrGLCaps::initConfigTable(const GrGLContextInfo& ctxInfo, const GrGLInterfa
fConfigTable[kAlpha_8_GrPixelConfig].fFormats.fExternalType = GR_GL_UNSIGNED_BYTE;
fConfigTable[kAlpha_8_GrPixelConfig].fFormatType = kNormalizedFixedPoint_FormatType;
fConfigTable[kAlpha_8_GrPixelConfig].fFlags = ConfigInfo::kTextureable_Flag;
- if (this->textureRedSupport() || kDesktop_ARB_MSFBOType == this->msFBOType()) {
+ if (this->textureRedSupport() ||
+ (kDesktop_ARB_MSFBOType == this->msFBOType() &&
+ ctxInfo.renderer() != kOSMesa_GrGLRenderer)) {
// desktop ARB extension/3.0+ supports ALPHA8 as renderable.
+ // However, osmesa fails if it used even when GL_ARB_framebuffer_object is present.
// Core profile removes ALPHA8 support, but we should have chosen R8 in that case.
fConfigTable[kAlpha_8_GrPixelConfig].fFlags |= allRenderFlags;
}
diff --git a/src/gpu/gl/GrGLUtil.cpp b/src/gpu/gl/GrGLUtil.cpp
index a8c5425c64..46b58f1d76 100644
--- a/src/gpu/gl/GrGLUtil.cpp
+++ b/src/gpu/gl/GrGLUtil.cpp
@@ -127,7 +127,6 @@ void GrGLGetDriverInfo(GrGLStandard standard,
}
return;
}
-
int n = sscanf(versionString, "%d.%d Mesa %d.%d",
&major, &minor, &driverMajor, &driverMinor);
if (4 == n) {
@@ -304,6 +303,9 @@ GrGLRenderer GrGLGetRendererFromString(const char* rendererString) {
}
}
}
+ if (strcmp("Mesa Offscreen", rendererString)) {
+ return kOSMesa_GrGLRenderer;
+ }
}
return kOther_GrGLRenderer;
}
diff --git a/src/gpu/gl/GrGLUtil.h b/src/gpu/gl/GrGLUtil.h
index 2f023f97bb..c30ee93689 100644
--- a/src/gpu/gl/GrGLUtil.h
+++ b/src/gpu/gl/GrGLUtil.h
@@ -51,6 +51,7 @@ enum GrGLRenderer {
kPowerVRRogue_GrGLRenderer,
kAdreno3xx_GrGLRenderer,
kAdreno4xx_GrGLRenderer,
+ kOSMesa_GrGLRenderer,
kOther_GrGLRenderer
};