| 1 |
/* |
| 2 |
* Copyright 2022 Google LLC |
| 3 |
* |
| 4 |
* Use of this source code is governed by a BSD-style license that can be |
| 5 |
* found in the LICENSE file. |
| 6 |
*/ |
| 7 |
|
| 8 |
#ifndef skgpu_graphite_render_BitmapTextRenderStep_DEFINED |
| 9 |
#define skgpu_graphite_render_BitmapTextRenderStep_DEFINED |
| 10 |
|
| 11 |
#include "src/base/SkEnumBitMask.h" |
| 12 |
#include "src/base/SkVx.h" |
| 13 |
#include "src/gpu/graphite/Renderer.h" |
| 14 |
|
| 15 |
#include <string> |
| 16 |
|
| 17 |
namespace skgpu { |
| 18 |
enum class MaskFormat : int; |
| 19 |
} |
| 20 |
|
| 21 |
namespace skgpu::graphite { |
| 22 |
|
| 23 |
class DrawParams; |
| 24 |
class DrawWriter; |
| 25 |
class PipelineDataGatherer; |
| 26 |
struct ResourceBindingRequirements; |
| 27 |
|
| 28 |
class BitmapTextRenderStep final : public RenderStep { |
| 29 |
public: |
| 30 |
BitmapTextRenderStep(Layout, skgpu::MaskFormat variant); |
| 31 |
|
| 32 |
~BitmapTextRenderStep() override; |
| 33 |
|
| 34 |
std::string vertexSkSL() const override; |
| 35 |
std::string texturesAndSamplersSkSL(const ResourceBindingRequirements&, |
| 36 |
int* nextBindingIndex) const override; |
| 37 |
// For a given BitmapTextRenderStep instance, |
| 38 |
// we will only use either fragmentColorSkSL() (for color text) |
| 39 |
// or fragmentCoverageSKSL() (for grayscale and LCD masks), never both. |
| 40 |
const char* fragmentColorSkSL() const override; |
| 41 |
const char* fragmentCoverageSkSL() const override; |
| 42 |
bool usesUniformsInFragmentSkSL() const override; |
| 43 |
|
| 44 |
void writeVertices(DrawWriter*, const DrawParams&, uint32_t ssboIndex) const override; |
| 45 |
void writeUniformsAndTextures(const DrawParams&, PipelineDataGatherer*) const override; |
| 46 |
|
| 47 |
private: |
| 48 |
static SkEnumBitMask<Flags> Flags(skgpu::MaskFormat); |
| 49 |
}; |
| 50 |
|
| 51 |
} // namespace skgpu::graphite |
| 52 |
|
| 53 |
#endif // skgpu_graphite_render_BitmapTextRenderStep_DEFINED |