1 // 2 // Copyright (c) 2002-2013 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 // TextureStorage.h: Defines the abstract rx::TextureStorage class. 8 9 #ifndef LIBGLESV2_RENDERER_TEXTURESTORAGE_H_ 10 #define LIBGLESV2_RENDERER_TEXTURESTORAGE_H_ 11 12 #include "common/debug.h" 13 14 #include <GLES2/gl2.h> 15 16 namespace gl 17 { 18 struct ImageIndex; 19 } 20 21 namespace rx 22 { 23 class Renderer; 24 class SwapChain; 25 class RenderTarget; 26 27 class TextureStorage 28 { 29 public: 30 TextureStorage(); 31 virtual ~TextureStorage() {}; 32 33 virtual int getTopLevel() const = 0; 34 virtual bool isRenderTarget() const = 0; 35 virtual bool isManaged() const = 0; 36 virtual int getLevelCount() const = 0; 37 38 virtual RenderTarget *getRenderTarget(const gl::ImageIndex &index) = 0; 39 virtual void generateMipmaps() = 0; 40 41 unsigned int getRenderTargetSerial(const gl::ImageIndex &index) const; 42 unsigned int getTextureSerial() const; 43 44 protected: 45 void initializeSerials(unsigned int rtSerialsToReserve, unsigned int rtSerialsLayerStride); 46 47 private: 48 DISALLOW_COPY_AND_ASSIGN(TextureStorage); 49 50 const unsigned int mTextureSerial; 51 static unsigned int issueTextureSerial(); 52 53 static unsigned int mCurrentTextureSerial; 54 55 unsigned int mFirstRenderTargetSerial; 56 unsigned int mRenderTargetSerialsLayerStride; 57 }; 58 59 } 60 61 #endif // LIBGLESV2_RENDERER_TEXTURESTORAGE_H_ 62