Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(67)

Side by Side Diff: src/gpu/gl/builders/GrGLVertexShaderBuilder.h

Issue 678953002: Default geometry processor (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix dm bug Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 void transformPositionToDeviceSpace(const char* pos3);
20
19 /** 21 /**
20 * Are explicit local coordinates provided as input to the vertex shader. 22 * Are explicit local coordinates provided as input to the vertex shader.
21 */ 23 */
22 bool hasLocalCoords() const { return (fLocalCoordsVar != fPositionVar); } 24 bool hasLocalCoords() const { return (fLocalCoordsVar != fPositionVar); }
23 25
24 /** Returns a vertex attribute that represents the local coords in the VS. T his may be the same 26 /** Returns a vertex attribute that represents the local coords in the VS. T his may be the same
25 as positionAttribute() or it may not be. It depends upon whether the ren dering code 27 as positionAttribute() or it may not be. It depends upon whether the ren dering code
26 specified explicit local coords or not in the GrDrawState. */ 28 specified explicit local coords or not in the GrDrawState. */
27 const GrGLShaderVar& localCoordsAttribute() const { return *fLocalCoordsVar; } 29 const GrGLShaderVar& localCoordsAttribute() const { return *fLocalCoordsVar; }
28 30
29 /** Returns a vertex attribute that represents the vertex position in the VS . This is the 31 /** Returns a vertex attribute that represents the vertex position in the VS . This is the
30 pre-matrix position and is commonly used by effects to compute texture c oords via a matrix. 32 pre-matrix position and is commonly used by effects to compute texture c oords via a matrix.
31 */ 33 */
32 const GrGLShaderVar& positionAttribute() const { return *fPositionVar; } 34 const GrGLShaderVar& positionAttribute() const { return *fPositionVar; }
33 35
34 private: 36 private:
35 /* 37 /*
36 * Internal call for GrGLProgramBuilder.addVarying 38 * Internal call for GrGLProgramBuilder.addVarying
37 */ 39 */
38 void addVarying(const char* name, GrGLVarying*); 40 void addVarying(const char* name, GrGLVarying*);
39 41
40 /* 42 /*
41 * private helpers for compilation by GrGLProgramBuilder 43 * private helpers for compilation by GrGLProgramBuilder
42 */ 44 */
43 void setupLocalCoords(); 45 void setupLocalCoords();
44 void transformGLToSkiaCoords();
45 void setupBuiltinVertexAttribute(const char* inName, GrGLSLExpr4* out); 46 void setupBuiltinVertexAttribute(const char* inName, GrGLSLExpr4* out);
46 void emitAttributes(const GrGeometryProcessor& gp); 47 void emitAttributes(const GrGeometryProcessor& gp);
47 void transformSkiaToGLCoords();
48 void bindVertexAttributes(GrGLuint programID); 48 void bindVertexAttributes(GrGLuint programID);
49 bool compileAndAttachShaders(GrGLuint programId, SkTDArray<GrGLuint>* shader Ids) const; 49 bool compileAndAttachShaders(GrGLuint programId, SkTDArray<GrGLuint>* shader Ids) const;
50 50
51 // an internal call which checks for uniquness of a var before adding it to the list of inputs 51 // an internal call which checks for uniquness of a var before adding it to the list of inputs
52 bool addAttribute(const GrShaderVar& var); 52 bool addAttribute(const GrShaderVar& var);
53 struct AttributePair { 53 struct AttributePair {
54 void set(int index, const SkString& name) { 54 void set(int index, const SkString& name) {
55 fIndex = index; fName = name; 55 fIndex = index; fName = name;
56 } 56 }
57 int fIndex; 57 int fIndex;
58 SkString fName; 58 SkString fName;
59 }; 59 };
60 60
61 GrGLShaderVar* fPositionVar; 61 GrGLShaderVar* fPositionVar;
62 GrGLShaderVar* fLocalCoordsVar; 62 GrGLShaderVar* fLocalCoordsVar;
63 const char* fRtAdjustName;
63 int fEffectAttribOffset; 64 int fEffectAttribOffset;
64 65
65 friend class GrGLProgramBuilder; 66 friend class GrGLProgramBuilder;
66 67
67 typedef GrGLShaderBuilder INHERITED; 68 typedef GrGLShaderBuilder INHERITED;
68 }; 69 };
69 70
70 #endif 71 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698