Backed out changeset a2cfe189c828 (bug 1215089)
This commit is contained in:
@@ -3017,8 +3017,7 @@ GetBytesPerTexel(GLenum format, GLenum type)
|
||||
}
|
||||
} else if (type == LOCAL_GL_UNSIGNED_SHORT_4_4_4_4 ||
|
||||
type == LOCAL_GL_UNSIGNED_SHORT_5_5_5_1 ||
|
||||
type == LOCAL_GL_UNSIGNED_SHORT_5_6_5 ||
|
||||
type == LOCAL_GL_UNSIGNED_SHORT)
|
||||
type == LOCAL_GL_UNSIGNED_SHORT_5_6_5)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
@@ -464,14 +464,6 @@ UploadImageDataToTexture(GLContext* gl,
|
||||
// We don't have a specific luminance shader
|
||||
surfaceFormat = SurfaceFormat::A8;
|
||||
break;
|
||||
case SurfaceFormat::A16:
|
||||
format = LOCAL_GL_LUMINANCE;
|
||||
internalFormat = LOCAL_GL_LUMINANCE16;
|
||||
type = LOCAL_GL_UNSIGNED_SHORT;
|
||||
// We don't have a specific luminance shader
|
||||
surfaceFormat = SurfaceFormat::A8;
|
||||
pixelSize = 2;
|
||||
break;
|
||||
default:
|
||||
NS_ASSERTION(false, "Unhandled image surface format!");
|
||||
}
|
||||
|
||||
@@ -832,18 +832,8 @@ CompositorOGL::GetShaderConfigFor(Effect *aEffect,
|
||||
config.SetRenderColor(true);
|
||||
break;
|
||||
case EffectTypes::YCBCR:
|
||||
{
|
||||
config.SetYCbCr(true);
|
||||
EffectYCbCr* effectYCbCr =
|
||||
static_cast<EffectYCbCr*>(aEffect);
|
||||
uint32_t pixelBits = (8 * BytesPerPixel(SurfaceFormatForAlphaDepth(effectYCbCr->mDepth)));
|
||||
uint32_t paddingBits = pixelBits - effectYCbCr->mDepth;
|
||||
// OpenGL expects values between [0,255], this range needs to be adjusted
|
||||
// according to the bit depth.
|
||||
// So we will scale the YUV values by this amount.
|
||||
config.SetColorMultiplier(pow(2, paddingBits));
|
||||
break;
|
||||
}
|
||||
case EffectTypes::NV12:
|
||||
config.SetNV12(true);
|
||||
config.SetTextureTarget(LOCAL_GL_TEXTURE_RECTANGLE_ARB);
|
||||
|
||||
@@ -114,13 +114,6 @@ ShaderConfigOGL::SetYCbCr(bool aEnabled)
|
||||
MOZ_ASSERT(!(mFeatures & ENABLE_TEXTURE_NV12));
|
||||
}
|
||||
|
||||
void
|
||||
ShaderConfigOGL::SetColorMultiplier(uint32_t aMultiplier)
|
||||
{
|
||||
MOZ_ASSERT(mFeatures & ENABLE_TEXTURE_YCBCR, "Multiplier only supported with YCbCr!");
|
||||
mMultiplier = aMultiplier;
|
||||
}
|
||||
|
||||
void
|
||||
ShaderConfigOGL::SetNV12(bool aEnabled)
|
||||
{
|
||||
@@ -448,12 +441,11 @@ ProgramProfileOGL::GetProfileFor(ShaderConfigOGL aConfig)
|
||||
fs << " COLOR_PRECISION float cr = " << texture2D << "(uCbTexture, coord).a;" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
fs << " y = y - 0.06275;" << endl;
|
||||
fs << " cb = cb - 0.50196;" << endl;
|
||||
fs << " cr = cr - 0.50196;" << endl;
|
||||
fs << " vec3 yuv = vec3(y, cb, cr);" << endl;
|
||||
if (aConfig.mMultiplier != 1) {
|
||||
fs << " yuv *= " << aConfig.mMultiplier << ".0;" << endl;
|
||||
}
|
||||
fs << " vec3 coeff = vec3(0.06275, 0.50196, 0.50196 );" << endl;
|
||||
fs << " yuv -= coeff;" << endl;
|
||||
fs << " color.rgb = uYuvColorMatrix * yuv;" << endl;
|
||||
fs << " color.a = 1.0;" << endl;
|
||||
} else if (aConfig.mFeatures & ENABLE_TEXTURE_COMPONENT_ALPHA) {
|
||||
|
||||
@@ -212,12 +212,10 @@ public:
|
||||
class ShaderConfigOGL
|
||||
{
|
||||
public:
|
||||
ShaderConfigOGL()
|
||||
: mFeatures(0)
|
||||
, mMultiplier(1)
|
||||
, mCompositionOp(gfx::CompositionOp::OP_OVER)
|
||||
{
|
||||
}
|
||||
ShaderConfigOGL() :
|
||||
mFeatures(0),
|
||||
mCompositionOp(gfx::CompositionOp::OP_OVER)
|
||||
{}
|
||||
|
||||
void SetRenderColor(bool aEnabled);
|
||||
void SetTextureTarget(GLenum aTarget);
|
||||
@@ -234,21 +232,15 @@ public:
|
||||
void SetCompositionOp(gfx::CompositionOp aOp);
|
||||
void SetNoPremultipliedAlpha();
|
||||
void SetDynamicGeometry(bool aEnabled);
|
||||
void SetColorMultiplier(uint32_t aMultiplier);
|
||||
|
||||
bool operator< (const ShaderConfigOGL& other) const
|
||||
{
|
||||
bool operator< (const ShaderConfigOGL& other) const {
|
||||
return mFeatures < other.mFeatures ||
|
||||
(mFeatures == other.mFeatures &&
|
||||
(int)mCompositionOp < (int)other.mCompositionOp) ||
|
||||
(mFeatures == other.mFeatures &&
|
||||
(int)mCompositionOp == (int)other.mCompositionOp &&
|
||||
mMultiplier < other.mMultiplier);
|
||||
(int)mCompositionOp < (int)other.mCompositionOp);
|
||||
}
|
||||
|
||||
public:
|
||||
void SetFeature(int aBitmask, bool aState)
|
||||
{
|
||||
void SetFeature(int aBitmask, bool aState) {
|
||||
if (aState)
|
||||
mFeatures |= aBitmask;
|
||||
else
|
||||
@@ -256,7 +248,6 @@ public:
|
||||
}
|
||||
|
||||
int mFeatures;
|
||||
uint32_t mMultiplier;
|
||||
gfx::CompositionOp mCompositionOp;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user