@shopify/react-native-skia 2.6.0 → 2.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/CMakeLists.txt +0 -1
- package/android/cpp/jni/JniWebGPUView.cpp +3 -3
- package/android/cpp/rnskia-android/OpenGLContext.h +4 -5
- package/android/cpp/rnskia-android/RNSkAndroidPlatformContext.h +1 -1
- package/apple/MetalContext.h +5 -6
- package/apple/MetalWindowContext.mm +3 -4
- package/apple/RNSkApplePlatformContext.h +1 -1
- package/apple/RNSkApplePlatformContext.mm +4 -3
- package/apple/SkiaCVPixelBufferUtils.h +1 -1
- package/apple/SkiaCVPixelBufferUtils.mm +31 -30
- package/apple/SkiaPlatformContext.mm +2 -2
- package/apple/SkiaUIView.mm +1 -1
- package/apple/SkiaWebGPUView.mm +8 -4
- package/apple/WebGPUMetalView.h +1 -1
- package/apple/WebGPUMetalView.mm +1 -1
- package/cpp/api/JsiSkColor.h +8 -4
- package/cpp/api/JsiSkContourMeasure.h +4 -3
- package/cpp/api/JsiSkImage.h +17 -9
- package/cpp/api/JsiSkParagraphBuilder.h +14 -1
- package/cpp/api/JsiSkPath.h +71 -81
- package/cpp/api/JsiSkPathEffectFactory.h +2 -1
- package/cpp/api/JsiSkPathFactory.h +48 -52
- package/cpp/api/JsiSkShader.h +1 -1
- package/cpp/api/JsiSkShaderFactory.h +50 -26
- package/cpp/api/JsiSkSurfaceFactory.h +2 -1
- package/cpp/api/recorder/Drawings.h +5 -7
- package/cpp/api/recorder/Shaders.h +77 -22
- package/cpp/jsi2/JSIConverter.h +1 -1
- package/cpp/rnskia/RNDawnContext.h +14 -15
- package/cpp/rnskia/RNDawnUtils.h +14 -17
- package/cpp/rnskia/RNDawnWindowContext.h +1 -1
- package/cpp/rnskia/RNSkManager.cpp +5 -4
- package/cpp/rnskia/RNSkPlatformContext.h +2 -2
- package/cpp/rnwgpu/api/GPU.cpp +21 -0
- package/cpp/rnwgpu/api/GPUCanvasContext.cpp +1 -1
- package/cpp/rnwgpu/api/GPUCanvasContext.h +2 -2
- package/cpp/rnwgpu/api/GPUFeatures.h +0 -9
- package/cpp/rnwgpu/api/GPUTexture.h +14 -2
- package/cpp/rnwgpu/api/GPUUncapturedErrorEvent.h +3 -4
- package/cpp/rnwgpu/api/RNWebGPU.h +1 -1
- package/cpp/rnwgpu/api/descriptors/Unions.h +0 -15
- package/cpp/skia/include/android/SkImageAndroid.h +7 -2
- package/cpp/skia/include/android/vk/AndroidVulkanMemoryAllocator.h +31 -0
- package/cpp/skia/include/codec/SkCodec.h +42 -15
- package/cpp/skia/include/config/SkUserConfig.h +8 -0
- package/cpp/skia/include/core/SkBitmap.h +0 -5
- package/cpp/skia/include/core/SkCanvas.h +2 -39
- package/cpp/skia/include/core/SkColor.h +12 -0
- package/cpp/skia/include/core/SkColorSpace.h +9 -0
- package/cpp/skia/include/core/SkContourMeasure.h +1 -5
- package/cpp/skia/include/core/SkData.h +8 -0
- package/cpp/skia/include/core/SkFont.h +1 -55
- package/cpp/skia/include/core/SkFontArguments.h +15 -0
- package/cpp/skia/include/core/SkGraphics.h +0 -5
- package/cpp/skia/include/core/SkImage.h +0 -4
- package/cpp/skia/include/core/SkImageGenerator.h +1 -4
- package/cpp/skia/include/core/SkMatrix.h +0 -37
- package/cpp/skia/include/core/SkMilestone.h +1 -1
- package/cpp/skia/include/core/SkPath.h +11 -911
- package/cpp/skia/include/core/SkPathBuilder.h +42 -32
- package/cpp/skia/include/core/SkPathEffect.h +0 -9
- package/cpp/skia/include/core/SkPathMeasure.h +1 -4
- package/cpp/skia/include/core/SkPathUtils.h +0 -10
- package/cpp/skia/include/core/SkRect.h +0 -12
- package/cpp/skia/include/core/SkRegion.h +1 -6
- package/cpp/skia/include/core/SkSerialProcs.h +4 -5
- package/cpp/skia/include/core/SkSurfaceProps.h +6 -0
- package/cpp/skia/include/core/SkTextBlob.h +0 -22
- package/cpp/skia/include/core/SkTypeface.h +14 -32
- package/cpp/skia/include/core/SkTypes.h +0 -8
- package/cpp/skia/include/docs/SkPDFDocument.h +19 -17
- package/cpp/skia/include/effects/SkDashPathEffect.h +0 -6
- package/cpp/skia/include/effects/SkGradient.h +206 -0
- package/cpp/skia/include/effects/SkHighContrastFilter.h +2 -2
- package/cpp/skia/include/gpu/GpuTypes.h +2 -0
- package/cpp/skia/include/gpu/ganesh/GrBackendSemaphore.h +5 -35
- package/cpp/skia/include/gpu/ganesh/GrBackendSurface.h +7 -106
- package/cpp/skia/include/gpu/ganesh/GrContextOptions.h +0 -11
- package/cpp/skia/include/gpu/ganesh/GrDirectContext.h +0 -9
- package/cpp/skia/include/gpu/ganesh/d3d/GrD3DBackendSemaphore.h +20 -0
- package/cpp/skia/include/gpu/ganesh/d3d/GrD3DBackendSurface.h +59 -0
- package/cpp/skia/include/gpu/ganesh/d3d/GrD3DDirectContext.h +28 -0
- package/cpp/skia/include/gpu/ganesh/gl/GrGLFunctions.h +4 -1
- package/cpp/skia/include/gpu/graphite/ContextOptions.h +4 -20
- package/cpp/skia/include/gpu/graphite/GraphiteTypes.h +32 -46
- package/cpp/skia/include/gpu/graphite/Recorder.h +1 -1
- package/cpp/skia/include/gpu/graphite/Surface.h +31 -0
- package/cpp/skia/include/gpu/graphite/TextureInfo.h +3 -10
- package/cpp/skia/include/gpu/graphite/dawn/DawnGraphiteTypes.h +3 -3
- package/cpp/skia/include/gpu/graphite/mtl/MtlGraphiteTypes.h +1 -1
- package/cpp/skia/include/gpu/graphite/precompile/PrecompileShader.h +6 -6
- package/cpp/skia/include/gpu/graphite/vk/VulkanGraphiteTypes.h +5 -3
- package/cpp/skia/include/gpu/graphite/vk/precompile/VulkanPrecompileShader.h +1 -1
- package/cpp/skia/include/gpu/vk/VulkanBackendContext.h +1 -1
- package/cpp/skia/include/gpu/vk/VulkanPreferredFeatures.h +8 -0
- package/cpp/skia/include/private/SkEncodedInfo.h +43 -105
- package/cpp/skia/include/private/SkHdrMetadata.h +165 -2
- package/cpp/skia/include/private/SkPathRef.h +0 -457
- package/cpp/skia/include/private/base/SkFeatures.h +4 -0
- package/cpp/skia/include/private/base/SkFloatingPoint.h +1 -2
- package/cpp/skia/include/private/base/SkLoadUserConfig.h +2 -1
- package/cpp/skia/include/private/base/SkLog.h +68 -0
- package/cpp/skia/include/private/base/SkLogPriority.h +35 -0
- package/cpp/skia/include/private/base/SkMacros.h +9 -0
- package/cpp/skia/include/private/base/SkTArray.h +1 -1
- package/cpp/skia/include/private/gpu/ganesh/GrD3DTypesMinimal.h +10 -24
- package/cpp/skia/include/utils/SkEventTracer.h +5 -7
- package/cpp/skia/modules/skottie/include/TextShaper.h +0 -7
- package/cpp/skia/modules/skparagraph/include/FontCollection.h +6 -20
- package/cpp/skia/modules/skparagraph/include/ParagraphBuilder.h +0 -6
- package/cpp/skia/modules/skparagraph/include/ParagraphCache.h +4 -19
- package/cpp/skia/modules/skparagraph/include/TypefaceFontProvider.h +2 -3
- package/cpp/skia/modules/skunicode/include/SkUnicode_icu.h +18 -0
- package/cpp/skia/modules/skunicode/include/SkUnicode_libgrapheme.h +19 -0
- package/cpp/skia/src/base/SkMathPriv.h +27 -132
- package/package.json +5 -5
- package/cpp/skia/include/effects/SkGradientShader.h +0 -359
- package/cpp/skia/include/gpu/graphite/LogPriority.h +0 -36
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
#include "include/core/SkRefCnt.h"
|
|
12
12
|
#include "include/core/SkSize.h"
|
|
13
13
|
#include "include/core/SkSpan.h"
|
|
14
|
+
#include "include/gpu/graphite/GraphiteTypes.h"
|
|
14
15
|
#include "include/private/base/SkAPI.h"
|
|
15
16
|
#include "include/private/base/SkMath.h"
|
|
16
17
|
|
|
@@ -45,11 +46,12 @@ struct SK_API ContextOptions {
|
|
|
45
46
|
|
|
46
47
|
/**
|
|
47
48
|
* Specifies the number of samples Graphite should use when performing internal draws with MSAA
|
|
48
|
-
* (hardware capabilities permitting).
|
|
49
|
+
* (hardware capabilities permitting). This represents the maximum that will be used; if a
|
|
50
|
+
* a specific format supports only lower values, those may be used instead.
|
|
49
51
|
*
|
|
50
52
|
* If <= 1, Graphite will disable internal code paths that use multisampling.
|
|
51
53
|
*/
|
|
52
|
-
|
|
54
|
+
SampleCount fInternalMultisampleCount = SampleCount::k4;
|
|
53
55
|
|
|
54
56
|
/**
|
|
55
57
|
* If set, this specifies the max width/height of MSAA textures that Graphite should use for
|
|
@@ -68,13 +70,6 @@ struct SK_API ContextOptions {
|
|
|
68
70
|
*/
|
|
69
71
|
float fMinimumPathSizeForMSAA = 0;
|
|
70
72
|
|
|
71
|
-
/**
|
|
72
|
-
* Will the client make sure to only ever be executing one thread that uses the Context and all
|
|
73
|
-
* derived classes (e.g. Recorders, Recordings, etc.) at a time. If so we can possibly make some
|
|
74
|
-
* objects (e.g. VulkanMemoryAllocator) not thread safe to improve single thread performance.
|
|
75
|
-
*/
|
|
76
|
-
bool fClientWillExternallySynchronizeAllThreads = false;
|
|
77
|
-
|
|
78
73
|
/**
|
|
79
74
|
* The maximum size of cache textures used for Skia's Glyph cache.
|
|
80
75
|
*/
|
|
@@ -140,17 +135,6 @@ struct SK_API ContextOptions {
|
|
|
140
135
|
bool fSetBackendLabels = false;
|
|
141
136
|
#endif
|
|
142
137
|
|
|
143
|
-
/**
|
|
144
|
-
* If Skia is creating a default VMA allocator for the Vulkan backend this value will be used
|
|
145
|
-
* for the preferredLargeHeapBlockSize. If the value is not set, then Skia will use an
|
|
146
|
-
* internally defined default size.
|
|
147
|
-
*
|
|
148
|
-
* However, it is highly discouraged to have Skia make a default allocator (and support for
|
|
149
|
-
* doing so will be removed soon, b/321962001). Instead clients should create their own
|
|
150
|
-
* allocator to pass into Skia where they can fine tune this value themeselves.
|
|
151
|
-
*/
|
|
152
|
-
std::optional<uint64_t> fVulkanVMALargeHeapBlockSize;
|
|
153
|
-
|
|
154
138
|
/**
|
|
155
139
|
* Client-provided context that is passed to the client-provided PipelineCachingCallback
|
|
156
140
|
* and the (deprecated) PipelineCallback.
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
#include "include/gpu/GpuTypes.h"
|
|
15
15
|
|
|
16
16
|
#include <memory>
|
|
17
|
+
#include <string>
|
|
17
18
|
|
|
18
19
|
class SkSurface;
|
|
19
20
|
|
|
@@ -52,16 +53,24 @@ public:
|
|
|
52
53
|
kAddCommandsFailed,
|
|
53
54
|
// Internal failure, shader pipeline compilation failed (driver issue, or disk corruption),
|
|
54
55
|
// state unrecoverable.
|
|
55
|
-
kAsyncShaderCompilesFailed
|
|
56
|
+
kAsyncShaderCompilesFailed,
|
|
57
|
+
// The inserted Recording is out of order from what the Context expects (when
|
|
58
|
+
// `[Context|Recorder]Options::fRequireOrderedRecordings` is true), which can either
|
|
59
|
+
// represent a client synchronization error or an internal failure when a prior dependent
|
|
60
|
+
// Recording failed for some reason, no CB changes but state likely unrecoverable.
|
|
61
|
+
kOutOfOrderRecording,
|
|
56
62
|
};
|
|
57
63
|
|
|
58
|
-
|
|
59
|
-
/*implicit*/
|
|
64
|
+
InsertStatus() : fValue(kSuccess) {}
|
|
65
|
+
/*implicit*/ InsertStatus(V v) : fValue(v) {}
|
|
66
|
+
InsertStatus(V v, std::string message) : fValue(v), fMessage(std::move(message)) {}
|
|
60
67
|
|
|
61
68
|
operator InsertStatus::V() const {
|
|
62
69
|
return fValue;
|
|
63
70
|
}
|
|
64
71
|
|
|
72
|
+
const std::string& message() const { return fMessage; }
|
|
73
|
+
|
|
65
74
|
// Assist migration from old bool return value of insertRecording; kSuccess is true,
|
|
66
75
|
// all other error statuses are false.
|
|
67
76
|
// NOTE: This is intentionally not explicit so that InsertStatus can be assigned correctly to
|
|
@@ -73,6 +82,7 @@ public:
|
|
|
73
82
|
|
|
74
83
|
private:
|
|
75
84
|
V fValue;
|
|
85
|
+
std::string fMessage;
|
|
76
86
|
};
|
|
77
87
|
|
|
78
88
|
/**
|
|
@@ -148,7 +158,7 @@ struct InsertRecordingInfo {
|
|
|
148
158
|
* and the caller can use the callback to know it is safe to free any resources associated with
|
|
149
159
|
* the Recording that they may be holding onto. If the Recording is successfully submitted to the
|
|
150
160
|
* GPU the callback will be called with CallbackResult::kSuccess once the GPU has finished. All
|
|
151
|
-
* other cases where some failure
|
|
161
|
+
* other cases where some failure occurred it will be called with CallbackResult::kFailed.
|
|
152
162
|
*/
|
|
153
163
|
struct InsertFinishInfo {
|
|
154
164
|
InsertFinishInfo() = default;
|
|
@@ -209,50 +219,26 @@ enum class DepthStencilFlags : int {
|
|
|
209
219
|
kDepthStencil = kDepth | kStencil,
|
|
210
220
|
};
|
|
211
221
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
enum V : uint8_t {
|
|
219
|
-
k1 = 1,
|
|
220
|
-
k2 = 2,
|
|
221
|
-
k4 = 4,
|
|
222
|
-
k8 = 8,
|
|
223
|
-
k16 = 16
|
|
224
|
-
};
|
|
225
|
-
|
|
226
|
-
constexpr SampleCount() : fValue(k1) {}
|
|
227
|
-
/*implicit*/ constexpr SampleCount(V v) : fValue(v) {}
|
|
228
|
-
|
|
229
|
-
// Behave like an enum
|
|
230
|
-
constexpr bool operator ==(const SampleCount& o) const { return fValue == o.fValue; }
|
|
231
|
-
constexpr bool operator <(const SampleCount& o) const { return fValue < o.fValue; }
|
|
232
|
-
constexpr bool operator <=(const SampleCount& o) const { return fValue <= o.fValue; }
|
|
233
|
-
constexpr bool operator >(const SampleCount& o) const { return fValue > o.fValue; }
|
|
234
|
-
constexpr bool operator >=(const SampleCount& o) const { return fValue >= o.fValue; }
|
|
235
|
-
|
|
236
|
-
// This needs to be explicit so that ternaries that return constants mixed with variables aren't
|
|
237
|
-
// ambiguous; internal code can cast for switch statements.
|
|
238
|
-
explicit constexpr operator SampleCount::V() const { return fValue; }
|
|
239
|
-
explicit constexpr operator uint8_t() const { return (uint8_t) fValue; }
|
|
240
|
-
explicit constexpr operator unsigned int() const { return (unsigned int) fValue; }
|
|
241
|
-
|
|
242
|
-
// Assist migration from old code that would assign integers to sample count fields that used
|
|
243
|
-
// to be uint8_t and are now more strictly typed to SampleCount. Asserts if the value doesn't
|
|
244
|
-
// match a SampleCount value.
|
|
245
|
-
/*implicit*/ constexpr SampleCount(uint8_t v) : fValue((V) v) {
|
|
246
|
-
SkASSERT(v == 1 || v == 2 || v == 4 || v == 8 || v == 16);
|
|
247
|
-
}
|
|
248
|
-
constexpr SampleCount& operator=(uint8_t sampleCount) {
|
|
249
|
-
return (*this = SampleCount(sampleCount));
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
private:
|
|
253
|
-
V fValue;
|
|
222
|
+
enum class SampleCount : uint8_t {
|
|
223
|
+
k1 = 1,
|
|
224
|
+
k2 = 2,
|
|
225
|
+
k4 = 4,
|
|
226
|
+
k8 = 8,
|
|
227
|
+
k16 = 16
|
|
254
228
|
};
|
|
255
229
|
|
|
230
|
+
/**
|
|
231
|
+
* Convert an integer value to a strictly typed SampleCount value, rounding down to the lowest
|
|
232
|
+
* valid sample count if needed if `sampleCount` is not already equivalent.
|
|
233
|
+
*/
|
|
234
|
+
constexpr SampleCount ToSampleCount(uint32_t sampleCount) {
|
|
235
|
+
return sampleCount >= 16 ? SampleCount::k16 :
|
|
236
|
+
sampleCount >= 8 ? SampleCount::k8 :
|
|
237
|
+
sampleCount >= 4 ? SampleCount::k4 :
|
|
238
|
+
sampleCount >= 2 ? SampleCount::k2 :
|
|
239
|
+
SampleCount::k1;
|
|
240
|
+
}
|
|
241
|
+
|
|
256
242
|
/*
|
|
257
243
|
* This enum allows mapping from a set of observed RenderSteps (e.g., from a GraphicsPipeline
|
|
258
244
|
* printout) to the correct 'drawTypes' parameter needed by the Precompilation API.
|
|
@@ -291,7 +291,7 @@ private:
|
|
|
291
291
|
|
|
292
292
|
// NOTE: These are stored by pointer to allow them to be forward declared.
|
|
293
293
|
std::unique_ptr<TaskList> fRootTaskList;
|
|
294
|
-
// Aggregated one-time uploads that
|
|
294
|
+
// Aggregated one-time uploads that precede all tasks in the root task list.
|
|
295
295
|
std::unique_ptr<UploadList> fRootUploads;
|
|
296
296
|
|
|
297
297
|
std::unique_ptr<DrawBufferManager> fDrawBufferManager;
|
|
@@ -76,6 +76,8 @@ SK_API sk_sp<SkSurface> RenderTarget(skgpu::graphite::Recorder*,
|
|
|
76
76
|
* configuration, then the recorder must support sRGB, and colorSpace must be present. Further,
|
|
77
77
|
* backendTexture's width and height must not exceed the recorder's capabilities, and the
|
|
78
78
|
* recorder must be able to support the back-end texture.
|
|
79
|
+
*
|
|
80
|
+
* DEPRECATED: Use WrapBackendTexture that does not take a `colorType`.
|
|
79
81
|
*/
|
|
80
82
|
SK_API sk_sp<SkSurface> WrapBackendTexture(skgpu::graphite::Recorder*,
|
|
81
83
|
const skgpu::graphite::BackendTexture&,
|
|
@@ -85,6 +87,35 @@ SK_API sk_sp<SkSurface> WrapBackendTexture(skgpu::graphite::Recorder*,
|
|
|
85
87
|
TextureReleaseProc = nullptr,
|
|
86
88
|
ReleaseContext = nullptr,
|
|
87
89
|
std::string_view label = {});
|
|
90
|
+
/**
|
|
91
|
+
* Wraps a GPU-backed texture in an SkSurface. Depending on the backend gpu API, the caller may
|
|
92
|
+
* be required to ensure the texture is valid for the lifetime of the returned SkSurface. The
|
|
93
|
+
* required lifetimes for the specific apis are:
|
|
94
|
+
* Metal: Skia will call retain on the underlying MTLTexture so the caller can drop it once
|
|
95
|
+
* this call returns.
|
|
96
|
+
*
|
|
97
|
+
* SkSurface is returned if all the parameters are valid. The backendTexture is valid if its
|
|
98
|
+
* format and dimensions are supported by the context that created the recorder. The color type
|
|
99
|
+
* reported by the SkSurface's image info is inferred from backend texture's format, matching as
|
|
100
|
+
* closely as possible when a texture format is not representable exactly as an SkColorType. This
|
|
101
|
+
* is fine as the SkColorType represents the data layout were the texture to be read to CPU memory.
|
|
102
|
+
*
|
|
103
|
+
* For single-channel texture formats, the alpha-only SkColorType is selected as that is more
|
|
104
|
+
* consistently defined for data types. The implication of this is that the alpha channel output
|
|
105
|
+
* from fragment shading will be what's stored in the texture, regardless of whether its format was
|
|
106
|
+
* A or R.
|
|
107
|
+
*
|
|
108
|
+
* For other formats and color types, the ambiguities between BGR and RGB channel order are
|
|
109
|
+
* irrelevant for rendering and sampling on the GPU. Those swizzles can reliably be handled by the
|
|
110
|
+
* hardware and there's no semantic change for the related SkColorTypes.
|
|
111
|
+
*/
|
|
112
|
+
SK_API sk_sp<SkSurface> WrapBackendTexture(skgpu::graphite::Recorder*,
|
|
113
|
+
const skgpu::graphite::BackendTexture&,
|
|
114
|
+
sk_sp<SkColorSpace> colorSpace,
|
|
115
|
+
const SkSurfaceProps* props,
|
|
116
|
+
TextureReleaseProc = nullptr,
|
|
117
|
+
ReleaseContext = nullptr,
|
|
118
|
+
std::string_view label = {});
|
|
88
119
|
} // namespace SkSurfaces
|
|
89
120
|
|
|
90
121
|
#endif // skgpu_graphite_Surface_DEFINED
|
|
@@ -46,7 +46,7 @@ private:
|
|
|
46
46
|
public:
|
|
47
47
|
virtual ~Data() = default;
|
|
48
48
|
|
|
49
|
-
Data(
|
|
49
|
+
Data(SampleCount sampleCount, skgpu::Mipmapped mipmapped)
|
|
50
50
|
: fSampleCount(sampleCount)
|
|
51
51
|
, fMipmapped(mipmapped) {}
|
|
52
52
|
|
|
@@ -56,11 +56,7 @@ private:
|
|
|
56
56
|
Data& operator=(const Data&) = default;
|
|
57
57
|
|
|
58
58
|
// NOTE: These fields are accessible via the backend-specific subclasses.
|
|
59
|
-
|
|
60
|
-
// Must be a valid SampleCount value, or TextureInfo creation will fail to wrap the backend
|
|
61
|
-
// specific data. This is not strongly typed so that it can be assigned directly from the
|
|
62
|
-
// backend GPU API's representation, which is often just an integer.
|
|
63
|
-
uint8_t fSampleCount = 1;
|
|
59
|
+
SampleCount fSampleCount = SampleCount::k1;
|
|
64
60
|
Mipmapped fMipmapped = Mipmapped::kNo;
|
|
65
61
|
|
|
66
62
|
private:
|
|
@@ -95,7 +91,7 @@ public:
|
|
|
95
91
|
|
|
96
92
|
Protected isProtected() const { return fProtected; }
|
|
97
93
|
SampleCount sampleCount() const {
|
|
98
|
-
return fData.has_value() ?
|
|
94
|
+
return fData.has_value() ? fData->fSampleCount : SampleCount::k1;
|
|
99
95
|
}
|
|
100
96
|
Mipmapped mipmapped() const {
|
|
101
97
|
return fData.has_value() ? fData->fMipmapped : Mipmapped::kNo;
|
|
@@ -119,9 +115,6 @@ private:
|
|
|
119
115
|
: fBackend(BackendTextureData::kBackend)
|
|
120
116
|
, fViewFormat(data.viewFormat())
|
|
121
117
|
, fProtected(data.isProtected()) {
|
|
122
|
-
// TextureInfoPriv should not construct a TextureInfo if `data` would fail this assert.
|
|
123
|
-
SkASSERT(data.fSampleCount == 1 || data.fSampleCount == 2 || data.fSampleCount == 4 ||
|
|
124
|
-
data.fSampleCount == 8 || data.fSampleCount == 16);
|
|
125
118
|
fData.emplace<BackendTextureData>(data);
|
|
126
119
|
}
|
|
127
120
|
|
|
@@ -48,7 +48,7 @@ public:
|
|
|
48
48
|
|
|
49
49
|
explicit DawnTextureInfo(WGPUTexture texture);
|
|
50
50
|
|
|
51
|
-
DawnTextureInfo(
|
|
51
|
+
DawnTextureInfo(SampleCount sampleCount,
|
|
52
52
|
Mipmapped mipmapped,
|
|
53
53
|
wgpu::TextureFormat format,
|
|
54
54
|
wgpu::TextureUsage usage,
|
|
@@ -61,7 +61,7 @@ public:
|
|
|
61
61
|
aspect,
|
|
62
62
|
/*slice=*/0) {}
|
|
63
63
|
|
|
64
|
-
DawnTextureInfo(
|
|
64
|
+
DawnTextureInfo(SampleCount sampleCount,
|
|
65
65
|
Mipmapped mipmapped,
|
|
66
66
|
wgpu::TextureFormat format,
|
|
67
67
|
wgpu::TextureFormat viewFormat,
|
|
@@ -76,7 +76,7 @@ public:
|
|
|
76
76
|
, fSlice(slice) {}
|
|
77
77
|
|
|
78
78
|
#if !defined(__EMSCRIPTEN__)
|
|
79
|
-
DawnTextureInfo(
|
|
79
|
+
DawnTextureInfo(SampleCount sampleCount,
|
|
80
80
|
Mipmapped mipmapped,
|
|
81
81
|
wgpu::TextureFormat format,
|
|
82
82
|
wgpu::TextureFormat viewFormat,
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
#include "include/core/SkBlendMode.h"
|
|
14
14
|
#include "include/core/SkImageInfo.h"
|
|
15
|
-
#include "include/effects/
|
|
15
|
+
#include "include/effects/SkGradient.h"
|
|
16
16
|
|
|
17
17
|
class SkColorSpace;
|
|
18
18
|
|
|
@@ -202,19 +202,19 @@ namespace PrecompileShaders {
|
|
|
202
202
|
kNoLarge = kSmall | kMedium,
|
|
203
203
|
};
|
|
204
204
|
|
|
205
|
-
// --- This block of four matches all the factories in SkGradientShader (
|
|
205
|
+
// --- This block of four matches all the factories in SkGradientShader (SkGradient.h)
|
|
206
206
|
SK_API sk_sp<PrecompileShader> LinearGradient(
|
|
207
207
|
GradientShaderFlags = GradientShaderFlags::kAll,
|
|
208
|
-
|
|
208
|
+
SkGradient::Interpolation = SkGradient::Interpolation());
|
|
209
209
|
SK_API sk_sp<PrecompileShader> RadialGradient(
|
|
210
210
|
GradientShaderFlags = GradientShaderFlags::kAll,
|
|
211
|
-
|
|
211
|
+
SkGradient::Interpolation = SkGradient::Interpolation());
|
|
212
212
|
SK_API sk_sp<PrecompileShader> TwoPointConicalGradient(
|
|
213
213
|
GradientShaderFlags = GradientShaderFlags::kAll,
|
|
214
|
-
|
|
214
|
+
SkGradient::Interpolation = SkGradient::Interpolation());
|
|
215
215
|
SK_API sk_sp<PrecompileShader> SweepGradient(
|
|
216
216
|
GradientShaderFlags = GradientShaderFlags::kAll,
|
|
217
|
-
|
|
217
|
+
SkGradient::Interpolation = SkGradient::Interpolation());
|
|
218
218
|
|
|
219
219
|
// Normally, SkPicture shaders are only created via SkPicture::makeShader. Since the
|
|
220
220
|
// SkPicture to be drawn, most likely, won't be available at precompilation time, this
|
|
@@ -18,8 +18,9 @@ namespace skgpu::graphite {
|
|
|
18
18
|
class SK_API VulkanTextureInfo final : public TextureInfo::Data {
|
|
19
19
|
public:
|
|
20
20
|
// VkImageCreateInfo properties
|
|
21
|
-
// Currently the only supported
|
|
22
|
-
//
|
|
21
|
+
// Currently the only supported flags are VK_IMAGE_CREATE_PROTECTED_BIT and, when
|
|
22
|
+
// VK_EXT_multisampled_render_to_single_sampled is present and enabled,
|
|
23
|
+
// VK_IMAGE_CREATE_MULTISAMPLED_RENDER_TO_SINGLE_SAMPLED_BIT_EXT. Other flags are not accepted.
|
|
23
24
|
VkImageCreateFlags fFlags = 0;
|
|
24
25
|
VkFormat fFormat = VK_FORMAT_UNDEFINED;
|
|
25
26
|
VkImageTiling fImageTiling = VK_IMAGE_TILING_OPTIMAL;
|
|
@@ -46,7 +47,8 @@ public:
|
|
|
46
47
|
VkSharingMode sharingMode,
|
|
47
48
|
VkImageAspectFlags aspectMask,
|
|
48
49
|
VulkanYcbcrConversionInfo ycbcrConversionInfo)
|
|
49
|
-
|
|
50
|
+
// VkSampleCountFlagBits is value equivalent to SampleCount
|
|
51
|
+
: Data(static_cast<SampleCount>(sampleCount), mipmapped)
|
|
50
52
|
, fFlags(flags)
|
|
51
53
|
, fFormat(format)
|
|
52
54
|
, fImageTiling(imageTiling)
|
|
@@ -27,7 +27,7 @@ namespace PrecompileShaders {
|
|
|
27
27
|
|
|
28
28
|
@return A precompile shader for a specific type of YCbCr image
|
|
29
29
|
*/
|
|
30
|
-
SK_API sk_sp<PrecompileShader> VulkanYCbCrImage(skgpu::VulkanYcbcrConversionInfo& YCbCrInfo,
|
|
30
|
+
SK_API sk_sp<PrecompileShader> VulkanYCbCrImage(const skgpu::VulkanYcbcrConversionInfo& YCbCrInfo,
|
|
31
31
|
ImageShaderFlags = ImageShaderFlags::kAll,
|
|
32
32
|
SkSpan<const SkColorInfo> = {},
|
|
33
33
|
SkSpan<const SkTileMode> = { kAllTileModes });
|
|
@@ -39,7 +39,7 @@ struct SK_API VulkanBackendContext {
|
|
|
39
39
|
// fDeviceFeatures and fDeviceFeatures2 are null we will assume no features are enabled.
|
|
40
40
|
const VkPhysicalDeviceFeatures* fDeviceFeatures = nullptr;
|
|
41
41
|
const VkPhysicalDeviceFeatures2* fDeviceFeatures2 = nullptr;
|
|
42
|
-
//
|
|
42
|
+
// The client must provide an inplementation of a VulkanMemoryAllocator for Skia to use
|
|
43
43
|
// for allocating Vulkan resources that use VkDeviceMemory.
|
|
44
44
|
sk_sp<VulkanMemoryAllocator> fMemoryAllocator;
|
|
45
45
|
skgpu::VulkanGetProc fGetProc;
|
|
@@ -201,6 +201,10 @@ private:
|
|
|
201
201
|
const char* fLoadStoreOpNoneExtension = nullptr;
|
|
202
202
|
// VK_EXT_conservative_rasterization
|
|
203
203
|
const char* fConservativeRasterizationExtension = nullptr;
|
|
204
|
+
#if defined(SK_BUILD_FOR_ANDROID)
|
|
205
|
+
// VK_ANDROID_external_memory_android_hardware_buffer
|
|
206
|
+
const char* fExternalMemoryAHardwareBufferExtension = nullptr;
|
|
207
|
+
#endif
|
|
204
208
|
|
|
205
209
|
// Extensions that the other extensions above depend on:
|
|
206
210
|
// Dependency of VK_EXT_graphics_pipeline_library: VK_KHR_pipeline_library
|
|
@@ -210,6 +214,10 @@ private:
|
|
|
210
214
|
const char* fFormatFeatureFlags2Extension = nullptr;
|
|
211
215
|
// Dependency of VK_EXT_multisampled_render_to_single_sampled: VK_KHR_depth_stencil_resolve
|
|
212
216
|
const char* fDepthStencilResolveExtension = nullptr;
|
|
217
|
+
#if defined(SK_BUILD_FOR_ANDROID)
|
|
218
|
+
// Dependency of VK_ANDROID_external_memory_android_hardware_buffer: VK_EXT_queue_family_foreign
|
|
219
|
+
const char* fQueueFamilyForeignExtension = nullptr;
|
|
220
|
+
#endif
|
|
213
221
|
};
|
|
214
222
|
|
|
215
223
|
} // namespace skgpu
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
#include "include/core/SkRefCnt.h"
|
|
17
17
|
#include "include/core/SkTypes.h"
|
|
18
18
|
#include "include/private/SkHdrMetadata.h"
|
|
19
|
+
#include "include/private/base/SkAPI.h"
|
|
19
20
|
#include "include/private/base/SkTo.h"
|
|
20
21
|
#include "modules/skcms/skcms.h"
|
|
21
22
|
|
|
@@ -24,22 +25,12 @@
|
|
|
24
25
|
#include <tuple>
|
|
25
26
|
#include <utility>
|
|
26
27
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
public:
|
|
31
|
-
static std::unique_ptr<ICCProfile> Make(sk_sp<const SkData>);
|
|
32
|
-
static std::unique_ptr<ICCProfile> Make(const skcms_ICCProfile&);
|
|
33
|
-
|
|
34
|
-
const skcms_ICCProfile* profile() const { return &fProfile; }
|
|
35
|
-
sk_sp<const SkData> data() const { return fData; }
|
|
36
|
-
private:
|
|
37
|
-
ICCProfile(const skcms_ICCProfile&, sk_sp<const SkData> = nullptr);
|
|
38
|
-
|
|
39
|
-
skcms_ICCProfile fProfile;
|
|
40
|
-
sk_sp<const SkData> fData;
|
|
41
|
-
};
|
|
28
|
+
namespace SkCodecs {
|
|
29
|
+
class ColorProfile;
|
|
30
|
+
}
|
|
42
31
|
|
|
32
|
+
struct SK_API SkEncodedInfo {
|
|
33
|
+
public:
|
|
43
34
|
enum Alpha {
|
|
44
35
|
kOpaque_Alpha,
|
|
45
36
|
kUnpremul_Alpha,
|
|
@@ -106,75 +97,41 @@ public:
|
|
|
106
97
|
kYCCK_Color,
|
|
107
98
|
};
|
|
108
99
|
|
|
109
|
-
static SkEncodedInfo Make(
|
|
110
|
-
|
|
111
|
-
return Make(width, height, color, alpha, bitsPerComponent, nullptr);
|
|
112
|
-
}
|
|
100
|
+
static SkEncodedInfo Make(
|
|
101
|
+
int width, int height, Color color, Alpha alpha, int bitsPerComponent);
|
|
113
102
|
|
|
114
|
-
static SkEncodedInfo Make(
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
std::move(profile), /*colorDepth*/ bitsPerComponent);
|
|
118
|
-
}
|
|
103
|
+
static SkEncodedInfo Make(
|
|
104
|
+
int width, int height, Color color, Alpha alpha, int bitsPerComponent,
|
|
105
|
+
std::unique_ptr<SkCodecs::ColorProfile> profile);
|
|
119
106
|
|
|
120
|
-
static SkEncodedInfo Make(
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
return Make(width, height, color, alpha, bitsPerComponent, colorDepth, std::move(profile),
|
|
124
|
-
skhdr::Metadata::MakeEmpty());
|
|
125
|
-
}
|
|
107
|
+
static SkEncodedInfo Make(
|
|
108
|
+
int width, int height, Color color, Alpha alpha, int bitsPerComponent,
|
|
109
|
+
std::unique_ptr<SkCodecs::ColorProfile> profile, int colorDepth);
|
|
126
110
|
|
|
127
|
-
static SkEncodedInfo Make(
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
2 == bitsPerComponent ||
|
|
132
|
-
4 == bitsPerComponent ||
|
|
133
|
-
8 == bitsPerComponent ||
|
|
134
|
-
16 == bitsPerComponent);
|
|
135
|
-
VerifyColor(color, alpha, bitsPerComponent);
|
|
136
|
-
return SkEncodedInfo(width,
|
|
137
|
-
height,
|
|
138
|
-
color,
|
|
139
|
-
alpha,
|
|
140
|
-
SkToU8(bitsPerComponent),
|
|
141
|
-
SkToU8(colorDepth),
|
|
142
|
-
std::move(profile),
|
|
143
|
-
hdrMetadata);
|
|
144
|
-
}
|
|
111
|
+
static SkEncodedInfo Make(
|
|
112
|
+
int width, int height, Color color, Alpha alpha, int bitsPerComponent,
|
|
113
|
+
int colorDepth,
|
|
114
|
+
std::unique_ptr<SkCodecs::ColorProfile> profile, const skhdr::Metadata& hdrMetadata);
|
|
145
115
|
|
|
146
116
|
/*
|
|
147
117
|
* Returns a recommended SkImageInfo.
|
|
148
118
|
*
|
|
149
119
|
* TODO: Leave this up to the client.
|
|
150
120
|
*/
|
|
151
|
-
SkImageInfo makeImageInfo() const
|
|
152
|
-
auto ct = kGray_Color == fColor ? kGray_8_SkColorType :
|
|
153
|
-
kXAlpha_Color == fColor ? kAlpha_8_SkColorType :
|
|
154
|
-
k565_Color == fColor ? kRGB_565_SkColorType :
|
|
155
|
-
kN32_SkColorType ;
|
|
156
|
-
auto alpha = kOpaque_Alpha == fAlpha ? kOpaque_SkAlphaType
|
|
157
|
-
: kUnpremul_SkAlphaType;
|
|
158
|
-
sk_sp<SkColorSpace> cs = fProfile ? SkColorSpace::Make(*fProfile->profile())
|
|
159
|
-
: nullptr;
|
|
160
|
-
if (!cs) {
|
|
161
|
-
cs = SkColorSpace::MakeSRGB();
|
|
162
|
-
}
|
|
163
|
-
return SkImageInfo::Make(fWidth, fHeight, ct, alpha, std::move(cs));
|
|
164
|
-
}
|
|
121
|
+
SkImageInfo makeImageInfo() const;
|
|
165
122
|
|
|
166
123
|
int width() const { return fWidth; }
|
|
167
124
|
int height() const { return fHeight; }
|
|
168
125
|
Color color() const { return fColor; }
|
|
169
126
|
Alpha alpha() const { return fAlpha; }
|
|
170
127
|
bool opaque() const { return fAlpha == kOpaque_Alpha; }
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
sk_sp<const SkData> profileData() const
|
|
176
|
-
|
|
177
|
-
return
|
|
128
|
+
|
|
129
|
+
// TODO(https://issues.skia.org/issues/464217864): Remove direct access to the
|
|
130
|
+
// skcms_ICCProfile and change profileData() to serialize a new profile.
|
|
131
|
+
const skcms_ICCProfile* profile() const;
|
|
132
|
+
sk_sp<const SkData> profileData() const;
|
|
133
|
+
const SkCodecs::ColorProfile* colorProfile() const {
|
|
134
|
+
return fColorProfile.get();
|
|
178
135
|
}
|
|
179
136
|
|
|
180
137
|
uint8_t bitsPerComponent() const { return fBitsPerComponent; }
|
|
@@ -208,20 +165,11 @@ public:
|
|
|
208
165
|
SkEncodedInfo(const SkEncodedInfo& orig) = delete;
|
|
209
166
|
SkEncodedInfo& operator=(const SkEncodedInfo&) = delete;
|
|
210
167
|
|
|
211
|
-
SkEncodedInfo(SkEncodedInfo&& orig)
|
|
212
|
-
SkEncodedInfo& operator=(SkEncodedInfo&&)
|
|
168
|
+
SkEncodedInfo(SkEncodedInfo&& orig);
|
|
169
|
+
SkEncodedInfo& operator=(SkEncodedInfo&&);
|
|
213
170
|
|
|
214
171
|
// Explicit copy method, to avoid accidental copying.
|
|
215
|
-
SkEncodedInfo copy() const
|
|
216
|
-
return SkEncodedInfo(fWidth,
|
|
217
|
-
fHeight,
|
|
218
|
-
fColor,
|
|
219
|
-
fAlpha,
|
|
220
|
-
fBitsPerComponent,
|
|
221
|
-
fColorDepth,
|
|
222
|
-
fProfile ? std::make_unique<const ICCProfile>(*fProfile) : nullptr,
|
|
223
|
-
fHdrMetadata);
|
|
224
|
-
}
|
|
172
|
+
SkEncodedInfo copy() const;
|
|
225
173
|
|
|
226
174
|
// Return number of bits of R/G/B channel
|
|
227
175
|
uint8_t getColorDepth() const {
|
|
@@ -234,23 +182,13 @@ public:
|
|
|
234
182
|
return fHdrMetadata;
|
|
235
183
|
}
|
|
236
184
|
|
|
185
|
+
~SkEncodedInfo();
|
|
186
|
+
|
|
237
187
|
private:
|
|
238
|
-
SkEncodedInfo(
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
uint8_t bitsPerComponent,
|
|
243
|
-
uint8_t colorDepth,
|
|
244
|
-
std::unique_ptr<const ICCProfile> profile,
|
|
245
|
-
const skhdr::Metadata& hdrMetadata)
|
|
246
|
-
: fWidth(width)
|
|
247
|
-
, fHeight(height)
|
|
248
|
-
, fColor(color)
|
|
249
|
-
, fAlpha(alpha)
|
|
250
|
-
, fBitsPerComponent(bitsPerComponent)
|
|
251
|
-
, fColorDepth(colorDepth)
|
|
252
|
-
, fProfile(std::move(profile))
|
|
253
|
-
, fHdrMetadata(hdrMetadata) {}
|
|
188
|
+
SkEncodedInfo(
|
|
189
|
+
int width, int height, Color color, Alpha alpha, uint8_t bitsPerComponent,
|
|
190
|
+
uint8_t colorDepth,
|
|
191
|
+
std::unique_ptr<SkCodecs::ColorProfile> profile, const skhdr::Metadata& hdrMetadata);
|
|
254
192
|
|
|
255
193
|
static void VerifyColor(Color color, Alpha alpha, int bitsPerComponent) {
|
|
256
194
|
// Avoid `-Wunused-parameter` warnings on non-debug builds.
|
|
@@ -298,14 +236,14 @@ private:
|
|
|
298
236
|
SkASSERT(false); // Unrecognized `color` enum value.
|
|
299
237
|
}
|
|
300
238
|
|
|
301
|
-
int
|
|
302
|
-
int
|
|
303
|
-
Color
|
|
304
|
-
Alpha
|
|
305
|
-
uint8_t
|
|
306
|
-
uint8_t
|
|
307
|
-
std::unique_ptr<const
|
|
308
|
-
skhdr::Metadata
|
|
239
|
+
int fWidth;
|
|
240
|
+
int fHeight;
|
|
241
|
+
Color fColor;
|
|
242
|
+
Alpha fAlpha;
|
|
243
|
+
uint8_t fBitsPerComponent;
|
|
244
|
+
uint8_t fColorDepth;
|
|
245
|
+
std::unique_ptr<const SkCodecs::ColorProfile> fColorProfile;
|
|
246
|
+
skhdr::Metadata fHdrMetadata;
|
|
309
247
|
};
|
|
310
248
|
|
|
311
249
|
#endif
|