maxwell3d: HLE multi-layer clear macro

This commit is contained in:
Liam 2022-11-16 22:28:58 -05:00
parent f426fd95fe
commit ece0c1095d
2 changed files with 22 additions and 1 deletions

View file

@ -1129,6 +1129,7 @@ public:
Tegra::RenderTargetFormat format; Tegra::RenderTargetFormat format;
TileMode tile_mode; TileMode tile_mode;
union { union {
u32 depth_volume;
BitField<0, 16, u32> depth; BitField<0, 16, u32> depth;
BitField<16, 1, u32> volume; BitField<16, 1, u32> volume;
}; };

View file

@ -126,11 +126,31 @@ void HLE_3F5E74B9C9A50164(Engines::Maxwell3D& maxwell3d, const std::vector<u32>&
} }
} }
constexpr std::array<std::pair<u64, HLEFunction>, 4> hle_funcs{{ // Multi-layer Clear
void HLE_EAD26C3E2109B06B(Engines::Maxwell3D& maxwell3d, const std::vector<u32>& parameters) {
ASSERT(parameters.size() == 1);
Engines::Maxwell3D::Regs::ClearSurface clear_params{parameters[0]};
const u32 rt_index = clear_params.RT;
const u32 num_layers = maxwell3d.regs.rt[rt_index].depth_volume;
for (u32 i = 0; i < num_layers; i++) {
// 0x674 = regs.clear_surface
maxwell3d.CallMethod(0x674, clear_params.raw, true);
clear_params.layer.Assign(clear_params.layer + 1);
// FIXME: remove this when amdvlk can clear multiple layers without crashing
break;
}
}
constexpr std::array<std::pair<u64, HLEFunction>, 5> hle_funcs{{
{0x771BB18C62444DA0, &HLE_771BB18C62444DA0}, {0x771BB18C62444DA0, &HLE_771BB18C62444DA0},
{0x0D61FC9FAAC9FCAD, &HLE_0D61FC9FAAC9FCAD}, {0x0D61FC9FAAC9FCAD, &HLE_0D61FC9FAAC9FCAD},
{0x0217920100488FF7, &HLE_0217920100488FF7}, {0x0217920100488FF7, &HLE_0217920100488FF7},
{0x3F5E74B9C9A50164, &HLE_3F5E74B9C9A50164}, {0x3F5E74B9C9A50164, &HLE_3F5E74B9C9A50164},
{0xEAD26C3E2109B06B, &HLE_EAD26C3E2109B06B},
}}; }};
class HLEMacroImpl final : public CachedMacro { class HLEMacroImpl final : public CachedMacro {