blob: 2aa0d5537cfe94134b88bd5d66016d7e9a4519c1 [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
Brandon Jones6b19b002014-07-16 14:32:05 -070034class TextureImpl
Brandon Jonesf47bebc2014-07-09 14:28:42 -070035{
36 public:
Brandon Jonesf47bebc2014-07-09 14:28:42 -070037 // TODO: If this methods could go away that would be ideal;
38 // TextureStorage should only be necessary for the D3D backend, and as such
39 // higher level code should not rely on it.
40 virtual TextureStorageInterface *getNativeTexture() = 0;
41
Brandon Jonescef06ff2014-08-05 13:27:48 -070042 virtual Image *getImage(int level, int layer) const = 0;
43 virtual GLsizei getLayerCount(int level) const = 0;
44
45 virtual bool hasDirtyImages() const = 0;
46 virtual void resetDirty() = 0;
Brandon Jonesf47bebc2014-07-09 14:28:42 -070047 virtual void setUsage(GLenum usage) = 0;
Brandon Jonesf47bebc2014-07-09 14:28:42 -070048
49 virtual bool isSamplerComplete(const gl::SamplerState &samplerState) const = 0;
Brandon Jones6b19b002014-07-16 14:32:05 -070050
Brandon Jonescef06ff2014-08-05 13:27:48 -070051 virtual void setImage(GLenum target, GLint level, GLsizei width, GLsizei height, GLsizei depth, GLenum internalFormat, GLenum format, GLenum type, const gl::PixelUnpackState &unpack, const void *pixels) = 0;
52 virtual void setCompressedImage(GLenum target, GLint level, GLenum format, GLsizei width, GLsizei height, GLsizei depth, GLsizei imageSize, const void *pixels) = 0;
53 virtual void subImage(GLenum target, 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;
54 virtual void subImageCompressed(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *pixels) = 0;
55 virtual void copyImage(GLenum target, GLint level, GLenum format, GLint x, GLint y, GLsizei width, GLsizei height, gl::Framebuffer *source) = 0;
Brandon Jones6b19b002014-07-16 14:32:05 -070056 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;
Brandon Jonescef06ff2014-08-05 13:27:48 -070057 virtual void storage(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth) = 0;
Brandon Jones6b19b002014-07-16 14:32:05 -070058
59 virtual void generateMipmaps() = 0;
Brandon Jonescef06ff2014-08-05 13:27:48 -070060
61 virtual unsigned int getRenderTargetSerial(GLint level, GLint layer) = 0;
62 virtual RenderTarget *getRenderTarget(GLint level, GLint layer) = 0;
63 virtual RenderTarget *getDepthStencil(GLint level, GLint layer) = 0;
Brandon Jones6b19b002014-07-16 14:32:05 -070064};
65
66class Texture2DImpl : public TextureImpl
67{
68 public:
69 virtual ~Texture2DImpl() {}
70
Brandon Jonesf47bebc2014-07-09 14:28:42 -070071 virtual void bindTexImage(egl::Surface *surface) = 0;
72 virtual void releaseTexImage() = 0;
Brandon Jonesf47bebc2014-07-09 14:28:42 -070073};
74
Brandon Jones6b19b002014-07-16 14:32:05 -070075class TextureCubeImpl : public TextureImpl
Brandon Jones0511e802014-07-14 16:27:26 -070076{
77 public:
78 virtual ~TextureCubeImpl() {}
79
Brandon Jones0511e802014-07-14 16:27:26 -070080 virtual bool isCubeComplete() const = 0;
Brandon Jones0511e802014-07-14 16:27:26 -070081};
82
Brandon Jones6b19b002014-07-16 14:32:05 -070083class Texture3DImpl : public TextureImpl
Brandon Jones78b1acd2014-07-15 15:33:07 -070084{
85 public:
86 virtual ~Texture3DImpl() {}
Brandon Jones78b1acd2014-07-15 15:33:07 -070087};
88
Brandon Jones6b19b002014-07-16 14:32:05 -070089class Texture2DArrayImpl : public TextureImpl
Brandon Jones142ec422014-07-16 10:31:30 -070090{
91 public:
92 virtual ~Texture2DArrayImpl() {}
Brandon Jones142ec422014-07-16 10:31:30 -070093};
94
Brandon Jonesf47bebc2014-07-09 14:28:42 -070095}
96
97#endif // LIBGLESV2_RENDERER_TEXTUREIMPL_H_