Bug 1261166 - Add the ability to use IOSurface instead of texture upload on OS X. r=nical,mattwoodrow

Initial patch by Markus Stange, additional fixes by Kartikaya Gupta. The code
to use IOSurface is guarded by a pref that is disabled by default.

MozReview-Commit-ID: LbhsYu4zMRV
This commit is contained in:
Markus Stange
2016-06-27 11:25:13 -04:00
parent 95cb504c9f
commit 000c753119
9 changed files with 145 additions and 27 deletions

View File

@@ -350,8 +350,8 @@ ProgramProfileOGL::GetProfileFor(ShaderConfigOGL aConfig)
fs << "uniform " << sampler2D << " uYTexture;" << endl;
fs << "uniform " << sampler2D << " uCbTexture;" << endl;
} else if (aConfig.mFeatures & ENABLE_TEXTURE_COMPONENT_ALPHA) {
fs << "uniform sampler2D uBlackTexture;" << endl;
fs << "uniform sampler2D uWhiteTexture;" << endl;
fs << "uniform " << sampler2D << " uBlackTexture;" << endl;
fs << "uniform " << sampler2D << " uWhiteTexture;" << endl;
fs << "uniform bool uTexturePass2;" << endl;
} else {
fs << "uniform " << sampler2D << " uTexture;" << endl;
@@ -422,8 +422,13 @@ For [0,1] instead of [0,255], and to 5 places:
fs << " color.b = y + 2.01723*cb;" << endl;
fs << " color.a = 1.0;" << endl;
} else if (aConfig.mFeatures & ENABLE_TEXTURE_COMPONENT_ALPHA) {
fs << " COLOR_PRECISION vec3 onBlack = texture2D(uBlackTexture, coord).rgb;" << endl;
fs << " COLOR_PRECISION vec3 onWhite = texture2D(uWhiteTexture, coord).rgb;" << endl;
if (aConfig.mFeatures & ENABLE_TEXTURE_RECT) {
fs << " COLOR_PRECISION vec3 onBlack = " << texture2D << "(uBlackTexture, coord * uTexCoordMultiplier).rgb;" << endl;
fs << " COLOR_PRECISION vec3 onWhite = " << texture2D << "(uWhiteTexture, coord * uTexCoordMultiplier).rgb;" << endl;
} else {
fs << " COLOR_PRECISION vec3 onBlack = " << texture2D << "(uBlackTexture, coord).rgb;" << endl;
fs << " COLOR_PRECISION vec3 onWhite = " << texture2D << "(uWhiteTexture, coord).rgb;" << endl;
}
fs << " COLOR_PRECISION vec4 alphas = (1.0 - onWhite + onBlack).rgbg;" << endl;
fs << " if (uTexturePass2)" << endl;
fs << " color = vec4(onBlack, alphas.a);" << endl;