32constexpr int kNumSDFAtlasTextures = 4;
67 return "texIndex = half(indexAndFlags.x);"
68 "float4 devPosition = text_vertex_fn(float2(sk_VertexID >> 1, sk_VertexID & 1), "
69 "subRunDeviceMatrix, "
75 "strikeToSourceScale, "
86 for (
unsigned int i = 0;
i < kNumSDFAtlasTextures; ++
i) {
103 static_assert(kNumSDFAtlasTextures == 4);
104 return "outputCoverage = sdf_text_lcd_coverage_fn(textureCoords, "
105 "pixelGeometryDelta, "
125 params.order().depthAsFloat());
133 unsigned int numProxies;
134 Recorder* recorder = subRunData.recorder();
137 subRunData.subRun()->maskFormat(), &numProxies);
138 SkASSERT(proxies && numProxies > 0);
142 gatherer->
write(subRunData.deviceToLocal());
143 SkV2 atlasDimensionsInverse = {1.f/proxies[0]->dimensions().width(),
144 1.f/proxies[0]->dimensions().height()};
145 gatherer->
write(atlasDimensionsInverse);
148 SkV2 pixelGeometryDelta = {0, 0};
150 pixelGeometryDelta = {1.f/(3*proxies[0]->dimensions().width()), 0};
152 pixelGeometryDelta = {0, 1.f/(3*proxies[0]->dimensions().height())};
155 pixelGeometryDelta = -pixelGeometryDelta;
161 float redCorrection = dfAdjustTable->getAdjustment(
SkColorGetR(subRunData.luminanceColor()),
162 subRunData.useGammaCorrectDistanceTable());
163 float greenCorrection = dfAdjustTable->getAdjustment(
SkColorGetG(subRunData.luminanceColor()),
164 subRunData.useGammaCorrectDistanceTable());
165 float blueCorrection = dfAdjustTable->getAdjustment(
SkColorGetB(subRunData.luminanceColor()),
166 subRunData.useGammaCorrectDistanceTable());
167 SkV4 gammaParams = {redCorrection, greenCorrection, blueCorrection,
168 subRunData.useGammaCorrectDistanceTable() ? 1.f : 0.f};
174 for (
unsigned int i = 0;
i < numProxies; ++
i) {
175 gatherer->add(proxies[
i], {kSamplingOptions, kTileModes});
178 for (
unsigned int i = numProxies;
i < kNumSDFAtlasTextures; ++
i) {
179 gatherer->add(proxies[0], {kSamplingOptions, kTileModes});
#define SkColorGetR(color)
#define SkColorGetG(color)
#define SkColorGetB(color)
static bool SkPixelGeometryIsH(SkPixelGeometry geo)
static bool SkPixelGeometryIsBGR(SkPixelGeometry geo)
static bool SkPixelGeometryIsV(SkPixelGeometry geo)
SkDEBUGCODE(SK_SPI) SkThreadID SkGetThreadID()
TextAtlasManager * textAtlasManager() const
void writeHalf(const T &t)
AtlasProvider * atlasProvider()
SkSpan< const Uniform > uniforms() const
std::string texturesAndSamplersSkSL(const ResourceBindingRequirements &, int *nextBindingIndex) const override
void writeVertices(DrawWriter *, const DrawParams &, skvx::ushort2 ssboIndices) const override
const char * fragmentCoverageSkSL() const override
~SDFTextLCDRenderStep() override
void writeUniformsAndTextures(const DrawParams &, PipelineDataGatherer *) const override
std::string vertexSkSL() const override
const sktext::gpu::AtlasSubRun * subRun() const
int startGlyphIndex() const
const sk_sp< TextureProxy > * getProxies(MaskFormat format, unsigned int *numActiveProxies)
virtual const VertexFiller & vertexFiller() const =0
virtual unsigned short instanceFlags() const =0
virtual SkSpan< const Glyph * > glyphs() const =0
static const DistanceFieldAdjustTable * Get()
void fillInstanceData(skgpu::graphite::DrawWriter *dw, int offset, int count, unsigned short flags, skvx::ushort2 ssboIndex, SkSpan< const Glyph * > glyphs, SkScalar depth) const
const EmbeddedViewParams * params
std::string void appendf(std::string *str, const char *fmt,...) SK_PRINTF_LIKE(2
static constexpr DepthStencilSettings kDirectDepthGEqualPass
std::string EmitSamplerLayout(const ResourceBindingRequirements &bindingReqs, int *binding)