summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/angle/src/libGLESv2/renderer/TextureImpl.h
blob: 35c916602335545c7fc3b9f10ef86dcd71d97e7c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
//
// Copyright 2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//

// TextureImpl.h: Defines the abstract rx::TextureImpl classes.

#ifndef LIBGLESV2_RENDERER_TEXTUREIMPL_H_
#define LIBGLESV2_RENDERER_TEXTUREIMPL_H_

#include "common/angleutils.h"

namespace egl
{
class Surface;
}

namespace gl
{
class Framebuffer;
struct PixelUnpackState;
struct SamplerState;
}

namespace rx
{

class Image;
class RenderTarget;
class Renderer;
class TextureStorageInterface;

class Texture2DImpl
{
  public:
    virtual ~Texture2DImpl() {}

    // TODO: If this methods could go away that would be ideal;
    // TextureStorage should only be necessary for the D3D backend, and as such
    // higher level code should not rely on it.
    virtual TextureStorageInterface *getNativeTexture() = 0;

    virtual Image *getImage(int level) const = 0;

    virtual void setUsage(GLenum usage) = 0;
    virtual bool hasDirtyImages() const = 0;
    virtual void resetDirty() = 0;

    virtual bool isSamplerComplete(const gl::SamplerState &samplerState) const = 0;
    virtual void bindTexImage(egl::Surface *surface) = 0;
    virtual void releaseTexImage() = 0;

    virtual void setImage(GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const gl::PixelUnpackState &unpack, const void *pixels) = 0;
    virtual void setCompressedImage(GLint level, GLenum format, GLsizei width, GLsizei height, GLsizei imageSize, const void *pixels) = 0;
    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;
    virtual void subImageCompressed(GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *pixels) = 0;
    virtual void copyImage(GLint level, GLenum format, GLint x, GLint y, GLsizei width, GLsizei height, gl::Framebuffer *source) = 0;
    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;
    virtual void storage(GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height) = 0;
    virtual void generateMipmaps() = 0;

    virtual unsigned int getRenderTargetSerial(GLint level) = 0;

    virtual RenderTarget *getRenderTarget(GLint level) = 0;
    virtual RenderTarget *getDepthSencil(GLint level) = 0;

    virtual void redefineImage(GLint level, GLenum internalformat, GLsizei width, GLsizei height) = 0;
};

class TextureCubeImpl
{
  public:
    virtual ~TextureCubeImpl() {}

    virtual TextureStorageInterface *getNativeTexture() = 0;

    virtual Image *getImage(GLenum target, int level) const = 0;

    virtual void setUsage(GLenum usage) = 0;
    virtual bool hasDirtyImages() const = 0;
    virtual void resetDirty() = 0;

    virtual bool isSamplerComplete(const gl::SamplerState &samplerState) const = 0;
    virtual bool isCubeComplete() const = 0;

    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;
    virtual void setCompressedImage(GLenum target, GLint level, GLenum format, GLsizei width, GLsizei height, GLsizei imageSize, const void *pixels) = 0;
    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;
    virtual void subImageCompressed(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *pixels) = 0;
    virtual void copyImage(GLenum target, GLint level, GLenum format, GLint x, GLint y, GLsizei width, GLsizei height, gl::Framebuffer *source) = 0;
    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;
    virtual void storage(GLsizei levels, GLenum internalformat, GLsizei size) = 0;
    virtual void generateMipmaps() = 0;

    virtual unsigned int getRenderTargetSerial(GLenum target, GLint level) = 0;

    virtual RenderTarget *getRenderTarget(GLenum target, GLint level) = 0;
    virtual RenderTarget *getDepthStencil(GLenum target, GLint level) = 0;
};

class Texture3DImpl
{
  public:
    virtual ~Texture3DImpl() {}

    virtual TextureStorageInterface *getNativeTexture() = 0;

    virtual Image *getImage(int level) const = 0;

    virtual void setUsage(GLenum usage) = 0;
    virtual bool hasDirtyImages() const = 0;
    virtual void resetDirty() = 0;

    virtual bool isSamplerComplete(const gl::SamplerState &samplerState) const = 0;
    virtual bool isMipmapComplete() const = 0;

    virtual void setImage(GLint level, GLsizei width, GLsizei height, GLsizei depth, GLenum internalFormat, GLenum format, GLenum type, const gl::PixelUnpackState &unpack, const void *pixels) = 0;
    virtual void setCompressedImage(GLint level, GLenum format, GLsizei width, GLsizei height, GLsizei depth, GLsizei imageSize, const void *pixels) = 0;
    virtual void subImage(GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const gl::PixelUnpackState &unpack, const void *pixels) = 0;
    virtual void subImageCompressed(GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *pixels) = 0;
    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;
    virtual void storage(GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth) = 0;
    virtual void generateMipmaps() = 0;

    virtual unsigned int getRenderTargetSerial(GLint level, GLint layer) = 0;

    virtual RenderTarget *getRenderTarget(GLint level) = 0;
    virtual RenderTarget *getRenderTarget(GLint level, GLint layer) = 0;
    virtual RenderTarget *getDepthStencil(GLint level, GLint layer) = 0;
};

class Texture2DArrayImpl
{
  public:
    virtual ~Texture2DArrayImpl() {}

    virtual TextureStorageInterface *getNativeTexture() = 0;

    virtual Image *getImage(int level, int layer) const = 0;
    virtual GLsizei getLayerCount(int level) const = 0;

    virtual void setUsage(GLenum usage) = 0;
    virtual bool hasDirtyImages() const = 0;
    virtual void resetDirty() = 0;

    virtual bool isSamplerComplete(const gl::SamplerState &samplerState) const = 0;
    virtual bool isMipmapComplete() const = 0;

    virtual void setImage(GLint level, GLsizei width, GLsizei height, GLsizei depth, GLenum internalFormat, GLenum format, GLenum type, const gl::PixelUnpackState &unpack, const void *pixels) = 0;
    virtual void setCompressedImage(GLint level, GLenum format, GLsizei width, GLsizei height, GLsizei depth, GLsizei imageSize, const void *pixels) = 0;
    virtual void subImage(GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const gl::PixelUnpackState &unpack, const void *pixels) = 0;
    virtual void subImageCompressed(GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *pixels) = 0;
    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;
    virtual void storage(GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth) = 0;
    virtual void generateMipmaps() = 0;

    virtual unsigned int getRenderTargetSerial(GLint level, GLint layer) = 0;

    virtual RenderTarget *getRenderTarget(GLint level, GLint layer) = 0;
    virtual RenderTarget *getDepthStencil(GLint level, GLint layer) = 0;
};

}

#endif // LIBGLESV2_RENDERER_TEXTUREIMPL_H_