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
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user