@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
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 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 SkGradient_DEFINED
|
|
9
|
+
#define SkGradient_DEFINED
|
|
10
|
+
|
|
11
|
+
#include "include/core/SkColor.h"
|
|
12
|
+
#include "include/core/SkColorSpace.h"
|
|
13
|
+
#include "include/core/SkPoint.h"
|
|
14
|
+
#include "include/core/SkShader.h"
|
|
15
|
+
#include "include/core/SkSpan.h"
|
|
16
|
+
#include "include/core/SkTileMode.h"
|
|
17
|
+
#include "include/private/base/SkAPI.h"
|
|
18
|
+
|
|
19
|
+
class SkMatrix;
|
|
20
|
+
|
|
21
|
+
class SkGradient {
|
|
22
|
+
public:
|
|
23
|
+
struct Interpolation {
|
|
24
|
+
enum class InPremul : bool { kNo = false, kYes = true };
|
|
25
|
+
|
|
26
|
+
enum class ColorSpace : uint8_t {
|
|
27
|
+
// Default Skia behavior: interpolate in the color space of the destination surface
|
|
28
|
+
kDestination,
|
|
29
|
+
|
|
30
|
+
// https://www.w3.org/TR/css-color-4/#interpolation-space
|
|
31
|
+
kSRGBLinear,
|
|
32
|
+
kLab,
|
|
33
|
+
kOKLab,
|
|
34
|
+
// This is the same as kOKLab, except it has a simplified version of the CSS gamut
|
|
35
|
+
// mapping algorithm (https://www.w3.org/TR/css-color-4/#css-gamut-mapping)
|
|
36
|
+
// into Rec2020 space applied to it.
|
|
37
|
+
// Warning: This space is experimental and should not be used in production.
|
|
38
|
+
kOKLabGamutMap,
|
|
39
|
+
kLCH,
|
|
40
|
+
kOKLCH,
|
|
41
|
+
// This is the same as kOKLCH, except it has the same gamut mapping applied to it
|
|
42
|
+
// as kOKLabGamutMap does.
|
|
43
|
+
// Warning: This space is experimental and should not be used in production.
|
|
44
|
+
kOKLCHGamutMap,
|
|
45
|
+
kSRGB,
|
|
46
|
+
kHSL,
|
|
47
|
+
kHWB,
|
|
48
|
+
|
|
49
|
+
kDisplayP3,
|
|
50
|
+
kRec2020,
|
|
51
|
+
kProphotoRGB,
|
|
52
|
+
kA98RGB,
|
|
53
|
+
|
|
54
|
+
kLastColorSpace = kA98RGB,
|
|
55
|
+
};
|
|
56
|
+
static constexpr int kColorSpaceCount = static_cast<int>(ColorSpace::kLastColorSpace) + 1;
|
|
57
|
+
|
|
58
|
+
enum class HueMethod : uint8_t {
|
|
59
|
+
// https://www.w3.org/TR/css-color-4/#hue-interpolation
|
|
60
|
+
kShorter,
|
|
61
|
+
kLonger,
|
|
62
|
+
kIncreasing,
|
|
63
|
+
kDecreasing,
|
|
64
|
+
|
|
65
|
+
kLastHueMethod = kDecreasing,
|
|
66
|
+
};
|
|
67
|
+
static constexpr int kHueMethodCount = static_cast<int>(HueMethod::kLastHueMethod) + 1;
|
|
68
|
+
|
|
69
|
+
InPremul fInPremul = InPremul::kNo;
|
|
70
|
+
ColorSpace fColorSpace = ColorSpace::kDestination;
|
|
71
|
+
HueMethod fHueMethod = HueMethod::kShorter; // Only relevant for LCH, OKLCH, HSL, or HWB
|
|
72
|
+
|
|
73
|
+
// legacy compatibility -- remove when we can
|
|
74
|
+
static Interpolation FromFlags(uint32_t flags) {
|
|
75
|
+
return {flags & 1 ? InPremul::kYes : InPremul::kNo,
|
|
76
|
+
ColorSpace::kDestination,
|
|
77
|
+
HueMethod::kShorter};
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Specification for the colors in a gradient.
|
|
83
|
+
*
|
|
84
|
+
* @param colors The span of colors for the gradient.
|
|
85
|
+
* @param pos Relative positions of each color across the gradient. If empty,
|
|
86
|
+
* the the colors are distributed evenly. If this is not null, the values
|
|
87
|
+
* must lie between 0.0 and 1.0, and be strictly increasing. If the first
|
|
88
|
+
* value is not 0.0, then an additional color stop is added at position 0.0,
|
|
89
|
+
* with the same color as colors[0]. If the the last value is less than 1.0,
|
|
90
|
+
* then an additional color stop is added at position 1.0, with the same color
|
|
91
|
+
* as colors[count - 1].
|
|
92
|
+
* @param mode Tiling mode for the gradient.
|
|
93
|
+
* @param cs Optional colorspace associated with the span of colors. If this is null,
|
|
94
|
+
* the colors are treated as sRGB.
|
|
95
|
+
*/
|
|
96
|
+
class Colors {
|
|
97
|
+
public:
|
|
98
|
+
Colors() {}
|
|
99
|
+
Colors(SkSpan<const SkColor4f> colors,
|
|
100
|
+
SkSpan<const float> pos,
|
|
101
|
+
SkTileMode mode,
|
|
102
|
+
sk_sp<SkColorSpace> cs = nullptr)
|
|
103
|
+
: fColors(colors), fPos(pos), fColorSpace(std::move(cs)), fTileMode(mode) {
|
|
104
|
+
SkASSERT(fPos.size() == 0 || fPos.size() == fColors.size());
|
|
105
|
+
|
|
106
|
+
// throw away inconsistent inputs
|
|
107
|
+
if (fPos.size() != fColors.size()) {
|
|
108
|
+
fPos = {};
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
Colors(SkSpan<const SkColor4f> colors, SkTileMode tm, sk_sp<SkColorSpace> cs = nullptr)
|
|
113
|
+
: Colors(colors, {}, tm, std::move(cs)) {}
|
|
114
|
+
|
|
115
|
+
SkSpan<const SkColor4f> colors() const { return fColors; }
|
|
116
|
+
SkSpan<const float> positions() const { return fPos; }
|
|
117
|
+
const sk_sp<SkColorSpace>& colorSpace() const { return fColorSpace; }
|
|
118
|
+
SkTileMode tileMode() const { return fTileMode; }
|
|
119
|
+
|
|
120
|
+
private:
|
|
121
|
+
SkSpan<const SkColor4f> fColors;
|
|
122
|
+
SkSpan<const float> fPos;
|
|
123
|
+
sk_sp<SkColorSpace> fColorSpace;
|
|
124
|
+
SkTileMode fTileMode = SkTileMode::kClamp;
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
SkGradient() {}
|
|
128
|
+
SkGradient(const Colors& colors, const Interpolation& interp)
|
|
129
|
+
: fColors(colors), fInterpolation(interp) {}
|
|
130
|
+
|
|
131
|
+
const Colors& colors() const { return fColors; }
|
|
132
|
+
const Interpolation& interpolation() const { return fInterpolation; }
|
|
133
|
+
|
|
134
|
+
private:
|
|
135
|
+
Colors fColors;
|
|
136
|
+
Interpolation fInterpolation;
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
namespace SkShaders {
|
|
140
|
+
/** Returns a shader that generates a linear gradient between the two specified points.
|
|
141
|
+
* If the inputs are invalid, this will return nullptr.
|
|
142
|
+
* @param points Array of 2 points, the end-points of the line segment
|
|
143
|
+
* @param grad Description of the colors and interpolation method
|
|
144
|
+
* @param lm Optional local matrix, may be null
|
|
145
|
+
*/
|
|
146
|
+
SK_API sk_sp<SkShader> LinearGradient(const SkPoint pts[2],
|
|
147
|
+
const SkGradient&,
|
|
148
|
+
const SkMatrix* lm = nullptr);
|
|
149
|
+
|
|
150
|
+
/** Returns a shader that generates a radial gradient given the center and radius.
|
|
151
|
+
* @param center The center of the circle for this gradient
|
|
152
|
+
* @param radius Must be positive. The radius of the circle for this gradient
|
|
153
|
+
* @param grad Description of the colors and interpolation method
|
|
154
|
+
* @param lm Optional local matrix, may be null
|
|
155
|
+
*/
|
|
156
|
+
SK_API sk_sp<SkShader> RadialGradient(SkPoint center,
|
|
157
|
+
float radius,
|
|
158
|
+
const SkGradient& grad,
|
|
159
|
+
const SkMatrix* lm = nullptr);
|
|
160
|
+
|
|
161
|
+
/** Returns a shader that generates a conical gradient given two circles, or
|
|
162
|
+
* returns null if the inputs are invalid. The gradient interprets the
|
|
163
|
+
* two circles according to the following HTML spec.
|
|
164
|
+
* http://dev.w3.org/html5/2dcontext/#dom-context-2d-createradialgradient
|
|
165
|
+
* @param start The center of the circle for this gradient
|
|
166
|
+
* @param startRadius Must be positive. The radius of the circle for this gradient
|
|
167
|
+
* @param end The center of the circle for this gradient
|
|
168
|
+
* @param startRadius Must be positive. The radius of the circle for this gradient
|
|
169
|
+
* @param grad Description of the colors and interpolation method
|
|
170
|
+
* @param lm Optional local matrix, may be null
|
|
171
|
+
*/
|
|
172
|
+
SK_API sk_sp<SkShader> TwoPointConicalGradient(SkPoint start,
|
|
173
|
+
float startRadius,
|
|
174
|
+
SkPoint end,
|
|
175
|
+
float endRadius,
|
|
176
|
+
const SkGradient& grad,
|
|
177
|
+
const SkMatrix* lm = nullptr);
|
|
178
|
+
|
|
179
|
+
/** Returns a shader that generates a sweep gradient given a center.
|
|
180
|
+
* The shader accepts negative angles and angles larger than 360, draws
|
|
181
|
+
* between 0 and 360 degrees, similar to the CSS conic-gradient
|
|
182
|
+
* semantics. 0 degrees means horizontal positive x axis. The start angle
|
|
183
|
+
* must be less than the end angle, otherwise a null pointer is
|
|
184
|
+
* returned. If color stops do not contain 0 and 1 but are within this
|
|
185
|
+
* range, the respective outer color stop is repeated for 0 and 1. Color
|
|
186
|
+
* stops less than 0 are clamped to 0, and greater than 1 are clamped to 1.
|
|
187
|
+
* @param center The center of the sweep
|
|
188
|
+
* @param startAngle Start of the angular range, corresponding to pos == 0.
|
|
189
|
+
* @param endAngle End of the angular range, corresponding to pos == 1.
|
|
190
|
+
* @param grad Description of the colors and interpolation method
|
|
191
|
+
* @param lm Optional local matrix, may be null
|
|
192
|
+
*/
|
|
193
|
+
SK_API sk_sp<SkShader> SweepGradient(SkPoint center,
|
|
194
|
+
float startAngle,
|
|
195
|
+
float endAngle,
|
|
196
|
+
const SkGradient&,
|
|
197
|
+
const SkMatrix* lm = nullptr);
|
|
198
|
+
static inline sk_sp<SkShader> SweepGradient(SkPoint center,
|
|
199
|
+
const SkGradient& grad,
|
|
200
|
+
const SkMatrix* lm = nullptr) {
|
|
201
|
+
return SweepGradient(center, 0, 360, grad, lm);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
} // namespace SkShaders
|
|
205
|
+
|
|
206
|
+
#endif
|
|
@@ -45,8 +45,8 @@ struct SkHighContrastConfig {
|
|
|
45
45
|
bool isValid() const {
|
|
46
46
|
return fInvertStyle >= InvertStyle::kNoInvert &&
|
|
47
47
|
fInvertStyle <= InvertStyle::kInvertLightness &&
|
|
48
|
-
fContrast >= -1.
|
|
49
|
-
fContrast <= 1.
|
|
48
|
+
fContrast >= -1.0f &&
|
|
49
|
+
fContrast <= 1.0f;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
// If true, the color will be converted to grayscale.
|
|
@@ -82,10 +82,12 @@ enum class Origin : unsigned {
|
|
|
82
82
|
enum class GpuStatsFlags : uint32_t {
|
|
83
83
|
kNone = 0b00,
|
|
84
84
|
kElapsedTime = 0b01,
|
|
85
|
+
kOcclusionPassSamples = 0b10,
|
|
85
86
|
};
|
|
86
87
|
|
|
87
88
|
struct GpuStats {
|
|
88
89
|
uint64_t elapsedTime = 0;
|
|
90
|
+
uint64_t numOcclusionPassSamples = 0;
|
|
89
91
|
};
|
|
90
92
|
|
|
91
93
|
} // namespace skgpu
|
|
@@ -4,18 +4,13 @@
|
|
|
4
4
|
* Use of this source code is governed by a BSD-style license that can be
|
|
5
5
|
* found in the LICENSE file.
|
|
6
6
|
*/
|
|
7
|
-
|
|
8
7
|
#ifndef GrBackendSemaphore_DEFINED
|
|
9
8
|
#define GrBackendSemaphore_DEFINED
|
|
10
9
|
|
|
11
|
-
#include "include/gpu/ganesh/GrTypes.h"
|
|
10
|
+
#include "include/gpu/ganesh/GrTypes.h"
|
|
12
11
|
#include "include/private/base/SkAPI.h"
|
|
13
12
|
#include "include/private/base/SkAnySubclass.h"
|
|
14
13
|
|
|
15
|
-
#ifdef SK_DIRECT3D
|
|
16
|
-
#include "include/private/gpu/ganesh/GrD3DTypesMinimal.h"
|
|
17
|
-
#endif
|
|
18
|
-
|
|
19
14
|
#include <cstddef>
|
|
20
15
|
|
|
21
16
|
class GrBackendSemaphoreData;
|
|
@@ -25,27 +20,14 @@ class GrBackendSemaphoreData;
|
|
|
25
20
|
*/
|
|
26
21
|
class SK_API GrBackendSemaphore {
|
|
27
22
|
public:
|
|
28
|
-
//
|
|
29
|
-
// appropriate GrBackend.
|
|
23
|
+
// An empty semaphore. To instantiate, see GrBackendSemaphores::MakeVk and similar
|
|
30
24
|
GrBackendSemaphore();
|
|
31
25
|
~GrBackendSemaphore();
|
|
32
26
|
GrBackendSemaphore(const GrBackendSemaphore&);
|
|
33
27
|
GrBackendSemaphore& operator=(const GrBackendSemaphore&);
|
|
34
28
|
|
|
35
|
-
#ifdef SK_DIRECT3D
|
|
36
|
-
void initDirect3D(const GrD3DFenceInfo& info) {
|
|
37
|
-
fBackend = GrBackendApi::kDirect3D;
|
|
38
|
-
this->assignD3DFenceInfo(info);
|
|
39
|
-
fIsInitialized = true;
|
|
40
|
-
}
|
|
41
|
-
#endif
|
|
42
|
-
|
|
43
|
-
bool isInitialized() const { return fIsInitialized; }
|
|
44
29
|
GrBackendApi backend() const { return fBackend; }
|
|
45
|
-
|
|
46
|
-
#ifdef SK_DIRECT3D
|
|
47
|
-
bool getD3DFenceInfo(GrD3DFenceInfo* outInfo) const;
|
|
48
|
-
#endif
|
|
30
|
+
bool isInitialized() const { return fBackend != GrBackendApi::kUnsupported; }
|
|
49
31
|
|
|
50
32
|
private:
|
|
51
33
|
friend class GrBackendSemaphorePriv;
|
|
@@ -57,24 +39,12 @@ private:
|
|
|
57
39
|
using AnySemaphoreData = SkAnySubclass<GrBackendSemaphoreData, kMaxSubclassSize>;
|
|
58
40
|
|
|
59
41
|
template <typename SemaphoreData>
|
|
60
|
-
GrBackendSemaphore(GrBackendApi api, SemaphoreData data) : fBackend(api)
|
|
42
|
+
GrBackendSemaphore(GrBackendApi api, SemaphoreData data) : fBackend(api) {
|
|
61
43
|
fSemaphoreData.emplace<SemaphoreData>(data);
|
|
62
44
|
}
|
|
63
45
|
|
|
64
|
-
|
|
65
|
-
void assignD3DFenceInfo(const GrD3DFenceInfo& info);
|
|
66
|
-
#endif
|
|
67
|
-
|
|
68
|
-
GrBackendApi fBackend;
|
|
46
|
+
GrBackendApi fBackend = GrBackendApi::kUnsupported;
|
|
69
47
|
AnySemaphoreData fSemaphoreData;
|
|
70
|
-
|
|
71
|
-
union {
|
|
72
|
-
void* fPlaceholder; // TODO(293490566)
|
|
73
|
-
#ifdef SK_DIRECT3D
|
|
74
|
-
GrD3DFenceInfo* fD3DFenceInfo;
|
|
75
|
-
#endif
|
|
76
|
-
};
|
|
77
|
-
bool fIsInitialized;
|
|
78
48
|
};
|
|
79
49
|
|
|
80
50
|
#endif
|
|
@@ -27,11 +27,6 @@ namespace skgpu {
|
|
|
27
27
|
class MutableTextureState;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
#ifdef SK_DIRECT3D
|
|
31
|
-
#include "include/private/gpu/ganesh/GrD3DTypesMinimal.h"
|
|
32
|
-
class GrD3DResourceState;
|
|
33
|
-
#endif
|
|
34
|
-
|
|
35
30
|
#if defined(SK_DEBUG) || defined(GPU_TEST_UTILS)
|
|
36
31
|
class SkString;
|
|
37
32
|
#endif
|
|
@@ -49,12 +44,6 @@ public:
|
|
|
49
44
|
GrBackendFormat& operator=(const GrBackendFormat&);
|
|
50
45
|
~GrBackendFormat();
|
|
51
46
|
|
|
52
|
-
#ifdef SK_DIRECT3D
|
|
53
|
-
static GrBackendFormat MakeDxgi(DXGI_FORMAT format) {
|
|
54
|
-
return GrBackendFormat(format);
|
|
55
|
-
}
|
|
56
|
-
#endif
|
|
57
|
-
|
|
58
47
|
static GrBackendFormat MakeMock(GrColorType colorType,
|
|
59
48
|
SkTextureCompressionType compression,
|
|
60
49
|
bool isStencilFormat = false);
|
|
@@ -73,14 +62,6 @@ public:
|
|
|
73
62
|
|
|
74
63
|
GrColorFormatDesc desc() const;
|
|
75
64
|
|
|
76
|
-
#ifdef SK_DIRECT3D
|
|
77
|
-
/**
|
|
78
|
-
* If the backend API is Direct3D this gets the format as a DXGI_FORMAT and returns true.
|
|
79
|
-
* Otherwise, returns false.
|
|
80
|
-
*/
|
|
81
|
-
bool asDxgiFormat(DXGI_FORMAT*) const;
|
|
82
|
-
#endif
|
|
83
|
-
|
|
84
65
|
/**
|
|
85
66
|
* If the backend API is not Mock these three calls will return kUnknown, kNone or false,
|
|
86
67
|
* respectively. Otherwise, only one of the following can be true. The GrColorType is not
|
|
@@ -119,10 +100,6 @@ private:
|
|
|
119
100
|
fFormatData.emplace<FormatData>(formatData);
|
|
120
101
|
}
|
|
121
102
|
|
|
122
|
-
#ifdef SK_DIRECT3D
|
|
123
|
-
explicit GrBackendFormat(DXGI_FORMAT dxgiFormat);
|
|
124
|
-
#endif
|
|
125
|
-
|
|
126
103
|
GrBackendFormat(GrColorType, SkTextureCompressionType, bool isStencilFormat);
|
|
127
104
|
|
|
128
105
|
#ifdef SK_DEBUG
|
|
@@ -133,16 +110,11 @@ private:
|
|
|
133
110
|
bool fValid = false;
|
|
134
111
|
AnyFormatData fFormatData;
|
|
135
112
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
GrColorType fColorType;
|
|
142
|
-
SkTextureCompressionType fCompressionType;
|
|
143
|
-
bool fIsStencilFormat;
|
|
144
|
-
} fMock;
|
|
145
|
-
};
|
|
113
|
+
struct {
|
|
114
|
+
GrColorType fColorType;
|
|
115
|
+
SkTextureCompressionType fCompressionType;
|
|
116
|
+
bool fIsStencilFormat;
|
|
117
|
+
} fMock;
|
|
146
118
|
GrTextureType fTextureType = GrTextureType::kNone;
|
|
147
119
|
};
|
|
148
120
|
|
|
@@ -151,13 +123,6 @@ public:
|
|
|
151
123
|
// Creates an invalid backend texture.
|
|
152
124
|
GrBackendTexture();
|
|
153
125
|
|
|
154
|
-
#ifdef SK_DIRECT3D
|
|
155
|
-
GrBackendTexture(int width,
|
|
156
|
-
int height,
|
|
157
|
-
const GrD3DTextureResourceInfo& d3dInfo,
|
|
158
|
-
std::string_view label = {});
|
|
159
|
-
#endif
|
|
160
|
-
|
|
161
126
|
GrBackendTexture(int width,
|
|
162
127
|
int height,
|
|
163
128
|
skgpu::Mipmapped,
|
|
@@ -179,17 +144,6 @@ public:
|
|
|
179
144
|
GrBackendApi backend() const {return fBackend; }
|
|
180
145
|
GrTextureType textureType() const { return fTextureType; }
|
|
181
146
|
|
|
182
|
-
#ifdef SK_DIRECT3D
|
|
183
|
-
// If the backend API is Direct3D, copies a snapshot of the GrD3DTextureResourceInfo struct into
|
|
184
|
-
// the passed in pointer and returns true. This snapshot will set the fResourceState to the
|
|
185
|
-
// current resource state. Otherwise returns false if the backend API is not D3D.
|
|
186
|
-
bool getD3DTextureResourceInfo(GrD3DTextureResourceInfo*) const;
|
|
187
|
-
|
|
188
|
-
// Anytime the client changes the D3D12_RESOURCE_STATES of the D3D12_RESOURCE captured by this
|
|
189
|
-
// GrBackendTexture, they must call this function to notify Skia of the changed layout.
|
|
190
|
-
void setD3DResourceState(GrD3DResourceStateEnum);
|
|
191
|
-
#endif
|
|
192
|
-
|
|
193
147
|
// Get the GrBackendFormat for this texture (or an invalid format if this is not valid).
|
|
194
148
|
GrBackendFormat getBackendFormat() const;
|
|
195
149
|
|
|
@@ -249,20 +203,6 @@ private:
|
|
|
249
203
|
friend class GrVkGpu; // for getMutableState
|
|
250
204
|
sk_sp<skgpu::MutableTextureState> getMutableState() const;
|
|
251
205
|
|
|
252
|
-
#ifdef SK_DIRECT3D
|
|
253
|
-
friend class GrD3DTexture;
|
|
254
|
-
friend class GrD3DGpu; // for getGrD3DResourceState
|
|
255
|
-
GrBackendTexture(int width,
|
|
256
|
-
int height,
|
|
257
|
-
const GrD3DTextureResourceInfo& vkInfo,
|
|
258
|
-
sk_sp<GrD3DResourceState> state,
|
|
259
|
-
std::string_view label = {});
|
|
260
|
-
sk_sp<GrD3DResourceState> getGrD3DResourceState() const;
|
|
261
|
-
#endif
|
|
262
|
-
|
|
263
|
-
// Free and release and resources being held by the GrBackendTexture.
|
|
264
|
-
void cleanup();
|
|
265
|
-
|
|
266
206
|
bool fIsValid;
|
|
267
207
|
int fWidth; //<! width in pixels
|
|
268
208
|
int fHeight; //<! height in pixels
|
|
@@ -272,12 +212,7 @@ private:
|
|
|
272
212
|
GrTextureType fTextureType;
|
|
273
213
|
AnyTextureData fTextureData;
|
|
274
214
|
|
|
275
|
-
|
|
276
|
-
GrMockTextureInfo fMockInfo;
|
|
277
|
-
#ifdef SK_DIRECT3D
|
|
278
|
-
GrD3DBackendSurfaceInfo fD3DInfo;
|
|
279
|
-
#endif
|
|
280
|
-
};
|
|
215
|
+
GrMockTextureInfo fMockInfo;
|
|
281
216
|
};
|
|
282
217
|
|
|
283
218
|
class SK_API GrBackendRenderTarget {
|
|
@@ -285,12 +220,6 @@ public:
|
|
|
285
220
|
// Creates an invalid backend texture.
|
|
286
221
|
GrBackendRenderTarget();
|
|
287
222
|
|
|
288
|
-
#ifdef SK_DIRECT3D
|
|
289
|
-
GrBackendRenderTarget(int width,
|
|
290
|
-
int height,
|
|
291
|
-
const GrD3DTextureResourceInfo& d3dInfo);
|
|
292
|
-
#endif
|
|
293
|
-
|
|
294
223
|
GrBackendRenderTarget(int width,
|
|
295
224
|
int height,
|
|
296
225
|
int sampleCnt,
|
|
@@ -310,16 +239,6 @@ public:
|
|
|
310
239
|
GrBackendApi backend() const {return fBackend; }
|
|
311
240
|
bool isFramebufferOnly() const { return fFramebufferOnly; }
|
|
312
241
|
|
|
313
|
-
#ifdef SK_DIRECT3D
|
|
314
|
-
// If the backend API is Direct3D, copies a snapshot of the GrMtlTextureInfo struct into the
|
|
315
|
-
// passed in pointer and returns true. Otherwise returns false if the backend API is not D3D.
|
|
316
|
-
bool getD3DTextureResourceInfo(GrD3DTextureResourceInfo*) const;
|
|
317
|
-
|
|
318
|
-
// Anytime the client changes the D3D12_RESOURCE_STATES of the D3D12_RESOURCE captured by this
|
|
319
|
-
// GrBackendTexture, they must call this function to notify Skia of the changed layout.
|
|
320
|
-
void setD3DResourceState(GrD3DResourceStateEnum);
|
|
321
|
-
#endif
|
|
322
|
-
|
|
323
242
|
// Get the GrBackendFormat for this render target (or an invalid format if this is not valid).
|
|
324
243
|
GrBackendFormat getBackendFormat() const;
|
|
325
244
|
|
|
@@ -377,19 +296,6 @@ private:
|
|
|
377
296
|
friend class GrVkGpu; // for getMutableState
|
|
378
297
|
sk_sp<skgpu::MutableTextureState> getMutableState() const;
|
|
379
298
|
|
|
380
|
-
#ifdef SK_DIRECT3D
|
|
381
|
-
friend class GrD3DGpu;
|
|
382
|
-
friend class GrD3DRenderTarget;
|
|
383
|
-
GrBackendRenderTarget(int width,
|
|
384
|
-
int height,
|
|
385
|
-
const GrD3DTextureResourceInfo& d3dInfo,
|
|
386
|
-
sk_sp<GrD3DResourceState> state);
|
|
387
|
-
sk_sp<GrD3DResourceState> getGrD3DResourceState() const;
|
|
388
|
-
#endif
|
|
389
|
-
|
|
390
|
-
// Free and release and resources being held by the GrBackendTexture.
|
|
391
|
-
void cleanup();
|
|
392
|
-
|
|
393
299
|
bool fIsValid;
|
|
394
300
|
bool fFramebufferOnly = false;
|
|
395
301
|
int fWidth; //<! width in pixels
|
|
@@ -401,12 +307,7 @@ private:
|
|
|
401
307
|
GrBackendApi fBackend;
|
|
402
308
|
AnyRenderTargetData fRTData;
|
|
403
309
|
|
|
404
|
-
|
|
405
|
-
GrMockRenderTargetInfo fMockInfo;
|
|
406
|
-
#ifdef SK_DIRECT3D
|
|
407
|
-
GrD3DBackendSurfaceInfo fD3DInfo;
|
|
408
|
-
#endif
|
|
409
|
-
};
|
|
310
|
+
GrMockRenderTargetInfo fMockInfo;
|
|
410
311
|
};
|
|
411
312
|
|
|
412
313
|
#endif
|
|
@@ -75,17 +75,6 @@ struct SK_API GrContextOptions {
|
|
|
75
75
|
|
|
76
76
|
GrContextOptions() {}
|
|
77
77
|
|
|
78
|
-
/**
|
|
79
|
-
* If Skia is creating a default VMA allocator for the Vulkan backend this value will be used
|
|
80
|
-
* for the preferredLargeHeapBlockSize. If the value is not set, then Skia will use an
|
|
81
|
-
* inernally defined default size.
|
|
82
|
-
*
|
|
83
|
-
* However, it is highly discouraged to have Skia make a default allocator (and support for
|
|
84
|
-
* doing so will be removed soon, b/321962001). Instead clients should create their own
|
|
85
|
-
* allocator to pass into Skia where they can fine tune this value themeselves.
|
|
86
|
-
*/
|
|
87
|
-
std::optional<uint64_t> fVulkanVMALargeHeapBlockSize;
|
|
88
|
-
|
|
89
78
|
/**
|
|
90
79
|
* Optional callback that can be passed into the GrDirectContext which will be called when the
|
|
91
80
|
* GrDirectContext is about to be destroyed. When this call is made, it will be safe for the
|
|
@@ -42,7 +42,6 @@ class SkTraceMemoryDump;
|
|
|
42
42
|
enum SkColorType : int;
|
|
43
43
|
enum class SkTextureCompressionType;
|
|
44
44
|
struct GrMockOptions;
|
|
45
|
-
struct GrD3DBackendContext; // IWYU pragma: keep
|
|
46
45
|
|
|
47
46
|
namespace skgpu {
|
|
48
47
|
class MutableTextureState;
|
|
@@ -59,14 +58,6 @@ enum class BackendSurfaceAccess;
|
|
|
59
58
|
|
|
60
59
|
class SK_API GrDirectContext : public GrRecordingContext {
|
|
61
60
|
public:
|
|
62
|
-
#ifdef SK_DIRECT3D
|
|
63
|
-
/**
|
|
64
|
-
* Makes a GrDirectContext which uses Direct3D as the backend. The Direct3D context
|
|
65
|
-
* must be kept alive until the returned GrDirectContext is first destroyed or abandoned.
|
|
66
|
-
*/
|
|
67
|
-
static sk_sp<GrDirectContext> MakeDirect3D(const GrD3DBackendContext&, const GrContextOptions&);
|
|
68
|
-
static sk_sp<GrDirectContext> MakeDirect3D(const GrD3DBackendContext&);
|
|
69
|
-
#endif
|
|
70
61
|
|
|
71
62
|
static sk_sp<GrDirectContext> MakeMock(const GrMockOptions*, const GrContextOptions&);
|
|
72
63
|
static sk_sp<GrDirectContext> MakeMock(const GrMockOptions*);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026 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 GrD3DBackendSemaphore_DEFINED
|
|
9
|
+
#define GrD3DBackendSemaphore_DEFINED
|
|
10
|
+
|
|
11
|
+
#include "include/gpu/ganesh/GrBackendSemaphore.h"
|
|
12
|
+
#include "include/private/base/SkAPI.h"
|
|
13
|
+
#include "include/private/gpu/ganesh/GrD3DTypesMinimal.h"
|
|
14
|
+
|
|
15
|
+
namespace GrBackendSemaphores {
|
|
16
|
+
SK_API GrBackendSemaphore MakeD3D(const GrD3DFenceInfo& info);
|
|
17
|
+
SK_API GrD3DFenceInfo GetD3DFenceInfo(const GrBackendSemaphore&);
|
|
18
|
+
} // namespace GrBackendSemaphores
|
|
19
|
+
|
|
20
|
+
#endif
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026 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
|
+
#ifndef GrD3DBackendSurface_DEFINED
|
|
8
|
+
#define GrD3DBackendSurface_DEFINED
|
|
9
|
+
|
|
10
|
+
#include "include/private/base/SkAPI.h"
|
|
11
|
+
#include "include/private/gpu/ganesh/GrD3DTypesMinimal.h"
|
|
12
|
+
|
|
13
|
+
#include <string_view>
|
|
14
|
+
|
|
15
|
+
class GrBackendFormat;
|
|
16
|
+
class GrBackendTexture;
|
|
17
|
+
class GrBackendRenderTarget;
|
|
18
|
+
|
|
19
|
+
namespace GrBackendFormats {
|
|
20
|
+
|
|
21
|
+
SK_API GrBackendFormat MakeD3D(DXGI_FORMAT);
|
|
22
|
+
SK_API DXGI_FORMAT AsDxgiFormat(const GrBackendFormat&);
|
|
23
|
+
|
|
24
|
+
} // namespace GrBackendFormats
|
|
25
|
+
|
|
26
|
+
namespace GrBackendTextures {
|
|
27
|
+
|
|
28
|
+
SK_API GrBackendTexture MakeD3D(int width,
|
|
29
|
+
int height,
|
|
30
|
+
const GrD3DTextureResourceInfo& d3dInfo,
|
|
31
|
+
std::string_view label = {});
|
|
32
|
+
|
|
33
|
+
// Return a snapshot of the GrD3DTextureResourceInfo struct.
|
|
34
|
+
// This snapshot will set the fResourceState to the current resource state.
|
|
35
|
+
SK_API GrD3DTextureResourceInfo GetD3DTextureResourceInfo(const GrBackendTexture&);
|
|
36
|
+
|
|
37
|
+
// Anytime the client changes the D3D12_RESOURCE_STATES of the D3D12_RESOURCE captured by this
|
|
38
|
+
// GrBackendTexture, they must call this function to notify Skia of the changed layout.
|
|
39
|
+
SK_API void SetD3DResourceState(GrBackendTexture*, GrD3DResourceStateEnum);
|
|
40
|
+
|
|
41
|
+
} // namespace GrBackendTextures
|
|
42
|
+
|
|
43
|
+
namespace GrBackendRenderTargets {
|
|
44
|
+
|
|
45
|
+
SK_API GrBackendRenderTarget MakeD3D(int width,
|
|
46
|
+
int height,
|
|
47
|
+
const GrD3DTextureResourceInfo& d3dInfo);
|
|
48
|
+
|
|
49
|
+
// Return a snapshot of the GrD3DTextureResourceInfo struct.
|
|
50
|
+
// This snapshot will set the fResourceState to the current resource state.
|
|
51
|
+
SK_API GrD3DTextureResourceInfo GetD3DTextureResourceInfo(const GrBackendRenderTarget&);
|
|
52
|
+
|
|
53
|
+
// Anytime the client changes the D3D12_RESOURCE_STATES of the D3D12_RESOURCE captured by this
|
|
54
|
+
// GrBackendRenderTarget, they must call this function to notify Skia of the changed layout.
|
|
55
|
+
SK_API void SetD3DResourceState(GrBackendRenderTarget*, GrD3DResourceStateEnum);
|
|
56
|
+
|
|
57
|
+
} // namespace GrBackendRenderTargets
|
|
58
|
+
|
|
59
|
+
#endif
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026 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 GrD3DDirectContext_DEFINED
|
|
9
|
+
#define GrD3DDirectContext_DEFINED
|
|
10
|
+
|
|
11
|
+
#include "include/core/SkRefCnt.h"
|
|
12
|
+
#include "include/private/base/SkAPI.h"
|
|
13
|
+
|
|
14
|
+
class GrDirectContext;
|
|
15
|
+
struct GrContextOptions;
|
|
16
|
+
struct GrD3DBackendContext;
|
|
17
|
+
|
|
18
|
+
namespace GrDirectContexts {
|
|
19
|
+
/**
|
|
20
|
+
* Makes a GrDirectContext which uses Direct3D as the backend. The Direct3D context
|
|
21
|
+
* must be kept alive until the returned GrDirectContext is first destroyed or abandoned.
|
|
22
|
+
*/
|
|
23
|
+
SK_API sk_sp<GrDirectContext> MakeD3D(const GrD3DBackendContext& backendContext,
|
|
24
|
+
const GrContextOptions& options);
|
|
25
|
+
SK_API sk_sp<GrDirectContext> MakeD3D(const GrD3DBackendContext& backendContext);
|
|
26
|
+
} // namespace GrDirectContexts
|
|
27
|
+
|
|
28
|
+
#endif
|
|
@@ -12,6 +12,9 @@
|
|
|
12
12
|
#include "include/gpu/ganesh/gl/GrGLTypes.h"
|
|
13
13
|
#include "include/private/base/SkTLogic.h"
|
|
14
14
|
|
|
15
|
+
#if defined(__EMSCRIPTEN__)
|
|
16
|
+
#include <emscripten/version.h>
|
|
17
|
+
#endif
|
|
15
18
|
|
|
16
19
|
extern "C" {
|
|
17
20
|
|
|
@@ -218,7 +221,7 @@ using GrGLMultiDrawElementsInstancedBaseVertexBaseInstanceFn = GrGLvoid GR_GL_FU
|
|
|
218
221
|
/* ARB_sync */
|
|
219
222
|
using GrGLFenceSyncFn = GrGLsync GR_GL_FUNCTION_TYPE(GrGLenum condition, GrGLbitfield flags);
|
|
220
223
|
using GrGLIsSyncFn = GrGLboolean GR_GL_FUNCTION_TYPE(GrGLsync sync);
|
|
221
|
-
#if defined(__EMSCRIPTEN__)
|
|
224
|
+
#if defined(__EMSCRIPTEN__) && (__EMSCRIPTEN_major__ < 5)
|
|
222
225
|
using GrGLClientWaitSyncFn = GrGLenum GR_GL_FUNCTION_TYPE(GrGLsync sync, GrGLbitfield flags, GrGLint timeoutLo, GrGLint timeoutHi);
|
|
223
226
|
using GrGLWaitSyncFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLsync sync, GrGLbitfield flags, GrGLuint timeoutLo, GrGLuint timeoutHi);
|
|
224
227
|
#else
|