One more pass at getting half float texture configs correct.

Added in check for sized internal format.
Made choice between RED and ALPHA orthogonal to HALF_FLOAT and
HALF_FLOAT_OES.
Enabled rendertarget support on ES 2.0.

Review URL: https://codereview.chromium.org/805033002
This commit is contained in:
jvanverth 2014-12-18 05:44:55 -08:00 committed by Commit bot
parent eacaa2819d
commit 1334c21eee
3 changed files with 34 additions and 20 deletions

View File

@ -497,10 +497,17 @@ void GrGLCaps::initConfigRenderableTable(const GrGLContextInfo& ctxInfo) {
if (kGL_GrGLStandard == standard) {
fConfigRenderSupport[kAlpha_half_GrPixelConfig][kNo_MSAA] = true;
fConfigRenderSupport[kAlpha_half_GrPixelConfig][kYes_MSAA] = true;
} else if (ctxInfo.version() >= GR_GL_VER(3,0)) {
fConfigRenderSupport[kAlpha_half_GrPixelConfig][kNo_MSAA] = true;
// for now we don't support floating point MSAA on ES
fConfigRenderSupport[kAlpha_half_GrPixelConfig][kYes_MSAA] = false;
} else {
if (ctxInfo.hasExtension("GL_EXT_color_buffer_half_float") && fTextureRedSupport) {
fConfigRenderSupport[kAlpha_half_GrPixelConfig][kNo_MSAA] = true;
} else {
// in theory, check for "GL_EXT_color_buffer_half_float"
// for now we don't support half float alpha render target on ES
fConfigRenderSupport[kAlpha_half_GrPixelConfig][kNo_MSAA] = false;
}
// for now we don't support floating point MSAA on ES
fConfigRenderSupport[kAlpha_half_GrPixelConfig][kYes_MSAA] = false;
}
}
@ -652,7 +659,7 @@ void GrGLCaps::initConfigTexturableTable(const GrGLContextInfo& ctxInfo, const G
(ctxInfo.hasExtension("GL_OES_texture_half_float_linear") &&
ctxInfo.hasExtension("GL_OES_texture_half_float"));
}
fConfigTextureSupport[kAlpha_half_GrPixelConfig] = hasHalfFPTextures && fTextureRedSupport;
fConfigTextureSupport[kAlpha_half_GrPixelConfig] = hasHalfFPTextures;
}
bool GrGLCaps::doReadPixelsSupported(const GrGLInterface* intf,

View File

@ -2386,18 +2386,25 @@ bool GrGLGpu::configToGLFormats(GrPixelConfig config,
break;
case kAlpha_half_GrPixelConfig:
if (kGLES_GrGLStandard == this->glStandard() && this->glVersion() < GR_GL_VER(3, 1)) {
*internalFormat = GR_GL_ALPHA;
*externalFormat = GR_GL_ALPHA;
*externalType = GR_GL_HALF_FLOAT_OES;
} else if (this->glCaps().textureRedSupport()) {
if (this->glCaps().textureRedSupport()) {
if (getSizedInternalFormat) {
*internalFormat = GR_GL_R16F;
} else {
*internalFormat = GR_GL_RED;
}
*externalFormat = GR_GL_RED;
} else {
if (getSizedInternalFormat) {
*internalFormat = GR_GL_ALPHA16F;
} else {
*internalFormat = GR_GL_ALPHA;
}
*externalFormat = GR_GL_ALPHA;
}
if (kGL_GrGLStandard == this->glStandard() || this->glVersion() >= GR_GL_VER(3, 0)) {
*externalType = GR_GL_HALF_FLOAT;
} else {
*internalFormat = GR_GL_ALPHA16F;
*externalFormat = GR_GL_ALPHA;
*externalType = GR_GL_HALF_FLOAT;
*externalType = GR_GL_HALF_FLOAT_OES;
}
break;