mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 19:35:51 +00:00
Bug 1478704 - Fully generalize shader generation to rect textures r=jrmuizel
I'm not sure if there was a reason for not fully generalizing the sampler2DRect and texture2DRect stuff throughout the shader generalization file. It seemed the simplest thing was to fully replace it - even if in some cases it doesn't make sense it's more consistent, and it definitely fixes the trouble we were having with switching to GL_TEXTURE_RECTANGLE_ARB for client storage. MozReview-Commit-ID: 7243OjQdakN --HG-- extra : rebase_source : 756741bbff4c56edec64cc6dd367328974b83b35
This commit is contained in:
parent
8716065e9c
commit
2df99d5c56
@ -989,6 +989,7 @@ CompositorOGL::GetShaderConfigFor(Effect *aEffect,
|
||||
// according to the bit depth.
|
||||
// So we will scale the YUV values by this amount.
|
||||
config.SetColorMultiplier(pow(2, paddingBits));
|
||||
config.SetTextureTarget(effectYCbCr->mTexture->AsSourceOGL()->GetTextureTarget());
|
||||
break;
|
||||
}
|
||||
case EffectTypes::NV12:
|
||||
@ -1488,6 +1489,11 @@ CompositorOGL::DrawGeometry(const Geometry& aGeometry,
|
||||
sourceCb->BindTexture(LOCAL_GL_TEXTURE1, effectYCbCr->mSamplingFilter);
|
||||
sourceCr->BindTexture(LOCAL_GL_TEXTURE2, effectYCbCr->mSamplingFilter);
|
||||
|
||||
if (config.mFeatures & ENABLE_TEXTURE_RECT) {
|
||||
// This is used by IOSurface that use 0,0...w,h coordinate rather then 0,0..1,1.
|
||||
program->SetCbCrTexCoordMultiplier(sourceCb->GetSize().width, sourceCb->GetSize().height);
|
||||
}
|
||||
|
||||
program->SetYCbCrTextureUnits(Y, Cb, Cr);
|
||||
program->SetTextureTransform(Matrix4x4());
|
||||
program->SetYUVColorSpace(effectYCbCr->mYUVColorSpace);
|
||||
|
@ -389,9 +389,9 @@ ProgramProfileOGL::GetProfileFor(ShaderConfigOGL aConfig)
|
||||
}
|
||||
|
||||
if (aConfig.mFeatures & ENABLE_TEXTURE_YCBCR) {
|
||||
fs << "uniform sampler2D uYTexture;" << endl;
|
||||
fs << "uniform sampler2D uCbTexture;" << endl;
|
||||
fs << "uniform sampler2D uCrTexture;" << endl;
|
||||
fs << "uniform " << sampler2D << " uYTexture;" << endl;
|
||||
fs << "uniform " << sampler2D << " uCbTexture;" << endl;
|
||||
fs << "uniform " << sampler2D << " uCrTexture;" << endl;
|
||||
fs << "uniform mat3 uYuvColorMatrix;" << endl;
|
||||
} else if (aConfig.mFeatures & ENABLE_TEXTURE_NV12) {
|
||||
fs << "uniform " << sampler2D << " uYTexture;" << endl;
|
||||
@ -413,7 +413,7 @@ ProgramProfileOGL::GetProfileFor(ShaderConfigOGL aConfig)
|
||||
|
||||
if (aConfig.mFeatures & ENABLE_MASK) {
|
||||
fs << "varying vec3 vMaskCoord;" << endl;
|
||||
fs << "uniform sampler2D uMaskTexture;" << endl;
|
||||
fs << "uniform " << sampler2D << " uMaskTexture;" << endl;
|
||||
}
|
||||
|
||||
if (aConfig.mFeatures & ENABLE_DEAA) {
|
||||
@ -431,13 +431,13 @@ ProgramProfileOGL::GetProfileFor(ShaderConfigOGL aConfig)
|
||||
aConfig.mFeatures & ENABLE_TEXTURE_NV12) {
|
||||
if (aConfig.mFeatures & ENABLE_TEXTURE_YCBCR) {
|
||||
if (aConfig.mFeatures & ENABLE_TEXTURE_RECT) {
|
||||
fs << " COLOR_PRECISION float y = texture2D(uYTexture, coord * uTexCoordMultiplier).r;" << endl;
|
||||
fs << " COLOR_PRECISION float cb = texture2D(uCbTexture, coord * uCbCrTexCoordMultiplier).r;" << endl;
|
||||
fs << " COLOR_PRECISION float cr = texture2D(uCrTexture, coord * uCbCrTexCoordMultiplier).r;" << endl;
|
||||
fs << " COLOR_PRECISION float y = " << texture2D << "(uYTexture, coord * uTexCoordMultiplier).r;" << endl;
|
||||
fs << " COLOR_PRECISION float cb = " << texture2D << "(uCbTexture, coord * uCbCrTexCoordMultiplier).r;" << endl;
|
||||
fs << " COLOR_PRECISION float cr = " << texture2D << "(uCrTexture, coord * uCbCrTexCoordMultiplier).r;" << endl;
|
||||
} else {
|
||||
fs << " COLOR_PRECISION float y = texture2D(uYTexture, coord).r;" << endl;
|
||||
fs << " COLOR_PRECISION float cb = texture2D(uCbTexture, coord).r;" << endl;
|
||||
fs << " COLOR_PRECISION float cr = texture2D(uCrTexture, coord).r;" << endl;
|
||||
fs << " COLOR_PRECISION float y = " << texture2D << "(uYTexture, coord).r;" << endl;
|
||||
fs << " COLOR_PRECISION float cb = " << texture2D << "(uCbTexture, coord).r;" << endl;
|
||||
fs << " COLOR_PRECISION float cr = " << texture2D << "(uCrTexture, coord).r;" << endl;
|
||||
}
|
||||
} else {
|
||||
if (aConfig.mFeatures & ENABLE_TEXTURE_RECT) {
|
||||
@ -543,7 +543,11 @@ ProgramProfileOGL::GetProfileFor(ShaderConfigOGL aConfig)
|
||||
}
|
||||
if (aConfig.mFeatures & ENABLE_MASK) {
|
||||
fs << " vec2 maskCoords = vMaskCoord.xy / vMaskCoord.z;" << endl;
|
||||
fs << " COLOR_PRECISION float mask = texture2D(uMaskTexture, maskCoords).r;" << endl;
|
||||
if (aConfig.mFeatures & ENABLE_TEXTURE_RECT) {
|
||||
fs << " COLOR_PRECISION float mask = " << texture2D << "(uMaskTexture, maskCoords * uTexCoordMultiplier).r;" << endl;
|
||||
} else {
|
||||
fs << " COLOR_PRECISION float mask = " << texture2D << "(uMaskTexture, maskCoords).r;" << endl;
|
||||
}
|
||||
fs << " color *= mask;" << endl;
|
||||
} else {
|
||||
fs << " COLOR_PRECISION float mask = 1.0;" << endl;
|
||||
|
Loading…
Reference in New Issue
Block a user