update parallel rdp

This commit is contained in:
Logan McNaughton committed 2022-09-05 10:27:23 -06:00
1 parent ef40b5e17a
commit a2afcb3f77
5 files changed
+96 -4

No files matched your search

@@ -120,6 +120,11 @@ void Renderer::set_device(Vulkan::Device *device_)
device = device_;
}
void Renderer::set_validation_interface(ValidationInterface *iface)
{
validation_iface = iface;
}
bool Renderer::init_caps()
{
auto &features = device->get_device_features();
@@ -1404,8 +1409,50 @@ void Renderer::fixup_triangle_setup(TriangleSetup &setup) const
setup.flags |= TRIANGLE_SETUP_FILL_COPY_RASTER_BIT;
}
void Renderer::validate_draw_state() const
{
if ((stream.static_raster_state.flags & RASTERIZATION_FILL_BIT) != 0)
{
if (fb.fmt == FBFormat::I4)
{
validation_iface->report_rdp_crash(ValidationError::Fill4bpp,
"Attempted to use Fill mode on 4bpp surface.");
}
if ((stream.depth_blend_state.flags & DEPTH_BLEND_DEPTH_TEST_BIT) != 0)
{
validation_iface->report_rdp_crash(ValidationError::FillDepthTest,
"Attempted to use Fill mode with depth test.");
}
if ((stream.depth_blend_state.flags & DEPTH_BLEND_IMAGE_READ_ENABLE_BIT) != 0)
{
validation_iface->report_rdp_crash(ValidationError::FillImageReadEnable,
"Attempted to use Fill mode with image read enable.");
}
if ((stream.depth_blend_state.flags & DEPTH_BLEND_DEPTH_UPDATE_BIT) != 0 &&
!constants.use_prim_depth)
{
validation_iface->report_rdp_crash(ValidationError::FillDepthWrite,
"Attempted to use Fill mode with depth write enabled.");
}
}
else if ((stream.static_raster_state.flags & RASTERIZATION_COPY_BIT) != 0)
{
if (fb.fmt == FBFormat::RGBA8888)
{
validation_iface->report_rdp_crash(ValidationError::Copy32bpp,
"Attempted to use Copy mode on 32bpp surface.");
}
}
}
void Renderer::draw_shaded_primitive(TriangleSetup &setup, const AttributeSetup &attr)
{
if (validation_iface)
validate_draw_state();
fixup_triangle_setup(setup);
unsigned num_tiles = compute_conservative_max_num_tiles(setup);
@@ -3040,6 +3087,15 @@ bool Renderer::tmem_upload_needs_flush(uint32_t addr) const
void Renderer::load_tile(uint32_t tile, const LoadTileInfo &info)
{
if (validation_iface && info.mode == UploadMode::TLUT)
{
if ((info.thi >> 2) > (info.tlo >> 2))
{
validation_iface->report_rdp_crash(ValidationError::InvalidMultilineLoadTlut,
"Attempting to load multiple lines in TLUT.");
}
}
if (tmem_upload_needs_flush(info.tex_addr))
flush_queues();
@@ -3171,6 +3227,8 @@ void Renderer::load_tile_iteration(uint32_t tile, const LoadTileInfo &info, uint
if (info.size == TextureSize::Bpp4)
{
LOGE("4-bit VRAM pointer crashes the RDP.\n");
if (validation_iface)
validation_iface->report_rdp_crash(ValidationError::LoadTile4bpp, "4-bit VRAM pointer crashes the RDP.");
return;
}