Suppress rendererability of kAlpha8 GL_CHROMIUM_framebuffer_multisample for ANGLE D3D9

For ANGLE D3D9 ES2 we're seeing GL_CHROMIUM_framebuffer_multisample but not GL_ANGLE_framebuffer_multisample.
The same occurs for ANGLE D3D11 ES2 but kAlpha8 is renderable in that case.

Bug: 730082
Change-Id: I7eda844b0ad48150d19406517d1dfbe453e9e478
Reviewed-on: https://skia-review.googlesource.com/18980
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
This commit is contained in:
Robert Phillips 2017-06-07 12:04:18 -04:00 committed by Skia Commit-Bot
parent b246b9407f
commit 5ab7276a35
3 changed files with 33 additions and 24 deletions

View File

@ -33,6 +33,7 @@ GrGLCaps::GrGLCaps(const GrContextOptions& contextOptions,
fPackFlipYSupport = false;
fTextureUsageSupport = false;
fTextureRedSupport = false;
fAlpha8IsRenderable = false;
fImagingSupport = false;
fVertexArrayObjectSupport = false;
fDirectStateAccessSupport = false;
@ -1042,11 +1043,13 @@ void GrGLCaps::initFSAASupport(const GrContextOptions& contextOptions, const GrG
fMSFBOType = kES_IMG_MsToTexture_MSFBOType;
} else if (fUsesMixedSamples) {
fMSFBOType = kMixedSamples_MSFBOType;
} else if (ctxInfo.version() >= GR_GL_VER(3,0) ||
ctxInfo.hasExtension("GL_CHROMIUM_framebuffer_multisample")) {
} else if (ctxInfo.version() >= GR_GL_VER(3,0)) {
fMSFBOType = kStandard_MSFBOType;
fAlpha8IsRenderable = true;
} else if (ctxInfo.hasExtension("GL_CHROMIUM_framebuffer_multisample")) {
fMSFBOType = kStandard_MSFBOType;
} else if (ctxInfo.hasExtension("GL_ANGLE_framebuffer_multisample")) {
fMSFBOType = kEXT_MSFBOType;
fMSFBOType = kStandard_MSFBOType;
} else if (ctxInfo.hasExtension("GL_APPLE_framebuffer_multisample")) {
fMSFBOType = kES_Apple_MSFBOType;
}
@ -1055,10 +1058,18 @@ void GrGLCaps::initFSAASupport(const GrContextOptions& contextOptions, const GrG
fMSFBOType = kMixedSamples_MSFBOType;
} else if (ctxInfo.version() >= GR_GL_VER(3,0) ||
ctxInfo.hasExtension("GL_ARB_framebuffer_object")) {
fMSFBOType = kStandard_MSFBOType;
if (!fIsCoreProfile && ctxInfo.renderer() != kOSMesa_GrGLRenderer) {
// Core profile removes ALPHA8 support.
// OpenGL 3.0+ (and GL_ARB_framebuffer_object) supports ALPHA8 as renderable.
// However, osmesa fails if it is used even when GL_ARB_framebuffer_object is
// present.
fAlpha8IsRenderable = true;
}
} else if (ctxInfo.hasExtension("GL_EXT_framebuffer_multisample") &&
ctxInfo.hasExtension("GL_EXT_framebuffer_blit")) {
fMSFBOType = kEXT_MSFBOType;
fMSFBOType = kStandard_MSFBOType;
}
}
@ -1200,7 +1211,6 @@ SkString GrGLCaps::dump() const {
static const char* kMSFBOExtStr[] = {
"None",
"EXT",
"Standard",
"Apple",
"IMG MS To Texture",
@ -1208,12 +1218,11 @@ SkString GrGLCaps::dump() const {
"MixedSamples",
};
GR_STATIC_ASSERT(0 == kNone_MSFBOType);
GR_STATIC_ASSERT(1 == kEXT_MSFBOType);
GR_STATIC_ASSERT(2 == kStandard_MSFBOType);
GR_STATIC_ASSERT(3 == kES_Apple_MSFBOType);
GR_STATIC_ASSERT(4 == kES_IMG_MsToTexture_MSFBOType);
GR_STATIC_ASSERT(5 == kES_EXT_MsToTexture_MSFBOType);
GR_STATIC_ASSERT(6 == kMixedSamples_MSFBOType);
GR_STATIC_ASSERT(1 == kStandard_MSFBOType);
GR_STATIC_ASSERT(2 == kES_Apple_MSFBOType);
GR_STATIC_ASSERT(3 == kES_IMG_MsToTexture_MSFBOType);
GR_STATIC_ASSERT(4 == kES_EXT_MsToTexture_MSFBOType);
GR_STATIC_ASSERT(5 == kMixedSamples_MSFBOType);
GR_STATIC_ASSERT(SK_ARRAY_COUNT(kMSFBOExtStr) == kLast_MSFBOType + 1);
static const char* kInvalidateFBTypeStr[] = {
@ -1250,6 +1259,7 @@ SkString GrGLCaps::dump() const {
r.appendf("Texture Usage support: %s\n", (fTextureUsageSupport ? "YES": "NO"));
r.appendf("GL_R support: %s\n", (fTextureRedSupport ? "YES": "NO"));
r.appendf("Alpha8 is renderable: %s\n", (fAlpha8IsRenderable ? "YES" : "NO"));
r.appendf("GL_ARB_imaging support: %s\n", (fImagingSupport ? "YES": "NO"));
r.appendf("Vertex array object support: %s\n", (fVertexArrayObjectSupport ? "YES": "NO"));
r.appendf("Direct state access support: %s\n", (fDirectStateAccessSupport ? "YES": "NO"));
@ -1799,20 +1809,18 @@ void GrGLCaps::initConfigTable(const GrContextOptions& contextOptions,
if (texelBufferSupport) {
fConfigTable[kAlpha_8_GrPixelConfig].fFlags |= ConfigInfo::kCanUseWithTexelBuffer_Flag;
}
fConfigTable[kAlpha_8_GrPixelConfig].fFlags |= allRenderFlags;
} else {
fConfigTable[kAlpha_8_GrPixelConfig].fFormats.fBaseInternalFormat = GR_GL_ALPHA;
fConfigTable[kAlpha_8_GrPixelConfig].fFormats.fSizedInternalFormat = GR_GL_ALPHA8;
fConfigTable[kAlpha_8_GrPixelConfig].fFormats.fExternalFormat[kOther_ExternalFormatUsage] =
GR_GL_ALPHA;
fConfigTable[kAlpha_8_GrPixelConfig].fSwizzle = GrSwizzle::AAAA();
if (fAlpha8IsRenderable) {
fConfigTable[kAlpha_8_GrPixelConfig].fFlags |= allRenderFlags;
}
}
if (this->textureRedSupport() ||
(kStandard_MSFBOType == this->msFBOType() && ctxInfo.renderer() != kOSMesa_GrGLRenderer)) {
// OpenGL 3.0+ (and GL_ARB_framebuffer_object) supports ALPHA8 as renderable.
// However, osmesa fails if it is 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;
}
// ES2 Command Buffer does not allow TexStorage with R8_EXT (so Alpha_8 and Gray_8)
if (texStorageSupported && !isCommandBufferES2) {
fConfigTable[kAlpha_8_GrPixelConfig].fFlags |= ConfigInfo::kCanUseTexStorage_Flag;

View File

@ -41,11 +41,9 @@ public:
*/
kNone_MSFBOType = 0,
/**
* OpenGL < 3.0 with GL_EXT_framebuffer_object. Doesn't allow rendering to ALPHA.
*/
kEXT_MSFBOType,
/**
* OpenGL 3.0+, OpenGL ES 3.0+, and GL_ARB_framebuffer_object.
* OpenGL 3.0+, OpenGL ES 3.0+, GL_ARB_framebuffer_object,
* GL_CHROMIUM_framebuffer_multisample, GL_ANGLE_framebuffer_multisample,
* or GL_EXT_framebuffer_multisample
*/
kStandard_MSFBOType,
/**
@ -285,6 +283,9 @@ public:
/// Is there support for GL_RED and GL_R8
bool textureRedSupport() const { return fTextureRedSupport; }
/// Is GL_ALPHA8 renderable
bool alpha8IsRenderable() const { return fAlpha8IsRenderable; }
/// Is GL_ARB_IMAGING supported
bool imagingSupport() const { return fImagingSupport; }
@ -421,6 +422,7 @@ private:
bool fPackFlipYSupport : 1;
bool fTextureUsageSupport : 1;
bool fTextureRedSupport : 1;
bool fAlpha8IsRenderable: 1;
bool fImagingSupport : 1;
bool fVertexArrayObjectSupport : 1;
bool fDirectStateAccessSupport : 1;

View File

@ -1145,7 +1145,6 @@ static bool renderbuffer_storage_msaa(const GrGLContext& ctx,
CLEAR_ERROR_BEFORE_ALLOC(ctx.interface());
SkASSERT(GrGLCaps::kNone_MSFBOType != ctx.caps()->msFBOType());
switch (ctx.caps()->msFBOType()) {
case GrGLCaps::kEXT_MSFBOType:
case GrGLCaps::kStandard_MSFBOType:
case GrGLCaps::kMixedSamples_MSFBOType:
GL_ALLOC_CALL(ctx.interface(),