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