@shopify/react-native-skia 0.1.196 → 0.1.199

Sign up to get free protection for your applications and to get access to all the features.
Files changed (221) hide show
  1. package/android/CMakeLists.txt +32 -31
  2. package/android/cpp/rnskia-android/SkiaOpenGLRenderer.cpp +4 -2
  3. package/android/cpp/rnskia-android/SkiaOpenGLRenderer.h +3 -0
  4. package/cpp/api/JsiSkImage.h +1 -1
  5. package/cpp/api/JsiSkShaderFactory.h +4 -4
  6. package/cpp/api/JsiSkSurface.h +0 -1
  7. package/cpp/api/JsiSkSurfaceFactory.h +2 -1
  8. package/cpp/rnskia/RNSkView.h +20 -40
  9. package/cpp/rnskia/dom/nodes/JsiShaderNodes.h +2 -2
  10. package/cpp/rnskia/values/RNSkReadonlyValue.h +6 -7
  11. package/cpp/skia/include/android/SkCanvasAndroid.h +20 -0
  12. package/cpp/skia/include/android/SkHeifDecoder.h +43 -0
  13. package/cpp/skia/include/android/SkSurfaceAndroid.h +50 -0
  14. package/cpp/skia/include/codec/SkAvifDecoder.h +43 -0
  15. package/cpp/skia/include/codec/SkBmpDecoder.h +43 -0
  16. package/cpp/skia/include/codec/SkCodec.h +25 -1
  17. package/cpp/skia/include/codec/SkGifDecoder.h +43 -0
  18. package/cpp/skia/include/codec/SkIcoDecoder.h +43 -0
  19. package/cpp/skia/include/codec/SkJpegDecoder.h +43 -0
  20. package/cpp/skia/include/codec/SkJpegxlDecoder.h +43 -0
  21. package/cpp/skia/include/codec/SkPngDecoder.h +43 -0
  22. package/cpp/skia/include/codec/SkRawDecoder.h +49 -0
  23. package/cpp/skia/include/codec/SkWbmpDecoder.h +43 -0
  24. package/cpp/skia/include/codec/SkWebpDecoder.h +43 -0
  25. package/cpp/skia/include/core/SkBBHFactory.h +5 -1
  26. package/cpp/skia/include/core/SkBlender.h +0 -2
  27. package/cpp/skia/include/core/SkCanvas.h +4 -23
  28. package/cpp/skia/include/core/SkColorFilter.h +14 -1
  29. package/cpp/skia/include/core/SkColorTable.h +59 -0
  30. package/cpp/skia/include/core/SkContourMeasure.h +3 -0
  31. package/cpp/skia/include/core/SkDeferredDisplayList.h +8 -104
  32. package/cpp/skia/include/core/SkDeferredDisplayListRecorder.h +8 -91
  33. package/cpp/skia/include/core/SkDrawable.h +5 -2
  34. package/cpp/skia/include/core/SkGraphics.h +7 -19
  35. package/cpp/skia/include/core/SkImage.h +157 -249
  36. package/cpp/skia/include/core/SkImageGenerator.h +0 -31
  37. package/cpp/skia/include/core/SkMilestone.h +1 -1
  38. package/cpp/skia/include/core/SkPathMeasure.h +3 -3
  39. package/cpp/skia/include/core/SkPictureRecorder.h +1 -1
  40. package/cpp/skia/include/core/SkPoint.h +5 -563
  41. package/cpp/skia/include/core/SkPoint3.h +1 -0
  42. package/cpp/skia/include/core/SkPromiseImageTexture.h +4 -30
  43. package/cpp/skia/include/core/SkRect.h +8 -8
  44. package/cpp/skia/include/core/SkSamplingOptions.h +4 -2
  45. package/cpp/skia/include/core/SkScalar.h +1 -1
  46. package/cpp/skia/include/core/SkSerialProcs.h +5 -1
  47. package/cpp/skia/include/core/SkShader.h +14 -21
  48. package/cpp/skia/include/core/SkString.h +2 -0
  49. package/cpp/skia/include/core/SkSurface.h +169 -701
  50. package/cpp/skia/include/core/SkSurfaceCharacterization.h +8 -256
  51. package/cpp/skia/include/core/SkTiledImageUtils.h +97 -0
  52. package/cpp/skia/include/core/SkTypes.h +4 -2
  53. package/cpp/skia/include/core/SkYUVAPixmaps.h +0 -5
  54. package/cpp/skia/include/effects/SkGradientShader.h +10 -1
  55. package/cpp/skia/include/effects/SkImageFilters.h +62 -37
  56. package/cpp/skia/include/effects/SkPerlinNoiseShader.h +28 -29
  57. package/cpp/skia/include/effects/SkRuntimeEffect.h +17 -12
  58. package/cpp/skia/include/gpu/GrBackendSurface.h +12 -39
  59. package/cpp/skia/include/gpu/GrBackendSurfaceMutableState.h +6 -0
  60. package/cpp/skia/include/gpu/GrContextThreadSafeProxy.h +3 -3
  61. package/cpp/skia/include/gpu/GrDirectContext.h +103 -3
  62. package/cpp/skia/include/gpu/GrRecordingContext.h +10 -19
  63. package/cpp/skia/include/gpu/MutableTextureState.h +4 -0
  64. package/cpp/skia/include/gpu/ganesh/GrExternalTextureGenerator.h +54 -0
  65. package/cpp/skia/include/gpu/ganesh/SkImageGanesh.h +20 -76
  66. package/cpp/skia/include/gpu/ganesh/SkSurfaceGanesh.h +217 -0
  67. package/cpp/skia/include/gpu/ganesh/mtl/SkSurfaceMetal.h +73 -0
  68. package/cpp/skia/include/gpu/gl/GrGLTypes.h +13 -2
  69. package/cpp/skia/include/gpu/graphite/BackendSemaphore.h +78 -0
  70. package/cpp/skia/include/gpu/graphite/BackendTexture.h +1 -0
  71. package/cpp/skia/include/gpu/graphite/Image.h +277 -0
  72. package/cpp/skia/include/gpu/graphite/ImageProvider.h +1 -1
  73. package/cpp/skia/include/gpu/graphite/Recording.h +1 -4
  74. package/cpp/skia/include/gpu/graphite/Surface.h +81 -0
  75. package/cpp/skia/include/gpu/graphite/TextureInfo.h +5 -7
  76. package/cpp/skia/include/gpu/graphite/YUVABackendTextures.h +2 -2
  77. package/cpp/skia/include/gpu/mock/GrMockTypes.h +23 -8
  78. package/cpp/skia/include/ports/SkTypeface_fontations.h +21 -0
  79. package/cpp/skia/include/private/SkGainmapInfo.h +2 -0
  80. package/cpp/skia/include/private/SkGainmapShader.h +1 -0
  81. package/cpp/skia/include/private/SkJpegMetadataDecoder.h +19 -1
  82. package/cpp/skia/include/private/SkPathRef.h +13 -15
  83. package/cpp/skia/include/private/SkXmp.h +53 -0
  84. package/cpp/skia/include/private/base/SkFeatures.h +0 -4
  85. package/cpp/skia/include/private/base/SkFloatingPoint.h +11 -5
  86. package/cpp/skia/include/private/base/SkPoint_impl.h +569 -0
  87. package/cpp/skia/include/private/base/SkSpan_impl.h +3 -7
  88. package/cpp/skia/include/private/base/SkTArray.h +11 -11
  89. package/cpp/skia/include/private/chromium/GrDeferredDisplayList.h +120 -0
  90. package/cpp/skia/include/private/chromium/GrDeferredDisplayListRecorder.h +98 -0
  91. package/cpp/skia/include/private/chromium/GrPromiseImageTexture.h +43 -0
  92. package/cpp/skia/include/private/chromium/GrSurfaceCharacterization.h +215 -0
  93. package/cpp/skia/include/private/chromium/GrVkSecondaryCBDrawContext.h +6 -6
  94. package/cpp/skia/include/private/chromium/SkImageChromium.h +104 -0
  95. package/cpp/skia/include/private/chromium/Slug.h +7 -3
  96. package/cpp/skia/include/private/gpu/ganesh/GrContext_Base.h +7 -3
  97. package/cpp/skia/include/private/gpu/ganesh/GrGLTypesPriv.h +2 -0
  98. package/cpp/skia/include/private/gpu/ganesh/GrImageContext.h +3 -2
  99. package/cpp/skia/include/private/gpu/ganesh/GrMtlTypesPriv.h +10 -2
  100. package/cpp/skia/include/{gpu → private/gpu}/ganesh/GrTextureGenerator.h +2 -13
  101. package/cpp/skia/include/private/gpu/ganesh/GrTypesPriv.h +1 -1
  102. package/cpp/skia/include/private/gpu/graphite/DawnTypesPriv.h +7 -0
  103. package/cpp/skia/include/private/gpu/graphite/MtlGraphiteTypesPriv.h +19 -6
  104. package/cpp/skia/include/private/gpu/graphite/VulkanGraphiteTypesPriv.h +13 -0
  105. package/cpp/skia/include/third_party/vulkan/vulkan/vulkan.h +0 -1
  106. package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_android.h +14 -1
  107. package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_core.h +999 -79
  108. package/cpp/skia/modules/skcms/src/Transform_inl.h +36 -236
  109. package/cpp/skia/modules/skparagraph/include/Paragraph.h +2 -0
  110. package/cpp/skia/modules/skparagraph/include/ParagraphBuilder.h +16 -0
  111. package/cpp/skia/modules/skparagraph/include/TextStyle.h +6 -2
  112. package/cpp/skia/modules/skresources/include/SkResources.h +1 -1
  113. package/cpp/skia/modules/svg/include/SkSVGCircle.h +1 -1
  114. package/cpp/skia/modules/svg/include/SkSVGClipPath.h +1 -1
  115. package/cpp/skia/modules/svg/include/SkSVGContainer.h +1 -1
  116. package/cpp/skia/modules/svg/include/SkSVGDOM.h +1 -1
  117. package/cpp/skia/modules/svg/include/SkSVGDefs.h +1 -1
  118. package/cpp/skia/modules/svg/include/SkSVGEllipse.h +1 -1
  119. package/cpp/skia/modules/svg/include/SkSVGFe.h +1 -1
  120. package/cpp/skia/modules/svg/include/SkSVGFeBlend.h +1 -1
  121. package/cpp/skia/modules/svg/include/SkSVGFeColorMatrix.h +1 -1
  122. package/cpp/skia/modules/svg/include/SkSVGFeComposite.h +1 -1
  123. package/cpp/skia/modules/svg/include/SkSVGFeDisplacementMap.h +1 -1
  124. package/cpp/skia/modules/svg/include/SkSVGFeFlood.h +1 -1
  125. package/cpp/skia/modules/svg/include/SkSVGFeGaussianBlur.h +1 -1
  126. package/cpp/skia/modules/svg/include/SkSVGFeImage.h +1 -1
  127. package/cpp/skia/modules/svg/include/SkSVGFeLightSource.h +1 -1
  128. package/cpp/skia/modules/svg/include/SkSVGFeLighting.h +1 -1
  129. package/cpp/skia/modules/svg/include/SkSVGFeOffset.h +1 -1
  130. package/cpp/skia/modules/svg/include/SkSVGFeTurbulence.h +1 -1
  131. package/cpp/skia/modules/svg/include/SkSVGFilter.h +1 -1
  132. package/cpp/skia/modules/svg/include/SkSVGG.h +1 -1
  133. package/cpp/skia/modules/svg/include/SkSVGGradient.h +1 -1
  134. package/cpp/skia/modules/svg/include/SkSVGHiddenContainer.h +1 -1
  135. package/cpp/skia/modules/svg/include/SkSVGImage.h +1 -1
  136. package/cpp/skia/modules/svg/include/SkSVGLine.h +1 -1
  137. package/cpp/skia/modules/svg/include/SkSVGLinearGradient.h +1 -1
  138. package/cpp/skia/modules/svg/include/SkSVGMask.h +1 -1
  139. package/cpp/skia/modules/svg/include/SkSVGNode.h +1 -1
  140. package/cpp/skia/modules/svg/include/SkSVGPath.h +1 -1
  141. package/cpp/skia/modules/svg/include/SkSVGPattern.h +1 -1
  142. package/cpp/skia/modules/svg/include/SkSVGPoly.h +1 -1
  143. package/cpp/skia/modules/svg/include/SkSVGRadialGradient.h +1 -1
  144. package/cpp/skia/modules/svg/include/SkSVGRect.h +1 -1
  145. package/cpp/skia/modules/svg/include/SkSVGRenderContext.h +3 -3
  146. package/cpp/skia/modules/svg/include/SkSVGSVG.h +1 -1
  147. package/cpp/skia/modules/svg/include/SkSVGShape.h +1 -1
  148. package/cpp/skia/modules/svg/include/SkSVGStop.h +1 -1
  149. package/cpp/skia/modules/svg/include/SkSVGText.h +1 -1
  150. package/cpp/skia/modules/svg/include/SkSVGTransformableNode.h +1 -1
  151. package/cpp/skia/modules/svg/include/SkSVGTypes.h +21 -21
  152. package/cpp/skia/modules/svg/include/SkSVGUse.h +1 -1
  153. package/cpp/skia/modules/svg/include/SkSVGValue.h +2 -2
  154. package/cpp/skia/{include/private → src/core}/SkChecksum.h +32 -17
  155. package/cpp/skia/src/core/SkTHash.h +1 -1
  156. package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.mm +3 -1
  157. package/ios/RNSkia-iOS/SkiaMetalRenderer.mm +3 -1
  158. package/lib/commonjs/renderer/Canvas.js +24 -13
  159. package/lib/commonjs/renderer/Canvas.js.map +1 -1
  160. package/lib/commonjs/skia/core/Data.d.ts +2 -2
  161. package/lib/commonjs/skia/core/Data.js.map +1 -1
  162. package/lib/commonjs/skia/core/RRect.js +5 -1
  163. package/lib/commonjs/skia/core/RRect.js.map +1 -1
  164. package/lib/commonjs/skia/core/Rect.js +32 -6
  165. package/lib/commonjs/skia/core/Rect.js.map +1 -1
  166. package/lib/commonjs/skia/types/Color.js.map +1 -1
  167. package/lib/commonjs/skia/types/JsiInstance.d.ts +2 -4
  168. package/lib/commonjs/skia/types/JsiInstance.js.map +1 -1
  169. package/lib/module/renderer/Canvas.js +25 -14
  170. package/lib/module/renderer/Canvas.js.map +1 -1
  171. package/lib/module/skia/core/Data.d.ts +2 -2
  172. package/lib/module/skia/core/Data.js.map +1 -1
  173. package/lib/module/skia/core/RRect.js +5 -1
  174. package/lib/module/skia/core/RRect.js.map +1 -1
  175. package/lib/module/skia/core/Rect.js +32 -6
  176. package/lib/module/skia/core/Rect.js.map +1 -1
  177. package/lib/module/skia/types/Color.js.map +1 -1
  178. package/lib/module/skia/types/JsiInstance.d.ts +2 -4
  179. package/lib/module/skia/types/JsiInstance.js.map +1 -1
  180. package/lib/typescript/src/skia/core/Data.d.ts +2 -2
  181. package/lib/typescript/src/skia/types/JsiInstance.d.ts +2 -4
  182. package/libs/android/arm64-v8a/libskia.a +0 -0
  183. package/libs/android/arm64-v8a/libskottie.a +0 -0
  184. package/libs/android/arm64-v8a/libsksg.a +0 -0
  185. package/libs/android/arm64-v8a/libsvg.a +0 -0
  186. package/libs/android/armeabi-v7a/libskia.a +0 -0
  187. package/libs/android/armeabi-v7a/libskottie.a +0 -0
  188. package/libs/android/armeabi-v7a/libsksg.a +0 -0
  189. package/libs/android/armeabi-v7a/libsvg.a +0 -0
  190. package/libs/android/x86/libskia.a +0 -0
  191. package/libs/android/x86/libskottie.a +0 -0
  192. package/libs/android/x86/libsksg.a +0 -0
  193. package/libs/android/x86/libsvg.a +0 -0
  194. package/libs/android/x86_64/libskia.a +0 -0
  195. package/libs/android/x86_64/libskottie.a +0 -0
  196. package/libs/android/x86_64/libsksg.a +0 -0
  197. package/libs/android/x86_64/libsvg.a +0 -0
  198. package/libs/ios/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
  199. package/libs/ios/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
  200. package/libs/ios/libskottie.xcframework/ios-arm64_arm64e/libskottie.a +0 -0
  201. package/libs/ios/libskottie.xcframework/ios-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
  202. package/libs/ios/libsksg.xcframework/Info.plist +5 -5
  203. package/libs/ios/libsksg.xcframework/ios-arm64_arm64e/libsksg.a +0 -0
  204. package/libs/ios/libsksg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
  205. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
  206. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
  207. package/libs/ios/libsvg.xcframework/Info.plist +5 -5
  208. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
  209. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
  210. package/package.json +3 -4
  211. package/src/renderer/Canvas.tsx +25 -19
  212. package/src/skia/core/Data.ts +3 -3
  213. package/src/skia/core/RRect.tsx +4 -2
  214. package/src/skia/core/Rect.ts +29 -12
  215. package/src/skia/types/Color.ts +1 -1
  216. package/src/skia/types/JsiInstance.ts +2 -5
  217. package/cpp/skia/include/effects/SkTableColorFilter.h +0 -29
  218. package/cpp/skia/include/private/SkOpts_spi.h +0 -23
  219. package/cpp/skia/include/private/SkSpinlock.h +0 -57
  220. package/cpp/skia/include/private/chromium/GrSlug.h +0 -16
  221. package/scripts/install-npm.js +0 -33
