@shopify/react-native-skia 0.1.233 → 0.1.236

Sign up to get free protection for your applications and to get access to all the features.
Files changed (294) hide show
  1. package/android/CMakeLists.txt +0 -1
  2. package/android/cpp/jni/JniSkiaManager.cpp +0 -1
  3. package/android/cpp/rnskia-android/RNSkAndroidView.h +0 -1
  4. package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.cpp +1 -1
  5. package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.h +1 -2
  6. package/cpp/api/JsiSkTypefaceFactory.h +2 -1
  7. package/cpp/skia/include/android/AHardwareBufferUtils.h +23 -0
  8. package/cpp/skia/include/android/GrAHardwareBufferUtils.h +2 -0
  9. package/cpp/skia/include/android/graphite/SurfaceAndroid.h +59 -0
  10. package/cpp/skia/include/codec/SkAvifDecoder.h +1 -1
  11. package/cpp/skia/include/codec/SkBmpDecoder.h +1 -1
  12. package/cpp/skia/include/codec/SkCodec.h +21 -3
  13. package/cpp/skia/include/codec/SkGifDecoder.h +1 -1
  14. package/cpp/skia/include/codec/SkIcoDecoder.h +1 -1
  15. package/cpp/skia/include/codec/SkJpegDecoder.h +1 -1
  16. package/cpp/skia/include/codec/SkJpegxlDecoder.h +1 -1
  17. package/cpp/skia/include/codec/SkPngDecoder.h +1 -1
  18. package/cpp/skia/include/codec/SkRawDecoder.h +1 -1
  19. package/cpp/skia/include/codec/SkWbmpDecoder.h +1 -1
  20. package/cpp/skia/include/codec/SkWebpDecoder.h +1 -1
  21. package/cpp/skia/include/config/SkUserConfig.h +3 -1
  22. package/cpp/skia/include/core/SkCanvas.h +66 -37
  23. package/cpp/skia/include/core/SkColorFilter.h +5 -2
  24. package/cpp/skia/include/core/SkContourMeasure.h +1 -0
  25. package/cpp/skia/include/core/SkDocument.h +1 -0
  26. package/cpp/skia/include/core/SkFont.h +14 -24
  27. package/cpp/skia/include/core/SkFontArguments.h +1 -1
  28. package/cpp/skia/include/core/SkFontMetrics.h +1 -1
  29. package/cpp/skia/include/core/SkFontMgr.h +0 -7
  30. package/cpp/skia/include/core/SkGraphics.h +13 -0
  31. package/cpp/skia/include/core/SkMesh.h +9 -13
  32. package/cpp/skia/include/core/SkMilestone.h +1 -1
  33. package/cpp/skia/include/core/SkPathMeasure.h +2 -0
  34. package/cpp/skia/include/core/SkSerialProcs.h +29 -11
  35. package/cpp/skia/include/core/SkSize.h +3 -3
  36. package/cpp/skia/include/core/SkStream.h +3 -13
  37. package/cpp/skia/include/core/SkSurface.h +6 -3
  38. package/cpp/skia/include/core/SkSurfaceProps.h +2 -4
  39. package/cpp/skia/include/core/SkTraceMemoryDump.h +15 -0
  40. package/cpp/skia/include/core/SkTypeface.h +8 -56
  41. package/cpp/skia/include/core/SkTypes.h +8 -0
  42. package/cpp/skia/include/core/SkVertices.h +1 -1
  43. package/cpp/skia/include/docs/SkMultiPictureDocument.h +53 -0
  44. package/cpp/skia/include/docs/SkPDFDocument.h +11 -0
  45. package/cpp/skia/include/effects/SkGradientShader.h +9 -0
  46. package/cpp/skia/include/effects/SkRuntimeEffect.h +3 -7
  47. package/cpp/skia/include/gpu/GrBackendSemaphore.h +33 -47
  48. package/cpp/skia/include/gpu/GrBackendSurface.h +2 -3
  49. package/cpp/skia/include/gpu/GrContextOptions.h +0 -6
  50. package/cpp/skia/include/gpu/GrContextThreadSafeProxy.h +44 -28
  51. package/cpp/skia/include/gpu/GrDirectContext.h +12 -31
  52. package/cpp/skia/include/gpu/GrTypes.h +1 -16
  53. package/cpp/skia/include/gpu/MutableTextureState.h +35 -80
  54. package/cpp/skia/include/gpu/ShaderErrorHandler.h +11 -1
  55. package/cpp/skia/include/gpu/ganesh/SkImageGanesh.h +2 -2
  56. package/cpp/skia/include/gpu/ganesh/SkSurfaceGanesh.h +1 -1
  57. package/cpp/skia/include/gpu/ganesh/gl/GrGLDirectContext.h +3 -2
  58. package/cpp/skia/include/gpu/ganesh/vk/GrVkBackendSemaphore.h +20 -0
  59. package/cpp/skia/include/gpu/ganesh/vk/GrVkDirectContext.h +30 -0
  60. package/cpp/skia/include/gpu/gl/GrGLFunctions.h +1 -1
  61. package/cpp/skia/include/gpu/gl/GrGLInterface.h +2 -0
  62. package/cpp/skia/include/gpu/gl/glx/GrGLMakeGLXInterface.h +6 -0
  63. package/cpp/skia/include/gpu/graphite/BackendSemaphore.h +3 -3
  64. package/cpp/skia/include/gpu/graphite/BackendTexture.h +39 -27
  65. package/cpp/skia/include/gpu/graphite/Context.h +39 -13
  66. package/cpp/skia/include/gpu/graphite/ContextOptions.h +2 -0
  67. package/cpp/skia/include/gpu/graphite/GraphiteTypes.h +2 -1
  68. package/cpp/skia/include/gpu/graphite/Image.h +106 -87
  69. package/cpp/skia/include/gpu/graphite/Recorder.h +24 -3
  70. package/cpp/skia/include/gpu/graphite/Surface.h +7 -2
  71. package/cpp/skia/include/gpu/graphite/dawn/DawnBackendContext.h +41 -2
  72. package/cpp/skia/include/gpu/graphite/dawn/DawnTypes.h +11 -6
  73. package/cpp/skia/include/gpu/graphite/mtl/MtlGraphiteTypes.h +1 -2
  74. package/cpp/skia/include/gpu/graphite/vk/VulkanGraphiteTypes.h +6 -6
  75. package/cpp/skia/include/gpu/mock/GrMockTypes.h +1 -0
  76. package/cpp/skia/include/gpu/vk/GrVkBackendContext.h +1 -1
  77. package/cpp/skia/include/gpu/vk/GrVkTypes.h +1 -44
  78. package/cpp/skia/include/gpu/vk/VulkanExtensions.h +1 -1
  79. package/cpp/skia/include/gpu/vk/VulkanMutableTextureState.h +25 -0
  80. package/cpp/skia/include/gpu/vk/VulkanTypes.h +44 -0
  81. package/cpp/skia/include/ports/SkFontConfigInterface.h +3 -6
  82. package/cpp/skia/include/private/SkEncodedInfo.h +5 -0
  83. package/cpp/skia/include/private/SkExif.h +102 -0
  84. package/cpp/skia/include/private/SkGainmapInfo.h +11 -1
  85. package/cpp/skia/include/private/base/SkAssert.h +16 -0
  86. package/cpp/skia/include/private/base/SkDeque.h +2 -7
  87. package/cpp/skia/include/private/base/SkLoadUserConfig.h +1 -1
  88. package/cpp/skia/include/private/base/SkTArray.h +69 -28
  89. package/cpp/skia/include/private/base/SkThreadAnnotations.h +18 -5
  90. package/cpp/skia/include/private/chromium/GrSurfaceCharacterization.h +26 -30
  91. package/cpp/skia/include/private/chromium/GrVkSecondaryCBDrawContext.h +4 -3
  92. package/cpp/skia/include/private/chromium/SkImageChromium.h +1 -1
  93. package/cpp/skia/include/private/gpu/ganesh/GrTypesPriv.h +8 -6
  94. package/cpp/skia/include/private/gpu/graphite/ContextOptionsPriv.h +29 -0
  95. package/cpp/skia/include/private/gpu/graphite/DawnTypesPriv.h +12 -9
  96. package/cpp/skia/include/private/gpu/graphite/VulkanGraphiteTypesPriv.h +16 -11
  97. package/cpp/skia/include/third_party/vulkan/vulkan/vk_platform.h +2 -2
  98. package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_h264std.h +312 -0
  99. package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_h264std_decode.h +77 -0
  100. package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_h265std.h +446 -0
  101. package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_h265std_decode.h +67 -0
  102. package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codecs_common.h +36 -0
  103. package/cpp/skia/include/third_party/vulkan/vulkan/vulkan.h +9 -2
  104. package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_android.h +31 -3
  105. package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_core.h +10624 -5716
  106. package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_ios.h +2 -1
  107. package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_macos.h +2 -1
  108. package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_win32.h +28 -1
  109. package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_xcb.h +2 -1
  110. package/cpp/skia/include/utils/mac/SkCGUtils.h +23 -11
  111. package/cpp/skia/modules/skcms/skcms.h +2 -410
  112. package/cpp/skia/modules/skcms/src/Transform_inl.h +831 -704
  113. package/cpp/skia/modules/skcms/src/skcms_Transform.h +161 -0
  114. package/cpp/skia/modules/skcms/src/skcms_internals.h +136 -0
  115. package/cpp/skia/modules/skcms/src/skcms_public.h +404 -0
  116. package/cpp/skia/modules/skparagraph/include/FontArguments.h +1 -1
  117. package/cpp/skia/modules/skparagraph/include/FontCollection.h +2 -0
  118. package/cpp/skia/modules/skparagraph/include/Paragraph.h +2 -2
  119. package/cpp/skia/modules/skparagraph/include/TextStyle.h +4 -3
  120. package/cpp/skia/modules/skparagraph/include/TypefaceFontProvider.h +1 -3
  121. package/cpp/skia/modules/skresources/include/SkResources.h +28 -17
  122. package/cpp/skia/modules/skunicode/include/SkUnicode.h +12 -0
  123. package/cpp/skia/modules/svg/include/SkSVGDOM.h +4 -1
  124. package/cpp/skia/modules/svg/include/SkSVGRenderContext.h +4 -1
  125. package/cpp/skia/src/base/SkUTF.h +7 -0
  126. package/cpp/skia/src/core/SkTHash.h +20 -8
  127. package/lib/commonjs/dom/nodes/JsiSkDOM.d.ts +3 -2
  128. package/lib/commonjs/dom/nodes/JsiSkDOM.js +56 -57
  129. package/lib/commonjs/dom/nodes/JsiSkDOM.js.map +1 -1
  130. package/lib/commonjs/external/reanimated/index.d.ts +1 -0
  131. package/lib/commonjs/external/reanimated/index.js +13 -0
  132. package/lib/commonjs/external/reanimated/index.js.map +1 -1
  133. package/lib/commonjs/external/reanimated/interpolators.js +16 -2
  134. package/lib/commonjs/external/reanimated/interpolators.js.map +1 -1
  135. package/lib/commonjs/external/reanimated/moduleWrapper.d.ts +1 -0
  136. package/lib/commonjs/external/reanimated/moduleWrapper.js +5 -3
  137. package/lib/commonjs/external/reanimated/moduleWrapper.js.map +1 -1
  138. package/lib/commonjs/external/reanimated/textures.d.ts +5 -0
  139. package/lib/commonjs/external/reanimated/textures.js +52 -0
  140. package/lib/commonjs/external/reanimated/textures.js.map +1 -0
  141. package/lib/commonjs/headless/index.js +1 -1
  142. package/lib/commonjs/headless/index.js.map +1 -1
  143. package/lib/commonjs/mock/index.js +3 -0
  144. package/lib/commonjs/mock/index.js.map +1 -1
  145. package/lib/commonjs/renderer/Canvas.js +6 -5
  146. package/lib/commonjs/renderer/Canvas.js.map +1 -1
  147. package/lib/commonjs/renderer/Container.d.ts +1 -1
  148. package/lib/commonjs/renderer/Container.js +2 -1
  149. package/lib/commonjs/renderer/Container.js.map +1 -1
  150. package/lib/commonjs/renderer/Offscreen.d.ts +1 -0
  151. package/lib/commonjs/renderer/Offscreen.js +18 -5
  152. package/lib/commonjs/renderer/Offscreen.js.map +1 -1
  153. package/lib/commonjs/renderer/Reconciler.d.ts +1 -1
  154. package/lib/commonjs/renderer/Reconciler.js +7 -4
  155. package/lib/commonjs/renderer/Reconciler.js.map +1 -1
  156. package/lib/commonjs/skia/types/Matrix4.d.ts +2 -2
  157. package/lib/commonjs/skia/types/Matrix4.js.map +1 -1
  158. package/lib/commonjs/skia/types/Shader/Shader.d.ts +1 -1
  159. package/lib/commonjs/skia/types/Shader/Shader.js.map +1 -1
  160. package/lib/commonjs/skia/web/JsiSkPath.d.ts +2 -2
  161. package/lib/commonjs/skia/web/JsiSkPath.js +10 -2
  162. package/lib/commonjs/skia/web/JsiSkPath.js.map +1 -1
  163. package/lib/commonjs/views/SkiaJSDomView.d.ts +31 -0
  164. package/lib/commonjs/views/SkiaJSDomView.js +161 -0
  165. package/lib/commonjs/views/SkiaJSDomView.js.map +1 -0
  166. package/lib/commonjs/views/SkiaJSDomView.web.d.ts +1 -0
  167. package/lib/commonjs/views/SkiaJSDomView.web.js +14 -0
  168. package/lib/commonjs/views/SkiaJSDomView.web.js.map +1 -0
  169. package/lib/module/dom/nodes/JsiSkDOM.d.ts +3 -2
  170. package/lib/module/dom/nodes/JsiSkDOM.js +56 -56
  171. package/lib/module/dom/nodes/JsiSkDOM.js.map +1 -1
  172. package/lib/module/external/reanimated/index.d.ts +1 -0
  173. package/lib/module/external/reanimated/index.js +1 -0
  174. package/lib/module/external/reanimated/index.js.map +1 -1
  175. package/lib/module/external/reanimated/interpolators.js +15 -2
  176. package/lib/module/external/reanimated/interpolators.js.map +1 -1
  177. package/lib/module/external/reanimated/moduleWrapper.d.ts +1 -0
  178. package/lib/module/external/reanimated/moduleWrapper.js +3 -2
  179. package/lib/module/external/reanimated/moduleWrapper.js.map +1 -1
  180. package/lib/module/external/reanimated/textures.d.ts +5 -0
  181. package/lib/module/external/reanimated/textures.js +35 -0
  182. package/lib/module/external/reanimated/textures.js.map +1 -0
  183. package/lib/module/headless/index.js +1 -1
  184. package/lib/module/headless/index.js.map +1 -1
  185. package/lib/module/mock/index.js +3 -0
  186. package/lib/module/mock/index.js.map +1 -1
  187. package/lib/module/renderer/Canvas.js +5 -4
  188. package/lib/module/renderer/Canvas.js.map +1 -1
  189. package/lib/module/renderer/Container.d.ts +1 -1
  190. package/lib/module/renderer/Container.js +2 -1
  191. package/lib/module/renderer/Container.js.map +1 -1
  192. package/lib/module/renderer/Offscreen.d.ts +1 -0
  193. package/lib/module/renderer/Offscreen.js +11 -3
  194. package/lib/module/renderer/Offscreen.js.map +1 -1
  195. package/lib/module/renderer/Reconciler.d.ts +1 -1
  196. package/lib/module/renderer/Reconciler.js +7 -4
  197. package/lib/module/renderer/Reconciler.js.map +1 -1
  198. package/lib/module/skia/types/Matrix4.d.ts +2 -2
  199. package/lib/module/skia/types/Matrix4.js.map +1 -1
  200. package/lib/module/skia/types/Shader/Shader.d.ts +1 -1
  201. package/lib/module/skia/types/Shader/Shader.js.map +1 -1
  202. package/lib/module/skia/web/JsiSkPath.d.ts +2 -2
  203. package/lib/module/skia/web/JsiSkPath.js +10 -2
  204. package/lib/module/skia/web/JsiSkPath.js.map +1 -1
  205. package/lib/module/views/SkiaJSDomView.d.ts +31 -0
  206. package/lib/module/views/SkiaJSDomView.js +136 -0
  207. package/lib/module/views/SkiaJSDomView.js.map +1 -0
  208. package/lib/module/views/SkiaJSDomView.web.d.ts +1 -0
  209. package/lib/module/views/SkiaJSDomView.web.js +2 -0
  210. package/lib/module/views/SkiaJSDomView.web.js.map +1 -0
  211. package/lib/typescript/src/dom/nodes/JsiSkDOM.d.ts +3 -2
  212. package/lib/typescript/src/external/reanimated/index.d.ts +1 -0
  213. package/lib/typescript/src/external/reanimated/moduleWrapper.d.ts +1 -0
  214. package/lib/typescript/src/external/reanimated/textures.d.ts +5 -0
  215. package/lib/typescript/src/renderer/Container.d.ts +1 -1
  216. package/lib/typescript/src/renderer/Offscreen.d.ts +1 -0
  217. package/lib/typescript/src/renderer/Reconciler.d.ts +1 -1
  218. package/lib/typescript/src/skia/types/Matrix4.d.ts +2 -2
  219. package/lib/typescript/src/skia/types/Shader/Shader.d.ts +1 -1
  220. package/lib/typescript/src/skia/web/JsiSkPath.d.ts +2 -2
  221. package/lib/typescript/src/views/SkiaJSDomView.d.ts +31 -0
  222. package/lib/typescript/src/views/SkiaJSDomView.web.d.ts +1 -0
  223. package/libs/android/arm64-v8a/libskia.a +0 -0
  224. package/libs/android/arm64-v8a/libskottie.a +0 -0
  225. package/libs/android/arm64-v8a/libskparagraph.a +0 -0
  226. package/libs/android/arm64-v8a/libsksg.a +0 -0
  227. package/libs/android/arm64-v8a/libskshaper.a +0 -0
  228. package/libs/android/arm64-v8a/libskunicode.a +0 -0
  229. package/libs/android/arm64-v8a/libsvg.a +0 -0
  230. package/libs/android/armeabi-v7a/libskia.a +0 -0
  231. package/libs/android/armeabi-v7a/libskottie.a +0 -0
  232. package/libs/android/armeabi-v7a/libskparagraph.a +0 -0
  233. package/libs/android/armeabi-v7a/libsksg.a +0 -0
  234. package/libs/android/armeabi-v7a/libskshaper.a +0 -0
  235. package/libs/android/armeabi-v7a/libskunicode.a +0 -0
  236. package/libs/android/armeabi-v7a/libsvg.a +0 -0
  237. package/libs/android/x86/libskia.a +0 -0
  238. package/libs/android/x86/libskottie.a +0 -0
  239. package/libs/android/x86/libskparagraph.a +0 -0
  240. package/libs/android/x86/libsksg.a +0 -0
  241. package/libs/android/x86/libskshaper.a +0 -0
  242. package/libs/android/x86/libskunicode.a +0 -0
  243. package/libs/android/x86/libsvg.a +0 -0
  244. package/libs/android/x86_64/libskia.a +0 -0
  245. package/libs/android/x86_64/libskottie.a +0 -0
  246. package/libs/android/x86_64/libskparagraph.a +0 -0
  247. package/libs/android/x86_64/libsksg.a +0 -0
  248. package/libs/android/x86_64/libskshaper.a +0 -0
  249. package/libs/android/x86_64/libskunicode.a +0 -0
  250. package/libs/android/x86_64/libsvg.a +0 -0
  251. package/libs/ios/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
  252. package/libs/ios/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
  253. package/libs/ios/libskottie.xcframework/ios-arm64_arm64e/libskottie.a +0 -0
  254. package/libs/ios/libskottie.xcframework/ios-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
  255. package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e/libskparagraph.a +0 -0
  256. package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e_x86_64-simulator/libskparagraph.a +0 -0
  257. package/libs/ios/libsksg.xcframework/ios-arm64_arm64e/libsksg.a +0 -0
  258. package/libs/ios/libsksg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
  259. package/libs/ios/libskshaper.xcframework/Info.plist +5 -5
  260. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
  261. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
  262. package/libs/ios/libskunicode.xcframework/ios-arm64_arm64e/libskunicode.a +0 -0
  263. package/libs/ios/libskunicode.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode.a +0 -0
  264. package/libs/ios/libsvg.xcframework/Info.plist +5 -5
  265. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
  266. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
  267. package/package.json +1 -1
  268. package/src/dom/nodes/JsiSkDOM.ts +55 -56
  269. package/src/external/reanimated/index.ts +1 -0
  270. package/src/external/reanimated/interpolators.ts +17 -3
  271. package/src/external/reanimated/moduleWrapper.ts +1 -0
  272. package/src/external/reanimated/textures.tsx +50 -0
  273. package/src/headless/index.ts +1 -1
  274. package/src/mock/index.ts +3 -0
  275. package/src/renderer/Canvas.tsx +4 -3
  276. package/src/renderer/Container.tsx +3 -2
  277. package/src/renderer/Offscreen.tsx +12 -3
  278. package/src/renderer/Reconciler.tsx +5 -2
  279. package/src/skia/types/Matrix4.ts +2 -2
  280. package/src/skia/types/Shader/Shader.ts +6 -1
  281. package/src/skia/web/JsiSkPath.ts +23 -3
  282. package/src/views/SkiaJSDomView.tsx +126 -0
  283. package/src/views/SkiaJSDomView.web.tsx +1 -0
  284. package/android/cpp/jni/include/JniSkiaDrawView.h +0 -90
  285. package/cpp/rnskia/RNSkJsView.cpp +0 -236
  286. package/cpp/rnskia/RNSkJsView.h +0 -121
  287. package/cpp/skia/include/gpu/GrSurfaceInfo.h +0 -142
  288. package/cpp/skia/include/private/gpu/ganesh/GrGLTypesPriv.h +0 -107
  289. package/cpp/skia/include/private/gpu/ganesh/GrMockTypesPriv.h +0 -32
  290. package/cpp/skia/include/private/gpu/ganesh/GrMtlTypesPriv.h +0 -83
  291. package/cpp/skia/include/private/gpu/ganesh/GrVkTypesPriv.h +0 -47
  292. package/cpp/skia/include/private/gpu/vk/VulkanTypesPriv.h +0 -57
  293. package/cpp/skia/include/utils/SkBase64.h +0 -53
  294. package/cpp/skia/modules/skcms/skcms_internal.h +0 -56
