Revert "Implement the egl and gl layers of EGL Image."
This reverts commit 22a4f38c2ca9ca430b5f976fc7fc816d88918eba.
Change-Id: I07acbfe28d11675236de2ea7f6b050c25f80579a
Reviewed-on: https://chromium-review.googlesource.com/290960
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Tested-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/Texture.cpp b/src/libANGLE/Texture.cpp
index 2668478..8b18663 100644
--- a/src/libANGLE/Texture.cpp
+++ b/src/libANGLE/Texture.cpp
@@ -12,7 +12,6 @@
#include "common/utilities.h"
#include "libANGLE/Config.h"
#include "libANGLE/Data.h"
-#include "libANGLE/Image.h"
#include "libANGLE/Surface.h"
#include "libANGLE/formatutils.h"
@@ -47,7 +46,7 @@
}
Texture::Texture(rx::TextureImpl *impl, GLuint id, GLenum target)
- : egl::ImageSibling(id),
+ : FramebufferAttachmentObject(id),
mTexture(impl),
mUsage(GL_NONE),
mImmutableLevelCount(0),
@@ -128,11 +127,6 @@
return mCompletenessCache.samplerComplete;
}
-bool Texture::isMipmapComplete() const
-{
- return computeMipmapCompleteness(mSamplerState);
-}
-
// Tests for cube texture completeness. [OpenGL ES 2.0.24] section 3.7.10 page 81.
bool Texture::isCubeComplete() const
{
@@ -158,22 +152,6 @@
return true;
}
-size_t Texture::getMipCompleteLevels() const
-{
- const ImageDesc &baseImageDesc = getImageDesc(getBaseImageTarget(), 0);
- if (mTarget == GL_TEXTURE_3D)
- {
- const size_t maxDim =
- std::max(std::max(baseImageDesc.size.width, baseImageDesc.size.height),
- baseImageDesc.size.depth);
- return log2(maxDim) + 1;
- }
- else
- {
- return log2(std::max(baseImageDesc.size.width, baseImageDesc.size.height)) + 1;
- }
-}
-
bool Texture::isImmutable() const
{
return (mImmutableLevelCount > 0);
@@ -184,11 +162,6 @@
return mImmutableLevelCount;
}
-egl::Surface *Texture::getBoundSurface() const
-{
- return mBoundSurface;
-}
-
Error Texture::setImage(GLenum target, size_t level, GLenum internalFormat, const Extents &size, GLenum format, GLenum type,
const PixelUnpackState &unpack, const uint8_t *pixels)
{
@@ -196,7 +169,6 @@
// Release from previous calls to eglBindTexImage, to avoid calling the Impl after
releaseTexImageInternal();
- orphanImages();
Error error = mTexture->setImage(target, level, internalFormat, size, format, type, unpack, pixels);
if (error.isError())
@@ -224,7 +196,6 @@
// Release from previous calls to eglBindTexImage, to avoid calling the Impl after
releaseTexImageInternal();
- orphanImages();
Error error = mTexture->setCompressedImage(target, level, internalFormat, size, unpack, imageSize, pixels);
if (error.isError())
@@ -252,7 +223,6 @@
// Release from previous calls to eglBindTexImage, to avoid calling the Impl after
releaseTexImageInternal();
- orphanImages();
Error error = mTexture->copyImage(target, level, sourceArea, internalFormat, source);
if (error.isError())
@@ -280,7 +250,6 @@
// Release from previous calls to eglBindTexImage, to avoid calling the Impl after
releaseTexImageInternal();
- orphanImages();
Error error = mTexture->setStorage(target, levels, internalFormat, size);
if (error.isError())
@@ -301,13 +270,6 @@
// Release from previous calls to eglBindTexImage, to avoid calling the Impl after
releaseTexImageInternal();
- // EGL_KHR_gl_image states that images are only orphaned when generating mipmaps if the texture
- // is not mip complete.
- if (!isMipmapComplete())
- {
- orphanImages();
- }
-
Error error = mTexture->generateMipmaps(getSamplerState());
if (error.isError())
{
@@ -426,38 +388,24 @@
}
}
-Error Texture::setEGLImageTarget(GLenum target, egl::Image *imageTarget)
-{
- ASSERT(target == mTarget);
- ASSERT(target == GL_TEXTURE_2D);
-
- // Release from previous calls to eglBindTexImage, to avoid calling the Impl after
- releaseTexImageInternal();
- orphanImages();
-
- Error error = mTexture->setEGLImageTarget(target, imageTarget);
- if (error.isError())
- {
- return error;
- }
-
- setTargetImage(imageTarget);
-
- Extents size(imageTarget->getWidth(), imageTarget->getHeight(), 1);
- GLenum internalFormat = imageTarget->getInternalFormat();
- GLenum type = GetInternalFormatInfo(internalFormat).type;
-
- clearImageDescs();
- setImageDesc(target, 0, ImageDesc(size, GetSizedInternalFormat(internalFormat, type)));
-
- return Error(GL_NO_ERROR);
-}
-
GLenum Texture::getBaseImageTarget() const
{
return mTarget == GL_TEXTURE_CUBE_MAP ? FirstCubeMapTextureTarget : mTarget;
}
+size_t Texture::getExpectedMipLevels() const
+{
+ const ImageDesc &baseImageDesc = getImageDesc(getBaseImageTarget(), 0);
+ if (mTarget == GL_TEXTURE_3D)
+ {
+ return log2(std::max(std::max(baseImageDesc.size.width, baseImageDesc.size.height), baseImageDesc.size.depth)) + 1;
+ }
+ else
+ {
+ return log2(std::max(baseImageDesc.size.width, baseImageDesc.size.height)) + 1;
+ }
+}
+
bool Texture::computeSamplerCompleteness(const SamplerState &samplerState, const Data &data) const
{
const ImageDesc &baseImageDesc = getImageDesc(getBaseImageTarget(), samplerState.baseLevel);
@@ -533,7 +481,7 @@
bool Texture::computeMipmapCompleteness(const gl::SamplerState &samplerState) const
{
- size_t expectedMipLevels = getMipCompleteLevels();
+ size_t expectedMipLevels = getExpectedMipLevels();
size_t maxLevel = std::min<size_t>(expectedMipLevels, samplerState.maxLevel + 1);
@@ -577,13 +525,13 @@
return false;
}
- const ImageDesc &levelImageDesc = getImageDesc(target, level);
- if (levelImageDesc.size.width == 0 || levelImageDesc.size.height == 0 ||
- levelImageDesc.size.depth == 0)
+ // The base image level is complete if the width and height are positive
+ if (level == 0)
{
- return false;
+ return true;
}
+ const ImageDesc &levelImageDesc = getImageDesc(target, level);
if (levelImageDesc.internalFormat != baseImageDesc.internalFormat)
{
return false;