OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright 2014 Google Inc. |
| 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. |
| 6 */ |
| 7 |
| 8 #ifndef GrGLFullProgramBuilder_DEFINED |
| 9 #define GrGLFullProgramBuilder_DEFINED |
| 10 |
| 11 #include "GrGLProgramBuilder.h" |
| 12 |
| 13 class GrGLFullProgramBuilder : public GrGLProgramBuilder { |
| 14 public: |
| 15 GrGLFullProgramBuilder(GrGpuGL*, const GrGLProgramDesc&); |
| 16 |
| 17 /** Add a varying variable to the current program to pass values between vert
ex and fragment |
| 18 shaders. If the last two parameters are non-NULL, they are filled in wit
h the name |
| 19 generated. */ |
| 20 void addVarying(GrSLType type, |
| 21 const char* name, |
| 22 const char** vsOutName = NULL, |
| 23 const char** fsInName = NULL, |
| 24 GrGLShaderVar::Precision fsPrecision=GrGLShaderVar::kDefault
_Precision); |
| 25 |
| 26 /** Add a separable varying input variable to the current program. |
| 27 * A separable varying (fragment shader input) is a varying that can be used
also when vertex |
| 28 * shaders are not used. With a vertex shader, the operation is same as with
other |
| 29 * varyings. Without a vertex shader, such as with NV_path_rendering, GL API
s are used to |
| 30 * populate the variable. The APIs can refer to the variable through the ret
urned handle. |
| 31 */ |
| 32 VaryingHandle addSeparableVarying(GrSLType type, |
| 33 const char* name, |
| 34 const char** vsOutName, |
| 35 const char** fsInName); |
| 36 |
| 37 GrGLVertexShaderBuilder* getVertexShaderBuilder() { return &fVS; } |
| 38 |
| 39 private: |
| 40 virtual void emitCodeBeforeEffects(GrGLSLExpr4* color, |
| 41 GrGLSLExpr4* coverage) SK_OVERRIDE; |
| 42 |
| 43 virtual void emitGeometryProcessor(const GrEffectStage* geometryProcessor, |
| 44 GrGLSLExpr4* coverage) SK_OVERRIDE; |
| 45 |
| 46 virtual GrGLProgramEffects* createAndEmitEffects(const GrEffectStage* effect
Stages[], |
| 47 int effectCnt, |
| 48 const GrGLProgramDesc::Effe
ctKeyProvider&, |
| 49 GrGLSLExpr4* inOutFSColor)
SK_OVERRIDE; |
| 50 |
| 51 /* |
| 52 * These functions are temporary and will eventually operate not on effects
but on |
| 53 * geometry processors |
| 54 */ |
| 55 void createAndEmitEffect(GrGLProgramEffectsBuilder*, |
| 56 const GrEffectStage* effectStage, |
| 57 const GrGLProgramDesc::EffectKeyProvider&, |
| 58 GrGLSLExpr4* inOutFSColor); |
| 59 |
| 60 GrGLProgramEffects* createAndEmitEffect(const GrEffectStage* geometryProcess
or, |
| 61 const GrGLProgramDesc::EffectKeyProv
ider&, |
| 62 GrGLSLExpr4* inOutFSColor); |
| 63 |
| 64 virtual void emitCodeAfterEffects() SK_OVERRIDE; |
| 65 |
| 66 virtual bool compileAndAttachShaders(GrGLuint programId, |
| 67 SkTDArray<GrGLuint>* shaderIds) const S
K_OVERRIDE; |
| 68 |
| 69 virtual void bindProgramLocations(GrGLuint programId) SK_OVERRIDE; |
| 70 |
| 71 GrGLGeometryShaderBuilder fGS; |
| 72 GrGLVertexShaderBuilder fVS; |
| 73 |
| 74 typedef GrGLProgramBuilder INHERITED; |
| 75 }; |
| 76 |
| 77 #endif |
OLD | NEW |