Correct SSE alpha check for 4444 textures.

Oops, can't use cmplt here.
This commit is contained in:
Unknown W. Brackets 2016-01-12 00:20:36 -08:00
parent d479990595
commit 6b3260df9a

View File

@ -476,16 +476,19 @@ CheckAlphaResult CheckAlphaABGR4444SSE2(const u32 *pixelData, int stride, int w,
__m128i hasAnyCursor = _mm_setzero_si128();
for (int i = 0; i < w8; ++i) {
// This moves XXXA to A000.
const __m128i a = _mm_slli_epi16(_mm_load_si128(&p[i]), 12);
// At least one bit in isZero, and therefore hasZeroCursor, will get set if there's a zero.
const __m128i isZero = _mm_cmpeq_epi16(a, zero);
hasZeroCursor = _mm_or_si128(hasZeroCursor, isZero);
// If a = F, isNotFull will be 0 -> hasAny will be 0.
// If a = 0, a & isNotFull will be 0 -> hasAny will be 0.
// If a = F, isFull will be 1 -> hasAny will be 0.
// If a = 0, a & !isFull will be 0 -> hasAny will be 0.
// In any other case, hasAny will have some bits set.
const __m128i isNotFull = _mm_cmplt_epi32(a, full);
hasAnyCursor = _mm_or_si128(hasAnyCursor, _mm_and_si128(a, isNotFull));
const __m128i isFull = _mm_cmpeq_epi32(a, full);
const __m128i hasAny = _mm_andnot_si128(isFull, a);
hasAnyCursor = _mm_or_si128(hasAnyCursor, hasAny);
}
p += stride8;