gfx/angle/src/compiler/TranslatorESSL.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 //
     2 // Copyright (c) 2002-2011 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 //
     7 #include "compiler/TranslatorESSL.h"
     9 #include "compiler/OutputESSL.h"
    11 TranslatorESSL::TranslatorESSL(ShShaderType type, ShShaderSpec spec)
    12     : TCompiler(type, spec) {
    13 }
    15 void TranslatorESSL::translate(TIntermNode* root) {
    16     TInfoSinkBase& sink = getInfoSink().obj;
    18     // Write built-in extension behaviors.
    19     writeExtensionBehavior();
    21     // Write emulated built-in functions if needed.
    22     getBuiltInFunctionEmulator().OutputEmulatedFunctionDefinition(
    23         sink, getShaderType() == SH_FRAGMENT_SHADER);
    25     // Write array bounds clamping emulation if needed.
    26     getArrayBoundsClamper().OutputClampingFunctionDefinition(sink);
    28     // Write translated shader.
    29     TOutputESSL outputESSL(sink, getArrayIndexClampingStrategy(), getHashFunction(), getNameMap(), getSymbolTable());
    30     root->traverse(&outputESSL);
    31 }
    33 void TranslatorESSL::writeExtensionBehavior() {
    34     TInfoSinkBase& sink = getInfoSink().obj;
    35     const TExtensionBehavior& extensionBehavior = getExtensionBehavior();
    36     for (TExtensionBehavior::const_iterator iter = extensionBehavior.begin();
    37          iter != extensionBehavior.end(); ++iter) {
    38         if (iter->second != EBhUndefined) {
    39             sink << "#extension " << iter->first << " : "
    40                  << getBehaviorString(iter->second) << "\n";
    41         }
    42     }
    43 }

mercurial