Clamp dynlights to 0-1 range on sprites

This commit is contained in:
Magnus Norddahl 2017-02-23 07:49:02 +01:00
parent 92e6f070b4
commit c5683bbde5
2 changed files with 67 additions and 262 deletions

View file

@ -657,12 +657,9 @@ namespace swrenderer
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128()); __m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
// Shade // Shade
__m128i material = fgcolor; mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, mlight), 8); fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, mlight), 8);
fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, dynlight), 8));
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255));
// Blend // Blend
__m128i outcolor = fgcolor; __m128i outcolor = fgcolor;
outcolor = _mm_packus_epi16(outcolor, _mm_setzero_si128()); outcolor = _mm_packus_epi16(outcolor, _mm_setzero_si128());
@ -689,12 +686,9 @@ namespace swrenderer
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128()); __m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
// Shade // Shade
__m128i material = fgcolor; mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, mlight), 8); fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, mlight), 8);
fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, dynlight), 8));
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255));
// Blend // Blend
__m128i outcolor = fgcolor; __m128i outcolor = fgcolor;
outcolor = _mm_packus_epi16(outcolor, _mm_setzero_si128()); outcolor = _mm_packus_epi16(outcolor, _mm_setzero_si128());
@ -805,12 +799,9 @@ namespace swrenderer
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128()); __m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
// Shade // Shade
__m128i material = fgcolor; mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, mlight), 8); fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, mlight), 8);
fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, dynlight), 8));
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255));
// Blend // Blend
__m128i outcolor = fgcolor; __m128i outcolor = fgcolor;
outcolor = _mm_packus_epi16(outcolor, _mm_setzero_si128()); outcolor = _mm_packus_epi16(outcolor, _mm_setzero_si128());
@ -857,12 +848,9 @@ namespace swrenderer
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128()); __m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
// Shade // Shade
__m128i material = fgcolor; mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, mlight), 8); fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, mlight), 8);
fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, dynlight), 8));
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255));
// Blend // Blend
__m128i outcolor = fgcolor; __m128i outcolor = fgcolor;
outcolor = _mm_packus_epi16(outcolor, _mm_setzero_si128()); outcolor = _mm_packus_epi16(outcolor, _mm_setzero_si128());
@ -943,7 +931,7 @@ namespace swrenderer
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128()); __m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
// Shade // Shade
__m128i material = fgcolor; mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
int blue0 = BPART(ifgcolor[0]); int blue0 = BPART(ifgcolor[0]);
int green0 = GPART(ifgcolor[0]); int green0 = GPART(ifgcolor[0]);
int red0 = RPART(ifgcolor[0]); int red0 = RPART(ifgcolor[0]);
@ -961,9 +949,6 @@ namespace swrenderer
fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8); fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8);
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8); fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8);
fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, dynlight), 8));
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255));
// Blend // Blend
__m128i outcolor = fgcolor; __m128i outcolor = fgcolor;
outcolor = _mm_packus_epi16(outcolor, _mm_setzero_si128()); outcolor = _mm_packus_epi16(outcolor, _mm_setzero_si128());
@ -990,7 +975,7 @@ namespace swrenderer
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128()); __m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
// Shade // Shade
__m128i material = fgcolor; mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
int blue0 = BPART(ifgcolor[0]); int blue0 = BPART(ifgcolor[0]);
int green0 = GPART(ifgcolor[0]); int green0 = GPART(ifgcolor[0]);
int red0 = RPART(ifgcolor[0]); int red0 = RPART(ifgcolor[0]);
@ -1008,9 +993,6 @@ namespace swrenderer
fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8); fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8);
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8); fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8);
fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, dynlight), 8));
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255));
// Blend // Blend
__m128i outcolor = fgcolor; __m128i outcolor = fgcolor;
outcolor = _mm_packus_epi16(outcolor, _mm_setzero_si128()); outcolor = _mm_packus_epi16(outcolor, _mm_setzero_si128());
@ -1126,7 +1108,7 @@ namespace swrenderer
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128()); __m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
// Shade // Shade
__m128i material = fgcolor; mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
int blue0 = BPART(ifgcolor[0]); int blue0 = BPART(ifgcolor[0]);
int green0 = GPART(ifgcolor[0]); int green0 = GPART(ifgcolor[0]);
int red0 = RPART(ifgcolor[0]); int red0 = RPART(ifgcolor[0]);
@ -1144,9 +1126,6 @@ namespace swrenderer
fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8); fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8);
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8); fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8);
fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, dynlight), 8));
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255));
// Blend // Blend
__m128i outcolor = fgcolor; __m128i outcolor = fgcolor;
outcolor = _mm_packus_epi16(outcolor, _mm_setzero_si128()); outcolor = _mm_packus_epi16(outcolor, _mm_setzero_si128());
@ -1193,7 +1172,7 @@ namespace swrenderer
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128()); __m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
// Shade // Shade
__m128i material = fgcolor; mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
int blue0 = BPART(ifgcolor[0]); int blue0 = BPART(ifgcolor[0]);
int green0 = GPART(ifgcolor[0]); int green0 = GPART(ifgcolor[0]);
int red0 = RPART(ifgcolor[0]); int red0 = RPART(ifgcolor[0]);
@ -1211,9 +1190,6 @@ namespace swrenderer
fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8); fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8);
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8); fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8);
fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, dynlight), 8));
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255));
// Blend // Blend
__m128i outcolor = fgcolor; __m128i outcolor = fgcolor;
outcolor = _mm_packus_epi16(outcolor, _mm_setzero_si128()); outcolor = _mm_packus_epi16(outcolor, _mm_setzero_si128());
@ -1306,12 +1282,9 @@ namespace swrenderer
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128()); __m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
// Shade // Shade
__m128i material = fgcolor; mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, mlight), 8); fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, mlight), 8);
fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, dynlight), 8));
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255));
// Blend // Blend
uint32_t alpha0 = APART(ifgcolor[0]); uint32_t alpha0 = APART(ifgcolor[0]);
uint32_t alpha1 = APART(ifgcolor[1]); uint32_t alpha1 = APART(ifgcolor[1]);
@ -1368,12 +1341,9 @@ namespace swrenderer
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128()); __m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
// Shade // Shade
__m128i material = fgcolor; mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, mlight), 8); fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, mlight), 8);
fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, dynlight), 8));
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255));
// Blend // Blend
uint32_t alpha0 = APART(ifgcolor[0]); uint32_t alpha0 = APART(ifgcolor[0]);
uint32_t alpha1 = APART(ifgcolor[1]); uint32_t alpha1 = APART(ifgcolor[1]);
@ -1514,12 +1484,9 @@ namespace swrenderer
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128()); __m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
// Shade // Shade
__m128i material = fgcolor; mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, mlight), 8); fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, mlight), 8);
fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, dynlight), 8));
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255));
// Blend // Blend
uint32_t alpha0 = APART(ifgcolor[0]); uint32_t alpha0 = APART(ifgcolor[0]);
uint32_t alpha1 = APART(ifgcolor[1]); uint32_t alpha1 = APART(ifgcolor[1]);
@ -1596,12 +1563,9 @@ namespace swrenderer
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128()); __m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
// Shade // Shade
__m128i material = fgcolor; mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, mlight), 8); fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, mlight), 8);
fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, dynlight), 8));
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255));
// Blend // Blend
uint32_t alpha0 = APART(ifgcolor[0]); uint32_t alpha0 = APART(ifgcolor[0]);
uint32_t alpha1 = APART(ifgcolor[1]); uint32_t alpha1 = APART(ifgcolor[1]);
@ -1712,7 +1676,7 @@ namespace swrenderer
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128()); __m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
// Shade // Shade
__m128i material = fgcolor; mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
int blue0 = BPART(ifgcolor[0]); int blue0 = BPART(ifgcolor[0]);
int green0 = GPART(ifgcolor[0]); int green0 = GPART(ifgcolor[0]);
int red0 = RPART(ifgcolor[0]); int red0 = RPART(ifgcolor[0]);
@ -1730,9 +1694,6 @@ namespace swrenderer
fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8); fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8);
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8); fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8);
fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, dynlight), 8));
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255));
// Blend // Blend
uint32_t alpha0 = APART(ifgcolor[0]); uint32_t alpha0 = APART(ifgcolor[0]);
uint32_t alpha1 = APART(ifgcolor[1]); uint32_t alpha1 = APART(ifgcolor[1]);
@ -1789,7 +1750,7 @@ namespace swrenderer
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128()); __m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
// Shade // Shade
__m128i material = fgcolor; mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
int blue0 = BPART(ifgcolor[0]); int blue0 = BPART(ifgcolor[0]);
int green0 = GPART(ifgcolor[0]); int green0 = GPART(ifgcolor[0]);
int red0 = RPART(ifgcolor[0]); int red0 = RPART(ifgcolor[0]);
@ -1807,9 +1768,6 @@ namespace swrenderer
fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8); fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8);
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8); fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8);
fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, dynlight), 8));
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255));
// Blend // Blend
uint32_t alpha0 = APART(ifgcolor[0]); uint32_t alpha0 = APART(ifgcolor[0]);
uint32_t alpha1 = APART(ifgcolor[1]); uint32_t alpha1 = APART(ifgcolor[1]);
@ -1955,7 +1913,7 @@ namespace swrenderer
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128()); __m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
// Shade // Shade
__m128i material = fgcolor; mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
int blue0 = BPART(ifgcolor[0]); int blue0 = BPART(ifgcolor[0]);
int green0 = GPART(ifgcolor[0]); int green0 = GPART(ifgcolor[0]);
int red0 = RPART(ifgcolor[0]); int red0 = RPART(ifgcolor[0]);
@ -1973,9 +1931,6 @@ namespace swrenderer
fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8); fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8);
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8); fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8);
fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, dynlight), 8));
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255));
// Blend // Blend
uint32_t alpha0 = APART(ifgcolor[0]); uint32_t alpha0 = APART(ifgcolor[0]);
uint32_t alpha1 = APART(ifgcolor[1]); uint32_t alpha1 = APART(ifgcolor[1]);
@ -2052,7 +2007,7 @@ namespace swrenderer
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128()); __m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
// Shade // Shade
__m128i material = fgcolor; mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
int blue0 = BPART(ifgcolor[0]); int blue0 = BPART(ifgcolor[0]);
int green0 = GPART(ifgcolor[0]); int green0 = GPART(ifgcolor[0]);
int red0 = RPART(ifgcolor[0]); int red0 = RPART(ifgcolor[0]);
@ -2070,9 +2025,6 @@ namespace swrenderer
fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8); fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8);
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8); fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8);
fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, dynlight), 8));
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255));
// Blend // Blend
uint32_t alpha0 = APART(ifgcolor[0]); uint32_t alpha0 = APART(ifgcolor[0]);
uint32_t alpha1 = APART(ifgcolor[1]); uint32_t alpha1 = APART(ifgcolor[1]);
@ -2194,12 +2146,9 @@ namespace swrenderer
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128()); __m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
// Shade // Shade
__m128i material = fgcolor; mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, mlight), 8); fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, mlight), 8);
fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, dynlight), 8));
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255));
// Blend // Blend
uint32_t alpha0 = APART(ifgcolor[0]); uint32_t alpha0 = APART(ifgcolor[0]);
uint32_t alpha1 = APART(ifgcolor[1]); uint32_t alpha1 = APART(ifgcolor[1]);
@ -2256,12 +2205,9 @@ namespace swrenderer
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128()); __m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
// Shade // Shade
__m128i material = fgcolor; mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, mlight), 8); fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, mlight), 8);
fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, dynlight), 8));
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255));
// Blend // Blend
uint32_t alpha0 = APART(ifgcolor[0]); uint32_t alpha0 = APART(ifgcolor[0]);
uint32_t alpha1 = APART(ifgcolor[1]); uint32_t alpha1 = APART(ifgcolor[1]);
@ -2402,12 +2348,9 @@ namespace swrenderer
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128()); __m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
// Shade // Shade
__m128i material = fgcolor; mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, mlight), 8); fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, mlight), 8);
fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, dynlight), 8));
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255));
// Blend // Blend
uint32_t alpha0 = APART(ifgcolor[0]); uint32_t alpha0 = APART(ifgcolor[0]);
uint32_t alpha1 = APART(ifgcolor[1]); uint32_t alpha1 = APART(ifgcolor[1]);
@ -2484,12 +2427,9 @@ namespace swrenderer
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128()); __m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
// Shade // Shade
__m128i material = fgcolor; mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, mlight), 8); fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, mlight), 8);
fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, dynlight), 8));
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255));
// Blend // Blend
uint32_t alpha0 = APART(ifgcolor[0]); uint32_t alpha0 = APART(ifgcolor[0]);
uint32_t alpha1 = APART(ifgcolor[1]); uint32_t alpha1 = APART(ifgcolor[1]);
@ -2600,7 +2540,7 @@ namespace swrenderer
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128()); __m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
// Shade // Shade
__m128i material = fgcolor; mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
int blue0 = BPART(ifgcolor[0]); int blue0 = BPART(ifgcolor[0]);
int green0 = GPART(ifgcolor[0]); int green0 = GPART(ifgcolor[0]);
int red0 = RPART(ifgcolor[0]); int red0 = RPART(ifgcolor[0]);
@ -2618,9 +2558,6 @@ namespace swrenderer
fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8); fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8);
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8); fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8);
fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, dynlight), 8));
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255));
// Blend // Blend
uint32_t alpha0 = APART(ifgcolor[0]); uint32_t alpha0 = APART(ifgcolor[0]);
uint32_t alpha1 = APART(ifgcolor[1]); uint32_t alpha1 = APART(ifgcolor[1]);
@ -2677,7 +2614,7 @@ namespace swrenderer
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128()); __m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
// Shade // Shade
__m128i material = fgcolor; mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
int blue0 = BPART(ifgcolor[0]); int blue0 = BPART(ifgcolor[0]);
int green0 = GPART(ifgcolor[0]); int green0 = GPART(ifgcolor[0]);
int red0 = RPART(ifgcolor[0]); int red0 = RPART(ifgcolor[0]);
@ -2695,9 +2632,6 @@ namespace swrenderer
fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8); fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8);
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8); fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8);
fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, dynlight), 8));
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255));
// Blend // Blend
uint32_t alpha0 = APART(ifgcolor[0]); uint32_t alpha0 = APART(ifgcolor[0]);
uint32_t alpha1 = APART(ifgcolor[1]); uint32_t alpha1 = APART(ifgcolor[1]);
@ -2843,7 +2777,7 @@ namespace swrenderer
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128()); __m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
// Shade // Shade
__m128i material = fgcolor; mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
int blue0 = BPART(ifgcolor[0]); int blue0 = BPART(ifgcolor[0]);
int green0 = GPART(ifgcolor[0]); int green0 = GPART(ifgcolor[0]);
int red0 = RPART(ifgcolor[0]); int red0 = RPART(ifgcolor[0]);
@ -2861,9 +2795,6 @@ namespace swrenderer
fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8); fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8);
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8); fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8);
fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, dynlight), 8));
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255));
// Blend // Blend
uint32_t alpha0 = APART(ifgcolor[0]); uint32_t alpha0 = APART(ifgcolor[0]);
uint32_t alpha1 = APART(ifgcolor[1]); uint32_t alpha1 = APART(ifgcolor[1]);
@ -2940,7 +2871,7 @@ namespace swrenderer
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128()); __m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
// Shade // Shade
__m128i material = fgcolor; mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
int blue0 = BPART(ifgcolor[0]); int blue0 = BPART(ifgcolor[0]);
int green0 = GPART(ifgcolor[0]); int green0 = GPART(ifgcolor[0]);
int red0 = RPART(ifgcolor[0]); int red0 = RPART(ifgcolor[0]);
@ -2958,9 +2889,6 @@ namespace swrenderer
fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8); fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8);
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8); fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8);
fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, dynlight), 8));
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255));
// Blend // Blend
uint32_t alpha0 = APART(ifgcolor[0]); uint32_t alpha0 = APART(ifgcolor[0]);
uint32_t alpha1 = APART(ifgcolor[1]); uint32_t alpha1 = APART(ifgcolor[1]);
@ -3082,12 +3010,9 @@ namespace swrenderer
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128()); __m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
// Shade // Shade
__m128i material = fgcolor; mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, mlight), 8); fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, mlight), 8);
fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, dynlight), 8));
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255));
// Blend // Blend
uint32_t alpha0 = APART(ifgcolor[0]); uint32_t alpha0 = APART(ifgcolor[0]);
uint32_t alpha1 = APART(ifgcolor[1]); uint32_t alpha1 = APART(ifgcolor[1]);
@ -3144,12 +3069,9 @@ namespace swrenderer
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128()); __m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
// Shade // Shade
__m128i material = fgcolor; mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, mlight), 8); fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, mlight), 8);
fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, dynlight), 8));
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255));
// Blend // Blend
uint32_t alpha0 = APART(ifgcolor[0]); uint32_t alpha0 = APART(ifgcolor[0]);
uint32_t alpha1 = APART(ifgcolor[1]); uint32_t alpha1 = APART(ifgcolor[1]);
@ -3290,12 +3212,9 @@ namespace swrenderer
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128()); __m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
// Shade // Shade
__m128i material = fgcolor; mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, mlight), 8); fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, mlight), 8);
fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, dynlight), 8));
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255));
// Blend // Blend
uint32_t alpha0 = APART(ifgcolor[0]); uint32_t alpha0 = APART(ifgcolor[0]);
uint32_t alpha1 = APART(ifgcolor[1]); uint32_t alpha1 = APART(ifgcolor[1]);
@ -3372,12 +3291,9 @@ namespace swrenderer
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128()); __m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
// Shade // Shade
__m128i material = fgcolor; mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, mlight), 8); fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, mlight), 8);
fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, dynlight), 8));
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255));
// Blend // Blend
uint32_t alpha0 = APART(ifgcolor[0]); uint32_t alpha0 = APART(ifgcolor[0]);
uint32_t alpha1 = APART(ifgcolor[1]); uint32_t alpha1 = APART(ifgcolor[1]);
@ -3488,7 +3404,7 @@ namespace swrenderer
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128()); __m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
// Shade // Shade
__m128i material = fgcolor; mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
int blue0 = BPART(ifgcolor[0]); int blue0 = BPART(ifgcolor[0]);
int green0 = GPART(ifgcolor[0]); int green0 = GPART(ifgcolor[0]);
int red0 = RPART(ifgcolor[0]); int red0 = RPART(ifgcolor[0]);
@ -3506,9 +3422,6 @@ namespace swrenderer
fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8); fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8);
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8); fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8);
fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, dynlight), 8));
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255));
// Blend // Blend
uint32_t alpha0 = APART(ifgcolor[0]); uint32_t alpha0 = APART(ifgcolor[0]);
uint32_t alpha1 = APART(ifgcolor[1]); uint32_t alpha1 = APART(ifgcolor[1]);
@ -3565,7 +3478,7 @@ namespace swrenderer
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128()); __m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
// Shade // Shade
__m128i material = fgcolor; mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
int blue0 = BPART(ifgcolor[0]); int blue0 = BPART(ifgcolor[0]);
int green0 = GPART(ifgcolor[0]); int green0 = GPART(ifgcolor[0]);
int red0 = RPART(ifgcolor[0]); int red0 = RPART(ifgcolor[0]);
@ -3583,9 +3496,6 @@ namespace swrenderer
fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8); fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8);
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8); fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8);
fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, dynlight), 8));
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255));
// Blend // Blend
uint32_t alpha0 = APART(ifgcolor[0]); uint32_t alpha0 = APART(ifgcolor[0]);
uint32_t alpha1 = APART(ifgcolor[1]); uint32_t alpha1 = APART(ifgcolor[1]);
@ -3731,7 +3641,7 @@ namespace swrenderer
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128()); __m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
// Shade // Shade
__m128i material = fgcolor; mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
int blue0 = BPART(ifgcolor[0]); int blue0 = BPART(ifgcolor[0]);
int green0 = GPART(ifgcolor[0]); int green0 = GPART(ifgcolor[0]);
int red0 = RPART(ifgcolor[0]); int red0 = RPART(ifgcolor[0]);
@ -3749,9 +3659,6 @@ namespace swrenderer
fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8); fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8);
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8); fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8);
fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, dynlight), 8));
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255));
// Blend // Blend
uint32_t alpha0 = APART(ifgcolor[0]); uint32_t alpha0 = APART(ifgcolor[0]);
uint32_t alpha1 = APART(ifgcolor[1]); uint32_t alpha1 = APART(ifgcolor[1]);
@ -3828,7 +3735,7 @@ namespace swrenderer
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128()); __m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
// Shade // Shade
__m128i material = fgcolor; mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
int blue0 = BPART(ifgcolor[0]); int blue0 = BPART(ifgcolor[0]);
int green0 = GPART(ifgcolor[0]); int green0 = GPART(ifgcolor[0]);
int red0 = RPART(ifgcolor[0]); int red0 = RPART(ifgcolor[0]);
@ -3846,9 +3753,6 @@ namespace swrenderer
fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8); fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8);
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8); fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8);
fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, dynlight), 8));
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255));
// Blend // Blend
uint32_t alpha0 = APART(ifgcolor[0]); uint32_t alpha0 = APART(ifgcolor[0]);
uint32_t alpha1 = APART(ifgcolor[1]); uint32_t alpha1 = APART(ifgcolor[1]);
@ -3964,12 +3868,9 @@ namespace swrenderer
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128()); __m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
// Shade // Shade
__m128i material = fgcolor; mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, mlight), 8); fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, mlight), 8);
fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, dynlight), 8));
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255));
// Blend // Blend
__m128i outcolor = fgcolor; __m128i outcolor = fgcolor;
outcolor = _mm_packus_epi16(outcolor, _mm_setzero_si128()); outcolor = _mm_packus_epi16(outcolor, _mm_setzero_si128());
@ -3995,12 +3896,9 @@ namespace swrenderer
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128()); __m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
// Shade // Shade
__m128i material = fgcolor; mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, mlight), 8); fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, mlight), 8);
fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, dynlight), 8));
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255));
// Blend // Blend
__m128i outcolor = fgcolor; __m128i outcolor = fgcolor;
outcolor = _mm_packus_epi16(outcolor, _mm_setzero_si128()); outcolor = _mm_packus_epi16(outcolor, _mm_setzero_si128());
@ -4075,7 +3973,7 @@ namespace swrenderer
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128()); __m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
// Shade // Shade
__m128i material = fgcolor; mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
int blue0 = BPART(ifgcolor[0]); int blue0 = BPART(ifgcolor[0]);
int green0 = GPART(ifgcolor[0]); int green0 = GPART(ifgcolor[0]);
int red0 = RPART(ifgcolor[0]); int red0 = RPART(ifgcolor[0]);
@ -4093,9 +3991,6 @@ namespace swrenderer
fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8); fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8);
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8); fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8);
fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, dynlight), 8));
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255));
// Blend // Blend
__m128i outcolor = fgcolor; __m128i outcolor = fgcolor;
outcolor = _mm_packus_epi16(outcolor, _mm_setzero_si128()); outcolor = _mm_packus_epi16(outcolor, _mm_setzero_si128());
@ -4121,7 +4016,7 @@ namespace swrenderer
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128()); __m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
// Shade // Shade
__m128i material = fgcolor; mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
int blue0 = BPART(ifgcolor[0]); int blue0 = BPART(ifgcolor[0]);
int green0 = GPART(ifgcolor[0]); int green0 = GPART(ifgcolor[0]);
int red0 = RPART(ifgcolor[0]); int red0 = RPART(ifgcolor[0]);
@ -4139,9 +4034,6 @@ namespace swrenderer
fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8); fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8);
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8); fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8);
fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, dynlight), 8));
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255));
// Blend // Blend
__m128i outcolor = fgcolor; __m128i outcolor = fgcolor;
outcolor = _mm_packus_epi16(outcolor, _mm_setzero_si128()); outcolor = _mm_packus_epi16(outcolor, _mm_setzero_si128());
@ -4228,12 +4120,9 @@ namespace swrenderer
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128()); __m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
// Shade // Shade
__m128i material = fgcolor; mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, mlight), 8); fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, mlight), 8);
fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, dynlight), 8));
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255));
// Blend // Blend
uint32_t alpha0 = APART(ifgcolor[0]); uint32_t alpha0 = APART(ifgcolor[0]);
uint32_t alpha1 = APART(ifgcolor[1]); uint32_t alpha1 = APART(ifgcolor[1]);
@ -4289,12 +4178,9 @@ namespace swrenderer
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128()); __m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
// Shade // Shade
__m128i material = fgcolor; mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, mlight), 8); fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, mlight), 8);
fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, dynlight), 8));
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255));
// Blend // Blend
uint32_t alpha0 = APART(ifgcolor[0]); uint32_t alpha0 = APART(ifgcolor[0]);
uint32_t alpha1 = APART(ifgcolor[1]); uint32_t alpha1 = APART(ifgcolor[1]);
@ -4399,7 +4285,7 @@ namespace swrenderer
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128()); __m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
// Shade // Shade
__m128i material = fgcolor; mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
int blue0 = BPART(ifgcolor[0]); int blue0 = BPART(ifgcolor[0]);
int green0 = GPART(ifgcolor[0]); int green0 = GPART(ifgcolor[0]);
int red0 = RPART(ifgcolor[0]); int red0 = RPART(ifgcolor[0]);
@ -4417,9 +4303,6 @@ namespace swrenderer
fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8); fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8);
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8); fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8);
fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, dynlight), 8));
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255));
// Blend // Blend
uint32_t alpha0 = APART(ifgcolor[0]); uint32_t alpha0 = APART(ifgcolor[0]);
uint32_t alpha1 = APART(ifgcolor[1]); uint32_t alpha1 = APART(ifgcolor[1]);
@ -4475,7 +4358,7 @@ namespace swrenderer
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128()); __m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
// Shade // Shade
__m128i material = fgcolor; mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
int blue0 = BPART(ifgcolor[0]); int blue0 = BPART(ifgcolor[0]);
int green0 = GPART(ifgcolor[0]); int green0 = GPART(ifgcolor[0]);
int red0 = RPART(ifgcolor[0]); int red0 = RPART(ifgcolor[0]);
@ -4493,9 +4376,6 @@ namespace swrenderer
fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8); fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8);
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8); fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8);
fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, dynlight), 8));
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255));
// Blend // Blend
uint32_t alpha0 = APART(ifgcolor[0]); uint32_t alpha0 = APART(ifgcolor[0]);
uint32_t alpha1 = APART(ifgcolor[1]); uint32_t alpha1 = APART(ifgcolor[1]);
@ -4611,12 +4491,9 @@ namespace swrenderer
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128()); __m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
// Shade // Shade
__m128i material = fgcolor; mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, mlight), 8); fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, mlight), 8);
fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, dynlight), 8));
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255));
// Blend // Blend
uint32_t alpha0 = APART(ifgcolor[0]); uint32_t alpha0 = APART(ifgcolor[0]);
uint32_t alpha1 = APART(ifgcolor[1]); uint32_t alpha1 = APART(ifgcolor[1]);
@ -4672,12 +4549,9 @@ namespace swrenderer
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128()); __m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
// Shade // Shade
__m128i material = fgcolor; mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, mlight), 8); fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, mlight), 8);
fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, dynlight), 8));
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255));
// Blend // Blend
uint32_t alpha0 = APART(ifgcolor[0]); uint32_t alpha0 = APART(ifgcolor[0]);
uint32_t alpha1 = APART(ifgcolor[1]); uint32_t alpha1 = APART(ifgcolor[1]);
@ -4782,7 +4656,7 @@ namespace swrenderer
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128()); __m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
// Shade // Shade
__m128i material = fgcolor; mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
int blue0 = BPART(ifgcolor[0]); int blue0 = BPART(ifgcolor[0]);
int green0 = GPART(ifgcolor[0]); int green0 = GPART(ifgcolor[0]);
int red0 = RPART(ifgcolor[0]); int red0 = RPART(ifgcolor[0]);
@ -4800,9 +4674,6 @@ namespace swrenderer
fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8); fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8);
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8); fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8);
fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, dynlight), 8));
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255));
// Blend // Blend
uint32_t alpha0 = APART(ifgcolor[0]); uint32_t alpha0 = APART(ifgcolor[0]);
uint32_t alpha1 = APART(ifgcolor[1]); uint32_t alpha1 = APART(ifgcolor[1]);
@ -4858,7 +4729,7 @@ namespace swrenderer
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128()); __m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
// Shade // Shade
__m128i material = fgcolor; mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
int blue0 = BPART(ifgcolor[0]); int blue0 = BPART(ifgcolor[0]);
int green0 = GPART(ifgcolor[0]); int green0 = GPART(ifgcolor[0]);
int red0 = RPART(ifgcolor[0]); int red0 = RPART(ifgcolor[0]);
@ -4876,9 +4747,6 @@ namespace swrenderer
fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8); fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8);
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8); fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8);
fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, dynlight), 8));
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255));
// Blend // Blend
uint32_t alpha0 = APART(ifgcolor[0]); uint32_t alpha0 = APART(ifgcolor[0]);
uint32_t alpha1 = APART(ifgcolor[1]); uint32_t alpha1 = APART(ifgcolor[1]);
@ -4994,12 +4862,9 @@ namespace swrenderer
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128()); __m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
// Shade // Shade
__m128i material = fgcolor; mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, mlight), 8); fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, mlight), 8);
fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, dynlight), 8));
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255));
// Blend // Blend
uint32_t alpha0 = APART(ifgcolor[0]); uint32_t alpha0 = APART(ifgcolor[0]);
uint32_t alpha1 = APART(ifgcolor[1]); uint32_t alpha1 = APART(ifgcolor[1]);
@ -5055,12 +4920,9 @@ namespace swrenderer
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128()); __m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
// Shade // Shade
__m128i material = fgcolor; mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, mlight), 8); fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, mlight), 8);
fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, dynlight), 8));
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255));
// Blend // Blend
uint32_t alpha0 = APART(ifgcolor[0]); uint32_t alpha0 = APART(ifgcolor[0]);
uint32_t alpha1 = APART(ifgcolor[1]); uint32_t alpha1 = APART(ifgcolor[1]);
@ -5165,7 +5027,7 @@ namespace swrenderer
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128()); __m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
// Shade // Shade
__m128i material = fgcolor; mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
int blue0 = BPART(ifgcolor[0]); int blue0 = BPART(ifgcolor[0]);
int green0 = GPART(ifgcolor[0]); int green0 = GPART(ifgcolor[0]);
int red0 = RPART(ifgcolor[0]); int red0 = RPART(ifgcolor[0]);
@ -5183,9 +5045,6 @@ namespace swrenderer
fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8); fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8);
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8); fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8);
fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, dynlight), 8));
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255));
// Blend // Blend
uint32_t alpha0 = APART(ifgcolor[0]); uint32_t alpha0 = APART(ifgcolor[0]);
uint32_t alpha1 = APART(ifgcolor[1]); uint32_t alpha1 = APART(ifgcolor[1]);
@ -5241,7 +5100,7 @@ namespace swrenderer
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128()); __m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
// Shade // Shade
__m128i material = fgcolor; mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
int blue0 = BPART(ifgcolor[0]); int blue0 = BPART(ifgcolor[0]);
int green0 = GPART(ifgcolor[0]); int green0 = GPART(ifgcolor[0]);
int red0 = RPART(ifgcolor[0]); int red0 = RPART(ifgcolor[0]);
@ -5259,9 +5118,6 @@ namespace swrenderer
fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8); fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8);
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8); fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8);
fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, dynlight), 8));
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255));
// Blend // Blend
uint32_t alpha0 = APART(ifgcolor[0]); uint32_t alpha0 = APART(ifgcolor[0]);
uint32_t alpha1 = APART(ifgcolor[1]); uint32_t alpha1 = APART(ifgcolor[1]);
@ -5626,12 +5482,9 @@ namespace swrenderer
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128()); __m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
// Shade // Shade
__m128i material = fgcolor; mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, mlight), 8); fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, mlight), 8);
fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, dynlight), 8));
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255));
// Blend // Blend
__m128i outcolor = fgcolor; __m128i outcolor = fgcolor;
outcolor = _mm_packus_epi16(outcolor, _mm_setzero_si128()); outcolor = _mm_packus_epi16(outcolor, _mm_setzero_si128());
@ -5657,12 +5510,9 @@ namespace swrenderer
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128()); __m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
// Shade // Shade
__m128i material = fgcolor; mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, mlight), 8); fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, mlight), 8);
fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, dynlight), 8));
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255));
// Blend // Blend
__m128i outcolor = fgcolor; __m128i outcolor = fgcolor;
outcolor = _mm_packus_epi16(outcolor, _mm_setzero_si128()); outcolor = _mm_packus_epi16(outcolor, _mm_setzero_si128());
@ -5738,7 +5588,7 @@ namespace swrenderer
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128()); __m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
// Shade // Shade
__m128i material = fgcolor; mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
int blue0 = BPART(ifgcolor[0]); int blue0 = BPART(ifgcolor[0]);
int green0 = GPART(ifgcolor[0]); int green0 = GPART(ifgcolor[0]);
int red0 = RPART(ifgcolor[0]); int red0 = RPART(ifgcolor[0]);
@ -5756,9 +5606,6 @@ namespace swrenderer
fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8); fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8);
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8); fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8);
fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, dynlight), 8));
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255));
// Blend // Blend
__m128i outcolor = fgcolor; __m128i outcolor = fgcolor;
outcolor = _mm_packus_epi16(outcolor, _mm_setzero_si128()); outcolor = _mm_packus_epi16(outcolor, _mm_setzero_si128());
@ -5784,7 +5631,7 @@ namespace swrenderer
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128()); __m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
// Shade // Shade
__m128i material = fgcolor; mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
int blue0 = BPART(ifgcolor[0]); int blue0 = BPART(ifgcolor[0]);
int green0 = GPART(ifgcolor[0]); int green0 = GPART(ifgcolor[0]);
int red0 = RPART(ifgcolor[0]); int red0 = RPART(ifgcolor[0]);
@ -5802,9 +5649,6 @@ namespace swrenderer
fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8); fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8);
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8); fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8);
fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, dynlight), 8));
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255));
// Blend // Blend
__m128i outcolor = fgcolor; __m128i outcolor = fgcolor;
outcolor = _mm_packus_epi16(outcolor, _mm_setzero_si128()); outcolor = _mm_packus_epi16(outcolor, _mm_setzero_si128());
@ -5892,12 +5736,9 @@ namespace swrenderer
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128()); __m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
// Shade // Shade
__m128i material = fgcolor; mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, mlight), 8); fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, mlight), 8);
fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, dynlight), 8));
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255));
// Blend // Blend
uint32_t alpha0 = APART(ifgcolor[0]); uint32_t alpha0 = APART(ifgcolor[0]);
uint32_t alpha1 = APART(ifgcolor[1]); uint32_t alpha1 = APART(ifgcolor[1]);
@ -5953,12 +5794,9 @@ namespace swrenderer
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128()); __m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
// Shade // Shade
__m128i material = fgcolor; mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, mlight), 8); fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, mlight), 8);
fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, dynlight), 8));
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255));
// Blend // Blend
uint32_t alpha0 = APART(ifgcolor[0]); uint32_t alpha0 = APART(ifgcolor[0]);
uint32_t alpha1 = APART(ifgcolor[1]); uint32_t alpha1 = APART(ifgcolor[1]);
@ -6064,7 +5902,7 @@ namespace swrenderer
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128()); __m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
// Shade // Shade
__m128i material = fgcolor; mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
int blue0 = BPART(ifgcolor[0]); int blue0 = BPART(ifgcolor[0]);
int green0 = GPART(ifgcolor[0]); int green0 = GPART(ifgcolor[0]);
int red0 = RPART(ifgcolor[0]); int red0 = RPART(ifgcolor[0]);
@ -6082,9 +5920,6 @@ namespace swrenderer
fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8); fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8);
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8); fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8);
fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, dynlight), 8));
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255));
// Blend // Blend
uint32_t alpha0 = APART(ifgcolor[0]); uint32_t alpha0 = APART(ifgcolor[0]);
uint32_t alpha1 = APART(ifgcolor[1]); uint32_t alpha1 = APART(ifgcolor[1]);
@ -6140,7 +5975,7 @@ namespace swrenderer
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128()); __m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
// Shade // Shade
__m128i material = fgcolor; mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
int blue0 = BPART(ifgcolor[0]); int blue0 = BPART(ifgcolor[0]);
int green0 = GPART(ifgcolor[0]); int green0 = GPART(ifgcolor[0]);
int red0 = RPART(ifgcolor[0]); int red0 = RPART(ifgcolor[0]);
@ -6158,9 +5993,6 @@ namespace swrenderer
fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8); fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8);
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8); fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8);
fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, dynlight), 8));
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255));
// Blend // Blend
uint32_t alpha0 = APART(ifgcolor[0]); uint32_t alpha0 = APART(ifgcolor[0]);
uint32_t alpha1 = APART(ifgcolor[1]); uint32_t alpha1 = APART(ifgcolor[1]);
@ -6277,12 +6109,9 @@ namespace swrenderer
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128()); __m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
// Shade // Shade
__m128i material = fgcolor; mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, mlight), 8); fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, mlight), 8);
fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, dynlight), 8));
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255));
// Blend // Blend
uint32_t alpha0 = APART(ifgcolor[0]); uint32_t alpha0 = APART(ifgcolor[0]);
uint32_t alpha1 = APART(ifgcolor[1]); uint32_t alpha1 = APART(ifgcolor[1]);
@ -6338,12 +6167,9 @@ namespace swrenderer
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128()); __m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
// Shade // Shade
__m128i material = fgcolor; mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, mlight), 8); fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, mlight), 8);
fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, dynlight), 8));
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255));
// Blend // Blend
uint32_t alpha0 = APART(ifgcolor[0]); uint32_t alpha0 = APART(ifgcolor[0]);
uint32_t alpha1 = APART(ifgcolor[1]); uint32_t alpha1 = APART(ifgcolor[1]);
@ -6449,7 +6275,7 @@ namespace swrenderer
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128()); __m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
// Shade // Shade
__m128i material = fgcolor; mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
int blue0 = BPART(ifgcolor[0]); int blue0 = BPART(ifgcolor[0]);
int green0 = GPART(ifgcolor[0]); int green0 = GPART(ifgcolor[0]);
int red0 = RPART(ifgcolor[0]); int red0 = RPART(ifgcolor[0]);
@ -6467,9 +6293,6 @@ namespace swrenderer
fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8); fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8);
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8); fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8);
fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, dynlight), 8));
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255));
// Blend // Blend
uint32_t alpha0 = APART(ifgcolor[0]); uint32_t alpha0 = APART(ifgcolor[0]);
uint32_t alpha1 = APART(ifgcolor[1]); uint32_t alpha1 = APART(ifgcolor[1]);
@ -6525,7 +6348,7 @@ namespace swrenderer
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128()); __m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
// Shade // Shade
__m128i material = fgcolor; mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
int blue0 = BPART(ifgcolor[0]); int blue0 = BPART(ifgcolor[0]);
int green0 = GPART(ifgcolor[0]); int green0 = GPART(ifgcolor[0]);
int red0 = RPART(ifgcolor[0]); int red0 = RPART(ifgcolor[0]);
@ -6543,9 +6366,6 @@ namespace swrenderer
fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8); fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8);
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8); fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8);
fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, dynlight), 8));
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255));
// Blend // Blend
uint32_t alpha0 = APART(ifgcolor[0]); uint32_t alpha0 = APART(ifgcolor[0]);
uint32_t alpha1 = APART(ifgcolor[1]); uint32_t alpha1 = APART(ifgcolor[1]);
@ -6662,12 +6482,9 @@ namespace swrenderer
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128()); __m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
// Shade // Shade
__m128i material = fgcolor; mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, mlight), 8); fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, mlight), 8);
fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, dynlight), 8));
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255));
// Blend // Blend
uint32_t alpha0 = APART(ifgcolor[0]); uint32_t alpha0 = APART(ifgcolor[0]);
uint32_t alpha1 = APART(ifgcolor[1]); uint32_t alpha1 = APART(ifgcolor[1]);
@ -6723,12 +6540,9 @@ namespace swrenderer
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128()); __m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
// Shade // Shade
__m128i material = fgcolor; mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, mlight), 8); fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, mlight), 8);
fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, dynlight), 8));
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255));
// Blend // Blend
uint32_t alpha0 = APART(ifgcolor[0]); uint32_t alpha0 = APART(ifgcolor[0]);
uint32_t alpha1 = APART(ifgcolor[1]); uint32_t alpha1 = APART(ifgcolor[1]);
@ -6834,7 +6648,7 @@ namespace swrenderer
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128()); __m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
// Shade // Shade
__m128i material = fgcolor; mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
int blue0 = BPART(ifgcolor[0]); int blue0 = BPART(ifgcolor[0]);
int green0 = GPART(ifgcolor[0]); int green0 = GPART(ifgcolor[0]);
int red0 = RPART(ifgcolor[0]); int red0 = RPART(ifgcolor[0]);
@ -6852,9 +6666,6 @@ namespace swrenderer
fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8); fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8);
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8); fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8);
fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, dynlight), 8));
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255));
// Blend // Blend
uint32_t alpha0 = APART(ifgcolor[0]); uint32_t alpha0 = APART(ifgcolor[0]);
uint32_t alpha1 = APART(ifgcolor[1]); uint32_t alpha1 = APART(ifgcolor[1]);
@ -6910,7 +6721,7 @@ namespace swrenderer
__m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128()); __m128i fgcolor = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)ifgcolor), _mm_setzero_si128());
// Shade // Shade
__m128i material = fgcolor; mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
int blue0 = BPART(ifgcolor[0]); int blue0 = BPART(ifgcolor[0]);
int green0 = GPART(ifgcolor[0]); int green0 = GPART(ifgcolor[0]);
int red0 = RPART(ifgcolor[0]); int red0 = RPART(ifgcolor[0]);
@ -6928,9 +6739,6 @@ namespace swrenderer
fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8); fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8);
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8); fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8);
fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, dynlight), 8));
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255));
// Blend // Blend
uint32_t alpha0 = APART(ifgcolor[0]); uint32_t alpha0 = APART(ifgcolor[0]);
uint32_t alpha1 = APART(ifgcolor[1]); uint32_t alpha1 = APART(ifgcolor[1]);

View file

@ -279,7 +279,7 @@ namespace swrenderer
{ {
if ($blendVariant == "copy" || $blendVariant == "shaded") return; if ($blendVariant == "copy" || $blendVariant == "shaded") return;
?> ?>
__m128i material = fgcolor; mlight = _mm_min_epi16(_mm_add_epi16(mlight, dynlight), _mm_set1_epi16(256));
<? <?
if ($isSimpleShade == true) if ($isSimpleShade == true)
{ ?> { ?>
@ -303,11 +303,8 @@ namespace swrenderer
fgcolor = _mm_mullo_epi16(fgcolor, mlight); fgcolor = _mm_mullo_epi16(fgcolor, mlight);
fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8); fgcolor = _mm_srli_epi16(_mm_add_epi16(shade_fade, fgcolor), 8);
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8); fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, shade_light), 8);
<? } ?>
fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, dynlight), 8));
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255));
<? } <? }
}
function Blend($blendVariant) function Blend($blendVariant)
{ {