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