@@ -0,0 +1,30 @@
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 GrVkDirectContext_DEFINED
9
+ #define GrVkDirectContext_DEFINED
10
+
11
+ #include "include/core/SkRefCnt.h"
12
+ #include "include/private/base/SkAPI.h"
13
+
14
+ class GrDirectContext;
15
+ struct GrContextOptions;
16
+ struct GrVkBackendContext;
17
+
18
+ namespace GrDirectContexts {
19
+ /**
20
+ * The Vulkan context (VkQueue, VkDevice, VkInstance) must be kept alive until the returned
21
+ * GrDirectContext is destroyed. This also means that any objects created with this
22
+ * GrDirectContext (e.g. SkSurfaces, SkImages, etc.) must also be released as they may hold
23
+ * refs on the GrDirectContext. Once all these objects and the GrDirectContext are released,
24
+ * then it is safe to delete the vulkan objects.
25
+ */
26
+ SK_API sk_sp<GrDirectContext> MakeVulkan(const GrVkBackendContext&, const GrContextOptions&);
27
+ SK_API sk_sp<GrDirectContext> MakeVulkan(const GrVkBackendContext&);
28
+ }
29
+
30
+ #endif
@@ -268,7 +268,7 @@ public:
268
268
  if (fn_ptr) {
269
269
  memcpy(fBuf, &fn_ptr, sizeof(fn_ptr));
270
270
  fCall = [](const void* buf, Args... args) {
271
- return (*(Fn**)buf)(std::forward<Args>(args)...);
271
+ return (*(Fn* const *)buf)(std::forward<Args>(args)...);
272
272
  };
273
273
  }
