mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-11 23:32:04 +00:00
Change dynlight sprite math to not overflow when used with dynamic colormaps
This commit is contained in:
parent
1a9b1de9a1
commit
3c3917f1f3
2 changed files with 233 additions and 35 deletions
|
@ -931,7 +931,10 @@ namespace swrenderer
|
|||
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
|
||||
|
||||
// Shade
|
||||
mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
|
||||
__m128i lightcontrib = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
|
||||
lightcontrib = _mm_sub_epi16(lightcontrib, mlight);
|
||||
lightcontrib = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, lightcontrib), 8);
|
||||
|
||||
int blue0 = BPART(ifgcolor[0]);
|
||||
int green0 = GPART(ifgcolor[0]);
|
||||
int red0 = RPART(ifgcolor[0]);
|
||||
|
@ -949,6 +952,9 @@ namespace swrenderer
|
|||
fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8);
|
||||
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8);
|
||||
|
||||
fgcolor = _mm_add_epi16(fgcolor, lightcontrib);
|
||||
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(256));
|
||||
|
||||
// Blend
|
||||
__m128i outcolor = fgcolor;
|
||||
outcolor = _mm_packus_epi16(outcolor, _mm_setzero_si128());
|
||||
|
@ -975,7 +981,10 @@ namespace swrenderer
|
|||
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
|
||||
|
||||
// Shade
|
||||
mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
|
||||
__m128i lightcontrib = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
|
||||
lightcontrib = _mm_sub_epi16(lightcontrib, mlight);
|
||||
lightcontrib = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, lightcontrib), 8);
|
||||
|
||||
int blue0 = BPART(ifgcolor[0]);
|
||||
int green0 = GPART(ifgcolor[0]);
|
||||
int red0 = RPART(ifgcolor[0]);
|
||||
|
@ -993,6 +1002,9 @@ namespace swrenderer
|
|||
fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8);
|
||||
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8);
|
||||
|
||||
fgcolor = _mm_add_epi16(fgcolor, lightcontrib);
|
||||
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(256));
|
||||
|
||||
// Blend
|
||||
__m128i outcolor = fgcolor;
|
||||
outcolor = _mm_packus_epi16(outcolor, _mm_setzero_si128());
|
||||
|
@ -1108,7 +1120,10 @@ namespace swrenderer
|
|||
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
|
||||
|
||||
// Shade
|
||||
mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
|
||||
__m128i lightcontrib = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
|
||||
lightcontrib = _mm_sub_epi16(lightcontrib, mlight);
|
||||
lightcontrib = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, lightcontrib), 8);
|
||||
|
||||
int blue0 = BPART(ifgcolor[0]);
|
||||
int green0 = GPART(ifgcolor[0]);
|
||||
int red0 = RPART(ifgcolor[0]);
|
||||
|
@ -1126,6 +1141,9 @@ namespace swrenderer
|
|||
fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8);
|
||||
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8);
|
||||
|
||||
fgcolor = _mm_add_epi16(fgcolor, lightcontrib);
|
||||
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(256));
|
||||
|
||||
// Blend
|
||||
__m128i outcolor = fgcolor;
|
||||
outcolor = _mm_packus_epi16(outcolor, _mm_setzero_si128());
|
||||
|
@ -1172,7 +1190,10 @@ namespace swrenderer
|
|||
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
|
||||
|
||||
// Shade
|
||||
mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
|
||||
__m128i lightcontrib = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
|
||||
lightcontrib = _mm_sub_epi16(lightcontrib, mlight);
|
||||
lightcontrib = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, lightcontrib), 8);
|
||||
|
||||
int blue0 = BPART(ifgcolor[0]);
|
||||
int green0 = GPART(ifgcolor[0]);
|
||||
int red0 = RPART(ifgcolor[0]);
|
||||
|
@ -1190,6 +1211,9 @@ namespace swrenderer
|
|||
fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8);
|
||||
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8);
|
||||
|
||||
fgcolor = _mm_add_epi16(fgcolor, lightcontrib);
|
||||
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(256));
|
||||
|
||||
// Blend
|
||||
__m128i outcolor = fgcolor;
|
||||
outcolor = _mm_packus_epi16(outcolor, _mm_setzero_si128());
|
||||
|
@ -1676,7 +1700,10 @@ namespace swrenderer
|
|||
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
|
||||
|
||||
// Shade
|
||||
mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
|
||||
__m128i lightcontrib = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
|
||||
lightcontrib = _mm_sub_epi16(lightcontrib, mlight);
|
||||
lightcontrib = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, lightcontrib), 8);
|
||||
|
||||
int blue0 = BPART(ifgcolor[0]);
|
||||
int green0 = GPART(ifgcolor[0]);
|
||||
int red0 = RPART(ifgcolor[0]);
|
||||
|
@ -1694,6 +1721,9 @@ namespace swrenderer
|
|||
fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8);
|
||||
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8);
|
||||
|
||||
fgcolor = _mm_add_epi16(fgcolor, lightcontrib);
|
||||
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(256));
|
||||
|
||||
// Blend
|
||||
uint32_t alpha0 = APART(ifgcolor[0]);
|
||||
uint32_t alpha1 = APART(ifgcolor[1]);
|
||||
|
@ -1750,7 +1780,10 @@ namespace swrenderer
|
|||
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
|
||||
|
||||
// Shade
|
||||
mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
|
||||
__m128i lightcontrib = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
|
||||
lightcontrib = _mm_sub_epi16(lightcontrib, mlight);
|
||||
lightcontrib = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, lightcontrib), 8);
|
||||
|
||||
int blue0 = BPART(ifgcolor[0]);
|
||||
int green0 = GPART(ifgcolor[0]);
|
||||
int red0 = RPART(ifgcolor[0]);
|
||||
|
@ -1768,6 +1801,9 @@ namespace swrenderer
|
|||
fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8);
|
||||
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8);
|
||||
|
||||
fgcolor = _mm_add_epi16(fgcolor, lightcontrib);
|
||||
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(256));
|
||||
|
||||
// Blend
|
||||
uint32_t alpha0 = APART(ifgcolor[0]);
|
||||
uint32_t alpha1 = APART(ifgcolor[1]);
|
||||
|
@ -1913,7 +1949,10 @@ namespace swrenderer
|
|||
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
|
||||
|
||||
// Shade
|
||||
mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
|
||||
__m128i lightcontrib = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
|
||||
lightcontrib = _mm_sub_epi16(lightcontrib, mlight);
|
||||
lightcontrib = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, lightcontrib), 8);
|
||||
|
||||
int blue0 = BPART(ifgcolor[0]);
|
||||
int green0 = GPART(ifgcolor[0]);
|
||||
int red0 = RPART(ifgcolor[0]);
|
||||
|
@ -1931,6 +1970,9 @@ namespace swrenderer
|
|||
fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8);
|
||||
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8);
|
||||
|
||||
fgcolor = _mm_add_epi16(fgcolor, lightcontrib);
|
||||
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(256));
|
||||
|
||||
// Blend
|
||||
uint32_t alpha0 = APART(ifgcolor[0]);
|
||||
uint32_t alpha1 = APART(ifgcolor[1]);
|
||||
|
@ -2007,7 +2049,10 @@ namespace swrenderer
|
|||
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
|
||||
|
||||
// Shade
|
||||
mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
|
||||
__m128i lightcontrib = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
|
||||
lightcontrib = _mm_sub_epi16(lightcontrib, mlight);
|
||||
lightcontrib = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, lightcontrib), 8);
|
||||
|
||||
int blue0 = BPART(ifgcolor[0]);
|
||||
int green0 = GPART(ifgcolor[0]);
|
||||
int red0 = RPART(ifgcolor[0]);
|
||||
|
@ -2025,6 +2070,9 @@ namespace swrenderer
|
|||
fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8);
|
||||
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8);
|
||||
|
||||
fgcolor = _mm_add_epi16(fgcolor, lightcontrib);
|
||||
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(256));
|
||||
|
||||
// Blend
|
||||
uint32_t alpha0 = APART(ifgcolor[0]);
|
||||
uint32_t alpha1 = APART(ifgcolor[1]);
|
||||
|
@ -2540,7 +2588,10 @@ namespace swrenderer
|
|||
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
|
||||
|
||||
// Shade
|
||||
mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
|
||||
__m128i lightcontrib = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
|
||||
lightcontrib = _mm_sub_epi16(lightcontrib, mlight);
|
||||
lightcontrib = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, lightcontrib), 8);
|
||||
|
||||
int blue0 = BPART(ifgcolor[0]);
|
||||
int green0 = GPART(ifgcolor[0]);
|
||||
int red0 = RPART(ifgcolor[0]);
|
||||
|
@ -2558,6 +2609,9 @@ namespace swrenderer
|
|||
fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8);
|
||||
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8);
|
||||
|
||||
fgcolor = _mm_add_epi16(fgcolor, lightcontrib);
|
||||
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(256));
|
||||
|
||||
// Blend
|
||||
uint32_t alpha0 = APART(ifgcolor[0]);
|
||||
uint32_t alpha1 = APART(ifgcolor[1]);
|
||||
|
@ -2614,7 +2668,10 @@ namespace swrenderer
|
|||
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
|
||||
|
||||
// Shade
|
||||
mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
|
||||
__m128i lightcontrib = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
|
||||
lightcontrib = _mm_sub_epi16(lightcontrib, mlight);
|
||||
lightcontrib = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, lightcontrib), 8);
|
||||
|
||||
int blue0 = BPART(ifgcolor[0]);
|
||||
int green0 = GPART(ifgcolor[0]);
|
||||
int red0 = RPART(ifgcolor[0]);
|
||||
|
@ -2632,6 +2689,9 @@ namespace swrenderer
|
|||
fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8);
|
||||
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8);
|
||||
|
||||
fgcolor = _mm_add_epi16(fgcolor, lightcontrib);
|
||||
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(256));
|
||||
|
||||
// Blend
|
||||
uint32_t alpha0 = APART(ifgcolor[0]);
|
||||
uint32_t alpha1 = APART(ifgcolor[1]);
|
||||
|
@ -2777,7 +2837,10 @@ namespace swrenderer
|
|||
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
|
||||
|
||||
// Shade
|
||||
mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
|
||||
__m128i lightcontrib = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
|
||||
lightcontrib = _mm_sub_epi16(lightcontrib, mlight);
|
||||
lightcontrib = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, lightcontrib), 8);
|
||||
|
||||
int blue0 = BPART(ifgcolor[0]);
|
||||
int green0 = GPART(ifgcolor[0]);
|
||||
int red0 = RPART(ifgcolor[0]);
|
||||
|
@ -2795,6 +2858,9 @@ namespace swrenderer
|
|||
fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8);
|
||||
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8);
|
||||
|
||||
fgcolor = _mm_add_epi16(fgcolor, lightcontrib);
|
||||
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(256));
|
||||
|
||||
// Blend
|
||||
uint32_t alpha0 = APART(ifgcolor[0]);
|
||||
uint32_t alpha1 = APART(ifgcolor[1]);
|
||||
|
@ -2871,7 +2937,10 @@ namespace swrenderer
|
|||
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
|
||||
|
||||
// Shade
|
||||
mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
|
||||
__m128i lightcontrib = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
|
||||
lightcontrib = _mm_sub_epi16(lightcontrib, mlight);
|
||||
lightcontrib = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, lightcontrib), 8);
|
||||
|
||||
int blue0 = BPART(ifgcolor[0]);
|
||||
int green0 = GPART(ifgcolor[0]);
|
||||
int red0 = RPART(ifgcolor[0]);
|
||||
|
@ -2889,6 +2958,9 @@ namespace swrenderer
|
|||
fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8);
|
||||
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8);
|
||||
|
||||
fgcolor = _mm_add_epi16(fgcolor, lightcontrib);
|
||||
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(256));
|
||||
|
||||
// Blend
|
||||
uint32_t alpha0 = APART(ifgcolor[0]);
|
||||
uint32_t alpha1 = APART(ifgcolor[1]);
|
||||
|
@ -3404,7 +3476,10 @@ namespace swrenderer
|
|||
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
|
||||
|
||||
// Shade
|
||||
mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
|
||||
__m128i lightcontrib = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
|
||||
lightcontrib = _mm_sub_epi16(lightcontrib, mlight);
|
||||
lightcontrib = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, lightcontrib), 8);
|
||||
|
||||
int blue0 = BPART(ifgcolor[0]);
|
||||
int green0 = GPART(ifgcolor[0]);
|
||||
int red0 = RPART(ifgcolor[0]);
|
||||
|
@ -3422,6 +3497,9 @@ namespace swrenderer
|
|||
fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8);
|
||||
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8);
|
||||
|
||||
fgcolor = _mm_add_epi16(fgcolor, lightcontrib);
|
||||
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(256));
|
||||
|
||||
// Blend
|
||||
uint32_t alpha0 = APART(ifgcolor[0]);
|
||||
uint32_t alpha1 = APART(ifgcolor[1]);
|
||||
|
@ -3478,7 +3556,10 @@ namespace swrenderer
|
|||
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
|
||||
|
||||
// Shade
|
||||
mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
|
||||
__m128i lightcontrib = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
|
||||
lightcontrib = _mm_sub_epi16(lightcontrib, mlight);
|
||||
lightcontrib = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, lightcontrib), 8);
|
||||
|
||||
int blue0 = BPART(ifgcolor[0]);
|
||||
int green0 = GPART(ifgcolor[0]);
|
||||
int red0 = RPART(ifgcolor[0]);
|
||||
|
@ -3496,6 +3577,9 @@ namespace swrenderer
|
|||
fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8);
|
||||
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8);
|
||||
|
||||
fgcolor = _mm_add_epi16(fgcolor, lightcontrib);
|
||||
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(256));
|
||||
|
||||
// Blend
|
||||
uint32_t alpha0 = APART(ifgcolor[0]);
|
||||
uint32_t alpha1 = APART(ifgcolor[1]);
|
||||
|
@ -3641,7 +3725,10 @@ namespace swrenderer
|
|||
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
|
||||
|
||||
// Shade
|
||||
mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
|
||||
__m128i lightcontrib = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
|
||||
lightcontrib = _mm_sub_epi16(lightcontrib, mlight);
|
||||
lightcontrib = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, lightcontrib), 8);
|
||||
|
||||
int blue0 = BPART(ifgcolor[0]);
|
||||
int green0 = GPART(ifgcolor[0]);
|
||||
int red0 = RPART(ifgcolor[0]);
|
||||
|
@ -3659,6 +3746,9 @@ namespace swrenderer
|
|||
fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8);
|
||||
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8);
|
||||
|
||||
fgcolor = _mm_add_epi16(fgcolor, lightcontrib);
|
||||
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(256));
|
||||
|
||||
// Blend
|
||||
uint32_t alpha0 = APART(ifgcolor[0]);
|
||||
uint32_t alpha1 = APART(ifgcolor[1]);
|
||||
|
@ -3735,7 +3825,10 @@ namespace swrenderer
|
|||
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
|
||||
|
||||
// Shade
|
||||
mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
|
||||
__m128i lightcontrib = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
|
||||
lightcontrib = _mm_sub_epi16(lightcontrib, mlight);
|
||||
lightcontrib = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, lightcontrib), 8);
|
||||
|
||||
int blue0 = BPART(ifgcolor[0]);
|
||||
int green0 = GPART(ifgcolor[0]);
|
||||
int red0 = RPART(ifgcolor[0]);
|
||||
|
@ -3753,6 +3846,9 @@ namespace swrenderer
|
|||
fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8);
|
||||
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8);
|
||||
|
||||
fgcolor = _mm_add_epi16(fgcolor, lightcontrib);
|
||||
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(256));
|
||||
|
||||
// Blend
|
||||
uint32_t alpha0 = APART(ifgcolor[0]);
|
||||
uint32_t alpha1 = APART(ifgcolor[1]);
|
||||
|
@ -3973,7 +4069,10 @@ namespace swrenderer
|
|||
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
|
||||
|
||||
// Shade
|
||||
mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
|
||||
__m128i lightcontrib = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
|
||||
lightcontrib = _mm_sub_epi16(lightcontrib, mlight);
|
||||
lightcontrib = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, lightcontrib), 8);
|
||||
|
||||
int blue0 = BPART(ifgcolor[0]);
|
||||
int green0 = GPART(ifgcolor[0]);
|
||||
int red0 = RPART(ifgcolor[0]);
|
||||
|
@ -3991,6 +4090,9 @@ namespace swrenderer
|
|||
fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8);
|
||||
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8);
|
||||
|
||||
fgcolor = _mm_add_epi16(fgcolor, lightcontrib);
|
||||
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(256));
|
||||
|
||||
// Blend
|
||||
__m128i outcolor = fgcolor;
|
||||
outcolor = _mm_packus_epi16(outcolor, _mm_setzero_si128());
|
||||
|
@ -4016,7 +4118,10 @@ namespace swrenderer
|
|||
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
|
||||
|
||||
// Shade
|
||||
mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
|
||||
__m128i lightcontrib = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
|
||||
lightcontrib = _mm_sub_epi16(lightcontrib, mlight);
|
||||
lightcontrib = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, lightcontrib), 8);
|
||||
|
||||
int blue0 = BPART(ifgcolor[0]);
|
||||
int green0 = GPART(ifgcolor[0]);
|
||||
int red0 = RPART(ifgcolor[0]);
|
||||
|
@ -4034,6 +4139,9 @@ namespace swrenderer
|
|||
fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8);
|
||||
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8);
|
||||
|
||||
fgcolor = _mm_add_epi16(fgcolor, lightcontrib);
|
||||
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(256));
|
||||
|
||||
// Blend
|
||||
__m128i outcolor = fgcolor;
|
||||
outcolor = _mm_packus_epi16(outcolor, _mm_setzero_si128());
|
||||
|
@ -4285,7 +4393,10 @@ namespace swrenderer
|
|||
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
|
||||
|
||||
// Shade
|
||||
mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
|
||||
__m128i lightcontrib = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
|
||||
lightcontrib = _mm_sub_epi16(lightcontrib, mlight);
|
||||
lightcontrib = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, lightcontrib), 8);
|
||||
|
||||
int blue0 = BPART(ifgcolor[0]);
|
||||
int green0 = GPART(ifgcolor[0]);
|
||||
int red0 = RPART(ifgcolor[0]);
|
||||
|
@ -4303,6 +4414,9 @@ namespace swrenderer
|
|||
fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8);
|
||||
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8);
|
||||
|
||||
fgcolor = _mm_add_epi16(fgcolor, lightcontrib);
|
||||
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(256));
|
||||
|
||||
// Blend
|
||||
uint32_t alpha0 = APART(ifgcolor[0]);
|
||||
uint32_t alpha1 = APART(ifgcolor[1]);
|
||||
|
@ -4358,7 +4472,10 @@ namespace swrenderer
|
|||
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
|
||||
|
||||
// Shade
|
||||
mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
|
||||
__m128i lightcontrib = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
|
||||
lightcontrib = _mm_sub_epi16(lightcontrib, mlight);
|
||||
lightcontrib = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, lightcontrib), 8);
|
||||
|
||||
int blue0 = BPART(ifgcolor[0]);
|
||||
int green0 = GPART(ifgcolor[0]);
|
||||
int red0 = RPART(ifgcolor[0]);
|
||||
|
@ -4376,6 +4493,9 @@ namespace swrenderer
|
|||
fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8);
|
||||
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8);
|
||||
|
||||
fgcolor = _mm_add_epi16(fgcolor, lightcontrib);
|
||||
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(256));
|
||||
|
||||
// Blend
|
||||
uint32_t alpha0 = APART(ifgcolor[0]);
|
||||
uint32_t alpha1 = APART(ifgcolor[1]);
|
||||
|
@ -4656,7 +4776,10 @@ namespace swrenderer
|
|||
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
|
||||
|
||||
// Shade
|
||||
mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
|
||||
__m128i lightcontrib = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
|
||||
lightcontrib = _mm_sub_epi16(lightcontrib, mlight);
|
||||
lightcontrib = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, lightcontrib), 8);
|
||||
|
||||
int blue0 = BPART(ifgcolor[0]);
|
||||
int green0 = GPART(ifgcolor[0]);
|
||||
int red0 = RPART(ifgcolor[0]);
|
||||
|
@ -4674,6 +4797,9 @@ namespace swrenderer
|
|||
fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8);
|
||||
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8);
|
||||
|
||||
fgcolor = _mm_add_epi16(fgcolor, lightcontrib);
|
||||
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(256));
|
||||
|
||||
// Blend
|
||||
uint32_t alpha0 = APART(ifgcolor[0]);
|
||||
uint32_t alpha1 = APART(ifgcolor[1]);
|
||||
|
@ -4729,7 +4855,10 @@ namespace swrenderer
|
|||
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
|
||||
|
||||
// Shade
|
||||
mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
|
||||
__m128i lightcontrib = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
|
||||
lightcontrib = _mm_sub_epi16(lightcontrib, mlight);
|
||||
lightcontrib = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, lightcontrib), 8);
|
||||
|
||||
int blue0 = BPART(ifgcolor[0]);
|
||||
int green0 = GPART(ifgcolor[0]);
|
||||
int red0 = RPART(ifgcolor[0]);
|
||||
|
@ -4747,6 +4876,9 @@ namespace swrenderer
|
|||
fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8);
|
||||
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8);
|
||||
|
||||
fgcolor = _mm_add_epi16(fgcolor, lightcontrib);
|
||||
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(256));
|
||||
|
||||
// Blend
|
||||
uint32_t alpha0 = APART(ifgcolor[0]);
|
||||
uint32_t alpha1 = APART(ifgcolor[1]);
|
||||
|
@ -5027,7 +5159,10 @@ namespace swrenderer
|
|||
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
|
||||
|
||||
// Shade
|
||||
mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
|
||||
__m128i lightcontrib = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
|
||||
lightcontrib = _mm_sub_epi16(lightcontrib, mlight);
|
||||
lightcontrib = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, lightcontrib), 8);
|
||||
|
||||
int blue0 = BPART(ifgcolor[0]);
|
||||
int green0 = GPART(ifgcolor[0]);
|
||||
int red0 = RPART(ifgcolor[0]);
|
||||
|
@ -5045,6 +5180,9 @@ namespace swrenderer
|
|||
fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8);
|
||||
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8);
|
||||
|
||||
fgcolor = _mm_add_epi16(fgcolor, lightcontrib);
|
||||
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(256));
|
||||
|
||||
// Blend
|
||||
uint32_t alpha0 = APART(ifgcolor[0]);
|
||||
uint32_t alpha1 = APART(ifgcolor[1]);
|
||||
|
@ -5100,7 +5238,10 @@ namespace swrenderer
|
|||
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
|
||||
|
||||
// Shade
|
||||
mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
|
||||
__m128i lightcontrib = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
|
||||
lightcontrib = _mm_sub_epi16(lightcontrib, mlight);
|
||||
lightcontrib = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, lightcontrib), 8);
|
||||
|
||||
int blue0 = BPART(ifgcolor[0]);
|
||||
int green0 = GPART(ifgcolor[0]);
|
||||
int red0 = RPART(ifgcolor[0]);
|
||||
|
@ -5118,6 +5259,9 @@ namespace swrenderer
|
|||
fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8);
|
||||
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8);
|
||||
|
||||
fgcolor = _mm_add_epi16(fgcolor, lightcontrib);
|
||||
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(256));
|
||||
|
||||
// Blend
|
||||
uint32_t alpha0 = APART(ifgcolor[0]);
|
||||
uint32_t alpha1 = APART(ifgcolor[1]);
|
||||
|
@ -5588,7 +5732,10 @@ namespace swrenderer
|
|||
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
|
||||
|
||||
// Shade
|
||||
mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
|
||||
__m128i lightcontrib = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
|
||||
lightcontrib = _mm_sub_epi16(lightcontrib, mlight);
|
||||
lightcontrib = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, lightcontrib), 8);
|
||||
|
||||
int blue0 = BPART(ifgcolor[0]);
|
||||
int green0 = GPART(ifgcolor[0]);
|
||||
int red0 = RPART(ifgcolor[0]);
|
||||
|
@ -5606,6 +5753,9 @@ namespace swrenderer
|
|||
fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8);
|
||||
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8);
|
||||
|
||||
fgcolor = _mm_add_epi16(fgcolor, lightcontrib);
|
||||
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(256));
|
||||
|
||||
// Blend
|
||||
__m128i outcolor = fgcolor;
|
||||
outcolor = _mm_packus_epi16(outcolor, _mm_setzero_si128());
|
||||
|
@ -5631,7 +5781,10 @@ namespace swrenderer
|
|||
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
|
||||
|
||||
// Shade
|
||||
mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
|
||||
__m128i lightcontrib = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
|
||||
lightcontrib = _mm_sub_epi16(lightcontrib, mlight);
|
||||
lightcontrib = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, lightcontrib), 8);
|
||||
|
||||
int blue0 = BPART(ifgcolor[0]);
|
||||
int green0 = GPART(ifgcolor[0]);
|
||||
int red0 = RPART(ifgcolor[0]);
|
||||
|
@ -5649,6 +5802,9 @@ namespace swrenderer
|
|||
fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8);
|
||||
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8);
|
||||
|
||||
fgcolor = _mm_add_epi16(fgcolor, lightcontrib);
|
||||
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(256));
|
||||
|
||||
// Blend
|
||||
__m128i outcolor = fgcolor;
|
||||
outcolor = _mm_packus_epi16(outcolor, _mm_setzero_si128());
|
||||
|
@ -5902,7 +6058,10 @@ namespace swrenderer
|
|||
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
|
||||
|
||||
// Shade
|
||||
mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
|
||||
__m128i lightcontrib = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
|
||||
lightcontrib = _mm_sub_epi16(lightcontrib, mlight);
|
||||
lightcontrib = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, lightcontrib), 8);
|
||||
|
||||
int blue0 = BPART(ifgcolor[0]);
|
||||
int green0 = GPART(ifgcolor[0]);
|
||||
int red0 = RPART(ifgcolor[0]);
|
||||
|
@ -5920,6 +6079,9 @@ namespace swrenderer
|
|||
fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8);
|
||||
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8);
|
||||
|
||||
fgcolor = _mm_add_epi16(fgcolor, lightcontrib);
|
||||
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(256));
|
||||
|
||||
// Blend
|
||||
uint32_t alpha0 = APART(ifgcolor[0]);
|
||||
uint32_t alpha1 = APART(ifgcolor[1]);
|
||||
|
@ -5975,7 +6137,10 @@ namespace swrenderer
|
|||
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
|
||||
|
||||
// Shade
|
||||
mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
|
||||
__m128i lightcontrib = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
|
||||
lightcontrib = _mm_sub_epi16(lightcontrib, mlight);
|
||||
lightcontrib = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, lightcontrib), 8);
|
||||
|
||||
int blue0 = BPART(ifgcolor[0]);
|
||||
int green0 = GPART(ifgcolor[0]);
|
||||
int red0 = RPART(ifgcolor[0]);
|
||||
|
@ -5993,6 +6158,9 @@ namespace swrenderer
|
|||
fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8);
|
||||
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8);
|
||||
|
||||
fgcolor = _mm_add_epi16(fgcolor, lightcontrib);
|
||||
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(256));
|
||||
|
||||
// Blend
|
||||
uint32_t alpha0 = APART(ifgcolor[0]);
|
||||
uint32_t alpha1 = APART(ifgcolor[1]);
|
||||
|
@ -6275,7 +6443,10 @@ namespace swrenderer
|
|||
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
|
||||
|
||||
// Shade
|
||||
mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
|
||||
__m128i lightcontrib = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
|
||||
lightcontrib = _mm_sub_epi16(lightcontrib, mlight);
|
||||
lightcontrib = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, lightcontrib), 8);
|
||||
|
||||
int blue0 = BPART(ifgcolor[0]);
|
||||
int green0 = GPART(ifgcolor[0]);
|
||||
int red0 = RPART(ifgcolor[0]);
|
||||
|
@ -6293,6 +6464,9 @@ namespace swrenderer
|
|||
fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8);
|
||||
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8);
|
||||
|
||||
fgcolor = _mm_add_epi16(fgcolor, lightcontrib);
|
||||
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(256));
|
||||
|
||||
// Blend
|
||||
uint32_t alpha0 = APART(ifgcolor[0]);
|
||||
uint32_t alpha1 = APART(ifgcolor[1]);
|
||||
|
@ -6348,7 +6522,10 @@ namespace swrenderer
|
|||
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
|
||||
|
||||
// Shade
|
||||
mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
|
||||
__m128i lightcontrib = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
|
||||
lightcontrib = _mm_sub_epi16(lightcontrib, mlight);
|
||||
lightcontrib = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, lightcontrib), 8);
|
||||
|
||||
int blue0 = BPART(ifgcolor[0]);
|
||||
int green0 = GPART(ifgcolor[0]);
|
||||
int red0 = RPART(ifgcolor[0]);
|
||||
|
@ -6366,6 +6543,9 @@ namespace swrenderer
|
|||
fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8);
|
||||
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8);
|
||||
|
||||
fgcolor = _mm_add_epi16(fgcolor, lightcontrib);
|
||||
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(256));
|
||||
|
||||
// Blend
|
||||
uint32_t alpha0 = APART(ifgcolor[0]);
|
||||
uint32_t alpha1 = APART(ifgcolor[1]);
|
||||
|
@ -6648,7 +6828,10 @@ namespace swrenderer
|
|||
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
|
||||
|
||||
// Shade
|
||||
mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
|
||||
__m128i lightcontrib = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
|
||||
lightcontrib = _mm_sub_epi16(lightcontrib, mlight);
|
||||
lightcontrib = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, lightcontrib), 8);
|
||||
|
||||
int blue0 = BPART(ifgcolor[0]);
|
||||
int green0 = GPART(ifgcolor[0]);
|
||||
int red0 = RPART(ifgcolor[0]);
|
||||
|
@ -6666,6 +6849,9 @@ namespace swrenderer
|
|||
fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8);
|
||||
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8);
|
||||
|
||||
fgcolor = _mm_add_epi16(fgcolor, lightcontrib);
|
||||
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(256));
|
||||
|
||||
// Blend
|
||||
uint32_t alpha0 = APART(ifgcolor[0]);
|
||||
uint32_t alpha1 = APART(ifgcolor[1]);
|
||||
|
@ -6721,7 +6907,10 @@ namespace swrenderer
|
|||
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
|
||||
|
||||
// Shade
|
||||
mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
|
||||
__m128i lightcontrib = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
|
||||
lightcontrib = _mm_sub_epi16(lightcontrib, mlight);
|
||||
lightcontrib = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, lightcontrib), 8);
|
||||
|
||||
int blue0 = BPART(ifgcolor[0]);
|
||||
int green0 = GPART(ifgcolor[0]);
|
||||
int red0 = RPART(ifgcolor[0]);
|
||||
|
@ -6739,6 +6928,9 @@ namespace swrenderer
|
|||
fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8);
|
||||
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8);
|
||||
|
||||
fgcolor = _mm_add_epi16(fgcolor, lightcontrib);
|
||||
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(256));
|
||||
|
||||
// Blend
|
||||
uint32_t alpha0 = APART(ifgcolor[0]);
|
||||
uint32_t alpha1 = APART(ifgcolor[1]);
|
||||
|
|
|
@ -278,15 +278,18 @@ namespace swrenderer
|
|||
function Shade($blendVariant, $isSimpleShade)
|
||||
{
|
||||
if ($blendVariant == "copy" || $blendVariant == "shaded") return;
|
||||
?>
|
||||
mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
|
||||
<?
|
||||
|
||||
if ($isSimpleShade == true)
|
||||
{ ?>
|
||||
mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
|
||||
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, mlight), 8);
|
||||
<? }
|
||||
else
|
||||
{ ?>
|
||||
__m128i lightcontrib = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
|
||||
lightcontrib = _mm_sub_epi16(lightcontrib, mlight);
|
||||
lightcontrib = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, lightcontrib), 8);
|
||||
|
||||
int blue0 = BPART(ifgcolor[0]);
|
||||
int green0 = GPART(ifgcolor[0]);
|
||||
int red0 = RPART(ifgcolor[0]);
|
||||
|
@ -303,6 +306,9 @@ namespace swrenderer
|
|||
fgcolor = _mm_mullo_epi16(fgcolor, mlight);
|
||||
fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8);
|
||||
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8);
|
||||
|
||||
fgcolor = _mm_add_epi16(fgcolor, lightcontrib);
|
||||
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(256));
|
||||
<? }
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue