From a6a12d8c0fc918972c15268f749ecc7c90b95d6c Mon Sep 17 00:00:00 2001 From: Andrew Knight Date: Tue, 5 Aug 2014 12:59:44 +0300 Subject: ANGLE: upgrade to 2.1~07d49ef5350a This version of ANGLE provides partial ES3 support, numerous bug fixes, and several potentially useful vendor extensions. All patches have been rebased. The following changes are noted: 0000-General-fixes-for-ANGLE-2.1.patch contains compile fixes for the new ANGLE 0004-Make-it-possible-to-link-ANGLE-statically-for-single.patch has incorporated patch 0015. 0007-Make-DX9-DX11-mutually-exclusive.patch has been removed as it was fixed upstream. 0007-Fix-ANGLE-build-with-Microsoft-Visual-Studio-14-CTP.patch has been moved up to fill the patch number gap. 0010-ANGLE-Enable-D3D11-for-feature-level-9-cards.patch now contains patch 0014 and 0017. 0013-ANGLE-Allow-for-universal-program-binaries.patch has been removed as it is no longer relevant. 0014-ANGLE-D3D11-Fix-internal-index-buffer-for-level-9-ha.patch has been merged with patch 0010. 0015-ANGLE-Don-t-export-DLLMain-functions-for-static-buil.patch has been merged with patch 0004. 0016-ANGLE-WinRT-Call-Trim-when-application-suspends.patch has been removed and will be replaced by a follow-up patch using a different technique. 0017-ANGLE-D3D11-Don-t-use-mipmaps-in-level-9-textures.patch has been merged with patch 0010. 0018-ANGLE-WinRT-Create-swap-chain-using-physical-resolut.patch has been removed and will be replaced by a follow-up patch extending the EGL_ANGLE_window_fixed_size extension. 0019-Fix-ANGLE-build-with-Microsoft-Visual-Studio-14-CTP.patch is now patch 0007. [ChangeLog][Third-party libraries] ANGLE has been upgraded to version 2.1, bringing partial support for OpenGL ES3 over Direct3D 11, numerous bug fixes, and several new vendor extensions. Change-Id: I6d95ce1480462d67228d83c1e5c74a1706b5b21c Reviewed-by: Friedemann Kleint --- src/3rdparty/angle/src/libGLESv2/Texture.h | 298 ++++++++++++++++------------- 1 file changed, 161 insertions(+), 137 deletions(-) (limited to 'src/3rdparty/angle/src/libGLESv2/Texture.h') diff --git a/src/3rdparty/angle/src/libGLESv2/Texture.h b/src/3rdparty/angle/src/libGLESv2/Texture.h index 4f5fab28d0..29f952f9f6 100644 --- a/src/3rdparty/angle/src/libGLESv2/Texture.h +++ b/src/3rdparty/angle/src/libGLESv2/Texture.h @@ -13,12 +13,12 @@ #include -#define GL_APICALL -#include +#include "angle_gl.h" #include "common/debug.h" #include "common/RefCountObject.h" #include "libGLESv2/angletypes.h" +#include "libGLESv2/constants.h" namespace egl { @@ -27,10 +27,11 @@ class Surface; namespace rx { -class Renderer; +class Texture2DImpl; +class TextureCubeImpl; +class Texture3DImpl; +class Texture2DArrayImpl; class TextureStorageInterface; -class TextureStorageInterface2D; -class TextureStorageInterfaceCube; class RenderTarget; class Image; } @@ -38,108 +39,72 @@ class Image; namespace gl { class Framebuffer; -class Renderbuffer; - -enum -{ - // These are the maximums the implementation can support - // The actual GL caps are limited by the device caps - // and should be queried from the Context - IMPLEMENTATION_MAX_TEXTURE_SIZE = 16384, - IMPLEMENTATION_MAX_CUBE_MAP_TEXTURE_SIZE = 16384, - - IMPLEMENTATION_MAX_TEXTURE_LEVELS = 15 // 1+log2 of MAX_TEXTURE_SIZE -}; +class FramebufferAttachment; class Texture : public RefCountObject { public: - Texture(rx::Renderer *renderer, GLuint id); + Texture(GLuint id, GLenum target); virtual ~Texture(); - virtual void addProxyRef(const Renderbuffer *proxy) = 0; - virtual void releaseProxy(const Renderbuffer *proxy) = 0; - - virtual GLenum getTarget() const = 0; - - bool setMinFilter(GLenum filter); - bool setMagFilter(GLenum filter); - bool setWrapS(GLenum wrap); - bool setWrapT(GLenum wrap); - bool setMaxAnisotropy(float textureMaxAnisotropy, float contextMaxAnisotropy); - bool setUsage(GLenum usage); - - GLenum getMinFilter() const; - GLenum getMagFilter() const; - GLenum getWrapS() const; - GLenum getWrapT() const; - float getMaxAnisotropy() const; - int getLodOffset(); - void getSamplerState(SamplerState *sampler); + GLenum getTarget() const; + + const SamplerState &getSamplerState() const { return mSamplerState; } + SamplerState &getSamplerState() { return mSamplerState; } + void getSamplerStateWithNativeOffset(SamplerState *sampler); + + virtual void setUsage(GLenum usage); GLenum getUsage() const; - bool isMipmapFiltered() const; - virtual bool isSamplerComplete() const = 0; + GLint getBaseLevelWidth() const; + GLint getBaseLevelHeight() const; + GLint getBaseLevelDepth() const; + GLenum getBaseLevelInternalFormat() const; + + virtual bool isSamplerComplete(const SamplerState &samplerState) const = 0; - rx::TextureStorageInterface *getNativeTexture(); - virtual Renderbuffer *getRenderbuffer(GLenum target) = 0; + virtual rx::TextureStorageInterface *getNativeTexture() = 0; virtual void generateMipmaps() = 0; - virtual void copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source) = 0; + virtual void copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source) = 0; - bool hasDirtyParameters() const; - bool hasDirtyImages() const; - void resetDirty(); + virtual bool hasDirtyImages() const = 0; + virtual void resetDirty() = 0; unsigned int getTextureSerial(); - unsigned int getRenderTargetSerial(GLenum target); bool isImmutable() const; + int immutableLevelCount(); static const GLuint INCOMPLETE_TEXTURE_ID = static_cast(-1); // Every texture takes an id at creation time. The value is arbitrary because it is never registered with the resource manager. protected: - void setImage(GLint unpackAlignment, const void *pixels, rx::Image *image); - bool subImage(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels, rx::Image *image); - void setCompressedImage(GLsizei imageSize, const void *pixels, rx::Image *image); - bool subImageCompressed(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *pixels, rx::Image *image); - - GLint creationLevels(GLsizei width, GLsizei height) const; - GLint creationLevels(GLsizei size) const; - - virtual void createTexture() = 0; - virtual void updateTexture() = 0; - virtual void convertToRenderTarget() = 0; - virtual rx::RenderTarget *getRenderTarget(GLenum target) = 0; - - virtual int levelCount() = 0; - - rx::Renderer *mRenderer; + int mipLevels() const; SamplerState mSamplerState; GLenum mUsage; - bool mDirtyImages; - bool mImmutable; + GLenum mTarget; + private: DISALLOW_COPY_AND_ASSIGN(Texture); - virtual rx::TextureStorageInterface *getStorage(bool renderTarget) = 0; + virtual const rx::Image *getBaseLevelImage() const = 0; }; class Texture2D : public Texture { public: - Texture2D(rx::Renderer *renderer, GLuint id); + Texture2D(rx::Texture2DImpl *impl, GLuint id); ~Texture2D(); - void addProxyRef(const Renderbuffer *proxy); - void releaseProxy(const Renderbuffer *proxy); - - virtual GLenum getTarget() const; + virtual rx::TextureStorageInterface *getNativeTexture(); + virtual void setUsage(GLenum usage); + virtual bool hasDirtyImages() const; + virtual void resetDirty(); GLsizei getWidth(GLint level) const; GLsizei getHeight(GLint level) const; @@ -148,128 +113,187 @@ class Texture2D : public Texture bool isCompressed(GLint level) const; bool isDepth(GLint level) const; - void setImage(GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels); + void setImage(GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels); void setCompressedImage(GLint level, GLenum format, GLsizei width, GLsizei height, GLsizei imageSize, const void *pixels); - void subImage(GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels); + void subImage(GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels); void subImageCompressed(GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *pixels); void copyImage(GLint level, GLenum format, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source); - virtual void copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source); + virtual void copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source); void storage(GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); - virtual bool isSamplerComplete() const; + virtual bool isSamplerComplete(const SamplerState &samplerState) const; virtual void bindTexImage(egl::Surface *surface); virtual void releaseTexImage(); virtual void generateMipmaps(); - virtual Renderbuffer *getRenderbuffer(GLenum target); + unsigned int getRenderTargetSerial(GLint level); protected: - friend class RenderbufferTexture2D; - virtual rx::RenderTarget *getRenderTarget(GLenum target); - virtual rx::RenderTarget *getDepthStencil(GLenum target); - virtual int levelCount(); + friend class Texture2DAttachment; + rx::RenderTarget *getRenderTarget(GLint level); + rx::RenderTarget *getDepthSencil(GLint level); private: DISALLOW_COPY_AND_ASSIGN(Texture2D); - virtual void createTexture(); - virtual void updateTexture(); - virtual void convertToRenderTarget(); - virtual rx::TextureStorageInterface *getStorage(bool renderTarget); - - bool isMipmapComplete() const; + virtual const rx::Image *getBaseLevelImage() const; - void redefineImage(GLint level, GLint internalformat, GLsizei width, GLsizei height); - void commitRect(GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height); + void redefineImage(GLint level, GLenum internalformat, GLsizei width, GLsizei height); - rx::Image *mImageArray[IMPLEMENTATION_MAX_TEXTURE_LEVELS]; - - rx::TextureStorageInterface2D *mTexStorage; + rx::Texture2DImpl *mTexture; egl::Surface *mSurface; - - // A specific internal reference count is kept for colorbuffer proxy references, - // because, as the renderbuffer acting as proxy will maintain a binding pointer - // back to this texture, there would be a circular reference if we used a binding - // pointer here. This reference count will cause the pointer to be set to NULL if - // the count drops to zero, but will not cause deletion of the Renderbuffer. - Renderbuffer *mColorbufferProxy; - unsigned int mProxyRefs; }; class TextureCubeMap : public Texture { public: - TextureCubeMap(rx::Renderer *renderer, GLuint id); + TextureCubeMap(rx::TextureCubeImpl *impl, GLuint id); ~TextureCubeMap(); - void addProxyRef(const Renderbuffer *proxy); - void releaseProxy(const Renderbuffer *proxy); + virtual rx::TextureStorageInterface *getNativeTexture(); + virtual void setUsage(GLenum usage); + virtual bool hasDirtyImages() const; + virtual void resetDirty(); - virtual GLenum getTarget() const; - GLsizei getWidth(GLenum target, GLint level) const; GLsizei getHeight(GLenum target, GLint level) const; GLenum getInternalFormat(GLenum target, GLint level) const; GLenum getActualFormat(GLenum target, GLint level) const; bool isCompressed(GLenum target, GLint level) const; + bool isDepth(GLenum target, GLint level) const; - void setImagePosX(GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels); - void setImageNegX(GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels); - void setImagePosY(GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels); - void setImageNegY(GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels); - void setImagePosZ(GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels); - void setImageNegZ(GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels); + void setImagePosX(GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels); + void setImageNegX(GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels); + void setImagePosY(GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels); + void setImageNegY(GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels); + void setImagePosZ(GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels); + void setImageNegZ(GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels); - void setCompressedImage(GLenum face, GLint level, GLenum format, GLsizei width, GLsizei height, GLsizei imageSize, const void *pixels); + void setCompressedImage(GLenum target, GLint level, GLenum format, GLsizei width, GLsizei height, GLsizei imageSize, const void *pixels); - void subImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels); + void subImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels); void subImageCompressed(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *pixels); void copyImage(GLenum target, GLint level, GLenum format, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source); - virtual void copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source); + virtual void copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source); void storage(GLsizei levels, GLenum internalformat, GLsizei size); - virtual bool isSamplerComplete() const; + virtual bool isSamplerComplete(const SamplerState &samplerState) const; + bool isCubeComplete() const; virtual void generateMipmaps(); - virtual Renderbuffer *getRenderbuffer(GLenum target); - - static unsigned int faceIndex(GLenum face); + unsigned int getRenderTargetSerial(GLenum target, GLint level); protected: - friend class RenderbufferTextureCubeMap; - virtual rx::RenderTarget *getRenderTarget(GLenum target); - virtual int levelCount(); + friend class TextureCubeMapAttachment; + rx::RenderTarget *getRenderTarget(GLenum target, GLint level); + rx::RenderTarget *getDepthStencil(GLenum target, GLint level); private: DISALLOW_COPY_AND_ASSIGN(TextureCubeMap); - virtual void createTexture(); - virtual void updateTexture(); - virtual void convertToRenderTarget(); - virtual rx::TextureStorageInterface *getStorage(bool renderTarget); + virtual const rx::Image *getBaseLevelImage() const; - bool isCubeComplete() const; - bool isMipmapCubeComplete() const; + rx::TextureCubeImpl *mTexture; +}; + +class Texture3D : public Texture +{ + public: + Texture3D(rx::Texture3DImpl *impl, GLuint id); + + ~Texture3D(); - void setImage(int faceIndex, GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels); - void commitRect(int faceIndex, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height); - void redefineImage(int faceIndex, GLint level, GLint internalformat, GLsizei width, GLsizei height); + virtual rx::TextureStorageInterface *getNativeTexture(); + virtual void setUsage(GLenum usage); + virtual bool hasDirtyImages() const; + virtual void resetDirty(); - rx::Image *mImageArray[6][IMPLEMENTATION_MAX_TEXTURE_LEVELS]; + GLsizei getWidth(GLint level) const; + GLsizei getHeight(GLint level) const; + GLsizei getDepth(GLint level) const; + GLenum getInternalFormat(GLint level) const; + GLenum getActualFormat(GLint level) const; + bool isCompressed(GLint level) const; + bool isDepth(GLint level) const; - rx::TextureStorageInterfaceCube *mTexStorage; + void setImage(GLint level, GLsizei width, GLsizei height, GLsizei depth, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels); + void setCompressedImage(GLint level, GLenum format, GLsizei width, GLsizei height, GLsizei depth, GLsizei imageSize, const void *pixels); + void subImage(GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels); + void subImageCompressed(GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *pixels); + void storage(GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); + + virtual void generateMipmaps(); + virtual void copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source); - // A specific internal reference count is kept for colorbuffer proxy references, - // because, as the renderbuffer acting as proxy will maintain a binding pointer - // back to this texture, there would be a circular reference if we used a binding - // pointer here. This reference count will cause the pointer to be set to NULL if - // the count drops to zero, but will not cause deletion of the Renderbuffer. - Renderbuffer *mFaceProxies[6]; - unsigned int *mFaceProxyRefs[6]; + virtual bool isSamplerComplete(const SamplerState &samplerState) const; + virtual bool isMipmapComplete() const; + + unsigned int getRenderTargetSerial(GLint level, GLint layer); + + protected: + friend class Texture3DAttachment; + rx::RenderTarget *getRenderTarget(GLint level); + rx::RenderTarget *getRenderTarget(GLint level, GLint layer); + rx::RenderTarget *getDepthStencil(GLint level, GLint layer); + + private: + DISALLOW_COPY_AND_ASSIGN(Texture3D); + + virtual const rx::Image *getBaseLevelImage() const; + + rx::Texture3DImpl *mTexture; +}; + +class Texture2DArray : public Texture +{ + public: + Texture2DArray(rx::Texture2DArrayImpl *impl, GLuint id); + + ~Texture2DArray(); + + virtual rx::TextureStorageInterface *getNativeTexture(); + virtual void setUsage(GLenum usage); + virtual bool hasDirtyImages() const; + virtual void resetDirty(); + + GLsizei getWidth(GLint level) const; + GLsizei getHeight(GLint level) const; + GLsizei getLayers(GLint level) const; + GLenum getInternalFormat(GLint level) const; + GLenum getActualFormat(GLint level) const; + bool isCompressed(GLint level) const; + bool isDepth(GLint level) const; + + void setImage(GLint level, GLsizei width, GLsizei height, GLsizei depth, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels); + void setCompressedImage(GLint level, GLenum format, GLsizei width, GLsizei height, GLsizei depth, GLsizei imageSize, const void *pixels); + void subImage(GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels); + void subImageCompressed(GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *pixels); + void storage(GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); + + virtual void generateMipmaps(); + virtual void copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source); + + virtual bool isSamplerComplete(const SamplerState &samplerState) const; + virtual bool isMipmapComplete() const; + + unsigned int getRenderTargetSerial(GLint level, GLint layer); + + protected: + friend class Texture2DArrayAttachment; + rx::RenderTarget *getRenderTarget(GLint level, GLint layer); + rx::RenderTarget *getDepthStencil(GLint level, GLint layer); + + private: + DISALLOW_COPY_AND_ASSIGN(Texture2DArray); + + virtual const rx::Image *getBaseLevelImage() const; + + rx::Texture2DArrayImpl *mTexture; }; + } #endif // LIBGLESV2_TEXTURE_H_ -- cgit v1.2.3