Created test and fixed texture storage bug in d3d11

Bug: b/172489285
Change-Id: If7d88cf50d99da3380082c60fb3936ae0b20c4e5
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2519876
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
This commit is contained in:
Trevor David Black 2020-11-04 13:16:31 -08:00 коммит произвёл Commit Bot
Родитель b22f8e8e6a
Коммит 03f3ba5b14
2 изменённых файлов: 37 добавлений и 2 удалений

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

@ -1606,8 +1606,8 @@ angle::Result TextureD3D_2D::redefineImage(const gl::Context *context,
}
if ((level >= storageLevels && storageLevels != 0) || size.width != storageWidth ||
size.height != storageHeight ||
internalformat != storageFormat) // Discard mismatched storage
size.height != storageHeight || internalformat != storageFormat ||
mEGLImageTarget) // Discard mismatched storage
{
ANGLE_TRY(releaseTexStorage(context));
markAllImagesDirty();

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

@ -3345,6 +3345,41 @@ TEST_P(ImageTest, UpdatedExternalTexture)
glDeleteTextures(1, &targetTexture);
}
// Check that the texture successfully updates when an image is deleted
TEST_P(ImageTest, DeletedImageWithSameSizeAndFormat)
{
EGLWindow *window = getEGLWindow();
ANGLE_SKIP_TEST_IF(!hasOESExt() || !hasBaseExt() || !has2DTextureExt());
GLubyte originalData[4] = {255, 0, 255, 255};
GLubyte updateData[4] = {0, 255, 0, 255};
// Create the Image
GLuint source;
EGLImageKHR image;
createEGLImage2DTextureSource(1, 1, GL_RGBA, GL_UNSIGNED_BYTE, kDefaultAttribs, originalData,
&source, &image);
// Create texture & bind to Image
GLuint texture;
createEGLImageTargetTexture2D(image, &texture);
// Delete Image
eglDestroyImageKHR(window->getDisplay(), image);
ASSERT_EGL_SUCCESS();
// Redefine Texture
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, updateData);
ASSERT_GL_NO_ERROR();
// Clean up
glDeleteTextures(1, &source);
glDeleteTextures(1, &texture);
}
// Use this to select which configurations (e.g. which renderer, which GLES major version) these
// tests should be run against.
ANGLE_INSTANTIATE_TEST_ES2_AND_ES3(ImageTest);