mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
Bug 1367251 - ignore gl.UNPACK_FLIP_Y_WEBGL & UNPACK_PREMULTIPLY_ALPHA for textures uploading ImageBitmap data as per spec. r=jgilbert
*** Differential Revision: https://phabricator.services.mozilla.com/D29469
This commit is contained in:
parent
1e3e2b9d7c
commit
90f897f991
@ -405,6 +405,7 @@ struct QueueParamTraits<webgl::TexUnpackBlobDesc> {
|
||||
!view.WriteParam(in.srcAlphaType) || !view.WriteParam(in.unpacking) ||
|
||||
!view.WriteParam(in.cpuData) || !view.WriteParam(in.pboOffset) ||
|
||||
!view.WriteParam(in.imageSize) || !view.WriteParam(in.sd) ||
|
||||
!view.WriteParam(in.applyUnpackTransforms) ||
|
||||
!view.WriteParam(isDataSurf)) {
|
||||
return view.GetStatus();
|
||||
}
|
||||
@ -438,7 +439,9 @@ struct QueueParamTraits<webgl::TexUnpackBlobDesc> {
|
||||
!view.ReadParam(&out->srcAlphaType) ||
|
||||
!view.ReadParam(&out->unpacking) || !view.ReadParam(&out->cpuData) ||
|
||||
!view.ReadParam(&out->pboOffset) || !view.ReadParam(&out->imageSize) ||
|
||||
!view.ReadParam(&out->sd) || !view.ReadParam(&isDataSurf)) {
|
||||
!view.ReadParam(&out->sd) ||
|
||||
!view.ReadParam(&out->applyUnpackTransforms) ||
|
||||
!view.ReadParam(&isDataSurf)) {
|
||||
return view.GetStatus();
|
||||
}
|
||||
if (isDataSurf) {
|
||||
|
@ -407,7 +407,7 @@ bool TexUnpackBlob::ConvertIfNeeded(
|
||||
if (!rowLength || !rowCount) return true;
|
||||
|
||||
const auto srcIsPremult = (mDesc.srcAlphaType == gfxAlphaType::Premult);
|
||||
const auto& dstIsPremult = unpacking.mPremultiplyAlpha;
|
||||
auto dstIsPremult = unpacking.mPremultiplyAlpha;
|
||||
const auto fnHasPremultMismatch = [&]() {
|
||||
if (mDesc.srcAlphaType == gfxAlphaType::Opaque) return false;
|
||||
|
||||
@ -418,7 +418,12 @@ bool TexUnpackBlob::ConvertIfNeeded(
|
||||
|
||||
const auto srcOrigin =
|
||||
(unpacking.mFlipY ? gl::OriginPos::TopLeft : gl::OriginPos::BottomLeft);
|
||||
const auto dstOrigin = gl::OriginPos::BottomLeft;
|
||||
auto dstOrigin = gl::OriginPos::BottomLeft;
|
||||
|
||||
if (!mDesc.applyUnpackTransforms) {
|
||||
dstIsPremult = srcIsPremult;
|
||||
dstOrigin = srcOrigin;
|
||||
}
|
||||
|
||||
if (srcFormat != dstFormat) {
|
||||
webgl->GeneratePerfWarning(
|
||||
|
@ -71,7 +71,9 @@ Maybe<TexUnpackBlobDesc> FromImageBitmap(const GLenum target, uvec3 size,
|
||||
imageSize,
|
||||
nullptr,
|
||||
{},
|
||||
surf});
|
||||
surf,
|
||||
{},
|
||||
false});
|
||||
}
|
||||
|
||||
TexUnpackBlobDesc FromImageData(const GLenum target, uvec3 size,
|
||||
@ -918,10 +920,18 @@ void WebGLTexture::TexImage(uint32_t level, GLenum respecFormat,
|
||||
if (src.cpuData) {
|
||||
cpuDataView = Some(RawBuffer<>{src.cpuData->Data()});
|
||||
}
|
||||
const auto srcViewDesc = webgl::TexUnpackBlobDesc{
|
||||
src.imageTarget, src.size, src.srcAlphaType, std::move(cpuDataView),
|
||||
src.pboOffset, src.imageSize, src.image, src.sd,
|
||||
src.dataSurf, src.unpacking};
|
||||
const auto srcViewDesc = webgl::TexUnpackBlobDesc{src.imageTarget,
|
||||
src.size,
|
||||
src.srcAlphaType,
|
||||
std::move(cpuDataView),
|
||||
src.pboOffset,
|
||||
src.imageSize,
|
||||
src.image,
|
||||
src.sd,
|
||||
src.dataSurf,
|
||||
src.unpacking,
|
||||
src.applyUnpackTransforms};
|
||||
|
||||
const auto blob = webgl::TexUnpackBlob::Create(srcViewDesc);
|
||||
if (!blob) {
|
||||
MOZ_ASSERT(false);
|
||||
|
@ -1062,6 +1062,7 @@ struct TexUnpackBlobDesc final {
|
||||
RefPtr<gfx::DataSourceSurface> dataSurf;
|
||||
|
||||
WebGLPixelStore unpacking;
|
||||
bool applyUnpackTransforms = true;
|
||||
|
||||
void Shrink(const webgl::PackingInfo&);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user