Bumping gaia.json for 1 gaia revision(s) a=gaia-bump
[gecko.git] / dom / canvas / WebGLUniformInfo.h
blobaba30886f07d32dcbb4eec74ddb03f8ada532a0c
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;
53 } // namespace mozilla
55 #endif