From 16b1eab9bab992785a9c8dd780b42e6ed76a5dc0 Mon Sep 17 00:00:00 2001 From: Brian Salomon Date: Thu, 24 May 2018 16:08:28 -0400 Subject: [PATCH] Reland "Workaround constexpr bug in MSVC 2015 in GrTextureOp" This is a reland of 9eff78e2623d600282ca63c2e9988e0ffbba2949 Original change's description: > Workaround constexpr bug in MSVC 2015 in GrTextureOp > > Change-Id: I441858aab5fcd63e5467625a23681c5bcd35f25b > Reviewed-on: https://skia-review.googlesource.com/130122 > Reviewed-by: Brian Osman > Commit-Queue: Brian Salomon Change-Id: I90e5d807f658baadfab80333d84872d8105bf02b Reviewed-on: https://skia-review.googlesource.com/130306 Reviewed-by: Stephen White --- src/gpu/ops/GrTextureOp.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/gpu/ops/GrTextureOp.cpp b/src/gpu/ops/GrTextureOp.cpp index 933a17393e..4d0c41d127 100644 --- a/src/gpu/ops/GrTextureOp.cpp +++ b/src/gpu/ops/GrTextureOp.cpp @@ -790,9 +790,14 @@ __attribute__((no_sanitize("float-cast-overflow"))) ih[t] = 1.f / texture->height(); } +#if defined(_MSC_VER) && _MSC_VER <= 1910 +# define MAYBE_CONSTEXPR const +#else +# define MAYBE_CONSTEXPR constexpr +#endif using TessFn = decltype(&TextureOp::tess); - static constexpr TessFn kTessFns[] = { + static MAYBE_CONSTEXPR TessFn kTessFns[] = { &TextureOp::tess, &TextureOp::tess, &TextureOp::tess, @@ -810,6 +815,7 @@ __attribute__((no_sanitize("float-cast-overflow"))) &TextureOp::tess, &TextureOp::tess, }; +#undef MAYBE_CONSTEXPR int tessFnIdx = 0; tessFnIdx |= coverageAA ? 0x1 : 0x0; tessFnIdx |= fDomain ? 0x2 : 0x0;