Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Side by Side Diff: include/gpu/GrShaderVar.h

Issue 788733003: Make addUniform take a precision (Closed) Base URL: https://skia.googlesource.com/skia.git@move_prec
Patch Set: rebase Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | include/gpu/GrTypesPriv.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef GrShaderVar_DEFINED 8 #ifndef GrShaderVar_DEFINED
9 #define GrShaderVar_DEFINED 9 #define GrShaderVar_DEFINED
10 10
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 , fPrecision(kDefault_GrSLPrecision) { 44 , fPrecision(kDefault_GrSLPrecision) {
45 } 45 }
46 46
47 GrShaderVar(const SkString& name, GrSLType type, int arrayCount = kNonArray, 47 GrShaderVar(const SkString& name, GrSLType type, int arrayCount = kNonArray,
48 GrSLPrecision precision = kDefault_GrSLPrecision) 48 GrSLPrecision precision = kDefault_GrSLPrecision)
49 : fType(type) 49 : fType(type)
50 , fTypeModifier(kNone_TypeModifier) 50 , fTypeModifier(kNone_TypeModifier)
51 , fName(name) 51 , fName(name)
52 , fCount(arrayCount) 52 , fCount(arrayCount)
53 , fPrecision(precision) { 53 , fPrecision(precision) {
54 SkASSERT(kDefault_GrSLPrecision == precision || GrSLTypeIsFloatType(type ));
54 SkASSERT(kVoid_GrSLType != type); 55 SkASSERT(kVoid_GrSLType != type);
55 } 56 }
56 57
57 GrShaderVar(const char* name, GrSLType type, int arrayCount = kNonArray, 58 GrShaderVar(const char* name, GrSLType type, int arrayCount = kNonArray,
58 GrSLPrecision precision = kDefault_GrSLPrecision) 59 GrSLPrecision precision = kDefault_GrSLPrecision)
59 : fType(type) 60 : fType(type)
60 , fTypeModifier(kNone_TypeModifier) 61 , fTypeModifier(kNone_TypeModifier)
61 , fName(name) 62 , fName(name)
62 , fCount(arrayCount) 63 , fCount(arrayCount)
63 , fPrecision(precision) { 64 , fPrecision(precision) {
65 SkASSERT(kDefault_GrSLPrecision == precision || GrSLTypeIsFloatType(type ));
64 SkASSERT(kVoid_GrSLType != type); 66 SkASSERT(kVoid_GrSLType != type);
65 } 67 }
66 68
67 GrShaderVar(const char* name, GrSLType type, TypeModifier typeModifier, 69 GrShaderVar(const char* name, GrSLType type, TypeModifier typeModifier,
68 int arrayCount = kNonArray, GrSLPrecision precision = kDefault _GrSLPrecision) 70 int arrayCount = kNonArray, GrSLPrecision precision = kDefault _GrSLPrecision)
69 : fType(type) 71 : fType(type)
70 , fTypeModifier(typeModifier) 72 , fTypeModifier(typeModifier)
71 , fName(name) 73 , fName(name)
72 , fCount(arrayCount) 74 , fCount(arrayCount)
73 , fPrecision(precision) { 75 , fPrecision(precision) {
76 SkASSERT(kDefault_GrSLPrecision == precision || GrSLTypeIsFloatType(type ));
74 SkASSERT(kVoid_GrSLType != type); 77 SkASSERT(kVoid_GrSLType != type);
75 } 78 }
76 79
77 /** 80 /**
78 * Values for array count that have special meaning. We allow 1-sized arrays . 81 * Values for array count that have special meaning. We allow 1-sized arrays .
79 */ 82 */
80 enum { 83 enum {
81 kNonArray = 0, // not an array 84 kNonArray = 0, // not an array
82 kUnsizedArray = -1, // an unsized array (declared with []) 85 kUnsizedArray = -1, // an unsized array (declared with [])
83 }; 86 };
84 87
85 /** 88 /**
86 * Sets as a non-array. 89 * Sets as a non-array.
87 */ 90 */
88 void set(GrSLType type, 91 void set(GrSLType type,
89 TypeModifier typeModifier, 92 TypeModifier typeModifier,
90 const SkString& name, 93 const SkString& name,
91 GrSLPrecision precision = kDefault_GrSLPrecision) { 94 GrSLPrecision precision = kDefault_GrSLPrecision) {
92 SkASSERT(kVoid_GrSLType != type); 95 SkASSERT(kVoid_GrSLType != type);
96 SkASSERT(kDefault_GrSLPrecision == precision || GrSLTypeIsFloatType(type ));
93 fType = type; 97 fType = type;
94 fTypeModifier = typeModifier; 98 fTypeModifier = typeModifier;
95 fName = name; 99 fName = name;
96 fCount = kNonArray; 100 fCount = kNonArray;
97 fPrecision = precision; 101 fPrecision = precision;
98 } 102 }
99 103
100 /** 104 /**
101 * Sets as a non-array. 105 * Sets as a non-array.
102 */ 106 */
103 void set(GrSLType type, 107 void set(GrSLType type,
104 TypeModifier typeModifier, 108 TypeModifier typeModifier,
105 const char* name, 109 const char* name,
106 GrSLPrecision precision = kDefault_GrSLPrecision) { 110 GrSLPrecision precision = kDefault_GrSLPrecision) {
107 SkASSERT(kVoid_GrSLType != type); 111 SkASSERT(kVoid_GrSLType != type);
112 SkASSERT(kDefault_GrSLPrecision == precision || GrSLTypeIsFloatType(type ));
108 fType = type; 113 fType = type;
109 fTypeModifier = typeModifier; 114 fTypeModifier = typeModifier;
110 fName = name; 115 fName = name;
111 fCount = kNonArray; 116 fCount = kNonArray;
112 fPrecision = precision; 117 fPrecision = precision;
113 } 118 }
114 119
115 /** 120 /**
116 * Set all var options 121 * Set all var options
117 */ 122 */
118 void set(GrSLType type, 123 void set(GrSLType type,
119 TypeModifier typeModifier, 124 TypeModifier typeModifier,
120 const SkString& name, 125 const SkString& name,
121 int count, 126 int count,
122 GrSLPrecision precision = kDefault_GrSLPrecision) { 127 GrSLPrecision precision = kDefault_GrSLPrecision) {
123 SkASSERT(kVoid_GrSLType != type); 128 SkASSERT(kVoid_GrSLType != type);
129 SkASSERT(kDefault_GrSLPrecision == precision || GrSLTypeIsFloatType(type ));
124 fType = type; 130 fType = type;
125 fTypeModifier = typeModifier; 131 fTypeModifier = typeModifier;
126 fName = name; 132 fName = name;
127 fCount = count; 133 fCount = count;
128 fPrecision = precision; 134 fPrecision = precision;
129 } 135 }
130 136
131 /** 137 /**
132 * Set all var options 138 * Set all var options
133 */ 139 */
134 void set(GrSLType type, 140 void set(GrSLType type,
135 TypeModifier typeModifier, 141 TypeModifier typeModifier,
136 const char* name, 142 const char* name,
137 int count, 143 int count,
138 GrSLPrecision precision = kDefault_GrSLPrecision) { 144 GrSLPrecision precision = kDefault_GrSLPrecision) {
139 SkASSERT(kVoid_GrSLType != type); 145 SkASSERT(kVoid_GrSLType != type);
146 SkASSERT(kDefault_GrSLPrecision == precision || GrSLTypeIsFloatType(type ));
140 fType = type; 147 fType = type;
141 fTypeModifier = typeModifier; 148 fTypeModifier = typeModifier;
142 fName = name; 149 fName = name;
143 fCount = count; 150 fCount = count;
144 fPrecision = precision; 151 fPrecision = precision;
145 } 152 }
146 153
147 /** 154 /**
148 * Is the var an array. 155 * Is the var an array.
149 */ 156 */
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 220
214 protected: 221 protected:
215 GrSLType fType; 222 GrSLType fType;
216 TypeModifier fTypeModifier; 223 TypeModifier fTypeModifier;
217 SkString fName; 224 SkString fName;
218 int fCount; 225 int fCount;
219 GrSLPrecision fPrecision; 226 GrSLPrecision fPrecision;
220 }; 227 };
221 228
222 #endif 229 #endif
OLDNEW
« no previous file with comments | « no previous file | include/gpu/GrTypesPriv.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698