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 #include "gl/GrGLTypes.h" | |
13 #include "GrGeometryProcessor.h" | 12 #include "GrGeometryProcessor.h" |
14 | 13 |
15 class GrGLVarying; | 14 class GrGLSLVarying; |
16 | 15 |
17 class GrGLVertexBuilder : public GrGLShaderBuilder { | 16 class GrGLVertexBuilder : public GrGLShaderBuilder { |
18 public: | 17 public: |
19 GrGLVertexBuilder(GrGLProgramBuilder* program); | 18 GrGLVertexBuilder(GrGLSLProgramBuilder* program); |
20 | 19 |
21 void transformToNormalizedDeviceSpace(const GrShaderVar& posVar); | 20 void transformToNormalizedDeviceSpace(const GrShaderVar& posVar); |
22 void emitAttributes(const GrGeometryProcessor& gp); | 21 void emitAttributes(const GrGeometryProcessor& gp); |
23 | 22 |
24 void addAttribute(const GrGeometryProcessor::Attribute* attr) { | 23 void addAttribute(const GrGeometryProcessor::Attribute* attr) { |
25 this->addAttribute(GrShaderVar(attr->fName, | 24 this->addAttribute(GrShaderVar(attr->fName, |
26 GrVertexAttribTypeToSLType(attr->fType), | 25 GrVertexAttribTypeToSLType(attr->fType), |
27 GrShaderVar::kAttribute_TypeModifier, | 26 GrShaderVar::kAttribute_TypeModifier, |
28 GrShaderVar::kNonArray, | 27 GrShaderVar::kNonArray, |
29 attr->fPrecision)); | 28 attr->fPrecision)); |
30 } | 29 } |
31 | 30 |
32 private: | 31 private: |
33 /* | 32 /* |
34 * Internal call for GrGLProgramBuilder.addVarying | 33 * Internal call for GrGLProgramBuilder.addVarying |
35 */ | 34 */ |
36 void addVarying(const char* name, GrSLPrecision, GrGLVarying*); | 35 void addVarying(const char* name, GrSLPrecision, GrGLSLVarying*); |
37 | |
38 /* | |
39 * private helpers for compilation by GrGLProgramBuilder | |
40 */ | |
41 void bindVertexAttributes(GrGLuint programID); | |
42 | 36 |
43 // an internal call which checks for uniquness of a var before adding it to
the list of inputs | 37 // an internal call which checks for uniquness of a var before adding it to
the list of inputs |
44 bool addAttribute(const GrShaderVar& var); | 38 bool addAttribute(const GrShaderVar& var); |
45 | 39 |
46 void onFinalize() override {} | 40 void onFinalize() override {} |
47 | 41 |
48 const char* fRtAdjustName; | 42 const char* fRtAdjustName; |
49 | 43 |
50 friend class GrGLProgramBuilder; | 44 friend class GrGLProgramBuilder; |
51 | 45 |
52 typedef GrGLShaderBuilder INHERITED; | 46 typedef GrGLShaderBuilder INHERITED; |
53 }; | 47 }; |
54 | 48 |
55 #endif | 49 #endif |
OLD | NEW |