mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-01-31 13:50:48 +00:00
- fix sky drawer issues when not using max screenblocks
This commit is contained in:
parent
e296d2819b
commit
db295fae3a
4 changed files with 61 additions and 58 deletions
|
@ -151,8 +151,8 @@ void PolyTriangleThreadData::SetViewport(int x, int y, int width, int height, ui
|
||||||
dest_height = new_dest_height;
|
dest_height = new_dest_height;
|
||||||
dest_pitch = new_dest_pitch;
|
dest_pitch = new_dest_pitch;
|
||||||
dest_bgra = new_dest_bgra;
|
dest_bgra = new_dest_bgra;
|
||||||
numa_start_y = numa_node * dest_height / num_numa_nodes;
|
numa_start_y = numa_node * screen->GetHeight() / num_numa_nodes;
|
||||||
numa_end_y = (numa_node + 1) * dest_height / num_numa_nodes;
|
numa_end_y = (numa_node + 1) * screen->GetHeight() / num_numa_nodes;
|
||||||
ccw = true;
|
ccw = true;
|
||||||
weaponScene = false;
|
weaponScene = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -558,21 +558,6 @@ namespace swrenderer
|
||||||
int32_t frac = args.TextureVPos();
|
int32_t frac = args.TextureVPos();
|
||||||
int32_t fracstep = args.TextureVStep();
|
int32_t fracstep = args.TextureVStep();
|
||||||
|
|
||||||
if (!args.FadeSky())
|
|
||||||
{
|
|
||||||
int count = thread->count_for_thread(args.DestY(), args.Count());
|
|
||||||
|
|
||||||
for (int index = 0; index < count; index++)
|
|
||||||
{
|
|
||||||
uint32_t sample_index = (((((uint32_t)frac) << 8) >> FRACBITS) * textureheight0) >> FRACBITS;
|
|
||||||
*dest = source0[sample_index];
|
|
||||||
dest += pitch;
|
|
||||||
frac += fracstep;
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int num_cores = thread->num_cores;
|
int num_cores = thread->num_cores;
|
||||||
int skipped = thread->skipped_by_thread(args.DestY());
|
int skipped = thread->skipped_by_thread(args.DestY());
|
||||||
int count = skipped + thread->count_for_thread(args.DestY(), args.Count()) * num_cores;
|
int count = skipped + thread->count_for_thread(args.DestY(), args.Count()) * num_cores;
|
||||||
|
@ -594,6 +579,21 @@ namespace swrenderer
|
||||||
fracstep *= num_cores;
|
fracstep *= num_cores;
|
||||||
pitch *= num_cores;
|
pitch *= num_cores;
|
||||||
|
|
||||||
|
if (!args.FadeSky())
|
||||||
|
{
|
||||||
|
count = thread->count_for_thread(args.DestY(), args.Count());
|
||||||
|
|
||||||
|
for (int index = 0; index < count; index++)
|
||||||
|
{
|
||||||
|
uint32_t sample_index = (((((uint32_t)frac) << 8) >> FRACBITS) * textureheight0) >> FRACBITS;
|
||||||
|
*dest = source0[sample_index];
|
||||||
|
dest += pitch;
|
||||||
|
frac += fracstep;
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
uint32_t solid_top = args.SolidTopColor();
|
uint32_t solid_top = args.SolidTopColor();
|
||||||
uint32_t solid_bottom = args.SolidBottomColor();
|
uint32_t solid_bottom = args.SolidBottomColor();
|
||||||
|
|
||||||
|
@ -686,7 +686,6 @@ namespace swrenderer
|
||||||
void DrawDoubleSky1PalCommand::Execute(DrawerThread *thread)
|
void DrawDoubleSky1PalCommand::Execute(DrawerThread *thread)
|
||||||
{
|
{
|
||||||
uint8_t *dest = args.Dest();
|
uint8_t *dest = args.Dest();
|
||||||
int count = args.Count();
|
|
||||||
int pitch = args.Viewport()->RenderTarget->GetPitch();
|
int pitch = args.Viewport()->RenderTarget->GetPitch();
|
||||||
const uint8_t *source0 = args.FrontTexturePixels();
|
const uint8_t *source0 = args.FrontTexturePixels();
|
||||||
const uint8_t *source1 = args.BackTexturePixels();
|
const uint8_t *source1 = args.BackTexturePixels();
|
||||||
|
@ -696,6 +695,10 @@ namespace swrenderer
|
||||||
int32_t frac = args.TextureVPos();
|
int32_t frac = args.TextureVPos();
|
||||||
int32_t fracstep = args.TextureVStep();
|
int32_t fracstep = args.TextureVStep();
|
||||||
|
|
||||||
|
int num_cores = thread->num_cores;
|
||||||
|
int skipped = thread->skipped_by_thread(args.DestY());
|
||||||
|
int count = skipped + thread->count_for_thread(args.DestY(), args.Count()) * num_cores;
|
||||||
|
|
||||||
// Find bands for top solid color, top fade, center textured, bottom fade, bottom solid color:
|
// Find bands for top solid color, top fade, center textured, bottom fade, bottom solid color:
|
||||||
int start_fade = 2; // How fast it should fade out
|
int start_fade = 2; // How fast it should fade out
|
||||||
int fade_length = (1 << (24 - start_fade));
|
int fade_length = (1 << (24 - start_fade));
|
||||||
|
@ -708,8 +711,6 @@ namespace swrenderer
|
||||||
start_fadebottom_y = clamp(start_fadebottom_y, 0, count);
|
start_fadebottom_y = clamp(start_fadebottom_y, 0, count);
|
||||||
end_fadebottom_y = clamp(end_fadebottom_y, 0, count);
|
end_fadebottom_y = clamp(end_fadebottom_y, 0, count);
|
||||||
|
|
||||||
int num_cores = thread->num_cores;
|
|
||||||
int skipped = thread->skipped_by_thread(args.DestY());
|
|
||||||
dest = thread->dest_for_thread(args.DestY(), pitch, dest);
|
dest = thread->dest_for_thread(args.DestY(), pitch, dest);
|
||||||
frac += fracstep * skipped;
|
frac += fracstep * skipped;
|
||||||
fracstep *= num_cores;
|
fracstep *= num_cores;
|
||||||
|
|
|
@ -50,21 +50,6 @@ namespace swrenderer
|
||||||
uint32_t solid_bottom = args.SolidBottomColor();
|
uint32_t solid_bottom = args.SolidBottomColor();
|
||||||
bool fadeSky = args.FadeSky();
|
bool fadeSky = args.FadeSky();
|
||||||
|
|
||||||
if (!fadeSky)
|
|
||||||
{
|
|
||||||
int count = thread->count_for_thread(args.DestY(), args.Count());
|
|
||||||
|
|
||||||
for (int index = 0; index < count; index++)
|
|
||||||
{
|
|
||||||
uint32_t sample_index = (((((uint32_t)frac) << 8) >> FRACBITS) * textureheight0) >> FRACBITS;
|
|
||||||
*dest = source0[sample_index];
|
|
||||||
dest += pitch;
|
|
||||||
frac += fracstep;
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int num_cores = thread->num_cores;
|
int num_cores = thread->num_cores;
|
||||||
int skipped = thread->skipped_by_thread(args.DestY());
|
int skipped = thread->skipped_by_thread(args.DestY());
|
||||||
int count = skipped + thread->count_for_thread(args.DestY(), args.Count()) * num_cores;
|
int count = skipped + thread->count_for_thread(args.DestY(), args.Count()) * num_cores;
|
||||||
|
@ -86,6 +71,21 @@ namespace swrenderer
|
||||||
fracstep *= num_cores;
|
fracstep *= num_cores;
|
||||||
pitch *= num_cores;
|
pitch *= num_cores;
|
||||||
|
|
||||||
|
if (!fadeSky)
|
||||||
|
{
|
||||||
|
int count = thread->count_for_thread(args.DestY(), args.Count());
|
||||||
|
|
||||||
|
for (int index = 0; index < count; index++)
|
||||||
|
{
|
||||||
|
uint32_t sample_index = (((((uint32_t)frac) << 8) >> FRACBITS) * textureheight0) >> FRACBITS;
|
||||||
|
*dest = source0[sample_index];
|
||||||
|
dest += pitch;
|
||||||
|
frac += fracstep;
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
BgraColor solid_top_fill = solid_top;
|
BgraColor solid_top_fill = solid_top;
|
||||||
BgraColor solid_bottom_fill = solid_bottom;
|
BgraColor solid_bottom_fill = solid_bottom;
|
||||||
|
|
||||||
|
@ -172,7 +172,6 @@ namespace swrenderer
|
||||||
void Execute(DrawerThread *thread) override
|
void Execute(DrawerThread *thread) override
|
||||||
{
|
{
|
||||||
uint32_t *dest = (uint32_t *)args.Dest();
|
uint32_t *dest = (uint32_t *)args.Dest();
|
||||||
int count = args.Count();
|
|
||||||
int pitch = args.Viewport()->RenderTarget->GetPitch();
|
int pitch = args.Viewport()->RenderTarget->GetPitch();
|
||||||
const uint32_t *source0 = (const uint32_t *)args.FrontTexturePixels();
|
const uint32_t *source0 = (const uint32_t *)args.FrontTexturePixels();
|
||||||
const uint32_t *source1 = (const uint32_t *)args.BackTexturePixels();
|
const uint32_t *source1 = (const uint32_t *)args.BackTexturePixels();
|
||||||
|
@ -181,7 +180,11 @@ namespace swrenderer
|
||||||
|
|
||||||
int32_t frac = args.TextureVPos();
|
int32_t frac = args.TextureVPos();
|
||||||
int32_t fracstep = args.TextureVStep();
|
int32_t fracstep = args.TextureVStep();
|
||||||
|
|
||||||
|
int num_cores = thread->num_cores;
|
||||||
|
int skipped = thread->skipped_by_thread(args.DestY());
|
||||||
|
int count = skipped + thread->count_for_thread(args.DestY(), args.Count()) * num_cores;
|
||||||
|
|
||||||
uint32_t solid_top = args.SolidTopColor();
|
uint32_t solid_top = args.SolidTopColor();
|
||||||
uint32_t solid_bottom = args.SolidBottomColor();
|
uint32_t solid_bottom = args.SolidBottomColor();
|
||||||
bool fadeSky = args.FadeSky();
|
bool fadeSky = args.FadeSky();
|
||||||
|
@ -198,8 +201,6 @@ namespace swrenderer
|
||||||
start_fadebottom_y = clamp(start_fadebottom_y, 0, count);
|
start_fadebottom_y = clamp(start_fadebottom_y, 0, count);
|
||||||
end_fadebottom_y = clamp(end_fadebottom_y, 0, count);
|
end_fadebottom_y = clamp(end_fadebottom_y, 0, count);
|
||||||
|
|
||||||
int num_cores = thread->num_cores;
|
|
||||||
int skipped = thread->skipped_by_thread(args.DestY());
|
|
||||||
dest = thread->dest_for_thread(args.DestY(), pitch, dest);
|
dest = thread->dest_for_thread(args.DestY(), pitch, dest);
|
||||||
frac += fracstep * skipped;
|
frac += fracstep * skipped;
|
||||||
fracstep *= num_cores;
|
fracstep *= num_cores;
|
||||||
|
|
|
@ -49,21 +49,6 @@ namespace swrenderer
|
||||||
uint32_t solid_bottom = args.SolidBottomColor();
|
uint32_t solid_bottom = args.SolidBottomColor();
|
||||||
bool fadeSky = args.FadeSky();
|
bool fadeSky = args.FadeSky();
|
||||||
|
|
||||||
if (!fadeSky)
|
|
||||||
{
|
|
||||||
int count = thread->count_for_thread(args.DestY(), args.Count());
|
|
||||||
|
|
||||||
for (int index = 0; index < count; index++)
|
|
||||||
{
|
|
||||||
uint32_t sample_index = (((((uint32_t)frac) << 8) >> FRACBITS) * textureheight0) >> FRACBITS;
|
|
||||||
*dest = source0[sample_index];
|
|
||||||
dest += pitch;
|
|
||||||
frac += fracstep;
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int num_cores = thread->num_cores;
|
int num_cores = thread->num_cores;
|
||||||
int skipped = thread->skipped_by_thread(args.DestY());
|
int skipped = thread->skipped_by_thread(args.DestY());
|
||||||
int count = skipped + thread->count_for_thread(args.DestY(), args.Count()) * num_cores;
|
int count = skipped + thread->count_for_thread(args.DestY(), args.Count()) * num_cores;
|
||||||
|
@ -85,6 +70,21 @@ namespace swrenderer
|
||||||
fracstep *= num_cores;
|
fracstep *= num_cores;
|
||||||
pitch *= num_cores;
|
pitch *= num_cores;
|
||||||
|
|
||||||
|
if (!fadeSky)
|
||||||
|
{
|
||||||
|
int count = thread->count_for_thread(args.DestY(), args.Count());
|
||||||
|
|
||||||
|
for (int index = 0; index < count; index++)
|
||||||
|
{
|
||||||
|
uint32_t sample_index = (((((uint32_t)frac) << 8) >> FRACBITS) * textureheight0) >> FRACBITS;
|
||||||
|
*dest = source0[sample_index];
|
||||||
|
dest += pitch;
|
||||||
|
frac += fracstep;
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
__m128i solid_top_fill = _mm_unpacklo_epi8(_mm_cvtsi32_si128(solid_top), _mm_setzero_si128());
|
__m128i solid_top_fill = _mm_unpacklo_epi8(_mm_cvtsi32_si128(solid_top), _mm_setzero_si128());
|
||||||
__m128i solid_bottom_fill = _mm_unpacklo_epi8(_mm_cvtsi32_si128(solid_bottom), _mm_setzero_si128());
|
__m128i solid_bottom_fill = _mm_unpacklo_epi8(_mm_cvtsi32_si128(solid_bottom), _mm_setzero_si128());
|
||||||
|
|
||||||
|
@ -167,7 +167,6 @@ namespace swrenderer
|
||||||
void Execute(DrawerThread *thread) override
|
void Execute(DrawerThread *thread) override
|
||||||
{
|
{
|
||||||
uint32_t *dest = (uint32_t *)args.Dest();
|
uint32_t *dest = (uint32_t *)args.Dest();
|
||||||
int count = args.Count();
|
|
||||||
int pitch = args.Viewport()->RenderTarget->GetPitch();
|
int pitch = args.Viewport()->RenderTarget->GetPitch();
|
||||||
const uint32_t *source0 = (const uint32_t *)args.FrontTexturePixels();
|
const uint32_t *source0 = (const uint32_t *)args.FrontTexturePixels();
|
||||||
const uint32_t *source1 = (const uint32_t *)args.BackTexturePixels();
|
const uint32_t *source1 = (const uint32_t *)args.BackTexturePixels();
|
||||||
|
@ -176,7 +175,11 @@ namespace swrenderer
|
||||||
|
|
||||||
int32_t frac = args.TextureVPos();
|
int32_t frac = args.TextureVPos();
|
||||||
int32_t fracstep = args.TextureVStep();
|
int32_t fracstep = args.TextureVStep();
|
||||||
|
|
||||||
|
int num_cores = thread->num_cores;
|
||||||
|
int skipped = thread->skipped_by_thread(args.DestY());
|
||||||
|
int count = skipped + thread->count_for_thread(args.DestY(), args.Count()) * num_cores;
|
||||||
|
|
||||||
uint32_t solid_top = args.SolidTopColor();
|
uint32_t solid_top = args.SolidTopColor();
|
||||||
uint32_t solid_bottom = args.SolidBottomColor();
|
uint32_t solid_bottom = args.SolidBottomColor();
|
||||||
bool fadeSky = args.FadeSky();
|
bool fadeSky = args.FadeSky();
|
||||||
|
@ -193,8 +196,6 @@ namespace swrenderer
|
||||||
start_fadebottom_y = clamp(start_fadebottom_y, 0, count);
|
start_fadebottom_y = clamp(start_fadebottom_y, 0, count);
|
||||||
end_fadebottom_y = clamp(end_fadebottom_y, 0, count);
|
end_fadebottom_y = clamp(end_fadebottom_y, 0, count);
|
||||||
|
|
||||||
int num_cores = thread->num_cores;
|
|
||||||
int skipped = thread->skipped_by_thread(args.DestY());
|
|
||||||
dest = thread->dest_for_thread(args.DestY(), pitch, dest);
|
dest = thread->dest_for_thread(args.DestY(), pitch, dest);
|
||||||
frac += fracstep * skipped;
|
frac += fracstep * skipped;
|
||||||
fracstep *= num_cores;
|
fracstep *= num_cores;
|
||||||
|
|
Loading…
Reference in a new issue