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

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

Issue 815643005: Move program descriptor and primitive processor off of optstate (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: small cleanup Created 5 years, 11 months 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 #include "GrGLVertexShaderBuilder.h" 8 #include "GrGLVertexShaderBuilder.h"
9 #include "GrGLProgramBuilder.h" 9 #include "GrGLProgramBuilder.h"
10 #include "GrGLShaderStringBuilder.h" 10 #include "GrGLShaderStringBuilder.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 // Transform from Skia's device coords to GL's normalized device coords. 47 // Transform from Skia's device coords to GL's normalized device coords.
48 this->codeAppendf("gl_Position = vec4(dot(%s.xz, %s.xy), dot(%s.yz, %s.zw), 0, %s.z);", 48 this->codeAppendf("gl_Position = vec4(dot(%s.xz, %s.xy), dot(%s.yz, %s.zw), 0, %s.z);",
49 pos3, fRtAdjustName, pos3, fRtAdjustName, pos3); 49 pos3, fRtAdjustName, pos3, fRtAdjustName, pos3);
50 50
51 // We could have the GrGeometryProcessor do this, but its just easier to hav e it performed here. 51 // We could have the GrGeometryProcessor do this, but its just easier to hav e it performed here.
52 // If we ever need to set variable pointsize, then we can reinvestigate 52 // If we ever need to set variable pointsize, then we can reinvestigate
53 this->codeAppend("gl_PointSize = 1.0;"); 53 this->codeAppend("gl_PointSize = 1.0;");
54 } 54 }
55 55
56 void GrGLVertexBuilder::bindVertexAttributes(GrGLuint programID) { 56 void GrGLVertexBuilder::bindVertexAttributes(GrGLuint programID) {
57 const GrPrimitiveProcessor* primProc = fProgramBuilder->fOptState.getPrimiti veProcessor(); 57 const GrPrimitiveProcessor& primProc = fProgramBuilder->primitiveProcessor() ;
58 58
59 int vaCount = primProc->numAttribs(); 59 int vaCount = primProc.numAttribs();
60 for (int i = 0; i < vaCount; i++) { 60 for (int i = 0; i < vaCount; i++) {
61 GL_CALL(BindAttribLocation(programID, i, primProc->getAttrib(i).fName)); 61 GL_CALL(BindAttribLocation(programID, i, primProc.getAttrib(i).fName));
62 } 62 }
63 return; 63 return;
64 } 64 }
65 65
66 bool GrGLVertexBuilder::compileAndAttachShaders(GrGLuint programId, 66 bool GrGLVertexBuilder::compileAndAttachShaders(GrGLuint programId,
67 SkTDArray<GrGLuint>* shaderIds) const { 67 SkTDArray<GrGLuint>* shaderIds) const {
68 GrGLGpu* gpu = fProgramBuilder->gpu(); 68 GrGLGpu* gpu = fProgramBuilder->gpu();
69 const GrGLContext& glCtx = gpu->glContext(); 69 const GrGLContext& glCtx = gpu->glContext();
70 const GrGLContextInfo& ctxInfo = gpu->ctxInfo(); 70 const GrGLContextInfo& ctxInfo = gpu->ctxInfo();
71 SkString vertShaderSrc(GrGetGLSLVersionDecl(ctxInfo)); 71 SkString vertShaderSrc(GrGetGLSLVersionDecl(ctxInfo));
(...skipping 18 matching lines...) Expand all
90 for (int i = 0; i < fInputs.count(); ++i) { 90 for (int i = 0; i < fInputs.count(); ++i) {
91 const GrGLShaderVar& attr = fInputs[i]; 91 const GrGLShaderVar& attr = fInputs[i];
92 // if attribute already added, don't add it again 92 // if attribute already added, don't add it again
93 if (attr.getName().equals(var.getName())) { 93 if (attr.getName().equals(var.getName())) {
94 return false; 94 return false;
95 } 95 }
96 } 96 }
97 fInputs.push_back(var); 97 fInputs.push_back(var);
98 return true; 98 return true;
99 } 99 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698