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 "GrGeometryProcessor.h" | 8 #include "GrGeometryProcessor.h" |
9 | 9 |
10 #include "GrCoordTransform.h" | 10 #include "GrCoordTransform.h" |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 tout->push_back_n(tin.count()); | 384 tout->push_back_n(tin.count()); |
385 fInstalledTransforms.push_back_n(tin.count()); | 385 fInstalledTransforms.push_back_n(tin.count()); |
386 for (int i = 0; i < tin.count(); i++) { | 386 for (int i = 0; i < tin.count(); i++) { |
387 const ProcCoords& coordTransforms = tin[i]; | 387 const ProcCoords& coordTransforms = tin[i]; |
388 fInstalledTransforms[i].push_back_n(coordTransforms.count()); | 388 fInstalledTransforms[i].push_back_n(coordTransforms.count()); |
389 for (int t = 0; t < coordTransforms.count(); t++) { | 389 for (int t = 0; t < coordTransforms.count(); t++) { |
390 GrSLType varyingType = | 390 GrSLType varyingType = |
391 coordTransforms[t]->getMatrix().hasPerspective() ? kVec3
f_GrSLType : | 391 coordTransforms[t]->getMatrix().hasPerspective() ? kVec3
f_GrSLType : |
392 kVec2
f_GrSLType; | 392 kVec2
f_GrSLType; |
393 | 393 |
394 const char* varyingName = "MatrixCoord"; | 394 |
395 SkString suffixedVaryingName; | 395 SkString strVaryingName("MatrixCoord"); |
396 if (0 != t) { | 396 strVaryingName.appendf("_%i_%i", i, t); |
397 suffixedVaryingName.append(varyingName); | |
398 suffixedVaryingName.appendf("_%i", t); | |
399 varyingName = suffixedVaryingName.c_str(); | |
400 } | |
401 GrGLVertToFrag v(varyingType); | 397 GrGLVertToFrag v(varyingType); |
402 pb->addVarying(varyingName, &v); | 398 pb->addVarying(strVaryingName.c_str(), &v); |
403 SeparableVaryingInfo& varyingInfo = fSeparableVaryingInfos.push_
back(); | 399 SeparableVaryingInfo& varyingInfo = fSeparableVaryingInfos.push_
back(); |
404 varyingInfo.fVariable = pb->getFragmentShaderBuilder()->fInputs.
back(); | 400 varyingInfo.fVariable = pb->getFragmentShaderBuilder()->fInputs.
back(); |
405 varyingInfo.fLocation = fSeparableVaryingInfos.count() - 1; | 401 varyingInfo.fLocation = fSeparableVaryingInfos.count() - 1; |
406 varyingInfo.fType = varyingType; | 402 varyingInfo.fType = varyingType; |
407 fInstalledTransforms[i][t].fHandle = ShaderVarHandle(varyingInfo
.fLocation); | 403 fInstalledTransforms[i][t].fHandle = ShaderVarHandle(varyingInfo
.fLocation); |
408 fInstalledTransforms[i][t].fType = varyingType; | 404 fInstalledTransforms[i][t].fType = varyingType; |
409 | 405 |
410 SkNEW_APPEND_TO_TARRAY(&(*tout)[i], GrGLProcessor::TransformedCo
ords, | 406 SkNEW_APPEND_TO_TARRAY(&(*tout)[i], GrGLProcessor::TransformedCo
ords, |
411 (SkString(v.fsIn()), varyingType)); | 407 (SkString(v.fsIn()), varyingType)); |
412 } | 408 } |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 const GrGLCaps& caps)
const { | 527 const GrGLCaps& caps)
const { |
532 SkASSERT(caps.nvprSupport() != GrGLCaps::kNone_NvprSupport); | 528 SkASSERT(caps.nvprSupport() != GrGLCaps::kNone_NvprSupport); |
533 if (caps.nvprSupport() == GrGLCaps::kLegacy_NvprSupport) { | 529 if (caps.nvprSupport() == GrGLCaps::kLegacy_NvprSupport) { |
534 return SkNEW_ARGS(GrGLLegacyPathProcessor, (*this, bt, | 530 return SkNEW_ARGS(GrGLLegacyPathProcessor, (*this, bt, |
535 caps.maxFixedFunctionTexture
Coords())); | 531 caps.maxFixedFunctionTexture
Coords())); |
536 } else { | 532 } else { |
537 return SkNEW_ARGS(GrGLNormalPathProcessor, (*this, bt)); | 533 return SkNEW_ARGS(GrGLNormalPathProcessor, (*this, bt)); |
538 } | 534 } |
539 } | 535 } |
540 | 536 |
OLD | NEW |