Bug 1347866 - Part4: ANGLE patch uplift for bug1325741; r=jgilbert

MozReview-Commit-ID: 7FNeSn5XGaZ
This commit is contained in:
Chih-Yi Leu committed 2017-04-05 12:04:18 +08:00
1 parent b9afd9cbb5
commit 89812f856b
15 files changed
+104 -110

No files matched your search

+24 -35
View File
@@ -718,27 +718,19 @@ const InternalFormat &GetInternalFormatInfo(GLenum internalFormat)
}
}
GLuint InternalFormat::computePixelBytes(GLenum formatType) const
{
const auto &typeInfo = GetTypeInfo(formatType);
GLuint components = typeInfo.specialInterpretation ? 1u : componentCount;
return components * typeInfo.bytes;
}
ErrorOrResult<GLuint> InternalFormat::computeRowPitch(GLenum formatType,
GLsizei width,
GLint alignment,
GLint rowLength) const
ErrorOrResult<GLuint> InternalFormat::computeRowPitch(GLsizei width,
GLint alignment,
GLint rowLength) const
{
// Compressed images do not use pack/unpack parameters.
if (compressed)
{
ASSERT(rowLength == 0);
return computeCompressedImageSize(formatType, Extents(width, 1, 1));
return computeCompressedImageSize(Extents(width, 1, 1));
}
CheckedNumeric<GLuint> checkedWidth(rowLength > 0 ? rowLength : width);
CheckedNumeric<GLuint> checkedRowBytes = checkedWidth * computePixelBytes(formatType);
CheckedNumeric<GLuint> checkedRowBytes = checkedWidth * pixelBytes;
ASSERT(alignment > 0 && isPow2(alignment));
CheckedNumeric<GLuint> checkedAlignment(alignment);
@@ -749,7 +741,7 @@ ErrorOrResult<GLuint> InternalFormat::computeRowPitch(GLenum formatType,
ErrorOrResult<GLuint> InternalFormat::computeDepthPitch(GLsizei height,
GLint imageHeight,
GLuint rowPitch) const
GLuint rowPitch)
{
GLuint rows =
(imageHeight > 0 ? static_cast<GLuint>(imageHeight) : static_cast<GLuint>(height));
@@ -760,20 +752,18 @@ ErrorOrResult<GLuint> InternalFormat::computeDepthPitch(GLsizei height,
return depthPitch.ValueOrDie();
}
ErrorOrResult<GLuint> InternalFormat::computeDepthPitch(GLenum formatType,
GLsizei width,
GLsizei height,
GLint alignment,
GLint rowLength,
GLint imageHeight) const
ErrorOrResult<GLuint> InternalFormat::computeDepthPitch(GLsizei width,
GLsizei height,
GLint alignment,
GLint rowLength,
GLint imageHeight) const
{
GLuint rowPitch = 0;
ANGLE_TRY_RESULT(computeRowPitch(formatType, width, alignment, rowLength), rowPitch);
ANGLE_TRY_RESULT(computeRowPitch(width, alignment, rowLength), rowPitch);
return computeDepthPitch(height, imageHeight, rowPitch);
}
ErrorOrResult<GLuint> InternalFormat::computeCompressedImageSize(GLenum formatType,
const Extents &size) const
ErrorOrResult<GLuint> InternalFormat::computeCompressedImageSize(const Extents &size) const
{
CheckedNumeric<GLuint> checkedWidth(size.width);
CheckedNumeric<GLuint> checkedHeight(size.height);
@@ -790,9 +780,9 @@ ErrorOrResult<GLuint> InternalFormat::computeCompressedImageSize(GLenum formatTy
}
ErrorOrResult<GLuint> InternalFormat::computeSkipBytes(GLuint rowPitch,
GLuint depthPitch,
const PixelStoreStateBase &state,
bool is3D) const
GLuint depthPitch,
const PixelStoreStateBase &state,
bool is3D) const
{
CheckedNumeric<GLuint> checkedRowPitch(rowPitch);
CheckedNumeric<GLuint> checkedDepthPitch(depthPitch);
@@ -811,14 +801,12 @@ ErrorOrResult<GLuint> InternalFormat::computeSkipBytes(GLuint rowPitch,
return skipBytes.ValueOrDie();
}
ErrorOrResult<GLuint> InternalFormat::computePackUnpackEndByte(
GLenum formatType,
const Extents &size,
const PixelStoreStateBase &state,
bool is3D) const
ErrorOrResult<GLuint> InternalFormat::computePackUnpackEndByte(const Extents &size,
const PixelStoreStateBase &state,
bool is3D) const
{
GLuint rowPitch = 0;
ANGLE_TRY_RESULT(computeRowPitch(formatType, size.width, state.alignment, state.rowLength),
ANGLE_TRY_RESULT(computeRowPitch(size.width, state.alignment, state.rowLength),
rowPitch);
GLuint depthPitch = 0;
@@ -830,11 +818,11 @@ ErrorOrResult<GLuint> InternalFormat::computePackUnpackEndByte(
CheckedNumeric<GLuint> checkedCopyBytes = 0;
if (compressed)
{
ANGLE_TRY_RESULT(computeCompressedImageSize(formatType, size), checkedCopyBytes);
ANGLE_TRY_RESULT(computeCompressedImageSize(size), checkedCopyBytes);
}
else if (size.height != 0 && (!is3D || size.depth != 0))
{
CheckedNumeric<GLuint> bytes = computePixelBytes(formatType);
CheckedNumeric<GLuint> bytes = pixelBytes;
checkedCopyBytes += size.width * bytes;
CheckedNumeric<GLuint> heightMinusOne = size.height - 1;
@@ -848,7 +836,8 @@ ErrorOrResult<GLuint> InternalFormat::computePackUnpackEndByte(
}
CheckedNumeric<GLuint> checkedSkipBytes = 0;
ANGLE_TRY_RESULT(computeSkipBytes(rowPitch, depthPitch, state, is3D), checkedSkipBytes);
ANGLE_TRY_RESULT(computeSkipBytes(rowPitch, depthPitch, state, is3D),
checkedSkipBytes);
CheckedNumeric<GLuint> endByte = checkedCopyBytes + checkedSkipBytes;
+9 -15
View File
@@ -48,34 +48,28 @@ struct InternalFormat
{
InternalFormat();
GLuint computePixelBytes(GLenum formatType) const;
ErrorOrResult<GLuint> computeRowPitch(GLenum formatType,
GLsizei width,
ErrorOrResult<GLuint> computeRowPitch(GLsizei width,
GLint alignment,
GLint rowLength) const;
ErrorOrResult<GLuint> computeDepthPitch(GLsizei height,
GLint imageHeight,
GLuint rowPitch) const;
ErrorOrResult<GLuint> computeDepthPitch(GLenum formatType,
GLsizei width,
static ErrorOrResult<GLuint> computeDepthPitch(GLsizei height,
GLint imageHeight,
GLuint rowPitch);
ErrorOrResult<GLuint> computeDepthPitch(GLsizei width,
GLsizei height,
GLint alignment,
GLint rowLength,
GLint imageHeight) const;
ErrorOrResult<GLuint> computeCompressedImageSize(GLenum formatType,
const Extents &size) const;
ErrorOrResult<GLuint> computeCompressedImageSize(const Extents &size) const;
ErrorOrResult<GLuint> computeSkipBytes(GLuint rowPitch,
GLuint depthPitch,
const PixelStoreStateBase &state,
bool is3D) const;
ErrorOrResult<GLuint> computePackUnpackEndByte(GLenum formatType,
const Extents &size,
const PixelStoreStateBase &state,
bool is3D) const;
ErrorOrResult<GLuint> computePackUnpackEndByte(const Extents &size,
const PixelStoreStateBase &state,
bool is3D) const;
bool isLUMA() const;
GLenum getReadPixelsFormat() const;
@@ -240,15 +240,13 @@ gl::Error FramebufferD3D::readPixels(ContextImpl *context,
{
const gl::PixelPackState &packState = context->getGLState().getPackState();
GLenum sizedInternalFormat = gl::GetSizedInternalFormat(format, type);
const gl::InternalFormat &sizedFormatInfo = gl::GetInternalFormatInfo(sizedInternalFormat);
const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(gl::GetSizedInternalFormat(format, type));
GLuint outputPitch = 0;
ANGLE_TRY_RESULT(
sizedFormatInfo.computeRowPitch(type, area.width, packState.alignment, packState.rowLength),
outputPitch);
ANGLE_TRY_RESULT(formatInfo.computeRowPitch(area.width, packState.alignment, packState.rowLength),
outputPitch);
GLuint outputSkipBytes = 0;
ANGLE_TRY_RESULT(sizedFormatInfo.computeSkipBytes(outputPitch, 0, packState, false),
ANGLE_TRY_RESULT(formatInfo.computeSkipBytes(outputPitch, 0, packState, false),
outputSkipBytes);
return readPixelsImpl(area, format, type, outputPitch, packState,
@@ -10,6 +10,7 @@
#include "libANGLE/renderer/d3d/ImageD3D.h"
#include "libANGLE/formatutils.h"
#include "libANGLE/Framebuffer.h"
#include "libANGLE/FramebufferAttachment.h"
#include "libANGLE/renderer/d3d/FramebufferD3D.h"
@@ -29,4 +30,13 @@ ImageD3D::ImageD3D()
{
}
GLenum
ImageD3D::getSizedInputFormat(GLenum inputType) const
{
const auto &internalFormat = gl::GetInternalFormatInfo(mInternalFormat);
const auto &unsizedInternalFormat = internalFormat.format;
const auto &sizedInputFormat = gl::GetSizedInternalFormat(unsizedInternalFormat, inputType);
return sizedInputFormat;
}
} // namespace rx
@@ -51,6 +51,8 @@ class ImageD3D : angle::NonCopyable
virtual bool redefine(GLenum target, GLenum internalformat, const gl::Extents &size, bool forceRelease) = 0;
GLenum getSizedInputFormat(GLenum inputType) const;
virtual gl::Error loadData(const gl::Box &area,
const gl::PixelUnpackState &unpack,
GLenum type,
@@ -2366,15 +2366,15 @@ gl::Error TextureD3D_2DArray::setImage(GLenum target,
{
ASSERT(target == GL_TEXTURE_2D_ARRAY);
GLenum sizedInternalFormat = gl::GetSizedInternalFormat(internalFormat, type);
GLint level = static_cast<GLint>(imageLevel);
GLenum sizedInternalFormat = gl::GetSizedInternalFormat(internalFormat, type);
redefineImage(level, sizedInternalFormat, size);
const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(sizedInternalFormat);
GLsizei inputDepthPitch = 0;
ANGLE_TRY_RESULT(formatInfo.computeDepthPitch(type, size.width, size.height, unpack.alignment,
unpack.rowLength, unpack.imageHeight),
const auto sizedInputFormat = gl::GetSizedInternalFormat(format, type);
const gl::InternalFormat &inputFormat = gl::GetInternalFormatInfo(sizedInputFormat);
GLsizei inputDepthPitch = 0;
ANGLE_TRY_RESULT(inputFormat.computeDepthPitch(size.width, size.height, unpack.alignment,
unpack.rowLength, unpack.imageHeight),
inputDepthPitch);
for (int i = 0; i < size.depth; i++)
@@ -2396,11 +2396,12 @@ gl::Error TextureD3D_2DArray::setSubImage(GLenum target,
const uint8_t *pixels)
{
ASSERT(target == GL_TEXTURE_2D_ARRAY);
GLint level = static_cast<GLint>(imageLevel);
const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(getInternalFormat(level));
GLsizei inputDepthPitch = 0;
ANGLE_TRY_RESULT(formatInfo.computeDepthPitch(type, area.width, area.height, unpack.alignment,
unpack.rowLength, unpack.imageHeight),
GLint level = static_cast<GLint>(imageLevel);
const auto sizedInputFormat = gl::GetSizedInternalFormat(format, type);
const gl::InternalFormat &inputFormat = gl::GetInternalFormatInfo(sizedInputFormat);
GLsizei inputDepthPitch = 0;
ANGLE_TRY_RESULT(inputFormat.computeDepthPitch(area.width, area.height, unpack.alignment,
unpack.rowLength, unpack.imageHeight),
inputDepthPitch);
for (int i = 0; i < area.depth; i++)
@@ -2435,7 +2436,7 @@ gl::Error TextureD3D_2DArray::setCompressedImage(GLenum target,
const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(internalFormat);
GLsizei inputDepthPitch = 0;
ANGLE_TRY_RESULT(
formatInfo.computeDepthPitch(GL_UNSIGNED_BYTE, size.width, size.height, 1, 0, 0),
formatInfo.computeDepthPitch(size.width, size.height, 1, 0, 0),
inputDepthPitch);
for (int i = 0; i < size.depth; i++)
@@ -2457,7 +2458,7 @@ gl::Error TextureD3D_2DArray::setCompressedSubImage(GLenum target, size_t level,
const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(format);
GLsizei inputDepthPitch = 0;
ANGLE_TRY_RESULT(
formatInfo.computeDepthPitch(GL_UNSIGNED_BYTE, area.width, area.height, 1, 0, 0),
formatInfo.computeDepthPitch(area.width, area.height, 1, 0, 0),
inputDepthPitch);
for (int i = 0; i < area.depth; i++)
@@ -229,21 +229,22 @@ DXGI_FORMAT Image11::getDXGIFormat() const
// into the target pixel rectangle.
gl::Error Image11::loadData(const gl::Box &area,
const gl::PixelUnpackState &unpack,
GLenum type,
GLenum inputType,
const void *input,
bool applySkipImages)
{
const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(mInternalFormat);
const auto sizedInputFormat = getSizedInputFormat(inputType);
const gl::InternalFormat &inputFormat = gl::GetInternalFormatInfo(sizedInputFormat);
GLuint inputRowPitch = 0;
ANGLE_TRY_RESULT(
formatInfo.computeRowPitch(type, area.width, unpack.alignment, unpack.rowLength),
inputFormat.computeRowPitch(area.width, unpack.alignment, unpack.rowLength),
inputRowPitch);
GLuint inputDepthPitch = 0;
ANGLE_TRY_RESULT(formatInfo.computeDepthPitch(area.height, unpack.imageHeight, inputRowPitch),
ANGLE_TRY_RESULT(gl::InternalFormat::computeDepthPitch(area.height, unpack.imageHeight, inputRowPitch),
inputDepthPitch);
GLuint inputSkipBytes = 0;
ANGLE_TRY_RESULT(
formatInfo.computeSkipBytes(inputRowPitch, inputDepthPitch, unpack, applySkipImages),
inputFormat.computeSkipBytes(inputRowPitch, inputDepthPitch, unpack, applySkipImages),
inputSkipBytes);
const d3d11::DXGIFormatSize &dxgiFormatInfo = d3d11::GetDXGIFormatSizeInfo(mDXGIFormat);
@@ -251,7 +252,7 @@ gl::Error Image11::loadData(const gl::Box &area,
const d3d11::Format &d3dFormatInfo =
d3d11::Format::Get(mInternalFormat, mRenderer->getRenderer11DeviceCaps());
LoadImageFunction loadFunction = d3dFormatInfo.getLoadFunctions()(type).loadFunction;
LoadImageFunction loadFunction = d3dFormatInfo.getLoadFunctions()(inputType).loadFunction;
D3D11_MAPPED_SUBRESOURCE mappedImage;
ANGLE_TRY(map(D3D11_MAP_WRITE, &mappedImage));
@@ -272,9 +273,9 @@ gl::Error Image11::loadCompressedData(const gl::Box &area, const void *input)
{
const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(mInternalFormat);
GLsizei inputRowPitch = 0;
ANGLE_TRY_RESULT(formatInfo.computeRowPitch(GL_UNSIGNED_BYTE, area.width, 1, 0), inputRowPitch);
ANGLE_TRY_RESULT(formatInfo.computeRowPitch(area.width, 1, 0), inputRowPitch);
GLsizei inputDepthPitch = 0;
ANGLE_TRY_RESULT(formatInfo.computeDepthPitch(area.height, 0, inputRowPitch), inputDepthPitch);
ANGLE_TRY_RESULT(gl::InternalFormat::computeDepthPitch(area.height, 0, inputRowPitch), inputDepthPitch);
const d3d11::DXGIFormatSize &dxgiFormatInfo = d3d11::GetDXGIFormatSizeInfo(mDXGIFormat);
GLuint outputPixelSize = dxgiFormatInfo.pixelBytes;
@@ -588,7 +588,7 @@ gl::Error TextureStorage11::copyToStorage(TextureStorage *destStorage)
gl::Error TextureStorage11::setData(const gl::ImageIndex &index,
ImageD3D *image,
const gl::Box *destBox,
GLenum type,
GLenum inputType,
const gl::PixelUnpackState &unpack,
const uint8_t *pixelData)
{
@@ -602,33 +602,33 @@ gl::Error TextureStorage11::setData(const gl::ImageIndex &index,
UINT destSubresource = getSubresourceIndex(index);
const gl::InternalFormat &internalFormatInfo =
gl::GetInternalFormatInfo(image->getInternalFormat());
const auto sizedInputFormat = image->getSizedInputFormat(inputType);
const gl::InternalFormat &inputFormat = gl::GetInternalFormatInfo(sizedInputFormat);
gl::Box levelBox(0, 0, 0, getLevelWidth(index.mipIndex), getLevelHeight(index.mipIndex),
getLevelDepth(index.mipIndex));
bool fullUpdate = (destBox == nullptr || *destBox == levelBox);
ASSERT(internalFormatInfo.depthBits == 0 || fullUpdate);
ASSERT(inputFormat.depthBits == 0 || fullUpdate);
// TODO(jmadill): Handle compressed formats
// Compressed formats have different load syntax, so we'll have to handle them with slightly
// different logic. Will implemnent this in a follow-up patch, and ensure we do not use SetData
// with compressed formats in the calling logic.
ASSERT(!internalFormatInfo.compressed);
ASSERT(!inputFormat.compressed);
const int width = destBox ? destBox->width : static_cast<int>(image->getWidth());
const int height = destBox ? destBox->height : static_cast<int>(image->getHeight());
const int depth = destBox ? destBox->depth : static_cast<int>(image->getDepth());
GLuint srcRowPitch = 0;
ANGLE_TRY_RESULT(
internalFormatInfo.computeRowPitch(type, width, unpack.alignment, unpack.rowLength),
inputFormat.computeRowPitch(width, unpack.alignment, unpack.rowLength),
srcRowPitch);
GLuint srcDepthPitch = 0;
ANGLE_TRY_RESULT(internalFormatInfo.computeDepthPitch(height, unpack.imageHeight, srcRowPitch),
ANGLE_TRY_RESULT(gl::InternalFormat::computeDepthPitch(height, unpack.imageHeight, srcRowPitch),
srcDepthPitch);
GLuint srcSkipBytes = 0;
ANGLE_TRY_RESULT(
internalFormatInfo.computeSkipBytes(srcRowPitch, srcDepthPitch, unpack, index.is3D()),
inputFormat.computeSkipBytes(srcRowPitch, srcDepthPitch, unpack, index.is3D()),
srcSkipBytes);
const d3d11::Format &d3d11Format =
@@ -645,7 +645,7 @@ gl::Error TextureStorage11::setData(const gl::ImageIndex &index,
MemoryBuffer *conversionBuffer = nullptr;
const uint8_t *data = nullptr;
LoadImageFunctionInfo loadFunctionInfo = d3d11Format.getLoadFunctions()(type);
LoadImageFunctionInfo loadFunctionInfo = d3d11Format.getLoadFunctions()(inputType);
if (loadFunctionInfo.requiresConversion)
{
ANGLE_TRY(mRenderer->getScratchMemoryBuffer(neededSize, &conversionBuffer));
@@ -475,17 +475,17 @@ gl::Error Image9::copyToSurface(IDirect3DSurface9 *destSurface, const gl::Box &a
// into the target pixel rectangle.
gl::Error Image9::loadData(const gl::Box &area,
const gl::PixelUnpackState &unpack,
GLenum type,
GLenum inputType,
const void *input,
bool applySkipImages)
{
// 3D textures are not supported by the D3D9 backend.
ASSERT(area.z == 0 && area.depth == 1);
ASSERT(getSizedInputFormat(inputType) == mInternalFormat);
const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(mInternalFormat);
GLuint inputRowPitch = 0;
ANGLE_TRY_RESULT(
formatInfo.computeRowPitch(type, area.width, unpack.alignment, unpack.rowLength),
formatInfo.computeRowPitch(area.width, unpack.alignment, unpack.rowLength),
inputRowPitch);
ASSERT(!applySkipImages);
ASSERT(unpack.skipPixels == 0);
@@ -523,7 +523,7 @@ gl::Error Image9::loadCompressedData(const gl::Box &area, const void *input)
const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(mInternalFormat);
GLsizei inputRowPitch = 0;
ANGLE_TRY_RESULT(formatInfo.computeRowPitch(GL_UNSIGNED_BYTE, area.width, 1, 0), inputRowPitch);
ANGLE_TRY_RESULT(formatInfo.computeRowPitch(area.width, 1, 0), inputRowPitch);
GLsizei inputDepthPitch = 0;
ANGLE_TRY_RESULT(formatInfo.computeDepthPitch(area.height, 0, inputDepthPitch),
inputDepthPitch);
@@ -499,7 +499,7 @@ gl::Error FramebufferGL::readPixelsRowByRowWorkaround(const gl::Rectangle &area,
const gl::InternalFormat &glFormat =
gl::GetInternalFormatInfo(gl::GetSizedInternalFormat(format, type));
GLuint rowBytes = 0;
ANGLE_TRY_RESULT(glFormat.computeRowPitch(type, area.width, pack.alignment, pack.rowLength),
ANGLE_TRY_RESULT(glFormat.computeRowPitch(area.width, pack.alignment, pack.rowLength),
rowBytes);
GLuint skipBytes = 0;
ANGLE_TRY_RESULT(glFormat.computeSkipBytes(rowBytes, 0, pack, false), skipBytes);
@@ -530,7 +530,7 @@ gl::Error FramebufferGL::readPixelsPaddingWorkaround(const gl::Rectangle &area,
const gl::InternalFormat &glFormat =
gl::GetInternalFormatInfo(gl::GetSizedInternalFormat(format, type));
GLuint rowBytes = 0;
ANGLE_TRY_RESULT(glFormat.computeRowPitch(type, area.width, pack.alignment, pack.rowLength),
ANGLE_TRY_RESULT(glFormat.computeRowPitch(area.width, pack.alignment, pack.rowLength),
rowBytes);
GLuint skipBytes = 0;
ANGLE_TRY_RESULT(glFormat.computeSkipBytes(rowBytes, 0, pack, false), skipBytes);
@@ -326,11 +326,11 @@ gl::Error TextureGL::setSubImageRowByRowWorkaround(GLenum target,
const gl::InternalFormat &glFormat =
gl::GetInternalFormatInfo(gl::GetSizedInternalFormat(format, type));
GLuint rowBytes = 0;
ANGLE_TRY_RESULT(glFormat.computeRowPitch(type, area.width, unpack.alignment, unpack.rowLength),
GLuint rowBytes = 0;
ANGLE_TRY_RESULT(glFormat.computeRowPitch(area.width, unpack.alignment, unpack.rowLength),
rowBytes);
GLuint imageBytes = 0;
ANGLE_TRY_RESULT(glFormat.computeDepthPitch(area.height, unpack.imageHeight, rowBytes),
ANGLE_TRY_RESULT(gl::InternalFormat::computeDepthPitch(area.height, unpack.imageHeight, rowBytes),
imageBytes);
bool useTexImage3D = UseTexImage3D(getTarget());
GLuint skipBytes = 0;
@@ -378,10 +378,10 @@ gl::Error TextureGL::setSubImagePaddingWorkaround(GLenum target,
const gl::InternalFormat &glFormat =
gl::GetInternalFormatInfo(gl::GetSizedInternalFormat(format, type));
GLuint rowBytes = 0;
ANGLE_TRY_RESULT(glFormat.computeRowPitch(type, area.width, unpack.alignment, unpack.rowLength),
ANGLE_TRY_RESULT(glFormat.computeRowPitch(area.width, unpack.alignment, unpack.rowLength),
rowBytes);
GLuint imageBytes = 0;
ANGLE_TRY_RESULT(glFormat.computeDepthPitch(area.height, unpack.imageHeight, rowBytes),
ANGLE_TRY_RESULT(gl::InternalFormat::computeDepthPitch(area.height, unpack.imageHeight, rowBytes),
imageBytes);
bool useTexImage3D = UseTexImage3D(getTarget());
GLuint skipBytes = 0;
@@ -705,8 +705,7 @@ gl::Error TextureGL::setStorage(GLenum target,
if (internalFormatInfo.compressed)
{
GLuint dataSize = 0;
ANGLE_TRY_RESULT(internalFormatInfo.computeCompressedImageSize(
GL_UNSIGNED_BYTE, levelSize),
ANGLE_TRY_RESULT(internalFormatInfo.computeCompressedImageSize(levelSize),
dataSize);
mFunctions->compressedTexImage2D(target, static_cast<GLint>(level),
texStorageFormat.internalFormat,
@@ -729,7 +728,7 @@ gl::Error TextureGL::setStorage(GLenum target,
{
GLuint dataSize = 0;
ANGLE_TRY_RESULT(internalFormatInfo.computeCompressedImageSize(
GL_UNSIGNED_BYTE, levelSize),
levelSize),
dataSize);
mFunctions->compressedTexImage2D(
face, static_cast<GLint>(level), texStorageFormat.internalFormat,
@@ -780,7 +779,7 @@ gl::Error TextureGL::setStorage(GLenum target,
{
GLuint dataSize = 0;
ANGLE_TRY_RESULT(
internalFormatInfo.computeCompressedImageSize(GL_UNSIGNED_BYTE, levelSize),
internalFormatInfo.computeCompressedImageSize(levelSize),
dataSize);
mFunctions->compressedTexImage3D(target, i, texStorageFormat.internalFormat,
levelSize.width, levelSize.height,
@@ -1046,10 +1046,10 @@ gl::ErrorOrResult<bool> ShouldApplyLastRowPaddingWorkaround(const gl::Extents &s
const gl::InternalFormat &glFormat =
gl::GetInternalFormatInfo(gl::GetSizedInternalFormat(format, type));
ANGLE_TRY_RESULT(glFormat.computePackUnpackEndByte(type, size, state, is3D), checkedEndByte);
ANGLE_TRY_RESULT(glFormat.computeRowPitch(type, size.width, state.alignment, state.rowLength),
ANGLE_TRY_RESULT(glFormat.computePackUnpackEndByte(size, state, is3D), checkedEndByte);
ANGLE_TRY_RESULT(glFormat.computeRowPitch(size.width, state.alignment, state.rowLength),
rowPitch);
pixelBytes = glFormat.computePixelBytes(type);
pixelBytes = glFormat.pixelBytes;
checkedEndByte += reinterpret_cast<intptr_t>(pixels);
+2 -2
View File
@@ -255,7 +255,7 @@ bool ValidateReadPixelsBase(ValidationContext *context,
const gl::Extents size(width, height, 1);
const auto &pack = context->getGLState().getPackState();
auto endByteOrErr = formatInfo.computePackUnpackEndByte(type, size, pack, false);
auto endByteOrErr = formatInfo.computePackUnpackEndByte(size, pack, false);
if (endByteOrErr.isError())
{
context->handleError(endByteOrErr.getError());
@@ -1574,7 +1574,7 @@ bool ValidImageDataSize(ValidationContext *context,
const auto &unpack = context->getGLState().getUnpackState();
bool targetIs3D = textureTarget == GL_TEXTURE_3D || textureTarget == GL_TEXTURE_2D_ARRAY;
auto endByteOrErr = formatInfo.computePackUnpackEndByte(type, size, unpack, targetIs3D);
auto endByteOrErr = formatInfo.computePackUnpackEndByte(size, unpack, targetIs3D);
if (endByteOrErr.isError())
{
context->handleError(endByteOrErr.getError());
+2 -2
View File
@@ -2081,7 +2081,7 @@ bool ValidateCompressedTexImage2D(Context *context,
const InternalFormat &formatInfo = GetInternalFormatInfo(internalformat);
auto blockSizeOrErr =
formatInfo.computeCompressedImageSize(GL_UNSIGNED_BYTE, gl::Extents(width, height, 1));
formatInfo.computeCompressedImageSize(gl::Extents(width, height, 1));
if (blockSizeOrErr.isError())
{
context->handleError(blockSizeOrErr.getError());
@@ -2129,7 +2129,7 @@ bool ValidateCompressedTexSubImage2D(Context *context,
const InternalFormat &formatInfo = GetInternalFormatInfo(format);
auto blockSizeOrErr =
formatInfo.computeCompressedImageSize(GL_UNSIGNED_BYTE, gl::Extents(width, height, 1));
formatInfo.computeCompressedImageSize(gl::Extents(width, height, 1));
if (blockSizeOrErr.isError())
{
context->handleError(blockSizeOrErr.getError());
+2 -2
View File
@@ -1212,7 +1212,7 @@ bool ValidateCompressedTexImage3D(Context *context,
}
auto blockSizeOrErr =
formatInfo.computeCompressedImageSize(GL_UNSIGNED_BYTE, gl::Extents(width, height, depth));
formatInfo.computeCompressedImageSize(gl::Extents(width, height, depth));
if (blockSizeOrErr.isError())
{
context->handleError(Error(GL_INVALID_VALUE));
@@ -1621,7 +1621,7 @@ bool ValidateCompressedTexSubImage3D(Context *context,
const InternalFormat &formatInfo = GetInternalFormatInfo(format);
auto blockSizeOrErr =
formatInfo.computeCompressedImageSize(GL_UNSIGNED_BYTE, gl::Extents(width, height, depth));
formatInfo.computeCompressedImageSize(gl::Extents(width, height, depth));
if (blockSizeOrErr.isError())
{
context->handleError(blockSizeOrErr.getError());