Commit a1d6c4dc by Geoff Lang

Revert "Do not apply UNPACK_SKIP_IMAGES for 2D textures on D3D"

The Windows Intel GPU FYI bot started failing the Texture2DTestES3.UnpackSkipImages2D/ES3_OPENGL test after this CL. Example: https://build.chromium.org/p/chromium.gpu.fyi/builders/Win7%20Release%20%28New%20Intel%29/builds/866 This reverts commit ac3575b2. Change-Id: I5120261f5cf1ece9b21e4a94f63f85e014d2d8e4 Reviewed-on: https://chromium-review.googlesource.com/351280Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent e02a6834
...@@ -27,11 +27,6 @@ ImageIndex &ImageIndex::operator=(const ImageIndex &other) ...@@ -27,11 +27,6 @@ ImageIndex &ImageIndex::operator=(const ImageIndex &other)
return *this; return *this;
} }
bool ImageIndex::is3D() const
{
return type == GL_TEXTURE_3D || type == GL_TEXTURE_2D_ARRAY;
}
ImageIndex ImageIndex::Make2D(GLint mipIndex) ImageIndex ImageIndex::Make2D(GLint mipIndex)
{ {
return ImageIndex(GL_TEXTURE_2D, mipIndex, ENTIRE_LEVEL); return ImageIndex(GL_TEXTURE_2D, mipIndex, ENTIRE_LEVEL);
......
...@@ -28,7 +28,6 @@ struct ImageIndex ...@@ -28,7 +28,6 @@ struct ImageIndex
ImageIndex &operator=(const ImageIndex &other); ImageIndex &operator=(const ImageIndex &other);
bool hasLayer() const { return layerIndex != ENTIRE_LEVEL; } bool hasLayer() const { return layerIndex != ENTIRE_LEVEL; }
bool is3D() const;
static ImageIndex Make2D(GLint mipIndex); static ImageIndex Make2D(GLint mipIndex);
static ImageIndex MakeCube(GLenum target, GLint mipIndex); static ImageIndex MakeCube(GLenum target, GLint mipIndex);
......
...@@ -767,11 +767,9 @@ GLuint InternalFormat::computeSkipPixels(GLint rowPitch, ...@@ -767,11 +767,9 @@ GLuint InternalFormat::computeSkipPixels(GLint rowPitch,
GLint depthPitch, GLint depthPitch,
GLint skipImages, GLint skipImages,
GLint skipRows, GLint skipRows,
GLint skipPixels, GLint skipPixels) const
bool applySkipImages) const
{ {
GLuint skipImagesBytes = applySkipImages ? skipImages * depthPitch : 0; return skipImages * depthPitch + skipRows * rowPitch + skipPixels * pixelBytes;
return skipImagesBytes + skipRows * rowPitch + skipPixels * pixelBytes;
} }
gl::ErrorOrResult<GLuint> InternalFormat::computeUnpackSize( gl::ErrorOrResult<GLuint> InternalFormat::computeUnpackSize(
......
...@@ -63,8 +63,7 @@ struct InternalFormat ...@@ -63,8 +63,7 @@ struct InternalFormat
GLint depthPitch, GLint depthPitch,
GLint skipImages, GLint skipImages,
GLint skipRows, GLint skipRows,
GLint skipPixels, GLint skipPixels) const;
bool applySkipImages) const;
gl::ErrorOrResult<GLuint> computeUnpackSize(GLenum formatType, gl::ErrorOrResult<GLuint> computeUnpackSize(GLenum formatType,
const gl::Extents &size, const gl::Extents &size,
const gl::PixelUnpackState &unpack) const; const gl::PixelUnpackState &unpack) const;
......
...@@ -247,7 +247,7 @@ gl::Error FramebufferD3D::readPixels(ContextImpl *context, ...@@ -247,7 +247,7 @@ gl::Error FramebufferD3D::readPixels(ContextImpl *context,
sizedFormatInfo.computeRowPitch(type, area.width, packState.alignment, packState.rowLength), sizedFormatInfo.computeRowPitch(type, area.width, packState.alignment, packState.rowLength),
outputPitch); outputPitch);
GLsizei outputSkipBytes = sizedFormatInfo.computeSkipPixels( GLsizei outputSkipBytes = sizedFormatInfo.computeSkipPixels(
outputPitch, 0, 0, packState.skipRows, packState.skipPixels, false); outputPitch, 0, 0, packState.skipRows, packState.skipPixels);
return readPixelsImpl(area, format, type, outputPitch, packState, return readPixelsImpl(area, format, type, outputPitch, packState,
reinterpret_cast<uint8_t *>(pixels) + outputSkipBytes); reinterpret_cast<uint8_t *>(pixels) + outputSkipBytes);
......
...@@ -51,11 +51,7 @@ class ImageD3D : angle::NonCopyable ...@@ -51,11 +51,7 @@ class ImageD3D : angle::NonCopyable
virtual bool redefine(GLenum target, GLenum internalformat, const gl::Extents &size, bool forceRelease) = 0; virtual bool redefine(GLenum target, GLenum internalformat, const gl::Extents &size, bool forceRelease) = 0;
virtual gl::Error loadData(const gl::Box &area, virtual gl::Error loadData(const gl::Box &area, const gl::PixelUnpackState &unpack, GLenum type, const void *input) = 0;
const gl::PixelUnpackState &unpack,
GLenum type,
const void *input,
bool applySkipImages) = 0;
virtual gl::Error loadCompressedData(const gl::Box &area, const void *input) = 0; virtual gl::Error loadCompressedData(const gl::Box &area, const void *input) = 0;
virtual gl::Error setManagedSurface2D(TextureStorage *storage, int level) { return gl::Error(GL_NO_ERROR); }; virtual gl::Error setManagedSurface2D(TextureStorage *storage, int level) { return gl::Error(GL_NO_ERROR); };
......
...@@ -210,7 +210,7 @@ gl::Error TextureD3D::setImageImpl(const gl::ImageIndex &index, ...@@ -210,7 +210,7 @@ gl::Error TextureD3D::setImageImpl(const gl::ImageIndex &index,
else else
{ {
gl::Box fullImageArea(0, 0, 0, image->getWidth(), image->getHeight(), image->getDepth()); gl::Box fullImageArea(0, 0, 0, image->getWidth(), image->getHeight(), image->getDepth());
error = image->loadData(fullImageArea, unpack, type, pixelData, index.is3D()); error = image->loadData(fullImageArea, unpack, type, pixelData);
} }
if (error.isError()) if (error.isError())
...@@ -245,7 +245,7 @@ gl::Error TextureD3D::subImage(const gl::ImageIndex &index, const gl::Box &area, ...@@ -245,7 +245,7 @@ gl::Error TextureD3D::subImage(const gl::ImageIndex &index, const gl::Box &area,
return mTexStorage->setData(index, image, &area, type, unpack, pixelData); return mTexStorage->setData(index, image, &area, type, unpack, pixelData);
} }
error = image->loadData(area, unpack, type, pixelData, index.is3D()); error = image->loadData(area, unpack, type, pixelData);
if (error.isError()) if (error.isError())
{ {
return error; return error;
......
...@@ -245,11 +245,7 @@ DXGI_FORMAT Image11::getDXGIFormat() const ...@@ -245,11 +245,7 @@ DXGI_FORMAT Image11::getDXGIFormat() const
// Store the pixel rectangle designated by xoffset,yoffset,width,height with pixels stored as format/type at input // Store the pixel rectangle designated by xoffset,yoffset,width,height with pixels stored as format/type at input
// into the target pixel rectangle. // into the target pixel rectangle.
gl::Error Image11::loadData(const gl::Box &area, gl::Error Image11::loadData(const gl::Box &area, const gl::PixelUnpackState &unpack, GLenum type, const void *input)
const gl::PixelUnpackState &unpack,
GLenum type,
const void *input,
bool applySkipImages)
{ {
const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(mInternalFormat); const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(mInternalFormat);
GLsizei inputRowPitch = 0; GLsizei inputRowPitch = 0;
...@@ -260,9 +256,8 @@ gl::Error Image11::loadData(const gl::Box &area, ...@@ -260,9 +256,8 @@ gl::Error Image11::loadData(const gl::Box &area,
ANGLE_TRY_RESULT(formatInfo.computeDepthPitch(type, area.width, area.height, unpack.alignment, ANGLE_TRY_RESULT(formatInfo.computeDepthPitch(type, area.width, area.height, unpack.alignment,
unpack.rowLength, unpack.imageHeight), unpack.rowLength, unpack.imageHeight),
inputDepthPitch); inputDepthPitch);
GLsizei inputSkipBytes = GLsizei inputSkipBytes = formatInfo.computeSkipPixels(
formatInfo.computeSkipPixels(inputRowPitch, inputDepthPitch, unpack.skipImages, inputRowPitch, inputDepthPitch, unpack.skipImages, unpack.skipRows, unpack.skipPixels);
unpack.skipRows, unpack.skipPixels, applySkipImages);
const d3d11::DXGIFormatSize &dxgiFormatInfo = d3d11::GetDXGIFormatSizeInfo(mDXGIFormat); const d3d11::DXGIFormatSize &dxgiFormatInfo = d3d11::GetDXGIFormatSizeInfo(mDXGIFormat);
GLuint outputPixelSize = dxgiFormatInfo.pixelBytes; GLuint outputPixelSize = dxgiFormatInfo.pixelBytes;
......
...@@ -45,12 +45,8 @@ class Image11 : public ImageD3D ...@@ -45,12 +45,8 @@ class Image11 : public ImageD3D
DXGI_FORMAT getDXGIFormat() const; DXGI_FORMAT getDXGIFormat() const;
gl::Error loadData(const gl::Box &area, virtual gl::Error loadData(const gl::Box &area, const gl::PixelUnpackState &unpack, GLenum type, const void *input);
const gl::PixelUnpackState &unpack, virtual gl::Error loadCompressedData(const gl::Box &area, const void *input);
GLenum type,
const void *input,
bool applySkipImages) override;
gl::Error loadCompressedData(const gl::Box &area, const void *input) override;
gl::Error copyFromTexStorage(const gl::ImageIndex &imageIndex, TextureStorage *source) override; gl::Error copyFromTexStorage(const gl::ImageIndex &imageIndex, TextureStorage *source) override;
gl::Error copyFromFramebuffer(const gl::Offset &destOffset, gl::Error copyFromFramebuffer(const gl::Offset &destOffset,
......
...@@ -655,9 +655,8 @@ gl::Error TextureStorage11::setData(const gl::ImageIndex &index, ...@@ -655,9 +655,8 @@ gl::Error TextureStorage11::setData(const gl::ImageIndex &index,
ANGLE_TRY_RESULT(internalFormatInfo.computeDepthPitch(type, width, height, unpack.alignment, ANGLE_TRY_RESULT(internalFormatInfo.computeDepthPitch(type, width, height, unpack.alignment,
unpack.rowLength, unpack.imageHeight), unpack.rowLength, unpack.imageHeight),
srcDepthPitch); srcDepthPitch);
const GLsizei srcSkipBytes = const GLsizei srcSkipBytes = internalFormatInfo.computeSkipPixels(
internalFormatInfo.computeSkipPixels(srcRowPitch, srcDepthPitch, unpack.skipImages, srcRowPitch, srcDepthPitch, unpack.skipImages, unpack.skipRows, unpack.skipPixels);
unpack.skipRows, unpack.skipPixels, index.is3D());
const d3d11::TextureFormat &d3d11Format = d3d11::GetTextureFormatInfo( const d3d11::TextureFormat &d3d11Format = d3d11::GetTextureFormatInfo(
image->getInternalFormat(), mRenderer->getRenderer11DeviceCaps()); image->getInternalFormat(), mRenderer->getRenderer11DeviceCaps());
......
...@@ -473,11 +473,7 @@ gl::Error Image9::copyToSurface(IDirect3DSurface9 *destSurface, const gl::Box &a ...@@ -473,11 +473,7 @@ gl::Error Image9::copyToSurface(IDirect3DSurface9 *destSurface, const gl::Box &a
// Store the pixel rectangle designated by xoffset,yoffset,width,height with pixels stored as format/type at input // Store the pixel rectangle designated by xoffset,yoffset,width,height with pixels stored as format/type at input
// into the target pixel rectangle. // into the target pixel rectangle.
gl::Error Image9::loadData(const gl::Box &area, gl::Error Image9::loadData(const gl::Box &area, const gl::PixelUnpackState &unpack, GLenum type, const void *input)
const gl::PixelUnpackState &unpack,
GLenum type,
const void *input,
bool applySkipImages)
{ {
// 3D textures are not supported by the D3D9 backend. // 3D textures are not supported by the D3D9 backend.
ASSERT(area.z == 0 && area.depth == 1); ASSERT(area.z == 0 && area.depth == 1);
...@@ -487,9 +483,8 @@ gl::Error Image9::loadData(const gl::Box &area, ...@@ -487,9 +483,8 @@ gl::Error Image9::loadData(const gl::Box &area,
ANGLE_TRY_RESULT( ANGLE_TRY_RESULT(
formatInfo.computeRowPitch(type, area.width, unpack.alignment, unpack.rowLength), formatInfo.computeRowPitch(type, area.width, unpack.alignment, unpack.rowLength),
inputRowPitch); inputRowPitch);
ASSERT(!applySkipImages); GLsizei inputSkipBytes = formatInfo.computeSkipPixels(inputRowPitch, 0, unpack.skipImages,
GLsizei inputSkipBytes = formatInfo.computeSkipPixels( unpack.skipRows, unpack.skipPixels);
inputRowPitch, 0, unpack.skipImages, unpack.skipRows, unpack.skipPixels, false);
const d3d9::TextureFormat &d3dFormatInfo = d3d9::GetTextureFormatInfo(mInternalFormat); const d3d9::TextureFormat &d3dFormatInfo = d3d9::GetTextureFormatInfo(mInternalFormat);
ASSERT(d3dFormatInfo.loadFunction != NULL); ASSERT(d3dFormatInfo.loadFunction != NULL);
......
...@@ -42,12 +42,8 @@ class Image9 : public ImageD3D ...@@ -42,12 +42,8 @@ class Image9 : public ImageD3D
virtual gl::Error setManagedSurfaceCube(TextureStorage *storage, int face, int level); virtual gl::Error setManagedSurfaceCube(TextureStorage *storage, int face, int level);
virtual gl::Error copyToStorage(TextureStorage *storage, const gl::ImageIndex &index, const gl::Box &region); virtual gl::Error copyToStorage(TextureStorage *storage, const gl::ImageIndex &index, const gl::Box &region);
gl::Error loadData(const gl::Box &area, virtual gl::Error loadData(const gl::Box &area, const gl::PixelUnpackState &unpack, GLenum type, const void *input);
const gl::PixelUnpackState &unpack, virtual gl::Error loadCompressedData(const gl::Box &area, const void *input);
GLenum type,
const void *input,
bool applySkipImages) override;
gl::Error loadCompressedData(const gl::Box &area, const void *input) override;
gl::Error copyFromTexStorage(const gl::ImageIndex &imageIndex, TextureStorage *source) override; gl::Error copyFromTexStorage(const gl::ImageIndex &imageIndex, TextureStorage *source) override;
gl::Error copyFromFramebuffer(const gl::Offset &destOffset, gl::Error copyFromFramebuffer(const gl::Offset &destOffset,
......
...@@ -3318,36 +3318,6 @@ TEST_P(Texture2DNorm16TestES3, TextureNorm16Test) ...@@ -3318,36 +3318,6 @@ TEST_P(Texture2DNorm16TestES3, TextureNorm16Test)
testNorm16Render(GL_RGBA16_EXT, GL_RGBA, GL_UNSIGNED_SHORT); testNorm16Render(GL_RGBA16_EXT, GL_RGBA, GL_UNSIGNED_SHORT);
} }
// Test that UNPACK_SKIP_IMAGES doesn't have an effect on 2D texture uploads.
// GLES 3.0.4 section 3.8.3.
TEST_P(Texture2DTestES3, UnpackSkipImages2D)
{
glBindTexture(GL_TEXTURE_2D, mTexture2D);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
ASSERT_GL_NO_ERROR();
// SKIP_IMAGES should not have an effect on uploading 2D textures
glPixelStorei(GL_UNPACK_SKIP_IMAGES, 1000);
ASSERT_GL_NO_ERROR();
std::vector<GLColor> pixelsGreen(128u * 128u, GLColor::green);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 128, 128, 0, GL_RGBA, GL_UNSIGNED_BYTE,
pixelsGreen.data());
ASSERT_GL_NO_ERROR();
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 128, 128, GL_RGBA, GL_UNSIGNED_BYTE,
pixelsGreen.data());
ASSERT_GL_NO_ERROR();
glUseProgram(mProgram);
drawQuad(mProgram, "position", 0.5f);
ASSERT_GL_NO_ERROR();
EXPECT_PIXEL_COLOR_EQ(0, 0, GLColor::green);
}
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against. // Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
// TODO(oetuaho): Enable all below tests on OpenGL. Requires a fix for ANGLE bug 1278. // TODO(oetuaho): Enable all below tests on OpenGL. Requires a fix for ANGLE bug 1278.
ANGLE_INSTANTIATE_TEST(Texture2DTest, ANGLE_INSTANTIATE_TEST(Texture2DTest,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment