@shopify/react-native-skia 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. package/cpp/skia/include/codec/SkCodec.h +4 -1
  2. package/cpp/skia/include/core/SkMesh.h +2 -2
  3. package/cpp/skia/include/core/SkMilestone.h +1 -1
  4. package/cpp/skia/include/core/SkPathEffect.h +11 -4
  5. package/cpp/skia/include/core/SkPathMeasure.h +7 -2
  6. package/cpp/skia/include/core/SkPoint3.h +2 -1
  7. package/cpp/skia/include/core/SkRSXform.h +2 -0
  8. package/cpp/skia/include/core/SkString.h +5 -5
  9. package/cpp/skia/include/core/SkSurfaceProps.h +18 -5
  10. package/cpp/skia/include/gpu/GrBackendDrawableInfo.h +2 -37
  11. package/cpp/skia/include/gpu/GrDriverBugWorkaroundsAutogen.h +3 -1
  12. package/cpp/skia/include/gpu/MutableTextureState.h +0 -13
  13. package/cpp/skia/include/gpu/ganesh/vk/GrBackendDrawableInfo.h +46 -0
  14. package/cpp/skia/include/gpu/gl/GrGLAssembleHelpers.h +4 -0
  15. package/cpp/skia/include/gpu/gl/GrGLAssembleInterface.h +5 -0
  16. package/cpp/skia/include/gpu/gl/GrGLInterface.h +1 -5
  17. package/cpp/skia/include/gpu/gl/egl/GrGLMakeEGLInterface.h +11 -2
  18. package/cpp/skia/include/gpu/gl/glx/GrGLMakeGLXInterface.h +6 -3
  19. package/cpp/skia/include/gpu/graphite/Context.h +6 -0
  20. package/cpp/skia/include/gpu/graphite/dawn/DawnBackendContext.h +8 -4
  21. package/cpp/skia/include/gpu/vk/GrVkBackendContext.h +6 -0
  22. package/cpp/skia/include/gpu/vk/VulkanBackendContext.h +6 -0
  23. package/cpp/skia/include/gpu/vk/VulkanMutableTextureState.h +6 -5
  24. package/cpp/skia/include/gpu/vk/VulkanTypes.h +10 -0
  25. package/cpp/skia/include/ports/SkImageGeneratorCG.h +8 -2
  26. package/cpp/skia/include/ports/SkImageGeneratorWIC.h +8 -2
  27. package/cpp/skia/include/private/SkColorData.h +1 -2
  28. package/cpp/skia/include/private/base/SkFloatingPoint.h +8 -0
  29. package/cpp/skia/include/private/gpu/graphite/ContextOptionsPriv.h +6 -0
  30. package/cpp/skia/include/private/gpu/vk/SkiaVulkan.h +2 -2
  31. package/cpp/skia/modules/skresources/include/SkResources.h +11 -1
  32. package/lib/commonjs/Platform/Platform.web.js +16 -6
  33. package/lib/commonjs/Platform/Platform.web.js.map +1 -1
  34. package/lib/module/Platform/Platform.web.js +16 -6
  35. package/lib/module/Platform/Platform.web.js.map +1 -1
  36. package/libs/android/arm64-v8a/libskia.a +0 -0
  37. package/libs/android/arm64-v8a/libskottie.a +0 -0
  38. package/libs/android/arm64-v8a/libskparagraph.a +0 -0
  39. package/libs/android/arm64-v8a/libsvg.a +0 -0
  40. package/libs/android/armeabi-v7a/libskia.a +0 -0
  41. package/libs/android/armeabi-v7a/libskottie.a +0 -0
  42. package/libs/android/armeabi-v7a/libskparagraph.a +0 -0
  43. package/libs/android/armeabi-v7a/libsvg.a +0 -0
  44. package/libs/android/x86/libskia.a +0 -0
  45. package/libs/android/x86/libskottie.a +0 -0
  46. package/libs/android/x86/libskparagraph.a +0 -0
  47. package/libs/android/x86/libsvg.a +0 -0
  48. package/libs/android/x86_64/libskia.a +0 -0
  49. package/libs/android/x86_64/libskottie.a +0 -0
  50. package/libs/android/x86_64/libskparagraph.a +0 -0
  51. package/libs/android/x86_64/libsvg.a +0 -0
  52. package/libs/ios/libskia.xcframework/Info.plist +5 -5
  53. package/libs/ios/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
  54. package/libs/ios/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
  55. package/libs/ios/libskottie.xcframework/Info.plist +5 -5
  56. package/libs/ios/libskottie.xcframework/ios-arm64_arm64e/libskottie.a +0 -0
  57. package/libs/ios/libskottie.xcframework/ios-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
  58. package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e/libskparagraph.a +0 -0
  59. package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e_x86_64-simulator/libskparagraph.a +0 -0
  60. package/libs/ios/libsksg.xcframework/ios-arm64_arm64e/libsksg.a +0 -0
  61. package/libs/ios/libsksg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
  62. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
  63. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
  64. package/libs/ios/libskunicode.xcframework/Info.plist +5 -5
  65. package/libs/ios/libskunicode.xcframework/ios-arm64_arm64e/libskunicode.a +0 -0
  66. package/libs/ios/libskunicode.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode.a +0 -0
  67. package/libs/ios/libsvg.xcframework/Info.plist +5 -5
  68. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
  69. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
  70. package/package.json +1 -1
  71. package/src/Platform/Platform.web.tsx +16 -6
  72. package/cpp/skia/include/utils/SkAnimCodecPlayer.h +0 -67
