gfx/angle/src/libGLESv2/renderer/TextureStorage.cpp

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.

     1 #include "precompiled.h"
     2 //
     3 // Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
     4 // Use of this source code is governed by a BSD-style license that can be
     5 // found in the LICENSE file.
     6 //
     8 // TextureStorage.cpp: Implements the abstract rx::TextureStorageInterface class and its concrete derived
     9 // classes TextureStorageInterface2D and TextureStorageInterfaceCube, which act as the interface to the
    10 // GPU-side texture.
    12 #include "libGLESv2/renderer/TextureStorage.h"
    13 #include "libGLESv2/renderer/Renderer.h"
    14 #include "libGLESv2/Renderbuffer.h"
    15 #include "libGLESv2/Texture.h"
    17 #include "common/debug.h"
    19 namespace rx
    20 {
    21 unsigned int TextureStorageInterface::mCurrentTextureSerial = 1;
    23 TextureStorageInterface::TextureStorageInterface()
    24     : mTextureSerial(issueTextureSerial()),
    25       mInstance(NULL)
    26 {
    27 }
    29 TextureStorageInterface::~TextureStorageInterface()
    30 {
    31     delete mInstance;
    32 }
    34 bool TextureStorageInterface::isRenderTarget() const
    35 {
    36     return mInstance->isRenderTarget();
    37 }
    40 bool TextureStorageInterface::isManaged() const
    41 {
    42     return mInstance->isManaged();
    43 }
    45 unsigned int TextureStorageInterface::getTextureSerial() const
    46 {
    47     return mTextureSerial;
    48 }
    50 unsigned int TextureStorageInterface::issueTextureSerial()
    51 {
    52     return mCurrentTextureSerial++;
    53 }
    55 int TextureStorageInterface::getLodOffset() const
    56 {
    57     return mInstance->getLodOffset();
    58 }
    61 int TextureStorageInterface::levelCount()
    62 {
    63     return mInstance->levelCount();
    64 }
    66 TextureStorageInterface2D::TextureStorageInterface2D(Renderer *renderer, SwapChain *swapchain) 
    67     : mRenderTargetSerial(gl::RenderbufferStorage::issueSerial())
    68 {
    69     mInstance = renderer->createTextureStorage2D(swapchain);
    70 }
    72 TextureStorageInterface2D::TextureStorageInterface2D(Renderer *renderer, int levels, GLenum internalformat, GLenum usage, bool forceRenderable, GLsizei width, GLsizei height)
    73     : mRenderTargetSerial(gl::RenderbufferStorage::issueSerial())
    74 {
    75     mInstance = renderer->createTextureStorage2D(levels, internalformat, usage, forceRenderable, width, height);
    76 }
    78 TextureStorageInterface2D::~TextureStorageInterface2D()
    79 {
    80 }
    82 RenderTarget *TextureStorageInterface2D::getRenderTarget() const
    83 {
    84     return mInstance->getRenderTarget();
    85 }
    87 void TextureStorageInterface2D::generateMipmap(int level)
    88 {
    89     mInstance->generateMipmap(level);
    90 }
    92 unsigned int TextureStorageInterface2D::getRenderTargetSerial(GLenum target) const
    93 {
    94     return mRenderTargetSerial;
    95 }
    97 TextureStorageInterfaceCube::TextureStorageInterfaceCube(Renderer *renderer, int levels, GLenum internalformat, GLenum usage, bool forceRenderable, int size)
    98     : mFirstRenderTargetSerial(gl::RenderbufferStorage::issueCubeSerials())
    99 {
   100     mInstance = renderer->createTextureStorageCube(levels, internalformat, usage, forceRenderable, size);
   101 }
   103 TextureStorageInterfaceCube::~TextureStorageInterfaceCube()
   104 {
   105 }
   107 RenderTarget *TextureStorageInterfaceCube::getRenderTarget(GLenum faceTarget) const
   108 {
   109     return mInstance->getRenderTarget(faceTarget);
   110 }
   112 void TextureStorageInterfaceCube::generateMipmap(int face, int level)
   113 {
   114     mInstance->generateMipmap(face, level);
   115 }
   117 unsigned int TextureStorageInterfaceCube::getRenderTargetSerial(GLenum target) const
   118 {
   119     return mFirstRenderTargetSerial + gl::TextureCubeMap::faceIndex(target);
   120 }
   122 }

mercurial