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

Side by Side Diff: include/gpu/GrTypesPriv.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 | « include/gpu/GrShaderVar.h ('k') | src/effects/SkAlphaThresholdFilter.cpp » ('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 2013 Google Inc. 2 * Copyright 2013 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 GrTypesPriv_DEFINED 8 #ifndef GrTypesPriv_DEFINED
9 #define GrTypesPriv_DEFINED 9 #define GrTypesPriv_DEFINED
10 10
(...skipping 22 matching lines...) Expand all
33 kVertex_GrShaderType, 33 kVertex_GrShaderType,
34 kGeometry_GrShaderType, 34 kGeometry_GrShaderType,
35 kFragment_GrShaderType, 35 kFragment_GrShaderType,
36 36
37 kLastkFragment_GrShaderType = kFragment_GrShaderType 37 kLastkFragment_GrShaderType = kFragment_GrShaderType
38 }; 38 };
39 static const int kGrShaderTypeCount = kLastkFragment_GrShaderType + 1; 39 static const int kGrShaderTypeCount = kLastkFragment_GrShaderType + 1;
40 40
41 /** 41 /**
42 * Precisions of shader language variables. Not all shading languages support pr ecisions or actually 42 * Precisions of shader language variables. Not all shading languages support pr ecisions or actually
43 * vary the internal precision based on the qualifiers. 43 * vary the internal precision based on the qualifiers. These currently only app ly to float types (
44 * including float vectors and matrices).
44 */ 45 */
45 enum GrSLPrecision { 46 enum GrSLPrecision {
46 kLow_GrSLPrecision, 47 kLow_GrSLPrecision,
47 kMedium_GrSLPrecision, 48 kMedium_GrSLPrecision,
48 kHigh_GrSLPrecision, 49 kHigh_GrSLPrecision,
49 50
50 // Default precision is medium. This is because on OpenGL ES 2 highp support is not 51 // Default precision is medium. This is because on OpenGL ES 2 highp support is not
51 // guaranteed. On (non-ES) OpenGL the specifiers have no effect on precision . 52 // guaranteed. On (non-ES) OpenGL the specifiers have no effect on precision .
52 kDefault_GrSLPrecision = kMedium_GrSLPrecision, 53 kDefault_GrSLPrecision = kMedium_GrSLPrecision,
53 54
(...skipping 26 matching lines...) Expand all
80 static inline GrSLType GrSLFloatVectorType(int count) { 81 static inline GrSLType GrSLFloatVectorType(int count) {
81 SkASSERT(count > 0 && count <= 4); 82 SkASSERT(count > 0 && count <= 4);
82 return (GrSLType)(count); 83 return (GrSLType)(count);
83 84
84 GR_STATIC_ASSERT(kFloat_GrSLType == 1); 85 GR_STATIC_ASSERT(kFloat_GrSLType == 1);
85 GR_STATIC_ASSERT(kVec2f_GrSLType == 2); 86 GR_STATIC_ASSERT(kVec2f_GrSLType == 2);
86 GR_STATIC_ASSERT(kVec3f_GrSLType == 3); 87 GR_STATIC_ASSERT(kVec3f_GrSLType == 3);
87 GR_STATIC_ASSERT(kVec4f_GrSLType == 4); 88 GR_STATIC_ASSERT(kVec4f_GrSLType == 4);
88 } 89 }
89 90
91 /** Is the shading language type floating point (or vector/matrix of fp)? */
92 static inline bool GrSLTypeIsFloatType(GrSLType type) {
93 SkASSERT(type >= 0 && type < static_cast<GrSLType>(kGrSLTypeCount));
94 return type >= 1 && type <= 6;
95
96 GR_STATIC_ASSERT(0 == kVoid_GrSLType);
97 GR_STATIC_ASSERT(1 == kFloat_GrSLType);
98 GR_STATIC_ASSERT(2 == kVec2f_GrSLType);
99 GR_STATIC_ASSERT(3 == kVec3f_GrSLType);
100 GR_STATIC_ASSERT(4 == kVec4f_GrSLType);
101 GR_STATIC_ASSERT(5 == kMat33f_GrSLType);
102 GR_STATIC_ASSERT(6 == kMat44f_GrSLType);
103 GR_STATIC_ASSERT(7 == kSampler2D_GrSLType);
104 GR_STATIC_ASSERT(8 == kGrSLTypeCount);
105 }
90 ////////////////////////////////////////////////////////////////////////////// 106 //////////////////////////////////////////////////////////////////////////////
91 107
92 /** 108 /**
93 * Types used to describe format of vertices in arrays. 109 * Types used to describe format of vertices in arrays.
94 */ 110 */
95 enum GrVertexAttribType { 111 enum GrVertexAttribType {
96 kFloat_GrVertexAttribType = 0, 112 kFloat_GrVertexAttribType = 0,
97 kVec2f_GrVertexAttribType, 113 kVec2f_GrVertexAttribType,
98 kVec3f_GrVertexAttribType, 114 kVec3f_GrVertexAttribType,
99 kVec4f_GrVertexAttribType, 115 kVec4f_GrVertexAttribType,
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 /** 234 /**
219 * Indicates the type of pending IO operations that can be recorded for gpu reso urces. 235 * Indicates the type of pending IO operations that can be recorded for gpu reso urces.
220 */ 236 */
221 enum GrIOType { 237 enum GrIOType {
222 kRead_GrIOType, 238 kRead_GrIOType,
223 kWrite_GrIOType, 239 kWrite_GrIOType,
224 kRW_GrIOType 240 kRW_GrIOType
225 }; 241 };
226 242
227 #endif 243 #endif
OLDNEW
« no previous file with comments | « include/gpu/GrShaderVar.h ('k') | src/effects/SkAlphaThresholdFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698