56 return 0xff000000 |
color;
61 fuzz->
next(&makeOpaque);
103 uint32_t xferFunction;
104 fuzz->
next(&xferFunction);
105 xferFunction %=
std::size(gTransferFunctions);
106 return gTransferFunctions[xferFunction];
124enum class ColorSpaceType {
133static constexpr int kColorSpaceTypeCount =
static_cast<int>(ColorSpaceType::kLast) + 1;
139 case ColorSpaceType::kSRGB:
141 case ColorSpaceType::kSRGBLinear:
143 case ColorSpaceType::kRGB:
153 ColorSpaceType csType = (ColorSpaceType) (temp % kColorSpaceTypeCount);
155 return create_colorspace(fuzz, csType);
161enum class ColorFilterType {
171static constexpr int kColorFilterTypeCount =
static_cast<int>(ColorFilterType::kLast) + 1;
182 create_random_colorspace(fuzz),
183 random_blend_mode(fuzz));
209 ColorFilterType
type,
217 return {
nullptr,
nullptr };
218 case ColorFilterType::kBlend:
219 return create_blend_colorfilter(fuzz);
220 case ColorFilterType::kMatrix:
221 return create_matrix_colorfilter();
222 case ColorFilterType::kHSLAMatrix:
223 return create_hsla_matrix_colorfilter();
235 ColorFilterType cf = (ColorFilterType) (temp % kColorFilterTypeCount);
237 return create_colorfilter(fuzz, cf, depth);
241std::pair<SkPaint, PaintOptions> create_random_paint(
Fuzz* fuzz,
int depth) {
247 paint.setColor(random_opaque_skcolor(fuzz));
252 auto [cf, o] = create_random_colorfilter(fuzz, depth - 1);
256 paint.setColorFilter(std::move(cf));
261 return {
paint, paintOptions };
265void check_draw(
Context* context,
291 std::unique_ptr<skgpu::graphite::Recording> recording = recorder->
snap();
293 context->
submit(SyncToCpu::kYes);
303void fuzz_graphite(
Fuzz* fuzz,
Context* context,
int depth = 9) {
310 std::unique_ptr<RuntimeEffectDictionary> rtDict = std::make_unique<RuntimeEffectDictionary>();
328 "FuzzPrecompileFakeDstTexture",
341 auto [
paint, paintOptions] = create_random_paint(fuzz, depth);
343 constexpr Coverage coverageOptions[3] = {
356 bool needsDstSample = dstReadReq == DstReadRequirement::kTextureCopy ||
357 dstReadReq == DstReadRequirement::kTextureSample;
375 std::vector<UniquePaintParamsID> precompileIDs;
385 precompileIDs.push_back(
id);
390 auto result =
std::find(precompileIDs.begin(), precompileIDs.end(), paintID);
393 if (
result == precompileIDs.end()) {
397 SkDebugf(
"From combination builder:");
398 for (
auto iter : precompileIDs) {
416 check_draw(context, recorder.get(),
paint, kDrawType,
path);
428#elif defined(SK_VULKAN)
440 fuzz_graphite(fuzz, context);
DEF_FUZZ(Precompile, fuzz)
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
#define SkASSERT_RELEASE(cond)
static constexpr int kSkBlendModeCount
SkBlenderBase * as_BB(SkBlender *blend)
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
@ kJPEG_Full_SkYUVColorSpace
describes full range
int find(T *array, int N, T item)
void nextRange(T *, Min, Max)
virtual std::optional< SkBlendMode > asBlendMode() const
void drawRect(const SkRect &rect, const SkPaint &paint)
void drawPath(const SkPath &path, const SkPaint &paint)
static sk_sp< SkColorFilter > Blend(const SkColor4f &c, sk_sp< SkColorSpace >, SkBlendMode mode)
static sk_sp< SkColorFilter > Matrix(const SkColorMatrix &)
static sk_sp< SkColorFilter > HSLAMatrix(const SkColorMatrix &)
static SkColorMatrix RGBtoYUV(SkYUVColorSpace)
static sk_sp< SkColorSpace > MakeSRGB()
static sk_sp< SkColorSpace > MakeRGB(const skcms_TransferFunction &transferFn, const skcms_Matrix3x3 &toXYZ)
static sk_sp< SkColorSpace > MakeSRGBLinear()
virtual TextureInfo getDefaultSampledTextureInfo(SkColorType, Mipmapped mipmapped, Protected, Renderable) const =0
const GlobalCache * globalCache() const
const ShaderCodeDictionary * shaderCodeDictionary() const
BackendApi backend() const
std::unique_ptr< Recorder > makeRecorder(const RecorderOptions &={})
bool submit(SyncToCpu=SyncToCpu::kNo)
bool insertRecording(const InsertRecordingInfo &)
void buildCombinations(const KeyContext &keyContext, PipelineDataGatherer *gatherer, DrawTypeFlags drawTypes, bool withPrimitiveBlender, Coverage coverage, const ProcessCombination &processCombination) const
void setColorFilters(SkSpan< const sk_sp< PrecompileColorFilter > > colorFilters)
const Caps * caps() const
ResourceProvider * resourceProvider()
std::unique_ptr< Recording > snap()
ContextInfo getContextInfo(skgpu::ContextType)
static const skcms_Matrix3x3 gGamuts[]
SK_API sk_sp< SkDocument > Make(SkWStream *dst, const SkSerialProcs *=nullptr, std::function< void(const SkPicture *)> onEndPage=nullptr)
static constexpr skcms_Matrix3x3 kSRGB
static constexpr skcms_Matrix3x3 kAdobeRGB
static constexpr skcms_Matrix3x3 kXYZ
static constexpr skcms_Matrix3x3 kRec2020
static constexpr skcms_Matrix3x3 kDisplayP3
static constexpr skcms_TransferFunction kRec2020
static constexpr skcms_TransferFunction k2Dot2
static constexpr skcms_TransferFunction kSRGB
static constexpr skcms_TransferFunction kHLG
static constexpr skcms_TransferFunction kPQ
static constexpr skcms_TransferFunction kLinear
SK_API sk_sp< SkSurface > RenderTarget(GrRecordingContext *context, skgpu::Budgeted budgeted, const SkImageInfo &imageInfo, int sampleCount, GrSurfaceOrigin surfaceOrigin, const SkSurfaceProps *surfaceProps, bool shouldCreateWithMips=false, bool isProtected=false)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
SK_API sk_sp< PrecompileColorFilter > HSLAMatrix()
SK_API sk_sp< PrecompileColorFilter > Matrix()
DstReadRequirement GetDstReadRequirement(const Caps *caps, std::optional< SkBlendMode > blendMode, Coverage coverage)
void Precompile(Context *context, const PaintOptions &paintOptions, DrawTypeFlags drawTypes=kMostCommon)
std::tuple< UniquePaintParamsID, const UniformDataBlock *, const TextureDataBlock * > ExtractPaintData(Recorder *recorder, PipelineDataGatherer *gatherer, PaintParamsKeyBuilder *builder, const Layout layout, const SkM44 &local2Dev, const PaintParams &p, const Geometry &geometry, sk_sp< TextureProxy > dstTexture, SkIPoint dstOffset, const SkColorInfo &targetColorInfo)
@ kVulkan
ANGLE on Metal ES 3 context.
@ kMock
Dawn on OpenGL ES.
static SkPath make_path()
static constexpr SkIPoint Make(int32_t x, int32_t y)
static constexpr SkISize Make(int32_t w, int32_t h)
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)
static constexpr SkRect MakeWH(float w, float h)
skgpu::graphite::Context * fContext