@shopify/react-native-skia 0.1.129 → 0.1.130
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/cpp/rnskia-android/SkiaOpenGLRenderer.h +1 -0
- package/cpp/api/JsiSkRuntimeEffect.h +7 -9
- package/cpp/api/JsiSkVertices.h +0 -2
- package/cpp/rnskia/values/RNSkValue.h +1 -1
- package/cpp/skia/include/codec/SkCodec.h +7 -1
- package/cpp/skia/include/core/SkAlphaType.h +45 -0
- package/cpp/skia/include/core/SkBitmap.h +4 -2
- package/cpp/skia/include/core/SkCanvas.h +31 -20
- package/cpp/skia/include/core/SkColor.h +1 -1
- package/cpp/skia/include/core/SkColorFilter.h +1 -0
- package/cpp/skia/include/core/SkColorType.h +66 -0
- package/cpp/skia/include/core/SkDeferredDisplayListRecorder.h +1 -1
- package/cpp/skia/include/core/SkDrawable.h +7 -0
- package/cpp/skia/include/core/SkEncodedImageFormat.h +1 -0
- package/cpp/skia/include/core/SkFont.h +4 -3
- package/cpp/skia/include/core/SkFontArguments.h +33 -1
- package/cpp/skia/include/core/SkGraphics.h +13 -0
- package/cpp/skia/include/core/SkImage.h +67 -22
- package/cpp/skia/include/core/SkImageEncoder.h +0 -3
- package/cpp/skia/include/core/SkImageGenerator.h +4 -3
- package/cpp/skia/include/core/SkImageInfo.h +35 -142
- package/cpp/skia/include/core/SkMesh.h +303 -0
- package/cpp/skia/include/core/SkMilestone.h +1 -1
- package/cpp/skia/include/core/SkOpenTypeSVGDecoder.h +30 -0
- package/cpp/skia/include/core/SkPaint.h +4 -19
- package/cpp/skia/include/core/SkPath.h +20 -33
- package/cpp/skia/include/core/SkPathBuilder.h +1 -6
- package/cpp/skia/include/core/SkPixelRef.h +1 -1
- package/cpp/skia/include/core/SkPixmap.h +3 -2
- package/cpp/skia/include/core/SkRSXform.h +1 -1
- package/cpp/skia/include/core/SkSamplingOptions.h +16 -5
- package/cpp/skia/include/core/SkSpan.h +5 -5
- package/cpp/skia/include/core/SkString.h +5 -8
- package/cpp/skia/include/core/SkSurface.h +21 -0
- package/cpp/skia/include/core/SkTypeface.h +20 -4
- package/cpp/skia/include/core/SkTypes.h +9 -5
- package/cpp/skia/include/effects/SkGradientShader.h +9 -18
- package/cpp/skia/include/effects/SkRuntimeEffect.h +16 -12
- package/cpp/skia/include/gpu/GpuTypes.h +32 -0
- package/cpp/skia/include/gpu/GrBackendSemaphore.h +1 -1
- package/cpp/skia/include/gpu/GrBackendSurface.h +6 -5
- package/cpp/skia/include/gpu/GrBackendSurfaceMutableState.h +1 -1
- package/cpp/skia/include/gpu/GrContextOptions.h +11 -20
- package/cpp/skia/include/gpu/GrContextThreadSafeProxy.h +7 -0
- package/cpp/skia/include/gpu/GrDirectContext.h +16 -11
- package/cpp/skia/include/gpu/GrDriverBugWorkaroundsAutogen.h +0 -2
- package/cpp/skia/include/gpu/GrRecordingContext.h +14 -7
- package/cpp/skia/include/gpu/GrSurfaceInfo.h +6 -6
- package/cpp/skia/include/gpu/dawn/GrDawnTypes.h +1 -1
- package/cpp/skia/include/gpu/gl/GrGLFunctions.h +3 -1
- package/cpp/skia/include/gpu/gl/GrGLInterface.h +2 -2
- package/cpp/skia/include/gpu/graphite/BackendTexture.h +64 -0
- package/cpp/skia/include/gpu/graphite/Context.h +124 -0
- package/cpp/skia/include/gpu/graphite/GraphiteTypes.h +71 -0
- package/cpp/skia/include/gpu/graphite/Recorder.h +104 -0
- package/cpp/skia/include/gpu/graphite/Recording.h +39 -0
- package/cpp/skia/include/gpu/graphite/SkStuff.h +47 -0
- package/cpp/skia/include/gpu/graphite/TextureInfo.h +91 -0
- package/cpp/skia/include/gpu/graphite/mtl/MtlBackendContext.h +24 -0
- package/cpp/skia/include/gpu/graphite/mtl/MtlTypes.h +68 -0
- package/cpp/skia/include/gpu/mock/GrMockTypes.h +1 -2
- package/cpp/skia/include/ports/SkCFObject.h +0 -4
- package/cpp/skia/include/ports/SkTypeface_win.h +2 -2
- package/cpp/skia/include/private/{GrSingleOwner.h → SingleOwner.h} +17 -10
- package/cpp/skia/include/private/SkChecksum.h +11 -0
- package/cpp/skia/include/private/SkEncodedInfo.h +22 -5
- package/cpp/skia/include/private/SkFloatingPoint.h +0 -53
- package/cpp/skia/include/private/SkImageInfoPriv.h +8 -2
- package/cpp/skia/include/private/SkMacros.h +13 -18
- package/cpp/skia/include/private/SkMutex.h +8 -0
- package/cpp/skia/include/private/SkPathRef.h +2 -16
- package/cpp/skia/include/private/SkSLDefines.h +9 -1
- package/cpp/skia/include/private/SkSLIRNode.h +6 -5
- package/cpp/skia/include/private/SkSLLayout.h +11 -10
- package/cpp/skia/include/private/SkSLModifiers.h +4 -3
- package/cpp/skia/include/private/SkSLProgramElement.h +2 -2
- package/cpp/skia/include/private/SkSLProgramKind.h +8 -5
- package/cpp/skia/include/private/SkSLStatement.h +2 -3
- package/cpp/skia/include/private/SkSLString.h +17 -56
- package/cpp/skia/include/private/SkSLSymbol.h +4 -4
- package/cpp/skia/include/private/SkShadowFlags.h +3 -1
- package/cpp/skia/include/private/SkStringView.h +47 -0
- package/cpp/skia/include/private/SkTArray.h +4 -3
- package/cpp/skia/include/private/SkTHash.h +66 -24
- package/cpp/skia/include/private/SkTLogic.h +2 -32
- package/cpp/skia/include/private/SkTemplates.h +2 -2
- package/cpp/skia/include/private/SkThreadAnnotations.h +4 -4
- package/cpp/skia/include/private/SkVx.h +28 -28
- package/cpp/skia/include/private/chromium/GrSlug.h +40 -3
- package/cpp/skia/include/private/chromium/SkChromeRemoteGlyphCache.h +12 -6
- package/cpp/skia/include/private/{GrContext_Base.h → gpu/ganesh/GrContext_Base.h} +7 -0
- package/cpp/skia/include/private/{GrD3DTypesMinimal.h → gpu/ganesh/GrD3DTypesMinimal.h} +0 -0
- package/cpp/skia/include/private/{GrDawnTypesPriv.h → gpu/ganesh/GrDawnTypesPriv.h} +0 -0
- package/cpp/skia/include/private/{GrGLTypesPriv.h → gpu/ganesh/GrGLTypesPriv.h} +1 -0
- package/cpp/skia/include/private/{GrImageContext.h → gpu/ganesh/GrImageContext.h} +4 -4
- package/cpp/skia/include/private/{GrMockTypesPriv.h → gpu/ganesh/GrMockTypesPriv.h} +0 -0
- package/cpp/skia/include/private/{GrMtlTypesPriv.h → gpu/ganesh/GrMtlTypesPriv.h} +0 -0
- package/cpp/skia/include/private/{GrTypesPriv.h → gpu/ganesh/GrTypesPriv.h} +25 -367
- package/cpp/skia/include/private/{GrVkTypesPriv.h → gpu/ganesh/GrVkTypesPriv.h} +0 -0
- package/cpp/skia/include/private/gpu/graphite/MtlTypesPriv.h +74 -0
- package/cpp/skia/include/sksl/DSL.h +4 -0
- package/cpp/skia/include/sksl/DSLBlock.h +8 -3
- package/cpp/skia/include/sksl/DSLCase.h +6 -6
- package/cpp/skia/include/sksl/DSLCore.h +89 -78
- package/cpp/skia/include/sksl/DSLExpression.h +78 -45
- package/cpp/skia/include/sksl/DSLFunction.h +23 -18
- package/cpp/skia/include/sksl/DSLLayout.h +14 -16
- package/cpp/skia/include/sksl/DSLModifiers.h +7 -5
- package/cpp/skia/include/sksl/DSLRuntimeEffects.h +1 -1
- package/cpp/skia/include/sksl/DSLStatement.h +16 -10
- package/cpp/skia/include/sksl/DSLSymbols.h +7 -7
- package/cpp/skia/include/sksl/DSLType.h +27 -23
- package/cpp/skia/include/sksl/DSLVar.h +72 -61
- package/cpp/skia/include/sksl/SkSLErrorReporter.h +12 -49
- package/cpp/skia/include/sksl/SkSLOperator.h +151 -0
- package/cpp/skia/include/sksl/SkSLPosition.h +102 -0
- package/cpp/skia/include/svg/SkSVGCanvas.h +5 -1
- package/cpp/skia/include/utils/SkAnimCodecPlayer.h +7 -0
- package/cpp/skia/include/utils/SkCamera.h +2 -0
- package/cpp/skia/include/utils/SkCanvasStateUtils.h +4 -1
- package/cpp/skia/include/utils/SkCustomTypeface.h +6 -4
- package/cpp/skia/include/utils/SkNWayCanvas.h +34 -0
- package/cpp/skia/include/utils/SkNullCanvas.h +5 -1
- package/cpp/skia/include/utils/SkOrderedFontMgr.h +12 -0
- package/cpp/skia/include/utils/SkPaintFilterCanvas.h +30 -1
- package/cpp/skia/include/utils/SkParse.h +2 -0
- package/cpp/skia/include/utils/SkShadowUtils.h +3 -2
- package/cpp/skia/include/utils/SkTextUtils.h +8 -4
- package/cpp/skia/modules/svg/include/SkSVGAttributeParser.h +27 -1
- package/cpp/skia/modules/svg/include/SkSVGDOM.h +4 -0
- package/cpp/skia/modules/svg/include/SkSVGOpenTypeSVGDecoder.h +32 -0
- package/cpp/skia/modules/svg/include/SkSVGRenderContext.h +3 -3
- package/cpp/skia/modules/svg/include/SkSVGSVG.h +2 -0
- package/cpp/skia/modules/svg/include/SkSVGTypes.h +48 -9
- package/ios/RNSkia-iOS/PlatformContext.h +1 -1
- package/ios/RNSkia-iOS/RNSkDrawViewImpl.mm +1 -0
- package/ios/RNSkia-iOS/SkiaDrawView.mm +1 -1
- package/lib/commonjs/renderer/components/shaders/Shader.js +1 -2
- package/lib/commonjs/renderer/components/shaders/Shader.js.map +1 -1
- package/lib/module/renderer/components/shaders/Shader.js +1 -2
- package/lib/module/renderer/components/shaders/Shader.js.map +1 -1
- package/lib/typescript/src/renderer/components/shaders/Shader.d.ts +0 -1
- package/lib/typescript/src/skia/types/RuntimeEffect/RuntimeEffect.d.ts +2 -4
- package/libs/android/arm64-v8a/libskia.a +0 -0
- package/libs/android/arm64-v8a/libsvg.a +0 -0
- package/libs/android/armeabi-v7a/libskia.a +0 -0
- package/libs/android/armeabi-v7a/libsvg.a +0 -0
- package/libs/android/x86/libskia.a +0 -0
- package/libs/android/x86/libsvg.a +0 -0
- package/libs/android/x86_64/libskia.a +0 -0
- package/libs/android/x86_64/libsvg.a +0 -0
- package/libs/ios/libskia.xcframework/Info.plist +5 -5
- package/libs/ios/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
- package/libs/ios/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
- package/libs/ios/libskshaper.xcframework/Info.plist +5 -5
- package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
- package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
- package/libs/ios/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
- package/libs/ios/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
- package/package.json +2 -2
- package/src/renderer/components/shaders/Shader.tsx +1 -3
- package/src/skia/types/RuntimeEffect/RuntimeEffect.ts +1 -8
- package/cpp/skia/include/core/SkCustomMesh.h +0 -202
- package/cpp/skia/include/core/SkStringView.h +0 -185
- package/cpp/skia/include/private/SkPaintParamsKey.h +0 -110
- package/cpp/skia/include/private/SkShaderCodeDictionary.h +0 -63
- package/cpp/skia/include/private/SkTOptional.h +0 -362
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
#define GrRecordingContext_DEFINED
|
|
10
10
|
|
|
11
11
|
#include "include/core/SkRefCnt.h"
|
|
12
|
-
#include "include/private/GrImageContext.h"
|
|
13
12
|
#include "include/private/SkTArray.h"
|
|
13
|
+
#include "include/private/gpu/ganesh/GrImageContext.h"
|
|
14
14
|
|
|
15
15
|
#if GR_GPU_STATS && GR_TEST_UTILS
|
|
16
16
|
#include <map>
|
|
@@ -26,13 +26,16 @@ class GrProgramDesc;
|
|
|
26
26
|
class GrProgramInfo;
|
|
27
27
|
class GrProxyProvider;
|
|
28
28
|
class GrRecordingContextPriv;
|
|
29
|
-
class GrSubRunAllocator;
|
|
30
29
|
class GrSurfaceProxy;
|
|
31
30
|
class GrTextBlobRedrawCoordinator;
|
|
32
31
|
class GrThreadSafeCache;
|
|
33
32
|
class SkArenaAlloc;
|
|
34
33
|
class SkJSONWriter;
|
|
35
34
|
|
|
35
|
+
namespace sktext::gpu {
|
|
36
|
+
class SubRunAllocator;
|
|
37
|
+
}
|
|
38
|
+
|
|
36
39
|
#if GR_TEST_UTILS
|
|
37
40
|
class SkString;
|
|
38
41
|
#endif
|
|
@@ -90,7 +93,9 @@ public:
|
|
|
90
93
|
* rendering is supported for the color type. 0 is returned if rendering to this color type
|
|
91
94
|
* is not supported at all.
|
|
92
95
|
*/
|
|
93
|
-
SK_API int maxSurfaceSampleCountForColorType(SkColorType) const
|
|
96
|
+
SK_API int maxSurfaceSampleCountForColorType(SkColorType colorType) const {
|
|
97
|
+
return INHERITED::maxSurfaceSampleCountForColorType(colorType);
|
|
98
|
+
}
|
|
94
99
|
|
|
95
100
|
// Provides access to functions that aren't part of the public API.
|
|
96
101
|
GrRecordingContextPriv priv();
|
|
@@ -100,17 +105,19 @@ public:
|
|
|
100
105
|
// GrRecordingContext. Arenas does not maintain ownership of the pools it groups together.
|
|
101
106
|
class Arenas {
|
|
102
107
|
public:
|
|
103
|
-
Arenas(SkArenaAlloc*,
|
|
108
|
+
Arenas(SkArenaAlloc*, sktext::gpu::SubRunAllocator*);
|
|
104
109
|
|
|
105
110
|
// For storing pipelines and other complex data as-needed by ops
|
|
106
111
|
SkArenaAlloc* recordTimeAllocator() { return fRecordTimeAllocator; }
|
|
107
112
|
|
|
108
113
|
// For storing GrTextBlob SubRuns
|
|
109
|
-
|
|
114
|
+
sktext::gpu::SubRunAllocator* recordTimeSubRunAllocator() {
|
|
115
|
+
return fRecordTimeSubRunAllocator;
|
|
116
|
+
}
|
|
110
117
|
|
|
111
118
|
private:
|
|
112
119
|
SkArenaAlloc* fRecordTimeAllocator;
|
|
113
|
-
|
|
120
|
+
sktext::gpu::SubRunAllocator* fRecordTimeSubRunAllocator;
|
|
114
121
|
};
|
|
115
122
|
|
|
116
123
|
protected:
|
|
@@ -131,7 +138,7 @@ protected:
|
|
|
131
138
|
private:
|
|
132
139
|
bool fDDLRecording;
|
|
133
140
|
std::unique_ptr<SkArenaAlloc> fRecordTimeAllocator;
|
|
134
|
-
std::unique_ptr<
|
|
141
|
+
std::unique_ptr<sktext::gpu::SubRunAllocator> fRecordTimeSubRunAllocator;
|
|
135
142
|
};
|
|
136
143
|
|
|
137
144
|
GrRecordingContext(sk_sp<GrContextThreadSafeProxy>, bool ddlRecording);
|
|
@@ -11,22 +11,22 @@
|
|
|
11
11
|
#include "include/gpu/GrTypes.h"
|
|
12
12
|
|
|
13
13
|
#ifdef SK_GL
|
|
14
|
-
#include "include/private/GrGLTypesPriv.h"
|
|
14
|
+
#include "include/private/gpu/ganesh/GrGLTypesPriv.h"
|
|
15
15
|
#endif
|
|
16
16
|
#ifdef SK_VULKAN
|
|
17
|
-
#include "include/private/GrVkTypesPriv.h"
|
|
17
|
+
#include "include/private/gpu/ganesh/GrVkTypesPriv.h"
|
|
18
18
|
#endif
|
|
19
19
|
#ifdef SK_DIRECT3D
|
|
20
|
-
#include "include/private/GrD3DTypesMinimal.h"
|
|
20
|
+
#include "include/private/gpu/ganesh/GrD3DTypesMinimal.h"
|
|
21
21
|
struct GrD3DSurfaceInfo;
|
|
22
22
|
#endif
|
|
23
23
|
#ifdef SK_METAL
|
|
24
|
-
#include "include/private/GrMtlTypesPriv.h"
|
|
24
|
+
#include "include/private/gpu/ganesh/GrMtlTypesPriv.h"
|
|
25
25
|
#endif
|
|
26
26
|
#ifdef SK_DAWN
|
|
27
|
-
#include "include/private/GrDawnTypesPriv.h"
|
|
27
|
+
#include "include/private/gpu/ganesh/GrDawnTypesPriv.h"
|
|
28
28
|
#endif
|
|
29
|
-
#include "include/private/GrMockTypesPriv.h"
|
|
29
|
+
#include "include/private/gpu/ganesh/GrMockTypesPriv.h"
|
|
30
30
|
|
|
31
31
|
class GrSurfaceInfo {
|
|
32
32
|
public:
|
|
@@ -96,6 +96,7 @@ using GrGLGenVertexArraysFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLsizei n, GrGLuint
|
|
|
96
96
|
using GrGLGetBufferParameterivFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum target, GrGLenum pname, GrGLint* params);
|
|
97
97
|
using GrGLGetErrorFn = GrGLenum GR_GL_FUNCTION_TYPE();
|
|
98
98
|
using GrGLGetFramebufferAttachmentParameterivFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum target, GrGLenum attachment, GrGLenum pname, GrGLint* params);
|
|
99
|
+
using GrGLGetFloatvFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum pname, GrGLfloat* params);
|
|
99
100
|
using GrGLGetIntegervFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum pname, GrGLint* params);
|
|
100
101
|
using GrGLGetMultisamplefvFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum pname, GrGLuint index, GrGLfloat* val);
|
|
101
102
|
using GrGLGetProgramBinaryFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLuint program, GrGLsizei bufsize, GrGLsizei* length, GrGLenum* binaryFormat, void* binary);
|
|
@@ -142,7 +143,8 @@ using GrGLReadPixelsFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLint x, GrGLint y, GrGL
|
|
|
142
143
|
using GrGLRenderbufferStorageFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum target, GrGLenum internalformat, GrGLsizei width, GrGLsizei height);
|
|
143
144
|
using GrGLRenderbufferStorageMultisampleFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum target, GrGLsizei samples, GrGLenum internalformat, GrGLsizei width, GrGLsizei height);
|
|
144
145
|
using GrGLResolveMultisampleFramebufferFn = GrGLvoid GR_GL_FUNCTION_TYPE();
|
|
145
|
-
using
|
|
146
|
+
using GrGLSamplerParameterfFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLuint sampler, GrGLenum pname, GrGLfloat param);
|
|
147
|
+
using GrGLSamplerParameteriFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLuint sampler, GrGLenum pname, GrGLint param);
|
|
146
148
|
using GrGLSamplerParameterivFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLuint sampler, GrGLenum pname, const GrGLint* params);
|
|
147
149
|
using GrGLScissorFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLint x, GrGLint y, GrGLsizei width, GrGLsizei height);
|
|
148
150
|
// GL_CHROMIUM_bind_uniform_location
|
|
@@ -31,8 +31,6 @@ struct GrGLInterface;
|
|
|
31
31
|
* appropriate one to build.
|
|
32
32
|
*/
|
|
33
33
|
SK_API sk_sp<const GrGLInterface> GrGLMakeNativeInterface();
|
|
34
|
-
// Deprecated alternative to GrGLMakeNativeInterface().
|
|
35
|
-
SK_API const GrGLInterface* GrGLCreateNativeInterface();
|
|
36
34
|
|
|
37
35
|
/**
|
|
38
36
|
* GrContext uses the following interface to make all calls into OpenGL. When a
|
|
@@ -170,6 +168,7 @@ public:
|
|
|
170
168
|
GrGLFunction<GrGLGetBufferParameterivFn> fGetBufferParameteriv;
|
|
171
169
|
GrGLFunction<GrGLGetErrorFn> fGetError;
|
|
172
170
|
GrGLFunction<GrGLGetFramebufferAttachmentParameterivFn> fGetFramebufferAttachmentParameteriv;
|
|
171
|
+
GrGLFunction<GrGLGetFloatvFn> fGetFloatv;
|
|
173
172
|
GrGLFunction<GrGLGetIntegervFn> fGetIntegerv;
|
|
174
173
|
GrGLFunction<GrGLGetMultisamplefvFn> fGetMultisamplefv;
|
|
175
174
|
GrGLFunction<GrGLGetProgramBinaryFn> fGetProgramBinary;
|
|
@@ -248,6 +247,7 @@ public:
|
|
|
248
247
|
GrGLFunction<GrGLBindUniformLocationFn> fBindUniformLocation;
|
|
249
248
|
|
|
250
249
|
GrGLFunction<GrGLResolveMultisampleFramebufferFn> fResolveMultisampleFramebuffer;
|
|
250
|
+
GrGLFunction<GrGLSamplerParameterfFn> fSamplerParameterf;
|
|
251
251
|
GrGLFunction<GrGLSamplerParameteriFn> fSamplerParameteri;
|
|
252
252
|
GrGLFunction<GrGLSamplerParameterivFn> fSamplerParameteriv;
|
|
253
253
|
GrGLFunction<GrGLScissorFn> fScissor;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2021 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_BackendTexture_DEFINED
|
|
9
|
+
#define skgpu_graphite_BackendTexture_DEFINED
|
|
10
|
+
|
|
11
|
+
#include "include/core/SkSize.h"
|
|
12
|
+
#include "include/gpu/graphite/GraphiteTypes.h"
|
|
13
|
+
#include "include/gpu/graphite/TextureInfo.h"
|
|
14
|
+
|
|
15
|
+
#ifdef SK_METAL
|
|
16
|
+
#include "include/gpu/graphite/mtl/MtlTypes.h"
|
|
17
|
+
#endif
|
|
18
|
+
|
|
19
|
+
namespace skgpu::graphite {
|
|
20
|
+
|
|
21
|
+
class BackendTexture {
|
|
22
|
+
public:
|
|
23
|
+
BackendTexture() {}
|
|
24
|
+
#ifdef SK_METAL
|
|
25
|
+
// The BackendTexture will not call retain or release on the passed in MtlHandle. Thus the
|
|
26
|
+
// client must keep the MtlHandle valid until they are no longer using the BackendTexture.
|
|
27
|
+
BackendTexture(SkISize dimensions, MtlHandle mtlTexture);
|
|
28
|
+
#endif
|
|
29
|
+
|
|
30
|
+
BackendTexture(const BackendTexture&);
|
|
31
|
+
|
|
32
|
+
~BackendTexture();
|
|
33
|
+
|
|
34
|
+
BackendTexture& operator=(const BackendTexture&);
|
|
35
|
+
|
|
36
|
+
bool operator==(const BackendTexture&) const;
|
|
37
|
+
bool operator!=(const BackendTexture& that) const { return !(*this == that); }
|
|
38
|
+
|
|
39
|
+
bool isValid() const { return fInfo.isValid(); }
|
|
40
|
+
BackendApi backend() const { return fInfo.backend(); }
|
|
41
|
+
|
|
42
|
+
SkISize dimensions() const { return fDimensions; }
|
|
43
|
+
|
|
44
|
+
const TextureInfo& info() const { return fInfo; }
|
|
45
|
+
|
|
46
|
+
#ifdef SK_METAL
|
|
47
|
+
MtlHandle getMtlTexture() const;
|
|
48
|
+
#endif
|
|
49
|
+
|
|
50
|
+
private:
|
|
51
|
+
SkISize fDimensions;
|
|
52
|
+
TextureInfo fInfo;
|
|
53
|
+
|
|
54
|
+
union {
|
|
55
|
+
#ifdef SK_METAL
|
|
56
|
+
MtlHandle fMtlTexture;
|
|
57
|
+
#endif
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
} // namespace skgpu::graphite
|
|
62
|
+
|
|
63
|
+
#endif // skgpu_graphite_BackendTexture_DEFINED
|
|
64
|
+
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2021 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_Context_DEFINED
|
|
9
|
+
#define skgpu_graphite_Context_DEFINED
|
|
10
|
+
|
|
11
|
+
#include <vector>
|
|
12
|
+
#include "include/core/SkBlendMode.h"
|
|
13
|
+
#include "include/core/SkRefCnt.h"
|
|
14
|
+
#include "include/core/SkShader.h"
|
|
15
|
+
#include "include/core/SkTileMode.h"
|
|
16
|
+
#include "include/private/SkNoncopyable.h"
|
|
17
|
+
|
|
18
|
+
#include "include/gpu/graphite/GraphiteTypes.h"
|
|
19
|
+
|
|
20
|
+
namespace skgpu::graphite {
|
|
21
|
+
|
|
22
|
+
class BackendTexture;
|
|
23
|
+
class CommandBuffer;
|
|
24
|
+
class ContextPriv;
|
|
25
|
+
class GlobalCache;
|
|
26
|
+
class Gpu;
|
|
27
|
+
struct MtlBackendContext;
|
|
28
|
+
class Recorder;
|
|
29
|
+
class Recording;
|
|
30
|
+
class TextureInfo;
|
|
31
|
+
|
|
32
|
+
struct ShaderCombo {
|
|
33
|
+
enum class ShaderType {
|
|
34
|
+
kNone, // does not modify color buffer, e.g. depth and/or stencil only
|
|
35
|
+
kSolidColor,
|
|
36
|
+
kLinearGradient,
|
|
37
|
+
kRadialGradient,
|
|
38
|
+
kSweepGradient,
|
|
39
|
+
kConicalGradient
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
ShaderCombo() {}
|
|
43
|
+
ShaderCombo(std::vector<ShaderType> types,
|
|
44
|
+
std::vector<SkTileMode> tileModes)
|
|
45
|
+
: fTypes(std::move(types))
|
|
46
|
+
, fTileModes(std::move(tileModes)) {
|
|
47
|
+
}
|
|
48
|
+
std::vector<ShaderType> fTypes;
|
|
49
|
+
std::vector<SkTileMode> fTileModes;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
struct PaintCombo {
|
|
53
|
+
std::vector<ShaderCombo> fShaders;
|
|
54
|
+
std::vector<SkBlendMode> fBlendModes;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
class Context final {
|
|
58
|
+
public:
|
|
59
|
+
Context(const Context&) = delete;
|
|
60
|
+
Context(Context&&) = delete;
|
|
61
|
+
Context& operator=(const Context&) = delete;
|
|
62
|
+
Context& operator=(Context&&) = delete;
|
|
63
|
+
|
|
64
|
+
~Context();
|
|
65
|
+
|
|
66
|
+
#ifdef SK_METAL
|
|
67
|
+
static std::unique_ptr<Context> MakeMetal(const skgpu::graphite::MtlBackendContext&);
|
|
68
|
+
#endif
|
|
69
|
+
|
|
70
|
+
BackendApi backend() const { return fBackend; }
|
|
71
|
+
|
|
72
|
+
std::unique_ptr<Recorder> makeRecorder();
|
|
73
|
+
|
|
74
|
+
void insertRecording(const InsertRecordingInfo&);
|
|
75
|
+
void submit(SyncToCpu = SyncToCpu::kNo);
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Checks whether any asynchronous work is complete and if so calls related callbacks.
|
|
79
|
+
*/
|
|
80
|
+
void checkAsyncWorkCompletion();
|
|
81
|
+
|
|
82
|
+
void preCompile(const PaintCombo&);
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Creates a new backend gpu texture matching the dimensinos and TextureInfo. If an invalid
|
|
86
|
+
* TextureInfo or a TextureInfo Skia can't support is passed in, this will return an invalid
|
|
87
|
+
* BackendTexture. Thus the client should check isValid on the returned BackendTexture to know
|
|
88
|
+
* if it succeeded or not.
|
|
89
|
+
*
|
|
90
|
+
* If this does return a valid BackendTexture, the caller is required to use
|
|
91
|
+
* Context::deleteBackendTexture to delete that texture.
|
|
92
|
+
*/
|
|
93
|
+
BackendTexture createBackendTexture(SkISize dimensions, const TextureInfo&);
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Called to delete the passed in BackendTexture. This should only be called if the
|
|
97
|
+
* BackendTexture was created by calling Context::createBackendTexture. If the BackendTexture is
|
|
98
|
+
* not valid or does not match the BackendApi of the Context then nothing happens.
|
|
99
|
+
*
|
|
100
|
+
* Otherwise this will delete/release the backend object that is wrapped in the BackendTexture.
|
|
101
|
+
* The BackendTexture will be reset to an invalid state and should not be used again.
|
|
102
|
+
*/
|
|
103
|
+
void deleteBackendTexture(BackendTexture&);
|
|
104
|
+
|
|
105
|
+
// Provides access to functions that aren't part of the public API.
|
|
106
|
+
ContextPriv priv();
|
|
107
|
+
const ContextPriv priv() const; // NOLINT(readability-const-return-type)
|
|
108
|
+
|
|
109
|
+
protected:
|
|
110
|
+
Context(sk_sp<Gpu>, BackendApi);
|
|
111
|
+
|
|
112
|
+
private:
|
|
113
|
+
friend class ContextPriv;
|
|
114
|
+
|
|
115
|
+
sk_sp<CommandBuffer> fCurrentCommandBuffer;
|
|
116
|
+
|
|
117
|
+
sk_sp<Gpu> fGpu;
|
|
118
|
+
sk_sp<GlobalCache> fGlobalCache;
|
|
119
|
+
BackendApi fBackend;
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
} // namespace skgpu::graphite
|
|
123
|
+
|
|
124
|
+
#endif // skgpu_graphite_Context_DEFINED
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2021 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_GraphiteTypes_DEFINED
|
|
9
|
+
#define skgpu_graphite_GraphiteTypes_DEFINED
|
|
10
|
+
|
|
11
|
+
#include "include/core/SkTypes.h"
|
|
12
|
+
#include "include/gpu/GpuTypes.h"
|
|
13
|
+
|
|
14
|
+
#include <memory>
|
|
15
|
+
|
|
16
|
+
namespace skgpu::graphite {
|
|
17
|
+
|
|
18
|
+
class Recording;
|
|
19
|
+
|
|
20
|
+
using GpuFinishedContext = void*;
|
|
21
|
+
using GpuFinishedProc = void (*)(GpuFinishedContext finishedContext, CallbackResult);
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The fFinishedProc is called when the Recording has been submitted and finished on the GPU, or
|
|
25
|
+
* when there is a failure that caused it not to be submitted. The callback will always be called
|
|
26
|
+
* and the caller can use the callback to know it is safe to free any resources associated with
|
|
27
|
+
* the Recording that they may be holding onto. If the Recording is successfully submitted to the
|
|
28
|
+
* GPU the callback will be called with CallbackResult::kSuccess once the GPU has finished. All
|
|
29
|
+
* other cases where some failure occured it will be called with CallbackResult::kFailed.
|
|
30
|
+
*/
|
|
31
|
+
struct InsertRecordingInfo {
|
|
32
|
+
Recording* fRecording = nullptr;
|
|
33
|
+
GpuFinishedContext fFinishedContext = nullptr;
|
|
34
|
+
GpuFinishedProc fFinishedProc = nullptr;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Actually submit work to the GPU and track its completion
|
|
39
|
+
*/
|
|
40
|
+
enum class SyncToCpu : bool {
|
|
41
|
+
kYes = true,
|
|
42
|
+
kNo = false
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Possible 3D APIs that may be used by Graphite.
|
|
47
|
+
*/
|
|
48
|
+
enum class BackendApi : unsigned {
|
|
49
|
+
kMetal,
|
|
50
|
+
kMock,
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Is the texture mipmapped or not
|
|
55
|
+
*/
|
|
56
|
+
enum class Mipmapped: bool {
|
|
57
|
+
kNo = false,
|
|
58
|
+
kYes = true,
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Is the data protected on the GPU or not.
|
|
63
|
+
*/
|
|
64
|
+
enum class Protected : bool {
|
|
65
|
+
kNo = false,
|
|
66
|
+
kYes = true,
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
} // namespace skgpu::graphite
|
|
70
|
+
|
|
71
|
+
#endif // skgpu_graphite_GraphiteTypes_DEFINED
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2021 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_Recorder_DEFINED
|
|
9
|
+
#define skgpu_graphite_Recorder_DEFINED
|
|
10
|
+
|
|
11
|
+
#include "include/core/SkRefCnt.h"
|
|
12
|
+
#include "include/private/SingleOwner.h"
|
|
13
|
+
|
|
14
|
+
#include <vector>
|
|
15
|
+
|
|
16
|
+
class SkTextureDataBlock;
|
|
17
|
+
class SkUniformDataBlock;
|
|
18
|
+
class SkUniformDataBlockPassThrough; // TODO: remove
|
|
19
|
+
|
|
20
|
+
namespace skgpu::graphite {
|
|
21
|
+
|
|
22
|
+
class Caps;
|
|
23
|
+
class Device;
|
|
24
|
+
class DrawBufferManager;
|
|
25
|
+
class GlobalCache;
|
|
26
|
+
class Gpu;
|
|
27
|
+
class RecorderPriv;
|
|
28
|
+
class Recording;
|
|
29
|
+
class ResourceProvider;
|
|
30
|
+
class Task;
|
|
31
|
+
class TaskGraph;
|
|
32
|
+
class UploadBufferManager;
|
|
33
|
+
|
|
34
|
+
template<typename StorageT, typename BaseT> class PipelineDataCache;
|
|
35
|
+
using UniformDataCache = PipelineDataCache<SkUniformDataBlockPassThrough, SkUniformDataBlock>;
|
|
36
|
+
using TextureDataCache = PipelineDataCache<std::unique_ptr<SkTextureDataBlock>, SkTextureDataBlock>;
|
|
37
|
+
|
|
38
|
+
class Recorder final {
|
|
39
|
+
public:
|
|
40
|
+
Recorder(const Recorder&) = delete;
|
|
41
|
+
Recorder(Recorder&&) = delete;
|
|
42
|
+
Recorder& operator=(const Recorder&) = delete;
|
|
43
|
+
Recorder& operator=(Recorder&&) = delete;
|
|
44
|
+
|
|
45
|
+
~Recorder();
|
|
46
|
+
|
|
47
|
+
std::unique_ptr<Recording> snap();
|
|
48
|
+
|
|
49
|
+
// Provides access to functions that aren't part of the public API.
|
|
50
|
+
RecorderPriv priv();
|
|
51
|
+
const RecorderPriv priv() const; // NOLINT(readability-const-return-type)
|
|
52
|
+
|
|
53
|
+
#if GR_TEST_UTILS
|
|
54
|
+
bool deviceIsRegistered(Device*);
|
|
55
|
+
#endif
|
|
56
|
+
|
|
57
|
+
private:
|
|
58
|
+
friend class Context; // For ctor
|
|
59
|
+
friend class Device; // For registering and deregistering Devices;
|
|
60
|
+
friend class RecorderPriv; // for ctor and hidden methods
|
|
61
|
+
|
|
62
|
+
Recorder(sk_sp<Gpu>, sk_sp<GlobalCache>);
|
|
63
|
+
|
|
64
|
+
SingleOwner* singleOwner() const { return &fSingleOwner; }
|
|
65
|
+
|
|
66
|
+
// We keep track of all Devices that are connected to a Recorder. This allows the client to
|
|
67
|
+
// safely delete an SkSurface or a Recorder in any order. If the client deletes the Recorder
|
|
68
|
+
// we need to notify all Devices that the Recorder is no longer valid. If we delete the
|
|
69
|
+
// SkSurface/Device first we will flush all the Device's into the Recorder before deregistering
|
|
70
|
+
// it from the Recorder.
|
|
71
|
+
//
|
|
72
|
+
// We do not need to take a ref on the Device since the Device will flush and deregister itself
|
|
73
|
+
// in its dtor. There is no other need for the Recorder to know about the Device after this
|
|
74
|
+
// point.
|
|
75
|
+
//
|
|
76
|
+
// Note: We could probably get by with only registering Devices directly connected to
|
|
77
|
+
// SkSurfaces. All other one off Devices will be created in a controlled scope where the
|
|
78
|
+
// Recorder should still be valid by the time they need to flush their work when the Device is
|
|
79
|
+
// deleted. We would have to make sure we safely handle cases where a client calls saveLayer
|
|
80
|
+
// then either deletes the SkSurface or Recorder before calling restore. For simplicity we just
|
|
81
|
+
// register every device for now, but if we see extra overhead in pushing back the extra
|
|
82
|
+
// pointers, we can look into only registering SkSurface Devices.
|
|
83
|
+
void registerDevice(Device*);
|
|
84
|
+
void deregisterDevice(const Device*);
|
|
85
|
+
|
|
86
|
+
sk_sp<Gpu> fGpu;
|
|
87
|
+
std::unique_ptr<ResourceProvider> fResourceProvider;
|
|
88
|
+
|
|
89
|
+
std::unique_ptr<TaskGraph> fGraph;
|
|
90
|
+
std::unique_ptr<UniformDataCache> fUniformDataCache;
|
|
91
|
+
std::unique_ptr<TextureDataCache> fTextureDataCache;
|
|
92
|
+
std::unique_ptr<DrawBufferManager> fDrawBufferManager;
|
|
93
|
+
std::unique_ptr<UploadBufferManager> fUploadBufferManager;
|
|
94
|
+
std::vector<Device*> fTrackedDevices;
|
|
95
|
+
|
|
96
|
+
// In debug builds we guard against improper thread handling
|
|
97
|
+
// This guard is passed to the ResourceCache.
|
|
98
|
+
// TODO: Should we also pass this to Device, DrawContext, and similar classes?
|
|
99
|
+
mutable SingleOwner fSingleOwner;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
} // namespace skgpu::graphite
|
|
103
|
+
|
|
104
|
+
#endif // skgpu_graphite_Recorder_DEFINED
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2021 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_Recording_DEFINED
|
|
9
|
+
#define skgpu_graphite_Recording_DEFINED
|
|
10
|
+
|
|
11
|
+
#include "include/core/SkRefCnt.h"
|
|
12
|
+
|
|
13
|
+
class SkTextureDataBlock;
|
|
14
|
+
|
|
15
|
+
namespace skgpu::graphite {
|
|
16
|
+
|
|
17
|
+
class CommandBuffer;
|
|
18
|
+
template<typename StorageT, typename BaseT> class PipelineDataCache;
|
|
19
|
+
using TextureDataCache = PipelineDataCache<std::unique_ptr<SkTextureDataBlock>, SkTextureDataBlock>;
|
|
20
|
+
|
|
21
|
+
class Recording final {
|
|
22
|
+
public:
|
|
23
|
+
~Recording();
|
|
24
|
+
|
|
25
|
+
protected:
|
|
26
|
+
private:
|
|
27
|
+
friend class Context; // for access fCommandBuffer
|
|
28
|
+
friend class Recorder; // for ctor
|
|
29
|
+
Recording(sk_sp<CommandBuffer>, std::unique_ptr<TextureDataCache>);
|
|
30
|
+
|
|
31
|
+
sk_sp<CommandBuffer> fCommandBuffer;
|
|
32
|
+
|
|
33
|
+
// The TextureDataCache holds all the Textures and Samplers used in this Recording.
|
|
34
|
+
std::unique_ptr<TextureDataCache> fTextureDataCache;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
} // namespace skgpu::graphite
|
|
38
|
+
|
|
39
|
+
#endif // skgpu_graphite_Recording_DEFINED
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2021 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 SkStuff_DEFINED
|
|
9
|
+
#define SkStuff_DEFINED
|
|
10
|
+
|
|
11
|
+
#include "include/core/SkImageInfo.h"
|
|
12
|
+
#include "include/core/SkRefCnt.h"
|
|
13
|
+
|
|
14
|
+
class SkColorSpace;
|
|
15
|
+
class SkSurface;
|
|
16
|
+
class SkSurfaceProps;
|
|
17
|
+
|
|
18
|
+
namespace skgpu::graphite {
|
|
19
|
+
class BackendTexture;
|
|
20
|
+
class Recorder;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// TODO: Should be in SkSurface.h
|
|
24
|
+
sk_sp<SkSurface> MakeGraphite(skgpu::graphite::Recorder*, const SkImageInfo&);
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Wraps a GPU-backed texture into SkSurface. Depending on the backend gpu API, the caller may be
|
|
28
|
+
* required to ensure the texture is valid for the lifetime of returned SkSurface. The required
|
|
29
|
+
* lifetimes for the specific apis are:
|
|
30
|
+
* Metal: Skia will call retain on the underlying MTLTexture so the caller can drop it once this
|
|
31
|
+
* call returns.
|
|
32
|
+
*
|
|
33
|
+
* SkSurface is returned if all parameters are valid. BackendTexture is valid if its format agrees
|
|
34
|
+
* with colorSpace and context; for instance, if backendTexture has an sRGB configuration, then
|
|
35
|
+
* context must support sRGB, and colorSpace must be present. Further, backendTexture width and
|
|
36
|
+
* height must not exceed context capabilities, and the context must be able to support back-end
|
|
37
|
+
* textures.
|
|
38
|
+
*
|
|
39
|
+
* If SK_ENABLE_GRAPHITE is not defined, this has no effect and returns nullptr.
|
|
40
|
+
*/
|
|
41
|
+
sk_sp<SkSurface> MakeGraphiteFromBackendTexture(skgpu::graphite::Recorder*,
|
|
42
|
+
const skgpu::graphite::BackendTexture&,
|
|
43
|
+
SkColorType colorType,
|
|
44
|
+
sk_sp<SkColorSpace> colorSpace,
|
|
45
|
+
const SkSurfaceProps* props);
|
|
46
|
+
|
|
47
|
+
#endif // SkStuff_DEFINED
|