84#define VALIDATE_UNIFORMS(gatherer, dict, codeSnippetID) \
85 SkDEBUGCODE(UniformExpectationsValidator uev(gatherer, dict->getUniforms(codeSnippetID));)
93void add_solid_uniform_data(
const ShaderCodeDictionary* dict,
95 PipelineDataGatherer* gatherer) {
97 gatherer->write(premulColor);
106 add_solid_uniform_data(keyContext.
dict(), premulColor, gatherer);
122void add_alpha_only_paint_color_uniform_data(
const ShaderCodeDictionary* dict,
124 PipelineDataGatherer* gatherer) {
126 gatherer->writePaintColor(premulColor);
134 add_rgb_paint_color_uniform_data(keyContext.
dict(), keyContext.
paintColor(), gatherer);
142 add_alpha_only_paint_color_uniform_data(keyContext.
dict(), keyContext.
paintColor(), gatherer);
160 SkV4 coords{
static_cast<float>(dstOffset.
x()),
161 static_cast<float>(dstOffset.
y()),
162 dstTexture ? 1.0f / dstTexture->dimensions().width() : 1.0f,
163 dstTexture ? 1.0f / dstTexture->dimensions().height() : 1.0f };
164 gatherer->
write(coords);
174 add_dst_read_sample_uniform_data(keyContext.
dict(), gatherer, std::move(dstTexture), dstOffset);
187 if (gradData.
fNumStops <= kInternalStopLimit) {
208void add_gradient_postamble(
const GradientShaderBlocks::GradientData& gradData,
210 PipelineDataGatherer* gatherer) {
215 static_assert(
static_cast<int>(ColorSpace::kLab) == 2);
216 static_assert(
static_cast<int>(ColorSpace::kOKLab) == 3);
217 static_assert(
static_cast<int>(ColorSpace::kOKLabGamutMap) == 4);
218 static_assert(
static_cast<int>(ColorSpace::kLCH) == 5);
219 static_assert(
static_cast<int>(ColorSpace::kOKLCH) == 6);
220 static_assert(
static_cast<int>(ColorSpace::kOKLCHGamutMap) == 7);
221 static_assert(
static_cast<int>(ColorSpace::kHSL) == 9);
222 static_assert(
static_cast<int>(ColorSpace::kHWB) == 10);
224 bool inputPremul =
static_cast<bool>(gradData.fInterpolation.fInPremul);
226 if (gradData.fNumStops > kInternalStopLimit) {
227 gatherer->write(gradData.fNumStops);
228 if (gradData.fUseStorageBuffer) {
229 gatherer->write(bufferOffset);
233 gatherer->write(
static_cast<int>(gradData.fTM));
234 gatherer->write(
static_cast<int>(gradData.fInterpolation.fColorSpace));
235 gatherer->write(
static_cast<int>(inputPremul));
238void add_linear_gradient_uniform_data(
const ShaderCodeDictionary* dict,
240 const GradientShaderBlocks::GradientData& gradData,
242 PipelineDataGatherer* gatherer) {
245 add_gradient_preamble(gradData, gatherer);
246 add_gradient_postamble(gradData, bufferOffset, gatherer);
249void add_radial_gradient_uniform_data(
const ShaderCodeDictionary* dict,
251 const GradientShaderBlocks::GradientData& gradData,
253 PipelineDataGatherer* gatherer) {
256 add_gradient_preamble(gradData, gatherer);
257 add_gradient_postamble(gradData, bufferOffset, gatherer);
260void add_sweep_gradient_uniform_data(
const ShaderCodeDictionary* dict,
262 const GradientShaderBlocks::GradientData& gradData,
264 PipelineDataGatherer* gatherer) {
267 add_gradient_preamble(gradData, gatherer);
268 gatherer->write(gradData.fBias);
269 gatherer->write(gradData.fScale);
270 add_gradient_postamble(gradData, bufferOffset, gatherer);
273void add_conical_gradient_uniform_data(
const ShaderCodeDictionary* dict,
275 const GradientShaderBlocks::GradientData& gradData,
277 PipelineDataGatherer* gatherer) {
280 float dRadius = gradData.fRadii[1] - gradData.fRadii[0];
288 a = 1 - dRadius * dRadius;
290 invA = 1.0 / (2.0 *
a);
298 dRadius = gradData.fRadii[0] > 0 ? 1 : -1;
301 add_gradient_preamble(gradData, gatherer);
302 gatherer->write(gradData.fRadii[0]);
303 gatherer->write(dRadius);
305 gatherer->write(invA);
306 add_gradient_postamble(gradData, bufferOffset, gatherer);
321 for (
int i = 0;
i < numStops;
i++) {
327 int dataIndex =
i * 5;
328 dstData[dataIndex] =
offset;
329 dstData[dataIndex + 1] = unpremulColor.fR;
330 dstData[dataIndex + 2] = unpremulColor.fG;
331 dstData[dataIndex + 3] = unpremulColor.fB;
332 dstData[dataIndex + 4] = unpremulColor.fA;
341 bool useStorageBuffer)
343 , fPoints{{0.0f, 0.0f}, {0.0f, 0.0f}}
348 , fNumStops(numStops)
349 , fUseStorageBuffer(useStorageBuffer)
350 , fSrcColors(
nullptr)
351 , fSrcOffsets(
nullptr) {
353 sk_bzero(fOffsets,
sizeof(fOffsets));
358 float radius0,
float radius1,
359 float bias,
float scale,
366 bool useStorageBuffer,
372 , fNumStops(numStops)
373 , fUseStorageBuffer(useStorageBuffer)
377 , fInterpolation(
interp) {
414 auto dict = keyContext.
dict();
416 int bufferOffset = 0;
432 switch (gradData.
fType) {
440 add_linear_gradient_uniform_data(dict, codeSnippetID, gradData, bufferOffset, gatherer);
442 case SkShaderBase::GradientType::kRadial:
449 add_radial_gradient_uniform_data(dict, codeSnippetID, gradData, bufferOffset, gatherer);
451 case SkShaderBase::GradientType::kSweep:
458 add_sweep_gradient_uniform_data(dict, codeSnippetID, gradData, bufferOffset, gatherer);
460 case SkShaderBase::GradientType::kConical:
467 add_conical_gradient_uniform_data(dict, codeSnippetID, gradData, bufferOffset, gatherer);
471 SkDEBUGFAIL(
"Expected a gradient shader, but it wasn't one.");
475 builder->addBlock(codeSnippetID);
483 const SkM44& localMatrix,
488 bool wasInverted = localMatrix.
invert(&lmInverse);
493 gatherer->
write(lmInverse);
503 add_localmatrixshader_uniform_data(keyContext.
dict(), lmShaderData.
fLocalMatrix, gatherer);
512static constexpr int kColorSpaceXformFlagAlphaSwizzle = 0x20;
523 int colorXformFlags = SkTo<int>(steps.
flags.
mask());
528 colorXformFlags |= SkTo<int>(gamutSteps.
flags.
mask());
531 SkASSERT(colorXformFlags < kColorSpaceXformFlagAlphaSwizzle);
532 colorXformFlags |= kColorSpaceXformFlagAlphaSwizzle;
535 gatherer->
write(colorXformFlags);
546 const float identity[] = { 1, 0, 0, 0, 1, 0, 0, 0, 1 };
551 gamutTransform.
setAll(
m[0] +
m[3] +
m[6], 0, 0,
552 m[1] +
m[4] +
m[7], 0, 0,
553 m[2] +
m[5] +
m[8], 0, 0);
559 gamutTransform.
setAll(0, 0, 0,
578 switch (readSwizzle) {
597void add_image_uniform_data(
const ShaderCodeDictionary* dict,
598 const ImageShaderBlock::ImageData& imgData,
599 PipelineDataGatherer* gatherer) {
600 SkASSERT(!imgData.fSampling.useCubic);
603 gatherer->write(
SkSize::Make(1.f/imgData.fImgSize.width(), 1.f/imgData.fImgSize.height()));
604 gatherer->write(imgData.fSubset);
605 gatherer->write(SkTo<int>(imgData.fTileModes[0]));
606 gatherer->write(SkTo<int>(imgData.fTileModes[1]));
607 gatherer->write(SkTo<int>(imgData.fSampling.filter));
609 add_color_space_uniforms(imgData.fSteps, imgData.fReadSwizzle, gatherer);
612void add_cubic_image_uniform_data(
const ShaderCodeDictionary* dict,
613 const ImageShaderBlock::ImageData& imgData,
614 PipelineDataGatherer* gatherer) {
615 SkASSERT(imgData.fSampling.useCubic);
618 gatherer->write(
SkSize::Make(1.f/imgData.fImgSize.width(), 1.f/imgData.fImgSize.height()));
619 gatherer->write(imgData.fSubset);
620 gatherer->write(SkTo<int>(imgData.fTileModes[0]));
621 gatherer->write(SkTo<int>(imgData.fTileModes[1]));
625 add_color_space_uniforms(imgData.fSteps, imgData.fReadSwizzle, gatherer);
628void add_hw_image_uniform_data(
const ShaderCodeDictionary* dict,
629 const ImageShaderBlock::ImageData& imgData,
630 PipelineDataGatherer* gatherer) {
631 SkASSERT(!imgData.fSampling.useCubic);
634 gatherer->write(
SkSize::Make(1.f/imgData.fImgSize.width(), 1.f/imgData.fImgSize.height()));
636 add_color_space_uniforms(imgData.fSteps, imgData.fReadSwizzle, gatherer);
639bool can_do_tiling_in_hw(
const Caps* caps,
const ImageShaderBlock::ImageData& imgData) {
644 return imgData.fSubset.contains(
SkRect::Make(imgData.fImgSize));
647void add_sampler_data_to_key(PaintParamsKeyBuilder*
builder,
const SamplerDesc& samplerDesc) {
648 if (samplerDesc.isImmutable()) {
649 builder->addData({samplerDesc.asSpan()});
666 , fTileModes{tileModeX, tileModeY}
669 , fReadSwizzle(readSwizzle) {
683 const Caps* caps = keyContext.
caps();
684 const bool doTilingInHw = !imgData.
fSampling.
useCubic && can_do_tiling_in_hw(caps, imgData);
687 add_hw_image_uniform_data(keyContext.
dict(), imgData, gatherer);
690 add_cubic_image_uniform_data(keyContext.
dict(), imgData, gatherer);
693 add_image_uniform_data(keyContext.
dict(), imgData, gatherer);
703 doTilingInHw ? imgData.
fTileModes : kDefaultTileModes,
706 add_sampler_data_to_key(
builder, samplerDesc);
728 for (
int i = 0;
i < 4; ++
i) {
735void add_cubic_yuv_image_uniform_data(
const ShaderCodeDictionary* dict,
736 const YUVImageShaderBlock::ImageData& imgData,
737 PipelineDataGatherer* gatherer) {
740 gatherer->write(
SkSize::Make(1.f/imgData.fImgSize.width(), 1.f/imgData.fImgSize.height()));
741 gatherer->write(
SkSize::Make(1.f/imgData.fImgSizeUV.width(), 1.f/imgData.fImgSizeUV.height()));
742 gatherer->write(imgData.fSubset);
743 gatherer->write(SkTo<int>(imgData.fTileModes[0]));
744 gatherer->write(SkTo<int>(imgData.fTileModes[1]));
748 for (
int i = 0;
i < 4; ++
i) {
749 gatherer->writeHalf(imgData.fChannelSelect[
i]);
751 gatherer->writeHalf(imgData.fYUVtoRGBMatrix);
752 gatherer->writeHalf(imgData.fYUVtoRGBTranslate);
755void add_hw_yuv_image_uniform_data(
const ShaderCodeDictionary* dict,
756 const YUVImageShaderBlock::ImageData& imgData,
757 PipelineDataGatherer* gatherer) {
760 gatherer->write(
SkSize::Make(1.f/imgData.fImgSize.width(), 1.f/imgData.fImgSize.height()));
761 gatherer->write(
SkSize::Make(1.f/imgData.fImgSizeUV.width(), 1.f/imgData.fImgSizeUV.height()));
762 for (
int i = 0;
i < 4; ++
i) {
763 gatherer->writeHalf(imgData.fChannelSelect[
i]);
765 gatherer->writeHalf(imgData.fYUVtoRGBMatrix);
766 gatherer->writeHalf(imgData.fYUVtoRGBTranslate);
778 , fTileModes{tileModeX, tileModeY}
780 , fImgSizeUV(imgSize)
815 const Caps* caps = keyContext.
caps();
822 gatherer->add(imgData.
fTextureProxies[0], {imgData.fSampling, imgData.fTileModes});
823 gatherer->add(imgData.
fTextureProxies[1], {imgData.fSamplingUV, uvTileModes});
824 gatherer->add(imgData.
fTextureProxies[2], {imgData.fSamplingUV, uvTileModes});
825 gatherer->add(imgData.
fTextureProxies[3], {imgData.fSampling, imgData.fTileModes});
828 add_hw_yuv_image_uniform_data(keyContext.
dict(), imgData, gatherer);
831 add_cubic_yuv_image_uniform_data(keyContext.
dict(), imgData, gatherer);
834 add_yuv_image_uniform_data(keyContext.
dict(), imgData, gatherer);
857 add_coordclamp_uniform_data(keyContext.
dict(), clampData, gatherer);
880 add_dither_uniform_data(keyContext.
dict(),
data, gatherer);
886 gatherer->add(
data.fLUTProxy, {kNearest, kRepeatTiling});
902 gatherer->
write(
static_cast<int>(noiseData.
fType));
910 gatherer->add(noiseData.
fNoiseProxy, {kNearestSampling, kRepeatXTileModes});
919 add_perlin_noise_uniform_data(keyContext.
dict(), noiseData, gatherer);
941 gatherer->
write(SkTo<int>(blendMode));
987 gatherer->
write(
static_cast<int>(
data.fInHSLA));
997 add_matrix_colorfilter_uniform_data(keyContext.
dict(), matrixCFData, gatherer);
1012 gatherer->add(
data.fTextureProxy, {SkSamplingOptions(), kTileModes});
1023 add_table_colorfilter_uniform_data(keyContext.
dict(),
data, gatherer);
1031void add_color_space_xform_uniform_data(
1046 : fSteps(
src, srcAT,
dst, dstAT) {}
1052 add_color_space_xform_uniform_data(keyContext.
dict(),
data, gatherer);
1081 : fEffect(
std::move(effect)) {}
1085 : fEffect(
std::move(effect))
1086 , fUniforms(
std::move(uniforms)) {}
1091 return a ?
a->equals(
b) : (
a ==
b);
1101 const SkData* uniformData,
1107 SkDEBUGCODE(UniformExpectationsValidator uev(gatherer, graphiteUniforms);)
1111 if (!rtsUniforms.empty() && uniformData) {
1113 const uint8_t* uniformBase = uniformData->
bytes();
1114 for (
size_t index = 0; index < rtsUniforms.size(); ++index) {
1115 const Uniform& uniform = graphiteUniforms[index];
1117 const uint8_t* uniformPtr = uniformBase + rtsUniforms[index].offset;
1119 gatherer->
write(uniform, uniformPtr);
1165 builder->beginBlock(codeSnippetID);
1182void add_children_to_key(
const KeyContext& keyContext,
1183 PaintParamsKeyBuilder*
builder,
1184 PipelineDataGatherer* gatherer,
1193 for (
size_t index = 0; index < children.
size(); ++index) {
1195 std::optional<ChildType>
type = child.
type();
1204 switch (childInfo[index].
type) {
1226 PaintParamsKeyBuilder*
builder,
1227 PipelineDataGatherer* gatherer,
1235 keyContext.dstColorInfo().colorSpace());
1239 { effect, std::move(uniforms) });
1241 add_children_to_key(keyContext,
builder, gatherer,
1248 DrawContext* drawContext,
1250 for (
const auto& child : children) {
1251 if (child.
type().has_value()) {
1252 switch (*child.
type()) {
1278 case SkBlenderBase::BlenderType::k##type: \
1279 add_to_key(keyContext, \
1282 static_cast<const Sk##type##Blender*>(blender)); \
1294 if (
as_BB(blender)->
type() == SkBlenderBase::BlenderType::kRuntime) {
1327 filter->
dst().
get(), kAlphaType);
1337 Compose(keyContext, keyBuilder, gatherer,
1378 add_children_to_key(keyContext,
builder, gatherer,
1392 "TableColorFilterTexture");
1394 SKGPU_LOG_W(
"Couldn't create TableColorFilter's table");
1433 dstCS.
get(), dstAT, workingCS.
get(), workingAT);
1445 workingCS.
get(), workingAT, dstCS.
get(), dstAT);
1463 case SkColorFilterBase::Type::k##type: \
1464 add_to_key(keyContext, \
1467 static_cast<const Sk##type##ColorFilter*>(filter)); \
1479 if (
as_CFB(filter)->
type() == SkColorFilterBase::Type::kCompose) {
1484 }
else if (
as_CFB(filter)->
type() == SkColorFilterBase::Type::kWorkingFormat) {
1488 }
else if (
as_CFB(filter)->
type() == SkColorFilterBase::Type::kRuntime) {
1549 SkColor4f::FromColor(shader->
color()).premul());
1645 case 'r': imgData.
fChannelSelect[locIndex] = {1.f, 0.f, 0.f, 0.f};
break;
1646 case 'g': imgData.
fChannelSelect[locIndex] = {0.f, 1.f, 0.f, 0.f};
break;
1647 case 'b': imgData.
fChannelSelect[locIndex] = {0.f, 0.f, 1.f, 0.f};
break;
1648 case 'a': imgData.
fChannelSelect[locIndex] = {0.f, 0.f, 0.f, 1.f};
break;
1664 if (ssx > 1 || ssy > 1) {
1689 float scaleX = 1.f/ssx;
1690 float scaleY = 1.f/ssy;
1699 SkRect insetRectUV = {(iSubsetUV.
fLeft +0.5f)*ssx,
1700 (iSubsetUV.
fTop +0.5f)*ssy,
1701 (iSubsetUV.
fRight -0.5f)*ssx,
1702 (iSubsetUV.
fBottom-0.5f)*ssy};
1705 (void) insetRect.
intersect(insetRectUV);
1720 SkASSERT(yuvM[3] == 0 && yuvM[8] == 0 && yuvM[13] == 0 && yuvM[18] == 1);
1721 SkASSERT(yuvM[15] == 0 && yuvM[16] == 0 && yuvM[17] == 0 && yuvM[19] == 0);
1723 yuvM[ 0], yuvM[ 1], yuvM[ 2],
1724 yuvM[ 5], yuvM[ 6], yuvM[ 7],
1725 yuvM[10], yuvM[11], yuvM[12]
1738 if (!origShader->
isRaw()) {
1769 SKGPU_LOG_W(
"%s is an unsupported read swizzle. Defaulting to RGBA.\n",
1785 SKGPU_LOG_W(
"Couldn't convert ImageShader's image to a Graphite-backed image");
1811 std::move(imageToDraw),
1815 auto view =
AsView(imageToDraw.get());
1821 view.proxy()->dimensions(),
1830 bool samplingHasNoEffect =
false;
1833 !newSampling.useCubic) {
1848 if (imageToDraw->isAlphaOnly()) {
1853 if (!shader->
isRaw()) {
1855 imageToDraw->alphaType(),
1880 if (!
image->isGraphiteBacked()) {
1899 if (wrappedShaderBase->
type() == SkShaderBase::ShaderType::kImage) {
1900 auto imgShader =
static_cast<const SkImageShader*
>(wrappedShader);
1905 auto imgBase =
as_IB(imgShader->image());
1906 if (imgBase->isGraphiteBacked() && !imgBase->isYUVA()) {
1907 auto imgGraphite =
static_cast<Image*
>(imgBase);
1909 const auto& view = imgGraphite->textureProxyView();
1912 matrix.setTranslateY(view.height());
1915 }
else if (wrappedShaderBase->
type() == SkShaderBase::ShaderType::kGradientBase) {
1921 if (gradShader->asGradient() == SkShaderBase::GradientType::kConical) {
1926 SkPoint center = conicalShader->getStartCenter();
1933 conicalShader->getEndCenter(),
1936 gradMatrix = conicalMatrix;
1942 matrix.postConcat(invGradMatrix);
1976 std::unique_ptr<SkPerlinNoiseShader::PaintingData> paintingData = shader->
getPaintingData();
1977 paintingData->generateBitmaps();
1981 paintingData->getPermutationsBitmap(),
1982 "PerlinNoisePermTable");
1986 "PerlinNoiseNoiseTable");
1988 if (!perm || !noise) {
1989 SKGPU_LOG_W(
"Couldn't create tables for PerlinNoiseShader");
1996 paintingData->fBaseFrequency,
1998 {paintingData->fStitchDataInit.fWidth, paintingData->fStitchDataInit.fHeight});
2032 if (!
info.success) {
2033 SKGPU_LOG_W(
"Couldn't access PictureShaders' Image info");
2047 "PictureShaderTexture",
2053 SKGPU_LOG_W(
"Could not create surface to render PictureShader");
2067 SKGPU_LOG_W(
"Couldn't create SkImage for PictureShader");
2076 SKGPU_LOG_W(
"Couldn't create SkImageShader for PictureShader");
2101 {effect, std::move(uniforms)});
2103 add_children_to_key(keyContext,
builder, gatherer,
2118 SKGPU_LOG_W(
"Raster-only SkShader (SkTransformShader) encountered");
2129 SKGPU_LOG_W(
"Raster-only SkShader (SkTriColorShader) encountered");
2160 workingCS.
get(), dstAT, dstCS.
get(), dstAT);
2178 for (
int i = 0;
i < numStops;
i++) {
2188 float mantissa = frexp(
offset, &exponent);
2196#if defined(SK_DEBUG)
2210 return colorsAndOffsetsBitmap;
2223 bool inputPremul =
static_cast<bool>(
interp.fInPremul);
2225 switch (
interp.fColorSpace) {
2226 case ColorSpace::kLab:
2227 case ColorSpace::kOKLab:
2228 case ColorSpace::kOKLabGamutMap:
2229 case ColorSpace::kLCH:
2230 case ColorSpace::kOKLCH:
2231 case ColorSpace::kOKLCHGamutMap:
2232 case ColorSpace::kHSL:
2233 case ColorSpace::kHWB:
2234 inputPremul =
false;
2248 intermediateCS, intermediateAlphaType, dstColorSpace, dstColorInfo.
alphaType());
2274 const float* positions = xformedColors.
fPositions;
2275 const int colorCount = xformedColors.
fColors.
size();
2282 && !useStorageBuffer) {
2286 if (colorsAndOffsetsBitmap.
empty()) {
2287 SKGPU_LOG_W(
"Couldn't create GradientShader's color and offset bitmap");
2297 SKGPU_LOG_W(
"Couldn't create GradientShader's color and offset bitmap proxy");
2411 case SkShaderBase::GradientType::k##type: \
2412 add_gradient_to_key(keyContext, \
2415 static_cast<const Sk##type##Gradient*>(shader)); \
2420 SkDEBUGFAIL(
"Gradient shader says its type is none");
2438 case SkShaderBase::ShaderType::k##type: \
2439 add_to_key(keyContext, \
2442 static_cast<const Sk##type##Shader*>(shader)); \
2458 case SkShaderBase::ShaderType::k##type: \
2459 notify_in_use(recorder, \
2461 static_cast<const Sk##type##Shader*>(shader)); \
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
sk_bzero(glyphs, sizeof(glyphs))
SkAssertResult(font.textToGlyphs("Hello", 5, SkTextEncoding::kUTF8, glyphs, std::size(glyphs))==count)
#define VALIDATE_UNIFORMS(gatherer, dict, codeSnippetID)
#define SKGPU_LOG_W(fmt,...)
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
#define SkDEBUGFAIL(message)
#define SkDEBUGFAILF(fmt,...)
@ kSrcOver
r = s + (1-sa)*d
#define SK_ALL_BLENDERS(M)
SkBlenderBase * as_BB(SkBlender *blend)
constexpr SkPMColor4f SK_PMColor4fTRANSPARENT
#define SK_ALL_COLOR_FILTERS(M)
static SkColorFilterBase * as_CFB(SkColorFilter *filter)
SkColorSpace * sk_srgb_linear_singleton()
SkColorSpace * sk_srgb_singleton()
@ kRGBA_F16_SkColorType
pixel with half floats for red, green, blue, alpha;
static constexpr float sk_ieee_float_divide(float numer, float denom)
static float2 interp(const float2 &v0, const float2 &v1, const float2 &t)
float SkHalfToFloat(SkHalf h)
SkHalf SkFloatToHalf(float f)
static SkImage_Base * as_IB(SkImage *image)
#define SK_ScalarNearlyZero
static bool SkScalarIsInt(SkScalar x)
SkShaderBase * as_SB(SkShader *shader)
#define SK_ALL_GRADIENTS(M)
#define SK_ALL_SHADERS(M)
SkDEBUGCODE(SK_SPI) SkThreadID SkGetThreadID()
void SkColorMatrix_YUV2RGB(SkYUVColorSpace cs, float m[20])
void allocPixels(const SkImageInfo &info, size_t rowBytes)
void erase(SkColor4f c, const SkIRect &area) const
sk_sp< SkShader > dst() const
sk_sp< SkShader > src() const
const SkMatrix & ctm() const
sk_sp< SkShader > proxyShader() const
sk_sp< SkColorSpace > colorSpace() const
sk_sp< SkColorFilterBase > filter() const
sk_sp< SkShader > shader() const
SkAlphaType alphaType() const
sk_sp< SkColorSpace > refColorSpace() const
SkColorSpace * colorSpace() const
SkColorType colorType() const
static sk_sp< SkColorSpace > MakeSRGB()
sk_sp< SkColorFilterBase > inner() const
sk_sp< SkColorFilterBase > outer() const
const SkPoint & getEndCenter() const
SkScalar getEndRadius() const
const SkPoint & getStartCenter() const
SkScalar getDiffRadius() const
SkScalar getCenterX1() const
SkScalar getStartRadius() const
static bool MapToUnitX(const SkPoint &startCenter, const SkPoint &endCenter, SkMatrix *dstMatrix)
sk_sp< SkShader > shader() const
const uint8_t * bytes() const
const Interpolation & getInterpolation() const
void setCachedBitmap(SkBitmap b) const
const SkBitmap & cachedBitmap() const
const SkMatrix & getGradientMatrix() const
SkTileMode getTileMode() const
SkSamplingOptions sampling() const
static SkM44 CubicResamplerMatrix(float B, float C)
SkTileMode tileModeX() const
sk_sp< SkImage > image() const
SkTileMode tileModeY() const
bool isGraphiteBacked() const
SkColorSpace * colorSpace() const
SkISize dimensions() const
SkAlphaType alphaType() const
sk_sp< SkShader > makeShader(SkTileMode tmx, SkTileMode tmy, const SkSamplingOptions &, const SkMatrix *localMatrix=nullptr) const
const SkPoint & start() const
const SkPoint & end() const
const SkMatrix & localMatrix() const
sk_sp< SkShader > wrappedShader() const
bool invert(SkM44 *inverse) const
const float * matrix() const
static SkMatrix Scale(SkScalar sx, SkScalar sy)
SkMatrix & postTranslate(SkScalar dx, SkScalar dy)
SkMatrix & postScale(SkScalar sx, SkScalar sy, SkScalar px, SkScalar py)
SkMatrix & setAll(SkScalar scaleX, SkScalar skewX, SkScalar transX, SkScalar skewY, SkScalar scaleY, SkScalar transY, SkScalar persp0, SkScalar persp1, SkScalar persp2)
SkScalar getTranslateY() const
SkMatrix & preConcat(const SkMatrix &other)
void normalizePerspective()
SkScalar getTranslateX() const
SkPerlinNoiseShaderType noiseType() const
std::unique_ptr< PaintingData > getPaintingData() const
SkTileMode tileModeY() const
SkTileMode tileModeX() const
SkFilterMode filter() const
sk_sp< SkPicture > picture() const
const SkPoint & center() const
sk_sp< SkRuntimeEffect > effect() const
SkSpan< const SkRuntimeEffect::ChildPtr > children() const
sk_sp< const SkData > uniforms() const
SkSpan< const SkRuntimeEffect::ChildPtr > children() const
sk_sp< SkRuntimeEffect > effect() const
sk_sp< const SkData > uniforms() const
static sk_sp< const SkData > TransformUniforms(SkSpan< const SkRuntimeEffect::Uniform > uniforms, sk_sp< const SkData > originalData, const SkColorSpaceXformSteps &)
static bool UsesColorTransform(const SkRuntimeEffect *effect)
SkBlender * blender() const
SkShader * shader() const
std::optional< ChildType > type() const
SkColorFilter * colorFilter() const
SkSpan< const Child > children() const
SkSpan< const Uniform > uniforms() const
SkSpan< const SkRuntimeEffect::ChildPtr > children() const
sk_sp< const SkData > uniformData(const SkColorSpace *dstCS) const
sk_sp< SkRuntimeEffect > effect() const
virtual GradientType asGradient(GradientInfo *info=nullptr, SkMatrix *localMatrix=nullptr) const
virtual ShaderType type() const =0
constexpr size_t size() const
const char * data() const
const SkPoint & center() const
const SkBitmap & bitmap() const
sk_sp< SkShader > shader() const
sk_sp< SkColorSpace > workingSpace() const
SkMatrix originMatrix() const
SkYUVColorSpace yuvColorSpace() const
static constexpr int kYUVAChannelCount
static constexpr Swizzle Concat(const Swizzle &a, const Swizzle &b)
SkString asString() const
static constexpr Swizzle BGRA()
static constexpr Swizzle RGBA()
static constexpr Swizzle RGB1()
virtual ImmutableSamplerInfo getImmutableSamplerInfo(const TextureProxy *) const
bool storageBufferPreferred() const
bool clampToBorderSupport() const
bool storageBufferSupport() const
int maxTextureSize() const
std::tuple< int, int > uvSubsampleFactors() const
const SkYUVAInfo & yuvaInfo() const
const TextureProxyView & proxyView(int channelIndex) const
const SkM44 & local2Dev() const
RuntimeEffectDictionary * rtEffectDict() const
Recorder * recorder() const
const SkMatrix * localMatrix() const
const SkPMColor4f & paintColor() const
OptimizeSampling optimizeSampling() const
const SkColorInfo & dstColorInfo() const
ShaderCodeDictionary * dict() const
const Caps * caps() const
std::pair< float *, int > allocateGradientData(int numStops, const SkGradientBaseShader *shader)
void writeHalf(const T &t)
void writeArray(SkSpan< const T > t)
void writePaintColor(const SkPMColor4f &color)
const Caps * caps() const
static sk_sp< TextureProxy > CreateCachedProxy(Recorder *, const SkBitmap &, std::string_view label)
void set(int codeSnippetID, sk_sp< const SkRuntimeEffect > effect)
int findOrCreateRuntimeEffectSnippet(const SkRuntimeEffect *effect)
const ShaderSnippet * getEntry(int codeSnippetID) const SK_EXCLUDES(fSpinLock)
static sk_sp< Surface > Make(Recorder *recorder, const SkImageInfo &info, std::string_view label, Budgeted budgeted, Mipmapped mipmapped=Mipmapped::kNo, SkBackingFit backingFit=SkBackingFit::kExact, const SkSurfaceProps *props=nullptr)
SkISize dimensions() const
sk_sp< TextureProxy > refProxy() const
const uint8_t uint32_t uint32_t GError ** error
static float max(float r, float g, float b)
static constexpr int kUnknownRuntimeEffectIDStart
static constexpr skcms_TransferFunction kLinear
unsigned useCenter Optional< SkMatrix > matrix
sk_sp< const SkImage > image
PODArray< SkColor > colors
SkSamplingOptions sampling
SK_API sk_sp< SkImage > AsImage(sk_sp< const SkSurface >)
static DlImageSampling kNearestSampling
void AddToKey(const KeyContext &keyContext, PaintParamsKeyBuilder *builder, PipelineDataGatherer *gatherer, const SkBlender *blender)
void AddKnownModeBlend(const KeyContext &keyContext, PaintParamsKeyBuilder *builder, PipelineDataGatherer *gatherer, SkBlendMode bm)
@ kConicalGradientShader8
@ kConicalGradientShaderBuffer
@ kSweepGradientShaderTexture
@ kSweepGradientShaderBuffer
@ kConicalGradientShader4
@ kLinearGradientShaderTexture
@ kRadialGradientShaderBuffer
@ kColorSpaceXformColorFilter
@ kConicalGradientShaderTexture
@ kLinearGradientShaderBuffer
@ kRadialGradientShaderTexture
void AddBlendModeColorFilter(const KeyContext &keyContext, PaintParamsKeyBuilder *builder, PipelineDataGatherer *gatherer, SkBlendMode bm, const SkPMColor4f &srcColor)
static bool can_do_yuv_tiling_in_hw(const Caps *caps, const YUVImageShaderBlock::ImageData &imgData)
void Compose(const KeyContext &keyContext, PaintParamsKeyBuilder *keyBuilder, PipelineDataGatherer *gatherer, AddToKeyFn addInnerToKey, AddToKeyFn addOuterToKey)
static void notify_in_use(Recorder *recorder, DrawContext *drawContext, const SkBlendShader *shader)
static void add_yuv_image_to_key(const KeyContext &keyContext, PaintParamsKeyBuilder *builder, PipelineDataGatherer *gatherer, const SkImageShader *origShader, sk_sp< const SkImage > imageToDraw, SkSamplingOptions sampling)
static SkBitmap create_color_and_offset_bitmap(int numStops, const SkPMColor4f *colors, const float *offsets)
std::pair< sk_sp< SkImage >, SkSamplingOptions > GetGraphiteBacked(Recorder *recorder, const SkImage *imageIn, SkSamplingOptions sampling)
static void make_interpolated_to_dst(const KeyContext &keyContext, PaintParamsKeyBuilder *builder, PipelineDataGatherer *gatherer, const GradientShaderBlocks::GradientData &gradData, const SkGradientShader::Interpolation &interp, SkColorSpace *intermediateCS)
static void add_to_key(const KeyContext &keyContext, PaintParamsKeyBuilder *builder, PipelineDataGatherer *gatherer, const SkBlendModeColorFilter *filter)
void Blend(const KeyContext &keyContext, PaintParamsKeyBuilder *keyBuilder, PipelineDataGatherer *gatherer, AddToKeyFn addBlendToKey, AddToKeyFn addSrcToKey, AddToKeyFn addDstToKey)
static int write_color_and_offset_bufdata(int numStops, const SkPMColor4f *colors, const float *offsets, const SkGradientBaseShader *shader, PipelineDataGatherer *gatherer)
static void add_gradient_to_key(const KeyContext &keyContext, PaintParamsKeyBuilder *builder, PipelineDataGatherer *gatherer, const SkGradientBaseShader *shader, SkPoint point0, SkPoint point1, float radius0, float radius1, float bias, float scale)
static skgpu::graphite::ReadSwizzle swizzle_class_to_read_enum(const skgpu::Swizzle &swizzle)
void AddModeBlend(const KeyContext &keyContext, PaintParamsKeyBuilder *builder, PipelineDataGatherer *gatherer, SkBlendMode bm)
static void gather_runtime_effect_uniforms(const KeyContext &keyContext, const SkRuntimeEffect *effect, SkSpan< const Uniform > graphiteUniforms, const SkData *uniformData, PipelineDataGatherer *gatherer)
static SkPMColor4f map_color(const SkColor4f &c, SkColorSpace *src, SkColorSpace *dst)
static bool skdata_matches(const SkData *a, const SkData *b)
TextureProxyView AsView(const SkImage *image)
void NotifyImagesInUse(Recorder *recorder, DrawContext *drawContext, const SkBlender *blender)
SkSamplingOptions(SkFilterMode::kLinear))
SIN Vec< N, float > abs(const Vec< N, float > &x)
skcms_TFType skcms_TransferFunction_getType(const skcms_TransferFunction *tf)
constexpr int32_t y() const
constexpr int32_t x() const
int32_t fBottom
larger y-axis bounds
int32_t fTop
smaller y-axis bounds
static constexpr SkIRect MakeXYWH(int32_t x, int32_t y, int32_t w, int32_t h)
int32_t fLeft
smaller x-axis bounds
int32_t fRight
larger x-axis bounds
constexpr int32_t width() const
constexpr int32_t height() const
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)
static CachedImageInfo Make(const SkRect &bounds, const SkMatrix &totalM, SkColorType dstColorType, SkColorSpace *dstColorSpace, const int maxTextureSize, const SkSurfaceProps &propsIn)
static float Distance(const SkPoint &a, const SkPoint &b)
static SkRect Make(const SkISize &size)
SkScalar fBottom
larger y-axis bounds
bool intersect(const SkRect &r)
SkScalar fLeft
smaller x-axis bounds
SkRect makeOutset(float dx, float dy) const
SkScalar fRight
larger x-axis bounds
bool contains(SkScalar x, SkScalar y) const
void roundOut(SkIRect *dst) const
SkScalar fTop
smaller y-axis bounds
const SkFilterMode filter
const SkMipmapMode mipmap
static constexpr SkSize Make(SkScalar w, SkScalar h)
const float * ptr() const
static void AddBlock(const KeyContext &, PaintParamsKeyBuilder *, PipelineDataGatherer *)
static void AddBlock(const KeyContext &, PaintParamsKeyBuilder *, PipelineDataGatherer *, SkBlendMode)
static void BeginBlock(const KeyContext &, PaintParamsKeyBuilder *, PipelineDataGatherer *)
static void BeginBlock(const KeyContext &, PaintParamsKeyBuilder *, PipelineDataGatherer *)
static void AddBlock(const KeyContext &, PaintParamsKeyBuilder *, PipelineDataGatherer *, SkSpan< const float > coeffs)
static void BeginBlock(const KeyContext &, PaintParamsKeyBuilder *, PipelineDataGatherer *)
static void BeginBlock(const KeyContext &, PaintParamsKeyBuilder *, PipelineDataGatherer *, const CoordClampData &)
static void AddBlock(const KeyContext &, PaintParamsKeyBuilder *, PipelineDataGatherer *, const DitherData &)
static void AddBlock(const KeyContext &, PaintParamsKeyBuilder *, PipelineDataGatherer *, sk_sp< TextureProxy > dst, SkIPoint dstOffset)
const SkGradientBaseShader * fSrcShader
const SkPMColor4f * fSrcColors
SkPMColor4f fColors[kNumInternalStorageStops]
sk_sp< TextureProxy > fColorsAndOffsetsProxy
GradientData(SkShaderBase::GradientType, int numStops, bool useStorageBuffer)
const float * fSrcOffsets
SkShaderBase::GradientType fType
static constexpr int kNumInternalStorageStops
SkV4 fOffsets[kNumInternalStorageStops/4]
static void AddBlock(const KeyContext &, PaintParamsKeyBuilder *, PipelineDataGatherer *, const GradientData &)
sk_sp< TextureProxy > fTextureProxy
ImageData(const SkSamplingOptions &sampling, SkTileMode tileModeX, SkTileMode tileModeY, SkISize imgSize, SkRect subset, ReadSwizzle readSwizzle)
SkColorSpaceXformSteps fSteps
SkSamplingOptions fSampling
static void AddBlock(const KeyContext &, PaintParamsKeyBuilder *, PipelineDataGatherer *, const ImageData &)
static void BeginBlock(const KeyContext &, PaintParamsKeyBuilder *, PipelineDataGatherer *, const LMShaderData &)
static void AddBlock(const KeyContext &, PaintParamsKeyBuilder *, PipelineDataGatherer *, const MatrixColorFilterData &)
sk_sp< TextureProxy > fPermutationsProxy
sk_sp< TextureProxy > fNoiseProxy
static void AddBlock(const KeyContext &, PaintParamsKeyBuilder *, PipelineDataGatherer *, const PerlinNoiseData &)
static void AddBlock(const KeyContext &, PaintParamsKeyBuilder *, PipelineDataGatherer *)
sk_sp< const SkRuntimeEffect > fEffect
sk_sp< const SkData > fUniforms
ShaderData(sk_sp< const SkRuntimeEffect > effect)
bool operator==(const ShaderData &rhs) const
static void BeginBlock(const KeyContext &, PaintParamsKeyBuilder *, PipelineDataGatherer *, const ShaderData &)
SkSpan< const Uniform > fUniforms
static void AddBlock(const KeyContext &, PaintParamsKeyBuilder *, PipelineDataGatherer *, const SkPMColor4f &)
static void AddBlock(const KeyContext &, PaintParamsKeyBuilder *, PipelineDataGatherer *, const TableColorFilterData &)
SkSamplingOptions fSampling
SkPoint3 fYUVtoRGBTranslate
SkPoint fLinearFilterUVInset
SkSamplingOptions fSamplingUV
ImageData(const SkSamplingOptions &sampling, SkTileMode tileModeX, SkTileMode tileModeY, SkISize imgSize, SkRect subset)
sk_sp< TextureProxy > fTextureProxies[4]
static void AddBlock(const KeyContext &, PaintParamsKeyBuilder *, PipelineDataGatherer *, const ImageData &)
std::shared_ptr< const fml::Mapping > data