1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/angle/src/libGLESv2/renderer/Image.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,131 @@ 1.4 +// 1.5 +// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved. 1.6 +// Use of this source code is governed by a BSD-style license that can be 1.7 +// found in the LICENSE file. 1.8 +// 1.9 + 1.10 +// Image.h: Defines the rx::Image class, an abstract base class for the 1.11 +// renderer-specific classes which will define the interface to the underlying 1.12 +// surfaces or resources. 1.13 + 1.14 +#ifndef LIBGLESV2_RENDERER_IMAGE_H_ 1.15 +#define LIBGLESV2_RENDERER_IMAGE_H_ 1.16 + 1.17 +#include "common/debug.h" 1.18 + 1.19 +namespace gl 1.20 +{ 1.21 +class Framebuffer; 1.22 +} 1.23 + 1.24 +namespace rx 1.25 +{ 1.26 +class Renderer; 1.27 +class TextureStorageInterface2D; 1.28 +class TextureStorageInterfaceCube; 1.29 + 1.30 +class Image 1.31 +{ 1.32 + public: 1.33 + Image(); 1.34 + virtual ~Image() {}; 1.35 + 1.36 + GLsizei getWidth() const { return mWidth; } 1.37 + GLsizei getHeight() const { return mHeight; } 1.38 + GLenum getInternalFormat() const { return mInternalFormat; } 1.39 + GLenum getActualFormat() const { return mActualFormat; } 1.40 + 1.41 + void markDirty() {mDirty = true;} 1.42 + void markClean() {mDirty = false;} 1.43 + virtual bool isDirty() const = 0; 1.44 + 1.45 + virtual void setManagedSurface(TextureStorageInterface2D *storage, int level) {}; 1.46 + virtual void setManagedSurface(TextureStorageInterfaceCube *storage, int face, int level) {}; 1.47 + virtual bool updateSurface(TextureStorageInterface2D *storage, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height) = 0; 1.48 + virtual bool updateSurface(TextureStorageInterfaceCube *storage, int face, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height) = 0; 1.49 + 1.50 + virtual bool redefine(Renderer *renderer, GLint internalformat, GLsizei width, GLsizei height, bool forceRelease) = 0; 1.51 + 1.52 + virtual bool isRenderableFormat() const = 0; 1.53 + 1.54 + virtual void loadData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, 1.55 + GLint unpackAlignment, const void *input) = 0; 1.56 + virtual void loadCompressedData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, 1.57 + const void *input) = 0; 1.58 + 1.59 + virtual void copy(GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height, gl::Framebuffer *source) = 0; 1.60 + 1.61 + static void loadAlphaDataToBGRA(GLsizei width, GLsizei height, 1.62 + int inputPitch, const void *input, size_t outputPitch, void *output); 1.63 + static void loadAlphaDataToNative(GLsizei width, GLsizei height, 1.64 + int inputPitch, const void *input, size_t outputPitch, void *output); 1.65 + static void loadAlphaDataToBGRASSE2(GLsizei width, GLsizei height, 1.66 + int inputPitch, const void *input, size_t outputPitch, void *output); 1.67 + static void loadAlphaFloatDataToRGBA(GLsizei width, GLsizei height, 1.68 + int inputPitch, const void *input, size_t outputPitch, void *output); 1.69 + static void loadAlphaHalfFloatDataToRGBA(GLsizei width, GLsizei height, 1.70 + int inputPitch, const void *input, size_t outputPitch, void *output); 1.71 + static void loadLuminanceDataToNativeOrBGRA(GLsizei width, GLsizei height, 1.72 + int inputPitch, const void *input, size_t outputPitch, void *output, bool native); 1.73 + static void loadLuminanceFloatDataToRGBA(GLsizei width, GLsizei height, 1.74 + int inputPitch, const void *input, size_t outputPitch, void *output); 1.75 + static void loadLuminanceFloatDataToRGB(GLsizei width, GLsizei height, 1.76 + int inputPitch, const void *input, size_t outputPitch, void *output); 1.77 + static void loadLuminanceHalfFloatDataToRGBA(GLsizei width, GLsizei height, 1.78 + int inputPitch, const void *input, size_t outputPitch, void *output); 1.79 + static void loadLuminanceAlphaDataToNativeOrBGRA(GLsizei width, GLsizei height, 1.80 + int inputPitch, const void *input, size_t outputPitch, void *output, bool native); 1.81 + static void loadLuminanceAlphaFloatDataToRGBA(GLsizei width, GLsizei height, 1.82 + int inputPitch, const void *input, size_t outputPitch, void *output); 1.83 + static void loadLuminanceAlphaHalfFloatDataToRGBA(GLsizei width, GLsizei height, 1.84 + int inputPitch, const void *input, size_t outputPitch, void *output); 1.85 + static void loadRGBUByteDataToBGRX(GLsizei width, GLsizei height, 1.86 + int inputPitch, const void *input, size_t outputPitch, void *output); 1.87 + static void loadRGBUByteDataToRGBA(GLsizei width, GLsizei height, 1.88 + int inputPitch, const void *input, size_t outputPitch, void *output); 1.89 + static void loadRGB565DataToBGRA(GLsizei width, GLsizei height, 1.90 + int inputPitch, const void *input, size_t outputPitch, void *output); 1.91 + static void loadRGB565DataToRGBA(GLsizei width, GLsizei height, 1.92 + int inputPitch, const void *input, size_t outputPitch, void *output); 1.93 + static void loadRGBFloatDataToRGBA(GLsizei width, GLsizei height, 1.94 + int inputPitch, const void *input, size_t outputPitch, void *output); 1.95 + static void loadRGBFloatDataToNative(GLsizei width, GLsizei height, 1.96 + int inputPitch, const void *input, size_t outputPitch, void *output); 1.97 + static void loadRGBHalfFloatDataToRGBA(GLsizei width, GLsizei height, 1.98 + int inputPitch, const void *input, size_t outputPitch, void *output); 1.99 + static void loadRGBAUByteDataToBGRASSE2(GLsizei width, GLsizei height, 1.100 + int inputPitch, const void *input, size_t outputPitch, void *output); 1.101 + static void loadRGBAUByteDataToBGRA(GLsizei width, GLsizei height, 1.102 + int inputPitch, const void *input, size_t outputPitch, void *output); 1.103 + static void loadRGBAUByteDataToNative(GLsizei width, GLsizei height, 1.104 + int inputPitch, const void *input, size_t outputPitch, void *output); 1.105 + static void loadRGBA4444DataToBGRA(GLsizei width, GLsizei height, 1.106 + int inputPitch, const void *input, size_t outputPitch, void *output); 1.107 + static void loadRGBA4444DataToRGBA(GLsizei width, GLsizei height, 1.108 + int inputPitch, const void *input, size_t outputPitch, void *output); 1.109 + static void loadRGBA5551DataToBGRA(GLsizei width, GLsizei height, 1.110 + int inputPitch, const void *input, size_t outputPitch, void *output); 1.111 + static void loadRGBA5551DataToRGBA(GLsizei width, GLsizei height, 1.112 + int inputPitch, const void *input, size_t outputPitch, void *output); 1.113 + static void loadRGBAFloatDataToRGBA(GLsizei width, GLsizei height, 1.114 + int inputPitch, const void *input, size_t outputPitch, void *output); 1.115 + static void loadRGBAHalfFloatDataToRGBA(GLsizei width, GLsizei height, 1.116 + int inputPitch, const void *input, size_t outputPitch, void *output); 1.117 + static void loadBGRADataToBGRA(GLsizei width, GLsizei height, 1.118 + int inputPitch, const void *input, size_t outputPitch, void *output); 1.119 + 1.120 + protected: 1.121 + GLsizei mWidth; 1.122 + GLsizei mHeight; 1.123 + GLint mInternalFormat; 1.124 + GLenum mActualFormat; 1.125 + 1.126 + bool mDirty; 1.127 + 1.128 + private: 1.129 + DISALLOW_COPY_AND_ASSIGN(Image); 1.130 +}; 1.131 + 1.132 +} 1.133 + 1.134 +#endif // LIBGLESV2_RENDERER_IMAGE_H_