GPU/HW: Move some flush checks to command time
This commit is contained in:
parent
5302f83818
commit
7f5c6f8b4f
|
@ -50,6 +50,8 @@ void GPU::Reset()
|
|||
|
||||
void GPU::SoftReset()
|
||||
{
|
||||
FlushRender();
|
||||
|
||||
m_GPUSTAT.bits = 0x14802000;
|
||||
m_GPUSTAT.pal_mode = m_system->IsPALRegion();
|
||||
m_drawing_area.Set(0, 0, 0, 0);
|
||||
|
@ -66,7 +68,7 @@ void GPU::SoftReset()
|
|||
m_GP0_buffer.clear();
|
||||
SetDrawMode(0);
|
||||
SetTexturePalette(0);
|
||||
m_draw_mode.SetTextureWindow(0);
|
||||
SetTextureWindow(0);
|
||||
UpdateDMARequest();
|
||||
UpdateCRTCConfig();
|
||||
UpdateSliceTicks();
|
||||
|
@ -1011,18 +1013,20 @@ void GPU::SetTexturePalette(u16 value)
|
|||
m_draw_mode.texture_page_changed = true;
|
||||
}
|
||||
|
||||
void GPU::DrawMode::SetTextureWindow(u32 value)
|
||||
void GPU::SetTextureWindow(u32 value)
|
||||
{
|
||||
value &= TEXTURE_WINDOW_MASK;
|
||||
if (texture_window_value == value)
|
||||
value &= DrawMode::TEXTURE_WINDOW_MASK;
|
||||
if (m_draw_mode.texture_window_value == value)
|
||||
return;
|
||||
|
||||
texture_window_mask_x = value & UINT32_C(0x1F);
|
||||
texture_window_mask_y = (value >> 5) & UINT32_C(0x1F);
|
||||
texture_window_offset_x = (value >> 10) & UINT32_C(0x1F);
|
||||
texture_window_offset_y = (value >> 15) & UINT32_C(0x1F);
|
||||
texture_window_value = value;
|
||||
texture_window_changed = true;
|
||||
FlushRender();
|
||||
|
||||
m_draw_mode.texture_window_mask_x = value & UINT32_C(0x1F);
|
||||
m_draw_mode.texture_window_mask_y = (value >> 5) & UINT32_C(0x1F);
|
||||
m_draw_mode.texture_window_offset_x = (value >> 10) & UINT32_C(0x1F);
|
||||
m_draw_mode.texture_window_offset_y = (value >> 15) & UINT32_C(0x1F);
|
||||
m_draw_mode.texture_window_value = value;
|
||||
m_draw_mode.texture_window_changed = true;
|
||||
}
|
||||
|
||||
bool GPU::DumpVRAMToFile(const char* filename, u32 width, u32 height, u32 stride, const void* buffer, bool remove_alpha)
|
||||
|
|
|
@ -338,6 +338,9 @@ protected:
|
|||
/// Sets/decodes polygon/rectangle texture palette value.
|
||||
void SetTexturePalette(u16 bits);
|
||||
|
||||
/// Sets/decodes texture window bits.
|
||||
void SetTextureWindow(u32 value);
|
||||
|
||||
u32 ReadGPUREAD();
|
||||
void WriteGP0(u32 value);
|
||||
void WriteGP1(u32 value);
|
||||
|
@ -428,7 +431,7 @@ protected:
|
|||
struct DrawMode
|
||||
{
|
||||
static constexpr u16 PALETTE_MASK = UINT16_C(0b0111111111111111);
|
||||
static constexpr u32 TEXTURE_WINDOW_MASK = UINT16_C(0b11111111111111111111);
|
||||
static constexpr u32 TEXTURE_WINDOW_MASK = UINT32_C(0b11111111111111111111);
|
||||
|
||||
// bits in GP0(E1h) or texpage part of polygon
|
||||
union Reg
|
||||
|
@ -511,9 +514,6 @@ protected:
|
|||
bool IsTextureWindowChanged() const { return texture_window_changed; }
|
||||
void SetTextureWindowChanged() { texture_window_changed = true; }
|
||||
void ClearTextureWindowChangedFlag() { texture_window_changed = false; }
|
||||
|
||||
void SetTextureWindow(u32 value);
|
||||
|
||||
} m_draw_mode = {};
|
||||
|
||||
Common::Rectangle<u32> m_drawing_area;
|
||||
|
|
|
@ -136,7 +136,7 @@ bool GPU::HandleSetDrawModeCommand(const u32*& command_ptr, u32 command_size)
|
|||
bool GPU::HandleSetTextureWindowCommand(const u32*& command_ptr, u32 command_size)
|
||||
{
|
||||
const u32 param = *(command_ptr++) & 0x00FFFFFF;
|
||||
m_draw_mode.SetTextureWindow(param);
|
||||
SetTextureWindow(param);
|
||||
Log_DebugPrintf("Set texture window %02X %02X %02X %02X", m_draw_mode.texture_window_mask_x,
|
||||
m_draw_mode.texture_window_mask_y, m_draw_mode.texture_window_offset_x,
|
||||
m_draw_mode.texture_window_offset_y);
|
||||
|
|
|
@ -490,7 +490,7 @@ void GPU_HW::DispatchRenderCommand(RenderCommand rc, u32 num_vertices, const u32
|
|||
(m_draw_mode.GetTexturePageRectangle().Intersects(m_vram_dirty_rect) ||
|
||||
(m_draw_mode.IsUsingPalette() && m_draw_mode.GetTexturePaletteRectangle().Intersects(m_vram_dirty_rect))))
|
||||
{
|
||||
//Log_DevPrintf("Invalidating VRAM read cache due to drawing area overlap");
|
||||
// Log_DevPrintf("Invalidating VRAM read cache due to drawing area overlap");
|
||||
if (!IsFlushed())
|
||||
FlushRender();
|
||||
|
||||
|
@ -517,15 +517,11 @@ void GPU_HW::DispatchRenderCommand(RenderCommand rc, u32 num_vertices, const u32
|
|||
rc.transparency_enable ? m_draw_mode.GetTransparencyMode() : TransparencyMode::Disabled;
|
||||
const BatchPrimitive rc_primitive = GetPrimitiveForCommand(rc);
|
||||
const bool dithering_enable = (!m_true_color && rc.IsDitheringEnabled()) ? m_GPUSTAT.dither_enable : false;
|
||||
if (!IsFlushed())
|
||||
{
|
||||
if (m_batch.texture_mode != texture_mode || m_batch.transparency_mode != transparency_mode ||
|
||||
m_batch.primitive != rc_primitive || dithering_enable != m_batch.dithering || m_drawing_area_changed ||
|
||||
m_draw_mode.IsTextureWindowChanged())
|
||||
m_batch.primitive != rc_primitive || dithering_enable != m_batch.dithering)
|
||||
{
|
||||
FlushRender();
|
||||
}
|
||||
}
|
||||
|
||||
// transparency mode change
|
||||
if (m_batch.transparency_mode != transparency_mode && transparency_mode != TransparencyMode::Disabled)
|
||||
|
|
Loading…
Reference in New Issue