Render the bottom sky layer always with full opacity in the SW true color renderer.

No need to add explicit checks for color (0,0,0,0) here.
This commit is contained in:
Christoph Oelckers 2024-09-12 08:47:00 +02:00
parent 38290b6615
commit ed39413532
2 changed files with 16 additions and 32 deletions

View file

@ -64,8 +64,7 @@ namespace swrenderer
{
uint32_t sample_index = (((((uint32_t)frac) << 8) >> FRACBITS) * textureheight0) >> FRACBITS;
*dest = source0[sample_index];
if (*dest == 0)
*dest |= 0xff000000;
*dest |= 0xff000000;
dest += pitch;
frac += fracstep;
}
@ -92,8 +91,7 @@ namespace swrenderer
{
uint32_t sample_index = (((((uint32_t)frac) << 8) >> FRACBITS) * textureheight0) >> FRACBITS;
uint32_t fg = source0[sample_index];
if (fg == 0)
fg |= 0xff000000;
fg |= 0xff000000;
uint32_t alpha = max(min(frac >> (16 - start_fade), 256), 0);
uint32_t inv_alpha = 256 - alpha;
@ -114,8 +112,7 @@ namespace swrenderer
{
uint32_t sample_index = (((((uint32_t)frac) << 8) >> FRACBITS) * textureheight0) >> FRACBITS;
*dest = source0[sample_index];
if (*dest == 0)
*dest |= 0xff000000;
*dest |= 0xff000000;
frac += fracstep;
dest += pitch;
@ -127,8 +124,7 @@ namespace swrenderer
{
uint32_t sample_index = (((((uint32_t)frac) << 8) >> FRACBITS) * textureheight0) >> FRACBITS;
uint32_t fg = source0[sample_index];
if (fg == 0)
fg |= 0xff000000;
fg |= 0xff000000;
uint32_t alpha = max(min(((2 << 24) - frac) >> (16 - start_fade), 256), 0);
uint32_t inv_alpha = 256 - alpha;
@ -197,8 +193,7 @@ namespace swrenderer
{
uint32_t sample_index2 = min(sample_index, maxtextureheight1);
fg = source1[sample_index2];
if (fg == 0)
fg |= 0xff000000;
fg |= 0xff000000;
}
*dest = fg;
@ -232,8 +227,7 @@ namespace swrenderer
{
uint32_t sample_index2 = min(sample_index, maxtextureheight1);
fg = source1[sample_index2];
if (fg == 0)
fg |= 0xff000000;
fg |= 0xff000000;
}
uint32_t alpha = max(min(frac >> (16 - start_fade), 256), 0);
@ -257,8 +251,7 @@ namespace swrenderer
{
uint32_t sample_index2 = min(sample_index, maxtextureheight1);
fg = source1[sample_index2];
if (fg == 0)
fg |= 0xff000000;
fg |= 0xff000000;
}
*dest = fg;
@ -276,8 +269,7 @@ namespace swrenderer
{
uint32_t sample_index2 = min(sample_index, maxtextureheight1);
fg = source1[sample_index2];
if (fg == 0)
fg |= 0xff000000;
fg |= 0xff000000;
}
uint32_t alpha = max(min(((2 << 24) - frac) >> (16 - start_fade), 256), 0);

View file

@ -64,8 +64,7 @@ namespace swrenderer
{
uint32_t sample_index = (((((uint32_t)frac) << 8) >> FRACBITS) * textureheight0) >> FRACBITS;
*dest = source0[sample_index];
if (*dest == 0)
*dest |= 0xff000000;
*dest |= 0xff000000;
dest += pitch;
frac += fracstep;
}
@ -92,8 +91,7 @@ namespace swrenderer
{
uint32_t sample_index = (((((uint32_t)frac) << 8) >> FRACBITS) * textureheight0) >> FRACBITS;
uint32_t fg = source0[sample_index];
if (fg == 0)
fg |= 0xff000000;
fg |= 0xff000000;
__m128i alpha = _mm_set1_epi16(max(min(frac >> (16 - start_fade), 256), 0));
__m128i inv_alpha = _mm_sub_epi16(_mm_set1_epi16(256), alpha);
@ -112,8 +110,7 @@ namespace swrenderer
{
uint32_t sample_index = (((((uint32_t)frac) << 8) >> FRACBITS) * textureheight0) >> FRACBITS;
*dest = source0[sample_index];
if (*dest == 0)
*dest |= 0xff000000;
*dest |= 0xff000000;
frac += fracstep;
dest += pitch;
@ -125,8 +122,7 @@ namespace swrenderer
{
uint32_t sample_index = (((((uint32_t)frac) << 8) >> FRACBITS) * textureheight0) >> FRACBITS;
uint32_t fg = source0[sample_index];
if (fg == 0)
fg |= 0xff000000;
fg |= 0xff000000;
__m128i alpha = _mm_set1_epi16(max(min(((2 << 24) - frac) >> (16 - start_fade), 256), 0));
__m128i inv_alpha = _mm_sub_epi16(_mm_set1_epi16(256), alpha);
@ -181,8 +177,7 @@ namespace swrenderer
{
uint32_t sample_index2 = min(sample_index, maxtextureheight1);
fg = source1[sample_index2];
if (fg == 0)
fg |= 0xff000000;
fg |= 0xff000000;
}
*dest = fg;
@ -228,8 +223,7 @@ namespace swrenderer
{
uint32_t sample_index2 = min(sample_index, maxtextureheight1);
fg = source1[sample_index2];
if (fg == 0)
fg |= 0xff000000;
fg |= 0xff000000;
}
__m128i alpha = _mm_set1_epi16(max(min(frac >> (16 - start_fade), 256), 0));
@ -253,8 +247,7 @@ namespace swrenderer
{
uint32_t sample_index2 = min(sample_index, maxtextureheight1);
fg = source1[sample_index2];
if (fg == 0)
fg |= 0xff000000;
fg |= 0xff000000;
}
*dest = fg;
@ -272,8 +265,7 @@ namespace swrenderer
{
uint32_t sample_index2 = min(sample_index, maxtextureheight1);
fg = source1[sample_index2];
if (fg == 0)
fg |= 0xff000000;
fg |= 0xff000000;
}
__m128i alpha = _mm_set1_epi16(max(min(((2 << 24) - frac) >> (16 - start_fade), 256), 0));