@shopify/react-native-skia 0.1.213 → 0.1.214

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.
Files changed (245) hide show
  1. package/android/cpp/rnskia-android/SkiaOpenGLHelper.h +3 -2
  2. package/android/cpp/rnskia-android/SkiaOpenGLSurfaceFactory.cpp +9 -2
  3. package/cpp/api/JsiSkSurface.h +4 -1
  4. package/cpp/skia/include/android/GrAHardwareBufferUtils.h +99 -0
  5. package/cpp/skia/include/android/SkHeifDecoder.h +10 -3
  6. package/cpp/skia/include/codec/SkAvifDecoder.h +1 -0
  7. package/cpp/skia/include/codec/SkBmpDecoder.h +1 -0
  8. package/cpp/skia/include/codec/SkCodec.h +4 -3
  9. package/cpp/skia/include/codec/SkEncodedImageFormat.h +0 -3
  10. package/cpp/skia/include/codec/SkGifDecoder.h +1 -0
  11. package/cpp/skia/include/codec/SkIcoDecoder.h +1 -0
  12. package/cpp/skia/include/codec/SkJpegDecoder.h +1 -0
  13. package/cpp/skia/include/codec/SkJpegxlDecoder.h +1 -0
  14. package/cpp/skia/include/codec/SkPngDecoder.h +1 -0
  15. package/cpp/skia/include/codec/SkRawDecoder.h +1 -0
  16. package/cpp/skia/include/codec/SkWbmpDecoder.h +1 -0
  17. package/cpp/skia/include/codec/SkWebpDecoder.h +1 -0
  18. package/cpp/skia/include/config/SkUserConfig.h +0 -2
  19. package/cpp/skia/include/core/SkBitmap.h +8 -8
  20. package/cpp/skia/include/core/SkCanvas.h +37 -50
  21. package/cpp/skia/include/core/SkCapabilities.h +2 -7
  22. package/cpp/skia/include/core/SkColor.h +1 -1
  23. package/cpp/skia/include/core/SkColorFilter.h +6 -0
  24. package/cpp/skia/include/core/SkColorTable.h +3 -0
  25. package/cpp/skia/include/core/SkColorType.h +2 -0
  26. package/cpp/skia/include/core/SkContourMeasure.h +12 -8
  27. package/cpp/skia/include/core/SkDocument.h +1 -0
  28. package/cpp/skia/include/core/SkFont.h +11 -2
  29. package/cpp/skia/include/core/SkFontMgr.h +2 -3
  30. package/cpp/skia/include/core/SkGraphics.h +3 -13
  31. package/cpp/skia/include/core/SkImage.h +57 -111
  32. package/cpp/skia/include/core/SkImageFilter.h +6 -1
  33. package/cpp/skia/include/core/SkImageGenerator.h +8 -0
  34. package/cpp/skia/include/core/SkImageInfo.h +0 -2
  35. package/cpp/skia/include/core/SkM44.h +7 -3
  36. package/cpp/skia/include/core/SkMallocPixelRef.h +4 -1
  37. package/cpp/skia/include/core/SkMatrix.h +17 -17
  38. package/cpp/skia/include/core/SkMesh.h +71 -61
  39. package/cpp/skia/include/core/SkMilestone.h +1 -1
  40. package/cpp/skia/include/core/SkOverdrawCanvas.h +25 -0
  41. package/cpp/skia/include/core/SkPaint.h +1 -1
  42. package/cpp/skia/include/core/SkPath.h +12 -4
  43. package/cpp/skia/include/core/SkPathMeasure.h +3 -4
  44. package/cpp/skia/include/core/SkPicture.h +19 -6
  45. package/cpp/skia/include/core/SkPictureRecorder.h +6 -6
  46. package/cpp/skia/include/core/SkPixmap.h +2 -3
  47. package/cpp/skia/include/core/SkRRect.h +1 -1
  48. package/cpp/skia/include/core/SkRect.h +107 -110
  49. package/cpp/skia/include/core/SkRefCnt.h +1 -1
  50. package/cpp/skia/include/core/SkRegion.h +7 -1
  51. package/cpp/skia/include/core/SkSerialProcs.h +14 -0
  52. package/cpp/skia/include/core/SkShader.h +9 -0
  53. package/cpp/skia/include/core/SkStream.h +9 -9
  54. package/cpp/skia/include/core/SkString.h +1 -1
  55. package/cpp/skia/include/core/SkSurface.h +14 -25
  56. package/cpp/skia/include/core/SkTextBlob.h +17 -4
  57. package/cpp/skia/include/core/SkTiledImageUtils.h +28 -0
  58. package/cpp/skia/include/core/SkTypeface.h +7 -2
  59. package/cpp/skia/include/core/SkTypes.h +4 -12
  60. package/cpp/skia/include/docs/SkPDFDocument.h +17 -3
  61. package/cpp/skia/include/effects/SkImageFilters.h +73 -24
  62. package/cpp/skia/include/effects/SkRuntimeEffect.h +20 -51
  63. package/cpp/skia/include/gpu/GpuTypes.h +13 -0
  64. package/cpp/skia/include/gpu/GrBackendSurface.h +95 -262
  65. package/cpp/skia/include/gpu/GrContextOptions.h +7 -1
  66. package/cpp/skia/include/gpu/GrDirectContext.h +138 -128
  67. package/cpp/skia/include/gpu/GrRecordingContext.h +9 -4
  68. package/cpp/skia/include/gpu/GrSurfaceInfo.h +0 -24
  69. package/cpp/skia/include/gpu/GrTypes.h +16 -1
  70. package/cpp/skia/include/gpu/GrYUVABackendTextures.h +4 -4
  71. package/cpp/skia/include/gpu/d3d/GrD3DTypes.h +2 -2
  72. package/cpp/skia/include/gpu/ganesh/SkImageGanesh.h +44 -12
  73. package/cpp/skia/include/gpu/ganesh/SkMeshGanesh.h +57 -0
  74. package/cpp/skia/include/gpu/ganesh/SkSurfaceGanesh.h +2 -1
  75. package/cpp/skia/include/gpu/ganesh/gl/GrGLBackendSurface.h +58 -0
  76. package/cpp/skia/include/gpu/ganesh/gl/GrGLDirectContext.h +29 -0
  77. package/cpp/skia/include/gpu/ganesh/mtl/SkSurfaceMetal.h +1 -1
  78. package/cpp/skia/include/gpu/ganesh/vk/GrVkBackendSurface.h +67 -0
  79. package/cpp/skia/include/gpu/gl/GrGLInterface.h +2 -2
  80. package/cpp/skia/include/gpu/graphite/BackendTexture.h +14 -3
  81. package/cpp/skia/include/gpu/graphite/Context.h +93 -13
  82. package/cpp/skia/include/gpu/graphite/ContextOptions.h +19 -8
  83. package/cpp/skia/include/gpu/graphite/GraphiteTypes.h +23 -0
  84. package/cpp/skia/include/gpu/graphite/Image.h +56 -0
  85. package/cpp/skia/include/gpu/graphite/ImageProvider.h +5 -0
  86. package/cpp/skia/include/gpu/graphite/Recorder.h +26 -9
  87. package/cpp/skia/include/gpu/graphite/Recording.h +7 -5
  88. package/cpp/skia/include/gpu/graphite/TextureInfo.h +8 -0
  89. package/cpp/skia/include/gpu/graphite/mtl/MtlGraphiteTypes.h +2 -2
  90. package/cpp/skia/include/gpu/mtl/GrMtlTypes.h +2 -2
  91. package/cpp/skia/include/gpu/vk/GrVkTypes.h +4 -3
  92. package/cpp/skia/include/ports/SkCFObject.h +1 -1
  93. package/cpp/skia/include/private/SkGainmapInfo.h +4 -13
  94. package/cpp/skia/include/private/SkJpegGainmapEncoder.h +1 -24
  95. package/cpp/skia/include/private/SkWeakRefCnt.h +1 -1
  96. package/cpp/skia/include/private/base/SkAnySubclass.h +73 -0
  97. package/cpp/skia/include/private/base/SkAssert.h +106 -12
  98. package/cpp/skia/include/private/base/SkAttributes.h +0 -12
  99. package/cpp/skia/include/private/base/SkFeatures.h +0 -3
  100. package/cpp/skia/include/private/base/SkFloatingPoint.h +58 -105
  101. package/cpp/skia/include/private/base/SkSpan_impl.h +18 -12
  102. package/cpp/skia/include/private/base/SkTArray.h +22 -17
  103. package/cpp/skia/include/private/base/SkTDArray.h +5 -6
  104. package/cpp/skia/include/private/base/SkTemplates.h +50 -30
  105. package/cpp/skia/include/private/chromium/GrDeferredDisplayListRecorder.h +5 -2
  106. package/cpp/skia/include/private/chromium/GrSurfaceCharacterization.h +2 -2
  107. package/cpp/skia/include/private/chromium/SkChromeRemoteGlyphCache.h +13 -8
  108. package/cpp/skia/include/private/chromium/SkDiscardableMemory.h +1 -1
  109. package/cpp/skia/include/private/chromium/SkImageChromium.h +16 -3
  110. package/cpp/skia/include/private/chromium/Slug.h +11 -4
  111. package/cpp/skia/include/private/gpu/ganesh/GrD3DTypesMinimal.h +1 -1
  112. package/cpp/skia/include/private/gpu/ganesh/GrGLTypesPriv.h +6 -9
  113. package/cpp/skia/include/private/gpu/ganesh/GrTypesPriv.h +29 -13
  114. package/cpp/skia/include/private/gpu/ganesh/GrVkTypesPriv.h +2 -28
  115. package/cpp/skia/include/private/gpu/graphite/ContextOptionsPriv.h +34 -0
  116. package/cpp/skia/include/private/gpu/graphite/DawnTypesPriv.h +6 -0
  117. package/cpp/skia/include/private/gpu/graphite/MtlGraphiteTypesPriv.h +8 -0
  118. package/cpp/skia/include/private/gpu/graphite/VulkanGraphiteTypesPriv.h +10 -0
  119. package/cpp/skia/include/utils/SkBase64.h +2 -2
  120. package/cpp/skia/include/utils/SkNWayCanvas.h +1 -11
  121. package/cpp/skia/include/utils/SkNoDrawCanvas.h +0 -2
  122. package/cpp/skia/include/utils/SkPaintFilterCanvas.h +1 -2
  123. package/cpp/skia/include/utils/SkShadowUtils.h +15 -1
  124. package/cpp/skia/include/utils/SkTextUtils.h +1 -1
  125. package/cpp/skia/modules/skparagraph/include/Paragraph.h +107 -1
  126. package/cpp/skia/modules/skparagraph/include/ParagraphBuilder.h +3 -2
  127. package/cpp/skia/modules/skparagraph/include/ParagraphStyle.h +4 -0
  128. package/cpp/skia/modules/skparagraph/include/TypefaceFontProvider.h +5 -3
  129. package/cpp/skia/modules/svg/include/SkSVGAttributeParser.h +4 -0
  130. package/cpp/skia/src/core/SkChecksum.h +2 -1
  131. package/cpp/skia/src/core/SkPathPriv.h +1 -1
  132. package/cpp/skia/src/core/SkTHash.h +19 -9
  133. package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.mm +3 -1
  134. package/ios/RNSkia-iOS/SkiaMetalSurfaceFactory.mm +1 -1
  135. package/lib/commonjs/dom/nodes/datatypes/Rect.js +5 -1
  136. package/lib/commonjs/dom/nodes/datatypes/Rect.js.map +1 -1
  137. package/lib/commonjs/external/reanimated/index.d.ts +1 -0
  138. package/lib/commonjs/external/reanimated/index.js +13 -0
  139. package/lib/commonjs/external/reanimated/index.js.map +1 -1
  140. package/lib/commonjs/external/reanimated/moduleWrapper.js +3 -8
  141. package/lib/commonjs/external/reanimated/moduleWrapper.js.map +1 -1
  142. package/lib/commonjs/external/reanimated/renderHelpers.js +46 -1
  143. package/lib/commonjs/external/reanimated/renderHelpers.js.map +1 -1
  144. package/lib/commonjs/external/reanimated/useDerivedValueOnJS.d.ts +2 -0
  145. package/lib/commonjs/external/reanimated/useDerivedValueOnJS.js +26 -0
  146. package/lib/commonjs/external/reanimated/useDerivedValueOnJS.js.map +1 -0
  147. package/lib/commonjs/external/reanimated/useSharedValueEffect.js +2 -5
  148. package/lib/commonjs/external/reanimated/useSharedValueEffect.js.map +1 -1
  149. package/lib/commonjs/skia/types/MaskFilter.js +4 -0
  150. package/lib/commonjs/skia/types/MaskFilter.js.map +1 -1
  151. package/lib/commonjs/skia/web/JsiSkPicture.js +2 -1
  152. package/lib/commonjs/skia/web/JsiSkPicture.js.map +1 -1
  153. package/lib/commonjs/views/SkiaBaseWebView.js +1 -1
  154. package/lib/commonjs/views/SkiaBaseWebView.js.map +1 -1
  155. package/lib/commonjs/views/types.js +3 -0
  156. package/lib/commonjs/views/types.js.map +1 -1
  157. package/lib/module/dom/nodes/datatypes/Rect.js +5 -1
  158. package/lib/module/dom/nodes/datatypes/Rect.js.map +1 -1
  159. package/lib/module/external/reanimated/index.d.ts +1 -0
  160. package/lib/module/external/reanimated/index.js +1 -0
  161. package/lib/module/external/reanimated/index.js.map +1 -1
  162. package/lib/module/external/reanimated/moduleWrapper.js +1 -9
  163. package/lib/module/external/reanimated/moduleWrapper.js.map +1 -1
  164. package/lib/module/external/reanimated/renderHelpers.js +48 -2
  165. package/lib/module/external/reanimated/renderHelpers.js.map +1 -1
  166. package/lib/module/external/reanimated/useDerivedValueOnJS.d.ts +2 -0
  167. package/lib/module/external/reanimated/useDerivedValueOnJS.js +15 -0
  168. package/lib/module/external/reanimated/useDerivedValueOnJS.js.map +1 -0
  169. package/lib/module/external/reanimated/useSharedValueEffect.js +3 -6
  170. package/lib/module/external/reanimated/useSharedValueEffect.js.map +1 -1
  171. package/lib/module/skia/types/MaskFilter.js +3 -0
  172. package/lib/module/skia/types/MaskFilter.js.map +1 -1
  173. package/lib/module/views/types.js +3 -0
  174. package/lib/module/views/types.js.map +1 -1
  175. package/lib/typescript/src/external/reanimated/index.d.ts +1 -0
  176. package/lib/typescript/src/external/reanimated/useDerivedValueOnJS.d.ts +2 -0
  177. package/libs/android/arm64-v8a/libskia.a +0 -0
  178. package/libs/android/arm64-v8a/libskottie.a +0 -0
  179. package/libs/android/arm64-v8a/libskparagraph.a +0 -0
  180. package/libs/android/arm64-v8a/libsksg.a +0 -0
  181. package/libs/android/arm64-v8a/libskshaper.a +0 -0
  182. package/libs/android/arm64-v8a/libskunicode.a +0 -0
  183. package/libs/android/arm64-v8a/libsvg.a +0 -0
  184. package/libs/android/armeabi-v7a/libskia.a +0 -0
  185. package/libs/android/armeabi-v7a/libskottie.a +0 -0
  186. package/libs/android/armeabi-v7a/libskparagraph.a +0 -0
  187. package/libs/android/armeabi-v7a/libsksg.a +0 -0
  188. package/libs/android/armeabi-v7a/libskshaper.a +0 -0
  189. package/libs/android/armeabi-v7a/libskunicode.a +0 -0
  190. package/libs/android/armeabi-v7a/libsvg.a +0 -0
  191. package/libs/android/x86/libskia.a +0 -0
  192. package/libs/android/x86/libskottie.a +0 -0
  193. package/libs/android/x86/libskparagraph.a +0 -0
  194. package/libs/android/x86/libsksg.a +0 -0
  195. package/libs/android/x86/libskshaper.a +0 -0
  196. package/libs/android/x86/libskunicode.a +0 -0
  197. package/libs/android/x86/libsvg.a +0 -0
  198. package/libs/android/x86_64/libskia.a +0 -0
  199. package/libs/android/x86_64/libskottie.a +0 -0
  200. package/libs/android/x86_64/libskparagraph.a +0 -0
  201. package/libs/android/x86_64/libsksg.a +0 -0
  202. package/libs/android/x86_64/libskshaper.a +0 -0
  203. package/libs/android/x86_64/libskunicode.a +0 -0
  204. package/libs/android/x86_64/libsvg.a +0 -0
  205. package/libs/ios/libskia.xcframework/Info.plist +5 -5
  206. package/libs/ios/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
  207. package/libs/ios/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
  208. package/libs/ios/libskottie.xcframework/ios-arm64_arm64e/libskottie.a +0 -0
  209. package/libs/ios/libskottie.xcframework/ios-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
  210. package/libs/ios/libskparagraph.xcframework/Info.plist +5 -5
  211. package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e/libskparagraph.a +0 -0
  212. package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e_x86_64-simulator/libskparagraph.a +0 -0
  213. package/libs/ios/libsksg.xcframework/Info.plist +5 -5
  214. package/libs/ios/libsksg.xcframework/ios-arm64_arm64e/libsksg.a +0 -0
  215. package/libs/ios/libsksg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
  216. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
  217. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
  218. package/libs/ios/libskunicode.xcframework/Info.plist +5 -5
  219. package/libs/ios/libskunicode.xcframework/ios-arm64_arm64e/libskunicode.a +0 -0
  220. package/libs/ios/libskunicode.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode.a +0 -0
  221. package/libs/ios/libsvg.xcframework/Info.plist +5 -5
  222. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
  223. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
  224. package/package.json +1 -1
  225. package/react-native-skia.podspec +1 -1
  226. package/src/dom/nodes/datatypes/Rect.ts +6 -2
  227. package/src/external/reanimated/index.ts +1 -0
  228. package/src/external/reanimated/moduleWrapper.ts +6 -10
  229. package/src/external/reanimated/renderHelpers.ts +41 -1
  230. package/src/external/reanimated/useDerivedValueOnJS.ts +24 -0
  231. package/src/external/reanimated/useSharedValueEffect.ts +4 -7
  232. package/cpp/skia/include/core/SkDeferredDisplayList.h +0 -15
  233. package/cpp/skia/include/core/SkDeferredDisplayListRecorder.h +0 -15
  234. package/cpp/skia/include/core/SkPromiseImageTexture.h +0 -20
  235. package/cpp/skia/include/core/SkSurfaceCharacterization.h +0 -15
  236. package/cpp/skia/include/core/SkTime.h +0 -63
  237. package/cpp/skia/include/effects/SkOpPathEffect.h +0 -43
  238. package/cpp/skia/include/effects/SkStrokeAndFillPathEffect.h +0 -28
  239. package/cpp/skia/include/gpu/GrBackendSurfaceMutableState.h +0 -32
  240. package/cpp/skia/include/gpu/dawn/GrDawnTypes.h +0 -95
  241. package/cpp/skia/include/private/SkBitmaskEnum.h +0 -59
  242. package/cpp/skia/include/private/SkSLDefines.h +0 -64
  243. package/cpp/skia/include/private/SkShadowFlags.h +0 -27
  244. package/cpp/skia/include/private/gpu/ganesh/GrDawnTypesPriv.h +0 -26
  245. /package/cpp/skia/{include/private/base → src/core}/SkPathEnums.h +0 -0
