@shopify/react-native-skia 0.1.196 → 0.1.199
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 +32 -31
- package/android/cpp/rnskia-android/SkiaOpenGLRenderer.cpp +4 -2
- package/android/cpp/rnskia-android/SkiaOpenGLRenderer.h +3 -0
- package/cpp/api/JsiSkImage.h +1 -1
- package/cpp/api/JsiSkShaderFactory.h +4 -4
- package/cpp/api/JsiSkSurface.h +0 -1
- package/cpp/api/JsiSkSurfaceFactory.h +2 -1
- package/cpp/rnskia/RNSkView.h +20 -40
- package/cpp/rnskia/dom/nodes/JsiShaderNodes.h +2 -2
- package/cpp/rnskia/values/RNSkReadonlyValue.h +6 -7
- package/cpp/skia/include/android/SkCanvasAndroid.h +20 -0
- package/cpp/skia/include/android/SkHeifDecoder.h +43 -0
- package/cpp/skia/include/android/SkSurfaceAndroid.h +50 -0
- package/cpp/skia/include/codec/SkAvifDecoder.h +43 -0
- package/cpp/skia/include/codec/SkBmpDecoder.h +43 -0
- package/cpp/skia/include/codec/SkCodec.h +25 -1
- package/cpp/skia/include/codec/SkGifDecoder.h +43 -0
- package/cpp/skia/include/codec/SkIcoDecoder.h +43 -0
- package/cpp/skia/include/codec/SkJpegDecoder.h +43 -0
- package/cpp/skia/include/codec/SkJpegxlDecoder.h +43 -0
- package/cpp/skia/include/codec/SkPngDecoder.h +43 -0
- package/cpp/skia/include/codec/SkRawDecoder.h +49 -0
- package/cpp/skia/include/codec/SkWbmpDecoder.h +43 -0
- package/cpp/skia/include/codec/SkWebpDecoder.h +43 -0
- package/cpp/skia/include/core/SkBBHFactory.h +5 -1
- package/cpp/skia/include/core/SkBlender.h +0 -2
- package/cpp/skia/include/core/SkCanvas.h +4 -23
- package/cpp/skia/include/core/SkColorFilter.h +14 -1
- package/cpp/skia/include/core/SkColorTable.h +59 -0
- package/cpp/skia/include/core/SkContourMeasure.h +3 -0
- package/cpp/skia/include/core/SkDeferredDisplayList.h +8 -104
- package/cpp/skia/include/core/SkDeferredDisplayListRecorder.h +8 -91
- package/cpp/skia/include/core/SkDrawable.h +5 -2
- package/cpp/skia/include/core/SkGraphics.h +7 -19
- package/cpp/skia/include/core/SkImage.h +157 -249
- package/cpp/skia/include/core/SkImageGenerator.h +0 -31
- package/cpp/skia/include/core/SkMilestone.h +1 -1
- package/cpp/skia/include/core/SkPathMeasure.h +3 -3
- package/cpp/skia/include/core/SkPictureRecorder.h +1 -1
- package/cpp/skia/include/core/SkPoint.h +5 -563
- package/cpp/skia/include/core/SkPoint3.h +1 -0
- package/cpp/skia/include/core/SkPromiseImageTexture.h +4 -30
- package/cpp/skia/include/core/SkRect.h +8 -8
- package/cpp/skia/include/core/SkSamplingOptions.h +4 -2
- package/cpp/skia/include/core/SkScalar.h +1 -1
- package/cpp/skia/include/core/SkSerialProcs.h +5 -1
- package/cpp/skia/include/core/SkShader.h +14 -21
- package/cpp/skia/include/core/SkString.h +2 -0
- package/cpp/skia/include/core/SkSurface.h +169 -701
- package/cpp/skia/include/core/SkSurfaceCharacterization.h +8 -256
- package/cpp/skia/include/core/SkTiledImageUtils.h +97 -0
- package/cpp/skia/include/core/SkTypes.h +4 -2
- package/cpp/skia/include/core/SkYUVAPixmaps.h +0 -5
- package/cpp/skia/include/effects/SkGradientShader.h +10 -1
- package/cpp/skia/include/effects/SkImageFilters.h +62 -37
- package/cpp/skia/include/effects/SkPerlinNoiseShader.h +28 -29
- package/cpp/skia/include/effects/SkRuntimeEffect.h +17 -12
- package/cpp/skia/include/gpu/GrBackendSurface.h +12 -39
- package/cpp/skia/include/gpu/GrBackendSurfaceMutableState.h +6 -0
- package/cpp/skia/include/gpu/GrContextThreadSafeProxy.h +3 -3
- package/cpp/skia/include/gpu/GrDirectContext.h +103 -3
- package/cpp/skia/include/gpu/GrRecordingContext.h +10 -19
- package/cpp/skia/include/gpu/MutableTextureState.h +4 -0
- package/cpp/skia/include/gpu/ganesh/GrExternalTextureGenerator.h +54 -0
- package/cpp/skia/include/gpu/ganesh/SkImageGanesh.h +20 -76
- package/cpp/skia/include/gpu/ganesh/SkSurfaceGanesh.h +217 -0
- package/cpp/skia/include/gpu/ganesh/mtl/SkSurfaceMetal.h +73 -0
- package/cpp/skia/include/gpu/gl/GrGLTypes.h +13 -2
- package/cpp/skia/include/gpu/graphite/BackendSemaphore.h +78 -0
- package/cpp/skia/include/gpu/graphite/BackendTexture.h +1 -0
- package/cpp/skia/include/gpu/graphite/Image.h +277 -0
- package/cpp/skia/include/gpu/graphite/ImageProvider.h +1 -1
- package/cpp/skia/include/gpu/graphite/Recording.h +1 -4
- package/cpp/skia/include/gpu/graphite/Surface.h +81 -0
- package/cpp/skia/include/gpu/graphite/TextureInfo.h +5 -7
- package/cpp/skia/include/gpu/graphite/YUVABackendTextures.h +2 -2
- package/cpp/skia/include/gpu/mock/GrMockTypes.h +23 -8
- package/cpp/skia/include/ports/SkTypeface_fontations.h +21 -0
- package/cpp/skia/include/private/SkGainmapInfo.h +2 -0
- package/cpp/skia/include/private/SkGainmapShader.h +1 -0
- package/cpp/skia/include/private/SkJpegMetadataDecoder.h +19 -1
- package/cpp/skia/include/private/SkPathRef.h +13 -15
- package/cpp/skia/include/private/SkXmp.h +53 -0
- package/cpp/skia/include/private/base/SkFeatures.h +0 -4
- package/cpp/skia/include/private/base/SkFloatingPoint.h +11 -5
- package/cpp/skia/include/private/base/SkPoint_impl.h +569 -0
- package/cpp/skia/include/private/base/SkSpan_impl.h +3 -7
- package/cpp/skia/include/private/base/SkTArray.h +11 -11
- package/cpp/skia/include/private/chromium/GrDeferredDisplayList.h +120 -0
- package/cpp/skia/include/private/chromium/GrDeferredDisplayListRecorder.h +98 -0
- package/cpp/skia/include/private/chromium/GrPromiseImageTexture.h +43 -0
- package/cpp/skia/include/private/chromium/GrSurfaceCharacterization.h +215 -0
- package/cpp/skia/include/private/chromium/GrVkSecondaryCBDrawContext.h +6 -6
- package/cpp/skia/include/private/chromium/SkImageChromium.h +104 -0
- package/cpp/skia/include/private/chromium/Slug.h +7 -3
- package/cpp/skia/include/private/gpu/ganesh/GrContext_Base.h +7 -3
- package/cpp/skia/include/private/gpu/ganesh/GrGLTypesPriv.h +2 -0
- package/cpp/skia/include/private/gpu/ganesh/GrImageContext.h +3 -2
- package/cpp/skia/include/private/gpu/ganesh/GrMtlTypesPriv.h +10 -2
- package/cpp/skia/include/{gpu → private/gpu}/ganesh/GrTextureGenerator.h +2 -13
- package/cpp/skia/include/private/gpu/ganesh/GrTypesPriv.h +1 -1
- package/cpp/skia/include/private/gpu/graphite/DawnTypesPriv.h +7 -0
- package/cpp/skia/include/private/gpu/graphite/MtlGraphiteTypesPriv.h +19 -6
- package/cpp/skia/include/private/gpu/graphite/VulkanGraphiteTypesPriv.h +13 -0
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan.h +0 -1
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_android.h +14 -1
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_core.h +999 -79
- package/cpp/skia/modules/skcms/src/Transform_inl.h +36 -236
- package/cpp/skia/modules/skparagraph/include/Paragraph.h +2 -0
- package/cpp/skia/modules/skparagraph/include/ParagraphBuilder.h +16 -0
- package/cpp/skia/modules/skparagraph/include/TextStyle.h +6 -2
- package/cpp/skia/modules/skresources/include/SkResources.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGCircle.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGClipPath.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGContainer.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGDOM.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGDefs.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGEllipse.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGFe.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGFeBlend.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGFeColorMatrix.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGFeComposite.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGFeDisplacementMap.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGFeFlood.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGFeGaussianBlur.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGFeImage.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGFeLightSource.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGFeLighting.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGFeOffset.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGFeTurbulence.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGFilter.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGG.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGGradient.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGHiddenContainer.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGImage.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGLine.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGLinearGradient.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGMask.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGNode.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGPath.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGPattern.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGPoly.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGRadialGradient.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGRect.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGRenderContext.h +3 -3
- package/cpp/skia/modules/svg/include/SkSVGSVG.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGShape.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGStop.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGText.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGTransformableNode.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGTypes.h +21 -21
- package/cpp/skia/modules/svg/include/SkSVGUse.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGValue.h +2 -2
- package/cpp/skia/{include/private → src/core}/SkChecksum.h +32 -17
- package/cpp/skia/src/core/SkTHash.h +1 -1
- package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.mm +3 -1
- package/ios/RNSkia-iOS/SkiaMetalRenderer.mm +3 -1
- package/lib/commonjs/renderer/Canvas.js +24 -13
- package/lib/commonjs/renderer/Canvas.js.map +1 -1
- package/lib/commonjs/skia/core/Data.d.ts +2 -2
- package/lib/commonjs/skia/core/Data.js.map +1 -1
- package/lib/commonjs/skia/core/RRect.js +5 -1
- package/lib/commonjs/skia/core/RRect.js.map +1 -1
- package/lib/commonjs/skia/core/Rect.js +32 -6
- package/lib/commonjs/skia/core/Rect.js.map +1 -1
- package/lib/commonjs/skia/types/Color.js.map +1 -1
- package/lib/commonjs/skia/types/JsiInstance.d.ts +2 -4
- package/lib/commonjs/skia/types/JsiInstance.js.map +1 -1
- package/lib/module/renderer/Canvas.js +25 -14
- package/lib/module/renderer/Canvas.js.map +1 -1
- package/lib/module/skia/core/Data.d.ts +2 -2
- package/lib/module/skia/core/Data.js.map +1 -1
- package/lib/module/skia/core/RRect.js +5 -1
- package/lib/module/skia/core/RRect.js.map +1 -1
- package/lib/module/skia/core/Rect.js +32 -6
- package/lib/module/skia/core/Rect.js.map +1 -1
- package/lib/module/skia/types/Color.js.map +1 -1
- package/lib/module/skia/types/JsiInstance.d.ts +2 -4
- package/lib/module/skia/types/JsiInstance.js.map +1 -1
- package/lib/typescript/src/skia/core/Data.d.ts +2 -2
- package/lib/typescript/src/skia/types/JsiInstance.d.ts +2 -4
- package/libs/android/arm64-v8a/libskia.a +0 -0
- package/libs/android/arm64-v8a/libskottie.a +0 -0
- package/libs/android/arm64-v8a/libsksg.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/libsksg.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/libsksg.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/libsksg.a +0 -0
- package/libs/android/x86_64/libsvg.a +0 -0
- 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/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/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 +3 -4
- package/src/renderer/Canvas.tsx +25 -19
- package/src/skia/core/Data.ts +3 -3
- package/src/skia/core/RRect.tsx +4 -2
- package/src/skia/core/Rect.ts +29 -12
- package/src/skia/types/Color.ts +1 -1
- package/src/skia/types/JsiInstance.ts +2 -5
- package/cpp/skia/include/effects/SkTableColorFilter.h +0 -29
- package/cpp/skia/include/private/SkOpts_spi.h +0 -23
- package/cpp/skia/include/private/SkSpinlock.h +0 -57
- package/cpp/skia/include/private/chromium/GrSlug.h +0 -16
- package/scripts/install-npm.js +0 -33
|
@@ -45,10 +45,9 @@ public:
|
|
|
45
45
|
TArray() : fOwnMemory(true), fCapacity{0} {}
|
|
46
46
|
|
|
47
47
|
/**
|
|
48
|
-
* Creates an empty array that will preallocate space for reserveCount
|
|
49
|
-
* elements.
|
|
48
|
+
* Creates an empty array that will preallocate space for reserveCount elements.
|
|
50
49
|
*/
|
|
51
|
-
explicit TArray(int reserveCount) : TArray() { this->
|
|
50
|
+
explicit TArray(int reserveCount) : TArray() { this->reserve_exact(reserveCount); }
|
|
52
51
|
|
|
53
52
|
/**
|
|
54
53
|
* Copies one array to another. The new array will be heap allocated.
|
|
@@ -149,7 +148,9 @@ public:
|
|
|
149
148
|
}
|
|
150
149
|
|
|
151
150
|
/**
|
|
152
|
-
* Ensures there is enough reserved space for n elements.
|
|
151
|
+
* Ensures there is enough reserved space for at least n elements. This is guaranteed at least
|
|
152
|
+
* until the array size grows above n and subsequently shrinks below n, any version of reset()
|
|
153
|
+
* is called, or reserve() is called again.
|
|
153
154
|
*/
|
|
154
155
|
void reserve(int n) {
|
|
155
156
|
SkASSERT(n >= 0);
|
|
@@ -159,14 +160,13 @@ public:
|
|
|
159
160
|
}
|
|
160
161
|
|
|
161
162
|
/**
|
|
162
|
-
* Ensures there is enough reserved space for n
|
|
163
|
-
*
|
|
164
|
-
* is called, or reserve_back() is called again.
|
|
163
|
+
* Ensures there is enough reserved space for exactly n elements. The same capacity guarantees
|
|
164
|
+
* as above apply.
|
|
165
165
|
*/
|
|
166
|
-
void
|
|
166
|
+
void reserve_exact(int n) {
|
|
167
167
|
SkASSERT(n >= 0);
|
|
168
|
-
if (n >
|
|
169
|
-
this->checkRealloc(n, kExactFit);
|
|
168
|
+
if (n > this->size()) {
|
|
169
|
+
this->checkRealloc(n - this->size(), kExactFit);
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
172
|
|
|
@@ -652,7 +652,7 @@ public:
|
|
|
652
652
|
: STArray{data.begin(), SkToInt(data.size())} {}
|
|
653
653
|
|
|
654
654
|
explicit STArray(int reserveCount)
|
|
655
|
-
: STArray() { this->
|
|
655
|
+
: STArray() { this->reserve_exact(reserveCount); }
|
|
656
656
|
|
|
657
657
|
STArray(const STArray& that)
|
|
658
658
|
: STArray() { *this = that; }
|
|
@@ -0,0 +1,120 @@
|
|
|
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 GrDeferredDisplayList_DEFINED
|
|
9
|
+
#define GrDeferredDisplayList_DEFINED
|
|
10
|
+
|
|
11
|
+
#include "include/core/SkRefCnt.h"
|
|
12
|
+
#include "include/core/SkTypes.h"
|
|
13
|
+
#include "include/gpu/GrRecordingContext.h"
|
|
14
|
+
#include "include/private/base/SkTArray.h"
|
|
15
|
+
#include "include/private/chromium/GrSurfaceCharacterization.h"
|
|
16
|
+
|
|
17
|
+
class GrDirectContext;
|
|
18
|
+
class GrRenderTargetProxy;
|
|
19
|
+
class GrRenderTask;
|
|
20
|
+
class GrDeferredDisplayListPriv;
|
|
21
|
+
class SkSurface;
|
|
22
|
+
|
|
23
|
+
/*
|
|
24
|
+
* This class contains pre-processed gpu operations that can be replayed into
|
|
25
|
+
* an SkSurface via SkSurface::draw(GrDeferredDisplayList*).
|
|
26
|
+
*/
|
|
27
|
+
class GrDeferredDisplayList : public SkNVRefCnt<GrDeferredDisplayList> {
|
|
28
|
+
public:
|
|
29
|
+
SK_API ~GrDeferredDisplayList();
|
|
30
|
+
|
|
31
|
+
SK_API const GrSurfaceCharacterization& characterization() const {
|
|
32
|
+
return fCharacterization;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Iterate through the programs required by the DDL.
|
|
36
|
+
*/
|
|
37
|
+
class SK_API ProgramIterator {
|
|
38
|
+
public:
|
|
39
|
+
ProgramIterator(GrDirectContext*, GrDeferredDisplayList*);
|
|
40
|
+
~ProgramIterator();
|
|
41
|
+
|
|
42
|
+
// This returns true if any work was done. Getting a cache hit does not count as work.
|
|
43
|
+
bool compile();
|
|
44
|
+
bool done() const;
|
|
45
|
+
void next();
|
|
46
|
+
|
|
47
|
+
private:
|
|
48
|
+
GrDirectContext* fDContext;
|
|
49
|
+
const skia_private::TArray<GrRecordingContext::ProgramData>& fProgramData;
|
|
50
|
+
int fIndex;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
// Provides access to functions that aren't part of the public API.
|
|
54
|
+
GrDeferredDisplayListPriv priv();
|
|
55
|
+
const GrDeferredDisplayListPriv priv() const; // NOLINT(readability-const-return-type)
|
|
56
|
+
|
|
57
|
+
private:
|
|
58
|
+
friend class GrDrawingManager; // for access to 'fRenderTasks', 'fLazyProxyData', 'fArenas'
|
|
59
|
+
friend class GrDeferredDisplayListRecorder; // for access to 'fLazyProxyData'
|
|
60
|
+
friend class GrDeferredDisplayListPriv;
|
|
61
|
+
|
|
62
|
+
// This object is the source from which the lazy proxy backing the DDL will pull its backing
|
|
63
|
+
// texture when the DDL is replayed. It has to be separately ref counted bc the lazy proxy
|
|
64
|
+
// can outlive the DDL.
|
|
65
|
+
class LazyProxyData : public SkRefCnt {
|
|
66
|
+
public:
|
|
67
|
+
// Upon being replayed - this field will be filled in (by the DrawingManager) with the
|
|
68
|
+
// proxy backing the destination SkSurface. Note that, since there is no good place to
|
|
69
|
+
// clear it, it can become a dangling pointer. Additionally, since the renderTargetProxy
|
|
70
|
+
// doesn't get a ref here, the SkSurface that owns it must remain alive until the DDL
|
|
71
|
+
// is flushed.
|
|
72
|
+
// TODO: the drawing manager could ref the renderTargetProxy for the DDL and then add
|
|
73
|
+
// a renderingTask to unref it after the DDL's ops have been executed.
|
|
74
|
+
GrRenderTargetProxy* fReplayDest = nullptr;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
SK_API GrDeferredDisplayList(const GrSurfaceCharacterization& characterization,
|
|
78
|
+
sk_sp<GrRenderTargetProxy> fTargetProxy,
|
|
79
|
+
sk_sp<LazyProxyData>);
|
|
80
|
+
|
|
81
|
+
const skia_private::TArray<GrRecordingContext::ProgramData>& programData() const {
|
|
82
|
+
return fProgramData;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const GrSurfaceCharacterization fCharacterization;
|
|
86
|
+
|
|
87
|
+
// These are ordered such that the destructor cleans op tasks up first (which may refer back
|
|
88
|
+
// to the arena and memory pool in their destructors).
|
|
89
|
+
GrRecordingContext::OwnedArenas fArenas;
|
|
90
|
+
skia_private::TArray<sk_sp<GrRenderTask>> fRenderTasks;
|
|
91
|
+
|
|
92
|
+
skia_private::TArray<GrRecordingContext::ProgramData> fProgramData;
|
|
93
|
+
sk_sp<GrRenderTargetProxy> fTargetProxy;
|
|
94
|
+
sk_sp<LazyProxyData> fLazyProxyData;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
namespace skgpu::ganesh {
|
|
98
|
+
/** Draws the deferred display list created via a GrDeferredDisplayListRecorder.
|
|
99
|
+
If the deferred display list is not compatible with the surface, the draw is skipped
|
|
100
|
+
and false is return.
|
|
101
|
+
|
|
102
|
+
The xOffset and yOffset parameters are experimental and, if not both zero, will cause
|
|
103
|
+
the draw to be ignored.
|
|
104
|
+
When implemented, if xOffset or yOffset are non-zero, the DDL will be drawn offset by that
|
|
105
|
+
amount into the surface.
|
|
106
|
+
|
|
107
|
+
@param SkSurface The surface to apply the commands to, cannot be nullptr.
|
|
108
|
+
@param ddl drawing commands, cannot be nullptr.
|
|
109
|
+
@return false if ddl is not compatible
|
|
110
|
+
|
|
111
|
+
example: https://fiddle.skia.org/c/@Surface_draw_2
|
|
112
|
+
*/
|
|
113
|
+
SK_API bool DrawDDL(SkSurface*,
|
|
114
|
+
sk_sp<const GrDeferredDisplayList> ddl);
|
|
115
|
+
|
|
116
|
+
SK_API bool DrawDDL(sk_sp<SkSurface>,
|
|
117
|
+
sk_sp<const GrDeferredDisplayList> ddl);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
#endif
|
|
@@ -0,0 +1,98 @@
|
|
|
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 GrDeferredDisplayListRecorder_DEFINED
|
|
9
|
+
#define GrDeferredDisplayListRecorder_DEFINED
|
|
10
|
+
|
|
11
|
+
#include "include/core/SkRefCnt.h"
|
|
12
|
+
#include "include/core/SkTypes.h"
|
|
13
|
+
#include "include/gpu/GrTypes.h"
|
|
14
|
+
#include "include/private/chromium/GrDeferredDisplayList.h"
|
|
15
|
+
#include "include/private/chromium/GrSurfaceCharacterization.h"
|
|
16
|
+
|
|
17
|
+
class GrBackendFormat;
|
|
18
|
+
class GrRecordingContext;
|
|
19
|
+
class GrRenderTargetProxy;
|
|
20
|
+
class GrYUVABackendTextureInfo;
|
|
21
|
+
class SkCanvas;
|
|
22
|
+
class SkColorSpace;
|
|
23
|
+
class SkImage;
|
|
24
|
+
class GrPromiseImageTexture;
|
|
25
|
+
class SkSurface;
|
|
26
|
+
enum SkAlphaType : int;
|
|
27
|
+
enum SkColorType : int;
|
|
28
|
+
|
|
29
|
+
/*
|
|
30
|
+
* This class is intended to be used as:
|
|
31
|
+
* Get a GrSurfaceCharacterization representing the intended gpu-backed destination SkSurface
|
|
32
|
+
* Create one of these (a GrDeferredDisplayListRecorder) on the stack
|
|
33
|
+
* Get the canvas and render into it
|
|
34
|
+
* Snap off and hold on to a GrDeferredDisplayList
|
|
35
|
+
* Once your app actually needs the pixels, call skgpu::ganesh::DrawDDL(GrDeferredDisplayList*)
|
|
36
|
+
*
|
|
37
|
+
* This class never accesses the GPU but performs all the cpu work it can. It
|
|
38
|
+
* is thread-safe (i.e., one can break a scene into tiles and perform their cpu-side
|
|
39
|
+
* work in parallel ahead of time).
|
|
40
|
+
*/
|
|
41
|
+
class SK_API GrDeferredDisplayListRecorder {
|
|
42
|
+
public:
|
|
43
|
+
GrDeferredDisplayListRecorder(const GrSurfaceCharacterization&);
|
|
44
|
+
~GrDeferredDisplayListRecorder();
|
|
45
|
+
|
|
46
|
+
const GrSurfaceCharacterization& characterization() const {
|
|
47
|
+
return fCharacterization;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// The backing canvas will become invalid (and this entry point will return
|
|
51
|
+
// null) once 'detach' is called.
|
|
52
|
+
// Note: ownership of the SkCanvas is not transferred via this call.
|
|
53
|
+
SkCanvas* getCanvas();
|
|
54
|
+
|
|
55
|
+
sk_sp<GrDeferredDisplayList> detach();
|
|
56
|
+
|
|
57
|
+
using PromiseImageTextureContext = void*;
|
|
58
|
+
using PromiseImageTextureFulfillProc =
|
|
59
|
+
sk_sp<GrPromiseImageTexture> (*)(PromiseImageTextureContext);
|
|
60
|
+
using PromiseImageTextureReleaseProc = void (*)(PromiseImageTextureContext);
|
|
61
|
+
|
|
62
|
+
#ifndef SK_MAKE_PROMISE_TEXTURE_DISABLE_LEGACY_API
|
|
63
|
+
/** Deprecated: Use SkImages::PromiseTextureFrom instead. */
|
|
64
|
+
sk_sp<SkImage> makePromiseTexture(const GrBackendFormat& backendFormat,
|
|
65
|
+
int width,
|
|
66
|
+
int height,
|
|
67
|
+
GrMipmapped mipmapped,
|
|
68
|
+
GrSurfaceOrigin origin,
|
|
69
|
+
SkColorType colorType,
|
|
70
|
+
SkAlphaType alphaType,
|
|
71
|
+
sk_sp<SkColorSpace> colorSpace,
|
|
72
|
+
PromiseImageTextureFulfillProc textureFulfillProc,
|
|
73
|
+
PromiseImageTextureReleaseProc textureReleaseProc,
|
|
74
|
+
PromiseImageTextureContext textureContext);
|
|
75
|
+
|
|
76
|
+
/** Deprecated: Use SkImages::PromiseTextureFromYUVA instead. */
|
|
77
|
+
sk_sp<SkImage> makeYUVAPromiseTexture(const GrYUVABackendTextureInfo& yuvaBackendTextureInfo,
|
|
78
|
+
sk_sp<SkColorSpace> imageColorSpace,
|
|
79
|
+
PromiseImageTextureFulfillProc textureFulfillProc,
|
|
80
|
+
PromiseImageTextureReleaseProc textureReleaseProc,
|
|
81
|
+
PromiseImageTextureContext textureContexts[]);
|
|
82
|
+
#endif // SK_MAKE_PROMISE_TEXTURE_DISABLE_LEGACY_API
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
private:
|
|
86
|
+
GrDeferredDisplayListRecorder(const GrDeferredDisplayListRecorder&) = delete;
|
|
87
|
+
GrDeferredDisplayListRecorder& operator=(const GrDeferredDisplayListRecorder&) = delete;
|
|
88
|
+
|
|
89
|
+
bool init();
|
|
90
|
+
|
|
91
|
+
const GrSurfaceCharacterization fCharacterization;
|
|
92
|
+
sk_sp<GrRecordingContext> fContext;
|
|
93
|
+
sk_sp<GrRenderTargetProxy> fTargetProxy;
|
|
94
|
+
sk_sp<GrDeferredDisplayList::LazyProxyData> fLazyProxyData;
|
|
95
|
+
sk_sp<SkSurface> fSurface;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
#endif
|
|
@@ -0,0 +1,43 @@
|
|
|
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 GrPromiseImageTexture_DEFINED
|
|
9
|
+
#define GrPromiseImageTexture_DEFINED
|
|
10
|
+
|
|
11
|
+
#include "include/core/SkRefCnt.h"
|
|
12
|
+
#include "include/core/SkTypes.h"
|
|
13
|
+
#include "include/gpu/GrBackendSurface.h"
|
|
14
|
+
/**
|
|
15
|
+
* This type is used to fulfill textures for PromiseImages. Once an instance is returned from a
|
|
16
|
+
* PromiseImageTextureFulfillProc the GrBackendTexture it wraps must remain valid until the
|
|
17
|
+
* corresponding PromiseImageTextureReleaseProc is called.
|
|
18
|
+
*/
|
|
19
|
+
class SK_API GrPromiseImageTexture : public SkNVRefCnt<GrPromiseImageTexture> {
|
|
20
|
+
public:
|
|
21
|
+
GrPromiseImageTexture() = delete;
|
|
22
|
+
GrPromiseImageTexture(const GrPromiseImageTexture&) = delete;
|
|
23
|
+
GrPromiseImageTexture(GrPromiseImageTexture&&) = delete;
|
|
24
|
+
~GrPromiseImageTexture();
|
|
25
|
+
GrPromiseImageTexture& operator=(const GrPromiseImageTexture&) = delete;
|
|
26
|
+
GrPromiseImageTexture& operator=(GrPromiseImageTexture&&) = delete;
|
|
27
|
+
|
|
28
|
+
static sk_sp<GrPromiseImageTexture> Make(const GrBackendTexture& backendTexture) {
|
|
29
|
+
if (!backendTexture.isValid()) {
|
|
30
|
+
return nullptr;
|
|
31
|
+
}
|
|
32
|
+
return sk_sp<GrPromiseImageTexture>(new GrPromiseImageTexture(backendTexture));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
GrBackendTexture backendTexture() const { return fBackendTexture; }
|
|
36
|
+
|
|
37
|
+
private:
|
|
38
|
+
explicit GrPromiseImageTexture(const GrBackendTexture& backendTexture);
|
|
39
|
+
|
|
40
|
+
GrBackendTexture fBackendTexture;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
#endif // GrPromiseImageTexture_DEFINED
|
|
@@ -0,0 +1,215 @@
|
|
|
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 GrSurfaceCharacterization_DEFINED
|
|
9
|
+
#define GrSurfaceCharacterization_DEFINED
|
|
10
|
+
|
|
11
|
+
#include "include/core/SkColorSpace.h" // IWYU pragma: keep
|
|
12
|
+
#include "include/core/SkColorType.h"
|
|
13
|
+
#include "include/core/SkImageInfo.h"
|
|
14
|
+
#include "include/core/SkRefCnt.h"
|
|
15
|
+
#include "include/core/SkSize.h"
|
|
16
|
+
#include "include/core/SkSurfaceProps.h"
|
|
17
|
+
#include "include/core/SkTypes.h"
|
|
18
|
+
#include "include/gpu/GpuTypes.h"
|
|
19
|
+
#include "include/gpu/GrBackendSurface.h"
|
|
20
|
+
#include "include/gpu/GrContextThreadSafeProxy.h"
|
|
21
|
+
#include "include/gpu/GrTypes.h"
|
|
22
|
+
#include "include/private/base/SkDebug.h"
|
|
23
|
+
|
|
24
|
+
#include <cstddef>
|
|
25
|
+
#include <utility>
|
|
26
|
+
|
|
27
|
+
/** \class GrSurfaceCharacterization
|
|
28
|
+
A surface characterization contains all the information Ganesh requires to makes its internal
|
|
29
|
+
rendering decisions. When passed into a GrDeferredDisplayListRecorder it will copy the
|
|
30
|
+
data and pass it on to the GrDeferredDisplayList if/when it is created. Note that both of
|
|
31
|
+
those objects (the Recorder and the DisplayList) will take a ref on the
|
|
32
|
+
GrContextThreadSafeProxy and SkColorSpace objects.
|
|
33
|
+
*/
|
|
34
|
+
class SK_API GrSurfaceCharacterization {
|
|
35
|
+
public:
|
|
36
|
+
enum class Textureable : bool { kNo = false, kYes = true };
|
|
37
|
+
enum class MipMapped : bool { kNo = false, kYes = true };
|
|
38
|
+
enum class UsesGLFBO0 : bool { kNo = false, kYes = true };
|
|
39
|
+
// This flag indicates that the backing VkImage for this Vulkan surface will have the
|
|
40
|
+
// VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT set. This bit allows skia to handle advanced blends
|
|
41
|
+
// more optimally in a shader by being able to directly read the dst values.
|
|
42
|
+
enum class VkRTSupportsInputAttachment : bool { kNo = false, kYes = true };
|
|
43
|
+
// This flag indicates if the surface is wrapping a raw Vulkan secondary command buffer.
|
|
44
|
+
enum class VulkanSecondaryCBCompatible : bool { kNo = false, kYes = true };
|
|
45
|
+
|
|
46
|
+
GrSurfaceCharacterization()
|
|
47
|
+
: fCacheMaxResourceBytes(0)
|
|
48
|
+
, fOrigin(kBottomLeft_GrSurfaceOrigin)
|
|
49
|
+
, fSampleCnt(0)
|
|
50
|
+
, fIsTextureable(Textureable::kYes)
|
|
51
|
+
, fIsMipMapped(MipMapped::kYes)
|
|
52
|
+
, fUsesGLFBO0(UsesGLFBO0::kNo)
|
|
53
|
+
, fVulkanSecondaryCBCompatible(VulkanSecondaryCBCompatible::kNo)
|
|
54
|
+
, fIsProtected(GrProtected::kNo)
|
|
55
|
+
, fSurfaceProps(0, kUnknown_SkPixelGeometry) {
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
GrSurfaceCharacterization(GrSurfaceCharacterization&&) = default;
|
|
59
|
+
GrSurfaceCharacterization& operator=(GrSurfaceCharacterization&&) = default;
|
|
60
|
+
|
|
61
|
+
GrSurfaceCharacterization(const GrSurfaceCharacterization&) = default;
|
|
62
|
+
GrSurfaceCharacterization& operator=(const GrSurfaceCharacterization& other) = default;
|
|
63
|
+
bool operator==(const GrSurfaceCharacterization& other) const;
|
|
64
|
+
bool operator!=(const GrSurfaceCharacterization& other) const {
|
|
65
|
+
return !(*this == other);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/*
|
|
69
|
+
* Return a new surface characterization with the only difference being a different width
|
|
70
|
+
* and height
|
|
71
|
+
*/
|
|
72
|
+
GrSurfaceCharacterization createResized(int width, int height) const;
|
|
73
|
+
|
|
74
|
+
/*
|
|
75
|
+
* Return a new surface characterization with only a replaced color space
|
|
76
|
+
*/
|
|
77
|
+
GrSurfaceCharacterization createColorSpace(sk_sp<SkColorSpace>) const;
|
|
78
|
+
|
|
79
|
+
/*
|
|
80
|
+
* Return a new surface characterization with the backend format replaced. A colorType
|
|
81
|
+
* must also be supplied to indicate the interpretation of the new format.
|
|
82
|
+
*/
|
|
83
|
+
GrSurfaceCharacterization createBackendFormat(SkColorType colorType,
|
|
84
|
+
const GrBackendFormat& backendFormat) const;
|
|
85
|
+
|
|
86
|
+
/*
|
|
87
|
+
* Return a new surface characterization with just a different use of FBO0 (in GL)
|
|
88
|
+
*/
|
|
89
|
+
GrSurfaceCharacterization createFBO0(bool usesGLFBO0) const;
|
|
90
|
+
|
|
91
|
+
GrContextThreadSafeProxy* contextInfo() const { return fContextInfo.get(); }
|
|
92
|
+
sk_sp<GrContextThreadSafeProxy> refContextInfo() const { return fContextInfo; }
|
|
93
|
+
size_t cacheMaxResourceBytes() const { return fCacheMaxResourceBytes; }
|
|
94
|
+
|
|
95
|
+
bool isValid() const { return kUnknown_SkColorType != fImageInfo.colorType(); }
|
|
96
|
+
|
|
97
|
+
const SkImageInfo& imageInfo() const { return fImageInfo; }
|
|
98
|
+
const GrBackendFormat& backendFormat() const { return fBackendFormat; }
|
|
99
|
+
GrSurfaceOrigin origin() const { return fOrigin; }
|
|
100
|
+
SkISize dimensions() const { return fImageInfo.dimensions(); }
|
|
101
|
+
int width() const { return fImageInfo.width(); }
|
|
102
|
+
int height() const { return fImageInfo.height(); }
|
|
103
|
+
SkColorType colorType() const { return fImageInfo.colorType(); }
|
|
104
|
+
int sampleCount() const { return fSampleCnt; }
|
|
105
|
+
bool isTextureable() const { return Textureable::kYes == fIsTextureable; }
|
|
106
|
+
bool isMipMapped() const { return MipMapped::kYes == fIsMipMapped; }
|
|
107
|
+
bool usesGLFBO0() const { return UsesGLFBO0::kYes == fUsesGLFBO0; }
|
|
108
|
+
bool vkRTSupportsInputAttachment() const {
|
|
109
|
+
return VkRTSupportsInputAttachment::kYes == fVkRTSupportsInputAttachment;
|
|
110
|
+
}
|
|
111
|
+
bool vulkanSecondaryCBCompatible() const {
|
|
112
|
+
return VulkanSecondaryCBCompatible::kYes == fVulkanSecondaryCBCompatible;
|
|
113
|
+
}
|
|
114
|
+
GrProtected isProtected() const { return fIsProtected; }
|
|
115
|
+
SkColorSpace* colorSpace() const { return fImageInfo.colorSpace(); }
|
|
116
|
+
sk_sp<SkColorSpace> refColorSpace() const { return fImageInfo.refColorSpace(); }
|
|
117
|
+
const SkSurfaceProps& surfaceProps()const { return fSurfaceProps; }
|
|
118
|
+
|
|
119
|
+
// Is the provided backend texture compatible with this surface characterization?
|
|
120
|
+
bool isCompatible(const GrBackendTexture&) const;
|
|
121
|
+
|
|
122
|
+
private:
|
|
123
|
+
friend class SkSurface_Ganesh; // for 'set' & 'config'
|
|
124
|
+
friend class GrVkSecondaryCBDrawContext; // for 'set' & 'config'
|
|
125
|
+
friend class GrContextThreadSafeProxy; // for private ctor
|
|
126
|
+
friend class GrDeferredDisplayListRecorder; // for 'config'
|
|
127
|
+
friend class SkSurface; // for 'config'
|
|
128
|
+
|
|
129
|
+
SkDEBUGCODE(void validate() const;)
|
|
130
|
+
|
|
131
|
+
GrSurfaceCharacterization(sk_sp<GrContextThreadSafeProxy> contextInfo,
|
|
132
|
+
size_t cacheMaxResourceBytes,
|
|
133
|
+
const SkImageInfo& ii,
|
|
134
|
+
const GrBackendFormat& backendFormat,
|
|
135
|
+
GrSurfaceOrigin origin,
|
|
136
|
+
int sampleCnt,
|
|
137
|
+
Textureable isTextureable,
|
|
138
|
+
MipMapped isMipMapped,
|
|
139
|
+
UsesGLFBO0 usesGLFBO0,
|
|
140
|
+
VkRTSupportsInputAttachment vkRTSupportsInputAttachment,
|
|
141
|
+
VulkanSecondaryCBCompatible vulkanSecondaryCBCompatible,
|
|
142
|
+
GrProtected isProtected,
|
|
143
|
+
const SkSurfaceProps& surfaceProps)
|
|
144
|
+
: fContextInfo(std::move(contextInfo))
|
|
145
|
+
, fCacheMaxResourceBytes(cacheMaxResourceBytes)
|
|
146
|
+
, fImageInfo(ii)
|
|
147
|
+
, fBackendFormat(backendFormat)
|
|
148
|
+
, fOrigin(origin)
|
|
149
|
+
, fSampleCnt(sampleCnt)
|
|
150
|
+
, fIsTextureable(isTextureable)
|
|
151
|
+
, fIsMipMapped(isMipMapped)
|
|
152
|
+
, fUsesGLFBO0(usesGLFBO0)
|
|
153
|
+
, fVkRTSupportsInputAttachment(vkRTSupportsInputAttachment)
|
|
154
|
+
, fVulkanSecondaryCBCompatible(vulkanSecondaryCBCompatible)
|
|
155
|
+
, fIsProtected(isProtected)
|
|
156
|
+
, fSurfaceProps(surfaceProps) {
|
|
157
|
+
if (fSurfaceProps.flags() & SkSurfaceProps::kDynamicMSAA_Flag) {
|
|
158
|
+
// Dynamic MSAA is not currently supported with DDL.
|
|
159
|
+
*this = {};
|
|
160
|
+
}
|
|
161
|
+
SkDEBUGCODE(this->validate());
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
void set(sk_sp<GrContextThreadSafeProxy> contextInfo,
|
|
165
|
+
size_t cacheMaxResourceBytes,
|
|
166
|
+
const SkImageInfo& ii,
|
|
167
|
+
const GrBackendFormat& backendFormat,
|
|
168
|
+
GrSurfaceOrigin origin,
|
|
169
|
+
int sampleCnt,
|
|
170
|
+
Textureable isTextureable,
|
|
171
|
+
MipMapped isMipMapped,
|
|
172
|
+
UsesGLFBO0 usesGLFBO0,
|
|
173
|
+
VkRTSupportsInputAttachment vkRTSupportsInputAttachment,
|
|
174
|
+
VulkanSecondaryCBCompatible vulkanSecondaryCBCompatible,
|
|
175
|
+
GrProtected isProtected,
|
|
176
|
+
const SkSurfaceProps& surfaceProps) {
|
|
177
|
+
if (surfaceProps.flags() & SkSurfaceProps::kDynamicMSAA_Flag) {
|
|
178
|
+
// Dynamic MSAA is not currently supported with DDL.
|
|
179
|
+
*this = {};
|
|
180
|
+
} else {
|
|
181
|
+
fContextInfo = contextInfo;
|
|
182
|
+
fCacheMaxResourceBytes = cacheMaxResourceBytes;
|
|
183
|
+
|
|
184
|
+
fImageInfo = ii;
|
|
185
|
+
fBackendFormat = backendFormat;
|
|
186
|
+
fOrigin = origin;
|
|
187
|
+
fSampleCnt = sampleCnt;
|
|
188
|
+
fIsTextureable = isTextureable;
|
|
189
|
+
fIsMipMapped = isMipMapped;
|
|
190
|
+
fUsesGLFBO0 = usesGLFBO0;
|
|
191
|
+
fVkRTSupportsInputAttachment = vkRTSupportsInputAttachment;
|
|
192
|
+
fVulkanSecondaryCBCompatible = vulkanSecondaryCBCompatible;
|
|
193
|
+
fIsProtected = isProtected;
|
|
194
|
+
fSurfaceProps = surfaceProps;
|
|
195
|
+
}
|
|
196
|
+
SkDEBUGCODE(this->validate());
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
sk_sp<GrContextThreadSafeProxy> fContextInfo;
|
|
200
|
+
size_t fCacheMaxResourceBytes;
|
|
201
|
+
|
|
202
|
+
SkImageInfo fImageInfo;
|
|
203
|
+
GrBackendFormat fBackendFormat;
|
|
204
|
+
GrSurfaceOrigin fOrigin;
|
|
205
|
+
int fSampleCnt;
|
|
206
|
+
Textureable fIsTextureable;
|
|
207
|
+
MipMapped fIsMipMapped;
|
|
208
|
+
UsesGLFBO0 fUsesGLFBO0;
|
|
209
|
+
VkRTSupportsInputAttachment fVkRTSupportsInputAttachment;
|
|
210
|
+
VulkanSecondaryCBCompatible fVulkanSecondaryCBCompatible;
|
|
211
|
+
GrProtected fIsProtected;
|
|
212
|
+
SkSurfaceProps fSurfaceProps;
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
#endif
|
|
@@ -15,15 +15,15 @@
|
|
|
15
15
|
#include <memory>
|
|
16
16
|
|
|
17
17
|
class GrBackendSemaphore;
|
|
18
|
+
class GrDeferredDisplayList;
|
|
18
19
|
class GrRecordingContext;
|
|
20
|
+
class GrSurfaceCharacterization;
|
|
19
21
|
struct GrVkDrawableInfo;
|
|
20
22
|
namespace skgpu::ganesh {
|
|
21
23
|
class Device;
|
|
22
24
|
}
|
|
23
25
|
class SkCanvas;
|
|
24
|
-
class SkDeferredDisplayList;
|
|
25
26
|
struct SkImageInfo;
|
|
26
|
-
class SkSurfaceCharacterization;
|
|
27
27
|
class SkSurfaceProps;
|
|
28
28
|
|
|
29
29
|
/**
|
|
@@ -107,15 +107,15 @@ public:
|
|
|
107
107
|
const SkSurfaceProps& props() const { return fProps; }
|
|
108
108
|
|
|
109
109
|
// TODO: Fill out these calls to support DDL
|
|
110
|
-
bool characterize(
|
|
110
|
+
bool characterize(GrSurfaceCharacterization* characterization) const;
|
|
111
111
|
|
|
112
112
|
#ifndef SK_DDL_IS_UNIQUE_POINTER
|
|
113
|
-
bool draw(sk_sp<const
|
|
113
|
+
bool draw(sk_sp<const GrDeferredDisplayList> deferredDisplayList);
|
|
114
114
|
#else
|
|
115
|
-
bool draw(const
|
|
115
|
+
bool draw(const GrDeferredDisplayList* deferredDisplayList);
|
|
116
116
|
#endif
|
|
117
117
|
|
|
118
|
-
bool isCompatible(const
|
|
118
|
+
bool isCompatible(const GrSurfaceCharacterization& characterization) const;
|
|
119
119
|
|
|
120
120
|
private:
|
|
121
121
|
explicit GrVkSecondaryCBDrawContext(sk_sp<skgpu::ganesh::Device>, const SkSurfaceProps*);
|
|
@@ -0,0 +1,104 @@
|
|
|
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 SkImageChromium_DEFINED
|
|
9
|
+
#define SkImageChromium_DEFINED
|
|
10
|
+
|
|
11
|
+
#include "include/core/SkRefCnt.h"
|
|
12
|
+
#include "include/gpu/GrTypes.h"
|
|
13
|
+
#include "include/private/base/SkAPI.h"
|
|
14
|
+
|
|
15
|
+
class GrBackendFormat;
|
|
16
|
+
class GrContextThreadSafeProxy;
|
|
17
|
+
class GrPromiseImageTexture;
|
|
18
|
+
class GrYUVABackendTextureInfo;
|
|
19
|
+
class SkColorSpace;
|
|
20
|
+
class SkImage;
|
|
21
|
+
enum SkAlphaType : int;
|
|
22
|
+
enum SkColorType : int;
|
|
23
|
+
struct SkISize;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* These functions expose features that are only for external use in Chromium.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
namespace SkImages {
|
|
30
|
+
|
|
31
|
+
using PromiseImageTextureContext = void*;
|
|
32
|
+
using PromiseImageTextureFulfillProc = sk_sp<GrPromiseImageTexture> (*)(PromiseImageTextureContext);
|
|
33
|
+
using PromiseImageTextureReleaseProc = void (*)(PromiseImageTextureContext);
|
|
34
|
+
|
|
35
|
+
/** Create a new GPU-backed SkImage that is very similar to an SkImage created by BorrowTextureFrom.
|
|
36
|
+
The difference is that the caller need not have created the texture nor populated it with the
|
|
37
|
+
image pixel data. Moreover, the SkImage may be created on a thread as the creation of the
|
|
38
|
+
image does not require access to the backend API or GrDirectContext. Instead of passing a
|
|
39
|
+
GrBackendTexture the client supplies a description of the texture consisting of
|
|
40
|
+
GrBackendFormat, width, height, and GrMipmapped state. The resulting SkImage can be drawn
|
|
41
|
+
to a GrDeferredDisplayListRecorder or directly to a GPU-backed SkSurface.
|
|
42
|
+
When the actual texture is required to perform a backend API draw, textureFulfillProc will
|
|
43
|
+
be called to receive a GrBackendTexture. The properties of the GrBackendTexture must match
|
|
44
|
+
those set during the SkImage creation, and it must refer to a valid existing texture in the
|
|
45
|
+
backend API context/device, and be populated with the image pixel data. The texture cannot
|
|
46
|
+
be deleted until textureReleaseProc is called.
|
|
47
|
+
There is at most one call to each of textureFulfillProc and textureReleaseProc.
|
|
48
|
+
textureReleaseProc is always called even if image creation fails or if the
|
|
49
|
+
image is never fulfilled (e.g. it is never drawn or all draws are clipped out)
|
|
50
|
+
@param gpuContextProxy the thread-safe proxy of the gpu context. required.
|
|
51
|
+
@param backendFormat format of promised gpu texture
|
|
52
|
+
@param dimensions width & height of promised gpu texture
|
|
53
|
+
@param mipmapped mip mapped state of promised gpu texture
|
|
54
|
+
@param origin surface origin of promised gpu texture
|
|
55
|
+
@param colorType color type of promised gpu texture
|
|
56
|
+
@param alphaType alpha type of promised gpu texture
|
|
57
|
+
@param colorSpace range of colors; may be nullptr
|
|
58
|
+
@param textureFulfillProc function called to get actual gpu texture
|
|
59
|
+
@param textureReleaseProc function called when texture can be deleted
|
|
60
|
+
@param textureContext state passed to textureFulfillProc and textureReleaseProc
|
|
61
|
+
@return created SkImage, or nullptr
|
|
62
|
+
*/
|
|
63
|
+
SK_API sk_sp<SkImage> PromiseTextureFrom(sk_sp<GrContextThreadSafeProxy> gpuContextProxy,
|
|
64
|
+
const GrBackendFormat& backendFormat,
|
|
65
|
+
SkISize dimensions,
|
|
66
|
+
GrMipmapped mipmapped,
|
|
67
|
+
GrSurfaceOrigin origin,
|
|
68
|
+
SkColorType colorType,
|
|
69
|
+
SkAlphaType alphaType,
|
|
70
|
+
sk_sp<SkColorSpace> colorSpace,
|
|
71
|
+
PromiseImageTextureFulfillProc textureFulfillProc,
|
|
72
|
+
PromiseImageTextureReleaseProc textureReleaseProc,
|
|
73
|
+
PromiseImageTextureContext textureContext);
|
|
74
|
+
|
|
75
|
+
/** This is similar to 'PromiseTextureFrom' but it creates a GPU-backed SkImage from YUV[A] data.
|
|
76
|
+
The source data may be planar (i.e. spread across multiple textures). In
|
|
77
|
+
the extreme Y, U, V, and A are all in different planes and thus the image is specified by
|
|
78
|
+
four textures. 'backendTextureInfo' describes the planar arrangement, texture formats,
|
|
79
|
+
conversion to RGB, and origin of the textures. Separate 'textureFulfillProc' and
|
|
80
|
+
'textureReleaseProc' calls are made for each texture. Each texture has its own
|
|
81
|
+
PromiseImageTextureContext. If 'backendTextureInfo' is not valid then no release proc
|
|
82
|
+
calls are made. Otherwise, the calls will be made even on failure. 'textureContexts' has one
|
|
83
|
+
entry for each of the up to four textures, as indicated by 'backendTextureInfo'.
|
|
84
|
+
Currently the mip mapped property of 'backendTextureInfo' is ignored. However, in the
|
|
85
|
+
near future it will be required that if it is kYes then textureFulfillProc must return
|
|
86
|
+
a mip mapped texture for each plane in order to successfully draw the image.
|
|
87
|
+
@param gpuContextProxy the thread-safe proxy of the gpu context. required.
|
|
88
|
+
@param backendTextureInfo info about the promised yuva gpu texture
|
|
89
|
+
@param imageColorSpace range of colors; may be nullptr
|
|
90
|
+
@param textureFulfillProc function called to get actual gpu texture
|
|
91
|
+
@param textureReleaseProc function called when texture can be deleted
|
|
92
|
+
@param textureContexts state passed to textureFulfillProc and textureReleaseProc
|
|
93
|
+
@return created SkImage, or nullptr
|
|
94
|
+
*/
|
|
95
|
+
SK_API sk_sp<SkImage> PromiseTextureFromYUVA(sk_sp<GrContextThreadSafeProxy> gpuContextProxy,
|
|
96
|
+
const GrYUVABackendTextureInfo& backendTextureInfo,
|
|
97
|
+
sk_sp<SkColorSpace> imageColorSpace,
|
|
98
|
+
PromiseImageTextureFulfillProc textureFulfillProc,
|
|
99
|
+
PromiseImageTextureReleaseProc textureReleaseProc,
|
|
100
|
+
PromiseImageTextureContext textureContexts[]);
|
|
101
|
+
|
|
102
|
+
} // namespace SkImages
|
|
103
|
+
|
|
104
|
+
#endif
|