GPU: Only latch texpage/mode on polygon/set draw mode

Driver seems to draw an off-screen polygon to set up the parameters,
instead of the set draw mode command.

Fixes broken sprites in Driver/Driver 2.
This commit is contained in:
Connor McLaughlin 2019-12-02 17:03:55 +10:00
parent a3f2286bdb
commit 45fc19fd05
3 changed files with 2 additions and 8 deletions

View file

@ -128,6 +128,7 @@ bool GPU::HandleSetDrawModeCommand(const u32*& command_ptr, u32 command_size)
// 0..10 bits match GPUSTAT
const u32 MASK = ((1 << 11) - 1);
m_render_state.SetFromPageAttribute(param & MASK);
m_GPUSTAT.bits = (m_GPUSTAT.bits & ~MASK) | (param & MASK);
m_GPUSTAT.texture_disable = (param & (1 << 11)) != 0;
m_render_state.texture_x_flip = (param & (1 << 12)) != 0;
@ -292,7 +293,7 @@ bool GPU::HandleRenderCommand(const u32*& command_ptr, u32 command_size)
static constexpr std::array<const char*, 4> primitive_names = {{"", "polygon", "line", "rectangle"}};
Log_DebugPrintf("Render %s %s %s %s %s (%u verts, %u words per vert)", rc.quad_polygon ? "four-point" : "three-point",
Log_TracePrintf("Render %s %s %s %s %s (%u verts, %u words per vert)", rc.quad_polygon ? "four-point" : "three-point",
rc.transparency_enable ? "semi-transparent" : "opaque",
rc.texture_enable ? "textured" : "non-textured", rc.shading_enable ? "shaded" : "monochrome",
primitive_names[static_cast<u8>(rc.primitive.GetValue())], ZeroExtend32(num_vertices),

View file

@ -284,7 +284,6 @@ void GPU_HW::DispatchRenderCommand(RenderCommand rc, u32 num_vertices, const u32
case Primitive::Rectangle:
{
m_render_state.SetFromRectangleTexcoord(command_ptr[2]);
m_render_state.SetFromPageAttribute(Truncate16(m_GPUSTAT.bits));
}
break;
@ -316,7 +315,6 @@ void GPU_HW::DispatchRenderCommand(RenderCommand rc, u32 num_vertices, const u32
}
else
{
m_render_state.SetFromPageAttribute(Truncate16(m_GPUSTAT.bits));
texture_mode = TextureMode::Disabled;
}

View file

@ -171,10 +171,6 @@ void GPU_SW::DispatchRenderCommand(RenderCommand rc, u32 num_vertices, const u32
else
m_render_state.SetFromPolygonTexcoord(command_ptr[2], command_ptr[4]);
}
else
{
m_render_state.SetFromPageAttribute(Truncate16(m_GPUSTAT.bits));
}
u32 buffer_pos = 1;
for (u32 i = 0; i < num_vertices; i++)
@ -214,7 +210,6 @@ void GPU_SW::DispatchRenderCommand(RenderCommand rc, u32 num_vertices, const u32
const u32 texcoord_and_palette = rc.texture_enable ? command_ptr[buffer_pos++] : 0;
const auto [texcoord_x, texcoord_y] = UnpackTexcoord(Truncate16(texcoord_and_palette));
m_render_state.SetFromPageAttribute(Truncate16(m_GPUSTAT.bits));
m_render_state.SetFromPaletteAttribute(Truncate16(texcoord_and_palette >> 16));
s32 width;