daniel@transgaming.com | b9d7e6f | 2012-10-31 19:08:32 +0000 | [diff] [blame] | 1 | // |
| 2 | // Copyright (c) 2002-2012 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 | |
daniel@transgaming.com | 4ba2406 | 2012-12-20 20:54:24 +0000 | [diff] [blame] | 7 | // Image.h: Defines the rx::Image class, an abstract base class for the |
| 8 | // renderer-specific classes which will define the interface to the underlying |
| 9 | // surfaces or resources. |
daniel@transgaming.com | b9d7e6f | 2012-10-31 19:08:32 +0000 | [diff] [blame] | 10 | |
| 11 | #ifndef LIBGLESV2_RENDERER_IMAGE_H_ |
| 12 | #define LIBGLESV2_RENDERER_IMAGE_H_ |
| 13 | |
daniel@transgaming.com | b9d7e6f | 2012-10-31 19:08:32 +0000 | [diff] [blame] | 14 | #include "common/debug.h" |
| 15 | |
daniel@transgaming.com | 31b13e1 | 2012-11-28 19:34:30 +0000 | [diff] [blame] | 16 | namespace gl |
| 17 | { |
| 18 | class Framebuffer; |
| 19 | } |
| 20 | |
daniel@transgaming.com | a957168 | 2012-11-28 19:33:08 +0000 | [diff] [blame] | 21 | namespace rx |
| 22 | { |
daniel@transgaming.com | c5c806d | 2012-12-20 20:52:53 +0000 | [diff] [blame] | 23 | class Renderer; |
daniel@transgaming.com | 87705f8 | 2012-12-20 21:10:45 +0000 | [diff] [blame] | 24 | class TextureStorageInterface2D; |
| 25 | class TextureStorageInterfaceCube; |
shannon.woods%transgaming.com@gtempaccount.com | 2058d64 | 2013-04-13 03:42:50 +0000 | [diff] [blame] | 26 | class TextureStorageInterface3D; |
daniel@transgaming.com | 0f195ad | 2012-10-31 19:51:59 +0000 | [diff] [blame] | 27 | |
daniel@transgaming.com | b9d7e6f | 2012-10-31 19:08:32 +0000 | [diff] [blame] | 28 | class Image |
| 29 | { |
| 30 | public: |
| 31 | Image(); |
daniel@transgaming.com | 4ba2406 | 2012-12-20 20:54:24 +0000 | [diff] [blame] | 32 | virtual ~Image() {}; |
daniel@transgaming.com | b9d7e6f | 2012-10-31 19:08:32 +0000 | [diff] [blame] | 33 | |
daniel@transgaming.com | 4ba2406 | 2012-12-20 20:54:24 +0000 | [diff] [blame] | 34 | GLsizei getWidth() const { return mWidth; } |
| 35 | GLsizei getHeight() const { return mHeight; } |
shannon.woods%transgaming.com@gtempaccount.com | 4760c56 | 2013-04-13 03:42:30 +0000 | [diff] [blame] | 36 | GLsizei getDepth() const { return mDepth; } |
daniel@transgaming.com | 4ba2406 | 2012-12-20 20:54:24 +0000 | [diff] [blame] | 37 | GLenum getInternalFormat() const { return mInternalFormat; } |
| 38 | GLenum getActualFormat() const { return mActualFormat; } |
daniel@transgaming.com | b9d7e6f | 2012-10-31 19:08:32 +0000 | [diff] [blame] | 39 | |
daniel@transgaming.com | b9d7e6f | 2012-10-31 19:08:32 +0000 | [diff] [blame] | 40 | void markDirty() {mDirty = true;} |
| 41 | void markClean() {mDirty = false;} |
daniel@transgaming.com | 4ba2406 | 2012-12-20 20:54:24 +0000 | [diff] [blame] | 42 | virtual bool isDirty() const = 0; |
daniel@transgaming.com | b9d7e6f | 2012-10-31 19:08:32 +0000 | [diff] [blame] | 43 | |
daniel@transgaming.com | 87705f8 | 2012-12-20 21:10:45 +0000 | [diff] [blame] | 44 | virtual void setManagedSurface(TextureStorageInterface2D *storage, int level) {}; |
| 45 | virtual void setManagedSurface(TextureStorageInterfaceCube *storage, int face, int level) {}; |
shannon.woods%transgaming.com@gtempaccount.com | 2058d64 | 2013-04-13 03:42:50 +0000 | [diff] [blame] | 46 | virtual void setManagedSurface(TextureStorageInterface3D *storage, int level) {}; |
daniel@transgaming.com | 87705f8 | 2012-12-20 21:10:45 +0000 | [diff] [blame] | 47 | virtual bool updateSurface(TextureStorageInterface2D *storage, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height) = 0; |
| 48 | virtual bool updateSurface(TextureStorageInterfaceCube *storage, int face, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height) = 0; |
shannon.woods%transgaming.com@gtempaccount.com | 2058d64 | 2013-04-13 03:42:50 +0000 | [diff] [blame] | 49 | virtual bool updateSurface(TextureStorageInterface3D *storage, int level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth) = 0; |
daniel@transgaming.com | b9d7e6f | 2012-10-31 19:08:32 +0000 | [diff] [blame] | 50 | |
shannon.woods%transgaming.com@gtempaccount.com | 4760c56 | 2013-04-13 03:42:30 +0000 | [diff] [blame] | 51 | virtual bool redefine(Renderer *renderer, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, bool forceRelease) = 0; |
daniel@transgaming.com | b9d7e6f | 2012-10-31 19:08:32 +0000 | [diff] [blame] | 52 | |
daniel@transgaming.com | 4ba2406 | 2012-12-20 20:54:24 +0000 | [diff] [blame] | 53 | virtual bool isRenderableFormat() const = 0; |
| 54 | |
shannon.woods%transgaming.com@gtempaccount.com | 4760c56 | 2013-04-13 03:42:30 +0000 | [diff] [blame] | 55 | virtual void loadData(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, |
| 56 | GLint unpackAlignment, const void *input) = 0; |
| 57 | virtual void loadCompressedData(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, |
daniel@transgaming.com | 4ba2406 | 2012-12-20 20:54:24 +0000 | [diff] [blame] | 58 | const void *input) = 0; |
daniel@transgaming.com | b9d7e6f | 2012-10-31 19:08:32 +0000 | [diff] [blame] | 59 | |
shannon.woods%transgaming.com@gtempaccount.com | e5dcce7 | 2013-04-13 03:44:33 +0000 | [diff] [blame^] | 60 | virtual void copy(GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height, gl::Framebuffer *source) = 0; |
daniel@transgaming.com | b9d7e6f | 2012-10-31 19:08:32 +0000 | [diff] [blame] | 61 | |
shannon.woods%transgaming.com@gtempaccount.com | 4760c56 | 2013-04-13 03:42:30 +0000 | [diff] [blame] | 62 | static void loadAlphaDataToBGRA(GLsizei width, GLsizei height, GLsizei depth, |
| 63 | int inputRowPitch, int inputDepthPitch, const void *input, |
| 64 | size_t outputRowPitch, size_t outputDepthPitch, void *output); |
| 65 | static void loadAlphaDataToNative(GLsizei width, GLsizei height, GLsizei depth, |
| 66 | int inputRowPitch, int inputDepthPitch, const void *input, |
| 67 | size_t outRowputPitch, size_t outputDepthPitch, void *output); |
| 68 | static void loadAlphaDataToBGRASSE2(GLsizei width, GLsizei height, GLsizei depth, |
| 69 | int inputRowPitch, int inputDepthPitch, const void *input, |
| 70 | size_t outputRowPitch, size_t outputDepthPitch, void *output); |
| 71 | static void loadAlphaFloatDataToRGBA(GLsizei width, GLsizei height, GLsizei depth, |
| 72 | int inputRowPitch, int inputDepthPitch, const void *input, |
| 73 | size_t outputRowPitch, size_t outputDepthPitch, void *output); |
| 74 | static void loadAlphaHalfFloatDataToRGBA(GLsizei width, GLsizei height, GLsizei depth, |
| 75 | int inputRowPitch, int inputDepthPitch, const void *input, |
| 76 | size_t outputRowPitch, size_t outputDepthPitch, void *output); |
| 77 | static void loadLuminanceDataToNativeOrBGRA(GLsizei width, GLsizei height, GLsizei depth, |
| 78 | int inputRowPitch, int inputDepthPitch, const void *input, |
| 79 | size_t outputRowPitch, size_t outputDepthPitch, void *output, |
| 80 | bool native); |
| 81 | static void loadLuminanceFloatDataToRGBA(GLsizei width, GLsizei height, GLsizei depth, |
| 82 | int inputRowPitch, int inputDepthPitch, const void *input, |
| 83 | size_t outputRowPitch, size_t outputDepthPitch, void *output); |
| 84 | static void loadLuminanceFloatDataToRGB(GLsizei width, GLsizei height, GLsizei depth, |
| 85 | int inputRowPitch, int inputDepthPitch, const void *input, |
| 86 | size_t outputRowPitch, size_t outputDepthPitch, void *output); |
| 87 | static void loadLuminanceHalfFloatDataToRGBA(GLsizei width, GLsizei height, GLsizei depth, |
| 88 | int inputRowPitch, int inputDepthPitch, const void *input, |
| 89 | size_t outputRowPitch, size_t outputDepthPitch, void *output); |
| 90 | static void loadLuminanceAlphaDataToNativeOrBGRA(GLsizei width, GLsizei height, GLsizei depth, |
| 91 | int inputRowPitch, int inputDepthPitch, const void *input, |
| 92 | size_t outputRowPitch, size_t outputDepthPitch, void *output, |
| 93 | bool native); |
| 94 | static void loadLuminanceAlphaFloatDataToRGBA(GLsizei width, GLsizei height, GLsizei depth, |
| 95 | int inputRowPitch, int inputDepthPitch, const void *input, |
| 96 | size_t outputRowPitch, size_t outputDepthPitch, void *output); |
| 97 | static void loadLuminanceAlphaHalfFloatDataToRGBA(GLsizei width, GLsizei height, GLsizei depth, |
| 98 | int inputRowPitch, int inputDepthPitch, const void *input, |
| 99 | size_t outputRowPitch, size_t outputDepthPitch, void *output); |
| 100 | static void loadRGBUByteDataToBGRX(GLsizei width, GLsizei height, GLsizei depth, |
| 101 | int inputRowPitch, int inputDepthPitch, const void *input, |
| 102 | size_t outputRowPitch, size_t outputDepthPitch, void *output); |
| 103 | static void loadRGBUByteDataToRGBA(GLsizei width, GLsizei height, GLsizei depth, |
| 104 | int inputRowPitch, int inputDepthPitch, const void *input, |
| 105 | size_t outputRowPitch, size_t outputDepthPitch, void *output); |
| 106 | static void loadRGB565DataToBGRA(GLsizei width, GLsizei height, GLsizei depth, |
| 107 | int inputRowPitch, int inputDepthPitch, const void *input, |
| 108 | size_t outputRowPitch, size_t outputDepthPitch, void *output); |
| 109 | static void loadRGB565DataToRGBA(GLsizei width, GLsizei height, GLsizei depth, |
| 110 | int inputRowPitch, int inputDepthPitch, const void *input, |
| 111 | size_t outputRowPitch, size_t outputDepthPitch, void *output); |
| 112 | static void loadRGBFloatDataToRGBA(GLsizei width, GLsizei height, GLsizei depth, |
| 113 | int inputRowPitch, int inputDepthPitch, const void *input, |
| 114 | size_t outputRowPitch, size_t outputDepthPitch, void *output); |
| 115 | static void loadRGBFloatDataToNative(GLsizei width, GLsizei height, GLsizei depth, |
| 116 | int inputRowPitch, int inputDepthPitch, const void *input, |
| 117 | size_t outputRowPitch, size_t outputDepthPitch, void *output); |
| 118 | static void loadRGBHalfFloatDataToRGBA(GLsizei width, GLsizei height, GLsizei depth, |
| 119 | int inputRowPitch, int inputDepthPitch, const void *input, |
| 120 | size_t outputRowPitch, size_t outputDepthPitch, void *output); |
| 121 | static void loadRGBAUByteDataToBGRASSE2(GLsizei width, GLsizei height, GLsizei depth, |
| 122 | int inputRowPitch, int inputDepthPitch, const void *input, |
| 123 | size_t outputRowPitch, size_t outputDepthPitch, void *output); |
| 124 | static void loadRGBAUByteDataToBGRA(GLsizei width, GLsizei height, GLsizei depth, |
| 125 | int inputRowPitch, int inputDepthPitch, const void *input, |
| 126 | size_t outputRowPitch, size_t outputDepthPitch, void *output); |
| 127 | static void loadRGBAUByteDataToNative(GLsizei width, GLsizei height, GLsizei depth, |
| 128 | int inputRowPitch, int inputDepthPitch, const void *input, |
| 129 | size_t outputRowPitch, size_t outputDepthPitch, void *output); |
| 130 | static void loadRGBA4444DataToBGRA(GLsizei width, GLsizei height, GLsizei depth, |
| 131 | int inputRowPitch, int inputDepthPitch, const void *input, |
| 132 | size_t outputRowPitch, size_t outputDepthPitch, void *output); |
| 133 | static void loadRGBA4444DataToRGBA(GLsizei width, GLsizei height, GLsizei depth, |
| 134 | int inputRowPitch, int inputDepthPitch, const void *input, |
| 135 | size_t outputRowPitch, size_t outputDepthPitch, void *output); |
| 136 | static void loadRGBA5551DataToBGRA(GLsizei width, GLsizei height, GLsizei depth, |
| 137 | int inputRowPitch, int inputDepthPitch, const void *input, |
| 138 | size_t outputRowPitch, size_t outputDepthPitch, void *output); |
| 139 | static void loadRGBA5551DataToRGBA(GLsizei width, GLsizei height, GLsizei depth, |
| 140 | int inputRowPitch, int inputDepthPitch, const void *input, |
| 141 | size_t outputRowPitch, size_t outputDepthPitch, void *output); |
| 142 | static void loadRGBAFloatDataToRGBA(GLsizei width, GLsizei height, GLsizei depth, |
| 143 | int inputRowPitch, int inputDepthPitch, const void *input, |
| 144 | size_t outputRowPitch, size_t outputDepthPitch, void *output); |
| 145 | static void loadRGBAHalfFloatDataToRGBA(GLsizei width, GLsizei height, GLsizei depth, |
| 146 | int inputRowPitch, int inputDepthPitch, const void *input, |
| 147 | size_t outputRowPitch, size_t outputDepthPitch, void *output); |
| 148 | static void loadBGRADataToBGRA(GLsizei width, GLsizei height, GLsizei depth, |
| 149 | int inputRowPitch, int inputDepthPitch, const void *input, |
| 150 | size_t outputRowPitch, size_t outputDepthPitch, void *output); |
daniel@transgaming.com | b9d7e6f | 2012-10-31 19:08:32 +0000 | [diff] [blame] | 151 | |
daniel@transgaming.com | 4ba2406 | 2012-12-20 20:54:24 +0000 | [diff] [blame] | 152 | protected: |
daniel@transgaming.com | b9d7e6f | 2012-10-31 19:08:32 +0000 | [diff] [blame] | 153 | GLsizei mWidth; |
| 154 | GLsizei mHeight; |
shannon.woods%transgaming.com@gtempaccount.com | 4760c56 | 2013-04-13 03:42:30 +0000 | [diff] [blame] | 155 | GLsizei mDepth; |
daniel@transgaming.com | b9d7e6f | 2012-10-31 19:08:32 +0000 | [diff] [blame] | 156 | GLint mInternalFormat; |
daniel@transgaming.com | 4ba2406 | 2012-12-20 20:54:24 +0000 | [diff] [blame] | 157 | GLenum mActualFormat; |
daniel@transgaming.com | b9d7e6f | 2012-10-31 19:08:32 +0000 | [diff] [blame] | 158 | |
| 159 | bool mDirty; |
| 160 | |
daniel@transgaming.com | 4ba2406 | 2012-12-20 20:54:24 +0000 | [diff] [blame] | 161 | private: |
| 162 | DISALLOW_COPY_AND_ASSIGN(Image); |
daniel@transgaming.com | b9d7e6f | 2012-10-31 19:08:32 +0000 | [diff] [blame] | 163 | }; |
daniel@transgaming.com | 4ba2406 | 2012-12-20 20:54:24 +0000 | [diff] [blame] | 164 | |
daniel@transgaming.com | b9d7e6f | 2012-10-31 19:08:32 +0000 | [diff] [blame] | 165 | } |
| 166 | |
daniel@transgaming.com | 4ba2406 | 2012-12-20 20:54:24 +0000 | [diff] [blame] | 167 | #endif // LIBGLESV2_RENDERER_IMAGE_H_ |