gfx/angle/src/libGLESv2/renderer/TextureStorage11.h

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1 //
michael@0 2 // Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
michael@0 3 // Use of this source code is governed by a BSD-style license that can be
michael@0 4 // found in the LICENSE file.
michael@0 5 //
michael@0 6
michael@0 7 // TextureStorage11.h: Defines the abstract rx::TextureStorage11 class and its concrete derived
michael@0 8 // classes TextureStorage11_2D and TextureStorage11_Cube, which act as the interface to the D3D11 texture.
michael@0 9
michael@0 10 #ifndef LIBGLESV2_RENDERER_TEXTURESTORAGE11_H_
michael@0 11 #define LIBGLESV2_RENDERER_TEXTURESTORAGE11_H_
michael@0 12
michael@0 13 #include "libGLESv2/Texture.h"
michael@0 14 #include "libGLESv2/renderer/TextureStorage.h"
michael@0 15
michael@0 16 namespace rx
michael@0 17 {
michael@0 18 class RenderTarget;
michael@0 19 class RenderTarget11;
michael@0 20 class Renderer;
michael@0 21 class Renderer11;
michael@0 22 class SwapChain11;
michael@0 23
michael@0 24 class TextureStorage11 : public TextureStorage
michael@0 25 {
michael@0 26 public:
michael@0 27 TextureStorage11(Renderer *renderer, UINT bindFlags);
michael@0 28 virtual ~TextureStorage11();
michael@0 29
michael@0 30 static TextureStorage11 *makeTextureStorage11(TextureStorage *storage);
michael@0 31
michael@0 32 static DWORD GetTextureBindFlags(DXGI_FORMAT d3dfmt, GLenum glusage, bool forceRenderable);
michael@0 33 static bool IsTextureFormatRenderable(DXGI_FORMAT format);
michael@0 34
michael@0 35 UINT getBindFlags() const;
michael@0 36
michael@0 37 virtual ID3D11Texture2D *getBaseTexture() const;
michael@0 38 virtual ID3D11ShaderResourceView *getSRV() = 0;
michael@0 39 virtual RenderTarget *getRenderTarget() { return getRenderTarget(0); }
michael@0 40 virtual RenderTarget *getRenderTarget(int level) { return NULL; }
michael@0 41 virtual RenderTarget *getRenderTarget(GLenum faceTarget) { return getRenderTarget(faceTarget, 0); }
michael@0 42 virtual RenderTarget *getRenderTarget(GLenum faceTarget, int level) { return NULL; }
michael@0 43
michael@0 44 virtual void generateMipmap(int level) {};
michael@0 45 virtual void generateMipmap(int face, int level) {};
michael@0 46
michael@0 47 virtual int getLodOffset() const;
michael@0 48 virtual bool isRenderTarget() const;
michael@0 49 virtual bool isManaged() const;
michael@0 50 virtual int levelCount();
michael@0 51 UINT getSubresourceIndex(int level, int faceTarget);
michael@0 52
michael@0 53 bool updateSubresourceLevel(ID3D11Texture2D *texture, unsigned int sourceSubresource, int level,
michael@0 54 int faceTarget, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height);
michael@0 55
michael@0 56 protected:
michael@0 57 void generateMipmapLayer(RenderTarget11 *source, RenderTarget11 *dest);
michael@0 58
michael@0 59 Renderer11 *mRenderer;
michael@0 60 int mLodOffset;
michael@0 61 unsigned int mMipLevels;
michael@0 62
michael@0 63 ID3D11Texture2D *mTexture;
michael@0 64 DXGI_FORMAT mTextureFormat;
michael@0 65 DXGI_FORMAT mShaderResourceFormat;
michael@0 66 DXGI_FORMAT mRenderTargetFormat;
michael@0 67 DXGI_FORMAT mDepthStencilFormat;
michael@0 68 unsigned int mTextureWidth;
michael@0 69 unsigned int mTextureHeight;
michael@0 70
michael@0 71 ID3D11ShaderResourceView *mSRV;
michael@0 72
michael@0 73 private:
michael@0 74 DISALLOW_COPY_AND_ASSIGN(TextureStorage11);
michael@0 75
michael@0 76 const UINT mBindFlags;
michael@0 77 };
michael@0 78
michael@0 79 class TextureStorage11_2D : public TextureStorage11
michael@0 80 {
michael@0 81 public:
michael@0 82 TextureStorage11_2D(Renderer *renderer, SwapChain11 *swapchain);
michael@0 83 TextureStorage11_2D(Renderer *renderer, int levels, GLenum internalformat, GLenum usage, bool forceRenderable, GLsizei width, GLsizei height);
michael@0 84 virtual ~TextureStorage11_2D();
michael@0 85
michael@0 86 static TextureStorage11_2D *makeTextureStorage11_2D(TextureStorage *storage);
michael@0 87
michael@0 88 virtual ID3D11ShaderResourceView *getSRV();
michael@0 89 virtual RenderTarget *getRenderTarget(int level);
michael@0 90
michael@0 91 virtual void generateMipmap(int level);
michael@0 92
michael@0 93 private:
michael@0 94 DISALLOW_COPY_AND_ASSIGN(TextureStorage11_2D);
michael@0 95
michael@0 96 RenderTarget11 *mRenderTarget[gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS];
michael@0 97 };
michael@0 98
michael@0 99 class TextureStorage11_Cube : public TextureStorage11
michael@0 100 {
michael@0 101 public:
michael@0 102 TextureStorage11_Cube(Renderer *renderer, int levels, GLenum internalformat, GLenum usage, bool forceRenderable, int size);
michael@0 103 virtual ~TextureStorage11_Cube();
michael@0 104
michael@0 105 static TextureStorage11_Cube *makeTextureStorage11_Cube(TextureStorage *storage);
michael@0 106
michael@0 107 virtual ID3D11ShaderResourceView *getSRV();
michael@0 108 virtual RenderTarget *getRenderTarget(GLenum faceTarget, int level);
michael@0 109
michael@0 110 virtual void generateMipmap(int face, int level);
michael@0 111
michael@0 112 private:
michael@0 113 DISALLOW_COPY_AND_ASSIGN(TextureStorage11_Cube);
michael@0 114
michael@0 115 RenderTarget11 *mRenderTarget[6][gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS];
michael@0 116 };
michael@0 117
michael@0 118 }
michael@0 119
michael@0 120 #endif // LIBGLESV2_RENDERER_TEXTURESTORAGE11_H_

mercurial