content/canvas/src/WebGLUniformInfo.h

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

     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