|
|
deea491 |
diff --git a/gfx/wr/swgl/src/blend.h b/gfx/wr/swgl/src/blend.h
|
|
|
deea491 |
--- a/gfx/wr/swgl/src/blend.h
|
|
|
deea491 |
+++ b/gfx/wr/swgl/src/blend.h
|
|
|
deea491 |
@@ -405,7 +405,7 @@
|
|
|
deea491 |
blend_key = BlendKey(AA_BLEND_KEY_NONE + blend_key);
|
|
|
deea491 |
}
|
|
|
deea491 |
|
|
|
deea491 |
-static ALWAYS_INLINE WideRGBA8 blend_pixels(uint32_t* buf, PackedRGBA8 pdst,
|
|
|
deea491 |
+static PREFER_INLINE WideRGBA8 blend_pixels(uint32_t* buf, PackedRGBA8 pdst,
|
|
|
deea491 |
WideRGBA8 src, int span = 4) {
|
|
|
deea491 |
WideRGBA8 dst = unpack(pdst);
|
|
|
deea491 |
const WideRGBA8 RGB_MASK = {0xFFFF, 0xFFFF, 0xFFFF, 0, 0xFFFF, 0xFFFF,
|
|
|
deea491 |
@@ -686,7 +686,7 @@
|
|
|
deea491 |
// clang-format on
|
|
|
deea491 |
}
|
|
|
deea491 |
|
|
|
deea491 |
-static ALWAYS_INLINE WideR8 blend_pixels(uint8_t* buf, WideR8 dst, WideR8 src,
|
|
|
deea491 |
+static PREFER_INLINE WideR8 blend_pixels(uint8_t* buf, WideR8 dst, WideR8 src,
|
|
|
deea491 |
int span = 4) {
|
|
|
deea491 |
// clang-format off
|
|
|
deea491 |
#define BLEND_CASE_KEY(key) \
|
|
|
deea491 |
diff --git a/gfx/wr/swgl/src/gl.cc b/gfx/wr/swgl/src/gl.cc
|
|
|
deea491 |
--- a/gfx/wr/swgl/src/gl.cc
|
|
|
deea491 |
+++ b/gfx/wr/swgl/src/gl.cc
|
|
|
deea491 |
@@ -58,10 +58,24 @@
|
|
|
deea491 |
}
|
|
|
deea491 |
|
|
|
deea491 |
#else
|
|
|
deea491 |
-# define ALWAYS_INLINE __attribute__((always_inline)) inline
|
|
|
deea491 |
+// GCC is slower when dealing with always_inline, especially in debug builds.
|
|
|
deea491 |
+// When using Clang, use always_inline more aggressively.
|
|
|
deea491 |
+# if defined(__clang__) || defined(NDEBUG)
|
|
|
deea491 |
+# define ALWAYS_INLINE __attribute__((always_inline)) inline
|
|
|
deea491 |
+# else
|
|
|
deea491 |
+# define ALWAYS_INLINE inline
|
|
|
deea491 |
+# endif
|
|
|
deea491 |
# define NO_INLINE __attribute__((noinline))
|
|
|
deea491 |
#endif
|
|
|
deea491 |
|
|
|
deea491 |
+// Some functions may cause excessive binary bloat if inlined in debug or with
|
|
|
deea491 |
+// GCC builds, so use PREFER_INLINE on these instead of ALWAYS_INLINE.
|
|
|
deea491 |
+#if defined(__clang__) && defined(NDEBUG)
|
|
|
deea491 |
+# define PREFER_INLINE ALWAYS_INLINE
|
|
|
deea491 |
+#else
|
|
|
deea491 |
+# define PREFER_INLINE inline
|
|
|
deea491 |
+#endif
|
|
|
deea491 |
+
|
|
|
deea491 |
#define UNREACHABLE __builtin_unreachable()
|
|
|
deea491 |
|
|
|
deea491 |
#define UNUSED [[maybe_unused]]
|
|
|
deea491 |
|