mirror of
https://github.com/stenzek/duckstation.git
synced 2025-06-08 04:25:37 +00:00
GPU: Use same early culling rules for lines as polygons
This commit is contained in:
parent
c5bd4101b3
commit
4d4523dc04
@ -462,7 +462,7 @@ void GPU::UpdateDMARequest()
|
|||||||
|
|
||||||
case BlitterState::ReadingVRAM:
|
case BlitterState::ReadingVRAM:
|
||||||
m_GPUSTAT.ready_to_send_vram = true;
|
m_GPUSTAT.ready_to_send_vram = true;
|
||||||
m_GPUSTAT.ready_to_recieve_dma = m_fifo.IsEmpty();
|
m_GPUSTAT.ready_to_recieve_dma = false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BlitterState::DrawingPolyLine:
|
case BlitterState::DrawingPolyLine:
|
||||||
|
@ -378,7 +378,12 @@ private:
|
|||||||
ALWAYS_INLINE_RELEASE void AddDrawLineTicks(const GSVector4i rect, bool shaded)
|
ALWAYS_INLINE_RELEASE void AddDrawLineTicks(const GSVector4i rect, bool shaded)
|
||||||
{
|
{
|
||||||
const GSVector4i clamped_rect = rect.rintersect(m_clamped_drawing_area);
|
const GSVector4i clamped_rect = rect.rintersect(m_clamped_drawing_area);
|
||||||
u32 drawn_width = clamped_rect.width();
|
|
||||||
|
// Needed because we're not multiplying either dimension.
|
||||||
|
if (clamped_rect.rempty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
const u32 drawn_width = clamped_rect.width();
|
||||||
u32 drawn_height = clamped_rect.height();
|
u32 drawn_height = clamped_rect.height();
|
||||||
|
|
||||||
if (m_GPUSTAT.SkipDrawingToActiveField())
|
if (m_GPUSTAT.SkipDrawingToActiveField())
|
||||||
|
@ -724,21 +724,17 @@ bool GPU::HandleRenderLineCommand()
|
|||||||
cmd->vertices[i].w = 1.0f;
|
cmd->vertices[i].w = 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
const GSVector2 v0f = GSVector2::load<false>(&cmd->vertices[0].x);
|
const GSVector2i v0 = GSVector2i::load<false>(&cmd->vertices[0].native_x);
|
||||||
const GSVector2 v1f = GSVector2::load<false>(&cmd->vertices[1].x);
|
const GSVector2i v1 = GSVector2i::load<false>(&cmd->vertices[1].native_x);
|
||||||
const GSVector4i rect =
|
const GSVector4i rect = GSVector4i::xyxy(v0.min_s32(v1), v0.max_s32(v1)).add32(GSVector4i::cxpr(0, 0, 1, 1));
|
||||||
GSVector4i(GSVector4(v0f.min(v1f)).upld(GSVector4(v0f.max(v1f)))).add32(GSVector4i::cxpr(0, 0, 1, 1));
|
if (rect.width() > MAX_PRIMITIVE_WIDTH || rect.height() > MAX_PRIMITIVE_HEIGHT)
|
||||||
const GSVector4i clamped_rect = rect.rintersect(m_clamped_drawing_area);
|
|
||||||
|
|
||||||
if (rect.width() > MAX_PRIMITIVE_WIDTH || rect.height() > MAX_PRIMITIVE_HEIGHT || clamped_rect.rempty())
|
|
||||||
{
|
{
|
||||||
DEBUG_LOG("Culling too-large/off-screen line: {},{} - {},{}", cmd->vertices[0].y, cmd->vertices[0].y,
|
DEBUG_LOG("Culling too-large line: {} - {}", v0, v1);
|
||||||
cmd->vertices[1].x, cmd->vertices[1].y);
|
|
||||||
EndCommand();
|
EndCommand();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
AddDrawLineTicks(clamped_rect, rc.shading_enable);
|
AddDrawLineTicks(rect, rc.shading_enable);
|
||||||
GPUBackend::PushCommand(cmd);
|
GPUBackend::PushCommand(cmd);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -776,17 +772,14 @@ bool GPU::HandleRenderLineCommand()
|
|||||||
const GSVector2i v0 = GSVector2i::load<false>(&cmd->vertices[0].x);
|
const GSVector2i v0 = GSVector2i::load<false>(&cmd->vertices[0].x);
|
||||||
const GSVector2i v1 = GSVector2i::load<false>(&cmd->vertices[1].x);
|
const GSVector2i v1 = GSVector2i::load<false>(&cmd->vertices[1].x);
|
||||||
const GSVector4i rect = GSVector4i::xyxy(v0.min_s32(v1), v0.max_s32(v1)).add32(GSVector4i::cxpr(0, 0, 1, 1));
|
const GSVector4i rect = GSVector4i::xyxy(v0.min_s32(v1), v0.max_s32(v1)).add32(GSVector4i::cxpr(0, 0, 1, 1));
|
||||||
const GSVector4i clamped_rect = rect.rintersect(m_clamped_drawing_area);
|
if (rect.width() > MAX_PRIMITIVE_WIDTH || rect.height() > MAX_PRIMITIVE_HEIGHT)
|
||||||
|
|
||||||
if (rect.width() > MAX_PRIMITIVE_WIDTH || rect.height() > MAX_PRIMITIVE_HEIGHT || clamped_rect.rempty())
|
|
||||||
{
|
{
|
||||||
DEBUG_LOG("Culling too-large/off-screen line: {},{} - {},{}", cmd->vertices[0].y, cmd->vertices[0].y,
|
DEBUG_LOG("Culling too-large line: {} - {}", v0, v1);
|
||||||
cmd->vertices[1].x, cmd->vertices[1].y);
|
|
||||||
EndCommand();
|
EndCommand();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
AddDrawLineTicks(clamped_rect, rc.shading_enable);
|
AddDrawLineTicks(rect, rc.shading_enable);
|
||||||
GPUBackend::PushCommand(cmd);
|
GPUBackend::PushCommand(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -864,13 +857,13 @@ void GPU::FinishPolyline()
|
|||||||
(shaded ? Truncate32(m_polyline_buffer[buffer_pos++]) : m_render_command.bits) & UINT32_C(0x00FFFFFF);
|
(shaded ? Truncate32(m_polyline_buffer[buffer_pos++]) : m_render_command.bits) & UINT32_C(0x00FFFFFF);
|
||||||
read_vertex(end, color);
|
read_vertex(end, color);
|
||||||
|
|
||||||
const GSVector2 start_pos = GSVector2::load<false>(&start.x);
|
const GSVector2i start_pos = GSVector2i::load<false>(&start.native_x);
|
||||||
const GSVector2 end_pos = GSVector2::load<false>(&end.x);
|
const GSVector2i end_pos = GSVector2i::load<false>(&end.native_x);
|
||||||
const GSVector4i rect =
|
const GSVector4i rect =
|
||||||
GSVector4i(GSVector4::xyxy(start_pos.min(end_pos), start_pos.max(end_pos))).add32(GSVector4i::cxpr(0, 0, 1, 1));
|
GSVector4i::xyxy(start_pos.min_s32(end_pos), start_pos.max_s32(end_pos)).add32(GSVector4i::cxpr(0, 0, 1, 1));
|
||||||
if (rect.width() > MAX_PRIMITIVE_WIDTH || rect.height() > MAX_PRIMITIVE_HEIGHT)
|
if (rect.width() > MAX_PRIMITIVE_WIDTH || rect.height() > MAX_PRIMITIVE_HEIGHT)
|
||||||
{
|
{
|
||||||
DEBUG_LOG("Culling too-large/off-screen line: {},{} - {},{}", start_pos.x, start_pos.y, end_pos.x, end_pos.y);
|
DEBUG_LOG("Culling too-large line: {} - {}", start_pos, end_pos);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user