summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/angle/src/libGLESv2/Texture.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/angle/src/libGLESv2/Texture.h')
-rw-r--r--src/3rdparty/angle/src/libGLESv2/Texture.h154
1 files changed, 50 insertions, 104 deletions
diff --git a/src/3rdparty/angle/src/libGLESv2/Texture.h b/src/3rdparty/angle/src/libGLESv2/Texture.h
index 29f952f9f6..ca5686fde3 100644
--- a/src/3rdparty/angle/src/libGLESv2/Texture.h
+++ b/src/3rdparty/angle/src/libGLESv2/Texture.h
@@ -11,14 +11,16 @@
#ifndef LIBGLESV2_TEXTURE_H_
#define LIBGLESV2_TEXTURE_H_
-#include <vector>
-
-#include "angle_gl.h"
-
#include "common/debug.h"
#include "common/RefCountObject.h"
#include "libGLESv2/angletypes.h"
#include "libGLESv2/constants.h"
+#include "libGLESv2/renderer/TextureImpl.h"
+#include "libGLESv2/Caps.h"
+
+#include "angle_gl.h"
+
+#include <vector>
namespace egl
{
@@ -27,12 +29,7 @@ class Surface;
namespace rx
{
-class Texture2DImpl;
-class TextureCubeImpl;
-class Texture3DImpl;
-class Texture2DArrayImpl;
class TextureStorageInterface;
-class RenderTarget;
class Image;
}
@@ -40,11 +37,14 @@ namespace gl
{
class Framebuffer;
class FramebufferAttachment;
+struct ImageIndex;
+
+bool IsMipmapFiltered(const gl::SamplerState &samplerState);
class Texture : public RefCountObject
{
public:
- Texture(GLuint id, GLenum target);
+ Texture(rx::TextureImpl *impl, GLuint id, GLenum target);
virtual ~Texture();
@@ -54,7 +54,7 @@ class Texture : public RefCountObject
SamplerState &getSamplerState() { return mSamplerState; }
void getSamplerStateWithNativeOffset(SamplerState *sampler);
- virtual void setUsage(GLenum usage);
+ void setUsage(GLenum usage);
GLenum getUsage() const;
GLint getBaseLevelWidth() const;
@@ -62,25 +62,33 @@ class Texture : public RefCountObject
GLint getBaseLevelDepth() const;
GLenum getBaseLevelInternalFormat() const;
- virtual bool isSamplerComplete(const SamplerState &samplerState) const = 0;
+ GLsizei getWidth(const ImageIndex &index) const;
+ GLsizei getHeight(const ImageIndex &index) const;
+ GLenum getInternalFormat(const ImageIndex &index) const;
+ GLenum getActualFormat(const ImageIndex &index) const;
- virtual rx::TextureStorageInterface *getNativeTexture() = 0;
+ virtual bool isSamplerComplete(const SamplerState &samplerState, const TextureCapsMap &textureCaps, const Extensions &extensions, int clientVersion) const = 0;
- virtual void generateMipmaps() = 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;
+ rx::TextureStorage *getNativeTexture();
+
+ 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 hasDirtyImages() const = 0;
- virtual void resetDirty() = 0;
unsigned int getTextureSerial();
bool isImmutable() const;
int immutableLevelCount();
+ rx::TextureImpl *getImplementation() { return mTexture; }
+ const rx::TextureImpl *getImplementation() const { return mTexture; }
+
static const GLuint INCOMPLETE_TEXTURE_ID = static_cast<GLuint>(-1); // Every texture takes an id at creation time. The value is arbitrary because it is never registered with the resource manager.
protected:
int mipLevels() const;
+ rx::TextureImpl *mTexture;
+
SamplerState mSamplerState;
GLenum mUsage;
@@ -88,23 +96,18 @@ class Texture : public RefCountObject
GLenum mTarget;
+ const rx::Image *getBaseLevelImage() const;
+
private:
DISALLOW_COPY_AND_ASSIGN(Texture);
-
- virtual const rx::Image *getBaseLevelImage() const = 0;
};
class Texture2D : public Texture
{
public:
- Texture2D(rx::Texture2DImpl *impl, GLuint id);
-
- ~Texture2D();
+ Texture2D(rx::TextureImpl *impl, GLuint id);
- virtual rx::TextureStorageInterface *getNativeTexture();
- virtual void setUsage(GLenum usage);
- virtual bool hasDirtyImages() const;
- virtual void resetDirty();
+ virtual ~Texture2D();
GLsizei getWidth(GLint level) const;
GLsizei getHeight(GLint level) const;
@@ -118,44 +121,29 @@ class Texture2D : public Texture
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 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 SamplerState &samplerState) const;
+ virtual bool isSamplerComplete(const SamplerState &samplerState, const TextureCapsMap &textureCaps, const Extensions &extensions, int clientVersion) const;
virtual void bindTexImage(egl::Surface *surface);
virtual void releaseTexImage();
virtual void generateMipmaps();
- unsigned int getRenderTargetSerial(GLint level);
-
- protected:
- friend class Texture2DAttachment;
- rx::RenderTarget *getRenderTarget(GLint level);
- rx::RenderTarget *getDepthSencil(GLint level);
-
private:
DISALLOW_COPY_AND_ASSIGN(Texture2D);
- virtual const rx::Image *getBaseLevelImage() const;
+ bool isMipmapComplete() const;
+ bool isLevelComplete(int level) const;
- void redefineImage(GLint level, GLenum internalformat, GLsizei width, GLsizei height);
-
- rx::Texture2DImpl *mTexture;
egl::Surface *mSurface;
};
class TextureCubeMap : public Texture
{
public:
- TextureCubeMap(rx::TextureCubeImpl *impl, GLuint id);
-
- ~TextureCubeMap();
+ TextureCubeMap(rx::TextureImpl *impl, GLuint id);
- virtual rx::TextureStorageInterface *getNativeTexture();
- virtual void setUsage(GLenum usage);
- virtual bool hasDirtyImages() const;
- virtual void resetDirty();
+ virtual ~TextureCubeMap();
GLsizei getWidth(GLenum target, GLint level) const;
GLsizei getHeight(GLenum target, GLint level) const;
@@ -176,40 +164,28 @@ class TextureCubeMap : public Texture
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 zoffset, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source);
void storage(GLsizei levels, GLenum internalformat, GLsizei size);
- virtual bool isSamplerComplete(const SamplerState &samplerState) const;
- bool isCubeComplete() const;
-
- virtual void generateMipmaps();
+ virtual bool isSamplerComplete(const SamplerState &samplerState, const TextureCapsMap &textureCaps, const Extensions &extensions, int clientVersion) const;
- unsigned int getRenderTargetSerial(GLenum target, GLint level);
+ bool isCubeComplete() const;
- protected:
- friend class TextureCubeMapAttachment;
- rx::RenderTarget *getRenderTarget(GLenum target, GLint level);
- rx::RenderTarget *getDepthStencil(GLenum target, GLint level);
+ static int targetToLayerIndex(GLenum target);
+ static GLenum layerIndexToTarget(GLint layer);
private:
DISALLOW_COPY_AND_ASSIGN(TextureCubeMap);
- virtual const rx::Image *getBaseLevelImage() const;
-
- rx::TextureCubeImpl *mTexture;
+ bool isMipmapComplete() const;
+ bool isFaceLevelComplete(int faceIndex, int level) const;
};
class Texture3D : public Texture
{
public:
- Texture3D(rx::Texture3DImpl *impl, GLuint id);
-
- ~Texture3D();
+ Texture3D(rx::TextureImpl *impl, GLuint id);
- virtual rx::TextureStorageInterface *getNativeTexture();
- virtual void setUsage(GLenum usage);
- virtual bool hasDirtyImages() const;
- virtual void resetDirty();
+ virtual ~Texture3D();
GLsizei getWidth(GLint level) const;
GLsizei getHeight(GLint level) const;
@@ -225,39 +201,21 @@ class Texture3D : public Texture
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 Texture3DAttachment;
- rx::RenderTarget *getRenderTarget(GLint level);
- rx::RenderTarget *getRenderTarget(GLint level, GLint layer);
- rx::RenderTarget *getDepthStencil(GLint level, GLint layer);
+ virtual bool isSamplerComplete(const SamplerState &samplerState, const TextureCapsMap &textureCaps, const Extensions &extensions, int clientVersion) const;
private:
DISALLOW_COPY_AND_ASSIGN(Texture3D);
- virtual const rx::Image *getBaseLevelImage() const;
-
- rx::Texture3DImpl *mTexture;
+ bool isMipmapComplete() const;
+ bool isLevelComplete(int level) const;
};
class Texture2DArray : public Texture
{
public:
- Texture2DArray(rx::Texture2DArrayImpl *impl, GLuint id);
+ Texture2DArray(rx::TextureImpl *impl, GLuint id);
- ~Texture2DArray();
-
- virtual rx::TextureStorageInterface *getNativeTexture();
- virtual void setUsage(GLenum usage);
- virtual bool hasDirtyImages() const;
- virtual void resetDirty();
+ virtual ~Texture2DArray();
GLsizei getWidth(GLint level) const;
GLsizei getHeight(GLint level) const;
@@ -273,25 +231,13 @@ class Texture2DArray : public Texture
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);
+ virtual bool isSamplerComplete(const SamplerState &samplerState, const TextureCapsMap &textureCaps, const Extensions &extensions, int clientVersion) const;
private:
DISALLOW_COPY_AND_ASSIGN(Texture2DArray);
- virtual const rx::Image *getBaseLevelImage() const;
-
- rx::Texture2DArrayImpl *mTexture;
+ bool isMipmapComplete() const;
+ bool isLevelComplete(int level) const;
};
}