1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/angle/src/libGLESv2/renderer/TextureStorage.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,110 @@ 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 +// TextureStorage.h: Defines the abstract rx::TextureStorageInterface class and its concrete derived 1.11 +// classes TextureStorageInterface2D and TextureStorageInterfaceCube, which act as the interface to the 1.12 +// GPU-side texture. 1.13 + 1.14 +#ifndef LIBGLESV2_RENDERER_TEXTURESTORAGE_H_ 1.15 +#define LIBGLESV2_RENDERER_TEXTURESTORAGE_H_ 1.16 + 1.17 +#include "common/debug.h" 1.18 + 1.19 +namespace rx 1.20 +{ 1.21 +class Renderer; 1.22 +class SwapChain; 1.23 +class RenderTarget; 1.24 +class Blit; 1.25 + 1.26 +class TextureStorage 1.27 +{ 1.28 + public: 1.29 + TextureStorage() {}; 1.30 + virtual ~TextureStorage() {}; 1.31 + 1.32 + virtual int getLodOffset() const = 0; 1.33 + virtual bool isRenderTarget() const = 0; 1.34 + virtual bool isManaged() const = 0; 1.35 + virtual int levelCount() = 0; 1.36 + 1.37 + virtual RenderTarget *getRenderTarget() = 0; 1.38 + virtual RenderTarget *getRenderTarget(GLenum faceTarget) = 0; 1.39 + virtual void generateMipmap(int level) = 0; 1.40 + virtual void generateMipmap(int face, int level) = 0; 1.41 + 1.42 + private: 1.43 + DISALLOW_COPY_AND_ASSIGN(TextureStorage); 1.44 + 1.45 +}; 1.46 + 1.47 +class TextureStorageInterface 1.48 +{ 1.49 + public: 1.50 + TextureStorageInterface(); 1.51 + virtual ~TextureStorageInterface(); 1.52 + 1.53 + TextureStorage *getStorageInstance() { return mInstance; } 1.54 + 1.55 + unsigned int getTextureSerial() const; 1.56 + virtual unsigned int getRenderTargetSerial(GLenum target) const = 0; 1.57 + 1.58 + virtual int getLodOffset() const; 1.59 + virtual bool isRenderTarget() const; 1.60 + virtual bool isManaged() const; 1.61 + virtual int levelCount(); 1.62 + 1.63 + protected: 1.64 + TextureStorage *mInstance; 1.65 + 1.66 + private: 1.67 + DISALLOW_COPY_AND_ASSIGN(TextureStorageInterface); 1.68 + 1.69 + const unsigned int mTextureSerial; 1.70 + static unsigned int issueTextureSerial(); 1.71 + 1.72 + static unsigned int mCurrentTextureSerial; 1.73 +}; 1.74 + 1.75 +class TextureStorageInterface2D : public TextureStorageInterface 1.76 +{ 1.77 + public: 1.78 + TextureStorageInterface2D(Renderer *renderer, SwapChain *swapchain); 1.79 + TextureStorageInterface2D(Renderer *renderer, int levels, GLenum internalformat, GLenum usage, bool forceRenderable, GLsizei width, GLsizei height); 1.80 + virtual ~TextureStorageInterface2D(); 1.81 + 1.82 + void generateMipmap(int level); 1.83 + RenderTarget *getRenderTarget() const; 1.84 + 1.85 + virtual unsigned int getRenderTargetSerial(GLenum target) const; 1.86 + 1.87 + private: 1.88 + DISALLOW_COPY_AND_ASSIGN(TextureStorageInterface2D); 1.89 + 1.90 + const unsigned int mRenderTargetSerial; 1.91 +}; 1.92 + 1.93 +class TextureStorageInterfaceCube : public TextureStorageInterface 1.94 +{ 1.95 + public: 1.96 + TextureStorageInterfaceCube(Renderer *renderer, int levels, GLenum internalformat, GLenum usage, bool forceRenderable, int size); 1.97 + virtual ~TextureStorageInterfaceCube(); 1.98 + 1.99 + void generateMipmap(int face, int level); 1.100 + RenderTarget *getRenderTarget(GLenum faceTarget) const; 1.101 + 1.102 + virtual unsigned int getRenderTargetSerial(GLenum target) const; 1.103 + 1.104 + private: 1.105 + DISALLOW_COPY_AND_ASSIGN(TextureStorageInterfaceCube); 1.106 + 1.107 + const unsigned int mFirstRenderTargetSerial; 1.108 +}; 1.109 + 1.110 +} 1.111 + 1.112 +#endif // LIBGLESV2_RENDERER_TEXTURESTORAGE_H_ 1.113 +