413 {
414 auto dict = keyContext.dict();
415
416 int bufferOffset = 0;
418 if (gradData.fUseStorageBuffer) {
420 gradData.fSrcColors,
421 gradData.fSrcOffsets,
422 gradData.fSrcShader,
423 gatherer);
424 } else {
425 SkASSERT(gradData.fColorsAndOffsetsProxy);
427 gatherer->add(gradData.fColorsAndOffsetsProxy, {SkFilterMode::kNearest, kClampTiling});
428 }
429 }
430
432 switch (gradData.fType) {
434 codeSnippetID =
437 : gradData.fUseStorageBuffer
440 add_linear_gradient_uniform_data(dict, codeSnippetID, gradData, bufferOffset, gatherer);
441 break;
442 case SkShaderBase::GradientType::kRadial:
443 codeSnippetID =
446 : gradData.fUseStorageBuffer
449 add_radial_gradient_uniform_data(dict, codeSnippetID, gradData, bufferOffset, gatherer);
450 break;
451 case SkShaderBase::GradientType::kSweep:
452 codeSnippetID =
455 : gradData.fUseStorageBuffer
458 add_sweep_gradient_uniform_data(dict, codeSnippetID, gradData, bufferOffset, gatherer);
459 break;
460 case SkShaderBase::GradientType::kConical:
461 codeSnippetID =
464 : gradData.fUseStorageBuffer
467 add_conical_gradient_uniform_data(dict, codeSnippetID, gradData, bufferOffset, gatherer);
468 break;
470 default:
471 SkDEBUGFAIL(
"Expected a gradient shader, but it wasn't one.");
472 break;
473 }
474
475 builder->addBlock(codeSnippetID);
476}
#define SkDEBUGFAIL(message)
static constexpr skcms_TransferFunction kLinear
@ kConicalGradientShader8
@ kConicalGradientShaderBuffer
@ kSweepGradientShaderTexture
@ kSweepGradientShaderBuffer
@ kConicalGradientShader4
@ kLinearGradientShaderTexture
@ kRadialGradientShaderBuffer
@ kConicalGradientShaderTexture
@ kLinearGradientShaderBuffer
@ kRadialGradientShaderTexture
static int write_color_and_offset_bufdata(int numStops, const SkPMColor4f *colors, const float *offsets, const SkGradientBaseShader *shader, PipelineDataGatherer *gatherer)
static constexpr int kNumInternalStorageStops