blob: 694aaa77552e4bd935203b8b683c9aa382643459 [file] [log] [blame]
jvanverthcba99b82015-06-24 06:59:57 -07001/*
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
Brian Salomon23c55b62018-06-19 16:28:41 -04008#include "GrGLSL.h"
Brian Salomon94efbf52016-11-29 13:43:05 -05009#include "GrShaderCaps.h"
Brian Salomon1d816b92017-08-17 11:07:59 -040010
Robert Phillips8296e752017-08-25 08:45:21 -040011const char* GrGLSLTypeString(const GrShaderCaps* shaderCaps, GrSLType t) {
12 switch (t) {
13 case kVoid_GrSLType:
14 return "void";
Ethan Nicholasf7b88202017-09-18 14:10:39 -040015 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";
Ethan Nicholas8aa45692017-09-20 11:24:15 -040023 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";
Ethan Nicholasf7b88202017-09-18 14:10:39 -040031 case kUint2_GrSLType:
Chris Dalton51ebd662017-10-24 16:10:48 -060032 return "uint2";
Ethan Nicholasf7b88202017-09-18 14:10:39 -040033 case kInt2_GrSLType:
Robert Phillips8296e752017-08-25 08:45:21 -040034 return "int2";
Ethan Nicholasf7b88202017-09-18 14:10:39 -040035 case kInt3_GrSLType:
Robert Phillips8296e752017-08-25 08:45:21 -040036 return "int3";
Ethan Nicholasf7b88202017-09-18 14:10:39 -040037 case kInt4_GrSLType:
Robert Phillips8296e752017-08-25 08:45:21 -040038 return "int4";
Ethan Nicholas8aa45692017-09-20 11:24:15 -040039 case kFloat2x2_GrSLType:
40 return "float2x2";
41 case kFloat3x3_GrSLType:
42 return "float3x3";
43 case kFloat4x4_GrSLType:
44 return "float4x4";
Ethan Nicholasf7b88202017-09-18 14:10:39 -040045 case kHalf2x2_GrSLType:
46 return "half2x2";
47 case kHalf3x3_GrSLType:
48 return "half3x3";
49 case kHalf4x4_GrSLType:
50 return "half4x4";
Robert Phillips8296e752017-08-25 08:45:21 -040051 case kTexture2DSampler_GrSLType:
52 return "sampler2D";
Robert Phillips8296e752017-08-25 08:45:21 -040053 case kTextureExternalSampler_GrSLType:
54 return "samplerExternalOES";
55 case kTexture2DRectSampler_GrSLType:
56 return "sampler2DRect";
Robert Phillips8296e752017-08-25 08:45:21 -040057 case kBool_GrSLType:
58 return "bool";
59 case kInt_GrSLType:
60 return "int";
61 case kUint_GrSLType:
62 return "uint";
Ethan Nicholasf7b88202017-09-18 14:10:39 -040063 case kShort_GrSLType:
64 return "short";
Chris Dalton51ebd662017-10-24 16:10:48 -060065 case kShort2_GrSLType:
66 return "short2";
67 case kShort3_GrSLType:
68 return "short3";
69 case kShort4_GrSLType:
70 return "short4";
Ethan Nicholasf7b88202017-09-18 14:10:39 -040071 case kUShort_GrSLType:
72 return "ushort";
Chris Dalton51ebd662017-10-24 16:10:48 -060073 case kUShort2_GrSLType:
Brian Osman4a3f5c82018-09-18 16:16:38 -040074 return "ushort2";
Chris Dalton51ebd662017-10-24 16:10:48 -060075 case kUShort3_GrSLType:
76 return "ushort3";
77 case kUShort4_GrSLType:
78 return "ushort4";
Ruiqi Maob609e6d2018-07-17 10:19:38 -040079 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";
Robert Phillips8296e752017-08-25 08:45:21 -040095 }
96 SK_ABORT("Unknown shader var type.");
97 return ""; // suppress warning
98}