blob: 1ac945380e737e2b499ae3e2f3246d0aad7b2bc3 [file] [log] [blame]
Brandon Jonesf47bebc2014-07-09 14:28:42 -07001//
2// Copyright 2014 The ANGLE Project Authors. All rights reserved.
3// Use of this source code is governed by a BSD-style license that can be
4// found in the LICENSE file.
5//
6
7// TextureImpl.h: Defines the abstract rx::TextureImpl classes.
8
9#ifndef LIBGLESV2_RENDERER_TEXTUREIMPL_H_
10#define LIBGLESV2_RENDERER_TEXTUREIMPL_H_
11
12#include "common/angleutils.h"
13
Brandon Jones0511e802014-07-14 16:27:26 -070014namespace egl
15{
16class Surface;
17}
18
Brandon Jonesf47bebc2014-07-09 14:28:42 -070019namespace gl
20{
21class Framebuffer;
Brandon Jones0511e802014-07-14 16:27:26 -070022struct PixelUnpackState;
Brandon Jonesf47bebc2014-07-09 14:28:42 -070023struct SamplerState;
24}
25
26namespace rx
27{
28
29class Image;
30class RenderTarget;
31class Renderer;
32class TextureStorageInterface;
Brandon Jonesf47bebc2014-07-09 14:28:42 -070033
34class Texture2DImpl
35{
36 public:
37 virtual ~Texture2DImpl() {}
38
39 // TODO: If this methods could go away that would be ideal;
40 // TextureStorage should only be necessary for the D3D backend, and as such
41 // higher level code should not rely on it.
42 virtual TextureStorageInterface *getNativeTexture() = 0;
43
44 virtual Image *getImage(int level) const = 0;
45
46 virtual void setUsage(GLenum usage) = 0;
47 virtual bool hasDirtyImages() const = 0;
48 virtual void resetDirty() = 0;
49
50 virtual bool isSamplerComplete(const gl::SamplerState &samplerState) const = 0;
51 virtual void bindTexImage(egl::Surface *surface) = 0;
52 virtual void releaseTexImage() = 0;
53
54 virtual void setImage(GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const gl::PixelUnpackState &unpack, const void *pixels) = 0;
55 virtual void setCompressedImage(GLint level, GLenum format, GLsizei width, GLsizei height, GLsizei imageSize, const void *pixels) = 0;
56 virtual void subImage(GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const gl::PixelUnpackState &unpack, const void *pixels) = 0;
57 virtual void subImageCompressed(GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *pixels) = 0;
58 virtual void copyImage(GLint level, GLenum format, GLint x, GLint y, GLsizei width, GLsizei height, gl::Framebuffer *source) = 0;
59 virtual void copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height, gl::Framebuffer *source) = 0;
60 virtual void storage(GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height) = 0;
61 virtual void generateMipmaps() = 0;
62
63 virtual unsigned int getRenderTargetSerial(GLint level) = 0;
64
65 virtual RenderTarget *getRenderTarget(GLint level) = 0;
66 virtual RenderTarget *getDepthSencil(GLint level) = 0;
67
68 virtual void redefineImage(GLint level, GLenum internalformat, GLsizei width, GLsizei height) = 0;
69};
70
Brandon Jones0511e802014-07-14 16:27:26 -070071class TextureCubeImpl
72{
73 public:
74 virtual ~TextureCubeImpl() {}
75
76 virtual TextureStorageInterface *getNativeTexture() = 0;
77
78 virtual Image *getImage(GLenum target, int level) const = 0;
79
80 virtual void setUsage(GLenum usage) = 0;
81 virtual bool hasDirtyImages() const = 0;
82 virtual void resetDirty() = 0;
83
84 virtual bool isSamplerComplete(const gl::SamplerState &samplerState) const = 0;
85 virtual bool isCubeComplete() const = 0;
86
87 virtual void setImage(int faceIndex, GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const gl::PixelUnpackState &unpack, const void *pixels) = 0;
88 virtual void setCompressedImage(GLenum target, GLint level, GLenum format, GLsizei width, GLsizei height, GLsizei imageSize, const void *pixels) = 0;
89 virtual void subImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const gl::PixelUnpackState &unpack, const void *pixels) = 0;
90 virtual void subImageCompressed(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *pixels) = 0;
91 virtual void copyImage(GLenum target, GLint level, GLenum format, GLint x, GLint y, GLsizei width, GLsizei height, gl::Framebuffer *source) = 0;
92 virtual void copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height, gl::Framebuffer *source) = 0;
93 virtual void storage(GLsizei levels, GLenum internalformat, GLsizei size) = 0;
94 virtual void generateMipmaps() = 0;
95
96 virtual unsigned int getRenderTargetSerial(GLenum target, GLint level) = 0;
97
98 virtual RenderTarget *getRenderTarget(GLenum target, GLint level) = 0;
99 virtual RenderTarget *getDepthStencil(GLenum target, GLint level) = 0;
100};
101
Brandon Jonesf47bebc2014-07-09 14:28:42 -0700102}
103
104#endif // LIBGLESV2_RENDERER_TEXTUREIMPL_H_