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

Side by Side Diff: src/gpu/glsl/GrGLSL.h

Issue 1403373012: Make appending default precision be controled by GLSL (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 5 years, 1 month 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 | « src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp ('k') | src/gpu/glsl/GrGLSL.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 2011 Google Inc. 2 * Copyright 2011 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 GrGLSL_DEFINED 8 #ifndef GrGLSL_DEFINED
9 #define GrGLSL_DEFINED 9 #define GrGLSL_DEFINED
10 10
11 #include "GrTypesPriv.h" 11 #include "GrTypesPriv.h"
12 #include "SkString.h" 12 #include "SkString.h"
13 13
14 class GrGLSLCaps;
15
14 // Limited set of GLSL versions we build shaders for. Caller should round 16 // Limited set of GLSL versions we build shaders for. Caller should round
15 // down the GLSL version to one of these enums. 17 // down the GLSL version to one of these enums.
16 enum GrGLSLGeneration { 18 enum GrGLSLGeneration {
17 /** 19 /**
18 * Desktop GLSL 1.10 and ES2 shading language (based on desktop GLSL 1.20) 20 * Desktop GLSL 1.10 and ES2 shading language (based on desktop GLSL 1.20)
19 */ 21 */
20 k110_GrGLSLGeneration, 22 k110_GrGLSLGeneration,
21 /** 23 /**
22 * Desktop GLSL 1.30 24 * Desktop GLSL 1.30
23 */ 25 */
(...skipping 25 matching lines...) Expand all
49 inline const char* GrGLSLTexture2DFunctionName(GrSLType coordType, GrGLSLGenerat ion glslGen) { 51 inline const char* GrGLSLTexture2DFunctionName(GrSLType coordType, GrGLSLGenerat ion glslGen) {
50 if (kVec2f_GrSLType == coordType) { 52 if (kVec2f_GrSLType == coordType) {
51 return glslGen >= k130_GrGLSLGeneration ? "texture" : "texture2D"; 53 return glslGen >= k130_GrGLSLGeneration ? "texture" : "texture2D";
52 } else { 54 } else {
53 SkASSERT(kVec3f_GrSLType == coordType); 55 SkASSERT(kVec3f_GrSLType == coordType);
54 return glslGen >= k130_GrGLSLGeneration ? "textureProj" : "texture2DProj "; 56 return glslGen >= k130_GrGLSLGeneration ? "textureProj" : "texture2DProj ";
55 } 57 }
56 } 58 }
57 59
58 /** 60 /**
61 * Adds a line of GLSL code to declare the default precision for float types.
62 */
63 void GrGLSLAppendDefaultFloatPrecisionDeclaration(GrSLPrecision,
64 const GrGLSLCaps& glslCaps,
65 SkString* out);
66
67 /**
59 * Converts a GrSLType to a string containing the name of the equivalent GLSL ty pe. 68 * Converts a GrSLType to a string containing the name of the equivalent GLSL ty pe.
60 */ 69 */
61 static inline const char* GrGLSLTypeString(GrSLType t) { 70 static inline const char* GrGLSLTypeString(GrSLType t) {
62 switch (t) { 71 switch (t) {
63 case kVoid_GrSLType: 72 case kVoid_GrSLType:
64 return "void"; 73 return "void";
65 case kFloat_GrSLType: 74 case kFloat_GrSLType:
66 return "float"; 75 return "float";
67 case kVec2f_GrSLType: 76 case kVec2f_GrSLType:
68 return "vec2"; 77 return "vec2";
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 326
318 /** 327 /**
319 * Does an inplace mul, *=, of vec4VarName by mulFactor. 328 * Does an inplace mul, *=, of vec4VarName by mulFactor.
320 * A semicolon is added after the assignment. 329 * A semicolon is added after the assignment.
321 */ 330 */
322 void GrGLSLMulVarBy4f(SkString* outAppend, const char* vec4VarName, const GrGLSL Expr4& mulFactor); 331 void GrGLSLMulVarBy4f(SkString* outAppend, const char* vec4VarName, const GrGLSL Expr4& mulFactor);
323 332
324 #include "GrGLSL_impl.h" 333 #include "GrGLSL_impl.h"
325 334
326 #endif 335 #endif
OLDNEW
« no previous file with comments | « src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp ('k') | src/gpu/glsl/GrGLSL.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698