@@ -8,11 +8,12 @@
8
8
  #ifndef SkRuntimeEffect_DEFINED
9
9
  #define SkRuntimeEffect_DEFINED
10
10
 
11
- #include "include/core/SkBlender.h"
12
- #include "include/core/SkColorFilter.h"
11
+ #include "include/core/SkBlender.h" // IWYU pragma: keep
12
+ #include "include/core/SkColorFilter.h" // IWYU pragma: keep
13
13
  #include "include/core/SkData.h"
14
- #include "include/core/SkImageInfo.h"
14
+ #include "include/core/SkFlattenable.h"
15
15
  #include "include/core/SkMatrix.h"
16
+ #include "include/core/SkRefCnt.h"
16
17
  #include "include/core/SkShader.h"
17
18
  #include "include/core/SkSpan.h"
18
19
  #include "include/core/SkString.h"
@@ -20,34 +21,38 @@
20
21
  #include "include/private/SkSLSampleUsage.h"
21
22
  #include "include/private/base/SkOnce.h"
22
23
  #include "include/private/base/SkTemplates.h"
24
+ #include "include/private/base/SkTo.h"
25
+ #include "include/private/base/SkTypeTraits.h"
23
26
 
24
- #include <string>
27
+ #include <cstddef>
28
+ #include <cstdint>
29
+ #include <cstring>
30
+ #include <memory>
25
31
  #include <optional>
