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

Side by Side Diff: src/gpu/gl/GrGLGeometryProcessor.cpp

Issue 1272703002: AARectBatch can transform coords on cpu (Closed) Base URL: https://skia.googlesource.com/skia.git@lccleanup5
Patch Set: Created 5 years, 4 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
« no previous file with comments | « src/gpu/gl/GrGLGeometryProcessor.h ('k') | src/gpu/gl/builders/GrGLProgramBuilder.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 "GrGLGeometryProcessor.h" 8 #include "GrGLGeometryProcessor.h"
9 9
10 #include "builders/GrGLProgramBuilder.h" 10 #include "builders/GrGLProgramBuilder.h"
11 11
12 void GrGLGeometryProcessor::emitCode(EmitArgs& args) { 12 void GrGLGeometryProcessor::emitCode(EmitArgs& args) {
13 GrGLVertexBuilder* vsBuilder = args.fPB->getVertexShaderBuilder(); 13 GrGLVertexBuilder* vsBuilder = args.fPB->getVertexShaderBuilder();
14 GrGPArgs gpArgs; 14 GrGPArgs gpArgs;
15 this->onEmitCode(args, &gpArgs); 15 this->onEmitCode(args, &gpArgs);
16 vsBuilder->transformToNormalizedDeviceSpace(gpArgs.fPositionVar); 16 vsBuilder->transformToNormalizedDeviceSpace(gpArgs.fPositionVar);
17 } 17 }
18 18
19 void GrGLGeometryProcessor::emitTransforms(GrGLGPBuilder* pb, 19 void GrGLGeometryProcessor::emitTransforms(GrGLGPBuilder* pb,
20 const GrShaderVar& posVar, 20 const GrShaderVar& posVar,
21 const char* localCoords, 21 const char* localCoords,
22 const SkMatrix& localMatrix, 22 const SkMatrix& localMatrix,
23 const TransformsIn& tin, 23 const TransformsIn& tin,
24 TransformsOut* tout) { 24 TransformsOut* tout) {
25 fTransformedLocalCoords = false;
25 GrGLVertexBuilder* vb = pb->getVertexShaderBuilder(); 26 GrGLVertexBuilder* vb = pb->getVertexShaderBuilder();
26 tout->push_back_n(tin.count()); 27 tout->push_back_n(tin.count());
27 fInstalledTransforms.push_back_n(tin.count()); 28 fInstalledTransforms.push_back_n(tin.count());
28 for (int i = 0; i < tin.count(); i++) { 29 for (int i = 0; i < tin.count(); i++) {
29 const ProcCoords& coordTransforms = tin[i]; 30 const ProcCoords& coordTransforms = tin[i];
30 fInstalledTransforms[i].push_back_n(coordTransforms.count()); 31 fInstalledTransforms[i].push_back_n(coordTransforms.count());
31 for (int t = 0; t < coordTransforms.count(); t++) { 32 for (int t = 0; t < coordTransforms.count(); t++) {
32 SkString strUniName("StageMatrix"); 33 SkString strUniName("StageMatrix");
33 strUniName.appendf("_%i_%i", i, t); 34 strUniName.appendf("_%i_%i", i, t);
34 GrSLType varyingType; 35 GrSLType varyingType;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 } 87 }
87 } 88 }
88 } 89 }
89 } 90 }
90 } 91 }
91 92
92 void GrGLGeometryProcessor::emitTransforms(GrGLGPBuilder* pb, 93 void GrGLGeometryProcessor::emitTransforms(GrGLGPBuilder* pb,
93 const char* localCoords, 94 const char* localCoords,
94 const TransformsIn& tin, 95 const TransformsIn& tin,
95 TransformsOut* tout) { 96 TransformsOut* tout) {
97 fTransformedLocalCoords = true;
96 GrGLVertexBuilder* vb = pb->getVertexShaderBuilder(); 98 GrGLVertexBuilder* vb = pb->getVertexShaderBuilder();
97 tout->push_back_n(tin.count()); 99 tout->push_back_n(tin.count());
98 for (int i = 0; i < tin.count(); i++) { 100 for (int i = 0; i < tin.count(); i++) {
99 const ProcCoords& coordTransforms = tin[i]; 101 const ProcCoords& coordTransforms = tin[i];
100 for (int t = 0; t < coordTransforms.count(); t++) { 102 for (int t = 0; t < coordTransforms.count(); t++) {
101 GrSLType varyingType = kVec2f_GrSLType; 103 GrSLType varyingType = kVec2f_GrSLType;
102 104
103 // Device coords aren't supported 105 // Device coords aren't supported
104 GrCoordSet coordType = coordTransforms[t]->sourceCoords(); 106 GrCoordSet coordType = coordTransforms[t]->sourceCoords();
105 SkASSERT(kDevice_GrCoordSet != coordType); 107 SkASSERT(kDevice_GrCoordSet != coordType);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 gpArgs->fPositionVar.set(kVec2f_GrSLType, "pos2"); 148 gpArgs->fPositionVar.set(kVec2f_GrSLType, "pos2");
147 vsBuilder->codeAppendf("vec2 %s = vec2(%s * vec3(%s, 1));", 149 vsBuilder->codeAppendf("vec2 %s = vec2(%s * vec3(%s, 1));",
148 gpArgs->fPositionVar.c_str(), viewMatrixName, posName); 150 gpArgs->fPositionVar.c_str(), viewMatrixName, posName);
149 } else { 151 } else {
150 gpArgs->fPositionVar.set(kVec3f_GrSLType, "pos3"); 152 gpArgs->fPositionVar.set(kVec3f_GrSLType, "pos3");
151 vsBuilder->codeAppendf("vec3 %s = %s * vec3(%s, 1);", 153 vsBuilder->codeAppendf("vec3 %s = %s * vec3(%s, 1);",
152 gpArgs->fPositionVar.c_str(), viewMatrixName, posName); 154 gpArgs->fPositionVar.c_str(), viewMatrixName, posName);
153 } 155 }
154 } 156 }
155 } 157 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLGeometryProcessor.h ('k') | src/gpu/gl/builders/GrGLProgramBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698