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

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

Issue 674543004: OptState owns program descriptor (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: cleaup 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
« no previous file with comments | « src/gpu/gl/builders/GrGLShaderBuilder.h ('k') | tests/GLProgramsTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 "rtAdjustment", 86 "rtAdjustment",
87 &rtAdjustName); 87 &rtAdjustName);
88 88
89 // Transform from Skia's device coords to GL's normalized device coords. 89 // Transform from Skia's device coords to GL's normalized device coords.
90 this->codeAppendf("gl_Position = vec4(dot(pos3.xz, %s.xy), dot(pos3.yz, %s.z w), 0, pos3.z);", 90 this->codeAppendf("gl_Position = vec4(dot(pos3.xz, %s.xy), dot(pos3.yz, %s.z w), 0, pos3.z);",
91 rtAdjustName, rtAdjustName); 91 rtAdjustName, rtAdjustName);
92 } 92 }
93 93
94 void GrGLVertexBuilder::bindVertexAttributes(GrGLuint programID) { 94 void GrGLVertexBuilder::bindVertexAttributes(GrGLuint programID) {
95 // Bind the attrib locations to same values for all shaders 95 // Bind the attrib locations to same values for all shaders
96 const GrGLProgramDesc::KeyHeader& header = fProgramBuilder->header(); 96 const GrProgramDesc::KeyHeader& header = fProgramBuilder->header();
97 SkASSERT(-1 != header.fPositionAttributeIndex); 97 SkASSERT(-1 != header.fPositionAttributeIndex);
98 GL_CALL(BindAttribLocation(programID, 98 GL_CALL(BindAttribLocation(programID,
99 header.fPositionAttributeIndex, 99 header.fPositionAttributeIndex,
100 fPositionVar->c_str())); 100 fPositionVar->c_str()));
101 if (-1 != header.fLocalCoordAttributeIndex) { 101 if (-1 != header.fLocalCoordAttributeIndex) {
102 GL_CALL(BindAttribLocation(programID, 102 GL_CALL(BindAttribLocation(programID,
103 header.fLocalCoordAttributeIndex, 103 header.fLocalCoordAttributeIndex,
104 fLocalCoordsVar->c_str())); 104 fLocalCoordsVar->c_str()));
105 } 105 }
106 if (-1 != header.fColorAttributeIndex) { 106 if (-1 != header.fColorAttributeIndex) {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 for (int i = 0; i < fInputs.count(); ++i) { 164 for (int i = 0; i < fInputs.count(); ++i) {
165 const GrGLShaderVar& attr = fInputs[i]; 165 const GrGLShaderVar& attr = fInputs[i];
166 // if attribute already added, don't add it again 166 // if attribute already added, don't add it again
167 if (attr.getName().equals(var.getName())) { 167 if (attr.getName().equals(var.getName())) {
168 return false; 168 return false;
169 } 169 }
170 } 170 }
171 fInputs.push_back(var); 171 fInputs.push_back(var);
172 return true; 172 return true;
173 } 173 }
OLDNEW
« no previous file with comments | « src/gpu/gl/builders/GrGLShaderBuilder.h ('k') | tests/GLProgramsTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698