mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-23 14:25:37 +00:00
GPU: Alter timings to reflect new clock
This commit is contained in:
parent
dad63f2303
commit
bda528d70a
|
@ -412,16 +412,27 @@ protected:
|
||||||
virtual void DrawRendererStats(bool is_idle_frame);
|
virtual void DrawRendererStats(bool is_idle_frame);
|
||||||
|
|
||||||
// These are **very** approximate.
|
// These are **very** approximate.
|
||||||
ALWAYS_INLINE void AddDrawTriangleTicks(u32 width, u32 height, bool textured, bool shaded)
|
ALWAYS_INLINE void AddDrawTriangleTicks(u32 width, u32 height, bool shaded, bool textured, bool semitransparent)
|
||||||
{
|
{
|
||||||
#if 0
|
const u32 average_width = ((width + 2) / 3);
|
||||||
const u32 draw_ticks = static_cast<u32>((std::abs(x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2)) + 1u) / 2u);
|
u32 ticks_per_row = average_width;
|
||||||
#else
|
if (textured)
|
||||||
const u32 draw_ticks = ((width + 2) / 3) * height;
|
ticks_per_row += average_width;
|
||||||
#endif
|
if (semitransparent || m_GPUSTAT.check_mask_before_draw)
|
||||||
AddCommandTicks(draw_ticks);
|
ticks_per_row += (average_width + 1u) / 2u;
|
||||||
|
|
||||||
|
AddCommandTicks(ticks_per_row * height);
|
||||||
|
}
|
||||||
|
ALWAYS_INLINE void AddDrawRectangleTicks(u32 width, u32 height, bool textured, bool semitransparent)
|
||||||
|
{
|
||||||
|
u32 ticks_per_row = width;
|
||||||
|
if (textured)
|
||||||
|
ticks_per_row += width;
|
||||||
|
if (semitransparent || m_GPUSTAT.check_mask_before_draw)
|
||||||
|
ticks_per_row += (width + 1u) / 2u;
|
||||||
|
|
||||||
|
AddCommandTicks(ticks_per_row * height);
|
||||||
}
|
}
|
||||||
ALWAYS_INLINE void AddDrawRectangleTicks(u32 width, u32 height, bool textured) { AddCommandTicks(width * height); }
|
|
||||||
ALWAYS_INLINE void AddDrawLineTicks(u32 width, u32 height, bool shaded) { AddCommandTicks(std::max(width, height)); }
|
ALWAYS_INLINE void AddDrawLineTicks(u32 width, u32 height, bool shaded) { AddCommandTicks(std::max(width, height)); }
|
||||||
|
|
||||||
HostDisplay* m_host_display = nullptr;
|
HostDisplay* m_host_display = nullptr;
|
||||||
|
|
|
@ -241,7 +241,8 @@ void GPU_HW::LoadVertices()
|
||||||
static_cast<u32>(std::clamp<s32>(max_y, m_drawing_area.top, m_drawing_area.bottom)) + 1u;
|
static_cast<u32>(std::clamp<s32>(max_y, m_drawing_area.top, m_drawing_area.bottom)) + 1u;
|
||||||
|
|
||||||
m_vram_dirty_rect.Include(clip_left, clip_right, clip_top, clip_bottom);
|
m_vram_dirty_rect.Include(clip_left, clip_right, clip_top, clip_bottom);
|
||||||
AddDrawTriangleTicks(clip_right - clip_left, clip_bottom - clip_top, rc.texture_enable, rc.shading_enable);
|
AddDrawTriangleTicks(clip_right - clip_left, clip_bottom - clip_top, rc.shading_enable, rc.texture_enable,
|
||||||
|
rc.transparency_enable);
|
||||||
|
|
||||||
std::memcpy(m_batch_current_vertex_ptr, vertices.data(), sizeof(BatchVertex) * 3);
|
std::memcpy(m_batch_current_vertex_ptr, vertices.data(), sizeof(BatchVertex) * 3);
|
||||||
m_batch_current_vertex_ptr += 3;
|
m_batch_current_vertex_ptr += 3;
|
||||||
|
@ -271,7 +272,8 @@ void GPU_HW::LoadVertices()
|
||||||
static_cast<u32>(std::clamp<s32>(max_y_123, m_drawing_area.top, m_drawing_area.bottom)) + 1u;
|
static_cast<u32>(std::clamp<s32>(max_y_123, m_drawing_area.top, m_drawing_area.bottom)) + 1u;
|
||||||
|
|
||||||
m_vram_dirty_rect.Include(clip_left, clip_right, clip_top, clip_bottom);
|
m_vram_dirty_rect.Include(clip_left, clip_right, clip_top, clip_bottom);
|
||||||
AddDrawTriangleTicks(clip_right - clip_left, clip_bottom - clip_top, rc.texture_enable, rc.shading_enable);
|
AddDrawTriangleTicks(clip_right - clip_left, clip_bottom - clip_top, rc.shading_enable, rc.texture_enable,
|
||||||
|
rc.transparency_enable);
|
||||||
|
|
||||||
AddVertex(vertices[2]);
|
AddVertex(vertices[2]);
|
||||||
AddVertex(vertices[1]);
|
AddVertex(vertices[1]);
|
||||||
|
@ -367,7 +369,7 @@ void GPU_HW::LoadVertices()
|
||||||
static_cast<u32>(std::clamp<s32>(pos_y + rectangle_height, m_drawing_area.top, m_drawing_area.bottom)) + 1u;
|
static_cast<u32>(std::clamp<s32>(pos_y + rectangle_height, m_drawing_area.top, m_drawing_area.bottom)) + 1u;
|
||||||
|
|
||||||
m_vram_dirty_rect.Include(clip_left, clip_right, clip_top, clip_bottom);
|
m_vram_dirty_rect.Include(clip_left, clip_right, clip_top, clip_bottom);
|
||||||
AddDrawRectangleTicks(clip_right - clip_left, clip_bottom - clip_top, rc.texture_enable);
|
AddDrawRectangleTicks(clip_right - clip_left, clip_bottom - clip_top, rc.texture_enable, rc.transparency_enable);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -433,7 +433,7 @@ void GPU_SW::DrawTriangle(const SWVertex* v0, const SWVertex* v1, const SWVertex
|
||||||
max_x = std::clamp(max_x, static_cast<s32>(m_drawing_area.left), static_cast<s32>(m_drawing_area.right));
|
max_x = std::clamp(max_x, static_cast<s32>(m_drawing_area.left), static_cast<s32>(m_drawing_area.right));
|
||||||
min_y = std::clamp(min_y, static_cast<s32>(m_drawing_area.top), static_cast<s32>(m_drawing_area.bottom));
|
min_y = std::clamp(min_y, static_cast<s32>(m_drawing_area.top), static_cast<s32>(m_drawing_area.bottom));
|
||||||
max_y = std::clamp(max_y, static_cast<s32>(m_drawing_area.top), static_cast<s32>(m_drawing_area.bottom));
|
max_y = std::clamp(max_y, static_cast<s32>(m_drawing_area.top), static_cast<s32>(m_drawing_area.bottom));
|
||||||
AddDrawTriangleTicks(max_x - min_x + 1, max_y - min_y + 1, texture_enable, shading_enable);
|
AddDrawTriangleTicks(max_x - min_x + 1, max_y - min_y + 1, shading_enable, texture_enable, transparency_enable);
|
||||||
|
|
||||||
// compute per-pixel increments
|
// compute per-pixel increments
|
||||||
const s32 a01 = py0 - py1, b01 = px1 - px0;
|
const s32 a01 = py0 - py1, b01 = px1 - px0;
|
||||||
|
@ -539,7 +539,7 @@ void GPU_SW::DrawRectangle(s32 origin_x, s32 origin_y, u32 width, u32 height, u8
|
||||||
const u32 clip_bottom =
|
const u32 clip_bottom =
|
||||||
static_cast<u32>(std::clamp<s32>(start_y + static_cast<s32>(height), m_drawing_area.top, m_drawing_area.bottom)) +
|
static_cast<u32>(std::clamp<s32>(start_y + static_cast<s32>(height), m_drawing_area.top, m_drawing_area.bottom)) +
|
||||||
1u;
|
1u;
|
||||||
AddDrawRectangleTicks(clip_right - clip_left, clip_bottom - clip_top, texture_enable);
|
AddDrawRectangleTicks(clip_right - clip_left, clip_bottom - clip_top, texture_enable, transparency_enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (u32 offset_y = 0; offset_y < height; offset_y++)
|
for (u32 offset_y = 0; offset_y < height; offset_y++)
|
||||||
|
|
Loading…
Reference in a new issue