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

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

Issue 1202293002: Move GLSL-specific routines/classes to separate glsl directory (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rename GrGLGLSL.{cpp,h} Created 5 years, 6 months 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/GrGLVertexShaderBuilder.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 "gl/GrGLInterface.h"
12 #include "GrColor.h"
13 #include "GrTypesPriv.h" 11 #include "GrTypesPriv.h"
14 #include "SkString.h" 12 #include "SkString.h"
15 13
16 class GrGLContextInfo;
17 class GrGLShaderVar;
18
19 // Limited set of GLSL versions we build shaders for. Caller should round 14 // Limited set of GLSL versions we build shaders for. Caller should round
20 // down the GLSL version to one of these enums. 15 // down the GLSL version to one of these enums.
21 enum GrGLSLGeneration { 16 enum GrGLSLGeneration {
22 /** 17 /**
23 * Desktop GLSL 1.10 and ES2 shading language (based on desktop GLSL 1.20) 18 * Desktop GLSL 1.10 and ES2 shading language (based on desktop GLSL 1.20)
24 */ 19 */
25 k110_GrGLSLGeneration, 20 k110_GrGLSLGeneration,
26 /** 21 /**
27 * Desktop GLSL 1.30 22 * Desktop GLSL 1.30
28 */ 23 */
29 k130_GrGLSLGeneration, 24 k130_GrGLSLGeneration,
30 /** 25 /**
31 * Desktop GLSL 1.40 26 * Desktop GLSL 1.40
32 */ 27 */
33 k140_GrGLSLGeneration, 28 k140_GrGLSLGeneration,
34 /** 29 /**
35 * Desktop GLSL 1.50 30 * Desktop GLSL 1.50
36 */ 31 */
37 k150_GrGLSLGeneration, 32 k150_GrGLSLGeneration,
38 /** 33 /**
39 * Desktop GLSL 3.30, and ES GLSL 3.00 34 * Desktop GLSL 3.30, and ES GLSL 3.00
40 */ 35 */
41 k330_GrGLSLGeneration, 36 k330_GrGLSLGeneration,
42 /** 37 /**
43 * ES GLSL 3.10 only TODO Make GLSLCap objects to make this more granular 38 * ES GLSL 3.10 only TODO Make GLSLCap objects to make this more granular
44 */ 39 */
45 k310es_GrGLSLGeneration, 40 k310es_GrGLSLGeneration,
46 }; 41 };
47 42
48 /**
49 * Gets the most recent GLSL Generation compatible with the OpenGL context.
50 */
51 bool GrGetGLSLGeneration(const GrGLInterface* gl, GrGLSLGeneration* generation);
52
53 bool GrGLSLSupportsNamedFragmentShaderOutputs(GrGLSLGeneration); 43 bool GrGLSLSupportsNamedFragmentShaderOutputs(GrGLSLGeneration);
54 44
55 /** 45 /**
56 * Returns a string to include at the beginning of a shader to declare the GLSL
57 * version.
58 */
59 const char* GrGetGLSLVersionDecl(const GrGLContextInfo&);
60
61 /**
62 * Adds a line of GLSL code to declare the default precision for float types.
63 */
64 void GrGLSLAppendDefaultFloatPrecisionDeclaration(GrSLPrecision, GrGLStandard, S kString* out);
65
66 /**
67 * Gets the name of the function that should be used to sample a 2D texture. Coo rd type is used 46 * Gets the name of the function that should be used to sample a 2D texture. Coo rd type is used
68 * to indicate whether the texture is sampled using projective textured (kVec3f) or not (kVec2f). 47 * to indicate whether the texture is sampled using projective textured (kVec3f) or not (kVec2f).
69 */ 48 */
70 inline const char* GrGLSLTexture2DFunctionName(GrSLType coordType, GrGLSLGenerat ion glslGen) { 49 inline const char* GrGLSLTexture2DFunctionName(GrSLType coordType, GrGLSLGenerat ion glslGen) {
71 if (kVec2f_GrSLType == coordType) { 50 if (kVec2f_GrSLType == coordType) {
72 return glslGen >= k130_GrGLSLGeneration ? "texture" : "texture2D"; 51 return glslGen >= k130_GrGLSLGeneration ? "texture" : "texture2D";
73 } else { 52 } else {
74 SkASSERT(kVec3f_GrSLType == coordType); 53 SkASSERT(kVec3f_GrSLType == coordType);
75 return glslGen >= k130_GrGLSLGeneration ? "textureProj" : "texture2DProj "; 54 return glslGen >= k130_GrGLSLGeneration ? "textureProj" : "texture2DProj ";
76 } 55 }
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 317
339 /** 318 /**
340 * Does an inplace mul, *=, of vec4VarName by mulFactor. 319 * Does an inplace mul, *=, of vec4VarName by mulFactor.
341 * A semicolon is added after the assignment. 320 * A semicolon is added after the assignment.
342 */ 321 */
343 void GrGLSLMulVarBy4f(SkString* outAppend, const char* vec4VarName, const GrGLSL Expr4& mulFactor); 322 void GrGLSLMulVarBy4f(SkString* outAppend, const char* vec4VarName, const GrGLSL Expr4& mulFactor);
344 323
345 #include "GrGLSL_impl.h" 324 #include "GrGLSL_impl.h"
346 325
347 #endif 326 #endif
OLDNEW
« no previous file with comments | « src/gpu/gl/builders/GrGLVertexShaderBuilder.cpp ('k') | src/gpu/glsl/GrGLSL.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698