| OLD | NEW | 
|---|
| 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 GrGLSLShaderBuilder_DEFINED | 8 #ifndef GrGLSLShaderBuilder_DEFINED | 
| 9 #define GrGLSLShaderBuilder_DEFINED | 9 #define GrGLSLShaderBuilder_DEFINED | 
| 10 | 10 | 
| 11 #include "GrAllocator.h" | 11 #include "GrAllocator.h" | 
| 12 #include "glsl/GrGLSLShaderVar.h" | 12 #include "glsl/GrGLSLShaderVar.h" | 
| 13 #include "SkTDArray.h" | 13 #include "SkTDArray.h" | 
| 14 | 14 | 
| 15 #include <stdarg.h> | 15 #include <stdarg.h> | 
| 16 | 16 | 
| 17 class GrGLSLProgramBuilder; | 17 class GrGLSLProgramBuilder; | 
| 18 class GrGLSLTextureSampler; | 18 class GrGLSLTextureSampler; | 
| 19 | 19 | 
| 20 /** | 20 /** | 
| 21   base class for all shaders builders | 21   base class for all shaders builders | 
| 22 */ | 22 */ | 
| 23 class GrGLSLShaderBuilder { | 23 class GrGLSLShaderBuilder { | 
| 24 public: | 24 public: | 
| 25     GrGLSLShaderBuilder(GrGLSLProgramBuilder* program); | 25     GrGLSLShaderBuilder(GrGLSLProgramBuilder* program); | 
| 26     virtual ~GrGLSLShaderBuilder() {} | 26     virtual ~GrGLSLShaderBuilder() {} | 
| 27 | 27 | 
| 28     /* |  | 
| 29      * We put texture lookups in the base class because it is TECHNICALLY possib
     le to do texture |  | 
| 30      * lookups in any kind of shader.  However, for the time being using these c
     alls on non-fragment |  | 
| 31      * shaders will result in a shader compilation error as texture sampler unif
     orms are only |  | 
| 32      * visible to the fragment shader.  It would not be hard to change this beha
     vior, if someone |  | 
| 33      * actually wants to do texture lookups in a non-fragment shader |  | 
| 34      * |  | 
| 35      * TODO if append texture lookup is used on a non-fragment shader, sampler u
     niforms should be |  | 
| 36      * made visible to that shaders |  | 
| 37      */ |  | 
| 38     /** Appends a 2D texture sample with projection if necessary. coordType must
      either be Vec2f or | 28     /** Appends a 2D texture sample with projection if necessary. coordType must
      either be Vec2f or | 
| 39         Vec3f. The latter is interpreted as projective texture coords. The vec l
     ength and swizzle | 29         Vec3f. The latter is interpreted as projective texture coords. The vec l
     ength and swizzle | 
| 40         order of the result depends on the GrTextureAccess associated with the G
     rGLSLTextureSampler. | 30         order of the result depends on the GrTextureAccess associated with the G
     rGLSLTextureSampler. | 
| 41         */ | 31         */ | 
| 42     void appendTextureLookup(SkString* out, | 32     void appendTextureLookup(SkString* out, | 
| 43                              const GrGLSLTextureSampler&, | 33                              const GrGLSLTextureSampler&, | 
| 44                              const char* coordName, | 34                              const char* coordName, | 
| 45                              GrSLType coordType = kVec2f_GrSLType) const; | 35                              GrSLType coordType = kVec2f_GrSLType) const; | 
| 46 | 36 | 
| 47     /** Version of above that appends the result to the fragment shader code ins
     tead.*/ | 37     /** Version of above that appends the result to the fragment shader code ins
     tead.*/ | 
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 230     int fCodeIndex; | 220     int fCodeIndex; | 
| 231     bool fFinalized; | 221     bool fFinalized; | 
| 232 | 222 | 
| 233     friend class GrGLSLProgramBuilder; | 223     friend class GrGLSLProgramBuilder; | 
| 234     friend class GrGLProgramBuilder; | 224     friend class GrGLProgramBuilder; | 
| 235     friend class GrGLSLVaryingHandler; // to access noperspective interpolation 
     feature. | 225     friend class GrGLSLVaryingHandler; // to access noperspective interpolation 
     feature. | 
| 236     friend class GrGLPathProgramBuilder; // to access fInputs. | 226     friend class GrGLPathProgramBuilder; // to access fInputs. | 
| 237     friend class GrVkProgramBuilder; | 227     friend class GrVkProgramBuilder; | 
| 238 }; | 228 }; | 
| 239 #endif | 229 #endif | 
| OLD | NEW | 
|---|