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 "GrGLProgramBuilder.h" | 8 #include "GrGLProgramBuilder.h" |
9 #include "gl/GrGLProgram.h" | 9 #include "gl/GrGLProgram.h" |
10 #include "gl/GrGLSLPrettyPrint.h" | 10 #include "gl/GrGLSLPrettyPrint.h" |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 &uniName).toShaderBuilder
Index(); | 394 &uniName).toShaderBuilder
Index(); |
395 | 395 |
396 const char* varyingName = "MatrixCoord"; | 396 const char* varyingName = "MatrixCoord"; |
397 SkString suffixedVaryingName; | 397 SkString suffixedVaryingName; |
398 if (0 != t) { | 398 if (0 != t) { |
399 suffixedVaryingName.append(varyingName); | 399 suffixedVaryingName.append(varyingName); |
400 suffixedVaryingName.appendf("_%i", t); | 400 suffixedVaryingName.appendf("_%i", t); |
401 varyingName = suffixedVaryingName.c_str(); | 401 varyingName = suffixedVaryingName.c_str(); |
402 } | 402 } |
403 | 403 |
404 bool useLocalCoords = kLocal_GrCoordSet == processor->coordTransform(t).
sourceCoords(); | 404 GrCoordSet coordType = processor->coordTransform(t).sourceCoords(); |
405 const char* coords = useLocalCoords ? fVS.localCoords() : fVS.positionCo
ords(); | |
406 | |
407 GrGLVertToFrag v(varyingType); | 405 GrGLVertToFrag v(varyingType); |
408 this->addVarying(varyingName, &v, precision); | 406 this->addVarying(varyingName, &v, precision); |
409 fCoordVaryings.push_back(TransformVarying(v, uniName, coords)); | 407 fCoordVaryings.push_back(TransformVarying(v, uniName, coordType)); |
410 | 408 |
411 SkASSERT(kVec2f_GrSLType == varyingType || kVec3f_GrSLType == varyingTyp
e); | 409 SkASSERT(kVec2f_GrSLType == varyingType || kVec3f_GrSLType == varyingTyp
e); |
412 SkNEW_APPEND_TO_TARRAY(outCoords, GrGLProcessor::TransformedCoords, | 410 SkNEW_APPEND_TO_TARRAY(outCoords, GrGLProcessor::TransformedCoords, |
413 (SkString(v.fsIn()), varyingType)); | 411 (SkString(v.fsIn()), varyingType)); |
414 } | 412 } |
415 } | 413 } |
416 | 414 |
417 void GrGLProgramBuilder::emitSamplers(const GrProcessor& processor, | 415 void GrGLProgramBuilder::emitSamplers(const GrProcessor& processor, |
418 GrGLProcessor::TextureSamplerArray* outSam
plers, | 416 GrGLProcessor::TextureSamplerArray* outSam
plers, |
419 GrGLInstalledProc* ip) { | 417 GrGLInstalledProc* ip) { |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 } | 538 } |
541 | 539 |
542 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 540 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
543 | 541 |
544 GrGLInstalledFragProcs::~GrGLInstalledFragProcs() { | 542 GrGLInstalledFragProcs::~GrGLInstalledFragProcs() { |
545 int numProcs = fProcs.count(); | 543 int numProcs = fProcs.count(); |
546 for (int e = 0; e < numProcs; ++e) { | 544 for (int e = 0; e < numProcs; ++e) { |
547 SkDELETE(fProcs[e]); | 545 SkDELETE(fProcs[e]); |
548 } | 546 } |
549 } | 547 } |
OLD | NEW |