OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 "SkCanvas.h" | 8 #include "SkCanvas.h" |
9 #include "SkReadBuffer.h" | 9 #include "SkReadBuffer.h" |
10 #include "SkShadowShader.h" | 10 #include "SkShadowShader.h" |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
125 if (SkLights::Light::kPoint_LightType == lights->light(i).type() ) { | 125 if (SkLights::Light::kPoint_LightType == lights->light(i).type() ) { |
126 fLightDirOrPos[fNumNonAmbLights] = lights->light(i).pos(); | 126 fLightDirOrPos[fNumNonAmbLights] = lights->light(i).pos(); |
127 fLightColor[fNumNonAmbLights].scale(lights->light(i).intensi ty()); | 127 fLightColor[fNumNonAmbLights].scale(lights->light(i).intensi ty()); |
128 } else { | 128 } else { |
129 fLightDirOrPos[fNumNonAmbLights] = lights->light(i).dir(); | 129 fLightDirOrPos[fNumNonAmbLights] = lights->light(i).dir(); |
130 } | 130 } |
131 | 131 |
132 fIsPointLight[fNumNonAmbLights] = | 132 fIsPointLight[fNumNonAmbLights] = |
133 SkLights::Light::kPoint_LightType == lights->light(i).ty pe(); | 133 SkLights::Light::kPoint_LightType == lights->light(i).ty pe(); |
134 | 134 |
135 fIsRadialLight[fNumNonAmbLights] = lights->light(i).isRadial(); | |
136 | |
135 SkImage_Base* shadowMap = ((SkImage_Base*)lights->light(i).getSh adowMap()); | 137 SkImage_Base* shadowMap = ((SkImage_Base*)lights->light(i).getSh adowMap()); |
136 | 138 |
137 // gets deleted when the ShadowFP is destroyed, and frees the Gr Texture* | 139 // gets deleted when the ShadowFP is destroyed, and frees the Gr Texture* |
138 fTexture[fNumNonAmbLights] = sk_sp<GrTexture>(shadowMap->asTextu reRef(context, | 140 fTexture[fNumNonAmbLights] = sk_sp<GrTexture>(shadowMap->asTextu reRef(context, |
139 GrTextureParams::Clam pNoFilter(), | 141 GrTextureParams::Clam pNoFilter(), |
140 SkSourceGammaTreatmen t::kIgnore)); | 142 SkSourceGammaTreatmen t::kIgnore)); |
141 fDepthMapAccess[fNumNonAmbLights].reset(fTexture[fNumNonAmbLight s].get()); | 143 fDepthMapAccess[fNumNonAmbLights].reset(fTexture[fNumNonAmbLight s].get()); |
142 this->addTextureAccess(&fDepthMapAccess[fNumNonAmbLights]); | 144 this->addTextureAccess(&fDepthMapAccess[fNumNonAmbLights]); |
143 | 145 |
144 fDepthMapHeight[fNumNonAmbLights] = shadowMap->height(); | 146 fDepthMapHeight[fNumNonAmbLights] = shadowMap->height(); |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
274 // Note: vMatrixCoord_0_1_Stage0 is the texture sampler coordinates. | 276 // Note: vMatrixCoord_0_1_Stage0 is the texture sampler coordinates. |
275 fragBuilder->codeAppendf("worldCor = vec3(vMatrixCoord_0_1_Stage0 * " | 277 fragBuilder->codeAppendf("worldCor = vec3(vMatrixCoord_0_1_Stage0 * " |
276 "vec2(%s, %s), %s.b * 255);", | 278 "vec2(%s, %s), %s.b * 255);", |
277 widthUniName, heightUniName, povDepth.c_str ()); | 279 widthUniName, heightUniName, povDepth.c_str ()); |
278 | 280 |
279 // Applies the offset indexing that goes from our view space into th e light's space. | 281 // Applies the offset indexing that goes from our view space into th e light's space. |
280 for (int i = 0; i < shadowFP.fNumNonAmbLights; i++) { | 282 for (int i = 0; i < shadowFP.fNumNonAmbLights; i++) { |
281 SkString povCoord("povCoord"); | 283 SkString povCoord("povCoord"); |
282 povCoord.appendf("%d", i); | 284 povCoord.appendf("%d", i); |
283 | 285 |
284 // povDepth.b * 255 scales it to 0 - 255, bringing it to world s pace, | |
285 // and the / vec2(width, height) brings it back to a sampler coo rdinate | |
286 SkString offset("offset"); | 286 SkString offset("offset"); |
287 offset.appendf("%d", i); | 287 offset.appendf("%d", i); |
288 | |
289 SkString scaleVec("scaleVec"); | |
290 scaleVec.appendf("%d", i); | |
291 | |
292 fragBuilder->codeAppendf("vec2 %s;", offset.c_str()); | 288 fragBuilder->codeAppendf("vec2 %s;", offset.c_str()); |
293 | 289 |
294 // note that we flip the y-coord of the offset and then later ad d | |
295 // a value just to the y-coord of povCoord. This is to account f or | |
296 // the shifted origins from switching from raster into GPU. | |
297 if (shadowFP.fIsPointLight[i]) { | 290 if (shadowFP.fIsPointLight[i]) { |
298 fragBuilder->codeAppendf("vec3 fragToLight%d = %s - worldCor ;", | 291 fragBuilder->codeAppendf("vec3 fragToLight%d = %s - worldCor ;", |
299 i, lightDirOrPosUniName[i]); | 292 i, lightDirOrPosUniName[i]); |
300 fragBuilder->codeAppendf("float distsq%d = dot(fragToLight%d , " | 293 fragBuilder->codeAppendf("float distsq%d = dot(fragToLight%d , " |
301 "fragToLight%d );", | 294 "fragToLight%d);", |
302 i, i, i); | 295 i, i, i); |
303 fragBuilder->codeAppendf("%s = vec2(-fragToLight%d) * povDep th.b;", | 296 fragBuilder->codeAppendf("%s = vec2(-fragToLight%d) * povDep th.b;", |
304 offset.c_str(), i); | 297 offset.c_str(), i); |
305 fragBuilder->codeAppendf("fragToLight%d = normalize(fragToLi ght%d);", | 298 fragBuilder->codeAppendf("fragToLight%d = normalize(fragToLi ght%d);", |
306 i, i); | 299 i, i); |
300 } | |
307 | 301 |
308 // the 0.375s are precalculated transform values, given that the depth | 302 if (shadowFP.fIsRadialLight[i]) { |
309 // maps for pt lights are 4x the size (linearly) as diffuse maps. | 303 fragBuilder->codeAppendf("vec2 %s = vec2(vMatrixCoord_0_1_St age0.x, " |
310 // The vec2(0.375, -0.375) is used to transform us to the ce nter of the map. | 304 "1 - vMatrixCoord_0_ 1_Stage0.y);\n", |
311 fragBuilder->codeAppendf("vec2 %s = ((vec2(%s, %s) *" | 305 povCoord.c_str()); |
312 "vMatrixCoord_0_1_Stage0 +" | 306 |
313 "vec2(0,%s - %s)" | 307 fragBuilder->codeAppendf("%s = %s * 2.0 - 1.0;\n", |
314 "+ %s) / (vec2(%s, %s))) +" | 308 povCoord.c_str(), povCoord.c_str()) ; |
315 "vec2(0.375, -0.375);", | 309 |
316 povCoord.c_str(), | 310 fragBuilder->codeAppendf("float theta = atan(%s.y, %s.x);", |
317 widthUniName, heightUniName, | 311 povCoord.c_str(), povCoord.c_str()) ; |
318 depthMapHeightUniName[i], heightUni Name, | 312 fragBuilder->codeAppendf("float r = length(%s);", povCoord.c _str()); |
319 offset.c_str(), | 313 fragBuilder->codeAppendf("%s.x = (theta + 3.1415) / (2.0 * 3 .1415);", |
jvanverth1
2016/09/08 19:57:27
// map output of atan to [0, 1] ?
vjiaoblack
2016/09/08 20:25:08
Done.
| |
320 depthMapWidthUniName[i], depthMapWi dthUniName[i]); | 314 povCoord.c_str()); |
315 fragBuilder->codeAppendf("%s.y = 0.0;", povCoord.c_str()); | |
321 } else { | 316 } else { |
322 fragBuilder->codeAppendf("%s = vec2(%s) * povDepth.b * vec2( 255.0, -255.0);", | 317 // note that we flip the y-coord of the offset and then late r add |
323 offset.c_str(), lightDirOrPosUniNam e[i]); | 318 // a value just to the y-coord of povCoord. This is to accou nt for |
319 // the shifted origins from switching from raster into GPU. | |
320 if (shadowFP.fIsPointLight[i]) { | |
321 // the 0.375s are precalculated transform values, given that the depth | |
322 // maps for pt lights are 4x the size (linearly) as diff use maps. | |
323 // The vec2(0.375, -0.375) is used to transform us to | |
324 // the center of the map. | |
325 fragBuilder->codeAppendf("vec2 %s = ((vec2(%s, %s) *" | |
326 "vMatrixCoord_0_1_Stage 0 +" | |
327 "vec2(0,%s - %s)" | |
328 "+ %s) / (vec2(%s, %s)) ) +" | |
329 "vec2(0.375, -0.375);", | |
330 povCoord.c_str(), | |
331 widthUniName, heightUniName, | |
332 depthMapHeightUniName[i], heigh tUniName, | |
333 offset.c_str(), | |
334 depthMapWidthUniName[i], | |
335 depthMapWidthUniName[i]); | |
336 } else { | |
337 fragBuilder->codeAppendf("%s = vec2(%s) * povDepth.b * " | |
338 "vec2(255.0, -255.0);", | |
339 offset.c_str(), lightDirOrPosUn iName[i]); | |
324 | 340 |
325 fragBuilder->codeAppendf("vec2 %s = ((vec2(%s, %s) *" | 341 fragBuilder->codeAppendf("vec2 %s = ((vec2(%s, %s) *" |
326 "vMatrixCoord_0_1_Stage0 +" | 342 "vMatrixCoord_0_1_Stage 0 +" |
327 "vec2(0,%s - %s)" | 343 "vec2(0,%s - %s)" |
328 "+ %s) / vec2(%s, %s));", | 344 "+ %s) / vec2(%s, %s)); ", |
329 povCoord.c_str(), | 345 povCoord.c_str(), |
330 widthUniName, heightUniName, | 346 widthUniName, heightUniName, |
331 depthMapHeightUniName[i], heightUni Name, | 347 depthMapHeightUniName[i], heigh tUniName, |
332 offset.c_str(), | 348 offset.c_str(), |
333 depthMapWidthUniName[i], depthMapWi dthUniName[i]); | 349 depthMapWidthUniName[i], |
350 depthMapWidthUniName[i]); | |
351 } | |
334 } | 352 } |
335 | 353 |
336 fragBuilder->appendTextureLookup(&depthMaps[i], args.fTexSampler s[i], | 354 fragBuilder->appendTextureLookup(&depthMaps[i], args.fTexSampler s[i], |
337 povCoord.c_str(), | 355 povCoord.c_str(), |
338 kVec2f_GrSLType); | 356 kVec2f_GrSLType); |
339 | |
340 } | 357 } |
341 | 358 |
342 // helper variables for calculating shadowing | 359 // helper variables for calculating shadowing |
343 | 360 |
344 // variance of depth at this fragment in the context of surrounding area | 361 // variance of depth at this fragment in the context of surrounding area |
345 // (area size and weighting dependent on blur size and type) | 362 // (area size and weighting dependent on blur size and type) |
346 fragBuilder->codeAppendf("float variance;"); | 363 fragBuilder->codeAppendf("float variance;"); |
347 | 364 |
348 // the difference in depth between the user POV and light POV. | 365 // the difference in depth between the user POV and light POV. |
349 fragBuilder->codeAppendf("float d;"); | 366 fragBuilder->codeAppendf("float d;"); |
350 | 367 |
351 // add up light contributions from all lights to totalLightColor | 368 // add up light contributions from all lights to totalLightColor |
352 for (int i = 0; i < numLights; i++) { | 369 for (int i = 0; i < numLights; i++) { |
353 fragBuilder->codeAppendf("lightProbability = 1;"); | 370 fragBuilder->codeAppendf("lightProbability = 1;"); |
354 | 371 |
355 // 1/512 == .00195... is less than half a pixel; imperceptible | 372 if (shadowFP.fIsRadialLight[i]) { |
356 fragBuilder->codeAppendf("if (%s.b <= %s.b + .001953125) {", | 373 fragBuilder->codeAppend("totalLightColor = vec3(0);"); |
357 povDepth.c_str(), depthMaps[i].c_str()) ; | |
358 if (blurAlgorithm == SkShadowParams::kVariance_ShadowType) { | |
359 // We mess with depth and depth^2 in their given scales. | |
360 // (i.e. between 0 and 1) | |
361 fragBuilder->codeAppendf("vec2 moments%d = vec2(%s.b, %s.g); ", | |
362 i, depthMaps[i].c_str(), depthMaps[ i].c_str()); | |
363 | 374 |
364 // variance biasing lessens light bleeding | 375 fragBuilder->codeAppend("vec2 tc = vec2(povCoord0.x, 0.0);") ; |
365 fragBuilder->codeAppendf("variance = max(moments%d.y - " | 376 fragBuilder->codeAppend("float depth = texture(uTextureSampl er0_Stage1," |
366 "(moments%d.x * mome nts%d.x)," | 377 "povCoord0).b; "); |
367 "%s);", i, i, i, | |
368 minVarianceUniName); | |
369 | 378 |
370 fragBuilder->codeAppendf("d = (%s.b) - moments%d.x;", | 379 fragBuilder->codeAppendf("lightProbability = step(r, 1-depth );"); |
371 povDepth.c_str(), i); | |
372 fragBuilder->codeAppendf("lightProbability = " | |
373 "(variance / (variance + d * d));"); | |
374 | 380 |
375 SkString clamp("clamp"); | 381 fragBuilder->codeAppendf("if (%s.b != 0 || depth == 0) {" |
376 clamp.appendf("%d", i); | 382 "lightProbability = 1.0; }" , |
383 povDepth.c_str()); | |
384 } else { | |
385 // 1/512 == .00195... is less than half a pixel; imperceptib le | |
386 fragBuilder->codeAppendf("if (%s.b <= %s.b + .001953125) {", | |
387 povDepth.c_str(), depthMaps[i].c_st r()); | |
388 if (blurAlgorithm == SkShadowParams::kVariance_ShadowType) { | |
389 // We mess with depth and depth^2 in their given scales. | |
390 // (i.e. between 0 and 1) | |
391 fragBuilder->codeAppendf("vec2 moments%d = vec2(%s.b, %s .g);", | |
392 i, depthMaps[i].c_str(), depthM aps[i].c_str()); | |
377 | 393 |
378 // choosing between light artifacts or correct shape shadows | 394 // variance biasing lessens light bleeding |
379 // linstep | 395 fragBuilder->codeAppendf("variance = max(moments%d.y - " |
380 fragBuilder->codeAppendf("float %s = clamp((lightProbability - %s) /" | 396 "(moments%d.x * moments %d.x)," |
381 "(1 - %s), 0, 1);" , | 397 "%s);", i, i, i, |
382 clamp.c_str(), shBiasUniName, shBia sUniName); | 398 minVarianceUniName); |
383 | 399 |
384 fragBuilder->codeAppendf("lightProbability = %s;", clamp.c_s tr()); | 400 fragBuilder->codeAppendf("d = (%s.b) - moments%d.x;", |
385 } else { | 401 povDepth.c_str(), i); |
386 fragBuilder->codeAppendf("if (%s.b >= %s.b) {", | 402 fragBuilder->codeAppendf("lightProbability = " |
387 povDepth.c_str(), depthMaps[i].c_st r()); | 403 "(variance / (variance + d * d));"); |
388 fragBuilder->codeAppendf("lightProbability = 1;"); | 404 |
389 fragBuilder->codeAppendf("} else { lightProbability = 0; }") ; | 405 SkString clamp("clamp"); |
406 clamp.appendf("%d", i); | |
407 | |
408 // choosing between light artifacts or correct shape sha dows | |
409 // linstep | |
410 fragBuilder->codeAppendf("float %s = clamp((lightProbabi lity - %s) /" | |
411 "(1 - %s), 0, 1);", | |
412 clamp.c_str(), shBiasUniName, s hBiasUniName); | |
413 | |
414 fragBuilder->codeAppendf("lightProbability = %s;", clamp .c_str()); | |
415 } else { | |
416 fragBuilder->codeAppendf("if (%s.b >= %s.b) {", | |
417 povDepth.c_str(), depthMaps[i]. c_str()); | |
418 fragBuilder->codeAppendf("lightProbability = 1;"); | |
419 fragBuilder->codeAppendf("} else { lightProbability = 0; }"); | |
420 } | |
421 | |
422 // VSM: The curved shadows near plane edges are artifacts fr om blurring | |
423 // lightDir.z is equal to the lightDir dot the surface norma l. | |
424 fragBuilder->codeAppendf("}"); | |
390 } | 425 } |
391 | 426 |
392 // VSM: The curved shadows near plane edges are artifacts from b lurring | |
393 // lightDir.z is equal to the lightDir dot the surface normal. | |
394 fragBuilder->codeAppendf("}"); | |
395 | |
396 if (shadowFP.isPointLight(i)) { | 427 if (shadowFP.isPointLight(i)) { |
397 fragBuilder->codeAppendf("totalLightColor += max(fragToLight %d.z, 0) * %s /" | 428 fragBuilder->codeAppendf("totalLightColor += max(fragToLight %d.z, 0) * %s /" |
398 "(1 + distsq%d) *" | 429 "(1 + distsq%d) * lightProb ability;", |
399 "lightProbabilit y;", | |
400 i, lightColorUniName[i], i); | 430 i, lightColorUniName[i], i); |
401 } else { | 431 } else { |
402 fragBuilder->codeAppendf("totalLightColor += %s.z * %s * lig htProbability;", | 432 fragBuilder->codeAppendf("totalLightColor += %s.z * %s * lig htProbability;", |
403 lightDirOrPosUniName[i], | 433 lightDirOrPosUniName[i], |
404 lightColorUniName[i]); | 434 lightColorUniName[i]); |
405 } | 435 } |
436 | |
437 fragBuilder->codeAppendf("totalLightColor += %s;", ambientColorU niName); | |
438 fragBuilder->codeAppendf("%s = resultDiffuseColor * vec4(totalLi ghtColor, 1);", | |
439 args.fOutputColor); | |
406 } | 440 } |
407 | 441 |
408 fragBuilder->codeAppendf("totalLightColor += %s;", ambientColorUniNa me); | |
409 fragBuilder->codeAppendf("%s = resultDiffuseColor * vec4(totalLightC olor, 1);", | |
410 args.fOutputColor); | |
411 } | 442 } |
412 | 443 |
413 static void GenKey(const GrProcessor& proc, const GrGLSLCaps&, | 444 static void GenKey(const GrProcessor& proc, const GrGLSLCaps&, |
414 GrProcessorKeyBuilder* b) { | 445 GrProcessorKeyBuilder* b) { |
415 const ShadowFP& shadowFP = proc.cast<ShadowFP>(); | 446 const ShadowFP& shadowFP = proc.cast<ShadowFP>(); |
416 b->add32(shadowFP.fNumNonAmbLights); | 447 b->add32(shadowFP.fNumNonAmbLights); |
417 int isPL = 0; | 448 int isPLR = 0; |
418 for (int i = 0; i < SkShadowShader::kMaxNonAmbientLights; i++) { | 449 for (int i = 0; i < SkShadowShader::kMaxNonAmbientLights; i++) { |
419 isPL = isPL | ((shadowFP.fIsPointLight[i] ? 1 : 0) << i); | 450 isPLR = isPLR | ((shadowFP.fIsPointLight[i] ? 1 : 0) << i); |
451 isPLR = isPLR | ((shadowFP.fIsRadialLight[i] ? 1 : 0) << (i+4)); | |
420 } | 452 } |
421 b->add32(isPL); | 453 b->add32(isPLR); |
422 b->add32(shadowFP.fShadowParams.fType); | 454 b->add32(shadowFP.fShadowParams.fType); |
423 } | 455 } |
424 | 456 |
425 protected: | 457 protected: |
426 void onSetData(const GrGLSLProgramDataManager& pdman, const GrProcessor& proc) override { | 458 void onSetData(const GrGLSLProgramDataManager& pdman, const GrProcessor& proc) override { |
427 const ShadowFP &shadowFP = proc.cast<ShadowFP>(); | 459 const ShadowFP &shadowFP = proc.cast<ShadowFP>(); |
428 | 460 |
429 for (int i = 0; i < shadowFP.numLights(); i++) { | 461 for (int i = 0; i < shadowFP.numLights(); i++) { |
430 const SkVector3& lightDirOrPos = shadowFP.lightDirOrPos(i); | 462 const SkVector3& lightDirOrPos = shadowFP.lightDirOrPos(i); |
431 if (lightDirOrPos != fLightDirOrPos[i]) { | 463 if (lightDirOrPos != fLightDirOrPos[i]) { |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
521 | 553 |
522 void onComputeInvariantOutput(GrInvariantOutput* inout) const override { | 554 void onComputeInvariantOutput(GrInvariantOutput* inout) const override { |
523 inout->mulByUnknownFourComponents(); | 555 inout->mulByUnknownFourComponents(); |
524 } | 556 } |
525 int32_t numLights() const { return fNumNonAmbLights; } | 557 int32_t numLights() const { return fNumNonAmbLights; } |
526 const SkColor3f& ambientColor() const { return fAmbientColor; } | 558 const SkColor3f& ambientColor() const { return fAmbientColor; } |
527 bool isPointLight(int i) const { | 559 bool isPointLight(int i) const { |
528 SkASSERT(i < fNumNonAmbLights); | 560 SkASSERT(i < fNumNonAmbLights); |
529 return fIsPointLight[i]; | 561 return fIsPointLight[i]; |
530 } | 562 } |
563 bool isRadialLight(int i) const { | |
564 SkASSERT(i < fNumNonAmbLights); | |
565 return fIsRadialLight[i]; | |
566 } | |
531 const SkVector3& lightDirOrPos(int i) const { | 567 const SkVector3& lightDirOrPos(int i) const { |
532 SkASSERT(i < fNumNonAmbLights); | 568 SkASSERT(i < fNumNonAmbLights); |
533 return fLightDirOrPos[i]; | 569 return fLightDirOrPos[i]; |
534 } | 570 } |
535 const SkVector3& lightColor(int i) const { | 571 const SkVector3& lightColor(int i) const { |
536 SkASSERT(i < fNumNonAmbLights); | 572 SkASSERT(i < fNumNonAmbLights); |
537 return fLightColor[i]; | 573 return fLightColor[i]; |
538 } | 574 } |
539 int depthMapWidth(int i) const { | 575 int depthMapWidth(int i) const { |
540 SkASSERT(i < fNumNonAmbLights); | 576 SkASSERT(i < fNumNonAmbLights); |
(...skipping 18 matching lines...) Expand all Loading... | |
559 return false; | 595 return false; |
560 } | 596 } |
561 | 597 |
562 if (fWidth != shadowFP.fWidth || fHeight != shadowFP.fHeight) { | 598 if (fWidth != shadowFP.fWidth || fHeight != shadowFP.fHeight) { |
563 return false; | 599 return false; |
564 } | 600 } |
565 | 601 |
566 for (int i = 0; i < fNumNonAmbLights; i++) { | 602 for (int i = 0; i < fNumNonAmbLights; i++) { |
567 if (fLightDirOrPos[i] != shadowFP.fLightDirOrPos[i] || | 603 if (fLightDirOrPos[i] != shadowFP.fLightDirOrPos[i] || |
568 fLightColor[i] != shadowFP.fLightColor[i] || | 604 fLightColor[i] != shadowFP.fLightColor[i] || |
569 fIsPointLight[i] != shadowFP.fIsPointLight[i]) { | 605 fIsPointLight[i] != shadowFP.fIsPointLight[i] || |
606 fIsRadialLight[i] != shadowFP.fIsRadialLight[i]) { | |
570 return false; | 607 return false; |
571 } | 608 } |
572 | 609 |
573 if (fDepthMapWidth[i] != shadowFP.fDepthMapWidth[i] || | 610 if (fDepthMapWidth[i] != shadowFP.fDepthMapWidth[i] || |
574 fDepthMapHeight[i] != shadowFP.fDepthMapHeight[i]) { | 611 fDepthMapHeight[i] != shadowFP.fDepthMapHeight[i]) { |
575 return false; | 612 return false; |
576 } | 613 } |
577 } | 614 } |
578 | 615 |
579 return true; | 616 return true; |
580 } | 617 } |
581 | 618 |
582 int fNumNonAmbLights; | 619 int fNumNonAmbLights; |
583 | 620 |
584 bool fIsPointLight[SkShadowShader::kMaxNonAmbientLights]; | 621 bool fIsPointLight[SkShadowShader::kMaxNonAmbientLights]; |
622 bool fIsRadialLight[SkShadowShader::kMaxNonAmbientLights]; | |
585 SkVector3 fLightDirOrPos[SkShadowShader::kMaxNonAmbientLights]; | 623 SkVector3 fLightDirOrPos[SkShadowShader::kMaxNonAmbientLights]; |
586 SkColor3f fLightColor[SkShadowShader::kMaxNonAmbientLights]; | 624 SkColor3f fLightColor[SkShadowShader::kMaxNonAmbientLights]; |
587 GrTextureAccess fDepthMapAccess[SkShadowShader::kMaxNonAmbientLights]; | 625 GrTextureAccess fDepthMapAccess[SkShadowShader::kMaxNonAmbientLights]; |
588 sk_sp<GrTexture> fTexture[SkShadowShader::kMaxNonAmbientLights]; | 626 sk_sp<GrTexture> fTexture[SkShadowShader::kMaxNonAmbientLights]; |
589 | 627 |
590 int fDepthMapWidth[SkShadowShader::kMaxNonAmbientLights]; | 628 int fDepthMapWidth[SkShadowShader::kMaxNonAmbientLights]; |
591 int fDepthMapHeight[SkShadowShader::kMaxNonAmbientLights]; | 629 int fDepthMapHeight[SkShadowShader::kMaxNonAmbientLights]; |
592 | 630 |
593 int fHeight; | 631 int fHeight; |
594 int fWidth; | 632 int fWidth; |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
904 | 942 |
905 /////////////////////////////////////////////////////////////////////////////// | 943 /////////////////////////////////////////////////////////////////////////////// |
906 | 944 |
907 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkShadowShader) | 945 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkShadowShader) |
908 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkShadowShaderImpl) | 946 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkShadowShaderImpl) |
909 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 947 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
910 | 948 |
911 /////////////////////////////////////////////////////////////////////////////// | 949 /////////////////////////////////////////////////////////////////////////////// |
912 | 950 |
913 #endif | 951 #endif |
OLD | NEW |