| 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 void addInput(const GrGLSLShaderVar& input) { fInputs.push_back(input); } | |
| 29 void addOutput(const GrGLSLShaderVar& output) { fOutputs.push_back(output);
} | |
| 30 | |
| 31 /* | 28 /* |
| 32 * We put texture lookups in the base class because it is TECHNICALLY possib
le to do texture | 29 * We put texture lookups in the base class because it is TECHNICALLY possib
le to do texture |
| 33 * lookups in any kind of shader. However, for the time being using these c
alls on non-fragment | 30 * lookups in any kind of shader. However, for the time being using these c
alls on non-fragment |
| 34 * shaders will result in a shader compilation error as texture sampler unif
orms are only | 31 * shaders will result in a shader compilation error as texture sampler unif
orms are only |
| 35 * visible to the fragment shader. It would not be hard to change this beha
vior, if someone | 32 * visible to the fragment shader. It would not be hard to change this beha
vior, if someone |
| 36 * actually wants to do texture lookups in a non-fragment shader | 33 * actually wants to do texture lookups in a non-fragment shader |
| 37 * | 34 * |
| 38 * TODO if append texture lookup is used on a non-fragment shader, sampler u
niforms should be | 35 * TODO if append texture lookup is used on a non-fragment shader, sampler u
niforms should be |
| 39 * made visible to that shaders | 36 * made visible to that shaders |
| 40 */ | 37 */ |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 VarArray fOutputs; | 188 VarArray fOutputs; |
| 192 uint32_t fFeaturesAddedMask; | 189 uint32_t fFeaturesAddedMask; |
| 193 SkSTArray<1, SkString> fLayoutParams[kLastInterfaceQualifier + 1]; | 190 SkSTArray<1, SkString> fLayoutParams[kLastInterfaceQualifier + 1]; |
| 194 int fCodeIndex; | 191 int fCodeIndex; |
| 195 bool fFinalized; | 192 bool fFinalized; |
| 196 | 193 |
| 197 friend class GrGLProgramBuilder; | 194 friend class GrGLProgramBuilder; |
| 198 friend class GrGLPathProgramBuilder; // to access fInputs. | 195 friend class GrGLPathProgramBuilder; // to access fInputs. |
| 199 }; | 196 }; |
| 200 #endif | 197 #endif |
| OLD | NEW |