| 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 "gl/builders/GrGLProgramBuilder.h" |
| 8 #include "GrGLProgramEffects.h" | 9 #include "GrGLProgramEffects.h" |
| 9 #include "GrDrawEffect.h" | 10 #include "GrDrawEffect.h" |
| 10 #include "gl/GrGLEffect.h" | 11 #include "gl/GrGLEffect.h" |
| 11 #include "gl/GrGLShaderBuilder.h" | |
| 12 #include "gl/GrGLVertexEffect.h" | 12 #include "gl/GrGLVertexEffect.h" |
| 13 #include "gl/GrGpuGL.h" | 13 #include "gl/GrGpuGL.h" |
| 14 | 14 |
| 15 typedef GrGLProgramEffects::TransformedCoords TransformedCoords; | 15 typedef GrGLProgramEffects::TransformedCoords TransformedCoords; |
| 16 typedef GrGLProgramEffects::TransformedCoordsArray TransformedCoordsArray; | 16 typedef GrGLProgramEffects::TransformedCoordsArray TransformedCoordsArray; |
| 17 typedef GrGLProgramEffects::TextureSampler TextureSampler; | 17 typedef GrGLProgramEffects::TextureSampler TextureSampler; |
| 18 typedef GrGLProgramEffects::TextureSamplerArray TextureSamplerArray; | 18 typedef GrGLProgramEffects::TextureSamplerArray TextureSamplerArray; |
| 19 | 19 |
| 20 /** | 20 /** |
| 21 * We specialize the vertex code for each of these matrix types. | 21 * We specialize the vertex code for each of these matrix types. |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 return key; | 197 return key; |
| 198 } | 198 } |
| 199 | 199 |
| 200 GrGLProgramEffects::~GrGLProgramEffects() { | 200 GrGLProgramEffects::~GrGLProgramEffects() { |
| 201 int numEffects = fGLEffects.count(); | 201 int numEffects = fGLEffects.count(); |
| 202 for (int e = 0; e < numEffects; ++e) { | 202 for (int e = 0; e < numEffects; ++e) { |
| 203 SkDELETE(fGLEffects[e]); | 203 SkDELETE(fGLEffects[e]); |
| 204 } | 204 } |
| 205 } | 205 } |
| 206 | 206 |
| 207 void GrGLProgramEffects::emitSamplers(GrGLShaderBuilder* builder, | 207 void GrGLProgramEffects::emitSamplers(GrGLProgramBuilder* builder, |
| 208 const GrEffect* effect, | 208 const GrEffect* effect, |
| 209 TextureSamplerArray* outSamplers) { | 209 TextureSamplerArray* outSamplers) { |
| 210 SkTArray<Sampler, true>& samplers = fSamplers.push_back(); | 210 SkTArray<Sampler, true>& samplers = fSamplers.push_back(); |
| 211 int numTextures = effect->numTextures(); | 211 int numTextures = effect->numTextures(); |
| 212 samplers.push_back_n(numTextures); | 212 samplers.push_back_n(numTextures); |
| 213 SkString name; | 213 SkString name; |
| 214 for (int t = 0; t < numTextures; ++t) { | 214 for (int t = 0; t < numTextures; ++t) { |
| 215 name.printf("Sampler%d", t); | 215 name.printf("Sampler%d", t); |
| 216 samplers[t].fUniform = builder->addUniform(GrGLShaderBuilder::kFragment_
Visibility, | 216 samplers[t].fUniform = builder->addUniform(GrGLProgramBuilder::kFragment
_Visibility, |
| 217 kSampler2D_GrSLType, | 217 kSampler2D_GrSLType, |
| 218 name.c_str()); | 218 name.c_str()); |
| 219 SkNEW_APPEND_TO_TARRAY(outSamplers, TextureSampler, | 219 SkNEW_APPEND_TO_TARRAY(outSamplers, TextureSampler, |
| 220 (samplers[t].fUniform, effect->textureAccess(t)))
; | 220 (samplers[t].fUniform, effect->textureAccess(t)))
; |
| 221 } | 221 } |
| 222 } | 222 } |
| 223 | 223 |
| 224 void GrGLProgramEffects::initSamplers(const GrGLProgramDataManager& programResou
rceManager, int* texUnitIdx) { | 224 void GrGLProgramEffects::initSamplers(const GrGLProgramDataManager& programResou
rceManager, int* texUnitIdx) { |
| 225 int numEffects = fGLEffects.count(); | 225 int numEffects = fGLEffects.count(); |
| 226 SkASSERT(numEffects == fSamplers.count()); | 226 SkASSERT(numEffects == fSamplers.count()); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 243 SkASSERT(samplers[s].fTextureUnit >= 0); | 243 SkASSERT(samplers[s].fTextureUnit >= 0); |
| 244 const GrTextureAccess& textureAccess = effect->textureAccess(s); | 244 const GrTextureAccess& textureAccess = effect->textureAccess(s); |
| 245 gpu->bindTexture(samplers[s].fTextureUnit, | 245 gpu->bindTexture(samplers[s].fTextureUnit, |
| 246 textureAccess.getParams(), | 246 textureAccess.getParams(), |
| 247 static_cast<GrGLTexture*>(textureAccess.getTexture())); | 247 static_cast<GrGLTexture*>(textureAccess.getTexture())); |
| 248 } | 248 } |
| 249 } | 249 } |
| 250 | 250 |
| 251 //////////////////////////////////////////////////////////////////////////////// | 251 //////////////////////////////////////////////////////////////////////////////// |
| 252 | 252 |
| 253 void GrGLVertexProgramEffects::emitEffect(GrGLFullShaderBuilder* builder, | 253 void GrGLVertexProgramEffects::emitEffect(GrGLFullProgramBuilder* builder, |
| 254 const GrEffectStage& stage, | 254 const GrEffectStage& stage, |
| 255 const GrEffectKey& key, | 255 const GrEffectKey& key, |
| 256 const char* outColor, | 256 const char* outColor, |
| 257 const char* inColor, | 257 const char* inColor, |
| 258 int stageIndex) { | 258 int stageIndex) { |
| 259 GrDrawEffect drawEffect(stage, fHasExplicitLocalCoords); | 259 GrDrawEffect drawEffect(stage, fHasExplicitLocalCoords); |
| 260 const GrEffect* effect = stage.getEffect(); | 260 const GrEffect* effect = stage.getEffect(); |
| 261 SkSTArray<2, TransformedCoords> coords(effect->numTransforms()); | 261 SkSTArray<2, TransformedCoords> coords(effect->numTransforms()); |
| 262 SkSTArray<4, TextureSampler> samplers(effect->numTextures()); | 262 SkSTArray<4, TextureSampler> samplers(effect->numTextures()); |
| 263 | 263 |
| 264 this->emitAttributes(builder, stage); | 264 GrGLVertexShaderBuilder* vsBuilder = builder->getVertexShaderBuilder(); |
| 265 GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder(); |
| 266 vsBuilder->emitAttributes(stage); |
| 265 this->emitTransforms(builder, drawEffect, &coords); | 267 this->emitTransforms(builder, drawEffect, &coords); |
| 266 this->emitSamplers(builder, effect, &samplers); | 268 this->emitSamplers(builder, effect, &samplers); |
| 267 | 269 |
| 268 GrGLEffect* glEffect = effect->getFactory().createGLInstance(drawEffect); | 270 GrGLEffect* glEffect = effect->getFactory().createGLInstance(drawEffect); |
| 269 fGLEffects.push_back(glEffect); | 271 fGLEffects.push_back(glEffect); |
| 270 | 272 |
| 271 // Enclose custom code in a block to avoid namespace conflicts | 273 // Enclose custom code in a block to avoid namespace conflicts |
| 272 SkString openBrace; | 274 SkString openBrace; |
| 273 openBrace.printf("\t{ // Stage %d: %s\n", stageIndex, glEffect->name()); | 275 openBrace.printf("\t{ // Stage %d: %s\n", stageIndex, glEffect->name()); |
| 274 builder->vsCodeAppend(openBrace.c_str()); | 276 fsBuilder->codeAppend(openBrace.c_str()); |
| 275 builder->fsCodeAppend(openBrace.c_str()); | 277 vsBuilder->codeAppend(openBrace.c_str()); |
| 276 | 278 |
| 277 if (glEffect->isVertexEffect()) { | 279 if (glEffect->isVertexEffect()) { |
| 278 GrGLVertexEffect* vertexEffect = static_cast<GrGLVertexEffect*>(glEffect
); | 280 GrGLVertexEffect* vertexEffect = static_cast<GrGLVertexEffect*>(glEffect
); |
| 279 vertexEffect->emitCode(builder, drawEffect, key, outColor, inColor, coor
ds, samplers); | 281 vertexEffect->emitCode(builder, drawEffect, key, outColor, inColor, coor
ds, samplers); |
| 280 } else { | 282 } else { |
| 281 glEffect->emitCode(builder, drawEffect, key, outColor, inColor, coords,
samplers); | 283 glEffect->emitCode(builder, drawEffect, key, outColor, inColor, coords,
samplers); |
| 282 } | 284 } |
| 283 | 285 |
| 284 builder->vsCodeAppend("\t}\n"); | 286 vsBuilder->codeAppend("\t}\n"); |
| 285 builder->fsCodeAppend("\t}\n"); | 287 fsBuilder->codeAppend("\t}\n"); |
| 286 } | 288 } |
| 287 | 289 |
| 288 void GrGLVertexProgramEffects::emitAttributes(GrGLFullShaderBuilder* builder, | 290 void GrGLVertexProgramEffects::emitTransforms(GrGLFullProgramBuilder* builder, |
| 289 const GrEffectStage& stage) { | |
| 290 int numAttributes = stage.getVertexAttribIndexCount(); | |
| 291 const int* attributeIndices = stage.getVertexAttribIndices(); | |
| 292 for (int a = 0; a < numAttributes; ++a) { | |
| 293 // TODO: Make addAttribute mangle the name. | |
| 294 SkString attributeName("aAttr"); | |
| 295 attributeName.appendS32(attributeIndices[a]); | |
| 296 builder->addEffectAttribute(attributeIndices[a], | |
| 297 stage.getEffect()->vertexAttribType(a), | |
| 298 attributeName); | |
| 299 } | |
| 300 } | |
| 301 | |
| 302 void GrGLVertexProgramEffects::emitTransforms(GrGLFullShaderBuilder* builder, | |
| 303 const GrDrawEffect& drawEffect, | 291 const GrDrawEffect& drawEffect, |
| 304 TransformedCoordsArray* outCoords)
{ | 292 TransformedCoordsArray* outCoords)
{ |
| 305 SkTArray<Transform, true>& transforms = fTransforms.push_back(); | 293 SkTArray<Transform, true>& transforms = fTransforms.push_back(); |
| 306 uint32_t totalKey = GenTransformKey(drawEffect); | 294 uint32_t totalKey = GenTransformKey(drawEffect); |
| 307 int numTransforms = drawEffect.effect()->numTransforms(); | 295 int numTransforms = drawEffect.effect()->numTransforms(); |
| 308 transforms.push_back_n(numTransforms); | 296 transforms.push_back_n(numTransforms); |
| 309 for (int t = 0; t < numTransforms; t++) { | 297 for (int t = 0; t < numTransforms; t++) { |
| 310 GrSLType varyingType = kVoid_GrSLType; | 298 GrSLType varyingType = kVoid_GrSLType; |
| 311 const char* uniName; | 299 const char* uniName; |
| 312 switch (get_matrix_type(totalKey, t)) { | 300 switch (get_matrix_type(totalKey, t)) { |
| 313 case kNoPersp_MatrixType: | 301 case kNoPersp_MatrixType: |
| 314 uniName = "StageMatrix"; | 302 uniName = "StageMatrix"; |
| 315 varyingType = kVec2f_GrSLType; | 303 varyingType = kVec2f_GrSLType; |
| 316 break; | 304 break; |
| 317 case kGeneral_MatrixType: | 305 case kGeneral_MatrixType: |
| 318 uniName = "StageMatrix"; | 306 uniName = "StageMatrix"; |
| 319 varyingType = kVec3f_GrSLType; | 307 varyingType = kVec3f_GrSLType; |
| 320 break; | 308 break; |
| 321 default: | 309 default: |
| 322 SkFAIL("Unexpected key."); | 310 SkFAIL("Unexpected key."); |
| 323 } | 311 } |
| 324 SkString suffixedUniName; | 312 SkString suffixedUniName; |
| 325 if (0 != t) { | 313 if (0 != t) { |
| 326 suffixedUniName.append(uniName); | 314 suffixedUniName.append(uniName); |
| 327 suffixedUniName.appendf("_%i", t); | 315 suffixedUniName.appendf("_%i", t); |
| 328 uniName = suffixedUniName.c_str(); | 316 uniName = suffixedUniName.c_str(); |
| 329 } | 317 } |
| 330 transforms[t].fHandle = builder->addUniform(GrGLShaderBuilder::kVertex_V
isibility, | 318 transforms[t].fHandle = builder->addUniform(GrGLProgramBuilder::kVertex_
Visibility, |
| 331 kMat33f_GrSLType, | 319 kMat33f_GrSLType, |
| 332 uniName, | 320 uniName, |
| 333 &uniName); | 321 &uniName); |
| 334 | 322 |
| 335 const char* varyingName = "MatrixCoord"; | 323 const char* varyingName = "MatrixCoord"; |
| 336 SkString suffixedVaryingName; | 324 SkString suffixedVaryingName; |
| 337 if (0 != t) { | 325 if (0 != t) { |
| 338 suffixedVaryingName.append(varyingName); | 326 suffixedVaryingName.append(varyingName); |
| 339 suffixedVaryingName.appendf("_%i", t); | 327 suffixedVaryingName.appendf("_%i", t); |
| 340 varyingName = suffixedVaryingName.c_str(); | 328 varyingName = suffixedVaryingName.c_str(); |
| 341 } | 329 } |
| 342 const char* vsVaryingName; | 330 const char* vsVaryingName; |
| 343 const char* fsVaryingName; | 331 const char* fsVaryingName; |
| 332 GrGLVertexShaderBuilder* vsBuilder = builder->getVertexShaderBuilder(); |
| 344 builder->addVarying(varyingType, varyingName, &vsVaryingName, &fsVarying
Name); | 333 builder->addVarying(varyingType, varyingName, &vsVaryingName, &fsVarying
Name); |
| 345 | 334 |
| 346 const GrGLShaderVar& coords = kPosition_GrCoordSet == get_source_coords(
totalKey, t) ? | 335 const GrGLShaderVar& coords = kPosition_GrCoordSet == get_source_coords(
totalKey, t) ? |
| 347 builder->positionAttribute() : | 336 vsBuilder->positionAttribute() : |
| 348 builder->localCoordsAttribute(); | 337 vsBuilder->localCoordsAttribute(); |
| 349 // varying = matrix * coords (logically) | 338 // varying = matrix * coords (logically) |
| 350 SkASSERT(kVec2f_GrSLType == varyingType || kVec3f_GrSLType == varyingTyp
e); | 339 SkASSERT(kVec2f_GrSLType == varyingType || kVec3f_GrSLType == varyingTyp
e); |
| 351 if (kVec2f_GrSLType == varyingType) { | 340 if (kVec2f_GrSLType == varyingType) { |
| 352 builder->vsCodeAppendf("\t%s = (%s * vec3(%s, 1)).xy;\n", | 341 vsBuilder->codeAppendf("\t%s = (%s * vec3(%s, 1)).xy;\n", |
| 353 vsVaryingName, uniName, coords.c_str()); | 342 vsVaryingName, uniName, coords.c_str()); |
| 354 } else { | 343 } else { |
| 355 builder->vsCodeAppendf("\t%s = %s * vec3(%s, 1);\n", | 344 vsBuilder->codeAppendf("\t%s = %s * vec3(%s, 1);\n", |
| 356 vsVaryingName, uniName, coords.c_str()); | 345 vsVaryingName, uniName, coords.c_str()); |
| 357 } | 346 } |
| 358 SkNEW_APPEND_TO_TARRAY(outCoords, TransformedCoords, | 347 SkNEW_APPEND_TO_TARRAY(outCoords, TransformedCoords, |
| 359 (SkString(fsVaryingName), varyingType)); | 348 (SkString(fsVaryingName), varyingType)); |
| 360 } | 349 } |
| 361 } | 350 } |
| 362 | 351 |
| 363 void GrGLVertexProgramEffects::setData(GrGpuGL* gpu, | 352 void GrGLVertexProgramEffects::setData(GrGpuGL* gpu, |
| 364 const GrGLProgramDataManager& programReso
urceManager, | 353 const GrGLProgramDataManager& programReso
urceManager, |
| 365 const GrEffectStage* effectStages[]) { | 354 const GrEffectStage* effectStages[]) { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 383 for (int t = 0; t < numTransforms; ++t) { | 372 for (int t = 0; t < numTransforms; ++t) { |
| 384 SkASSERT(transforms[t].fHandle.isValid()); | 373 SkASSERT(transforms[t].fHandle.isValid()); |
| 385 const SkMatrix& matrix = get_transform_matrix(drawEffect, t); | 374 const SkMatrix& matrix = get_transform_matrix(drawEffect, t); |
| 386 if (!transforms[t].fCurrentValue.cheapEqualTo(matrix)) { | 375 if (!transforms[t].fCurrentValue.cheapEqualTo(matrix)) { |
| 387 programResourceManager.setSkMatrix(transforms[t].fHandle, matrix); | 376 programResourceManager.setSkMatrix(transforms[t].fHandle, matrix); |
| 388 transforms[t].fCurrentValue = matrix; | 377 transforms[t].fCurrentValue = matrix; |
| 389 } | 378 } |
| 390 } | 379 } |
| 391 } | 380 } |
| 392 | 381 |
| 393 GrGLVertexProgramEffectsBuilder::GrGLVertexProgramEffectsBuilder(GrGLFullShaderB
uilder* builder, | 382 GrGLVertexProgramEffectsBuilder::GrGLVertexProgramEffectsBuilder(GrGLFullProgram
Builder* builder, |
| 394 int reserveCoun
t) | 383 int reserveCoun
t) |
| 395 : fBuilder(builder) | 384 : fBuilder(builder) |
| 396 , fProgramEffects(SkNEW_ARGS(GrGLVertexProgramEffects, | 385 , fProgramEffects(SkNEW_ARGS(GrGLVertexProgramEffects, |
| 397 (reserveCount, fBuilder->hasExplicitLocalCoords
()))) { | 386 (reserveCount, |
| 387 fBuilder->getVertexShaderBuilder()->hasExplici
tLocalCoords()))) { |
| 398 } | 388 } |
| 399 | |
| 400 void GrGLVertexProgramEffectsBuilder::emitEffect(const GrEffectStage& stage, | 389 void GrGLVertexProgramEffectsBuilder::emitEffect(const GrEffectStage& stage, |
| 401 const GrEffectKey& key, | 390 const GrEffectKey& key, |
| 402 const char* outColor, | 391 const char* outColor, |
| 403 const char* inColor, | 392 const char* inColor, |
| 404 int stageIndex) { | 393 int stageIndex) { |
| 405 SkASSERT(NULL != fProgramEffects.get()); | 394 SkASSERT(NULL != fProgramEffects.get()); |
| 406 fProgramEffects->emitEffect(fBuilder, stage, key, outColor, inColor, stageIn
dex); | 395 fProgramEffects->emitEffect(fBuilder, stage, key, outColor, inColor, stageIn
dex); |
| 407 } | 396 } |
| 408 | 397 |
| 409 //////////////////////////////////////////////////////////////////////////////// | 398 //////////////////////////////////////////////////////////////////////////////// |
| 410 | 399 |
| 411 void GrGLPathTexGenProgramEffects::emitEffect(GrGLFragmentOnlyShaderBuilder* bui
lder, | 400 void GrGLPathTexGenProgramEffects::emitEffect(GrGLFragmentOnlyProgramBuilder* bu
ilder, |
| 412 const GrEffectStage& stage, | 401 const GrEffectStage& stage, |
| 413 const GrEffectKey& key, | 402 const GrEffectKey& key, |
| 414 const char* outColor, | 403 const char* outColor, |
| 415 const char* inColor, | 404 const char* inColor, |
| 416 int stageIndex) { | 405 int stageIndex) { |
| 417 GrDrawEffect drawEffect(stage, false); | 406 GrDrawEffect drawEffect(stage, false); |
| 418 const GrEffect* effect = stage.getEffect(); | 407 const GrEffect* effect = stage.getEffect(); |
| 419 SkSTArray<2, TransformedCoords> coords(effect->numTransforms()); | 408 SkSTArray<2, TransformedCoords> coords(effect->numTransforms()); |
| 420 SkSTArray<4, TextureSampler> samplers(effect->numTextures()); | 409 SkSTArray<4, TextureSampler> samplers(effect->numTextures()); |
| 421 | 410 |
| 422 SkASSERT(0 == stage.getVertexAttribIndexCount()); | 411 SkASSERT(0 == stage.getVertexAttribIndexCount()); |
| 423 this->setupPathTexGen(builder, drawEffect, &coords); | 412 this->setupPathTexGen(builder, drawEffect, &coords); |
| 424 this->emitSamplers(builder, effect, &samplers); | 413 this->emitSamplers(builder, effect, &samplers); |
| 425 | 414 |
| 426 GrGLEffect* glEffect = effect->getFactory().createGLInstance(drawEffect); | 415 GrGLEffect* glEffect = effect->getFactory().createGLInstance(drawEffect); |
| 427 fGLEffects.push_back(glEffect); | 416 fGLEffects.push_back(glEffect); |
| 428 | 417 |
| 418 GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder(); |
| 429 // Enclose custom code in a block to avoid namespace conflicts | 419 // Enclose custom code in a block to avoid namespace conflicts |
| 430 SkString openBrace; | 420 SkString openBrace; |
| 431 openBrace.printf("\t{ // Stage %d: %s\n", stageIndex, glEffect->name()); | 421 openBrace.printf("\t{ // Stage %d: %s\n", stageIndex, glEffect->name()); |
| 432 builder->fsCodeAppend(openBrace.c_str()); | 422 fsBuilder->codeAppend(openBrace.c_str()); |
| 433 | 423 |
| 434 SkASSERT(!glEffect->isVertexEffect()); | 424 SkASSERT(!glEffect->isVertexEffect()); |
| 435 glEffect->emitCode(builder, drawEffect, key, outColor, inColor, coords, samp
lers); | 425 glEffect->emitCode(builder, drawEffect, key, outColor, inColor, coords, samp
lers); |
| 436 | 426 |
| 437 builder->fsCodeAppend("\t}\n"); | 427 fsBuilder->codeAppend("\t}\n"); |
| 438 } | 428 } |
| 439 | 429 |
| 440 void GrGLPathTexGenProgramEffects::setupPathTexGen(GrGLFragmentOnlyShaderBuilder
* builder, | 430 void GrGLPathTexGenProgramEffects::setupPathTexGen(GrGLFragmentOnlyProgramBuilde
r* builder, |
| 441 const GrDrawEffect& drawEffect, | 431 const GrDrawEffect& drawEffect, |
| 442 TransformedCoordsArray* outCoords) { | 432 TransformedCoordsArray* outCoords) { |
| 443 int numTransforms = drawEffect.effect()->numTransforms(); | 433 int numTransforms = drawEffect.effect()->numTransforms(); |
| 444 uint32_t totalKey = GenTransformKey(drawEffect); | 434 uint32_t totalKey = GenTransformKey(drawEffect); |
| 445 int texCoordIndex = builder->addTexCoordSets(numTransforms); | 435 int texCoordIndex = builder->addTexCoordSets(numTransforms); |
| 446 SkNEW_APPEND_TO_TARRAY(&fTransforms, Transforms, (totalKey, texCoordIndex)); | 436 SkNEW_APPEND_TO_TARRAY(&fTransforms, Transforms, (totalKey, texCoordIndex)); |
| 447 SkString name; | 437 SkString name; |
| 448 for (int t = 0; t < numTransforms; ++t) { | 438 for (int t = 0; t < numTransforms; ++t) { |
| 449 GrSLType type = kGeneral_MatrixType == get_matrix_type(totalKey, t) ? | 439 GrSLType type = kGeneral_MatrixType == get_matrix_type(totalKey, t) ? |
| 450 kVec3f_GrSLType : | 440 kVec3f_GrSLType : |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 transform); | 482 transform); |
| 493 break; | 483 break; |
| 494 } | 484 } |
| 495 default: | 485 default: |
| 496 SkFAIL("Unexpected matrixs type."); | 486 SkFAIL("Unexpected matrixs type."); |
| 497 } | 487 } |
| 498 } | 488 } |
| 499 } | 489 } |
| 500 | 490 |
| 501 GrGLPathTexGenProgramEffectsBuilder::GrGLPathTexGenProgramEffectsBuilder( | 491 GrGLPathTexGenProgramEffectsBuilder::GrGLPathTexGenProgramEffectsBuilder( |
| 502 GrGLFragmentOnlyShaderBuilder* builder, | 492 GrGLFragmentOnlyProgramBuilder* builder, |
| 503 int reserveCount) | 493 int reserveCount) |
| 504 : fBuilder(builder) | 494 : fBuilder(builder) |
| 505 , fProgramEffects(SkNEW_ARGS(GrGLPathTexGenProgramEffects, (reserveCount)))
{ | 495 , fProgramEffects(SkNEW_ARGS(GrGLPathTexGenProgramEffects, (reserveCount)))
{ |
| 506 } | 496 } |
| 507 | |
| 508 void GrGLPathTexGenProgramEffectsBuilder::emitEffect(const GrEffectStage& stage, | 497 void GrGLPathTexGenProgramEffectsBuilder::emitEffect(const GrEffectStage& stage, |
| 509 const GrEffectKey& key, | 498 const GrEffectKey& key, |
| 510 const char* outColor, | 499 const char* outColor, |
| 511 const char* inColor, | 500 const char* inColor, |
| 512 int stageIndex) { | 501 int stageIndex) { |
| 513 SkASSERT(NULL != fProgramEffects.get()); | 502 SkASSERT(NULL != fProgramEffects.get()); |
| 514 fProgramEffects->emitEffect(fBuilder, stage, key, outColor, inColor, stageIn
dex); | 503 fProgramEffects->emitEffect(fBuilder, stage, key, outColor, inColor, stageIn
dex); |
| 515 } | 504 } |
| 505 |
| OLD | NEW |