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 GrGLVertexShader_DEFINED | 8 #ifndef GrGLVertexShader_DEFINED |
9 #define GrGLVertexShader_DEFINED | 9 #define GrGLVertexShader_DEFINED |
10 | 10 |
11 #include "GrGLShaderBuilder.h" | 11 #include "GrGLShaderBuilder.h" |
12 | 12 |
13 class GrGLVarying; | 13 class GrGLVarying; |
14 | 14 |
15 class GrGLVertexBuilder : public GrGLShaderBuilder { | 15 class GrGLVertexBuilder : public GrGLShaderBuilder { |
16 public: | 16 public: |
17 GrGLVertexBuilder(GrGLProgramBuilder* program); | 17 GrGLVertexBuilder(GrGLProgramBuilder* program); |
18 | 18 |
19 /** returns the expected position output */ | 19 /** returns the expected position output */ |
20 const char* glPosition() const { return "pos3"; } | 20 const char* glPosition() const { return "pos3"; } |
21 const char* positionCoords() const { return "position"; } | 21 const char* positionCoords() const { return "position"; } |
22 const char* localCoords() const { return "localCoords"; } | 22 const char* localCoords() const { return "localCoords"; } |
23 | 23 |
24 /** returns the expected uviewM matrix */ | |
25 // TODO all of this fixed function stuff can live on the GP/PP | |
26 const char* uViewM() const { return "uViewM"; } | |
27 | |
28 void addAttribute(const GrGeometryProcessor::GrAttribute* attr) { | 24 void addAttribute(const GrGeometryProcessor::GrAttribute* attr) { |
29 this->addAttribute(GrShaderVar(attr->fName, | 25 this->addAttribute(GrShaderVar(attr->fName, |
30 GrVertexAttribTypeToSLType(attr->fType), | 26 GrVertexAttribTypeToSLType(attr->fType), |
31 GrShaderVar::kAttribute_TypeModifier)); | 27 GrShaderVar::kAttribute_TypeModifier)); |
32 } | 28 } |
33 | 29 |
34 private: | 30 private: |
35 /* | 31 /* |
36 * Internal call for GrGLProgramBuilder.addVarying | 32 * Internal call for GrGLProgramBuilder.addVarying |
37 */ | 33 */ |
38 void addVarying(const char* name, GrGLVarying*); | 34 void addVarying(const char* name, GrGLVarying*); |
39 | 35 |
40 /* | 36 /* |
41 * private helpers for compilation by GrGLProgramBuilder | 37 * private helpers for compilation by GrGLProgramBuilder |
42 */ | 38 */ |
43 void transformToNormalizedDeviceSpace(); | 39 void transformToNormalizedDeviceSpace(); |
44 //TODO GP itself should setup the uniform view matrix | |
45 void setupUniformViewMatrix(); | |
46 void emitAttributes(const GrGeometryProcessor& gp); | 40 void emitAttributes(const GrGeometryProcessor& gp); |
47 void bindVertexAttributes(GrGLuint programID); | 41 void bindVertexAttributes(GrGLuint programID); |
48 bool compileAndAttachShaders(GrGLuint programId, SkTDArray<GrGLuint>* shader
Ids) const; | 42 bool compileAndAttachShaders(GrGLuint programId, SkTDArray<GrGLuint>* shader
Ids) const; |
49 | 43 |
50 // an internal call which checks for uniquness of a var before adding it to
the list of inputs | 44 // an internal call which checks for uniquness of a var before adding it to
the list of inputs |
51 bool addAttribute(const GrShaderVar& var); | 45 bool addAttribute(const GrShaderVar& var); |
52 | 46 |
53 const char* fRtAdjustName; | 47 const char* fRtAdjustName; |
54 | 48 |
55 friend class GrGLProgramBuilder; | 49 friend class GrGLProgramBuilder; |
56 | 50 |
57 typedef GrGLShaderBuilder INHERITED; | 51 typedef GrGLShaderBuilder INHERITED; |
58 }; | 52 }; |
59 | 53 |
60 #endif | 54 #endif |
OLD | NEW |