OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "GrGLProgramEffects.h" | 8 #include "GrGLProgramEffects.h" |
9 #include "GrDrawEffect.h" | 9 #include "GrDrawEffect.h" |
10 #include "gl/GrGLEffect.h" | 10 #include "gl/GrGLEffect.h" |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 vsVaryingName, uniName, coords.
c_str()); | 384 vsVaryingName, uniName, coords.
c_str()); |
385 } else { | 385 } else { |
386 vertexBuilder->vsCodeAppendf("\t%s = %s * vec3(%s, 1);\n", | 386 vertexBuilder->vsCodeAppendf("\t%s = %s * vec3(%s, 1);\n", |
387 vsVaryingName, uniName, coords.
c_str()); | 387 vsVaryingName, uniName, coords.
c_str()); |
388 } | 388 } |
389 break; | 389 break; |
390 } | 390 } |
391 default: | 391 default: |
392 GrCrash("Unexpected uniform type."); | 392 GrCrash("Unexpected uniform type."); |
393 } | 393 } |
394 SkNEW_APPEND_TO_TARRAY(outCoords, TransformedCoords, | 394 SkNEW_APPEND_TO_TARRAY(outCoords, TransformedCoords, (fsVaryingName, var
yingType)); |
395 (fsVaryingName, varyingType, vsVaryingName)); | |
396 } | 395 } |
397 } | 396 } |
398 | 397 |
399 void GrGLProgramEffectsBuilder::emitSamplers(const GrEffectRef& effect, | 398 void GrGLProgramEffectsBuilder::emitSamplers(const GrEffectRef& effect, |
400 TextureSamplerArray* outSamplers) { | 399 TextureSamplerArray* outSamplers) { |
401 typedef GrGLProgramEffects::Sampler Sampler; | 400 typedef GrGLProgramEffects::Sampler Sampler; |
402 SkTArray<Sampler, true>& samplers = fProgramEffects->fSamplers.push_back(); | 401 SkTArray<Sampler, true>& samplers = fProgramEffects->fSamplers.push_back(); |
403 int numTextures = effect->numTextures(); | 402 int numTextures = effect->numTextures(); |
404 samplers.push_back_n(numTextures); | 403 samplers.push_back_n(numTextures); |
405 SkString name; | 404 SkString name; |
406 for (int t = 0; t < numTextures; ++t) { | 405 for (int t = 0; t < numTextures; ++t) { |
407 name.printf("Sampler%d", t); | 406 name.printf("Sampler%d", t); |
408 samplers[t].fUniform = fBuilder->addUniform(GrGLShaderBuilder::kFragment
_Visibility, | 407 samplers[t].fUniform = fBuilder->addUniform(GrGLShaderBuilder::kFragment
_Visibility, |
409 kSampler2D_GrSLType, | 408 kSampler2D_GrSLType, |
410 name.c_str()); | 409 name.c_str()); |
411 SkNEW_APPEND_TO_TARRAY(outSamplers, TextureSampler, | 410 SkNEW_APPEND_TO_TARRAY(outSamplers, TextureSampler, |
412 (samplers[t].fUniform, effect->textureAccess(t)))
; | 411 (samplers[t].fUniform, effect->textureAccess(t)))
; |
413 } | 412 } |
414 } | 413 } |
OLD | NEW |