274
274
  }
@@ -18,6 +18,7 @@ typedef void(*GrGLFuncPtr)();
18
18
  struct GrGLInterface;
19
19
 
20
20
 
21
+ #if !defined(SK_DISABLE_LEGACY_GL_MAKE_NATIVE_INTERFACE)
21
22
  /**
22
23
  * Rather than depend on platform-specific GL headers and libraries, we require
23
24
  * the client to provide a struct of GL function pointers. This struct can be
@@ -31,6 +32,7 @@ struct GrGLInterface;
31
32
  * appropriate one to build.
32
33
  */
33
34
  SK_API sk_sp<const GrGLInterface> GrGLMakeNativeInterface();
35
+ #endif
34
36
 
35
37
  /**
36
38
  * GrContext uses the following interface to make all calls into OpenGL. When a
@@ -11,4 +11,10 @@
11
11
 
12
12
  struct GrGLInterface;
13
13
 
14
+ namespace GrGLInterfaces {
15
+ sk_sp<const GrGLInterface> MakeGLX();
16
+ }
17
+
18
+ #if !defined(SK_DISABLE_LEGACY_GLXINTERFACE_FACTORY)
14
19
  sk_sp<const GrGLInterface> GrGLMakeGLXInterface();
20
+ #endif
@@ -26,7 +26,7 @@ public:
26
26
  BackendSemaphore();
27
27
  #ifdef SK_METAL
28
28
  // TODO: Determine creator's responsibility for setting refcnt.
29
- BackendSemaphore(MtlHandle mtlEvent, uint64_t value);
29
+ BackendSemaphore(CFTypeRef mtlEvent, uint64_t value);
30
30
  #endif
31
31
 
32
32
  #ifdef SK_VULKAN
@@ -43,7 +43,7 @@ public:
43
43
  BackendApi backend() const { return fBackend; }
44
44
 
45
45
  #ifdef SK_METAL
46
- MtlHandle getMtlEvent() const;
46
+ CFTypeRef getMtlEvent() const;
47
47
  uint64_t getMtlValue() const;
48
48
  #endif
49
49
 
@@ -59,7 +59,7 @@ private:
59
59
  #endif
60
60
  #ifdef SK_METAL
61
61
  struct {
62
- MtlHandle fMtlEvent; // Expected to be an id<MTLEvent>
62
+ CFTypeRef fMtlEvent; // Expected to be an id<MTLEvent>
63
63
  uint64_t fMtlValue;
64
64
  };
65
65
  #endif
@@ -28,7 +28,6 @@
28
28
 
29
29
  namespace skgpu {
30
30
  class MutableTextureState;
31
- class MutableTextureStateRef;
32
31
  }
33
32
 
34
33
  namespace skgpu::graphite {
@@ -37,33 +36,46 @@ class SK_API BackendTexture {
37
36
  public:
38
37
  BackendTexture();
39
38
  #ifdef SK_DAWN
40
- // Create a BackendTexture from a WGPUTexture. Texture info will be
41
- // queried from the texture. Comparing to WGPUTextureView,
42
- // SkImage::readPixels(), SkSurface::readPixels() and
43
- // SkSurface::writePixels() are implemented by direct buffer copy. They
44
- // should be more efficient. For WGPUTextureView, those methods will use
45
- // create an intermediate WGPUTexture, and use it to transfer pixels.
46
- // Note:
47
- // - for better performance, using WGPUTexture IS RECOMMENDED.
48
- // - The BackendTexture will not call retain or release on the passed in
49
- // WGPUTexture. Thus the client must keep the WGPUTexture valid until
50
- // they are no longer using the BackendTexture.
39
+ // Create a BackendTexture from a WGPUTexture. Texture info will be queried from the texture.
40
+ //
41
+ // This is the recommended way of specifying a BackendTexture for Dawn. See the note below on
42
+ // the constructor that takes a WGPUTextureView for a fuller explanation.
43
+ //
44
+ // The BackendTexture will not call retain or release on the passed in WGPUTexture. Thus, the
45
+ // client must keep the WGPUTexture valid until they are no longer using the BackendTexture.
46
+ // However, any SkImage or SkSurface that wraps the BackendTexture *will* retain and release
47
+ // the WGPUTexture.
51
48
  BackendTexture(WGPUTexture texture);
49
+
50
+ // Create a BackendTexture from a WGPUTexture. Texture planeDimensions, plane aspect and
51
+ // info have to be provided. This is intended to be used only when accessing a plane
52
+ // of a WGPUTexture.
53
+ //
54
+ // The BackendTexture will not call retain or release on the passed in WGPUTexture. Thus, the
55
+ // client must keep the WGPUTexture valid until they are no longer using the BackendTexture.
56
+ // However, any SkImage or SkSurface that wraps the BackendTexture *will* retain and release
57
+ // the WGPUTexture.
58
+ BackendTexture(SkISize planeDimensions, const DawnTextureInfo& info, WGPUTexture texture);
59
+
52
60
  // Create a BackendTexture from a WGPUTextureView. Texture dimensions and
53
61
  // info have to be provided.
54
- // Note:
55
- // - this method is for importing WGPUTextureView from wgpu::SwapChain only.
56
- // - The BackendTexture will not call retain or release on the passed in
57
- // WGPUTextureView. Thus the client must keep the WGPUTextureView valid
58
- // until they are no longer using the BackendTexture.
59
- BackendTexture(SkISize dimensions,
60
- const DawnTextureInfo& info,
61
- WGPUTextureView textureView);
62
+ //
63
+ // Using a WGPUTextureView rather than a WGPUTexture is less effecient for operations that
64
+ // require buffer transfers to or from the texture (e.g. methods on graphite::Context that read
65
+ // pixels or SkSurface::writePixels). In such cases an intermediate copy to or from a
66
+ // WGPUTexture is required. Thus, it is recommended to use this functionality only for cases
67
+ // where a WGPUTexture is unavailable, in particular when using wgpu::SwapChain.
68
+ //
69
+ // The BackendTexture will not call retain or release on the passed in WGPUTextureView. Thus,
70
+ // the client must keep the WGPUTextureView valid until they are no longer using the
71
+ // BackendTexture. However, any SkImage or SkSurface that wraps the BackendTexture *will* retain
72
+ // and release the WGPUTextureView.
73
+ BackendTexture(SkISize dimensions, const DawnTextureInfo& info, WGPUTextureView textureView);
62
74
  #endif
63
75
  #ifdef SK_METAL
64
- // The BackendTexture will not call retain or release on the passed in MtlHandle. Thus the
65
- // client must keep the MtlHandle valid until they are no longer using the BackendTexture.
66
- BackendTexture(SkISize dimensions, MtlHandle mtlTexture);
76
+ // The BackendTexture will not call retain or release on the passed in CFTypeRef. Thus the
77
+ // client must keep the CFTypeRef valid until they are no longer using the BackendTexture.
78
+ BackendTexture(SkISize dimensions, CFTypeRef mtlTexture);
67
79
  #endif
68
80
 
69
81
  #ifdef SK_VULKAN
@@ -103,7 +115,7 @@ public:
103
115
  WGPUTextureView getDawnTextureViewPtr() const;
104
116
  #endif
105
117
  #ifdef SK_METAL
106
- MtlHandle getMtlTexture() const;
118
+ CFTypeRef getMtlTexture() const;
107
119
  #endif
108
120
 
109
121
  #ifdef SK_VULKAN
@@ -115,12 +127,12 @@ public:
115
127
 
116
128
  private:
117
129
  friend class VulkanResourceProvider; // for getMutableState
118
- sk_sp<MutableTextureStateRef> getMutableState() const;
130
+ sk_sp<MutableTextureState> getMutableState() const;
119
131
 
120
132
  SkISize fDimensions;
121
133
  TextureInfo fInfo;
122
134
 
123
- sk_sp<MutableTextureStateRef> fMutableState;
135
+ sk_sp<MutableTextureState> fMutableState;
124
136
 
125
137
  #ifdef SK_VULKAN
126
138
  // fMemoryAlloc == VulkanAlloc() if the client has already created their own VkImage and
@@ -137,7 +149,7 @@ private:
137
149
  };
138
150
  #endif
139
151
  #ifdef SK_METAL
140
- MtlHandle fMtlTexture;
152
+ CFTypeRef fMtlTexture;
141
153
  #endif
142
154
  #ifdef SK_VULKAN
143
155
  VkImage fVkImage = VK_NULL_HANDLE;
@@ -22,6 +22,7 @@
22
22
 
23
23
  class SkColorSpace;
24
24
  class SkRuntimeEffect;
25
+ class SkTraceMemoryDump;
25
26
 
26
27
  namespace skgpu::graphite {
27
28
 
@@ -55,6 +56,9 @@ public:
55
56
  bool insertRecording(const InsertRecordingInfo&);
56
57
  bool submit(SyncToCpu = SyncToCpu::kNo);
57
58
 
59
+ /** Returns true if there is work that was submitted to the GPU that has not finished. */
60
+ bool hasUnfinishedGpuWork() const;
61
+
58
62
  void asyncRescaleAndReadPixels(const SkImage* image,
59
63
  const SkImageInfo& dstImageInfo,
60
64
  const SkIRect& srcRect,
@@ -142,6 +146,22 @@ public:
142
146
  */
143
147
  void performDeferredCleanup(std::chrono::milliseconds msNotUsed);
144
148
 
149
+ /**
150
+ * Returns the number of bytes of gpu memory currently budgeted in the Context's cache.
151
+ */
152
+ size_t currentBudgetedBytes() const;
153
+
154
+ /**
155
+ * Enumerates all cached GPU resources owned by the Context and dumps their memory to
156
+ * traceMemoryDump.
157
+ */
158
+ void dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const;
159
+
160
+ /*
161
+ * Does this context support protected content?
162
+ */
163
+ bool supportsProtectedContent() const;
164
+
145
165
  // Provides access to functions that aren't part of the public API.
146
166
  ContextPriv priv();
147
167
  const ContextPriv priv() const; // NOLINT(readability-const-return-type)
@@ -172,6 +192,21 @@ private:
172
192
  friend class ContextPriv;
173
193
  friend class ContextCtorAccessor;
174
194
 
195
+ struct PixelTransferResult {
196
+ using ConversionFn = void(void* dst, const void* mappedBuffer);
197
+ // If null then the transfer could not be performed. Otherwise this buffer will contain
198
+ // the pixel data when the transfer is complete.
199
+ sk_sp<Buffer> fTransferBuffer;
200
+ // Size of the read.
201
+ SkISize fSize;
202
+ // RowBytes for transfer buffer data
203
+ size_t fRowBytes;
204
+ // If this is null then the transfer buffer will contain the data in the requested
205
+ // color type. Otherwise, when the transfer is done this must be called to convert
206
+ // from the transfer buffer's color type to the requested color type.
207
+ std::function<ConversionFn> fPixelConverter;
208
+ };
209
+
175
210
  SingleOwner* singleOwner() const { return &fSingleOwner; }
176
211
 
177
212
  // Must be called in Make() to handle one-time GPU setup operations that can possibly fail and
@@ -204,19 +239,11 @@ private:
204
239
  SkImage::ReadPixelsCallback callback,
205
240
  SkImage::ReadPixelsContext context);
