summaryrefslogtreecommitdiffstats
path: root/gfx/skia/skia/include/gpu/graphite/ContextOptions.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /gfx/skia/skia/include/gpu/graphite/ContextOptions.h
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'gfx/skia/skia/include/gpu/graphite/ContextOptions.h')
-rw-r--r--gfx/skia/skia/include/gpu/graphite/ContextOptions.h87
1 files changed, 87 insertions, 0 deletions
diff --git a/gfx/skia/skia/include/gpu/graphite/ContextOptions.h b/gfx/skia/skia/include/gpu/graphite/ContextOptions.h
new file mode 100644
index 0000000000..2838f10b0d
--- /dev/null
+++ b/gfx/skia/skia/include/gpu/graphite/ContextOptions.h
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef skgpu_graphite_ContextOptions_DEFINED
+#define skgpu_graphite_ContextOptions_DEFINED
+
+namespace skgpu { class ShaderErrorHandler; }
+
+namespace skgpu::graphite {
+
+struct SK_API ContextOptions {
+ ContextOptions() {}
+
+ /**
+ * Disables correctness workarounds that are enabled for particular GPUs, OSes, or drivers.
+ * This does not affect code path choices that are made for perfomance reasons nor does it
+ * override other ContextOption settings.
+ */
+ bool fDisableDriverCorrectnessWorkarounds = false;
+
+ /**
+ * If present, use this object to report shader compilation failures. If not, report failures
+ * via SkDebugf and assert.
+ */
+ skgpu::ShaderErrorHandler* fShaderErrorHandler = nullptr;
+
+ /**
+ * Will the client make sure to only ever be executing one thread that uses the Context and all
+ * derived classes (e.g. Recorders, Recordings, etc.) at a time. If so we can possibly make some
+ * objects (e.g. VulkanMemoryAllocator) not thread safe to improve single thread performance.
+ */
+ bool fClientWillExternallySynchronizeAllThreads = false;
+
+ /**
+ * The maximum size of cache textures used for Skia's Glyph cache.
+ */
+ size_t fGlyphCacheTextureMaximumBytes = 2048 * 1024 * 4;
+
+ /**
+ * Below this threshold size in device space distance field fonts won't be used. Distance field
+ * fonts don't support hinting which is more important at smaller sizes.
+ */
+ float fMinDistanceFieldFontSize = 18;
+
+ /**
+ * Above this threshold size in device space glyphs are drawn as individual paths.
+ */
+#if defined(SK_BUILD_FOR_ANDROID)
+ float fGlyphsAsPathsFontSize = 384;
+#elif defined(SK_BUILD_FOR_MAC)
+ float fGlyphsAsPathsFontSize = 256;
+#else
+ float fGlyphsAsPathsFontSize = 324;
+#endif
+
+ /**
+ * Can the glyph atlas use multiple textures. If allowed, the each texture's size is bound by
+ * fGlypheCacheTextureMaximumBytes.
+ */
+ bool fAllowMultipleGlyphCacheTextures = true;
+ bool fSupportBilerpFromGlyphAtlas = false;
+
+#if GRAPHITE_TEST_UTILS
+ /**
+ * Private options that are only meant for testing within Skia's tools.
+ */
+
+ /**
+ * Maximum width and height of internal texture atlases.
+ */
+ int fMaxTextureAtlasSize = 2048;
+
+ /**
+ * If true, will store a pointer in Recorder that points back to the Context
+ * that created it. Used by readPixels() and other methods that normally require a Context.
+ */
+ bool fStoreContextRefInRecorder = false;
+#endif
+};
+
+} // namespace skgpu::graphite
+
+#endif // skgpu_graphite_ContextOptions