gfx/angle/src/libGLESv2/Uniform.cpp

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     1 #include "precompiled.h"
     2 //
     3 // Copyright (c) 2010-2013 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 #include "libGLESv2/Uniform.h"
    10 #include "libGLESv2/utilities.h"
    12 namespace gl
    13 {
    15 Uniform::Uniform(GLenum type, GLenum precision, const std::string &name, unsigned int arraySize)
    16     : type(type), precision(precision), name(name), arraySize(arraySize)
    17 {
    18     int bytes = gl::UniformInternalSize(type) * elementCount();
    19     data = new unsigned char[bytes];
    20     memset(data, 0, bytes);
    21     dirty = true;
    23     psRegisterIndex = -1;
    24     vsRegisterIndex = -1;
    25     registerCount = VariableRowCount(type) * elementCount();
    26 }
    28 Uniform::~Uniform()
    29 {
    30     delete[] data;
    31 }
    33 bool Uniform::isArray() const
    34 {
    35     return arraySize > 0;
    36 }
    38 unsigned int Uniform::elementCount() const
    39 {
    40     return arraySize > 0 ? arraySize : 1;
    41 }
    43 }

mercurial