25#if defined(SK_GAMMA_APPLY_TO_A8)
35constexpr int kNumSDFAtlasTextures = 4;
68 return "texIndex = half(indexAndFlags.x);"
69 "float4 devPosition = text_vertex_fn(float2(sk_VertexID >> 1, sk_VertexID & 1), "
70 "subRunDeviceMatrix, "
76 "strikeToSourceScale, "
87 for (
unsigned int i = 0;
i < kNumSDFAtlasTextures; ++
i) {
104 static_assert(kNumSDFAtlasTextures == 4);
105 return "outputCoverage = sdf_text_coverage_fn(sample_indexed_atlas(textureCoords, "
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);
147 float gammaAdjustment = 0;
149#if defined(SK_GAMMA_APPLY_TO_A8)
153 subRunData.luminanceColor());
154 gammaAdjustment = dfAdjustTable->getAdjustment(
lum, subRunData.useGammaCorrectDistanceTable());
156 SkV2 gammaParams = {gammaAdjustment, subRunData.useGammaCorrectDistanceTable() ? 1.f : 0.f};
162 for (
unsigned int i = 0;
i < numProxies; ++
i) {
163 gatherer->add(proxies[
i], {kSamplingOptions, kTileModes});
166 for (
unsigned int i = numProxies;
i < kNumSDFAtlasTextures; ++
i) {
167 gatherer->add(proxies[0], {kSamplingOptions, kTileModes});
SkDEBUGCODE(SK_SPI) SkThreadID SkGetThreadID()
#define SK_GAMMA_EXPONENT
static U8CPU computeLuminance(SkScalar gamma, SkColor c)
TextAtlasManager * textAtlasManager() const
void writeHalf(const T &t)
AtlasProvider * atlasProvider()
SkSpan< const Uniform > uniforms() const
~SDFTextRenderStep() override
std::string vertexSkSL() const override
void writeUniformsAndTextures(const DrawParams &, PipelineDataGatherer *) const override
std::string texturesAndSamplersSkSL(const ResourceBindingRequirements &, int *nextBindingIndex) const override
const char * fragmentCoverageSkSL() const override
void writeVertices(DrawWriter *, const DrawParams &, skvx::ushort2 ssboIndices) 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
static float lum(float r, float g, float b)
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)