@@ -136,6 +136,8 @@ public:
136
136
  /**
137
137
  * If the container format contains both still images and image sequences,
138
138
  * SkCodec should choose one of the still images. This is the default.
139
+ * Note that kPreferStillImage may prevent use of the animation features
140
+ * if the input is not rewindable.
139
141
  */
140
142
  kPreferStillImage,
141
143
  /**
@@ -409,7 +411,8 @@ public:
409
411
  }
410
412
 
411
413
  /**
412
- * Return an image containing the pixels.
414
+ * Return an image containing the pixels. If the codec's origin is not "upper left",
415
+ * This will rotate the output image accordingly.
413
416
  */
414
417
  std::tuple<sk_sp<SkImage>, SkCodec::Result> getImage(const SkImageInfo& info,
415
418
  const Options* opts = nullptr);
@@ -62,7 +62,7 @@ namespace SkSL { struct Program; }
62
62
  * assumed to be shared between stages. It is an error to specify uniforms in the vertex and
63
63
  * fragment program with the same name but different types, dimensionality, or layouts.
64
64
  */
65
- class SkMeshSpecification : public SkNVRefCnt<SkMeshSpecification> {
65
+ class SK_API SkMeshSpecification : public SkNVRefCnt<SkMeshSpecification> {
66
66
  public:
67
67
  /** These values are enforced when creating a specification. */
68
68
  static constexpr size_t kMaxStride = 1024;
@@ -260,7 +260,7 @@ private:
260
260
  * SkMeshSpecification::uniformSize() and SkMeshSpecification::uniforms() for sizing and packing
261
261
  * uniforms into the SkData.
262
262
  */
263
- class SkMesh {
263
+ class SK_API SkMesh {
264
264
  public:
265
265
  class IndexBuffer : public SkRefCnt {
266
266
  public:
@@ -5,5 +5,5 @@
5
5
  * found in the LICENSE file.
6
6
  */
7
7
  #ifndef SK_MILESTONE
8
- #define SK_MILESTONE 122
8
+ #define SK_MILESTONE 123
9
9
  #endif
@@ -9,13 +9,20 @@
9
9
  #define SkPathEffect_DEFINED
10
10
 
11
11
  #include "include/core/SkFlattenable.h"
12
+ #include "include/core/SkRefCnt.h"
12
13
  #include "include/core/SkScalar.h"
13
- // not needed, but some of our clients need it (they don't IWYU)
14
- #include "include/core/SkPath.h"
14
+ #include "include/private/base/SkAPI.h"
15
15
 
16
- class SkPath;
17
- struct SkRect;
16
+ // TODO(kjlubick) update clients and remove this unnecessary #include
17
+ #include "include/core/SkPath.h" // IWYU pragma: keep
18
+
19
+ #include <cstddef>
20
+ #include <cstdint>
21
+
22
+ class SkMatrix;
18
23
  class SkStrokeRec;
24
+ struct SkDeserialProcs;
25
+ struct SkRect;
19
26
 
20
27
  /** \class SkPathEffect
21
28
 
@@ -9,8 +9,13 @@
9
9
  #define SkPathMeasure_DEFINED
10
10
 
11
11
  #include "include/core/SkContourMeasure.h"
12
- #include "include/core/SkPath.h"
13
- #include "include/private/base/SkTDArray.h"
12
+ #include "include/core/SkPoint.h"
13
+ #include "include/core/SkRefCnt.h"
14
+ #include "include/core/SkScalar.h"
15
+ #include "include/private/base/SkAPI.h"
16
+
17
+ class SkMatrix;
18
+ class SkPath;
14
19
 
15
20
  class SK_API SkPathMeasure {
16
21
  public:
@@ -8,8 +8,9 @@
8
8
  #ifndef SkPoint3_DEFINED
9
9
  #define SkPoint3_DEFINED
10
10
 
11
- #include "include/core/SkPoint.h"
12
11
  #include "include/core/SkScalar.h"
12
+ #include "include/private/base/SkAPI.h"
13
+ #include "include/private/base/SkAssert.h"
13
14
 
14
15
  struct SK_API SkPoint3 {
15
16
  SkScalar fX, fY, fZ;
@@ -9,7 +9,9 @@
9
9
  #define SkRSXform_DEFINED
10
10
 
11
11
  #include "include/core/SkPoint.h"
12
+ #include "include/core/SkScalar.h"
12
13
  #include "include/core/SkSize.h"
14
+ #include "include/private/base/SkAPI.h"
13
15
 
14
16
  /**
15
17
  * A compressed form of a rotation+scale matrix.
@@ -82,14 +82,14 @@ static inline bool SkStrContains(const char string[], const char subchar) {
82
82
  */
83
83
 
84
84
  static constexpr int kSkStrAppendU32_MaxSize = 10;
85
- char* SkStrAppendU32(char buffer[], uint32_t);
85
+ char* SkStrAppendU32(char buffer[], uint32_t);
86
86
  static constexpr int kSkStrAppendU64_MaxSize = 20;
87
- char* SkStrAppendU64(char buffer[], uint64_t, int minDigits);
87
+ char* SkStrAppendU64(char buffer[], uint64_t, int minDigits);
88
88
 
89
89
  static constexpr int kSkStrAppendS32_MaxSize = kSkStrAppendU32_MaxSize + 1;
90
- char* SkStrAppendS32(char buffer[], int32_t);
90
+ char* SkStrAppendS32(char buffer[], int32_t);
91
91
  static constexpr int kSkStrAppendS64_MaxSize = kSkStrAppendU64_MaxSize + 1;
92
- char* SkStrAppendS64(char buffer[], int64_t, int minDigits);
92
+ char* SkStrAppendS64(char buffer[], int64_t, int minDigits);
93
93
 
94
94
  /**
95
95
  * Floats have at most 8 significant digits, so we limit our %g to that.
@@ -281,7 +281,7 @@ private:
281
281
  };
282
282
 
283
283
  /// Creates a new string and writes into it using a printf()-style format.
284
- SkString SkStringPrintf(const char* format, ...) SK_PRINTF_LIKE(1, 2);
284
+ SK_API SkString SkStringPrintf(const char* format, ...) SK_PRINTF_LIKE(1, 2);
285
285
  /// This makes it easier to write a caller as a VAR_ARGS function where the format string is
286
286
  /// optional.
287
287
  static inline SkString SkStringPrintf() { return SkString(); }
@@ -8,6 +8,7 @@
8
8
  #ifndef SkSurfaceProps_DEFINED
9
9
  #define SkSurfaceProps_DEFINED
10
10
 
11
+ #include "include/core/SkScalar.h"
11
12
  #include "include/core/SkTypes.h"
12
13
  #include "include/private/base/SkTo.h"
13
14
 
@@ -52,27 +53,33 @@ static inline bool SkPixelGeometryIsV(SkPixelGeometry geo) {
52
53
  class SK_API SkSurfaceProps {
53
54
  public:
54
55
  enum Flags {
56
+ kDefault_Flag = 0,
55
57
  kUseDeviceIndependentFonts_Flag = 1 << 0,
56
58
  // Use internal MSAA to render to non-MSAA GPU surfaces.
57
- kDynamicMSAA_Flag = 1 << 1,
59
+ kDynamicMSAA_Flag = 1 << 1,
58
60
  // If set, all rendering will have dithering enabled
59
61
  // Currently this only impacts GPU backends
60
- kAlwaysDither_Flag = 1 << 2,
62
+ kAlwaysDither_Flag = 1 << 2,
61
63
  };
62
64
 
63
- /** No flags, unknown pixel geometry. */
65
+ /** No flags, unknown pixel geometry, platform-default contrast/gamma. */
64
66
  SkSurfaceProps();
67
+ /** TODO(kschmi): Remove this constructor and replace with the one below. **/
65
68
  SkSurfaceProps(uint32_t flags, SkPixelGeometry);
69
+ /** Specified pixel geometry, text contrast, and gamma **/
70
+ SkSurfaceProps(uint32_t flags, SkPixelGeometry, SkScalar textContrast, SkScalar textGamma);
66
71
 
67
72
  SkSurfaceProps(const SkSurfaceProps&) = default;
68
73
  SkSurfaceProps& operator=(const SkSurfaceProps&) = default;
69
74
 
70
75
  SkSurfaceProps cloneWithPixelGeometry(SkPixelGeometry newPixelGeometry) const {
71
- return SkSurfaceProps(fFlags, newPixelGeometry);
76
+ return SkSurfaceProps(fFlags, newPixelGeometry, fTextContrast, fTextGamma);
72
77
  }
73
78
 
74
79
  uint32_t flags() const { return fFlags; }
75
80
  SkPixelGeometry pixelGeometry() const { return fPixelGeometry; }
81
+ SkScalar textContrast() const { return fTextContrast; }
82
+ SkScalar textGamma() const { return fTextGamma; }
76
83
 
77
84
  bool isUseDeviceIndependentFonts() const {
78
85
  return SkToBool(fFlags & kUseDeviceIndependentFonts_Flag);
@@ -83,7 +90,8 @@ public:
83
90
  }
84
91
 
85
92
  bool operator==(const SkSurfaceProps& that) const {
86
- return fFlags == that.fFlags && fPixelGeometry == that.fPixelGeometry;
93
+ return fFlags == that.fFlags && fPixelGeometry == that.fPixelGeometry &&
94
+ fTextContrast == that.fTextContrast && fTextGamma == that.fTextGamma;
87
95
  }
88
96
 
89
97
  bool operator!=(const SkSurfaceProps& that) const {
@@ -93,6 +101,11 @@ public:
93
101
  private:
94
102
  uint32_t fFlags;
95
103
  SkPixelGeometry fPixelGeometry;
104
+
105
+ // This gamma value is specifically about blending of mask coverage.
106
+ // The surface also has a color space, but that applies to the colors.
107
+ SkScalar fTextContrast;
108
+ SkScalar fTextGamma;
96
109
  };
97
110
 
98
111
  #endif
@@ -5,40 +5,5 @@
5
5
  * found in the LICENSE file.
6
6
  */
7
7
 
8
- #ifndef GrBackendDrawableInfo_DEFINED
9
- #define GrBackendDrawableInfo_DEFINED
10
-
11
- #include "include/gpu/GrTypes.h"
12
-
13
- #include "include/gpu/vk/GrVkTypes.h"
14
-
15
- class SK_API GrBackendDrawableInfo {
16
- public:
17
- // Creates an invalid backend drawable info.
18
- GrBackendDrawableInfo() : fIsValid(false) {}
19
-
20
- GrBackendDrawableInfo(const GrVkDrawableInfo& info)
21
- : fIsValid(true)
22
- , fBackend(GrBackendApi::kVulkan)
23
- , fVkInfo(info) {}
24
-
25
- // Returns true if the backend texture has been initialized.
26
- bool isValid() const { return fIsValid; }
27
-
28
- GrBackendApi backend() const { return fBackend; }
29
-
30
- bool getVkDrawableInfo(GrVkDrawableInfo* outInfo) const {
31
- if (this->isValid() && GrBackendApi::kVulkan == fBackend) {
32
- *outInfo = fVkInfo;
33
- return true;
34
- }
35
- return false;
36
- }
37
-
38
- private:
39
- bool fIsValid;
40
- GrBackendApi fBackend;
41
- GrVkDrawableInfo fVkInfo;
42
- };
43
-
44
- #endif
8
+ // TODO(kjlubick) delete after Chrome (and Android?) are migrated.
9
+ #include "include/gpu/ganesh/vk/GrBackendDrawableInfo.h"
@@ -5,6 +5,7 @@
5
5
  // This file is auto-generated from build_workaround_header.py
6
6
  // DO NOT EDIT!
7
7
 
8
+ #ifndef GPU_DRIVER_BUG_WORKAROUNDS
8
9
  #define GPU_DRIVER_BUG_WORKAROUNDS(GPU_OP) \
9
10
  GPU_OP(ADD_AND_TRUE_TO_LOOP_CONDITION, \
10
11
  add_and_true_to_loop_condition) \
@@ -40,4 +41,5 @@
40
41
  unbind_attachments_on_bound_render_fbo_delete) \
41
42
  GPU_OP(UNFOLD_SHORT_CIRCUIT_AS_TERNARY_OPERATION, \
42
43
  unfold_short_circuit_as_ternary_operation) \
43
- // The End
44
+
45
+ #endif // GPU_DRIVER_BUG_WORKAROUNDS
@@ -12,12 +12,6 @@
12
12
  #include "include/core/SkTypes.h"
13
13
  #include "include/private/base/SkAnySubclass.h"
14
14
 
15
- #if defined(SK_VULKAN) && !defined(SK_DISABLE_LEGACY_VULKAN_MUTABLE_TEXTURE_STATE)
16
- #include "include/private/gpu/vk/SkiaVulkan.h"
17
-
18
- #include <cstdint>
19
- #endif
20
-
21
15
  #include <cstddef>
22
16
 
23
17
  namespace skgpu {
@@ -49,13 +43,6 @@ public:
49
43
  // Returns true if the backend mutable state has been initialized.
50
44
  bool isValid() const { return fIsValid; }
51
45
 
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
-
59
46
  private:
60
47
  friend class MutableTextureStateData;
61
48
  friend class MutableTextureStatePriv;
@@ -0,0 +1,46 @@
1
+ /*
2
+ * Copyright 2018 Google Inc.
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 GrBackendDrawableInfo_DEFINED
9
+ #define GrBackendDrawableInfo_DEFINED
10
+
11
+ #include "include/gpu/GrTypes.h"
12
+
13
+ #include "include/gpu/vk/GrVkTypes.h"
14
+
15
+ // If necessary, this could be pulled into a generic interface, but at this point, we only expect
16
+ // it to be used by the Ganesh Vulkan backend.
17
+ class SK_API GrBackendDrawableInfo {
18
+ public:
19
+ // Creates an invalid backend drawable info.
20
+ GrBackendDrawableInfo() : fIsValid(false) {}
21
+
22
+ GrBackendDrawableInfo(const GrVkDrawableInfo& info)
23
+ : fIsValid(true)
24
+ , fBackend(GrBackendApi::kVulkan)
25
+ , fVkInfo(info) {}
26
+
27
+ // Returns true if the backend texture has been initialized.
28
+ bool isValid() const { return fIsValid; }
29
+
30
+ GrBackendApi backend() const { return fBackend; }
31
+
32
+ bool getVkDrawableInfo(GrVkDrawableInfo* outInfo) const {
33
+ if (this->isValid() && GrBackendApi::kVulkan == fBackend) {
34
+ *outInfo = fVkInfo;
35
+ return true;
36
+ }
37
+ return false;
38
+ }
39
+
40
+ private:
41
+ bool fIsValid;
42
+ GrBackendApi fBackend;
43
+ GrVkDrawableInfo fVkInfo;
44
+ };
45
+
46
+ #endif
@@ -4,8 +4,12 @@
4
4
  * Use of this source code is governed by a BSD-style license that can be
5
5
  * found in the LICENSE file.
6
6
  */
7
+ #ifndef GrGLAssembleHelpers_DEFINED
8
+ #define GrGLAssembleHelpers_DEFINED
7
9
 
8
10
  #include "include/gpu/gl/GrGLAssembleInterface.h"
9
11
 
10
12
  void GrGetEGLQueryAndDisplay(GrEGLQueryStringFn** queryString, GrEGLDisplay* display,
11
13
  void* ctx, GrGLGetProc get);
14
+
15
+ #endif // GrGLAssembleHelpers_DEFINED
@@ -4,8 +4,11 @@
4
4
  * Use of this source code is governed by a BSD-style license that can be
5
5
  * found in the LICENSE file.
6
6
  */
7
+ #ifndef GrGLAssembleInterface_DEFINED
8
+ #define GrGLAssembleInterface_DEFINED
7
9
 
8
10
  #include "include/gpu/gl/GrGLInterface.h"
11
+ #include "include/private/base/SkAPI.h"
9
12
 
10
13
  typedef GrGLFuncPtr (*GrGLGetProc)(void* ctx, const char name[]);
11
14
 
@@ -37,3 +40,5 @@ SK_API sk_sp<const GrGLInterface> GrGLMakeAssembledWebGLInterface(void *ctx, GrG
37
40
 
38
41
  /** Deprecated version of GrGLMakeAssembledInterface() that returns a bare pointer. */
39
42
  SK_API const GrGLInterface* GrGLAssembleInterface(void *ctx, GrGLGetProc get);
43
+
44
+ #endif // GrGLAssembleInterface_DEFINED
@@ -78,11 +78,7 @@ public:
78
78
  #endif
79
79
 
80
80
  // Indicates the type of GL implementation
81
- union {
82
- GrGLStandard fStandard;
83
- GrGLStandard fBindingsExported; // Legacy name, will be remove when Chromium is updated.
84
- };
85
-
81
+ GrGLStandard fStandard;
86
82
  GrGLExtensions fExtensions;
87
83
 
88
84
  bool hasExtension(const char ext[]) const { return fExtensions.has(ext); }
@@ -4,11 +4,20 @@
4
4
  * Use of this source code is governed by a BSD-style license that can be
5
5
  * found in the LICENSE file.
6
6
  */
7
-
8
- #include "include/gpu/GrTypes.h"
7
+ #ifndef GrGLMakeEGLInterface_DEFINED
8
+ #define GrGLMakeEGLInterface_DEFINED
9
9
 
10
10
  #include "include/core/SkRefCnt.h"
11
+ #include "include/gpu/GrTypes.h"
11
12
 
12
13
  struct GrGLInterface;
13
14
 
15
+ namespace GrGLInterfaces {
16
+ SK_API sk_sp<const GrGLInterface> MakeEGL();
17
+ }
18
+
19
+ #if !defined(SK_DISABLE_LEGACY_GLXINTERFACE_FACTORY)
14
20
  sk_sp<const GrGLInterface> GrGLMakeEGLInterface();
21
+ #endif
22
+
23
+ #endif // GrGLMakeEGLInterface_DEFINED
@@ -4,17 +4,20 @@
4
4
  * Use of this source code is governed by a BSD-style license that can be
5
5
  * found in the LICENSE file.
6
6
  */
7
-
8
- #include "include/gpu/GrTypes.h"
7
+ #ifndef GrGLMakeGLXInterface_DEFINED
8
+ #define GrGLMakeGLXInterface_DEFINED
9
9
 
10
10
  #include "include/core/SkRefCnt.h"
11
+ #include "include/private/base/SkAPI.h"
11
12
 
12
13
  struct GrGLInterface;
13
14
 
14
15
  namespace GrGLInterfaces {
15
- sk_sp<const GrGLInterface> MakeGLX();
16
+ SK_API sk_sp<const GrGLInterface> MakeGLX();
16
17
  }
17
18
 
18
19
  #if !defined(SK_DISABLE_LEGACY_GLXINTERFACE_FACTORY)
19
20
  sk_sp<const GrGLInterface> GrGLMakeGLXInterface();
20
21
  #endif
22
+
23
+ #endif // GrGLMakeGLXInterface_DEFINED
@@ -157,6 +157,12 @@ public:
157
157
  */
158
158
  void dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const;
159
159
 
160
+ /**
161
+ * Returns true if the backend-specific context has gotten into an unrecoverarble, lost state
162
+ * (e.g. if we've gotten a VK_ERROR_DEVICE_LOST in the Vulkan backend).
163
+ */
164
+ bool isDeviceLost() const;
165
+
160
166
  /*
161
167
  * Does this context support protected content?
162
168
  */
@@ -15,7 +15,8 @@ namespace skgpu::graphite {
15
15
 
16
16
  /**
17
17
  * WebGPU needs to allow the main thread loop to run to detect GPU progress. Dawn native has a
18
- * function wgpu::Dawn::Tick(), not present in WebGPU, that can be used to detect GPU progress.
18
+ * function wgpu::Instance::ProcessEvents, not (currently) present in WebGPU, that can be used to
19
+ * detect GPU progress.
19
20
  *
20
21
  * When compiling using Emscripten/WASM the -s ASYNCIFY option can be used to yield. E.g.:
21
22
  *
@@ -38,16 +39,19 @@ namespace skgpu::graphite {
38
39
  * Using a non-yielding Context makes it possible to build and run Graphite/Dawn on WebGPU without
39
40
  * -s ASYNCIFY.
40
41
  */
41
- using DawnTickFunction = void(const wgpu::Device& device);
42
+ using DawnTickFunction = void(const wgpu::Instance& device);
42
43
 
43
44
  #if !defined(__EMSCRIPTEN__)
44
- SK_API inline void DawnNativeTickFunction(const wgpu::Device& device) { device.Tick(); }
45
+ SK_API inline void DawnNativeProcessEventsFunction(const wgpu::Instance& instance) {
46
+ instance.ProcessEvents();
47
+ }
45
48
  #endif
46
49
 
47
50
  // The DawnBackendContext contains all of the base Dawn objects needed by the graphite Dawn
48
51
  // backend. The client will create this object and pass it into the Context::MakeDawn factory call
49
52
  // when setting up Skia.
50
53
  struct SK_API DawnBackendContext {
54
+ wgpu::Instance fInstance;
51
55
  wgpu::Device fDevice;
52
56
  wgpu::Queue fQueue;
53
57
  // See comment on DawnTickFunction.
@@ -55,7 +59,7 @@ struct SK_API DawnBackendContext {
55
59
  #if defined(__EMSCRIPTEN__)
56
60
  nullptr;
57
61
  #else
58
- DawnNativeTickFunction;
62
+ DawnNativeProcessEventsFunction;
59
63
  #endif
60
64
  };
61
65
 
@@ -73,6 +73,12 @@ struct SK_API GrVkBackendContext {
73
73
  // Indicates that we are working with protected content and all CommandPool and Queue operations
74
74
  // should be done in a protected context.
75
75
  skgpu::Protected fProtectedContext = skgpu::Protected::kNo;
76
+ // Optional callback which will be invoked if a VK_ERROR_DEVICE_LOST error code is received from
77
+ // the driver. Debug information from the driver will be provided to the callback if the
78
+ // VK_EXT_device_fault extension is supported and enabled (VkPhysicalDeviceFaultFeaturesEXT must
79
+ // be in the pNext chain of VkDeviceCreateInfo).
80
+ skgpu::VulkanDeviceLostContext fDeviceLostContext = nullptr;
81
+ skgpu::VulkanDeviceLostProc fDeviceLostProc = nullptr;
76
82
  };
77
83
 
78
84
  #endif
@@ -39,6 +39,12 @@ struct SK_API VulkanBackendContext {
39
39
  sk_sp<VulkanMemoryAllocator> fMemoryAllocator;
40
40
  skgpu::VulkanGetProc fGetProc;
41
41
  Protected fProtectedContext;
42
+ // Optional callback which will be invoked if a VK_ERROR_DEVICE_LOST error code is received from
43
+ // the driver. Debug information from the driver will be provided to the callback if the
44
+ // VK_EXT_device_fault extension is supported and enabled (VkPhysicalDeviceFaultFeaturesEXT must
45
+ // be in the pNext chain of VkDeviceCreateInfo).
46
+ skgpu::VulkanDeviceLostContext fDeviceLostContext = nullptr;
47
+ skgpu::VulkanDeviceLostProc fDeviceLostProc = nullptr;
42
48
  };
43
49
 
44
50
  } // namespace skgpu::graphite
@@ -9,17 +9,18 @@
9
9
  #define skgpu_VulkanMutableTextureState_DEFINED
10
10
 
11
11
  #include "include/gpu/MutableTextureState.h"
12
+ #include "include/private/base/SkAPI.h"
12
13
  #include "include/private/gpu/vk/SkiaVulkan.h"
13
14
 
14
15
  #include <cstdint>
15
16
 
16
17
  namespace skgpu::MutableTextureStates {
17
- MutableTextureState MakeVulkan(VkImageLayout layout, uint32_t queueFamilyIndex);
18
+ SK_API MutableTextureState MakeVulkan(VkImageLayout layout, uint32_t queueFamilyIndex);
18
19
 
19
- VkImageLayout GetVkImageLayout(const MutableTextureState& state);
20
- VkImageLayout GetVkImageLayout(const MutableTextureState* state);
21
- uint32_t GetVkQueueFamilyIndex(const MutableTextureState& state);
22
- uint32_t GetVkQueueFamilyIndex(const MutableTextureState* state);
20
+ SK_API VkImageLayout GetVkImageLayout(const MutableTextureState& state);
21
+ SK_API VkImageLayout GetVkImageLayout(const MutableTextureState* state);
22
+ SK_API uint32_t GetVkQueueFamilyIndex(const MutableTextureState& state);
23
+ SK_API uint32_t GetVkQueueFamilyIndex(const MutableTextureState* state);
23
24
  }
24
25
 
25
26
  #endif
@@ -11,7 +11,10 @@
11
11
  #include "include/core/SkTypes.h"
12
12
  #include "include/private/gpu/vk/SkiaVulkan.h"
13
13
 
14
+ #include <cstddef>
14
15
  #include <functional>
16
+ #include <string>
17
+ #include <vector>
15
18
 
16
19
  #ifndef VK_VERSION_1_1
17
20
  #error Skia requires the use of Vulkan 1.1 headers
@@ -98,6 +101,13 @@ struct VulkanYcbcrConversionInfo {
98
101
  VkFormatFeatureFlags fFormatFeatures = 0;
99
102
  };
100
103
 
104
+ typedef void* VulkanDeviceLostContext;
105
+ typedef void (*VulkanDeviceLostProc)(VulkanDeviceLostContext faultContext,
106
+ const std::string& description,
107
+ const std::vector<VkDeviceFaultAddressInfoEXT>& addressInfos,
108
+ const std::vector<VkDeviceFaultVendorInfoEXT>& vendorInfos,
109
+ const std::vector<std::byte>& vendorBinaryData);
110
+
101
111
  } // namespace skgpu
102
112
 
103
113
  #endif // skgpu_VulkanTypes_DEFINED
@@ -4,12 +4,17 @@
4
4
  * Use of this source code is governed by a BSD-style license that can be
5
5
  * found in the LICENSE file.
6
6
  */
7
+ #ifndef SkImageGeneratorCG_DEFINED
8
+ #define SkImageGeneratorCG_DEFINED
9
+
10
+ #include "include/private/base/SkFeatures.h"
7
11
 
8
- #include "include/core/SkTypes.h"
9
12
  #if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS)
10
13
 
11
14
  #include "include/core/SkData.h"
12
15
  #include "include/core/SkImageGenerator.h"
16
+ #include "include/core/SkRefCnt.h"
17
+ #include "include/private/base/SkAPI.h"
13
18
 
14
19
  #include <memory>
15
20
 
@@ -17,4 +22,5 @@ namespace SkImageGeneratorCG {
17
22
  SK_API std::unique_ptr<SkImageGenerator> MakeFromEncodedCG(sk_sp<SkData>);
18
23
  } // namespace SkImageGeneratorCG
19
24
 
20
- #endif //defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS)
25
+ #endif // defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS)
26
+ #endif // SkImageGeneratorCG_DEFINED
@@ -5,12 +5,17 @@
5
5
  * found in the LICENSE file.
6
6
  */
7
7
 
8
- #include "include/core/SkTypes.h"
8
+ #ifndef SkImageGeneratorWIC_DEFINED
9
+ #define SkImageGeneratorWIC_DEFINED
10
+
11
+ #include "include/private/base/SkFeatures.h"
9
12
 
10
13
  #if defined(SK_BUILD_FOR_WIN)
11
14
 
12
15
  #include "include/core/SkData.h"
13
16
  #include "include/core/SkImageGenerator.h"
17
+ #include "include/core/SkRefCnt.h"
18
+ #include "include/private/base/SkAPI.h"
14
19
 
15
20
  #include <memory>
16
21
 
@@ -32,4 +37,5 @@ namespace SkImageGeneratorWIC {
32
37
  SK_API std::unique_ptr<SkImageGenerator> MakeFromEncodedWIC(sk_sp<SkData>);
33
38
  }
34
39
 
35
- #endif // SK_BUILD_FOR_WIN
40
+ #endif // SK_BUILD_FOR_WIN
41
+ #endif // SkImageGeneratorWIC_DEFINED
@@ -382,5 +382,4 @@ constexpr SkPMColor4f SK_PMColor4fILLEGAL = { SK_FloatNegativeInfinity,
382
382
  SK_FloatNegativeInfinity,
383
383
  SK_FloatNegativeInfinity,
384
384
  SK_FloatNegativeInfinity };
385
-
386
- #endif
385
+ #endif // SkColorData_DEFINED
@@ -161,6 +161,11 @@ inline constexpr int SK_FLT_DECIMAL_DIG = std::numeric_limits<float>::max_digits
161
161
 
162
162
  // IEEE defines how float divide behaves for non-finite values and zero-denoms, but C does not,
163
163
  // so we have a helper that suppresses the possible undefined-behavior warnings.
164
+ #ifdef SK_BUILD_FOR_WIN
165
+ #pragma warning( push )
166
+ #pragma warning( disable : 4723)
167
+ #endif
168
+ // Your function
164
169
  SK_NO_SANITIZE("float-divide-by-zero")
165
170
  static constexpr float sk_ieee_float_divide(float numer, float denom) {
166
171
  return numer / denom;
@@ -170,6 +175,9 @@ SK_NO_SANITIZE("float-divide-by-zero")
170
175
  static constexpr double sk_ieee_double_divide(double numer, double denom) {
171
176
  return numer / denom;
172
177
  }
178
+ #ifdef SK_BUILD_FOR_WIN
179
+ #pragma warning( pop )
180
+ #endif
173
181
 
174
182
  // Return a*b + c.
175
183
  static inline float sk_fmaf(float a, float b, float c) {