32
+ #include <string>
33
+ #include <string_view>
34
+ #include <utility>
26
35
  #include <vector>
27
36
 
28
37
  #ifdef SK_ENABLE_SKSL
29
38
 
39
+ #include "include/sksl/SkSLDebugTrace.h"
30
40
  #include "include/sksl/SkSLVersion.h"
31
41
 
32
42
  class GrRecordingContext;
33
43
  class SkFilterColorProgram;
34
44
  class SkImage;
35
- class SkRuntimeImageFilter;
45
+ struct SkIPoint;
46
+ struct SkImageInfo;
36
47
 
37
48
  namespace SkSL {
38
- class DebugTrace;
39
49
  class DebugTracePriv;
40
- class ErrorReporter;
41
50
  class FunctionDefinition;
42
51
  struct Program;
43
52
  enum class ProgramKind : int8_t;
44
53
  struct ProgramSettings;
45
54
  } // namespace SkSL
46
55
 
47
- namespace skvm {
48
- class Program;
49
- }
50
-
51
56
  namespace SkSL::RP {
52
57
  class Program;
53
58
  }
@@ -319,7 +324,7 @@ private:
319
324
  friend class GrGLSLSkSLFP; //
320
325
  #endif
321
326
 
322
- friend class SkRTShader; // fBaseProgram, fMain, fSampleUsages, getRPProgram()
327
+ friend class SkRuntimeShader; // fBaseProgram, fMain, fSampleUsages, getRPProgram()
323
328
  friend class SkRuntimeBlender; //
