Reland "Workaround constexpr bug in MSVC 2015 in GrTextureOp"

This is a reland of 9eff78e262

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 <brianosman@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

Change-Id: I90e5d807f658baadfab80333d84872d8105bf02b
Reviewed-on: https://skia-review.googlesource.com/130306
Reviewed-by: Stephen White <senorblanco@chromium.org>
This commit is contained in:
Brian Salomon 2018-05-24 16:08:28 -04:00 committed by Stephen White
parent b80ffee96c
commit 16b1eab9ba

View File

@ -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<SkPoint, MultiTexture::kNo, Domain::kNo, GrAA::kNo>);
static constexpr TessFn kTessFns[] = {
static MAYBE_CONSTEXPR TessFn kTessFns[] = {
&TextureOp::tess<SkPoint, MultiTexture::kNo, Domain::kNo, GrAA::kNo>,
&TextureOp::tess<SkPoint, MultiTexture::kNo, Domain::kNo, GrAA::kYes>,
&TextureOp::tess<SkPoint, MultiTexture::kNo, Domain::kYes, GrAA::kNo>,
@ -810,6 +815,7 @@ __attribute__((no_sanitize("float-cast-overflow")))
&TextureOp::tess<SkPoint3, MultiTexture::kYes, Domain::kYes, GrAA::kNo>,
&TextureOp::tess<SkPoint3, MultiTexture::kYes, Domain::kYes, GrAA::kYes>,
};
#undef MAYBE_CONSTEXPR
int tessFnIdx = 0;
tessFnIdx |= coverageAA ? 0x1 : 0x0;
tessFnIdx |= fDomain ? 0x2 : 0x0;