Sat, 03 Jan 2015 20:18:00 +0100
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) 2002-2010 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 | // Renderbuffer.h: Defines the wrapper class gl::Renderbuffer, as well as the |
michael@0 | 8 | // class hierarchy used to store its contents: RenderbufferStorage, Colorbuffer, |
michael@0 | 9 | // DepthStencilbuffer, Depthbuffer and Stencilbuffer. Implements GL renderbuffer |
michael@0 | 10 | // objects and related functionality. [OpenGL ES 2.0.24] section 4.4.3 page 108. |
michael@0 | 11 | |
michael@0 | 12 | #ifndef LIBGLESV2_RENDERBUFFER_H_ |
michael@0 | 13 | #define LIBGLESV2_RENDERBUFFER_H_ |
michael@0 | 14 | |
michael@0 | 15 | #define GL_APICALL |
michael@0 | 16 | #include <GLES2/gl2.h> |
michael@0 | 17 | |
michael@0 | 18 | #include "common/angleutils.h" |
michael@0 | 19 | #include "common/RefCountObject.h" |
michael@0 | 20 | |
michael@0 | 21 | namespace rx |
michael@0 | 22 | { |
michael@0 | 23 | class Renderer; |
michael@0 | 24 | class SwapChain; |
michael@0 | 25 | class RenderTarget; |
michael@0 | 26 | } |
michael@0 | 27 | |
michael@0 | 28 | namespace gl |
michael@0 | 29 | { |
michael@0 | 30 | class Texture2D; |
michael@0 | 31 | class TextureCubeMap; |
michael@0 | 32 | class Renderbuffer; |
michael@0 | 33 | class Colorbuffer; |
michael@0 | 34 | class DepthStencilbuffer; |
michael@0 | 35 | |
michael@0 | 36 | class RenderbufferInterface |
michael@0 | 37 | { |
michael@0 | 38 | public: |
michael@0 | 39 | RenderbufferInterface(); |
michael@0 | 40 | |
michael@0 | 41 | virtual ~RenderbufferInterface() {}; |
michael@0 | 42 | |
michael@0 | 43 | virtual void addProxyRef(const Renderbuffer *proxy); |
michael@0 | 44 | virtual void releaseProxy(const Renderbuffer *proxy); |
michael@0 | 45 | |
michael@0 | 46 | virtual rx::RenderTarget *getRenderTarget() = 0; |
michael@0 | 47 | virtual rx::RenderTarget *getDepthStencil() = 0; |
michael@0 | 48 | |
michael@0 | 49 | virtual GLsizei getWidth() const = 0; |
michael@0 | 50 | virtual GLsizei getHeight() const = 0; |
michael@0 | 51 | virtual GLenum getInternalFormat() const = 0; |
michael@0 | 52 | virtual GLenum getActualFormat() const = 0; |
michael@0 | 53 | virtual GLsizei getSamples() const = 0; |
michael@0 | 54 | |
michael@0 | 55 | GLuint getRedSize() const; |
michael@0 | 56 | GLuint getGreenSize() const; |
michael@0 | 57 | GLuint getBlueSize() const; |
michael@0 | 58 | GLuint getAlphaSize() const; |
michael@0 | 59 | GLuint getDepthSize() const; |
michael@0 | 60 | GLuint getStencilSize() const; |
michael@0 | 61 | |
michael@0 | 62 | virtual unsigned int getSerial() const = 0; |
michael@0 | 63 | |
michael@0 | 64 | private: |
michael@0 | 65 | DISALLOW_COPY_AND_ASSIGN(RenderbufferInterface); |
michael@0 | 66 | }; |
michael@0 | 67 | |
michael@0 | 68 | class RenderbufferTexture2D : public RenderbufferInterface |
michael@0 | 69 | { |
michael@0 | 70 | public: |
michael@0 | 71 | RenderbufferTexture2D(Texture2D *texture, GLenum target); |
michael@0 | 72 | |
michael@0 | 73 | virtual ~RenderbufferTexture2D(); |
michael@0 | 74 | |
michael@0 | 75 | void addProxyRef(const Renderbuffer *proxy); |
michael@0 | 76 | void releaseProxy(const Renderbuffer *proxy); |
michael@0 | 77 | |
michael@0 | 78 | rx::RenderTarget *getRenderTarget(); |
michael@0 | 79 | rx::RenderTarget *getDepthStencil(); |
michael@0 | 80 | |
michael@0 | 81 | virtual GLsizei getWidth() const; |
michael@0 | 82 | virtual GLsizei getHeight() const; |
michael@0 | 83 | virtual GLenum getInternalFormat() const; |
michael@0 | 84 | virtual GLenum getActualFormat() const; |
michael@0 | 85 | virtual GLsizei getSamples() const; |
michael@0 | 86 | |
michael@0 | 87 | virtual unsigned int getSerial() const; |
michael@0 | 88 | |
michael@0 | 89 | private: |
michael@0 | 90 | DISALLOW_COPY_AND_ASSIGN(RenderbufferTexture2D); |
michael@0 | 91 | |
michael@0 | 92 | BindingPointer <Texture2D> mTexture2D; |
michael@0 | 93 | GLenum mTarget; |
michael@0 | 94 | }; |
michael@0 | 95 | |
michael@0 | 96 | class RenderbufferTextureCubeMap : public RenderbufferInterface |
michael@0 | 97 | { |
michael@0 | 98 | public: |
michael@0 | 99 | RenderbufferTextureCubeMap(TextureCubeMap *texture, GLenum target); |
michael@0 | 100 | |
michael@0 | 101 | virtual ~RenderbufferTextureCubeMap(); |
michael@0 | 102 | |
michael@0 | 103 | void addProxyRef(const Renderbuffer *proxy); |
michael@0 | 104 | void releaseProxy(const Renderbuffer *proxy); |
michael@0 | 105 | |
michael@0 | 106 | rx::RenderTarget *getRenderTarget(); |
michael@0 | 107 | rx::RenderTarget *getDepthStencil(); |
michael@0 | 108 | |
michael@0 | 109 | virtual GLsizei getWidth() const; |
michael@0 | 110 | virtual GLsizei getHeight() const; |
michael@0 | 111 | virtual GLenum getInternalFormat() const; |
michael@0 | 112 | virtual GLenum getActualFormat() const; |
michael@0 | 113 | virtual GLsizei getSamples() const; |
michael@0 | 114 | |
michael@0 | 115 | virtual unsigned int getSerial() const; |
michael@0 | 116 | |
michael@0 | 117 | private: |
michael@0 | 118 | DISALLOW_COPY_AND_ASSIGN(RenderbufferTextureCubeMap); |
michael@0 | 119 | |
michael@0 | 120 | BindingPointer <TextureCubeMap> mTextureCubeMap; |
michael@0 | 121 | GLenum mTarget; |
michael@0 | 122 | }; |
michael@0 | 123 | |
michael@0 | 124 | // A class derived from RenderbufferStorage is created whenever glRenderbufferStorage |
michael@0 | 125 | // is called. The specific concrete type depends on whether the internal format is |
michael@0 | 126 | // colour depth, stencil or packed depth/stencil. |
michael@0 | 127 | class RenderbufferStorage : public RenderbufferInterface |
michael@0 | 128 | { |
michael@0 | 129 | public: |
michael@0 | 130 | RenderbufferStorage(); |
michael@0 | 131 | |
michael@0 | 132 | virtual ~RenderbufferStorage() = 0; |
michael@0 | 133 | |
michael@0 | 134 | virtual rx::RenderTarget *getRenderTarget(); |
michael@0 | 135 | virtual rx::RenderTarget *getDepthStencil(); |
michael@0 | 136 | |
michael@0 | 137 | virtual GLsizei getWidth() const; |
michael@0 | 138 | virtual GLsizei getHeight() const; |
michael@0 | 139 | virtual GLenum getInternalFormat() const; |
michael@0 | 140 | virtual GLenum getActualFormat() const; |
michael@0 | 141 | virtual GLsizei getSamples() const; |
michael@0 | 142 | |
michael@0 | 143 | virtual unsigned int getSerial() const; |
michael@0 | 144 | |
michael@0 | 145 | static unsigned int issueSerial(); |
michael@0 | 146 | static unsigned int issueCubeSerials(); |
michael@0 | 147 | |
michael@0 | 148 | protected: |
michael@0 | 149 | GLsizei mWidth; |
michael@0 | 150 | GLsizei mHeight; |
michael@0 | 151 | GLenum mInternalFormat; |
michael@0 | 152 | GLenum mActualFormat; |
michael@0 | 153 | GLsizei mSamples; |
michael@0 | 154 | |
michael@0 | 155 | private: |
michael@0 | 156 | DISALLOW_COPY_AND_ASSIGN(RenderbufferStorage); |
michael@0 | 157 | |
michael@0 | 158 | const unsigned int mSerial; |
michael@0 | 159 | |
michael@0 | 160 | static unsigned int mCurrentSerial; |
michael@0 | 161 | }; |
michael@0 | 162 | |
michael@0 | 163 | // Renderbuffer implements the GL renderbuffer object. |
michael@0 | 164 | // It's only a proxy for a RenderbufferInterface instance; the internal object |
michael@0 | 165 | // can change whenever glRenderbufferStorage is called. |
michael@0 | 166 | class Renderbuffer : public RefCountObject |
michael@0 | 167 | { |
michael@0 | 168 | public: |
michael@0 | 169 | Renderbuffer(rx::Renderer *renderer, GLuint id, RenderbufferInterface *storage); |
michael@0 | 170 | |
michael@0 | 171 | virtual ~Renderbuffer(); |
michael@0 | 172 | |
michael@0 | 173 | // These functions from RefCountObject are overloaded here because |
michael@0 | 174 | // Textures need to maintain their own count of references to them via |
michael@0 | 175 | // Renderbuffers/RenderbufferTextures. These functions invoke those |
michael@0 | 176 | // reference counting functions on the RenderbufferInterface. |
michael@0 | 177 | void addRef() const; |
michael@0 | 178 | void release() const; |
michael@0 | 179 | |
michael@0 | 180 | rx::RenderTarget *getRenderTarget(); |
michael@0 | 181 | rx::RenderTarget *getDepthStencil(); |
michael@0 | 182 | |
michael@0 | 183 | GLsizei getWidth() const; |
michael@0 | 184 | GLsizei getHeight() const; |
michael@0 | 185 | GLenum getInternalFormat() const; |
michael@0 | 186 | GLenum getActualFormat() const; |
michael@0 | 187 | GLuint getRedSize() const; |
michael@0 | 188 | GLuint getGreenSize() const; |
michael@0 | 189 | GLuint getBlueSize() const; |
michael@0 | 190 | GLuint getAlphaSize() const; |
michael@0 | 191 | GLuint getDepthSize() const; |
michael@0 | 192 | GLuint getStencilSize() const; |
michael@0 | 193 | GLsizei getSamples() const; |
michael@0 | 194 | |
michael@0 | 195 | unsigned int getSerial() const; |
michael@0 | 196 | |
michael@0 | 197 | void setStorage(RenderbufferStorage *newStorage); |
michael@0 | 198 | |
michael@0 | 199 | private: |
michael@0 | 200 | DISALLOW_COPY_AND_ASSIGN(Renderbuffer); |
michael@0 | 201 | |
michael@0 | 202 | RenderbufferInterface *mInstance; |
michael@0 | 203 | }; |
michael@0 | 204 | |
michael@0 | 205 | class Colorbuffer : public RenderbufferStorage |
michael@0 | 206 | { |
michael@0 | 207 | public: |
michael@0 | 208 | Colorbuffer(rx::Renderer *renderer, rx::SwapChain *swapChain); |
michael@0 | 209 | Colorbuffer(rx::Renderer *renderer, GLsizei width, GLsizei height, GLenum format, GLsizei samples); |
michael@0 | 210 | |
michael@0 | 211 | virtual ~Colorbuffer(); |
michael@0 | 212 | |
michael@0 | 213 | virtual rx::RenderTarget *getRenderTarget(); |
michael@0 | 214 | |
michael@0 | 215 | private: |
michael@0 | 216 | DISALLOW_COPY_AND_ASSIGN(Colorbuffer); |
michael@0 | 217 | |
michael@0 | 218 | rx::RenderTarget *mRenderTarget; |
michael@0 | 219 | }; |
michael@0 | 220 | |
michael@0 | 221 | class DepthStencilbuffer : public RenderbufferStorage |
michael@0 | 222 | { |
michael@0 | 223 | public: |
michael@0 | 224 | DepthStencilbuffer(rx::Renderer *renderer, rx::SwapChain *swapChain); |
michael@0 | 225 | DepthStencilbuffer(rx::Renderer *renderer, GLsizei width, GLsizei height, GLsizei samples); |
michael@0 | 226 | |
michael@0 | 227 | ~DepthStencilbuffer(); |
michael@0 | 228 | |
michael@0 | 229 | virtual rx::RenderTarget *getDepthStencil(); |
michael@0 | 230 | |
michael@0 | 231 | protected: |
michael@0 | 232 | rx::RenderTarget *mDepthStencil; |
michael@0 | 233 | |
michael@0 | 234 | private: |
michael@0 | 235 | DISALLOW_COPY_AND_ASSIGN(DepthStencilbuffer); |
michael@0 | 236 | }; |
michael@0 | 237 | |
michael@0 | 238 | class Depthbuffer : public DepthStencilbuffer |
michael@0 | 239 | { |
michael@0 | 240 | public: |
michael@0 | 241 | Depthbuffer(rx::Renderer *renderer, GLsizei width, GLsizei height, GLsizei samples); |
michael@0 | 242 | |
michael@0 | 243 | virtual ~Depthbuffer(); |
michael@0 | 244 | |
michael@0 | 245 | private: |
michael@0 | 246 | DISALLOW_COPY_AND_ASSIGN(Depthbuffer); |
michael@0 | 247 | }; |
michael@0 | 248 | |
michael@0 | 249 | class Stencilbuffer : public DepthStencilbuffer |
michael@0 | 250 | { |
michael@0 | 251 | public: |
michael@0 | 252 | Stencilbuffer(rx::Renderer *renderer, GLsizei width, GLsizei height, GLsizei samples); |
michael@0 | 253 | |
michael@0 | 254 | virtual ~Stencilbuffer(); |
michael@0 | 255 | |
michael@0 | 256 | private: |
michael@0 | 257 | DISALLOW_COPY_AND_ASSIGN(Stencilbuffer); |
michael@0 | 258 | }; |
michael@0 | 259 | } |
michael@0 | 260 | |
michael@0 | 261 | #endif // LIBGLESV2_RENDERBUFFER_H_ |