324
329
  friend class SkRuntimeColorFilter; //
325
330
 
@@ -8,36 +8,38 @@
8
8
  #ifndef GrBackendSurface_DEFINED
9
9
  #define GrBackendSurface_DEFINED
10
10
 
11
- // This include of GrBackendSurfaceMutableState is not needed here, but some clients were depending
12
- // on the include here instead of including it themselves. Adding this back here until we can fix
13
- // up clients so it can be removed.
14
- #include "include/gpu/GrBackendSurfaceMutableState.h"
15
-
16
- #include "include/gpu/GrSurfaceInfo.h"
11
+ #include "include/core/SkRefCnt.h"
12
+ #include "include/core/SkSize.h"
13
+ #include "include/gpu/GpuTypes.h"
17
14
  #include "include/gpu/GrTypes.h"
18
- #include "include/gpu/MutableTextureState.h"
15
+ #include "include/private/base/SkAPI.h"
16
+ #include "include/private/gpu/ganesh/GrTypesPriv.h"
17
+
19
18
  #ifdef SK_GL
20
19
  #include "include/gpu/gl/GrGLTypes.h"
21
20
  #include "include/private/gpu/ganesh/GrGLTypesPriv.h"
22
21
  #endif
22
+
23
23
  #include "include/gpu/mock/GrMockTypes.h"
24
+
24
25
  #ifdef SK_VULKAN
25
26
  #include "include/gpu/vk/GrVkTypes.h"
26
27
  #include "include/private/gpu/ganesh/GrVkTypesPriv.h"
28
+ #include "include/private/gpu/vk/SkiaVulkan.h"
27
29
  #endif
28
30
 
29
31
  #ifdef SK_DAWN
30
32
  #include "include/gpu/dawn/GrDawnTypes.h"
31
33
  #endif
32
34
 
35
+ #include <cstdint>
33
36
  #include <string>
37
+ #include <string_view>
34
38
 
35
- class GrVkImageLayout;
36
- class GrGLTextureParameters;
37
- class GrColorFormatDesc;
38
39
  enum class SkTextureCompressionType;
39
40
 
40
41
  namespace skgpu {
42
+ class MutableTextureState;
41
43
  class MutableTextureStateRef;
42
44
  }
43
45
 
@@ -58,33 +60,6 @@ class GrD3DResourceState;
58
60
  class SkString;
59
61
  #endif
60
62
 
61
- #if !defined(SK_GANESH)
62
-
63
- // SkSurfaceCharacterization always needs a minimal version of this
64
- class SK_API GrBackendFormat {
65
- public:
66
- bool isValid() const { return false; }
67
- };
68
-
69
- // SkSurface and SkImage rely on a minimal version of these always being available
70
- class SK_API GrBackendTexture {
71
- public:
72
- GrBackendTexture() {}
73
-
74
- bool isValid() const { return false; }
75
- };
76
-
77
- class SK_API GrBackendRenderTarget {
78
- public:
79
- GrBackendRenderTarget() {}
80
-
81
- bool isValid() const { return false; }
82
- bool isFramebufferOnly() const { return false; }
83
- };
84
- #else
85
-
86
- enum class GrGLFormat;
87
-
88
63
  class SK_API GrBackendFormat {
89
64
  public:
90
65
  // Creates an invalid backend format.
@@ -663,5 +638,3 @@ private:
663
638
  };