206
241
 
242
+ void finalizeAsyncReadPixels(SkSpan<PixelTransferResult>,
243
+ SkImage::ReadPixelsCallback callback,
244
+ SkImage::ReadPixelsContext callbackContext);
245
+
207
246
  // Inserts a texture to buffer transfer task, used by asyncReadPixels methods
208
- struct PixelTransferResult {
209
- using ConversionFn = void(void* dst, const void* mappedBuffer);
210
- // If null then the transfer could not be performed. Otherwise this buffer will contain
211
- // the pixel data when the transfer is complete.
212
- sk_sp<Buffer> fTransferBuffer;
213
- // RowBytes for transfer buffer data
214
- size_t fRowBytes;
215
- // If this is null then the transfer buffer will contain the data in the requested
216
- // color type. Otherwise, when the transfer is done this must be called to convert
217
- // from the transfer buffer's color type to the requested color type.
218
- std::function<ConversionFn> fPixelConverter;
219
- };
220
247
  PixelTransferResult transferPixels(const TextureProxy*,
221
248
  const SkImageInfo& srcImageInfo,
222
249
  const SkColorInfo& dstColorInfo,
@@ -226,7 +253,6 @@ private:
226
253
  std::unique_ptr<ResourceProvider> fResourceProvider;
227
254
  std::unique_ptr<QueueManager> fQueueManager;
228
255
  std::unique_ptr<ClientMappedBufferManager> fMappedBufferManager;
229
- std::unique_ptr<PlotUploadTracker> fPlotUploadTracker;
230
256
 
231
257
  // In debug builds we guard against improper thread handling. This guard is passed to the
232
258
  // ResourceCache for the Context.
@@ -80,6 +80,8 @@ struct SK_API ContextOptions {
80
80
  /**
81
81
  * Disable caching of glyph uploads at the start of each Recording. These can add additional
82
82
  * overhead and are only necessary if Recordings are replayed or played out of order.
83
+ *
84
+ * Deprecated, now only used to set requireOrderedRecordings Caps.
83
85
  */
84
86
  bool fDisableCachedGlyphUploads = false;
85
87
 
@@ -46,7 +46,8 @@ using GpuFinishedProc = void (*)(GpuFinishedContext finishedContext, CallbackRes
46
46
  *
47
47
  * The client may pass in two arrays of initialized BackendSemaphores to be included in the
48
48
  * command stream. At some time before issuing commands in the Recording, the fWaitSemaphores will
49
- * be waited on by the gpu. Similarly, at some time after issuing the Recording's commands, the
49
+ * be waited on by the gpu. We only guarantee these wait semaphores block transfer and fragment
50
+ * shader work. Similarly, at some time after issuing the Recording's commands, the
50
51
  * fSignalSemaphores will be signaled by the gpu. Depending on the platform, the timing of the wait
51
52
  * and signal operations will either be immediately before or after the given Recording's command
52
53
  * stream, respectively, or before and after the entire CommandBuffer's command stream. The
@@ -8,6 +8,7 @@
8
8
  #ifndef skgpu_graphite_Image_DEFINED
9
9
  #define skgpu_graphite_Image_DEFINED
10
10
 
11
+ #include "include/core/SkColorSpace.h"
11
12
  #include "include/core/SkImage.h"
12
13
  #include "include/core/SkRefCnt.h"
13
14
  #include "include/core/SkSpan.h"
@@ -45,7 +46,8 @@ using GraphitePromiseImageYUVAFulfillProc =
45
46
  using GraphitePromiseImageReleaseProc = void (*)(GraphitePromiseImageContext);
46
47
  using GraphitePromiseTextureReleaseProc = void (*)(GraphitePromiseTextureReleaseContext);
47
48
 
48
- /** Creates an SkImage from a GPU texture associated with the recorder.
49
+ /** Creates an SkImage from a GPU texture associated with the recorder. The client is still
50
+ responsible for managing the backend texture's lifetime.
49
51
 
50
52
  SkImage is returned if the format of backendTexture is recognized and supported.
51
53
  Recognized formats vary by GPU back-end.
@@ -63,57 +65,77 @@ using GraphitePromiseTextureReleaseProc = void (*)(GraphitePromiseTextureRelease
63
65
  BottomLeft
64
66
  @return created SkImage, or nullptr
65
67
  */
66
- SK_API sk_sp<SkImage> AdoptTextureFrom(skgpu::graphite::Recorder*,
67
- const skgpu::graphite::BackendTexture&,
68
+ SK_API sk_sp<SkImage> WrapTexture(skgpu::graphite::Recorder*,
69
+ const skgpu::graphite::BackendTexture&,
70
+ SkColorType colorType,
71
+ SkAlphaType alphaType,
72
+ sk_sp<SkColorSpace> colorSpace,
73
+ skgpu::Origin origin,
74
+ TextureReleaseProc = nullptr,
75
+ ReleaseContext = nullptr);
76
+
77
+ SK_API sk_sp<SkImage> WrapTexture(skgpu::graphite::Recorder*,
78
+ const skgpu::graphite::BackendTexture&,
79
+ SkColorType colorType,
80
+ SkAlphaType alphaType,
81
+ sk_sp<SkColorSpace> colorSpace,
82
+ TextureReleaseProc = nullptr,
83
+ ReleaseContext = nullptr);
84
+
85
+ #if !defined(SK_DISABLE_LEGACY_GRAPHITE_IMAGES)
86
+ inline sk_sp<SkImage> AdoptTextureFrom(skgpu::graphite::Recorder* recorder,
87
+ const skgpu::graphite::BackendTexture& tex,
68
88
  SkColorType colorType,
69
89
  SkAlphaType alphaType,
70
90
  sk_sp<SkColorSpace> colorSpace,
71
91
  skgpu::Origin origin,
72
- TextureReleaseProc = nullptr,
73
- ReleaseContext = nullptr);
92
+ TextureReleaseProc trProc = nullptr,
93
+ ReleaseContext ctx = nullptr) {
94
+ return WrapTexture(recorder, tex, colorType, alphaType, colorSpace, origin, trProc, ctx);
95
+ }
74
96
 
75
- SK_API sk_sp<SkImage> AdoptTextureFrom(skgpu::graphite::Recorder*,
76
- const skgpu::graphite::BackendTexture&,
97
+ inline sk_sp<SkImage> AdoptTextureFrom(skgpu::graphite::Recorder* recorder,
98
+ const skgpu::graphite::BackendTexture& tex,
77
99
  SkColorType colorType,
78
100
  SkAlphaType alphaType,
79
101
  sk_sp<SkColorSpace> colorSpace,
80
- TextureReleaseProc = nullptr,
81
- ReleaseContext = nullptr);
82
-
83
- /** Create a new SkImage that is very similar to an SkImage created by
84
- AdoptTextureFrom. The difference is that the caller need not have created the
85
- backend texture nor populated it with data when creating the image. Instead of passing a
86
- BackendTexture to the factory the client supplies a description of the texture consisting
87
- of dimensions, TextureInfo, SkColorInfo and Volatility.
88
-
89
- In general, 'fulfill' must return a BackendTexture that matches the properties
90
- provided at SkImage creation time. The BackendTexture must refer to a valid existing
91
- texture in the backend API context/device, and already be populated with data.
92
- The texture cannot be deleted until 'textureRelease' is called. 'textureRelease' will
93
- be called with the textureReleaseContext returned by 'fulfill'.
94
-
95
- Wrt when and how often the fulfill, imageRelease, and textureRelease callbacks will
96
- be called:
97
-
98
- For non-volatile promise images, 'fulfill' will be called at Context::insertRecording
99
- time. Regardless of whether 'fulfill' succeeded or failed, 'imageRelease' will always be
100
- called only once - when Skia will no longer try calling 'fulfill' to get a backend
101
- texture. If 'fulfill' failed (i.e., it didn't return a valid backend texture) then
102
- 'textureRelease' will never be called. If 'fulfill' was successful then
103
- 'textureRelease' will be called only once when the GPU is done with the contents of the
104
- promise image. This will usually occur during a Context::submit call but it could occur
105
- earlier due to error conditions. 'fulfill' can be called multiple times if the promise
106
- image is used in multiple recordings. If 'fulfill' fails, the insertRecording itself will
107
- fail. Subsequent insertRecording calls (with Recordings that use the promise image) will
108
- keep calling 'fulfill' until it succeeds.
109
-
110
- For volatile promise images, 'fulfill' will be called each time the Recording is inserted
111
- into a Context. Regardless of whether 'fulfill' succeeded or failed, 'imageRelease'
112
- will always be called only once just like the non-volatile case. If 'fulfill' fails at
113
- insertRecording-time, 'textureRelease' will never be called. If 'fulfill' was successful
114
- then a 'textureRelease' matching that 'fulfill' will be called when the GPU is done with
115
- the contents of the promise image. This will usually occur during a Context::submit call
116
- but it could occur earlier due to error conditions.
102
+ TextureReleaseProc trProc = nullptr,
103
+ ReleaseContext ctx = nullptr) {
104
+ return WrapTexture(recorder, tex, colorType, alphaType, colorSpace, trProc, ctx);
105
+ }
106
+ #endif
107
+
108
+ /** Create a new SkImage that is very similar to an SkImage created by WrapTexture. The difference
109
+ is that the caller need not have created the backend texture nor populated it with data when
110
+ creating the image. Instead of passing a BackendTexture to the factory the client supplies a
111
+ description of the texture consisting of dimensions, TextureInfo, SkColorInfo and Volatility.
112
+
113
+ In general, 'fulfill' must return a BackendTexture that matches the properties provided at
114
+ SkImage creation time. The BackendTexture must refer to a valid existing texture in the backend
115
+ API context/device, and already be populated with data. The texture cannot be deleted until
116
+ 'textureRelease' is called. 'textureRelease' will be called with the textureReleaseContext
117
+ returned by 'fulfill'.
118
+
119
+ Wrt when and how often the fulfill, imageRelease, and textureRelease callbacks will be called:
120
+
121
+ For non-volatile promise images, 'fulfill' will be called at Context::insertRecording time.
122
+ Regardless of whether 'fulfill' succeeded or failed, 'imageRelease' will always be called only
123
+ once - when Skia will no longer try calling 'fulfill' to get a backend texture. If 'fulfill'
124
+ failed (i.e., it didn't return a valid backend texture) then 'textureRelease' will never be
125
+ called. If 'fulfill' was successful then 'textureRelease' will be called only once when the GPU
126
+ is done with the contents of the promise image. This will usually occur during a Context::submit
127
+ call but it could occur earlier due to error conditions. 'fulfill' can be called multiple times
128
+ if the promise image is used in multiple recordings. If 'fulfill' fails, the insertRecording
129
+ itself will fail. Subsequent insertRecording calls (with Recordings that use the promise image)
130
+ will keep calling 'fulfill' until it succeeds.
131
+
132
+ For volatile promise images, 'fulfill' will be called each time the Recording is inserted into a
133
+ Context. Regardless of whether 'fulfill' succeeded or failed, 'imageRelease' will always be
134
+ called only once just like the non-volatile case. If 'fulfill' fails at insertRecording-time,
135
+ 'textureRelease' will never be called. If 'fulfill' was successful then a 'textureRelease'
136
+ matching that 'fulfill' will be called when the GPU is done with the contents of the promise
137
+ image. This will usually occur during a Context::submit call but it could occur earlier due to
138
+ error conditions.
117
139
 
118
140
  @param recorder the recorder that will capture the commands creating the image
119
141
  @param dimensions width & height of promised gpu texture
@@ -150,16 +172,16 @@ SK_API sk_sp<SkImage> PromiseTextureFrom(skgpu::graphite::Recorder*,
150
172
  GraphitePromiseImageContext);
151
173
 
152
174
  /** This is similar to 'PromiseTextureFrom' but it creates a GPU-backed SkImage from YUV[A] data.
153
- The source data may be planar (i.e. spread across multiple textures). In
154
- the extreme Y, U, V, and A are all in different planes and thus the image is specified by
155
- four textures. 'backendTextureInfo' describes the planar arrangement, texture formats,
156
- and conversion to RGB. Separate 'fulfill' and 'textureRelease' calls are made for each texture.
157
- Each texture has its own GraphitePromiseTextureContext. The GraphitePromiseImageReleaseProc
158
- will be made even on failure. 'textureContexts' has one entry for each of the up to four
159
- textures, as indicated by 'backendTextureInfo'. Currently the mipmapped property of
160
- 'backendTextureInfo' is ignored. However, in the near future it will be required that if it is
161
- kYes then the fulfillProc must return a mip mapped texture for each plane in order to
162
- successfully draw the image.
175
+ The source data may be planar (i.e. spread across multiple textures). In the extreme Y, U, V,
176
+ and A are all in different planes and thus the image is specified by four textures.
177
+ 'backendTextureInfo' describes the planar arrangement, texture formats, and conversion to RGB.
178
+ Separate 'fulfill' and 'textureRelease' calls are made for each texture. Each texture has its
179
+ own GraphitePromiseTextureContext. The GraphitePromiseImageReleaseProc will be made even on
180
+ failure. 'textureContexts' has one entry for each of the up to four textures, as indicated by
181
+ 'backendTextureInfo'. Currently the mipmapped property of 'backendTextureInfo' is ignored.
182
+ However, in the near future it will be required that if it is kYes then the fulfillProc must
183
+ return a mip mapped texture for each plane in order to successfully draw the image.
184
+
163
185
  @param recorder the recorder that will capture the commands creating the image
164
186
  @param backendTextureInfo info about the promised yuva gpu texture(s)
165
187
  @param imageColorSpace range of colors; may be nullptr
@@ -184,19 +206,19 @@ SK_API sk_sp<SkImage> PromiseTextureFromYUVA(skgpu::graphite::Recorder*,
184
206
  GraphitePromiseTextureContext textureContexts[]);
185
207
 
186
208
 
187
- /** Returns an SkImage backed by a Graphite texture, using the provided Recorder for creation
188
- and uploads if necessary. The returned SkImage respects the required image properties'
189
- mipmap setting for non-Graphite SkImages; i.e., if mipmapping is required, the backing
190
- Graphite texture will have allocated mip map levels.
209
+ /** Returns an SkImage backed by a Graphite texture, using the provided Recorder for creation and
210
+ uploads if necessary. The returned SkImage respects the required image properties' mipmap
211
+ setting for non-Graphite SkImages; i.e., if mipmapping is required, the backing Graphite texture
212
+ will have allocated mip map levels.
191
213
 
192
214
  It is assumed that MIP maps are always supported by the GPU.
193
215
 
194
- Returns original SkImage if the image is already Graphite-backed and the required mipmapping
195
- is compatible with the backing Graphite texture. If the required mipmapping is not
196
- compatible, nullptr will be returned.
216
+ Returns original SkImage if the image is already Graphite-backed and the required mipmapping is
217
+ compatible with the backing Graphite texture. If the required mipmapping is not compatible,
218
+ nullptr will be returned.
197
219
 
198
- Returns nullptr if no Recorder is provided, or if SkImage was created with another
199
- Recorder and work on that Recorder has not been submitted.
220
+ Returns nullptr if no Recorder is provided, or if SkImage was created with another Recorder and
221
+ work on that Recorder has not been submitted.
200
222
 
201
223
  @param Recorder the Recorder to use for storing commands
202
224
  @param RequiredProperties properties the returned SkImage must possess (e.g. mipmaps)
@@ -207,20 +229,19 @@ SK_API sk_sp<SkImage> TextureFromImage(skgpu::graphite::Recorder*,
207
229
  SkImage::RequiredProperties = {});
208
230
 
209
231
  inline sk_sp<SkImage> TextureFromImage(skgpu::graphite::Recorder* r,
210
- sk_sp<const SkImage> img,
232
+ const sk_sp<const SkImage>& img,
211
233
  SkImage::RequiredProperties props = {}) {
212
234
  return TextureFromImage(r, img.get(), props);
213
235
  }
214
236
 
215
237
  /** Creates SkImage from SkYUVAPixmaps.
216
238
 
217
- The image will remain planar with each plane converted to a texture using the passed
218
- Recorder.
239
+ The image will remain planar with each plane converted to a texture using the passed Recorder.
219
240
 
220
- SkYUVAPixmaps has a SkYUVAInfo which specifies the transformation from YUV to RGB.
221
- The SkColorSpace of the resulting RGB values is specified by imgColorSpace. This will
222
- be the SkColorSpace reported by the image and when drawn the RGB values will be converted
223
- from this space into the destination space (if the destination is tagged).
241
+ SkYUVAPixmaps has a SkYUVAInfo which specifies the transformation from YUV to RGB. The
242
+ SkColorSpace of the resulting RGB values is specified by imgColorSpace. This will be the
243
+ SkColorSpace reported by the image and when drawn the RGB values will be converted from this
244
+ space into the destination space (if the destination is tagged).
224
245
 
225
246
  This is only supported using the GPU backend and will fail if recorder is nullptr.
226
247
 
@@ -259,10 +280,10 @@ SK_API sk_sp<SkImage> TextureFromYUVATextures(
259
280
 
260
281
  /** Creates an SkImage from YUV[A] planar SkImages associated with the recorder.
261
282
 
262
- The images should have kGraphite type, and the result will be nullptr if any are not.
263
- The resulting SkImage will not take a ref on the given SkImages but will take a ref on
264
- the underlying TextureProxies. The releaseProcs, if any, for those Textures will be the
265
- ones set when the given SkImages were created.
283
+ The images should have kGraphite type, and the result will be nullptr if any are not. The
284
+ resulting SkImage will not take a ref on the given SkImages but will take a ref on the
285
+ underlying TextureProxies. The releaseProcs, if any, for those Textures will be the ones set
286
+ when the given SkImages were created.
266
287
 
267
288
  @param recorder The recorder.
268
289
  @param yuvaInfo Structure describing the YUVA format
@@ -297,19 +318,17 @@ SK_API sk_sp<SkImage> SubsetTextureFrom(skgpu::graphite::Recorder* recorder,
297
318
  SkImage::RequiredProperties props = {});
298
319
 
299
320
  /** Creates a filtered SkImage on the GPU. filter processes the src image, potentially changing
300
- color, position, and size. subset is the bounds of src that are processed
301
- by filter. clipBounds is the expected bounds of the filtered SkImage. outSubset
302
- is required storage for the actual bounds of the filtered SkImage. offset is
303
- required storage for translation of returned SkImage.
304
-
305
- Returns nullptr if SkImage could not be created. If nullptr is returned, outSubset
306
- and offset are undefined.
307
-
308
- Useful for animation of SkImageFilter that varies size from frame to frame.
309
- Returned SkImage is created larger than required by filter so that GPU texture
310
- can be reused with different sized effects. outSubset describes the valid bounds
311
- of GPU texture returned. offset translates the returned SkImage to keep subsequent
312
- animation frames aligned with respect to each other.
321
+ color, position, and size. subset is the bounds of src that are processed by filter. clipBounds
322
+ is the expected bounds of the filtered SkImage. outSubset is required storage for the actual
323
+ bounds of the filtered SkImage. offset is required storage for translation of returned SkImage.
324
+
325
+ Returns nullptr if SkImage could not be created. If nullptr is returned, outSubset and offset
326
+ are undefined.
327
+
328
+ Useful for animation of SkImageFilter that varies size from frame to frame. Returned SkImage is
329
+ created larger than required by filter so that GPU texture can be reused with different sized
330
+ effects. outSubset describes the valid bounds of GPU texture returned. offset translates the
331
+ returned SkImage to keep subsequent animation frames aligned with respect to each other.
313
332
 
314
333
  @param recorder the recorder in which the filtering operation is to be performed
315
334
  @param filter how SkImage is sampled when transformed