Fixes the D32_16_SSE2 blit on Mac. On Mac we default to ABGR for SkPMColor, but ...
12 years, 4 months ago
(2012-07-03 22:19:15 UTC)
#1
Fixes the D32_16_SSE2 blit on Mac. On Mac we default to ABGR for SkPMColor, but
RGB16 remains RGB. The current code assumes that SkPMColor and RGB16 will have
their RGB in the same order (which is the case on Windows, but not on Mac). With
this change we now swizzle the colors until they are dizzy and fall down in the
right place.
With this fix we can once again use LCD16 masks for text on the Mac.
Note that this isn't the prettiest, but SSE2 has shift right and shift left, but
no shift by some signed amount. Any suggestions on removing the ugly will be
entertained.
LGTM http://codereview.appspot.com/6356062/diff/1/src/opts/SkBlitRow_opts_SSE2.cpp File src/opts/SkBlitRow_opts_SSE2.cpp (right): http://codereview.appspot.com/6356062/diff/1/src/opts/SkBlitRow_opts_SSE2.cpp#newcode578 src/opts/SkBlitRow_opts_SSE2.cpp:578: __m128i r = _mm_and_si128(_mm_slli_epi32(mask, SK_D32_16_OPAQUE_R_SHIFT), I don't have ...
12 years, 4 months ago
(2012-07-03 22:42:24 UTC)
#2
LGTM
http://codereview.appspot.com/6356062/diff/1/src/opts/SkBlitRow_opts_SSE2.cpp
File src/opts/SkBlitRow_opts_SSE2.cpp (right):
http://codereview.appspot.com/6356062/diff/1/src/opts/SkBlitRow_opts_SSE2.cpp...
src/opts/SkBlitRow_opts_SSE2.cpp:578: __m128i r =
_mm_and_si128(_mm_slli_epi32(mask, SK_D32_16_OPAQUE_R_SHIFT),
I don't have any great ideas. You could factor out just the shift into a macro,
something like:
#if SK_D32_16_OPAQUE_R_SHIFT >= 0
#define SHIFT16_R(x) _mm_slli_epi32(x, SK_D32_16_OPAQUE_R_SHIFT)
#else
#define SHIFT16_R(x) _mm_srli_epi32(x, -SK_D32_16_OPAQUE_R_SHIFT)
#endif
Then
__m128i r = _mm_and_si128(SHIFT16_R(mask)), _mm_set1_epi32(01F << SK_R32_SHIFT);
Not much better, though.
You could also just put it in a ternary, and hope that the compiler notices that
the condition is constant (but check the assembly, especially MSVC).
Do we have any existing gm's that can record/verify the new results? http://codereview.appspot.com/6356062/diff/5001/src/opts/SkBlitRow_opts_SSE2.cpp File src/opts/SkBlitRow_opts_SSE2.cpp ...
12 years, 4 months ago
(2012-07-09 15:17:05 UTC)
#4
Do we have any existing gm's that can record/verify the new results?
http://codereview.appspot.com/6356062/diff/5001/src/opts/SkBlitRow_opts_SSE2.cpp
File src/opts/SkBlitRow_opts_SSE2.cpp (right):
http://codereview.appspot.com/6356062/diff/5001/src/opts/SkBlitRow_opts_SSE2....
src/opts/SkBlitRow_opts_SSE2.cpp:519: // Note that the mask's RGB16 order may
differ from the SkPMColor order.
1. Do these need to be named specifically for SSE2, or are they just functions
of the relationship between our 32 and 16bit shifts and bit counts?
2. Esp. given our use of _ in names, lets add a space before/after - and + to
make the expressions easier to read/parse).
Now using more Skia-like names modeled after those in SkColorPriv. There are no current GMs, ...
12 years, 4 months ago
(2012-07-09 17:21:28 UTC)
#6
Now using more Skia-like names modeled after those in SkColorPriv. There are no
current GMs, as those would have been wrong. After the change for the CG font
host to use LCD16 again (see review 6244068), there will be GMs for this.
Issue 6356062: Fix SkBlendLCD16Opaque_SSE2 for non ARGB platforms.
(Closed)
Created 12 years, 4 months ago by bungeman
Modified 12 years, 4 months ago
Reviewers: reed1, Stephen White, TomH
Base URL: http://skia.googlecode.com/svn/trunk/
Comments: 2