1 /*
2  * Copyright 2011 Google Inc.
3  *
4  * Use of this source code is governed by a BSD-style license that can be
5  * found in the LICENSE file.
6  */
7 
8 #include "src/gpu/GrShaderCaps.h"
9 #include "src/gpu/glsl/GrGLSL.h"
10 
GrGLSLTypeString(GrSLType t)11 const char* GrGLSLTypeString(GrSLType t) {
12     switch (t) {
13         case kVoid_GrSLType:
14             return "void";
15         case kHalf_GrSLType:
16             return "half";
17         case kHalf2_GrSLType:
18             return "half2";
19         case kHalf3_GrSLType:
20             return "half3";
21         case kHalf4_GrSLType:
22             return "half4";
23         case kFloat_GrSLType:
24             return "float";
25         case kFloat2_GrSLType:
26             return "float2";
27         case kFloat3_GrSLType:
28             return "float3";
29         case kFloat4_GrSLType:
30             return "float4";
31         case kUint2_GrSLType:
32             return "uint2";
33         case kInt2_GrSLType:
34             return "int2";
35         case kInt3_GrSLType:
36             return "int3";
37         case kInt4_GrSLType:
38             return "int4";
39         case kFloat2x2_GrSLType:
40             return "float2x2";
41         case kFloat3x3_GrSLType:
42             return "float3x3";
43         case kFloat4x4_GrSLType:
44             return "float4x4";
45         case kHalf2x2_GrSLType:
46             return "half2x2";
47         case kHalf3x3_GrSLType:
48             return "half3x3";
49         case kHalf4x4_GrSLType:
50             return "half4x4";
51         case kTexture2DSampler_GrSLType:
52             return "sampler2D";
53         case kTextureExternalSampler_GrSLType:
54             return "samplerExternalOES";
55         case kTexture2DRectSampler_GrSLType:
56             return "sampler2DRect";
57         case kBool_GrSLType:
58             return "bool";
59         case kInt_GrSLType:
60             return "int";
61         case kUint_GrSLType:
62             return "uint";
63         case kShort_GrSLType:
64             return "short";
65         case kShort2_GrSLType:
66             return "short2";
67         case kShort3_GrSLType:
68             return "short3";
69         case kShort4_GrSLType:
70             return "short4";
71         case kUShort_GrSLType:
72             return "ushort";
73         case kUShort2_GrSLType:
74             return "ushort2";
75         case kUShort3_GrSLType:
76             return "ushort3";
77         case kUShort4_GrSLType:
78             return "ushort4";
79         case kByte_GrSLType:
80             return "byte";
81         case kByte2_GrSLType:
82             return "byte2";
83         case kByte3_GrSLType:
84             return "byte3";
85         case kByte4_GrSLType:
86             return "byte4";
87         case kUByte_GrSLType:
88             return "ubyte";
89         case kUByte2_GrSLType:
90             return "ubyte2";
91         case kUByte3_GrSLType:
92             return "ubyte3";
93         case kUByte4_GrSLType:
94             return "ubyte4";
95         case kTexture2D_GrSLType:
96             return "texture2D";
97         case kSampler_GrSLType:
98             return "sampler";
99     }
100     SK_ABORT("Unknown shader var type.");
101 }
102