@@ -13,40 +13,21 @@
13
13
  #include "include/gpu/GpuTypes.h"
14
14
  #include "include/gpu/GrTypes.h"
15
15
  #include "include/private/base/SkAPI.h"
16
+ #include "include/private/base/SkAnySubclass.h"
16
17
  #include "include/private/gpu/ganesh/GrTypesPriv.h"
17
18
 
18
- #ifdef SK_GL
19
- #include "include/gpu/gl/GrGLTypes.h"
20
- #include "include/private/gpu/ganesh/GrGLTypesPriv.h"
21
- #endif
22
-
23
19
  #include "include/gpu/mock/GrMockTypes.h"
24
20
 
25
- #ifdef SK_VULKAN
26
- #include "include/gpu/vk/GrVkTypes.h"
27
- #include "include/private/gpu/ganesh/GrVkTypesPriv.h"
28
- #include "include/private/gpu/vk/SkiaVulkan.h"
29
- #endif
30
-
31
- #ifdef SK_DAWN
32
- #include "include/gpu/dawn/GrDawnTypes.h"
33
- #endif
34
-
35
- #include <cstdint>
36
- #include <string>
37
- #include <string_view>
38
-
39
21
  enum class SkTextureCompressionType;
22
+ class GrBackendFormatData;
23
+ class GrBackendTextureData;
24
+ class GrBackendRenderTargetData;
40
25
 
