Bug 1372385 - Fix premultiplication for LUMINANCE / LUMINANCE_ALPHA on WebGL2 conformance test - r=jgilbert

This commit is contained in:
Samuel Vargas 2017-06-09 15:54:45 -07:00 коммит произвёл Jeff Gilbert
Родитель e61bc0e9d7
Коммит b2d3e3f7f6
3 изменённых файлов: 16 добавлений и 14 удалений

Просмотреть файл

@ -97,10 +97,12 @@ FormatForPackingInfo(const PackingInfo& pi)
case LOCAL_GL_RGB:
case LOCAL_GL_RGB_INTEGER:
case LOCAL_GL_SRGB:
return WebGLTexelFormat::RGB8;
case LOCAL_GL_RGBA:
case LOCAL_GL_RGBA_INTEGER:
case LOCAL_GL_SRGB_ALPHA:
return WebGLTexelFormat::RGBA8;
case LOCAL_GL_RG:
@ -434,11 +436,11 @@ bool
TexUnpackBytes::TexOrSubImage(bool isSubImage, bool needsRespec, const char* funcName,
WebGLTexture* tex, TexImageTarget target, GLint level,
const webgl::DriverUnpackInfo* dui, GLint xOffset,
GLint yOffset, GLint zOffset, GLenum* const out_error) const
GLint yOffset, GLint zOffset, const webgl::PackingInfo& pi,
GLenum* const out_error) const
{
WebGLContext* webgl = tex->mContext;
const auto pi = dui->ToPacking();
const auto format = FormatForPackingInfo(pi);
const auto bytesPerPixel = webgl::BytesPerPixel(pi);
@ -613,7 +615,8 @@ bool
TexUnpackImage::TexOrSubImage(bool isSubImage, bool needsRespec, const char* funcName,
WebGLTexture* tex, TexImageTarget target, GLint level,
const webgl::DriverUnpackInfo* dui, GLint xOffset,
GLint yOffset, GLint zOffset, GLenum* const out_error) const
GLint yOffset, GLint zOffset, const webgl::PackingInfo& pi,
GLenum* const out_error) const
{
MOZ_ASSERT_IF(needsRespec, !isSubImage);
@ -739,7 +742,7 @@ TexUnpackImage::TexOrSubImage(bool isSubImage, bool needsRespec, const char* fun
mSrcAlphaType);
return surfBlob.TexOrSubImage(isSubImage, needsRespec, funcName, tex, target, level,
dui, xOffset, yOffset, zOffset, out_error);
dui, xOffset, yOffset, zOffset, pi, out_error);
}
////////////////////////////////////////////////////////////////////////////////
@ -821,8 +824,8 @@ TexUnpackSurface::Validate(WebGLContext* webgl, const char* funcName,
bool
TexUnpackSurface::TexOrSubImage(bool isSubImage, bool needsRespec, const char* funcName,
WebGLTexture* tex, TexImageTarget target, GLint level,
const webgl::DriverUnpackInfo* dstDUI, GLint xOffset,
GLint yOffset, GLint zOffset,
const webgl::DriverUnpackInfo* dui, GLint xOffset,
GLint yOffset, GLint zOffset, const webgl::PackingInfo& dstPI,
GLenum* const out_error) const
{
const auto& webgl = tex->mContext;
@ -832,7 +835,6 @@ TexUnpackSurface::TexOrSubImage(bool isSubImage, bool needsRespec, const char* f
const auto rowLength = mSurf->GetSize().width;
const auto rowCount = mSurf->GetSize().height;
const auto& dstPI = dstDUI->ToPacking();
const auto& dstBPP = webgl::BytesPerPixel(dstPI);
const auto dstFormat = FormatForPackingInfo(dstPI);
@ -892,7 +894,7 @@ TexUnpackSurface::TexOrSubImage(bool isSubImage, bool needsRespec, const char* f
gl->fPixelStorei(LOCAL_GL_UNPACK_ROW_LENGTH, rowLength);
}
*out_error = DoTexOrSubImage(isSubImage, gl, target.get(), level, dstDUI, xOffset,
*out_error = DoTexOrSubImage(isSubImage, gl, target.get(), level, dui, xOffset,
yOffset, zOffset, mWidth, mHeight, mDepth, dstBegin);
gl->fPixelStorei(LOCAL_GL_UNPACK_ALIGNMENT, webgl->mPixelStore_UnpackAlignment);

Просмотреть файл

@ -86,7 +86,7 @@ public:
WebGLTexture* tex, TexImageTarget target, GLint level,
const webgl::DriverUnpackInfo* dui, GLint xOffset,
GLint yOffset, GLint zOffset,
GLenum* const out_error) const = 0;
const webgl::PackingInfo& pi, GLenum* const out_error) const = 0;
};
class TexUnpackBytes final : public TexUnpackBlob
@ -108,7 +108,7 @@ public:
WebGLTexture* tex, TexImageTarget target, GLint level,
const webgl::DriverUnpackInfo* dui, GLint xOffset,
GLint yOffset, GLint zOffset,
GLenum* const out_error) const override;
const webgl::PackingInfo& pi, GLenum* const out_error) const override;
};
class TexUnpackImage final : public TexUnpackBlob
@ -128,7 +128,7 @@ public:
WebGLTexture* tex, TexImageTarget target, GLint level,
const webgl::DriverUnpackInfo* dui, GLint xOffset,
GLint yOffset, GLint zOffset,
GLenum* const out_error) const override;
const webgl::PackingInfo& dstPI, GLenum* const out_error) const override;
};
class TexUnpackSurface final : public TexUnpackBlob
@ -146,7 +146,7 @@ public:
WebGLTexture* tex, TexImageTarget target, GLint level,
const webgl::DriverUnpackInfo* dui, GLint xOffset,
GLint yOffset, GLint zOffset,
GLenum* const out_error) const override;
const webgl::PackingInfo& dstPI, GLenum* const out_error) const override;
};
} // namespace webgl

Просмотреть файл

@ -1292,7 +1292,7 @@ WebGLTexture::TexImage(const char* funcName, TexImageTarget target, GLint level,
GLenum glError;
if (!blob->TexOrSubImage(isSubImage, needsRespec, funcName, this, target, level,
driverUnpackInfo, xOffset, yOffset, zOffset, &glError))
driverUnpackInfo, xOffset, yOffset, zOffset, pi, &glError))
{
return;
}
@ -1380,7 +1380,7 @@ WebGLTexture::TexSubImage(const char* funcName, TexImageTarget target, GLint lev
GLenum glError;
if (!blob->TexOrSubImage(isSubImage, needsRespec, funcName, this, target, level,
driverUnpackInfo, xOffset, yOffset, zOffset, &glError))
driverUnpackInfo, xOffset, yOffset, zOffset, pi, &glError))
{
return;
}