content/canvas/src/WebGLUniformInfo.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
     2 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 #ifndef WEBGLUNIFORMINFO_H_
     7 #define WEBGLUNIFORMINFO_H_
     9 #include "angle/ShaderLang.h"
    11 namespace mozilla {
    13 struct WebGLUniformInfo {
    14     uint32_t arraySize;
    15     bool isArray;
    16     ShDataType type;
    18     WebGLUniformInfo(uint32_t s = 0, bool a = false, ShDataType t = SH_NONE)
    19         : arraySize(s), isArray(a), type(t) {}
    21     int ElementSize() const {
    22         switch (type) {
    23             case SH_INT:
    24             case SH_FLOAT:
    25             case SH_BOOL:
    26             case SH_SAMPLER_2D:
    27             case SH_SAMPLER_CUBE:
    28                 return 1;
    29             case SH_INT_VEC2:
    30             case SH_FLOAT_VEC2:
    31             case SH_BOOL_VEC2:
    32                 return 2;
    33             case SH_INT_VEC3:
    34             case SH_FLOAT_VEC3:
    35             case SH_BOOL_VEC3:
    36                 return 3;
    37             case SH_INT_VEC4:
    38             case SH_FLOAT_VEC4:
    39             case SH_BOOL_VEC4:
    40             case SH_FLOAT_MAT2:
    41                 return 4;
    42             case SH_FLOAT_MAT3:
    43                 return 9;
    44             case SH_FLOAT_MAT4:
    45                 return 16;
    46             default:
    47                 MOZ_ASSERT(false); // should never get here
    48                 return 0;
    49         }
    50     }
    51 };
    53 } // namespace mozilla
    55 #endif

mercurial