@shopify/react-native-skia 0.1.213 → 0.1.214
Sign up to get free protection for your applications and to get access to all the features.
- package/android/cpp/rnskia-android/SkiaOpenGLHelper.h +3 -2
- package/android/cpp/rnskia-android/SkiaOpenGLSurfaceFactory.cpp +9 -2
- package/cpp/api/JsiSkSurface.h +4 -1
- package/cpp/skia/include/android/GrAHardwareBufferUtils.h +99 -0
- package/cpp/skia/include/android/SkHeifDecoder.h +10 -3
- package/cpp/skia/include/codec/SkAvifDecoder.h +1 -0
- package/cpp/skia/include/codec/SkBmpDecoder.h +1 -0
- package/cpp/skia/include/codec/SkCodec.h +4 -3
- package/cpp/skia/include/codec/SkEncodedImageFormat.h +0 -3
- package/cpp/skia/include/codec/SkGifDecoder.h +1 -0
- package/cpp/skia/include/codec/SkIcoDecoder.h +1 -0
- package/cpp/skia/include/codec/SkJpegDecoder.h +1 -0
- package/cpp/skia/include/codec/SkJpegxlDecoder.h +1 -0
- package/cpp/skia/include/codec/SkPngDecoder.h +1 -0
- package/cpp/skia/include/codec/SkRawDecoder.h +1 -0
- package/cpp/skia/include/codec/SkWbmpDecoder.h +1 -0
- package/cpp/skia/include/codec/SkWebpDecoder.h +1 -0
- package/cpp/skia/include/config/SkUserConfig.h +0 -2
- package/cpp/skia/include/core/SkBitmap.h +8 -8
- package/cpp/skia/include/core/SkCanvas.h +37 -50
- package/cpp/skia/include/core/SkCapabilities.h +2 -7
- package/cpp/skia/include/core/SkColor.h +1 -1
- package/cpp/skia/include/core/SkColorFilter.h +6 -0
- package/cpp/skia/include/core/SkColorTable.h +3 -0
- package/cpp/skia/include/core/SkColorType.h +2 -0
- package/cpp/skia/include/core/SkContourMeasure.h +12 -8
- package/cpp/skia/include/core/SkDocument.h +1 -0
- package/cpp/skia/include/core/SkFont.h +11 -2
- package/cpp/skia/include/core/SkFontMgr.h +2 -3
- package/cpp/skia/include/core/SkGraphics.h +3 -13
- package/cpp/skia/include/core/SkImage.h +57 -111
- package/cpp/skia/include/core/SkImageFilter.h +6 -1
- package/cpp/skia/include/core/SkImageGenerator.h +8 -0
- package/cpp/skia/include/core/SkImageInfo.h +0 -2
- package/cpp/skia/include/core/SkM44.h +7 -3
- package/cpp/skia/include/core/SkMallocPixelRef.h +4 -1
- package/cpp/skia/include/core/SkMatrix.h +17 -17
- package/cpp/skia/include/core/SkMesh.h +71 -61
- package/cpp/skia/include/core/SkMilestone.h +1 -1
- package/cpp/skia/include/core/SkOverdrawCanvas.h +25 -0
- package/cpp/skia/include/core/SkPaint.h +1 -1
- package/cpp/skia/include/core/SkPath.h +12 -4
- package/cpp/skia/include/core/SkPathMeasure.h +3 -4
- package/cpp/skia/include/core/SkPicture.h +19 -6
- package/cpp/skia/include/core/SkPictureRecorder.h +6 -6
- package/cpp/skia/include/core/SkPixmap.h +2 -3
- package/cpp/skia/include/core/SkRRect.h +1 -1
- package/cpp/skia/include/core/SkRect.h +107 -110
- package/cpp/skia/include/core/SkRefCnt.h +1 -1
- package/cpp/skia/include/core/SkRegion.h +7 -1
- package/cpp/skia/include/core/SkSerialProcs.h +14 -0
- package/cpp/skia/include/core/SkShader.h +9 -0
- package/cpp/skia/include/core/SkStream.h +9 -9
- package/cpp/skia/include/core/SkString.h +1 -1
- package/cpp/skia/include/core/SkSurface.h +14 -25
- package/cpp/skia/include/core/SkTextBlob.h +17 -4
- package/cpp/skia/include/core/SkTiledImageUtils.h +28 -0
- package/cpp/skia/include/core/SkTypeface.h +7 -2
- package/cpp/skia/include/core/SkTypes.h +4 -12
- package/cpp/skia/include/docs/SkPDFDocument.h +17 -3
- package/cpp/skia/include/effects/SkImageFilters.h +73 -24
- package/cpp/skia/include/effects/SkRuntimeEffect.h +20 -51
- package/cpp/skia/include/gpu/GpuTypes.h +13 -0
- package/cpp/skia/include/gpu/GrBackendSurface.h +95 -262
- package/cpp/skia/include/gpu/GrContextOptions.h +7 -1
- package/cpp/skia/include/gpu/GrDirectContext.h +138 -128
- package/cpp/skia/include/gpu/GrRecordingContext.h +9 -4
- package/cpp/skia/include/gpu/GrSurfaceInfo.h +0 -24
- package/cpp/skia/include/gpu/GrTypes.h +16 -1
- package/cpp/skia/include/gpu/GrYUVABackendTextures.h +4 -4
- package/cpp/skia/include/gpu/d3d/GrD3DTypes.h +2 -2
- package/cpp/skia/include/gpu/ganesh/SkImageGanesh.h +44 -12
- package/cpp/skia/include/gpu/ganesh/SkMeshGanesh.h +57 -0
- package/cpp/skia/include/gpu/ganesh/SkSurfaceGanesh.h +2 -1
- package/cpp/skia/include/gpu/ganesh/gl/GrGLBackendSurface.h +58 -0
- package/cpp/skia/include/gpu/ganesh/gl/GrGLDirectContext.h +29 -0
- package/cpp/skia/include/gpu/ganesh/mtl/SkSurfaceMetal.h +1 -1
- package/cpp/skia/include/gpu/ganesh/vk/GrVkBackendSurface.h +67 -0
- package/cpp/skia/include/gpu/gl/GrGLInterface.h +2 -2
- package/cpp/skia/include/gpu/graphite/BackendTexture.h +14 -3
- package/cpp/skia/include/gpu/graphite/Context.h +93 -13
- package/cpp/skia/include/gpu/graphite/ContextOptions.h +19 -8
- package/cpp/skia/include/gpu/graphite/GraphiteTypes.h +23 -0
- package/cpp/skia/include/gpu/graphite/Image.h +56 -0
- package/cpp/skia/include/gpu/graphite/ImageProvider.h +5 -0
- package/cpp/skia/include/gpu/graphite/Recorder.h +26 -9
- package/cpp/skia/include/gpu/graphite/Recording.h +7 -5
- package/cpp/skia/include/gpu/graphite/TextureInfo.h +8 -0
- package/cpp/skia/include/gpu/graphite/mtl/MtlGraphiteTypes.h +2 -2
- package/cpp/skia/include/gpu/mtl/GrMtlTypes.h +2 -2
- package/cpp/skia/include/gpu/vk/GrVkTypes.h +4 -3
- package/cpp/skia/include/ports/SkCFObject.h +1 -1
- package/cpp/skia/include/private/SkGainmapInfo.h +4 -13
- package/cpp/skia/include/private/SkJpegGainmapEncoder.h +1 -24
- package/cpp/skia/include/private/SkWeakRefCnt.h +1 -1
- package/cpp/skia/include/private/base/SkAnySubclass.h +73 -0
- package/cpp/skia/include/private/base/SkAssert.h +106 -12
- package/cpp/skia/include/private/base/SkAttributes.h +0 -12
- package/cpp/skia/include/private/base/SkFeatures.h +0 -3
- package/cpp/skia/include/private/base/SkFloatingPoint.h +58 -105
- package/cpp/skia/include/private/base/SkSpan_impl.h +18 -12
- package/cpp/skia/include/private/base/SkTArray.h +22 -17
- package/cpp/skia/include/private/base/SkTDArray.h +5 -6
- package/cpp/skia/include/private/base/SkTemplates.h +50 -30
- package/cpp/skia/include/private/chromium/GrDeferredDisplayListRecorder.h +5 -2
- package/cpp/skia/include/private/chromium/GrSurfaceCharacterization.h +2 -2
- package/cpp/skia/include/private/chromium/SkChromeRemoteGlyphCache.h +13 -8
- package/cpp/skia/include/private/chromium/SkDiscardableMemory.h +1 -1
- package/cpp/skia/include/private/chromium/SkImageChromium.h +16 -3
- package/cpp/skia/include/private/chromium/Slug.h +11 -4
- package/cpp/skia/include/private/gpu/ganesh/GrD3DTypesMinimal.h +1 -1
- package/cpp/skia/include/private/gpu/ganesh/GrGLTypesPriv.h +6 -9
- package/cpp/skia/include/private/gpu/ganesh/GrTypesPriv.h +29 -13
- package/cpp/skia/include/private/gpu/ganesh/GrVkTypesPriv.h +2 -28
- package/cpp/skia/include/private/gpu/graphite/ContextOptionsPriv.h +34 -0
- package/cpp/skia/include/private/gpu/graphite/DawnTypesPriv.h +6 -0
- package/cpp/skia/include/private/gpu/graphite/MtlGraphiteTypesPriv.h +8 -0
- package/cpp/skia/include/private/gpu/graphite/VulkanGraphiteTypesPriv.h +10 -0
- package/cpp/skia/include/utils/SkBase64.h +2 -2
- package/cpp/skia/include/utils/SkNWayCanvas.h +1 -11
- package/cpp/skia/include/utils/SkNoDrawCanvas.h +0 -2
- package/cpp/skia/include/utils/SkPaintFilterCanvas.h +1 -2
- package/cpp/skia/include/utils/SkShadowUtils.h +15 -1
- package/cpp/skia/include/utils/SkTextUtils.h +1 -1
- package/cpp/skia/modules/skparagraph/include/Paragraph.h +107 -1
- package/cpp/skia/modules/skparagraph/include/ParagraphBuilder.h +3 -2
- package/cpp/skia/modules/skparagraph/include/ParagraphStyle.h +4 -0
- package/cpp/skia/modules/skparagraph/include/TypefaceFontProvider.h +5 -3
- package/cpp/skia/modules/svg/include/SkSVGAttributeParser.h +4 -0
- package/cpp/skia/src/core/SkChecksum.h +2 -1
- package/cpp/skia/src/core/SkPathPriv.h +1 -1
- package/cpp/skia/src/core/SkTHash.h +19 -9
- package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.mm +3 -1
- package/ios/RNSkia-iOS/SkiaMetalSurfaceFactory.mm +1 -1
- package/lib/commonjs/dom/nodes/datatypes/Rect.js +5 -1
- package/lib/commonjs/dom/nodes/datatypes/Rect.js.map +1 -1
- package/lib/commonjs/external/reanimated/index.d.ts +1 -0
- package/lib/commonjs/external/reanimated/index.js +13 -0
- package/lib/commonjs/external/reanimated/index.js.map +1 -1
- package/lib/commonjs/external/reanimated/moduleWrapper.js +3 -8
- package/lib/commonjs/external/reanimated/moduleWrapper.js.map +1 -1
- package/lib/commonjs/external/reanimated/renderHelpers.js +46 -1
- package/lib/commonjs/external/reanimated/renderHelpers.js.map +1 -1
- package/lib/commonjs/external/reanimated/useDerivedValueOnJS.d.ts +2 -0
- package/lib/commonjs/external/reanimated/useDerivedValueOnJS.js +26 -0
- package/lib/commonjs/external/reanimated/useDerivedValueOnJS.js.map +1 -0
- package/lib/commonjs/external/reanimated/useSharedValueEffect.js +2 -5
- package/lib/commonjs/external/reanimated/useSharedValueEffect.js.map +1 -1
- package/lib/commonjs/skia/types/MaskFilter.js +4 -0
- package/lib/commonjs/skia/types/MaskFilter.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPicture.js +2 -1
- package/lib/commonjs/skia/web/JsiSkPicture.js.map +1 -1
- package/lib/commonjs/views/SkiaBaseWebView.js +1 -1
- package/lib/commonjs/views/SkiaBaseWebView.js.map +1 -1
- package/lib/commonjs/views/types.js +3 -0
- package/lib/commonjs/views/types.js.map +1 -1
- package/lib/module/dom/nodes/datatypes/Rect.js +5 -1
- package/lib/module/dom/nodes/datatypes/Rect.js.map +1 -1
- package/lib/module/external/reanimated/index.d.ts +1 -0
- package/lib/module/external/reanimated/index.js +1 -0
- package/lib/module/external/reanimated/index.js.map +1 -1
- package/lib/module/external/reanimated/moduleWrapper.js +1 -9
- package/lib/module/external/reanimated/moduleWrapper.js.map +1 -1
- package/lib/module/external/reanimated/renderHelpers.js +48 -2
- package/lib/module/external/reanimated/renderHelpers.js.map +1 -1
- package/lib/module/external/reanimated/useDerivedValueOnJS.d.ts +2 -0
- package/lib/module/external/reanimated/useDerivedValueOnJS.js +15 -0
- package/lib/module/external/reanimated/useDerivedValueOnJS.js.map +1 -0
- package/lib/module/external/reanimated/useSharedValueEffect.js +3 -6
- package/lib/module/external/reanimated/useSharedValueEffect.js.map +1 -1
- package/lib/module/skia/types/MaskFilter.js +3 -0
- package/lib/module/skia/types/MaskFilter.js.map +1 -1
- package/lib/module/views/types.js +3 -0
- package/lib/module/views/types.js.map +1 -1
- package/lib/typescript/src/external/reanimated/index.d.ts +1 -0
- package/lib/typescript/src/external/reanimated/useDerivedValueOnJS.d.ts +2 -0
- package/libs/android/arm64-v8a/libskia.a +0 -0
- package/libs/android/arm64-v8a/libskottie.a +0 -0
- package/libs/android/arm64-v8a/libskparagraph.a +0 -0
- package/libs/android/arm64-v8a/libsksg.a +0 -0
- package/libs/android/arm64-v8a/libskshaper.a +0 -0
- package/libs/android/arm64-v8a/libskunicode.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/libskottie.a +0 -0
- package/libs/android/armeabi-v7a/libskparagraph.a +0 -0
- package/libs/android/armeabi-v7a/libsksg.a +0 -0
- package/libs/android/armeabi-v7a/libskshaper.a +0 -0
- package/libs/android/armeabi-v7a/libskunicode.a +0 -0
- package/libs/android/armeabi-v7a/libsvg.a +0 -0
- package/libs/android/x86/libskia.a +0 -0
- package/libs/android/x86/libskottie.a +0 -0
- package/libs/android/x86/libskparagraph.a +0 -0
- package/libs/android/x86/libsksg.a +0 -0
- package/libs/android/x86/libskshaper.a +0 -0
- package/libs/android/x86/libskunicode.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/libskottie.a +0 -0
- package/libs/android/x86_64/libskparagraph.a +0 -0
- package/libs/android/x86_64/libsksg.a +0 -0
- package/libs/android/x86_64/libskshaper.a +0 -0
- package/libs/android/x86_64/libskunicode.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/libskottie.xcframework/ios-arm64_arm64e/libskottie.a +0 -0
- package/libs/ios/libskottie.xcframework/ios-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
- package/libs/ios/libskparagraph.xcframework/Info.plist +5 -5
- package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e/libskparagraph.a +0 -0
- package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e_x86_64-simulator/libskparagraph.a +0 -0
- package/libs/ios/libsksg.xcframework/Info.plist +5 -5
- package/libs/ios/libsksg.xcframework/ios-arm64_arm64e/libsksg.a +0 -0
- package/libs/ios/libsksg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
- 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/libskunicode.xcframework/Info.plist +5 -5
- package/libs/ios/libskunicode.xcframework/ios-arm64_arm64e/libskunicode.a +0 -0
- package/libs/ios/libskunicode.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode.a +0 -0
- package/libs/ios/libsvg.xcframework/Info.plist +5 -5
- 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 +1 -1
- package/react-native-skia.podspec +1 -1
- package/src/dom/nodes/datatypes/Rect.ts +6 -2
- package/src/external/reanimated/index.ts +1 -0
- package/src/external/reanimated/moduleWrapper.ts +6 -10
- package/src/external/reanimated/renderHelpers.ts +41 -1
- package/src/external/reanimated/useDerivedValueOnJS.ts +24 -0
- package/src/external/reanimated/useSharedValueEffect.ts +4 -7
- package/cpp/skia/include/core/SkDeferredDisplayList.h +0 -15
- package/cpp/skia/include/core/SkDeferredDisplayListRecorder.h +0 -15
- package/cpp/skia/include/core/SkPromiseImageTexture.h +0 -20
- package/cpp/skia/include/core/SkSurfaceCharacterization.h +0 -15
- package/cpp/skia/include/core/SkTime.h +0 -63
- package/cpp/skia/include/effects/SkOpPathEffect.h +0 -43
- package/cpp/skia/include/effects/SkStrokeAndFillPathEffect.h +0 -28
- package/cpp/skia/include/gpu/GrBackendSurfaceMutableState.h +0 -32
- package/cpp/skia/include/gpu/dawn/GrDawnTypes.h +0 -95
- package/cpp/skia/include/private/SkBitmaskEnum.h +0 -59
- package/cpp/skia/include/private/SkSLDefines.h +0 -64
- package/cpp/skia/include/private/SkShadowFlags.h +0 -27
- package/cpp/skia/include/private/gpu/ganesh/GrDawnTypesPriv.h +0 -26
- /package/cpp/skia/{include/private/base → src/core}/SkPathEnums.h +0 -0
@@ -14,9 +14,6 @@
|
|
14
14
|
#include "include/gpu/GrTypes.h"
|
15
15
|
#include "include/private/base/SkAPI.h"
|
16
16
|
|
17
|
-
// TODO(kjlubick) remove after chromium is migrated to include this directly
|
18
|
-
#include "include/private/chromium/SkImageChromium.h" // IWYU pragma: keep
|
19
|
-
|
20
17
|
#include <functional>
|
21
18
|
#include <utility>
|
22
19
|
|
@@ -26,6 +23,8 @@ class GrRecordingContext;
|
|
26
23
|
class GrYUVABackendTextures;
|
27
24
|
class SkColorSpace;
|
28
25
|
class SkData;
|
26
|
+
class SkImageFilter;
|
27
|
+
struct SkIPoint;
|
29
28
|
class SkPixmap;
|
30
29
|
class SkYUVAPixmaps;
|
31
30
|
enum SkAlphaType : int;
|
@@ -174,13 +173,14 @@ SK_API sk_sp<SkImage> TextureFromCompressedTexture(GrRecordingContext* context,
|
|
174
173
|
@param isProtected do the contents of 'data' require DRM protection (on Vulkan)?
|
175
174
|
@return created SkImage, or nullptr
|
176
175
|
*/
|
177
|
-
SK_API sk_sp<SkImage> TextureFromCompressedTextureData(
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
176
|
+
SK_API sk_sp<SkImage> TextureFromCompressedTextureData(
|
177
|
+
GrDirectContext* direct,
|
178
|
+
sk_sp<SkData> data,
|
179
|
+
int width,
|
180
|
+
int height,
|
181
|
+
SkTextureCompressionType type,
|
182
|
+
skgpu::Mipmapped mipmapped = skgpu::Mipmapped::kNo,
|
183
|
+
GrProtected isProtected = GrProtected::kNo);
|
184
184
|
|
185
185
|
/** Returns SkImage backed by GPU texture associated with context. Returned SkImage is
|
186
186
|
compatible with SkSurface created with dstColorSpace. The returned SkImage respects
|
@@ -232,12 +232,12 @@ inline sk_sp<SkImage> TextureFromImage(GrDirectContext* ctx,
|
|
232
232
|
*/
|
233
233
|
SK_API sk_sp<SkImage> TextureFromYUVAPixmaps(GrRecordingContext* context,
|
234
234
|
const SkYUVAPixmaps& pixmaps,
|
235
|
-
|
235
|
+
skgpu::Mipmapped buildMips,
|
236
236
|
bool limitToMaxTextureSize,
|
237
237
|
sk_sp<SkColorSpace> imageColorSpace);
|
238
238
|
SK_API sk_sp<SkImage> TextureFromYUVAPixmaps(GrRecordingContext* context,
|
239
239
|
const SkYUVAPixmaps& pixmaps,
|
240
|
-
|
240
|
+
skgpu::Mipmapped buildMips = skgpu::Mipmapped::kNo,
|
241
241
|
bool limitToMaxTextureSize = false);
|
242
242
|
|
243
243
|
/** Creates a GPU-backed SkImage from YUV[A] planar textures. This requires that the textures
|
@@ -324,6 +324,38 @@ SK_API sk_sp<SkImage> SubsetTextureFrom(GrDirectContext* context,
|
|
324
324
|
const SkImage* img,
|
325
325
|
const SkIRect& subset);
|
326
326
|
|
327
|
+
/** Creates a filtered SkImage on the GPU. filter processes the src image, potentially changing
|
328
|
+
color, position, and size. subset is the bounds of src that are processed
|
329
|
+
by filter. clipBounds is the expected bounds of the filtered SkImage. outSubset
|
330
|
+
is required storage for the actual bounds of the filtered SkImage. offset is
|
331
|
+
required storage for translation of returned SkImage.
|
332
|
+
|
333
|
+
Returns nullptr if SkImage could not be created or if the recording context provided doesn't
|
334
|
+
match the GPU context in which the image was created. If nullptr is returned, outSubset
|
335
|
+
and offset are undefined.
|
336
|
+
|
337
|
+
Useful for animation of SkImageFilter that varies size from frame to frame.
|
338
|
+
Returned SkImage is created larger than required by filter so that GPU texture
|
339
|
+
can be reused with different sized effects. outSubset describes the valid bounds
|
340
|
+
of GPU texture returned. offset translates the returned SkImage to keep subsequent
|
341
|
+
animation frames aligned with respect to each other.
|
342
|
+
|
343
|
+
@param context the GrRecordingContext in play - if it exists
|
344
|
+
@param filter how SkImage is sampled when transformed
|
345
|
+
@param subset bounds of SkImage processed by filter
|
346
|
+
@param clipBounds expected bounds of filtered SkImage
|
347
|
+
@param outSubset storage for returned SkImage bounds
|
348
|
+
@param offset storage for returned SkImage translation
|
349
|
+
@return filtered SkImage, or nullptr
|
350
|
+
*/
|
351
|
+
SK_API sk_sp<SkImage> MakeWithFilter(GrRecordingContext* context,
|
352
|
+
sk_sp<SkImage> src,
|
353
|
+
const SkImageFilter* filter,
|
354
|
+
const SkIRect& subset,
|
355
|
+
const SkIRect& clipBounds,
|
356
|
+
SkIRect* outSubset,
|
357
|
+
SkIPoint* offset);
|
358
|
+
|
327
359
|
} // namespace SkImages
|
328
360
|
|
329
361
|
#endif
|
@@ -0,0 +1,57 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright 2023 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 SkMeshGanesh_DEFINED
|
9
|
+
#define SkMeshGanesh_DEFINED
|
10
|
+
|
11
|
+
#include "include/core/SkMesh.h"
|
12
|
+
#include "include/core/SkRefCnt.h"
|
13
|
+
#include "include/private/base/SkAPI.h"
|
14
|
+
|
15
|
+
#include <cstddef>
|
16
|
+
|
17
|
+
class GrDirectContext;
|
18
|
+
|
19
|
+
namespace SkMeshes {
|
20
|
+
/**
|
21
|
+
* Makes a GPU-backed index buffer to be used with SkMeshes.
|
22
|
+
*
|
23
|
+
* @param GrDirectContext* If non-null, the data will be uploaded to the corresponding GPU and the
|
24
|
+
* returned buffer will only be compatible with surfaces using the same
|
25
|
+
* context. If null, the data will be uploaded to a CPU buffer.
|
26
|
+
* @param data The data used to populate the buffer, or nullptr to create a zero-
|
27
|
+
* initialized buffer.
|
28
|
+
* @param size Both the size of the data in 'data' and the size of the resulting
|
29
|
+
* buffer.
|
30
|
+
*/
|
31
|
+
SK_API sk_sp<SkMesh::IndexBuffer> MakeIndexBuffer(GrDirectContext*, const void* data, size_t size);
|
32
|
+
|
33
|
+
/**
|
34
|
+
* Makes a copy of an index buffer. The copy will be GPU backed if the context is non-null.
|
35
|
+
*/
|
36
|
+
SK_API sk_sp<SkMesh::IndexBuffer> CopyIndexBuffer(GrDirectContext*, sk_sp<SkMesh::IndexBuffer>);
|
37
|
+
|
38
|
+
/**
|
39
|
+
* Makes a GPU-backed vertex buffer to be used with SkMeshes.
|
40
|
+
*
|
41
|
+
* @param GrDirectContext* If non-null, the data will be uploaded to the corresponding GPU and the
|
42
|
+
* returned buffer will only be compatible with surfaces using the same
|
43
|
+
* context. If null, the data will be uploaded to a CPU buffer.
|
44
|
+
* @param data The data used to populate the buffer, or nullptr to create a zero-
|
45
|
+
* initialized buffer.
|
46
|
+
* @param size Both the size of the data in 'data' and the size of the resulting
|
47
|
+
* buffer.
|
48
|
+
*/
|
49
|
+
SK_API sk_sp<SkMesh::VertexBuffer> MakeVertexBuffer(GrDirectContext*, const void*, size_t size);
|
50
|
+
|
51
|
+
/**
|
52
|
+
* Makes a copy of a vertex buffer. The copy will be GPU backed if the context is non-null.
|
53
|
+
*/
|
54
|
+
SK_API sk_sp<SkMesh::VertexBuffer> CopyVertexBuffer(GrDirectContext*, sk_sp<SkMesh::VertexBuffer>);
|
55
|
+
} // namespace SkMeshes
|
56
|
+
|
57
|
+
#endif
|
@@ -67,7 +67,8 @@ SK_API sk_sp<SkSurface> RenderTarget(GrRecordingContext* context,
|
|
67
67
|
int sampleCount,
|
68
68
|
GrSurfaceOrigin surfaceOrigin,
|
69
69
|
const SkSurfaceProps* surfaceProps,
|
70
|
-
bool shouldCreateWithMips = false
|
70
|
+
bool shouldCreateWithMips = false,
|
71
|
+
bool isProtected = false);
|
71
72
|
inline sk_sp<SkSurface> RenderTarget(GrRecordingContext* context,
|
72
73
|
skgpu::Budgeted budgeted,
|
73
74
|
const SkImageInfo& imageInfo,
|
@@ -0,0 +1,58 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright 2023 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 GrGLBackendSurface_DEFINED
|
9
|
+
#define GrGLBackendSurface_DEFINED
|
10
|
+
|
11
|
+
#include "include/gpu/gl/GrGLTypes.h"
|
12
|
+
#include "include/private/base/SkAPI.h"
|
13
|
+
|
14
|
+
#include <string_view>
|
15
|
+
|
16
|
+
class GrBackendFormat;
|
17
|
+
class GrBackendTexture;
|
18
|
+
class GrBackendRenderTarget;
|
19
|
+
|
20
|
+
namespace skgpu { enum class Mipmapped : bool; }
|
21
|
+
|
22
|
+
namespace GrBackendFormats {
|
23
|
+
SK_API GrBackendFormat MakeGL(GrGLenum format, GrGLenum target);
|
24
|
+
|
25
|
+
SK_API GrGLFormat AsGLFormat(const GrBackendFormat&);
|
26
|
+
SK_API GrGLenum AsGLFormatEnum(const GrBackendFormat&);
|
27
|
+
} // namespace GrBackendFormats
|
28
|
+
|
29
|
+
namespace GrBackendTextures {
|
30
|
+
// The GrGLTextureInfo must have a valid fFormat.
|
31
|
+
SK_API GrBackendTexture MakeGL(int width,
|
32
|
+
int height,
|
33
|
+
skgpu::Mipmapped,
|
34
|
+
const GrGLTextureInfo& glInfo,
|
35
|
+
std::string_view label = {});
|
36
|
+
|
37
|
+
// If the backend API is GL, copies a snapshot of the GrGLTextureInfo struct into the passed in
|
38
|
+
// pointer and returns true. Otherwise returns false if the backend API is not GL.
|
39
|
+
SK_API bool GetGLTextureInfo(const GrBackendTexture&, GrGLTextureInfo*);
|
40
|
+
|
41
|
+
// Call this to indicate that the texture parameters have been modified in the GL context
|
42
|
+
// externally to GrContext.
|
43
|
+
SK_API void GLTextureParametersModified(GrBackendTexture*);
|
44
|
+
} // namespace GrBackendTextures
|
45
|
+
|
46
|
+
namespace GrBackendRenderTargets {
|
47
|
+
// The GrGLTextureInfo must have a valid fFormat. If wrapping in an SkSurface we require the
|
48
|
+
// stencil bits to be either 0, 8 or 16.
|
49
|
+
SK_API GrBackendRenderTarget MakeGL(int width,
|
50
|
+
int height,
|
51
|
+
int sampleCnt,
|
52
|
+
int stencilBits,
|
53
|
+
const GrGLFramebufferInfo& glInfo);
|
54
|
+
|
55
|
+
SK_API bool GetGLFramebufferInfo(const GrBackendRenderTarget&, GrGLFramebufferInfo*);
|
56
|
+
} // namespace GrBackendRenderTargets
|
57
|
+
|
58
|
+
#endif
|
@@ -0,0 +1,29 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright 2023 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 GrGLDirectContext_DEFINED
|
9
|
+
#define GrGLDirectContext_DEFINED
|
10
|
+
|
11
|
+
#include "include/core/SkRefCnt.h"
|
12
|
+
#include "include/private/base/SkAPI.h"
|
13
|
+
|
14
|
+
class GrDirectContext;
|
15
|
+
struct GrContextOptions;
|
16
|
+
struct GrGLInterface;
|
17
|
+
|
18
|
+
namespace GrDirectContexts {
|
19
|
+
/**
|
20
|
+
* Creates a GrDirectContext for a backend context. If no GrGLInterface is provided then the
|
21
|
+
* result of GrGLMakeNativeInterface() is used if it succeeds.
|
22
|
+
*/
|
23
|
+
SK_API sk_sp<GrDirectContext> MakeGL(sk_sp<const GrGLInterface>, const GrContextOptions&);
|
24
|
+
SK_API sk_sp<GrDirectContext> MakeGL(sk_sp<const GrGLInterface>);
|
25
|
+
SK_API sk_sp<GrDirectContext> MakeGL(const GrContextOptions&);
|
26
|
+
SK_API sk_sp<GrDirectContext> MakeGL();
|
27
|
+
}
|
28
|
+
|
29
|
+
#endif
|
@@ -67,7 +67,7 @@ SK_API sk_sp<SkSurface> WrapMTKView(GrRecordingContext* context,
|
|
67
67
|
SkColorType colorType,
|
68
68
|
sk_sp<SkColorSpace> colorSpace,
|
69
69
|
const SkSurfaceProps* surfaceProps)
|
70
|
-
SK_API_AVAILABLE(macos(10.11), ios(9.0));
|
70
|
+
SK_API_AVAILABLE(macos(10.11), ios(9.0), tvos(9.0));
|
71
71
|
} // namespace SkSurfaces
|
72
72
|
|
73
73
|
#endif
|
@@ -0,0 +1,67 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright 2023 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 GrVkBackendSurface_DEFINED
|
9
|
+
#define GrVkBackendSurface_DEFINED
|
10
|
+
|
11
|
+
#include "include/gpu/vk/GrVkTypes.h"
|
12
|
+
#include "include/private/base/SkAPI.h"
|
13
|
+
|
14
|
+
#include <string_view>
|
15
|
+
|
16
|
+
class GrBackendFormat;
|
17
|
+
class GrBackendTexture;
|
18
|
+
class GrBackendRenderTarget;
|
19
|
+
|
20
|
+
|
21
|
+
namespace GrBackendFormats {
|
22
|
+
|
23
|
+
SK_API GrBackendFormat MakeVk(VkFormat format, bool willUseDRMFormatModifiers = false);
|
24
|
+
SK_API GrBackendFormat MakeVk(const GrVkYcbcrConversionInfo& ycbcrInfo,
|
25
|
+
bool willUseDRMFormatModifiers = false);
|
26
|
+
|
27
|
+
SK_API bool AsVkFormat(const GrBackendFormat&, VkFormat*);
|
28
|
+
SK_API const GrVkYcbcrConversionInfo* GetVkYcbcrConversionInfo(const GrBackendFormat&);
|
29
|
+
|
30
|
+
} // namespace GrBackendFormats
|
31
|
+
|
32
|
+
|
33
|
+
namespace GrBackendTextures {
|
34
|
+
|
35
|
+
SK_API GrBackendTexture MakeVk(int width,
|
36
|
+
int height,
|
37
|
+
const GrVkImageInfo&,
|
38
|
+
std::string_view label = {});
|
39
|
+
|
40
|
+
// If the backend API is Vulkan, copies a snapshot of the GrVkImageInfo struct into the passed
|
41
|
+
// in pointer and returns true. This snapshot will set the fImageLayout to the current layout
|
42
|
+
// state. Otherwise returns false if the backend API is not Vulkan.
|
43
|
+
SK_API bool GetVkImageInfo(const GrBackendTexture&, GrVkImageInfo*);
|
44
|
+
|
45
|
+
// Anytime the client changes the VkImageLayout of the VkImage captured by this
|
46
|
+
// GrBackendTexture, they must call this function to notify Skia of the changed layout.
|
47
|
+
SK_API void SetVkImageLayout(GrBackendTexture*, VkImageLayout);
|
48
|
+
|
49
|
+
} // namespace GrBackendTextures
|
50
|
+
|
51
|
+
|
52
|
+
namespace GrBackendRenderTargets {
|
53
|
+
|
54
|
+
SK_API GrBackendRenderTarget MakeVk(int width, int height, const GrVkImageInfo&);
|
55
|
+
|
56
|
+
// If the backend API is Vulkan, copies a snapshot of the GrVkImageInfo struct into the passed
|
57
|
+
// in pointer and returns true. This snapshot will set the fImageLayout to the current layout
|
58
|
+
// state. Otherwise returns false if the backend API is not Vulkan.
|
59
|
+
SK_API bool GetVkImageInfo(const GrBackendRenderTarget&, GrVkImageInfo*);
|
60
|
+
|
61
|
+
// Anytime the client changes the VkImageLayout of the VkImage captured by this
|
62
|
+
// GrBackendRenderTarget, they must call this function to notify Skia of the changed layout.
|
63
|
+
SK_API void SetVkImageLayout(GrBackendRenderTarget*, VkImageLayout);
|
64
|
+
|
65
|
+
} // namespace GrBackendRenderTargets
|
66
|
+
|
67
|
+
#endif
|
@@ -68,7 +68,7 @@ public:
|
|
68
68
|
void suppressErrorLogging();
|
69
69
|
#endif
|
70
70
|
|
71
|
-
#if GR_TEST_UTILS
|
71
|
+
#if defined(GR_TEST_UTILS)
|
72
72
|
GrGLInterface(const GrGLInterface& that)
|
73
73
|
: fStandard(that.fStandard)
|
74
74
|
, fExtensions(that.fExtensions)
|
@@ -331,7 +331,7 @@ public:
|
|
331
331
|
GrGLFunction<GrGLEndTilingFn> fEndTiling;
|
332
332
|
} fFunctions;
|
333
333
|
|
334
|
-
#if GR_TEST_UTILS
|
334
|
+
#if defined(GR_TEST_UTILS)
|
335
335
|
// This exists for internal testing.
|
336
336
|
virtual void abandon() const;
|
337
337
|
#endif
|
@@ -22,6 +22,7 @@
|
|
22
22
|
#endif
|
23
23
|
|
24
24
|
#ifdef SK_VULKAN
|
25
|
+
#include "include/gpu/vk/VulkanTypes.h"
|
25
26
|
#include "include/private/gpu/vk/SkiaVulkan.h"
|
26
27
|
#endif
|
27
28
|
|
@@ -70,7 +71,8 @@ public:
|
|
70
71
|
const VulkanTextureInfo&,
|
71
72
|
VkImageLayout,
|
72
73
|
uint32_t queueFamilyIndex,
|
73
|
-
VkImage
|
74
|
+
VkImage,
|
75
|
+
VulkanAlloc);
|
74
76
|
#endif
|
75
77
|
|
76
78
|
BackendTexture(const BackendTexture&);
|
@@ -108,16 +110,25 @@ public:
|
|
108
110
|
VkImage getVkImage() const;
|
109
111
|
VkImageLayout getVkImageLayout() const;
|
110
112
|
uint32_t getVkQueueFamilyIndex() const;
|
113
|
+
const VulkanAlloc* getMemoryAlloc() const;
|
111
114
|
#endif
|
112
115
|
|
113
116
|
private:
|
114
|
-
|
117
|
+
friend class VulkanResourceProvider; // for getMutableState
|
118
|
+
sk_sp<MutableTextureStateRef> getMutableState() const;
|
115
119
|
|
116
120
|
SkISize fDimensions;
|
117
121
|
TextureInfo fInfo;
|
118
122
|
|
119
123
|
sk_sp<MutableTextureStateRef> fMutableState;
|
120
124
|
|
125
|
+
#ifdef SK_VULKAN
|
126
|
+
// fMemoryAlloc == VulkanAlloc() if the client has already created their own VkImage and
|
127
|
+
// will destroy it themselves as opposed to having Skia create/destroy it via
|
128
|
+
// Recorder::createBackendTexture and Context::deleteBackendTexture.
|
129
|
+
VulkanAlloc fMemoryAlloc = VulkanAlloc();
|
130
|
+
#endif
|
131
|
+
|
121
132
|
union {
|
122
133
|
#ifdef SK_DAWN
|
123
134
|
struct {
|
@@ -129,7 +140,7 @@ private:
|
|
129
140
|
MtlHandle fMtlTexture;
|
130
141
|
#endif
|
131
142
|
#ifdef SK_VULKAN
|
132
|
-
VkImage fVkImage;
|
143
|
+
VkImage fVkImage = VK_NULL_HANDLE;
|
133
144
|
#endif
|
134
145
|
void* fEnsureUnionNonEmpty;
|
135
146
|
};
|
@@ -16,9 +16,11 @@
|
|
16
16
|
#include "include/gpu/graphite/Recorder.h"
|
17
17
|
#include "include/private/base/SingleOwner.h"
|
18
18
|
|
19
|
+
#include <chrono>
|
19
20
|
#include <functional>
|
20
21
|
#include <memory>
|
21
22
|
|
23
|
+
class SkColorSpace;
|
22
24
|
class SkRuntimeEffect;
|
23
25
|
|
24
26
|
namespace skgpu::graphite {
|
@@ -53,17 +55,61 @@ public:
|
|
53
55
|
bool insertRecording(const InsertRecordingInfo&);
|
54
56
|
bool submit(SyncToCpu = SyncToCpu::kNo);
|
55
57
|
|
56
|
-
void
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
58
|
+
void asyncRescaleAndReadPixels(const SkImage* image,
|
59
|
+
const SkImageInfo& dstImageInfo,
|
60
|
+
const SkIRect& srcRect,
|
61
|
+
SkImage::RescaleGamma rescaleGamma,
|
62
|
+
SkImage::RescaleMode rescaleMode,
|
63
|
+
SkImage::ReadPixelsCallback callback,
|
64
|
+
SkImage::ReadPixelsContext context);
|
65
|
+
|
66
|
+
void asyncRescaleAndReadPixels(const SkSurface* surface,
|
67
|
+
const SkImageInfo& dstImageInfo,
|
68
|
+
const SkIRect& srcRect,
|
69
|
+
SkImage::RescaleGamma rescaleGamma,
|
70
|
+
SkImage::RescaleMode rescaleMode,
|
71
|
+
SkImage::ReadPixelsCallback callback,
|
72
|
+
SkImage::ReadPixelsContext context);
|
73
|
+
|
74
|
+
void asyncRescaleAndReadPixelsYUV420(const SkImage*,
|
75
|
+
SkYUVColorSpace yuvColorSpace,
|
76
|
+
sk_sp<SkColorSpace> dstColorSpace,
|
77
|
+
const SkIRect& srcRect,
|
78
|
+
const SkISize& dstSize,
|
79
|
+
SkImage::RescaleGamma rescaleGamma,
|
80
|
+
SkImage::RescaleMode rescaleMode,
|
81
|
+
SkImage::ReadPixelsCallback callback,
|
82
|
+
SkImage::ReadPixelsContext context);
|
83
|
+
|
84
|
+
void asyncRescaleAndReadPixelsYUV420(const SkSurface*,
|
85
|
+
SkYUVColorSpace yuvColorSpace,
|
86
|
+
sk_sp<SkColorSpace> dstColorSpace,
|
87
|
+
const SkIRect& srcRect,
|
88
|
+
const SkISize& dstSize,
|
89
|
+
SkImage::RescaleGamma rescaleGamma,
|
90
|
+
SkImage::RescaleMode rescaleMode,
|
91
|
+
SkImage::ReadPixelsCallback callback,
|
92
|
+
SkImage::ReadPixelsContext context);
|
93
|
+
|
94
|
+
void asyncRescaleAndReadPixelsYUVA420(const SkImage*,
|
95
|
+
SkYUVColorSpace yuvColorSpace,
|
96
|
+
sk_sp<SkColorSpace> dstColorSpace,
|
97
|
+
const SkIRect& srcRect,
|
98
|
+
const SkISize& dstSize,
|
99
|
+
SkImage::RescaleGamma rescaleGamma,
|
100
|
+
SkImage::RescaleMode rescaleMode,
|
101
|
+
SkImage::ReadPixelsCallback callback,
|
102
|
+
SkImage::ReadPixelsContext context);
|
103
|
+
|
104
|
+
void asyncRescaleAndReadPixelsYUVA420(const SkSurface*,
|
105
|
+
SkYUVColorSpace yuvColorSpace,
|
106
|
+
sk_sp<SkColorSpace> dstColorSpace,
|
107
|
+
const SkIRect& srcRect,
|
108
|
+
const SkISize& dstSize,
|
109
|
+
SkImage::RescaleGamma rescaleGamma,
|
110
|
+
SkImage::RescaleMode rescaleMode,
|
111
|
+
SkImage::ReadPixelsCallback callback,
|
112
|
+
SkImage::ReadPixelsContext context);
|
67
113
|
|
68
114
|
/**
|
69
115
|
* Checks whether any asynchronous work is complete and if so calls related callbacks.
|
@@ -79,7 +125,22 @@ public:
|
|
79
125
|
* Otherwise this will delete/release the backend object that is wrapped in the BackendTexture.
|
80
126
|
* The BackendTexture will be reset to an invalid state and should not be used again.
|
81
127
|
*/
|
82
|
-
void deleteBackendTexture(BackendTexture&);
|
128
|
+
void deleteBackendTexture(const BackendTexture&);
|
129
|
+
|
130
|
+
/**
|
131
|
+
* Frees GPU resources created and held by the Context. Can be called to reduce GPU memory
|
132
|
+
* pressure. Any resources that are still in use (e.g. being used by work submitted to the GPU)
|
133
|
+
* will not be deleted by this call. If the caller wants to make sure all resources are freed,
|
134
|
+
* then they should first make sure to submit and wait on any outstanding work.
|
135
|
+
*/
|
136
|
+
void freeGpuResources();
|
137
|
+
|
138
|
+
/**
|
139
|
+
* Purge GPU resources on the Context that haven't been used in the past 'msNotUsed'
|
140
|
+
* milliseconds or are otherwise marked for deletion, regardless of whether the context is under
|
141
|
+
* budget.
|
142
|
+
*/
|
143
|
+
void performDeferredCleanup(std::chrono::milliseconds msNotUsed);
|
83
144
|
|
84
145
|
// Provides access to functions that aren't part of the public API.
|
85
146
|
ContextPriv priv();
|
@@ -117,6 +178,17 @@ private:
|
|
117
178
|
// require Context::Make() to return a nullptr.
|
118
179
|
bool finishInitialization();
|
119
180
|
|
181
|
+
void asyncRescaleAndReadPixelsYUV420Impl(const SkImage*,
|
182
|
+
SkYUVColorSpace yuvColorSpace,
|
183
|
+
bool readAlpha,
|
184
|
+
sk_sp<SkColorSpace> dstColorSpace,
|
185
|
+
const SkIRect& srcRect,
|
186
|
+
const SkISize& dstSize,
|
187
|
+
SkImage::RescaleGamma rescaleGamma,
|
188
|
+
SkImage::RescaleMode rescaleMode,
|
189
|
+
SkImage::ReadPixelsCallback callback,
|
190
|
+
SkImage::ReadPixelsContext context);
|
191
|
+
|
120
192
|
void asyncReadPixels(const TextureProxy* textureProxy,
|
121
193
|
const SkImageInfo& srcImageInfo,
|
122
194
|
const SkColorInfo& dstColorInfo,
|
@@ -124,6 +196,14 @@ private:
|
|
124
196
|
SkImage::ReadPixelsCallback callback,
|
125
197
|
SkImage::ReadPixelsContext context);
|
126
198
|
|
199
|
+
void asyncReadPixelsYUV420(Recorder*,
|
200
|
+
const SkImage*,
|
201
|
+
SkYUVColorSpace yuvColorSpace,
|
202
|
+
bool readAlpha,
|
203
|
+
const SkIRect& srcRect,
|
204
|
+
SkImage::ReadPixelsCallback callback,
|
205
|
+
SkImage::ReadPixelsContext context);
|
206
|
+
|
127
207
|
// Inserts a texture to buffer transfer task, used by asyncReadPixels methods
|
128
208
|
struct PixelTransferResult {
|
129
209
|
using ConversionFn = void(void* dst, const void* mappedBuffer);
|
@@ -152,7 +232,7 @@ private:
|
|
152
232
|
// ResourceCache for the Context.
|
153
233
|
mutable SingleOwner fSingleOwner;
|
154
234
|
|
155
|
-
#if GRAPHITE_TEST_UTILS
|
235
|
+
#if defined(GRAPHITE_TEST_UTILS)
|
156
236
|
// In test builds a Recorder may track the Context that was used to create it.
|
157
237
|
bool fStoreContextRefInRecorder = false;
|
158
238
|
// If this tracking is on, to allow the client to safely delete this Context or its Recorders
|
@@ -9,11 +9,14 @@
|
|
9
9
|
#define skgpu_graphite_ContextOptions_DEFINED
|
10
10
|
|
11
11
|
#include "include/private/base/SkAPI.h"
|
12
|
+
#include "include/private/base/SkMath.h"
|
12
13
|
|
13
14
|
namespace skgpu { class ShaderErrorHandler; }
|
14
15
|
|
15
16
|
namespace skgpu::graphite {
|
16
17
|
|
18
|
+
struct ContextOptionsPriv;
|
19
|
+
|
17
20
|
struct SK_API ContextOptions {
|
18
21
|
ContextOptions() {}
|
19
22
|
|
@@ -30,6 +33,14 @@ struct SK_API ContextOptions {
|
|
30
33
|
*/
|
31
34
|
skgpu::ShaderErrorHandler* fShaderErrorHandler = nullptr;
|
32
35
|
|
36
|
+
/**
|
37
|
+
* Specifies the number of samples Graphite should use when performing internal draws with MSAA
|
38
|
+
* (hardware capabilities permitting).
|
39
|
+
*
|
40
|
+
* If <= 1, Graphite will disable internal code paths that use multisampling.
|
41
|
+
*/
|
42
|
+
int fInternalMultisampleCount = 4;
|
43
|
+
|
33
44
|
/**
|
34
45
|
* Will the client make sure to only ever be executing one thread that uses the Context and all
|
35
46
|
* derived classes (e.g. Recorders, Recordings, etc.) at a time. If so we can possibly make some
|
@@ -66,22 +77,22 @@ struct SK_API ContextOptions {
|
|
66
77
|
bool fAllowMultipleGlyphCacheTextures = true;
|
67
78
|
bool fSupportBilerpFromGlyphAtlas = false;
|
68
79
|
|
69
|
-
#if GRAPHITE_TEST_UTILS
|
70
80
|
/**
|
71
|
-
*
|
81
|
+
* Disable caching of glyph uploads at the start of each Recording. These can add additional
|
82
|
+
* overhead and are only necessary if Recordings are replayed or played out of order.
|
72
83
|
*/
|
84
|
+
bool fDisableCachedGlyphUploads = false;
|
73
85
|
|
86
|
+
static constexpr size_t kDefaultContextBudget = 256 * (1 << 20);
|
74
87
|
/**
|
75
|
-
*
|
88
|
+
* What is the budget for GPU resources allocated and held by the Context.
|
76
89
|
*/
|
77
|
-
|
90
|
+
size_t fGpuBudgetInBytes = kDefaultContextBudget;
|
78
91
|
|
79
92
|
/**
|
80
|
-
*
|
81
|
-
* that created it. Used by readPixels() and other methods that normally require a Context.
|
93
|
+
* Private options that are only meant for testing within Skia's tools.
|
82
94
|
*/
|
83
|
-
|
84
|
-
#endif
|
95
|
+
ContextOptionsPriv* fOptionsPriv = nullptr;
|
85
96
|
};
|
86
97
|
|
87
98
|
} // namespace skgpu::graphite
|
@@ -16,8 +16,13 @@
|
|
16
16
|
|
17
17
|
class SkSurface;
|
18
18
|
|
19
|
+
namespace skgpu {
|
20
|
+
class MutableTextureState;
|
21
|
+
}
|
22
|
+
|
19
23
|
namespace skgpu::graphite {
|
20
24
|
|
25
|
+
class BackendSemaphore;
|
21
26
|
class Recording;
|
22
27
|
class Task;
|
23
28
|
|
@@ -38,12 +43,30 @@ using GpuFinishedProc = void (*)(GpuFinishedContext finishedContext, CallbackRes
|
|
38
43
|
* TextureInfo must match the info provided to the Recorder when making the deferred canvas.
|
39
44
|
*
|
40
45
|
* fTargetTranslation is an additional translation applied to draws targeting fTargetSurface.
|
46
|
+
*
|
47
|
+
* The client may pass in two arrays of initialized BackendSemaphores to be included in the
|
48
|
+
* command stream. At some time before issuing commands in the Recording, the fWaitSemaphores will
|
49
|
+
* be waited on by the gpu. Similarly, at some time after issuing the Recording's commands, the
|
50
|
+
* fSignalSemaphores will be signaled by the gpu. Depending on the platform, the timing of the wait
|
51
|
+
* and signal operations will either be immediately before or after the given Recording's command
|
52
|
+
* stream, respectively, or before and after the entire CommandBuffer's command stream. The
|
53
|
+
* semaphores are not sent to the GPU until the next Context::submit call is made.
|
54
|
+
*
|
55
|
+
* The client will own and be responsible for deleting the underlying semaphore objects after the
|
56
|
+
* submission completes, however the BackendSemaphore objects themselves can be deleted as soon
|
57
|
+
* as this function returns.
|
41
58
|
*/
|
42
59
|
struct InsertRecordingInfo {
|
43
60
|
Recording* fRecording = nullptr;
|
44
61
|
|
45
62
|
SkSurface* fTargetSurface = nullptr;
|
46
63
|
SkIVector fTargetTranslation = {0, 0};
|
64
|
+
MutableTextureState* fTargetTextureState = nullptr;
|
65
|
+
|
66
|
+
size_t fNumWaitSemaphores = 0;
|
67
|
+
BackendSemaphore* fWaitSemaphores = nullptr;
|
68
|
+
size_t fNumSignalSemaphores = 0;
|
69
|
+
BackendSemaphore* fSignalSemaphores = nullptr;
|
47
70
|
|
48
71
|
GpuFinishedContext fFinishedContext = nullptr;
|
49
72
|
GpuFinishedProc fFinishedProc = nullptr;
|