mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2025-02-16 19:05:39 +00:00
GPU: Mask variable sprite/rectangle sizes
Fixes broken sprites in Gradius Deluxe Pack (Gradius II).
This commit is contained in:
parent
c583459c6f
commit
237f469baa
|
@ -304,18 +304,19 @@ void GPU_HW::LoadVertices()
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
const u32 width_and_height = m_fifo.Pop();
|
const u32 width_and_height = m_fifo.Pop();
|
||||||
rectangle_width = static_cast<s32>(width_and_height & 0xFFFF);
|
rectangle_width = static_cast<s32>(width_and_height & VRAM_WIDTH_MASK);
|
||||||
rectangle_height = static_cast<s32>(width_and_height >> 16);
|
rectangle_height = static_cast<s32>((width_and_height >> 16) & VRAM_HEIGHT_MASK);
|
||||||
|
|
||||||
|
if (rectangle_width >= MAX_PRIMITIVE_WIDTH || rectangle_height >= MAX_PRIMITIVE_HEIGHT)
|
||||||
|
{
|
||||||
|
Log_DebugPrintf("Culling too-large rectangle: %d,%d %dx%d", pos_x, pos_y, rectangle_width,
|
||||||
|
rectangle_height);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rectangle_width >= MAX_PRIMITIVE_WIDTH || rectangle_height >= MAX_PRIMITIVE_HEIGHT)
|
|
||||||
{
|
|
||||||
Log_DebugPrintf("Culling too-large rectangle: %d,%d %dx%d", pos_x, pos_y, rectangle_width, rectangle_height);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// we can split the rectangle up into potentially 8 quads
|
// we can split the rectangle up into potentially 8 quads
|
||||||
DebugAssert(GetBatchVertexSpace() >= MAX_VERTICES_FOR_RECTANGLE);
|
DebugAssert(GetBatchVertexSpace() >= MAX_VERTICES_FOR_RECTANGLE);
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
#include "gpu_sw.h"
|
#include "gpu_sw.h"
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
|
#include "common/log.h"
|
||||||
#include "host_display.h"
|
#include "host_display.h"
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
Log_SetChannel(GPU_SW);
|
||||||
|
|
||||||
GPU_SW::GPU_SW()
|
GPU_SW::GPU_SW()
|
||||||
{
|
{
|
||||||
|
@ -277,8 +279,15 @@ void GPU_SW::DispatchRenderCommand()
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
const u32 width_and_height = m_fifo.Pop();
|
const u32 width_and_height = m_fifo.Pop();
|
||||||
width = static_cast<s32>(width_and_height & UINT32_C(0xFFFF));
|
width = static_cast<s32>(width_and_height & VRAM_WIDTH_MASK);
|
||||||
height = static_cast<s32>(width_and_height >> 16);
|
height = static_cast<s32>((width_and_height >> 16) & VRAM_HEIGHT_MASK);
|
||||||
|
|
||||||
|
if (width >= MAX_PRIMITIVE_WIDTH || height >= MAX_PRIMITIVE_HEIGHT)
|
||||||
|
{
|
||||||
|
Log_DebugPrintf("Culling too-large rectangle: %d,%d %dx%d", vp.x.GetValue(), vp.y.GetValue(), width,
|
||||||
|
height);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue