1 // 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 LIBANGLE_RENDERER_TEXTUREIMPL_H_ 10 #define LIBANGLE_RENDERER_TEXTUREIMPL_H_ 11 12 #include <stdint.h> 13 14 #include "angle_gl.h" 15 #include "common/angleutils.h" 16 #include "libANGLE/Error.h" 17 #include "libANGLE/ImageIndex.h" 18 #include "libANGLE/Stream.h" 19 #include "libANGLE/Texture.h" 20 #include "libANGLE/renderer/FramebufferAttachmentObjectImpl.h" 21 22 namespace egl 23 { 24 class Surface; 25 class Image; 26 } 27 28 namespace gl 29 { 30 struct Box; 31 struct Extents; 32 struct Offset; 33 struct Rectangle; 34 class Framebuffer; 35 struct PixelUnpackState; 36 struct TextureState; 37 } 38 39 namespace rx 40 { 41 class ContextImpl; 42 43 class TextureImpl : public FramebufferAttachmentObjectImpl 44 { 45 public: 46 TextureImpl(const gl::TextureState &state); 47 ~TextureImpl() override; 48 49 virtual gl::Error onDestroy(const gl::Context *context); 50 51 virtual gl::Error setImage(const gl::Context *context, 52 GLenum target, 53 size_t level, 54 GLenum internalFormat, 55 const gl::Extents &size, 56 GLenum format, 57 GLenum type, 58 const gl::PixelUnpackState &unpack, 59 const uint8_t *pixels) = 0; 60 virtual gl::Error setSubImage(const gl::Context *context, 61 GLenum target, 62 size_t level, 63 const gl::Box &area, 64 GLenum format, 65 GLenum type, 66 const gl::PixelUnpackState &unpack, 67 const uint8_t *pixels) = 0; 68 69 virtual gl::Error setCompressedImage(const gl::Context *context, 70 GLenum target, 71 size_t level, 72 GLenum internalFormat, 73 const gl::Extents &size, 74 const gl::PixelUnpackState &unpack, 75 size_t imageSize, 76 const uint8_t *pixels) = 0; 77 virtual gl::Error setCompressedSubImage(const gl::Context *context, 78 GLenum target, 79 size_t level, 80 const gl::Box &area, 81 GLenum format, 82 const gl::PixelUnpackState &unpack, 83 size_t imageSize, 84 const uint8_t *pixels) = 0; 85 86 virtual gl::Error copyImage(const gl::Context *context, 87 GLenum target, 88 size_t level, 89 const gl::Rectangle &sourceArea, 90 GLenum internalFormat, 91 const gl::Framebuffer *source) = 0; 92 virtual gl::Error copySubImage(const gl::Context *context, 93 GLenum target, 94 size_t level, 95 const gl::Offset &destOffset, 96 const gl::Rectangle &sourceArea, 97 const gl::Framebuffer *source) = 0; 98 99 virtual gl::Error copyTexture(const gl::Context *context, 100 GLenum target, 101 size_t level, 102 GLenum internalFormat, 103 GLenum type, 104 size_t sourceLevel, 105 bool unpackFlipY, 106 bool unpackPremultiplyAlpha, 107 bool unpackUnmultiplyAlpha, 108 const gl::Texture *source); 109 virtual gl::Error copySubTexture(const gl::Context *context, 110 GLenum target, 111 size_t level, 112 const gl::Offset &destOffset, 113 size_t sourceLevel, 114 const gl::Rectangle &sourceArea, 115 bool unpackFlipY, 116 bool unpackPremultiplyAlpha, 117 bool unpackUnmultiplyAlpha, 118 const gl::Texture *source); 119 120 virtual gl::Error copyCompressedTexture(const gl::Context *context, const gl::Texture *source); 121 122 virtual gl::Error setStorage(const gl::Context *context, 123 GLenum target, 124 size_t levels, 125 GLenum internalFormat, 126 const gl::Extents &size) = 0; 127 128 virtual gl::Error setStorageMultisample(const gl::Context *context, 129 GLenum target, 130 GLsizei samples, 131 GLint internalformat, 132 const gl::Extents &size, 133 bool fixedSampleLocations) = 0; 134 135 virtual gl::Error setEGLImageTarget(const gl::Context *context, 136 GLenum target, 137 egl::Image *image) = 0; 138 139 virtual gl::Error setImageExternal(const gl::Context *context, 140 GLenum target, 141 egl::Stream *stream, 142 const egl::Stream::GLTextureDescription &desc) = 0; 143 144 virtual gl::Error generateMipmap(const gl::Context *context) = 0; 145 146 virtual gl::Error setBaseLevel(const gl::Context *context, GLuint baseLevel) = 0; 147 148 virtual gl::Error bindTexImage(const gl::Context *context, egl::Surface *surface) = 0; 149 virtual gl::Error releaseTexImage(const gl::Context *context) = 0; 150 151 virtual void syncState(const gl::Texture::DirtyBits &dirtyBits) = 0; 152 153 protected: 154 const gl::TextureState &mState; 155 }; 156 157 } 158 159 #endif // LIBANGLE_RENDERER_TEXTUREIMPL_H_ 160