@shopify/react-native-skia 0.1.233 → 0.1.236

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 (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
@@ -8,60 +8,41 @@
8
8
  #ifndef GrBackendSemaphore_DEFINED
9
9
  #define GrBackendSemaphore_DEFINED
10
10
 
11
- #include "include/gpu/GrTypes.h"
12
-
13
- #include "include/gpu/gl/GrGLTypes.h"
11
+ #include "include/gpu/GrTypes.h" // IWYU pragma: keep
12
+ #include "include/private/base/SkAPI.h"
13
+ #include "include/private/base/SkAnySubclass.h"
14
14
 
15
15
  #ifdef SK_METAL
16
16
  #include "include/gpu/mtl/GrMtlTypes.h"
17
17
  #endif
18
18
 
19
- #ifdef SK_VULKAN
20
- #include "include/gpu/vk/GrVkTypes.h"
19
+ #if defined(SK_VULKAN) && !defined(SK_DISABLE_LEGACY_VULKAN_BACKENDSEMAPHORE)
20
+ #include "include/private/gpu/vk/SkiaVulkan.h"
21
21
  #endif
22
22
 
23
23
  #ifdef SK_DIRECT3D
24
24
  #include "include/private/gpu/ganesh/GrD3DTypesMinimal.h"
25
25
  #endif
26
26
 
27
+ #include <cstddef>
28
+
29
+ class GrBackendSemaphoreData;
30
+
27
31
  /**
28
32
  * Wrapper class for passing into and receiving data from Ganesh about a backend semaphore object.
29
33
  */
30
- class GrBackendSemaphore {
34
+ class SK_API GrBackendSemaphore {
31
35
  public:
32
- // For convenience we just set the backend here to OpenGL. The GrBackendSemaphore cannot be used
33
- // until either init* is called, which will set the appropriate GrBackend.
34
- GrBackendSemaphore()
35
- : fBackend(GrBackendApi::kOpenGL), fGLSync(nullptr), fIsInitialized(false) {}
36
-
37
- #ifdef SK_DIRECT3D
38
- // We only need to specify these if Direct3D is enabled, because it requires special copy
39
- // characteristics.
36
+ // The GrBackendSemaphore cannot be used until either init* is called, which will set the
37
+ // appropriate GrBackend.
38
+ GrBackendSemaphore();
40
39
  ~GrBackendSemaphore();
41
40
  GrBackendSemaphore(const GrBackendSemaphore&);
42
41
  GrBackendSemaphore& operator=(const GrBackendSemaphore&);
43
- #endif
44
-
45
- void initGL(GrGLsync sync) {
46
- fBackend = GrBackendApi::kOpenGL;
47
- fGLSync = sync;
48
- fIsInitialized = true;
49
- }
50
-
51
- #ifdef SK_VULKAN
52
- void initVulkan(VkSemaphore semaphore) {
53
- fBackend = GrBackendApi::kVulkan;
54
- fVkSemaphore = semaphore;
55
-
56
- fIsInitialized = true;
57
- }
58
42
 
59
- VkSemaphore vkSemaphore() const {
60
- if (!fIsInitialized || GrBackendApi::kVulkan != fBackend) {
61
- return VK_NULL_HANDLE;
62
- }
63
- return fVkSemaphore;
64
- }
43
+ #if defined(SK_VULKAN) && !defined(SK_DISABLE_LEGACY_VULKAN_BACKENDSEMAPHORE)
44
+ void initVulkan(VkSemaphore semaphore);
45
+ VkSemaphore vkSemaphore() const;
65
46
  #endif
66
47
 
67
48
  #ifdef SK_METAL
@@ -100,30 +81,35 @@ public:
100
81
  #endif
101
82
 
102
83
  bool isInitialized() const { return fIsInitialized; }
103
-
104
- GrGLsync glSync() const {
105
- if (!fIsInitialized || GrBackendApi::kOpenGL != fBackend) {
106
- return nullptr;
107
- }
108
- return fGLSync;
109
- }
110
-
84
+ GrBackendApi backend() const { return fBackend; }
111
85
 
112
86
  #ifdef SK_DIRECT3D
113
87
  bool getD3DFenceInfo(GrD3DFenceInfo* outInfo) const;
114
88
  #endif
115
89
 
116
90
  private:
91
+ friend class GrBackendSemaphorePriv;
92
+ friend class GrBackendSemaphoreData;
93
+ // Size determined by looking at the GrBackendSemaphoreData subclasses, then
94
+ // guessing-and-checking. Compiler will complain if this is too small - in that case,
95
+ // just increase the number.
96
+ inline constexpr static size_t kMaxSubclassSize = 16;
97
+ using AnySemaphoreData = SkAnySubclass<GrBackendSemaphoreData, kMaxSubclassSize>;
98
+
99
+ template <typename SemaphoreData>
100
+ GrBackendSemaphore(GrBackendApi api, SemaphoreData data) : fBackend(api), fIsInitialized(true) {
101
+ fSemaphoreData.emplace<SemaphoreData>(data);
102
+ }
103
+
117
104
  #ifdef SK_DIRECT3D
118
105
  void assignD3DFenceInfo(const GrD3DFenceInfo& info);
119
106
  #endif
120
107
 
121
108
  GrBackendApi fBackend;
109
+ AnySemaphoreData fSemaphoreData;
110
+
122
111
  union {
123
- GrGLsync fGLSync;
124
- #ifdef SK_VULKAN
125
- VkSemaphore fVkSemaphore;
126
- #endif
112
+ void* fPlaceholder; // TODO(293490566)
127
113
  #ifdef SK_METAL
128
114
  GrMTLHandle fMtlEvent; // Expected to be an id<MTLEvent>
129
115
  #endif
@@ -25,7 +25,6 @@ class GrBackendRenderTargetData;
25
25
 
26
26
  namespace skgpu {
27
27
  class MutableTextureState;
28
- class MutableTextureStateRef;
29
28
  }
30
29
 
31
30
  #ifdef SK_METAL
@@ -290,7 +289,7 @@ private:
290
289
  }
291
290
 
292
291
  friend class GrVkGpu; // for getMutableState
293
- sk_sp<skgpu::MutableTextureStateRef> getMutableState() const;
292
+ sk_sp<skgpu::MutableTextureState> getMutableState() const;
294
293
 
295
294
  #ifdef SK_DIRECT3D
296
295
  friend class GrD3DTexture;
@@ -433,7 +432,7 @@ private:
433
432
  }
434
433
 
435
434
  friend class GrVkGpu; // for getMutableState
436
- sk_sp<skgpu::MutableTextureStateRef> getMutableState() const;
435
+ sk_sp<skgpu::MutableTextureState> getMutableState() const;
437
436
 
438
437
  #ifdef SK_DIRECT3D
439
438
  friend class GrD3DGpu;
@@ -20,7 +20,6 @@
20
20
 
21
21
  class SkExecutor;
22
22
 
23
- #if defined(SK_GANESH)
24
23
  struct SK_API GrContextOptions {
25
24
  enum class Enable {
26
25
  /** Forces an option to be disabled. */
@@ -371,10 +370,5 @@ struct SK_API GrContextOptions {
371
370
 
372
371
  GrDriverBugWorkarounds fDriverBugWorkarounds;
373
372
  };
374
- #else
375
- struct GrContextOptions {
376
- struct PersistentCache {};
377
- };
378
- #endif
379
373
 
380
374
  #endif
@@ -8,11 +8,8 @@
8
8
  #ifndef GrContextThreadSafeProxy_DEFINED
9
9
  #define GrContextThreadSafeProxy_DEFINED
10
10
 
11
- #include "include/core/SkRefCnt.h"
12
-
13
- #if defined(SK_GANESH)
14
-
15
11
  #include "include/core/SkImageInfo.h"
12
+ #include "include/core/SkRefCnt.h"
16
13
  #include "include/gpu/GpuTypes.h"
17
14
  #include "include/gpu/GrContextOptions.h"
18
15
  #include "include/gpu/GrTypes.h"
@@ -34,9 +31,9 @@ namespace sktext::gpu { class TextBlobRedrawCoordinator; }
34
31
  * Can be used to perform actions related to the generating GrContext in a thread safe manner. The
35
32
  * proxy does not access the 3D API (e.g. OpenGL) that backs the generating GrContext.
36
33
  */
37
- class SK_API GrContextThreadSafeProxy final : public SkNVRefCnt<GrContextThreadSafeProxy> {
34
+ class SK_API GrContextThreadSafeProxy : public SkNVRefCnt<GrContextThreadSafeProxy> {
38
35
  public:
39
- ~GrContextThreadSafeProxy();
36
+ virtual ~GrContextThreadSafeProxy();
40
37
 
41
38
  /**
42
39
  * Create a surface characterization for a DDL that will be replayed into the GrContext
@@ -68,7 +65,7 @@ public:
68
65
  * @param surfaceProps The surface properties of the SkSurface that the DDL
69
66
  * created with this characterization will be replayed
70
67
  * into
71
- * @param isMipMapped Will the surface the DDL will be replayed into have
68
+ * @param isMipmapped Will the surface the DDL will be replayed into have
72
69
  * space allocated for mipmaps?
73
70
  * @param willUseGLFBO0 Will the surface the DDL will be replayed into be
74
71
  * backed by GL FBO 0. This flag is only valid if using
@@ -81,24 +78,39 @@ public:
81
78
  * command buffer via a GrVkSecondaryCBDrawContext? If
82
79
  * this is true then the following is required:
83
80
  * isTexureable = false
84
- * isMipMapped = false
81
+ * isMipmapped = false
85
82
  * willUseGLFBO0 = false
86
83
  * vkRTSupportsInputAttachment = false
87
84
  */
88
85
  GrSurfaceCharacterization createCharacterization(
89
- size_t cacheMaxResourceBytes,
90
- const SkImageInfo& ii,
91
- const GrBackendFormat& backendFormat,
92
- int sampleCount,
93
- GrSurfaceOrigin origin,
94
- const SkSurfaceProps& surfaceProps,
95
- bool isMipMapped,
96
- bool willUseGLFBO0 = false,
97
- bool isTextureable = true,
98
- GrProtected isProtected = GrProtected::kNo,
99
- bool vkRTSupportsInputAttachment = false,
100
- bool forVulkanSecondaryCommandBuffer = false);
101
-
86
+ size_t cacheMaxResourceBytes,
87
+ const SkImageInfo& ii,
88
+ const GrBackendFormat& backendFormat,
89
+ int sampleCount,
90
+ GrSurfaceOrigin origin,
91
+ const SkSurfaceProps& surfaceProps,
92
+ skgpu::Mipmapped isMipmapped,
93
+ bool willUseGLFBO0 = false,
94
+ bool isTextureable = true,
95
+ skgpu::Protected isProtected = GrProtected::kNo,
96
+ bool vkRTSupportsInputAttachment = false,
97
+ bool forVulkanSecondaryCommandBuffer = false);
98
+
99
+ #if !defined(SK_DISABLE_LEGACY_CREATE_CHARACTERIZATION)
100
+ GrSurfaceCharacterization createCharacterization(
101
+ size_t cacheMaxResourceBytes,
102
+ const SkImageInfo& ii,
103
+ const GrBackendFormat& backendFormat,
104
+ int sampleCount,
105
+ GrSurfaceOrigin origin,
106
+ const SkSurfaceProps& surfaceProps,
107
+ bool isMipmapped,
108
+ bool willUseGLFBO0 = false,
109
+ bool isTextureable = true,
110
+ skgpu::Protected isProtected = GrProtected::kNo,
111
+ bool vkRTSupportsInputAttachment = false,
112
+ bool forVulkanSecondaryCommandBuffer = false);
113
+ #endif
102
114
  /*
103
115
  * Retrieve the default GrBackendFormat for a given SkColorType and renderability.
104
116
  * It is guaranteed that this backend format will be the one used by the following
@@ -138,12 +150,13 @@ public:
138
150
  GrContextThreadSafeProxyPriv priv();
139
151
  const GrContextThreadSafeProxyPriv priv() const; // NOLINT(readability-const-return-type)
140
152
 
141
- private:
142
- friend class GrContextThreadSafeProxyPriv; // for ctor and hidden methods
143
-
153
+ protected:
144
154
  // DDL TODO: need to add unit tests for backend & maybe options
145
155
  GrContextThreadSafeProxy(GrBackendApi, const GrContextOptions&);
146
156
 
157
+ private:
158
+ friend class GrContextThreadSafeProxyPriv; // for ctor and hidden methods
159
+
147
160
  void abandonContext();
148
161
  bool abandoned() const;
149
162
 
@@ -152,6 +165,13 @@ private:
152
165
  // `init` method on GrContext_Base).
153
166
  void init(sk_sp<const GrCaps>, sk_sp<GrThreadSafePipelineBuilder>);
154
167
 
168
+ virtual bool isValidCharacterizationForVulkan(sk_sp<const GrCaps>,
169
+ bool isTextureable,
170
+ skgpu::Mipmapped isMipmapped,
171
+ skgpu::Protected isProtected,
172
+ bool vkRTSupportsInputAttachment,
173
+ bool forVulkanSecondaryCommandBuffer);
174
+
155
175
  const GrBackendApi fBackend;
156
176
  const GrContextOptions fOptions;
157
177
  const uint32_t fContextID;
@@ -162,8 +182,4 @@ private:
162
182
  std::atomic<bool> fAbandoned{false};
163
183
  };
164
184
 
165
- #else // !defined(SK_GANESH)
166
- class SK_API GrContextThreadSafeProxy final : public SkNVRefCnt<GrContextThreadSafeProxy> {};
167
- #endif
168
-
169
185
  #endif
@@ -41,9 +41,7 @@ class SkTaskGroup;
41
41
  class SkTraceMemoryDump;
42
42
  enum SkColorType : int;
43
43
  enum class SkTextureCompressionType;
44
- struct GrGLInterface;
45
44
  struct GrMockOptions;
46
- struct GrVkBackendContext; // IWYU pragma: keep
47
45
  struct GrD3DBackendContext; // IWYU pragma: keep
48
46
  struct GrMtlBackendContext; // IWYU pragma: keep
49
47
 
@@ -62,28 +60,6 @@ enum class BackendSurfaceAccess;
62
60
 
63
61
  class SK_API GrDirectContext : public GrRecordingContext {
64
62
  public:
65
- #if defined(SK_GL) && !defined(SK_DISABLE_LEGACY_GL_GRDIRECTCONTEXT_FACTORIES)
66
- /**
67
- * Creates a GrDirectContext for a backend context. If no GrGLInterface is provided then the
68
- * result of GrGLMakeNativeInterface() is used if it succeeds.
69
- */
70
- static sk_sp<GrDirectContext> MakeGL(sk_sp<const GrGLInterface>, const GrContextOptions&);
71
- static sk_sp<GrDirectContext> MakeGL(sk_sp<const GrGLInterface>);
72
- static sk_sp<GrDirectContext> MakeGL(const GrContextOptions&);
73
- static sk_sp<GrDirectContext> MakeGL();
74
- #endif
75
-
76
- #ifdef SK_VULKAN
77
- /**
78
- * The Vulkan context (VkQueue, VkDevice, VkInstance) must be kept alive until the returned
79
- * GrDirectContext is destroyed. This also means that any objects created with this
80
- * GrDirectContext (e.g. SkSurfaces, SkImages, etc.) must also be released as they may hold
81
- * refs on the GrDirectContext. Once all these objects and the GrDirectContext are released,
82
- * then it is safe to delete the vulkan objects.
83
- */
84
- static sk_sp<GrDirectContext> MakeVulkan(const GrVkBackendContext&, const GrContextOptions&);
85
- static sk_sp<GrDirectContext> MakeVulkan(const GrVkBackendContext&);
86
- #endif
87
63
 
88
64
  #ifdef SK_METAL
89
65
  /**
@@ -357,14 +333,17 @@ public:
357
333
 
358
334
  /**
359
335
  * Inserts a list of GPU semaphores that the current GPU-backed API must wait on before
360
- * executing any more commands on the GPU. If this call returns false, then the GPU back-end
361
- * will not wait on any passed in semaphores, and the client will still own the semaphores,
362
- * regardless of the value of deleteSemaphoresAfterWait.
336
+ * executing any more commands on the GPU. We only guarantee blocking transfer and fragment
337
+ * shader work, but may block earlier stages as well depending on the backend.If this call
338
+ * returns false, then the GPU back-end will not wait on any passed in semaphores, and the
339
+ * client will still own the semaphores, regardless of the value of deleteSemaphoresAfterWait.
363
340
  *
364
341
  * If deleteSemaphoresAfterWait is false then Skia will not delete the semaphores. In this case
365
342
  * it is the client's responsibility to not destroy or attempt to reuse the semaphores until it
366
343
  * knows that Skia has finished waiting on them. This can be done by using finishedProcs on
367
344
  * flush calls.
345
+ *
346
+ * This is not supported on the GL backend.
368
347
  */
369
348
  bool wait(int numSemaphores, const GrBackendSemaphore* waitSemaphores,
370
349
  bool deleteSemaphoresAfterWait = true);
@@ -416,13 +395,13 @@ public:
416
395
  * @param image the non-null image to flush.
417
396
  * @param info flush options
418
397
  */
419
- GrSemaphoresSubmitted flush(sk_sp<const SkImage> image, const GrFlushInfo& info);
420
- void flush(sk_sp<const SkImage> image);
398
+ GrSemaphoresSubmitted flush(const sk_sp<const SkImage>& image, const GrFlushInfo& info);
399
+ void flush(const sk_sp<const SkImage>& image);
421
400
 
422
401
  /** Version of flush() that uses a default GrFlushInfo. Also submits the flushed work to the
423
402
  * GPU.
424
403
  */
425
- void flushAndSubmit(sk_sp<const SkImage> image);
404
+ void flushAndSubmit(const sk_sp<const SkImage>& image);
426
405
 
427
406
  /** Issues pending SkSurface commands to the GPU-backed API objects and resolves any SkSurface
428
407
  * MSAA. A call to GrDirectContext::submit is always required to ensure work is actually sent
@@ -952,7 +931,9 @@ public:
952
931
  const GrDirectContextPriv priv() const; // NOLINT(readability-const-return-type)
953
932
 
954
933
  protected:
955
- GrDirectContext(GrBackendApi backend, const GrContextOptions& options);
934
+ GrDirectContext(GrBackendApi backend,
935
+ const GrContextOptions& options,
936
+ sk_sp<GrContextThreadSafeProxy> proxy);
956
937
 
957
938
  bool init() override;
958
939
 
@@ -16,7 +16,6 @@
16
16
  class GrBackendSemaphore;
17
17
 
18
18
  namespace skgpu {
19
- enum class Mipmapped : bool;
20
19
  enum class Protected : bool;
21
20
  enum class Renderable : bool;
22
21
  }
@@ -129,14 +128,6 @@ static constexpr GrBackendApi kMock_GrBackend = GrBackendApi::kMock;
129
128
 
130
129
  ///////////////////////////////////////////////////////////////////////////////
131
130
 
132
- /**
133
- * Used to say whether a texture has mip levels allocated or not.
134
- */
135
- /** Deprecated legacy alias of skgpu::Mipmapped. */
136
- using GrMipmapped = skgpu::Mipmapped;
137
- /** Deprecated legacy alias of skgpu::Mipmapped. */
138
- using GrMipMapped = skgpu::Mipmapped;
139
-
140
131
  /*
141
132
  * Can a GrBackendObject be rendered to?
142
133
  */
@@ -220,13 +211,7 @@ typedef void (*GrDirectContextDestroyedProc)(GrDirectContextDestroyedContext des
220
211
  * The submittedProc is useful to the client to know when semaphores that were sent with the flush
221
212
  * have actually been submitted to the GPU so that they can be waited on (or deleted if the submit
222
213
  * fails).
223
- * Note about GL: In GL work gets sent to the driver immediately during the flush call, but we don't
224
- * really know when the driver sends the work to the GPU. Therefore, we treat the submitted proc as
225
- * we do in other backends. It will be called when the next GrContext::submit is called after the
226
- * flush (or possibly during the flush if there is no work to be done for the flush). The main use
227
- * case for the submittedProc is to know when semaphores have been sent to the GPU and even in GL
228
- * it is required to call GrContext::submit to flush them. So a client should be able to treat all
229
- * backend APIs the same in terms of how the submitted procs are treated.
214
+ * GrBackendSemaphores are not supported for the GL backend and will be ignored if set.
230
215
  */
231
216
  struct GrFlushInfo {
232
217
  size_t fNumSemaphores = 0;
@@ -8,21 +8,21 @@
8
8
  #ifndef skgpu_MutableTextureState_DEFINED
9
9
  #define skgpu_MutableTextureState_DEFINED
10
10
 
11
+ #include "include/core/SkRefCnt.h"
11
12
  #include "include/core/SkTypes.h"
12
- #include "include/gpu/GpuTypes.h"
13
+ #include "include/private/base/SkAnySubclass.h"
13
14
 
14
- #ifdef SK_VULKAN
15
+ #if defined(SK_VULKAN) && !defined(SK_DISABLE_LEGACY_VULKAN_MUTABLE_TEXTURE_STATE)
15
16
  #include "include/private/gpu/vk/SkiaVulkan.h"
16
- #include "include/private/gpu/vk/VulkanTypesPriv.h"
17
17
 
18
18
  #include <cstdint>
19
19
  #endif
20
20
 
21
- #include <new>
22
-
23
- class GrVkGpu;
21
+ #include <cstddef>
24
22
 
25
23
  namespace skgpu {
24
+ enum class BackendApi : unsigned int;
25
+ class MutableTextureStateData;
26
26
 
27
27
  /**
28
28
  * Since Skia and clients can both modify gpu textures and their connected state, Skia needs a way
@@ -30,95 +30,50 @@ namespace skgpu {
30
30
  * for every single API and state, we use this class to be a generic wrapper around all the mutable
31
31
  * state. This class is used for calls that inform Skia of these texture/image state changes by the
32
32
  * client as well as for requesting state changes to be done by Skia. The backend specific state
33
- * that is wrapped by this class are:
34
- *
35
- * Vulkan: VkImageLayout and QueueFamilyIndex
33
+ * that is wrapped by this class are located in files like:
34
+ * - include/gpu/vk/VulkanMutableTextureState.h
36
35
  */
37
- class SK_API MutableTextureState {
36
+ class SK_API MutableTextureState : public SkRefCnt {
38
37
  public:
39
- MutableTextureState() {}
40
-
41
- #ifdef SK_VULKAN
42
- MutableTextureState(VkImageLayout layout, uint32_t queueFamilyIndex)
43
- : fVkState(layout, queueFamilyIndex)
44
- , fBackend(BackendApi::kVulkan)
45
- , fIsValid(true) {}
46
- #endif
38
+ MutableTextureState();
39
+ ~MutableTextureState() override;
47
40
 
48
- MutableTextureState(const MutableTextureState& that)
49
- : fBackend(that.fBackend), fIsValid(that.fIsValid) {
50
- if (!fIsValid) {
51
- return;
52
- }
53
- switch (fBackend) {
54
- case BackendApi::kVulkan:
55
- #ifdef SK_VULKAN
56
- SkASSERT(that.fBackend == BackendApi::kVulkan);
57
- fVkState = that.fVkState;
58
- #endif
59
- break;
60
- default:
61
- (void)that;
62
- SkUNREACHABLE;
63
- }
64
- }
41
+ MutableTextureState(const MutableTextureState& that);
65
42
 
66
- MutableTextureState& operator=(const MutableTextureState& that) {
67
- if (this != &that) {
68
- this->~MutableTextureState();
69
- new (this) MutableTextureState(that);
70
- }
71
- return *this;
72
- }
43
+ MutableTextureState& operator=(const MutableTextureState& that);
73
44
 
74
- #ifdef SK_VULKAN
75
- // If this class is not Vulkan backed it will return value of VK_IMAGE_LAYOUT_UNDEFINED.
76
- // Otherwise it will return the VkImageLayout.
77
- VkImageLayout getVkImageLayout() const {
78
- if (this->isValid() && fBackend != BackendApi::kVulkan) {
79
- return VK_IMAGE_LAYOUT_UNDEFINED;
80
- }
81
- return fVkState.getImageLayout();
82
- }
83
-
84
- // If this class is not Vulkan backed it will return value of VK_QUEUE_FAMILY_IGNORED.
85
- // Otherwise it will return the VkImageLayout.
86
- uint32_t getQueueFamilyIndex() const {
87
- if (this->isValid() && fBackend != BackendApi::kVulkan) {
88
- return VK_QUEUE_FAMILY_IGNORED;
89
- }
90
- return fVkState.getQueueFamilyIndex();
91
- }
92
- #endif
45
+ void set(const MutableTextureState& that);
93
46
 
94
47
  BackendApi backend() const { return fBackend; }
95
48
 
96
49
  // Returns true if the backend mutable state has been initialized.
97
50
  bool isValid() const { return fIsValid; }
98
51
 
52
+ #if defined(SK_VULKAN) && !defined(SK_DISABLE_LEGACY_VULKAN_MUTABLE_TEXTURE_STATE)
53
+ MutableTextureState(VkImageLayout layout, uint32_t queueFamilyIndex);
54
+
55
+ VkImageLayout getVkImageLayout() const;
56
+ uint32_t getQueueFamilyIndex() const;
57
+ #endif
58
+
99
59
  private:
100
- friend class MutableTextureStateRef;
101
- friend class ::GrVkGpu;
102
-
103
- #ifdef SK_VULKAN
104
- void setVulkanState(VkImageLayout layout, uint32_t queueFamilyIndex) {
105
- SkASSERT(!this->isValid() || fBackend == BackendApi::kVulkan);
106
- fVkState.setImageLayout(layout);
107
- fVkState.setQueueFamilyIndex(queueFamilyIndex);
108
- fBackend = BackendApi::kVulkan;
109
- fIsValid = true;
60
+ friend class MutableTextureStateData;
61
+ friend class MutableTextureStatePriv;
62
+ // Size determined by looking at the MutableTextureStateData subclasses, then
63
+ // guessing-and-checking. Compiler will complain if this is too small - in that case,
64
+ // just increase the number.
65
+ inline constexpr static size_t kMaxSubclassSize = 16;
66
+ using AnyStateData = SkAnySubclass<MutableTextureStateData, kMaxSubclassSize>;
67
+
68
+ template <typename StateData>
69
+ MutableTextureState(BackendApi api, const StateData& data) : fBackend(api), fIsValid(true) {
70
+ fStateData.emplace<StateData>(data);
110
71
  }
111
- #endif
112
72
 
113
- union {
114
- char fPlaceholder;
115
- #ifdef SK_VULKAN
116
- VulkanMutableTextureState fVkState;
117
- #endif
118
- };
73
+ AnyStateData fStateData;
119
74
 
120
- BackendApi fBackend = BackendApi::kMock;
121
- bool fIsValid = false;
75
+ BackendApi fBackend;
76
+ bool fIsValid;
122
77
  };
123
78
 
124
79
  } // namespace skgpu
@@ -18,7 +18,17 @@ class SK_API ShaderErrorHandler {
18
18
  public:
19
19
  virtual ~ShaderErrorHandler() = default;
20
20
 
21
- virtual void compileError(const char* shader, const char* errors) = 0;
21
+ /**
22
+ * compileError(shader, errors) is kept for backward compatibility with older clients.
23
+ */
24
+ virtual void compileError([[maybe_unused]] const char* shader,
25
+ [[maybe_unused]] const char* errors) {}
26
+ virtual void compileError(const char* shader,
27
+ const char* errors,
28
+ [[maybe_unused]] bool shaderWasCached) {
29
+ // Default implementation. Ignore shaderWasCached.
30
+ this->compileError(shader, errors);
31
+ }
22
32
 
23
33
  protected:
24
34
  ShaderErrorHandler() = default;
@@ -206,7 +206,7 @@ SK_API sk_sp<SkImage> TextureFromImage(GrDirectContext*,
206
206
  skgpu::Mipmapped = skgpu::Mipmapped::kNo,
207
207
  skgpu::Budgeted = skgpu::Budgeted::kYes);
208
208
  inline sk_sp<SkImage> TextureFromImage(GrDirectContext* ctx,
209
- sk_sp<const SkImage> img,
209
+ const sk_sp<const SkImage>& img,
210
210
  skgpu::Mipmapped m = skgpu::Mipmapped::kNo,
211
211
  skgpu::Budgeted b = skgpu::Budgeted::kYes) {
212
212
  return TextureFromImage(ctx, img.get(), m, b);
@@ -276,7 +276,7 @@ SK_API bool GetBackendTextureFromImage(const SkImage* img,
276
276
  GrBackendTexture* outTexture,
277
277
  bool flushPendingGrContextIO,
278
278
  GrSurfaceOrigin* origin = nullptr);
279
- inline bool GetBackendTextureFromImage(sk_sp<const SkImage> img,
279
+ inline bool GetBackendTextureFromImage(const sk_sp<const SkImage>& img,
280
280
  GrBackendTexture* outTexture,
281
281
  bool flushPendingGrContextIO,
282
282
  GrSurfaceOrigin* origin = nullptr) {
@@ -199,7 +199,7 @@ SK_API GrBackendRenderTarget GetBackendRenderTarget(SkSurface*, BackendHandleAcc
199
199
  GrDirectContext::flush.
200
200
  */
201
201
  SK_API void ResolveMSAA(SkSurface* surface);
202
- inline void ResolveMSAA(sk_sp<SkSurface> surface) {
202
+ inline void ResolveMSAA(const sk_sp<SkSurface>& surface) {
203
203
  return ResolveMSAA(surface.get());
204
204
  }
205
205
 
@@ -17,13 +17,14 @@ struct GrGLInterface;
17
17
 
18
18
  namespace GrDirectContexts {
19
19
  /**
20
- * Creates a GrDirectContext for a backend context. If no GrGLInterface is provided then the
21
- * result of GrGLMakeNativeInterface() is used if it succeeds.
20
+ * Creates a GrDirectContext for a backend context. GrGLInterface must be non-null.
22
21
  */
23
22
  SK_API sk_sp<GrDirectContext> MakeGL(sk_sp<const GrGLInterface>, const GrContextOptions&);
24
23
  SK_API sk_sp<GrDirectContext> MakeGL(sk_sp<const GrGLInterface>);
24
+ #if !defined(SK_DISABLE_LEGACY_GL_MAKE_NATIVE_INTERFACE)
25
25
  SK_API sk_sp<GrDirectContext> MakeGL(const GrContextOptions&);
26
26
  SK_API sk_sp<GrDirectContext> MakeGL();
27
+ #endif
27
28
  }
28
29
 
29
30
  #endif
@@ -0,0 +1,20 @@
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 GrVkBackendSemaphore_DEFINED
9
+ #define GrVkBackendSemaphore_DEFINED
10
+
11
+ #include "include/gpu/GrBackendSemaphore.h"
12
+ #include "include/private/base/SkAPI.h"
13
+ #include "include/private/gpu/vk/SkiaVulkan.h"
14
+
15
+ namespace GrBackendSemaphores {
16
+ SK_API GrBackendSemaphore MakeVk(VkSemaphore semaphore);
17
+ SK_API VkSemaphore GetVkSemaphore(const GrBackendSemaphore&);
18
+ } // namespace GrBackendSemaphores
19
+
20
+ #endif