mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-28 16:00:58 +00:00
Merge pull request #8421 from unknownbrackets/tex-sse
Correct SSE alpha check for 4444 textures
This commit is contained in:
commit
4a337f7fdf
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user