664
639
 
665
640
  #endif
666
-
667
- #endif
@@ -10,6 +10,12 @@
10
10
 
11
11
  #include "include/gpu/MutableTextureState.h"
12
12
 
13
+ #ifdef SK_VULKAN
14
+ #include "include/private/gpu/vk/SkiaVulkan.h"
15
+
16
+ #include <cstdint>
17
+ #endif
18
+
13
19
  class GrBackendSurfaceMutableState : public skgpu::MutableTextureState {
14
20
  public:
15
21
  GrBackendSurfaceMutableState() = default;
@@ -22,9 +22,9 @@
22
22
  class GrBackendFormat;
23
23
  class GrCaps;
24
24
  class GrContextThreadSafeProxyPriv;
25
+ class GrSurfaceCharacterization;
25
26
  class GrThreadSafeCache;
26
27
  class GrThreadSafePipelineBuilder;
27
- class SkSurfaceCharacterization;
28
28
  class SkSurfaceProps;
29
29
  enum class SkTextureCompressionType;
30
30
 
@@ -85,7 +85,7 @@ public:
85
85
  * willUseGLFBO0 = false
86
86
  * vkRTSupportsInputAttachment = false
87
87
  */
88
- SkSurfaceCharacterization createCharacterization(
88
+ GrSurfaceCharacterization createCharacterization(
89
89
  size_t cacheMaxResourceBytes,
90
90
  const SkImageInfo& ii,
91
91
  const GrBackendFormat& backendFormat,
@@ -102,7 +102,7 @@ public:
102
102
  /*
103
103
  * Retrieve the default GrBackendFormat for a given SkColorType and renderability.
104
104
  * It is guaranteed that this backend format will be the one used by the following
105
- * SkColorType and SkSurfaceCharacterization-based createBackendTexture methods.
105
+ * SkColorType and GrSurfaceCharacterization-based createBackendTexture methods.
106
106
  *
107
107
  * The caller should check that the returned format is valid.
108
108
  */
@@ -36,6 +36,7 @@ class GrResourceProvider;
36
36
  class SkData;
37
37
  class SkImage;
38
38
  class SkPixmap;
39
+ class SkSurface;
39
40
  class SkTaskGroup;
40
41
  class SkTraceMemoryDump;
41
42
  enum SkColorType : int;
@@ -55,6 +56,10 @@ namespace skgpu {
55
56
  namespace sktext { namespace gpu { class StrikeCache; } }
56
57
  namespace wgpu { class Device; } // IWYU pragma: keep
57
58
 
59
+ namespace SkSurfaces {
60
+ enum class BackendSurfaceAccess;
61
+ }
62
+
58
63
  class SK_API GrDirectContext : public GrRecordingContext {
59
64
  public:
60
65
  #ifdef SK_GL
@@ -408,10 +413,105 @@ public:
408
413
  void flush(sk_sp<const SkImage> image);
409
414
 
410
415
  /** Version of flush() that uses a default GrFlushInfo. Also submits the flushed work to the
411
- GPU.
412
- */
416
+ * GPU.
417
+ */
413
418
  void flushAndSubmit(sk_sp<const SkImage> image);
414
419
 
420
+ /** Issues pending SkSurface commands to the GPU-backed API objects and resolves any SkSurface
421
+ * MSAA. A call to GrDirectContext::submit is always required to ensure work is actually sent
422
+ * to the gpu. Some specific API details:
423
+ * GL: Commands are actually sent to the driver, but glFlush is never called. Thus some
424
+ * sync objects from the flush will not be valid until a submission occurs.
425
+ *
426
+ * Vulkan/Metal/D3D/Dawn: Commands are recorded to the backend APIs corresponding command
427
+ * buffer or encoder objects. However, these objects are not sent to the gpu until a
428
+ * submission occurs.
429
+ *
430
+ * The work that is submitted to the GPU will be dependent on the BackendSurfaceAccess that is
431
+ * passed in.
432
+ *
433
+ * If BackendSurfaceAccess::kNoAccess is passed in all commands will be issued to the GPU.
434
+ *
435
+ * If BackendSurfaceAccess::kPresent is passed in and the backend API is not Vulkan, it is
436
+ * treated the same as kNoAccess. If the backend API is Vulkan, the VkImage that backs the
437
+ * SkSurface will be transferred back to its original queue. If the SkSurface was created by
438
+ * wrapping a VkImage, the queue will be set to the queue which was originally passed in on
439
+ * the GrVkImageInfo. Additionally, if the original queue was not external or foreign the
440
+ * layout of the VkImage will be set to VK_IMAGE_LAYOUT_PRESENT_SRC_KHR.
441
+ *
442
+ * The GrFlushInfo describes additional options to flush. Please see documentation at
443
+ * GrFlushInfo for more info.
444
+ *
445
+ * If the return is GrSemaphoresSubmitted::kYes, only initialized GrBackendSemaphores will be
446
+ * submitted to the gpu during the next submit call (it is possible Skia failed to create a
447
+ * subset of the semaphores). The client should not wait on these semaphores until after submit
448
+ * has been called, but must keep them alive until then. If a submit flag was passed in with
449
+ * the flush these valid semaphores can we waited on immediately. If this call returns
450
+ * GrSemaphoresSubmitted::kNo, the GPU backend will not submit any semaphores to be signaled on
451
+ * the GPU. Thus the client should not have the GPU wait on any of the semaphores passed in
452
+ * with the GrFlushInfo. Regardless of whether semaphores were submitted to the GPU or not, the
453
+ * client is still responsible for deleting any initialized semaphores.
454
+ * Regardless of semaphore submission the context will still be flushed. It should be
455
+ * emphasized that a return value of GrSemaphoresSubmitted::kNo does not mean the flush did not
456
+ * happen. It simply means there were no semaphores submitted to the GPU. A caller should only
457
+ * take this as a failure if they passed in semaphores to be submitted.
458
+ *
459
+ * Pending surface commands are flushed regardless of the return result.
460
+ *
461
+ * @param surface The GPU backed surface to be flushed. Has no effect on a CPU-backed surface.
462
+ * @param access type of access the call will do on the backend object after flush
463
+ * @param info flush options
464
+ */
465
+ GrSemaphoresSubmitted flush(sk_sp<SkSurface> surface,
466
+ SkSurfaces::BackendSurfaceAccess access,
467
+ const GrFlushInfo& info);
468
+ GrSemaphoresSubmitted flush(SkSurface* surface,
469
+ SkSurfaces::BackendSurfaceAccess access,
470
+ const GrFlushInfo& info);
471
+
472
+ /**
473
+ * Same as above except:
474
+ *
475
+ * If a skgpu::MutableTextureState is passed in, at the end of the flush we will transition
476
+ * the surface to be in the state requested by the skgpu::MutableTextureState. If the surface
477
+ * (or SkImage or GrBackendSurface wrapping the same backend object) is used again after this
478
+ * flush the state may be changed and no longer match what is requested here. This is often
479
+ * used if the surface will be used for presenting or external use and the client wants backend
480
+ * object to be prepped for that use. A finishedProc or semaphore on the GrFlushInfo will also
481
+ * include the work for any requested state change.
482
+ *
483
+ * If the backend API is Vulkan, the caller can set the skgpu::MutableTextureState's
484
+ * VkImageLayout to VK_IMAGE_LAYOUT_UNDEFINED or queueFamilyIndex to VK_QUEUE_FAMILY_IGNORED to
485
+ * tell Skia to not change those respective states.
486
+ *
487
+ * @param surface The GPU backed surface to be flushed. Has no effect on a CPU-backed surface.
488
+ * @param info flush options
489
+ * @param newState optional state change request after flush
490
+ */
491
+ GrSemaphoresSubmitted flush(sk_sp<SkSurface> surface,
492
+ const GrFlushInfo& info,
493
+ const skgpu::MutableTextureState* newState = nullptr);
494
+ GrSemaphoresSubmitted flush(SkSurface* surface,
495
+ const GrFlushInfo& info,
496
+ const skgpu::MutableTextureState* newState = nullptr);
497
+
498
+ /** Call to ensure all reads/writes of the surface have been issued to the underlying 3D API.
499
+ * Skia will correctly order its own draws and pixel operations. This must to be used to ensure
500
+ * correct ordering when the surface backing store is accessed outside Skia (e.g. direct use of
501
+ * the 3D API or a windowing system). This is equivalent to
502
+ * calling ::flush with a default GrFlushInfo followed by ::submit(syncCpu).
503
+ *
504
+ * Has no effect on a CPU-backed surface.
505
+ */
506
+ void flushAndSubmit(sk_sp<SkSurface> surface, bool syncCpu = false);
507
+
508
+ /**
509
+ * Flushes the given surface with the default GrFlushInfo.
510
+ *
511
+ * Has no effect on a CPU-backed surface.
512
+ */
513
+ void flush(sk_sp<SkSurface> surface);
514
+
415
515
  /**
416
516
  * Submit outstanding work to the gpu from all previously un-submitted flushes. The return
417
517
  * value of the submit will indicate whether or not the submission to the GPU was successful.
@@ -444,7 +544,7 @@ public:
444
544
  /**
445
545
  * Retrieve the default GrBackendFormat for a given SkColorType and renderability.
446
546
  * It is guaranteed that this backend format will be the one used by the following
447
- * SkColorType and SkSurfaceCharacterization-based createBackendTexture methods.
547
+ * SkColorType and GrSurfaceCharacterization-based createBackendTexture methods.
448
548
  *
449
549
  * The caller should check that the returned format is valid.
450
550
  */
@@ -8,26 +8,27 @@
8
8
  #ifndef GrRecordingContext_DEFINED
9
9
  #define GrRecordingContext_DEFINED
10
10
 
11
+ #include "include/core/SkColorType.h"
11
12
  #include "include/core/SkRefCnt.h"
13
+ #include "include/core/SkString.h" // IWYU pragma: keep
12
14
  #include "include/core/SkTypes.h"
13
15
  #include "include/private/base/SkTArray.h"
16
+ #include "include/private/gpu/ganesh/GrContext_Base.h"
14
17
  #include "include/private/gpu/ganesh/GrImageContext.h"
15
18
 
16
- #if GR_GPU_STATS && GR_TEST_UTILS
17
19
  #include <map>
20
+ #include <memory>
18
21
  #include <string>
19
- #endif
20
22
 
21
23
  class GrAuditTrail;
22
- class GrBackendFormat;
24
+ class GrContextThreadSafeProxy;
25
+ class GrDirectContext;
23
26
  class GrDrawingManager;
24
27
  class GrOnFlushCallbackObject;
25
- class GrMemoryPool;
26
28
  class GrProgramDesc;
27
29
  class GrProgramInfo;
28
30
  class GrProxyProvider;
29
31
  class GrRecordingContextPriv;
30
- class GrSurfaceProxy;
31
32
  class GrThreadSafeCache;
32
33
  class SkArenaAlloc;
33
34
  class SkCapabilities;
@@ -38,25 +39,17 @@ class SubRunAllocator;
38
39
  class TextBlobRedrawCoordinator;
39
40
  }
40
41
 
41
- #if GR_TEST_UTILS
42
- class SkString;
43
- #endif
44
-
45
42
  class GrRecordingContext : public GrImageContext {
46
43
  public:
47
44
  ~GrRecordingContext() override;
48
45
 
49
- SK_API GrBackendFormat defaultBackendFormat(SkColorType ct, GrRenderable renderable) const {
50
- return INHERITED::defaultBackendFormat(ct, renderable);
51
- }
52
-
53
46
  /**
54
47
  * Reports whether the GrDirectContext associated with this GrRecordingContext is abandoned.
55
48
  * When called on a GrDirectContext it may actively check whether the underlying 3D API
56
49
  * device/context has been disconnected before reporting the status. If so, calling this
57
50
  * method will transition the GrDirectContext to the abandoned state.
58
51
  */
59
- bool abandoned() override { return INHERITED::abandoned(); }
52
+ bool abandoned() override { return GrImageContext::abandoned(); }
60
53
 
61
54
  /*
62
55
  * Can a SkSurface be created with the given color type. To check whether MSAA is supported
@@ -96,7 +89,7 @@ public:
96
89
  * is not supported at all.
97
90
  */
98
91
  SK_API int maxSurfaceSampleCountForColorType(SkColorType colorType) const {
99
- return INHERITED::maxSurfaceSampleCountForColorType(colorType);
92
+ return GrImageContext::maxSurfaceSampleCountForColorType(colorType);
100
93
  }
101
94
 
102
95
  SK_API sk_sp<const SkCapabilities> skCapabilities() const;
@@ -126,8 +119,8 @@ public:
126
119
 
127
120
  protected:
128
121
  friend class GrRecordingContextPriv; // for hidden functions
129
- friend class SkDeferredDisplayList; // for OwnedArenas
130
- friend class SkDeferredDisplayListPriv; // for ProgramData
122
+ friend class GrDeferredDisplayList; // for OwnedArenas
123
+ friend class GrDeferredDisplayListPriv; // for ProgramData
131
124
 
132
125
  // Like Arenas, but preserves ownership of the underlying pools.
133
126
  class OwnedArenas {
@@ -275,8 +268,6 @@ private:
275
268
  #if GR_TEST_UTILS
276
269
  int fSuppressWarningMessages = 0;
277
270
  #endif
278
-
279
- using INHERITED = GrImageContext;
280
271
  };
281
272
 
282
273
  /**
@@ -8,10 +8,14 @@
8
8
  #ifndef skgpu_MutableTextureState_DEFINED
9
9
  #define skgpu_MutableTextureState_DEFINED
10
10
 
11
+ #include "include/core/SkTypes.h"
11
12
  #include "include/gpu/GpuTypes.h"
12
13
 
13
14
  #ifdef SK_VULKAN
15
+ #include "include/private/gpu/vk/SkiaVulkan.h"
14
16
  #include "include/private/gpu/vk/VulkanTypesPriv.h"
17
+
18
+ #include <cstdint>
15
19
  #endif
16
20
 
17
21
  #include <new>
@@ -0,0 +1,54 @@
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 GrExternalTextureGenerator_DEFINED
9
+ #define GrExternalTextureGenerator_DEFINED
10
+
11
+ #include "include/core/SkRefCnt.h"
12
+ #include "include/gpu/GrBackendSurface.h"
13
+ #include "include/private/base/SkAPI.h"
14
+ #include "include/private/gpu/ganesh/GrTextureGenerator.h"
15
+
16
+ #include <memory>
17
+
18
+ class GrRecordingContext;
19
+ class GrSurfaceProxyView;
20
+ class SkImage;
21
+ enum class GrImageTexGenPolicy : int;
22
+ namespace skgpu { enum class Mipmapped : bool; }
23
+ struct SkImageInfo;
24
+
25
+ class GrExternalTexture {
26
+ public:
27
+ virtual ~GrExternalTexture() = default;
28
+ virtual GrBackendTexture getBackendTexture() = 0;
29
+ virtual void dispose() = 0;
30
+ };
31
+
32
+ class SK_API GrExternalTextureGenerator : public GrTextureGenerator {
33
+ public:
34
+ GrExternalTextureGenerator(const SkImageInfo& info);
35
+
36
+ GrSurfaceProxyView onGenerateTexture(GrRecordingContext*,
37
+ const SkImageInfo&,
38
+ skgpu::Mipmapped,
39
+ GrImageTexGenPolicy) override;
40
+ virtual std::unique_ptr<GrExternalTexture> generateExternalTexture(GrRecordingContext *,
41
+ skgpu::Mipmapped) = 0;
42
+ };
43
+
44
+ namespace SkImages {
45
+ /**
46
+ * Like SkImages::DeferredFromGenerator except allows for the use of GrTextureGenerator.
47
+ *
48
+ * @param gen producer of textures
49
+ * @return created SkImage, or nullptr
50
+ */
51
+ SK_API sk_sp<SkImage> DeferredFromTextureGenerator(std::unique_ptr<GrTextureGenerator> gen);
52
+ }
53
+
54
+ #endif // GrExternalTextureGenerator_DEFINED
@@ -14,25 +14,24 @@
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
+
17
20
  #include <functional>
18
21
  #include <utility>
19
22
 
20
- class GrBackendFormat;
21
23
  class GrBackendTexture;
22
- class GrContextThreadSafeProxy;
23
24
  class GrDirectContext;
24
25
  class GrRecordingContext;
25
- class GrYUVABackendTextureInfo;
26
26
  class GrYUVABackendTextures;
27
27
  class SkColorSpace;
28
28
  class SkData;
29
29
  class SkPixmap;
30
- class SkPromiseImageTexture;
31
30
  class SkYUVAPixmaps;
32
31
  enum SkAlphaType : int;
33
32
  enum SkColorType : int;
34
33
  enum class SkTextureCompressionType;
35
- struct SkISize;
34
+ struct SkIRect;
36
35
 
37
36
  /**
38
37
  * All factories in this file refer to the Ganesh GPU backend when they say GPU.
@@ -262,77 +261,6 @@ SK_API sk_sp<SkImage> TextureFromYUVATextures(GrRecordingContext* context,
262
261
  SK_API sk_sp<SkImage> TextureFromYUVATextures(GrRecordingContext* context,
263
262
  const GrYUVABackendTextures& yuvaTextures);
264
263
 
265
- using PromiseImageTextureContext = void*;
266
- using PromiseImageTextureFulfillProc = sk_sp<SkPromiseImageTexture> (*)(PromiseImageTextureContext);
267
- using PromiseImageTextureReleaseProc = void (*)(PromiseImageTextureContext);
268
-
269
- /** Create a new GPU-backed SkImage that is very similar to an SkImage created by BorrowTextureFrom.
270
- The difference is that the caller need not have created the texture nor populated it with the
271
- image pixel data. Moreover, the SkImage may be created on a thread as the creation of the
272
- image does not require access to the backend API or GrDirectContext. Instead of passing a
273
- GrBackendTexture the client supplies a description of the texture consisting of
274
- GrBackendFormat, width, height, and GrMipmapped state. The resulting SkImage can be drawn
275
- to a SkDeferredDisplayListRecorder or directly to a GPU-backed SkSurface.
276
- When the actual texture is required to perform a backend API draw, textureFulfillProc will
277
- be called to receive a GrBackendTexture. The properties of the GrBackendTexture must match
278
- those set during the SkImage creation, and it must refer to a valid existing texture in the
279
- backend API context/device, and be populated with the image pixel data. The texture cannot
280
- be deleted until textureReleaseProc is called.
281
- There is at most one call to each of textureFulfillProc and textureReleaseProc.
282
- textureReleaseProc is always called even if image creation fails or if the
283
- image is never fulfilled (e.g. it is never drawn or all draws are clipped out)
284
- @param gpuContextProxy the thread-safe proxy of the gpu context. required.
285
- @param backendFormat format of promised gpu texture
286
- @param dimensions width & height of promised gpu texture
287
- @param mipmapped mip mapped state of promised gpu texture
288
- @param origin surface origin of promised gpu texture
289
- @param colorType color type of promised gpu texture
290
- @param alphaType alpha type of promised gpu texture
291
- @param colorSpace range of colors; may be nullptr
292
- @param textureFulfillProc function called to get actual gpu texture
293
- @param textureReleaseProc function called when texture can be deleted
294
- @param textureContext state passed to textureFulfillProc and textureReleaseProc
295
- @return created SkImage, or nullptr
296
- */
297
- SK_API sk_sp<SkImage> PromiseTextureFrom(sk_sp<GrContextThreadSafeProxy> gpuContextProxy,
298
- const GrBackendFormat& backendFormat,
299
- SkISize dimensions,
300
- GrMipmapped mipmapped,
301
- GrSurfaceOrigin origin,
302
- SkColorType colorType,
303
- SkAlphaType alphaType,
304
- sk_sp<SkColorSpace> colorSpace,
305
- PromiseImageTextureFulfillProc textureFulfillProc,
306
- PromiseImageTextureReleaseProc textureReleaseProc,
307
- PromiseImageTextureContext textureContext);
308
-
309
- /** This is similar to 'PromiseTextureFrom' but it creates a GPU-backed SkImage from YUV[A] data.
310
- The source data may be planar (i.e. spread across multiple textures). In
311
- the extreme Y, U, V, and A are all in different planes and thus the image is specified by
312
- four textures. 'backendTextureInfo' describes the planar arrangement, texture formats,
313
- conversion to RGB, and origin of the textures. Separate 'textureFulfillProc' and
314
- 'textureReleaseProc' calls are made for each texture. Each texture has its own
315
- PromiseImageTextureContext. If 'backendTextureInfo' is not valid then no release proc
316
- calls are made. Otherwise, the calls will be made even on failure. 'textureContexts' has one
317
- entry for each of the up to four textures, as indicated by 'backendTextureInfo'.
318
- Currently the mip mapped property of 'backendTextureInfo' is ignored. However, in the
319
- near future it will be required that if it is kYes then textureFulfillProc must return
320
- a mip mapped texture for each plane in order to successfully draw the image.
321
- @param gpuContextProxy the thread-safe proxy of the gpu context. required.
322
- @param backendTextureInfo info about the promised yuva gpu texture
323
- @param imageColorSpace range of colors; may be nullptr
324
- @param textureFulfillProc function called to get actual gpu texture
325
- @param textureReleaseProc function called when texture can be deleted
326
- @param textureContexts state passed to textureFulfillProc and textureReleaseProc
327
- @return created SkImage, or nullptr
328
- */
329
- SK_API sk_sp<SkImage> PromiseTextureFromYUVA(sk_sp<GrContextThreadSafeProxy> gpuContextProxy,
330
- const GrYUVABackendTextureInfo& backendTextureInfo,
331
- sk_sp<SkColorSpace> imageColorSpace,
332
- PromiseImageTextureFulfillProc textureFulfillProc,
333
- PromiseImageTextureReleaseProc textureReleaseProc,
334
- PromiseImageTextureContext textureContexts[]);
335
-
336
264
  /** Retrieves the existing backend texture. If SkImage is not a Ganesh-backend texture image
337
265
  or otherwise does not have such a texture, false is returned. Otherwise, outTexture will
338
266
  be set to the image's texture.
@@ -380,6 +308,22 @@ inline bool GetBackendTextureFromImage(GrDirectContext* context,
380
308
  backendTextureReleaseProc);
381
309
  }
382
310
 
311
+ /** Returns subset of this image as a texture-backed image.
312
+
313
+ Returns nullptr if any of the following are true:
314
+ - Subset is empty
315
+ - Subset is not contained inside the image's bounds
316
+ - Pixels in the source image could not be read or copied
317
+ - The source image is texture-backed and context does not match the source image's context.
318
+
319
+ @param context the non-null GrDirectContext to which the subset should be uploaded.
320
+ @param subset bounds of returned SkImage
321
+ @return the subsetted image, uploaded as a texture, or nullptr
322
+ */
323
+ SK_API sk_sp<SkImage> SubsetTextureFrom(GrDirectContext* context,
324
+ const SkImage* img,
325
+ const SkIRect& subset);
326
+
383
327
  } // namespace SkImages
384
328
 
385
329
  #endif