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 #include "GrGLVertexShaderBuilder.h" | 8 #include "GrGLVertexShaderBuilder.h" |
9 #include "GrGLProgramBuilder.h" | 9 #include "GrGLProgramBuilder.h" |
10 #include "GrGLShaderStringBuilder.h" | 10 #include "GrGLShaderStringBuilder.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 posVar.c_str(), fRtAdjustName, fRtAdjustName, | 57 posVar.c_str(), fRtAdjustName, fRtAdjustName, |
58 posVar.c_str(), fRtAdjustName, fRtAdjustName); | 58 posVar.c_str(), fRtAdjustName, fRtAdjustName); |
59 } | 59 } |
60 | 60 |
61 // We could have the GrGeometryProcessor do this, but its just easier to hav
e it performed here. | 61 // We could have the GrGeometryProcessor do this, but its just easier to hav
e it performed here. |
62 // If we ever need to set variable pointsize, then we can reinvestigate | 62 // If we ever need to set variable pointsize, then we can reinvestigate |
63 this->codeAppend("gl_PointSize = 1.0;"); | 63 this->codeAppend("gl_PointSize = 1.0;"); |
64 } | 64 } |
65 | 65 |
66 void GrGLVertexBuilder::bindVertexAttributes(GrGLuint programID) { | 66 void GrGLVertexBuilder::bindVertexAttributes(GrGLuint programID) { |
67 const GrPrimitiveProcessor* primProc = fProgramBuilder->fOptState.getPrimiti
veProcessor(); | 67 const GrPrimitiveProcessor& primProc = fProgramBuilder->primitiveProcessor()
; |
68 | 68 |
69 int vaCount = primProc->numAttribs(); | 69 int vaCount = primProc.numAttribs(); |
70 for (int i = 0; i < vaCount; i++) { | 70 for (int i = 0; i < vaCount; i++) { |
71 GL_CALL(BindAttribLocation(programID, i, primProc->getAttrib(i).fName)); | 71 GL_CALL(BindAttribLocation(programID, i, primProc.getAttrib(i).fName)); |
72 } | 72 } |
73 return; | 73 return; |
74 } | 74 } |
75 | 75 |
76 bool GrGLVertexBuilder::compileAndAttachShaders(GrGLuint programId, | 76 bool GrGLVertexBuilder::compileAndAttachShaders(GrGLuint programId, |
77 SkTDArray<GrGLuint>* shaderIds) const { | 77 SkTDArray<GrGLuint>* shaderIds) const { |
78 GrGLGpu* gpu = fProgramBuilder->gpu(); | 78 GrGLGpu* gpu = fProgramBuilder->gpu(); |
79 const GrGLContext& glCtx = gpu->glContext(); | 79 const GrGLContext& glCtx = gpu->glContext(); |
80 const GrGLContextInfo& ctxInfo = gpu->ctxInfo(); | 80 const GrGLContextInfo& ctxInfo = gpu->ctxInfo(); |
81 SkString vertShaderSrc(GrGetGLSLVersionDecl(ctxInfo)); | 81 SkString vertShaderSrc(GrGetGLSLVersionDecl(ctxInfo)); |
(...skipping 18 matching lines...) Expand all Loading... |
100 for (int i = 0; i < fInputs.count(); ++i) { | 100 for (int i = 0; i < fInputs.count(); ++i) { |
101 const GrGLShaderVar& attr = fInputs[i]; | 101 const GrGLShaderVar& attr = fInputs[i]; |
102 // if attribute already added, don't add it again | 102 // if attribute already added, don't add it again |
103 if (attr.getName().equals(var.getName())) { | 103 if (attr.getName().equals(var.getName())) { |
104 return false; | 104 return false; |
105 } | 105 } |
106 } | 106 } |
107 fInputs.push_back(var); | 107 fInputs.push_back(var); |
108 return true; | 108 return true; |
109 } | 109 } |
OLD | NEW |