michael@0: // michael@0: // Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved. michael@0: // Use of this source code is governed by a BSD-style license that can be michael@0: // found in the LICENSE file. michael@0: // michael@0: michael@0: // Image.h: Defines the rx::Image class, an abstract base class for the michael@0: // renderer-specific classes which will define the interface to the underlying michael@0: // surfaces or resources. michael@0: michael@0: #ifndef LIBGLESV2_RENDERER_IMAGE_H_ michael@0: #define LIBGLESV2_RENDERER_IMAGE_H_ michael@0: michael@0: #include "common/debug.h" michael@0: michael@0: namespace gl michael@0: { michael@0: class Framebuffer; michael@0: } michael@0: michael@0: namespace rx michael@0: { michael@0: class Renderer; michael@0: class TextureStorageInterface2D; michael@0: class TextureStorageInterfaceCube; michael@0: michael@0: class Image michael@0: { michael@0: public: michael@0: Image(); michael@0: virtual ~Image() {}; michael@0: michael@0: GLsizei getWidth() const { return mWidth; } michael@0: GLsizei getHeight() const { return mHeight; } michael@0: GLenum getInternalFormat() const { return mInternalFormat; } michael@0: GLenum getActualFormat() const { return mActualFormat; } michael@0: michael@0: void markDirty() {mDirty = true;} michael@0: void markClean() {mDirty = false;} michael@0: virtual bool isDirty() const = 0; michael@0: michael@0: virtual void setManagedSurface(TextureStorageInterface2D *storage, int level) {}; michael@0: virtual void setManagedSurface(TextureStorageInterfaceCube *storage, int face, int level) {}; michael@0: virtual bool updateSurface(TextureStorageInterface2D *storage, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height) = 0; michael@0: virtual bool updateSurface(TextureStorageInterfaceCube *storage, int face, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height) = 0; michael@0: michael@0: virtual bool redefine(Renderer *renderer, GLint internalformat, GLsizei width, GLsizei height, bool forceRelease) = 0; michael@0: michael@0: virtual bool isRenderableFormat() const = 0; michael@0: michael@0: virtual void loadData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, michael@0: GLint unpackAlignment, const void *input) = 0; michael@0: virtual void loadCompressedData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, michael@0: const void *input) = 0; michael@0: michael@0: virtual void copy(GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height, gl::Framebuffer *source) = 0; michael@0: michael@0: static void loadAlphaDataToBGRA(GLsizei width, GLsizei height, michael@0: int inputPitch, const void *input, size_t outputPitch, void *output); michael@0: static void loadAlphaDataToNative(GLsizei width, GLsizei height, michael@0: int inputPitch, const void *input, size_t outputPitch, void *output); michael@0: static void loadAlphaDataToBGRASSE2(GLsizei width, GLsizei height, michael@0: int inputPitch, const void *input, size_t outputPitch, void *output); michael@0: static void loadAlphaFloatDataToRGBA(GLsizei width, GLsizei height, michael@0: int inputPitch, const void *input, size_t outputPitch, void *output); michael@0: static void loadAlphaHalfFloatDataToRGBA(GLsizei width, GLsizei height, michael@0: int inputPitch, const void *input, size_t outputPitch, void *output); michael@0: static void loadLuminanceDataToNativeOrBGRA(GLsizei width, GLsizei height, michael@0: int inputPitch, const void *input, size_t outputPitch, void *output, bool native); michael@0: static void loadLuminanceFloatDataToRGBA(GLsizei width, GLsizei height, michael@0: int inputPitch, const void *input, size_t outputPitch, void *output); michael@0: static void loadLuminanceFloatDataToRGB(GLsizei width, GLsizei height, michael@0: int inputPitch, const void *input, size_t outputPitch, void *output); michael@0: static void loadLuminanceHalfFloatDataToRGBA(GLsizei width, GLsizei height, michael@0: int inputPitch, const void *input, size_t outputPitch, void *output); michael@0: static void loadLuminanceAlphaDataToNativeOrBGRA(GLsizei width, GLsizei height, michael@0: int inputPitch, const void *input, size_t outputPitch, void *output, bool native); michael@0: static void loadLuminanceAlphaFloatDataToRGBA(GLsizei width, GLsizei height, michael@0: int inputPitch, const void *input, size_t outputPitch, void *output); michael@0: static void loadLuminanceAlphaHalfFloatDataToRGBA(GLsizei width, GLsizei height, michael@0: int inputPitch, const void *input, size_t outputPitch, void *output); michael@0: static void loadRGBUByteDataToBGRX(GLsizei width, GLsizei height, michael@0: int inputPitch, const void *input, size_t outputPitch, void *output); michael@0: static void loadRGBUByteDataToRGBA(GLsizei width, GLsizei height, michael@0: int inputPitch, const void *input, size_t outputPitch, void *output); michael@0: static void loadRGB565DataToBGRA(GLsizei width, GLsizei height, michael@0: int inputPitch, const void *input, size_t outputPitch, void *output); michael@0: static void loadRGB565DataToRGBA(GLsizei width, GLsizei height, michael@0: int inputPitch, const void *input, size_t outputPitch, void *output); michael@0: static void loadRGBFloatDataToRGBA(GLsizei width, GLsizei height, michael@0: int inputPitch, const void *input, size_t outputPitch, void *output); michael@0: static void loadRGBFloatDataToNative(GLsizei width, GLsizei height, michael@0: int inputPitch, const void *input, size_t outputPitch, void *output); michael@0: static void loadRGBHalfFloatDataToRGBA(GLsizei width, GLsizei height, michael@0: int inputPitch, const void *input, size_t outputPitch, void *output); michael@0: static void loadRGBAUByteDataToBGRASSE2(GLsizei width, GLsizei height, michael@0: int inputPitch, const void *input, size_t outputPitch, void *output); michael@0: static void loadRGBAUByteDataToBGRA(GLsizei width, GLsizei height, michael@0: int inputPitch, const void *input, size_t outputPitch, void *output); michael@0: static void loadRGBAUByteDataToNative(GLsizei width, GLsizei height, michael@0: int inputPitch, const void *input, size_t outputPitch, void *output); michael@0: static void loadRGBA4444DataToBGRA(GLsizei width, GLsizei height, michael@0: int inputPitch, const void *input, size_t outputPitch, void *output); michael@0: static void loadRGBA4444DataToRGBA(GLsizei width, GLsizei height, michael@0: int inputPitch, const void *input, size_t outputPitch, void *output); michael@0: static void loadRGBA5551DataToBGRA(GLsizei width, GLsizei height, michael@0: int inputPitch, const void *input, size_t outputPitch, void *output); michael@0: static void loadRGBA5551DataToRGBA(GLsizei width, GLsizei height, michael@0: int inputPitch, const void *input, size_t outputPitch, void *output); michael@0: static void loadRGBAFloatDataToRGBA(GLsizei width, GLsizei height, michael@0: int inputPitch, const void *input, size_t outputPitch, void *output); michael@0: static void loadRGBAHalfFloatDataToRGBA(GLsizei width, GLsizei height, michael@0: int inputPitch, const void *input, size_t outputPitch, void *output); michael@0: static void loadBGRADataToBGRA(GLsizei width, GLsizei height, michael@0: int inputPitch, const void *input, size_t outputPitch, void *output); michael@0: michael@0: protected: michael@0: GLsizei mWidth; michael@0: GLsizei mHeight; michael@0: GLint mInternalFormat; michael@0: GLenum mActualFormat; michael@0: michael@0: bool mDirty; michael@0: michael@0: private: michael@0: DISALLOW_COPY_AND_ASSIGN(Image); michael@0: }; michael@0: michael@0: } michael@0: michael@0: #endif // LIBGLESV2_RENDERER_IMAGE_H_