41
26
  namespace skgpu {
42
27
  class MutableTextureState;
43
28
  class MutableTextureStateRef;
44
29
  }
45
30
 
46
- #ifdef SK_DAWN
47
- #include "webgpu/webgpu_cpp.h"
48
- #endif
49
-
50
31
  #ifdef SK_METAL
51
32
  #include "include/gpu/mtl/GrMtlTypes.h"
52
33
  #endif
@@ -56,37 +37,22 @@ class MutableTextureStateRef;
56
37
  class GrD3DResourceState;
57
38
  #endif
58
39
 
59
- #if defined(SK_DEBUG) || GR_TEST_UTILS
40
+ #if defined(SK_DEBUG) || defined(GR_TEST_UTILS)
60
41
  class SkString;
61
42
  #endif
62
43
 
44
+ #include <cstddef>
45
+ #include <cstdint>
46
+ #include <string>
47
+ #include <string_view>
48
+
63
49
  class SK_API GrBackendFormat {
64
50
  public:
65
51
  // Creates an invalid backend format.
66
- GrBackendFormat() {}
52
+ GrBackendFormat();
67
53
  GrBackendFormat(const GrBackendFormat&);
68
54
  GrBackendFormat& operator=(const GrBackendFormat&);
69
-
70
- #ifdef SK_GL
71
- static GrBackendFormat MakeGL(GrGLenum format, GrGLenum target) {
72
- return GrBackendFormat(format, target);
73
- }
74
- #endif
75
-
76
- #ifdef SK_VULKAN
77
- static GrBackendFormat MakeVk(VkFormat format, bool willUseDRMFormatModifiers = false) {
78
- return GrBackendFormat(format, GrVkYcbcrConversionInfo(), willUseDRMFormatModifiers);
79
- }
80
-
81
- static GrBackendFormat MakeVk(const GrVkYcbcrConversionInfo& ycbcrInfo,
82
- bool willUseDRMFormatModifiers = false);
83
- #endif
84
-
85
- #ifdef SK_DAWN
86
- static GrBackendFormat MakeDawn(wgpu::TextureFormat format) {
87
- return GrBackendFormat(format);
88
- }
89
- #endif
55
+ ~GrBackendFormat();
90
56
 
91
57
  #ifdef SK_METAL
92
58
  static GrBackendFormat MakeMtl(GrMTLPixelFormat format) {
@@ -118,34 +84,6 @@ public:
118
84
 
119
85
  GrColorFormatDesc desc() const;
120
86
 
121
- #ifdef SK_GL
122
- /**
123
- * If the backend API is GL this gets the format as a GrGLFormat. Otherwise, returns
124
- * GrGLFormat::kUnknown.
125
- */
126
- GrGLFormat asGLFormat() const;
127
-
128
- GrGLenum asGLFormatEnum() const;
129
- #endif
130
-
131
- #ifdef SK_VULKAN
132
- /**
133
- * If the backend API is Vulkan this gets the format as a VkFormat and returns true. Otherwise,
134
- * returns false.
135
- */
136
- bool asVkFormat(VkFormat*) const;
137
-
138
- const GrVkYcbcrConversionInfo* getVkYcbcrConversionInfo() const;
139
- #endif
140
-
141
- #ifdef SK_DAWN
142
- /**
143
- * If the backend API is Dawn this gets the format as a wgpu::TextureFormat and returns true.
144
- * Otherwise, returns false.
145
- */
146
- bool asDawnFormat(wgpu::TextureFormat*) const;
147
- #endif
148
-
149
87
  #ifdef SK_METAL
150
88
  /**
151
89
  * If the backend API is Metal this gets the format as a GrMtlPixelFormat. Otherwise,
@@ -179,23 +117,26 @@ public:
179
117
  // Returns true if the backend format has been initialized.
180
118
  bool isValid() const { return fValid; }
181
119
 
182
- #if defined(SK_DEBUG) || GR_TEST_UTILS
120
+ #if defined(SK_DEBUG) || defined(GR_TEST_UTILS)
183
121
  SkString toStr() const;
184
122
  #endif
185
123
 
186
124
  private:
187
- #ifdef SK_GL
188
- GrBackendFormat(GrGLenum format, GrGLenum target);
189
- #endif
190
-
191
- #ifdef SK_VULKAN
192
- GrBackendFormat(const VkFormat vkFormat, const GrVkYcbcrConversionInfo&,
193
- bool willUseDRMFormatModifiers);
194
- #endif
195
-
196
- #ifdef SK_DAWN
197
- GrBackendFormat(wgpu::TextureFormat format);
198
- #endif
125
+ // Size determined by looking at the GrBackendFormatData subclasses, then guessing-and-checking.
126
+ // Compiler will complain if this is too small - in that case, just increase the number.
127
+ inline constexpr static size_t kMaxSubclassSize = 64;
128
+ using AnyFormatData = SkAnySubclass<GrBackendFormatData, kMaxSubclassSize>;
129
+
130
+ friend class GrBackendSurfacePriv;
131
+ friend class GrBackendFormatData;
132
+
133
+ // Used by internal factories. Should not be used externally. Use factories like
134
+ // GrBackendFormats::MakeGL instead.
135
+ template <typename FormatData>
136
+ GrBackendFormat(GrTextureType textureType, GrBackendApi api, const FormatData& formatData)
137
+ : fBackend(api), fValid(true), fTextureType(textureType) {
138
+ fFormatData.emplace<FormatData>(formatData);
139
+ }
199
140
 
200
141
  #ifdef SK_METAL
201
142
  GrBackendFormat(const GrMTLPixelFormat mtlFormat);
@@ -212,22 +153,10 @@ private:
212
153
  #endif
213
154
 
214
155
  GrBackendApi fBackend = GrBackendApi::kMock;
215
- bool fValid = false;
156
+ bool fValid = false;
157
+ AnyFormatData fFormatData;
216
158
 
217
159
  union {
218
- #ifdef SK_GL
219
- GrGLenum fGLFormat; // the sized, internal format of the GL resource
220
- #endif
221
- #ifdef SK_VULKAN
222
- struct {
223
- VkFormat fFormat;
224
- GrVkYcbcrConversionInfo fYcbcrConversionInfo;
225
- } fVk;
226
- #endif
227
- #ifdef SK_DAWN
228
- wgpu::TextureFormat fDawnFormat;
229
- #endif
230
-
231
160
  #ifdef SK_METAL
232
161
  GrMTLPixelFormat fMtlFormat;
233
162
  #endif
@@ -249,26 +178,10 @@ public:
249
178
  // Creates an invalid backend texture.
250
179
  GrBackendTexture();
251
180
 
252
- #ifdef SK_GL
253
- // The GrGLTextureInfo must have a valid fFormat.
254
- GrBackendTexture(int width,
255
- int height,
256
- GrMipmapped,
257
- const GrGLTextureInfo& glInfo,
258
- std::string_view label = {});
259
- #endif
260
-
261
- #ifdef SK_VULKAN
262
- GrBackendTexture(int width,
263
- int height,
264
- const GrVkImageInfo& vkInfo,
265
- std::string_view label = {});
266
- #endif
267
-
268
181
  #ifdef SK_METAL
269
182
  GrBackendTexture(int width,
270
183
  int height,
271
- GrMipmapped,
184
+ skgpu::Mipmapped,
272
185
  const GrMtlTextureInfo& mtlInfo,
273
186
  std::string_view label = {});
274
187
  #endif
@@ -280,16 +193,9 @@ public:
280
193
  std::string_view label = {});
281
194
  #endif
282
195
 
283
- #ifdef SK_DAWN
284
196
  GrBackendTexture(int width,
285
197
  int height,
286
- const GrDawnTextureInfo& dawnInfo,
287
- std::string_view label = {});
288
- #endif
289
-
290
- GrBackendTexture(int width,
291
- int height,
292
- GrMipmapped,
198
+ skgpu::Mipmapped,
293
199
  const GrMockTextureInfo& mockInfo,
294
200
  std::string_view label = {});
295
201
 
@@ -303,40 +209,13 @@ public:
303
209
  int width() const { return fWidth; }
304
210
  int height() const { return fHeight; }
305
211
  std::string_view getLabel() const { return fLabel; }
306
- GrMipmapped mipmapped() const { return fMipmapped; }
307
- bool hasMipmaps() const { return fMipmapped == GrMipmapped::kYes; }
212
+ skgpu::Mipmapped mipmapped() const { return fMipmapped; }
213
+ bool hasMipmaps() const { return fMipmapped == skgpu::Mipmapped::kYes; }
308
214
  /** deprecated alias of hasMipmaps(). */
309
215
  bool hasMipMaps() const { return this->hasMipmaps(); }
310
216
  GrBackendApi backend() const {return fBackend; }
311
217
  GrTextureType textureType() const { return fTextureType; }
312
218
 
313
- #ifdef SK_GL
314
- // If the backend API is GL, copies a snapshot of the GrGLTextureInfo struct into the passed in
315
- // pointer and returns true. Otherwise returns false if the backend API is not GL.
316
- bool getGLTextureInfo(GrGLTextureInfo*) const;
317
-
318
- // Call this to indicate that the texture parameters have been modified in the GL context
319
- // externally to GrContext.
320
- void glTextureParametersModified();
321
- #endif
322
-
323
- #ifdef SK_DAWN
324
- // If the backend API is Dawn, copies a snapshot of the GrDawnTextureInfo struct into the passed
325
- // in pointer and returns true. Otherwise returns false if the backend API is not Dawn.
326
- bool getDawnTextureInfo(GrDawnTextureInfo*) const;
327
- #endif
328
-
329
- #ifdef SK_VULKAN
330
- // If the backend API is Vulkan, copies a snapshot of the GrVkImageInfo struct into the passed
331
- // in pointer and returns true. This snapshot will set the fImageLayout to the current layout
332
- // state. Otherwise returns false if the backend API is not Vulkan.
333
- bool getVkImageInfo(GrVkImageInfo*) const;
334
-
335
- // Anytime the client changes the VkImageLayout of the VkImage captured by this
336
- // GrBackendTexture, they must call this function to notify Skia of the changed layout.
337
- void setVkImageLayout(VkImageLayout);
338
- #endif
339
-
340
219
  #ifdef SK_METAL
341
220
  // If the backend API is Metal, copies a snapshot of the GrMtlTextureInfo struct into the passed
342
221
  // in pointer and returns true. Otherwise returns false if the backend API is not Metal.
@@ -377,34 +256,41 @@ public:
377
256
  // Returns true if both textures are valid and refer to the same API texture.
378
257
  bool isSameTexture(const GrBackendTexture&);
379
258
 
380
- #if GR_TEST_UTILS
381
- static bool TestingOnly_Equals(const GrBackendTexture& , const GrBackendTexture&);
259
+ #if defined(GR_TEST_UTILS)
260
+ static bool TestingOnly_Equals(const GrBackendTexture&, const GrBackendTexture&);
382
261
  #endif
383
262
 
384
263
  private:
385
- friend class GrVkGpu; // for getMutableState
386
- sk_sp<skgpu::MutableTextureStateRef> getMutableState() const;
264
+ // Size determined by looking at the GrBackendTextureData subclasses, then guessing-and-checking.
265
+ // Compiler will complain if this is too small - in that case, just increase the number.
266
+ inline constexpr static size_t kMaxSubclassSize = 160;
267
+ using AnyTextureData = SkAnySubclass<GrBackendTextureData, kMaxSubclassSize>;
387
268
 
388
- #ifdef SK_GL
389
- friend class GrGLTexture;
390
- friend class GrGLGpu; // for getGLTextureParams
391
- GrBackendTexture(int width,
392
- int height,
393
- GrMipmapped,
394
- const GrGLTextureInfo,
395
- sk_sp<GrGLTextureParameters>,
396
- std::string_view label = {});
397
- sk_sp<GrGLTextureParameters> getGLTextureParams() const;
398
- #endif
269
+ friend class GrBackendSurfacePriv;
270
+ friend class GrBackendTextureData;
399
271
 
400
- #ifdef SK_VULKAN
401
- friend class GrVkTexture;
272
+ // Used by internal factories. Should not be used externally. Use factories like
273
+ // GrBackendTextures::MakeGL instead.
274
+ template <typename TextureData>
402
275
  GrBackendTexture(int width,
403
276
  int height,
404
- const GrVkImageInfo& vkInfo,
405
- sk_sp<skgpu::MutableTextureStateRef> mutableState,
406
- std::string_view label = {});
407
- #endif
277
+ std::string_view label,
278
+ skgpu::Mipmapped mipped,
279
+ GrBackendApi backend,
280
+ GrTextureType texture,
281
+ const TextureData& textureData)
282
+ : fIsValid(true)
283
+ , fWidth(width)
284
+ , fHeight(height)
285
+ , fLabel(label)
286
+ , fMipmapped(mipped)
287
+ , fBackend(backend)
288
+ , fTextureType(texture) {
289
+ fTextureData.emplace<TextureData>(textureData);
290
+ }
291
+
292
+ friend class GrVkGpu; // for getMutableState
293
+ sk_sp<skgpu::MutableTextureStateRef> getMutableState() const;
408
294
 
409
295
  #ifdef SK_DIRECT3D
410
296
  friend class GrD3DTexture;
@@ -424,17 +310,12 @@ private:
424
310
  int fWidth; //<! width in pixels
425
311
  int fHeight; //<! height in pixels
426
312
  const std::string fLabel;
427
- GrMipmapped fMipmapped;
313
+ skgpu::Mipmapped fMipmapped;
428
314
  GrBackendApi fBackend;
429
315
  GrTextureType fTextureType;
316
+ AnyTextureData fTextureData;
430
317
 
431
318
  union {
432
- #ifdef SK_GL
433
- GrGLBackendTextureInfo fGLInfo;
434
- #endif
435
- #ifdef SK_VULKAN
436
- GrVkBackendSurfaceInfo fVkInfo;
437
- #endif
438
319
  GrMockTextureInfo fMockInfo;
439
320
  #ifdef SK_DIRECT3D
440
321
  GrD3DBackendSurfaceInfo fD3DInfo;
@@ -443,11 +324,6 @@ private:
443
324
  #ifdef SK_METAL
444
325
  GrMtlTextureInfo fMtlInfo;
445
326
  #endif
446
- #ifdef SK_DAWN
447
- GrDawnTextureInfo fDawnInfo;
448
- #endif
449
-
450
- sk_sp<skgpu::MutableTextureStateRef> fMutableState;
451
327
  };
452
328
 
453
329
  class SK_API GrBackendRenderTarget {
@@ -455,41 +331,10 @@ public:
455
331
  // Creates an invalid backend texture.
456
332
  GrBackendRenderTarget();
457
333
 
458
- #ifdef SK_GL
459
- // The GrGLTextureInfo must have a valid fFormat. If wrapping in an SkSurface we require the
460
- // stencil bits to be either 0, 8 or 16.
461
- GrBackendRenderTarget(int width,
462
- int height,
463
- int sampleCnt,
464
- int stencilBits,
465
- const GrGLFramebufferInfo& glInfo);
466
- #endif
467
-
468
- #ifdef SK_DAWN
469
- // If wrapping in an SkSurface we require the stencil bits to be either 0, 8 or 16.
470
- GrBackendRenderTarget(int width,
471
- int height,
472
- int sampleCnt,
473
- int stencilBits,
474
- const GrDawnRenderTargetInfo& dawnInfo);
475
- #endif
476
-
477
- #ifdef SK_VULKAN
478
- /** Deprecated. Sample count is now part of GrVkImageInfo. */
479
- GrBackendRenderTarget(int width, int height, int sampleCnt, const GrVkImageInfo& vkInfo);
480
-
481
- GrBackendRenderTarget(int width, int height, const GrVkImageInfo& vkInfo);
482
- #endif
483
-
484
334
  #ifdef SK_METAL
485
335
  GrBackendRenderTarget(int width,
486
336
  int height,
487
337
  const GrMtlTextureInfo& mtlInfo);
488
- /** Deprecated. Sample count is ignored and is instead retrieved from the MtlTexture. */
489
- GrBackendRenderTarget(int width,
490
- int height,
491
- int sampleCnt,
492
- const GrMtlTextureInfo& mtlInfo);
493
338
  #endif
494
339
 
495
340
  #ifdef SK_DIRECT3D
@@ -517,29 +362,6 @@ public:
517
362
  GrBackendApi backend() const {return fBackend; }
518
363
  bool isFramebufferOnly() const { return fFramebufferOnly; }
519
364
 
520
- #ifdef SK_GL
521
- // If the backend API is GL, copies a snapshot of the GrGLFramebufferInfo struct into the passed
522
- // in pointer and returns true. Otherwise returns false if the backend API is not GL.
523
- bool getGLFramebufferInfo(GrGLFramebufferInfo*) const;
524
- #endif
525
-
526
- #ifdef SK_DAWN
527
- // If the backend API is Dawn, copies a snapshot of the GrDawnRenderTargetInfo struct into the
528
- // passed-in pointer and returns true. Otherwise returns false if the backend API is not Dawn.
529
- bool getDawnRenderTargetInfo(GrDawnRenderTargetInfo*) const;
530
- #endif
531
-
532
- #ifdef SK_VULKAN
533
- // If the backend API is Vulkan, copies a snapshot of the GrVkImageInfo struct into the passed
534
- // in pointer and returns true. This snapshot will set the fImageLayout to the current layout
535
- // state. Otherwise returns false if the backend API is not Vulkan.
536
- bool getVkImageInfo(GrVkImageInfo*) const;
537
-
538
- // Anytime the client changes the VkImageLayout of the VkImage captured by this
539
- // GrBackendRenderTarget, they must call this function to notify Skia of the changed layout.
540
- void setVkImageLayout(VkImageLayout);
541
- #endif
542
-
543
365
  #ifdef SK_METAL
544
366
  // If the backend API is Metal, copies a snapshot of the GrMtlTextureInfo struct into the passed
545
367
  // in pointer and returns true. Otherwise returns false if the backend API is not Metal.
@@ -576,22 +398,42 @@ public:
576
398
  // Returns true if the backend texture has been initialized.
577
399
  bool isValid() const { return fIsValid; }
578
400
 
579
-
580
- #if GR_TEST_UTILS
401
+ #if defined(GR_TEST_UTILS)
581
402
  static bool TestingOnly_Equals(const GrBackendRenderTarget&, const GrBackendRenderTarget&);
582
403
  #endif
583
404
 
584
405
  private:
585
- friend class GrVkGpu; // for getMutableState
586
- sk_sp<skgpu::MutableTextureStateRef> getMutableState() const;
587
-
588
- #ifdef SK_VULKAN
589
- friend class GrVkRenderTarget;
406
+ // Size determined by looking at the GrBackendRenderTargetData subclasses, then
407
+ // guessing-and-checking. Compiler will complain if this is too small - in that case, just
408
+ // increase the number.
409
+ inline constexpr static size_t kMaxSubclassSize = 160;
410
+ using AnyRenderTargetData = SkAnySubclass<GrBackendRenderTargetData, kMaxSubclassSize>;
411
+
412
+ friend class GrBackendSurfacePriv;
413
+ friend class GrBackendRenderTargetData;
414
+
415
+ // Used by internal factories. Should not be used externally. Use factories like
416
+ // GrBackendRenderTargets::MakeGL instead.
417
+ template <typename RenderTargetData>
590
418
  GrBackendRenderTarget(int width,
591
419
  int height,
592
- const GrVkImageInfo& vkInfo,
593
- sk_sp<skgpu::MutableTextureStateRef> mutableState);
594
- #endif
420
+ int sampleCnt,
421
+ int stencilBits,
422
+ GrBackendApi backend,
423
+ bool framebufferOnly,
424
+ const RenderTargetData& rtData)
425
+ : fIsValid(true)
426
+ , fFramebufferOnly(framebufferOnly)
427
+ , fWidth(width)
428
+ , fHeight(height)
429
+ , fSampleCnt(sampleCnt)
430
+ , fStencilBits(stencilBits)
431
+ , fBackend(backend) {
432
+ fRTData.emplace<RenderTargetData>(rtData);
433
+ }
434
+
435
+ friend class GrVkGpu; // for getMutableState
436
+ sk_sp<skgpu::MutableTextureStateRef> getMutableState() const;
595
437
 
596
438
  #ifdef SK_DIRECT3D
597
439
  friend class GrD3DGpu;
@@ -615,14 +457,9 @@ private:
615
457
  int fStencilBits;
616
458
 
617
459
  GrBackendApi fBackend;
460
+ AnyRenderTargetData fRTData;
618
461
 
619
462
  union {
620
- #ifdef SK_GL
621
- GrGLFramebufferInfo fGLInfo;
622
- #endif
623
- #ifdef SK_VULKAN
624
- GrVkBackendSurfaceInfo fVkInfo;
625
- #endif
626
463
  GrMockRenderTargetInfo fMockInfo;
627
464
  #ifdef SK_DIRECT3D
628
465
  GrD3DBackendSurfaceInfo fD3DInfo;
@@ -631,10 +468,6 @@ private:
631
468
  #ifdef SK_METAL
632
469
  GrMtlTextureInfo fMtlInfo;
633
470
  #endif
634
- #ifdef SK_DAWN
635
- GrDawnRenderTargetInfo fDawnInfo;
636
- #endif
637
- sk_sp<skgpu::MutableTextureStateRef> fMutableState;
638
471
  };
639
472
 
640
473
  #endif
@@ -97,6 +97,12 @@ struct SK_API GrContextOptions {
97
97
  deduce the optimal value for this platform. */
98
98
  int fBufferMapThreshold = -1;
99
99
 
100
+ /** Default minimum size to use when allocating buffers for uploading data to textures. The
101
+ larger the value the more uploads can be packed into one buffer, but at the cost of
102
+ more gpu memory allocated that may not be used. Uploads larger than the minimum will still
103
+ work by allocating a dedicated buffer. */
104
+ size_t fMinimumStagingBufferSize = 64 * 1024;
105
+
100
106
  /**
101
107
  * Executor to handle threaded work within Ganesh. If this is nullptr, then all work will be
102
108
  * done serially on the main thread. To have worker threads assist with various tasks, set this
@@ -292,7 +298,7 @@ struct SK_API GrContextOptions {
292
298
  GrDirectContextDestroyedContext fContextDeleteContext = nullptr;
293
299
  GrDirectContextDestroyedProc fContextDeleteProc = nullptr;
294
300
 
295
- #if GR_TEST_UTILS
301
+ #if defined(GR_TEST_UTILS)
296
302
  /**
297
303
  * Private options that are only meant for testing within Skia's tools.
298
304
  */