mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-10 01:28:44 +02:00
feat(recompiler): accept lwe on MIMG samples and gathers
The LOD warning lwe adds to the texel status is texture-streaming feedback, which is not reported for the T# MIN_LOD_WARN either. Accept lwe on sample and gather instructions as it already is on loads and stores; lwe on image_get_lod still throws.
This commit is contained in:
@@ -50,7 +50,7 @@ alignas(256) constexpr std::array<std::uint32_t, 99> SampleCode{
|
||||
0x5a7a000d, 0x7e1c02ff, 0x5a7a000e, 0x7e1e02ff, 0x5a7a000f, 0x7e2002ff, 0x5a7a0010, 0x7e2202ff,
|
||||
0x5a7a0011, 0x7e2402ff, 0x5a7a0012, 0x7e2602ff, 0x5a7a0013, 0x7e2802ff, 0x5a7a0014, 0x7e2a02ff,
|
||||
0x5a7a0015, 0x7e2c02ff, 0x5a7a0016, 0x7e2e02ff, 0x5a7a0017, 0x7e3002ff, 0x5a7a0018, 0x7e3202ff,
|
||||
0x5a7a0019, 0xf0810108, 0x00820a04, 0xf1010108, 0x00820c04, 0x7e540280, 0xf03b0308, 0x0002112a,
|
||||
0x5a7a0019, 0xf0830108, 0x00820a04, 0xf1030108, 0x00820c04, 0x7e540280, 0xf03b0308, 0x0002112a,
|
||||
0xf0910108, 0x00821404, 0x34500081, 0x7e520281, 0xf0030108, 0x00021628, 0x7e300280, 0xf0010108,
|
||||
0x80021828, 0xbf8c3f70, 0xe0701200, 0x80000a03, 0xe0701204, 0x80000b03, 0xe0701208, 0x80000c03,
|
||||
0xe070120c, 0x80000d03, 0xe0701210, 0x80000e03, 0xe0701214, 0x80000f03, 0xe0701218, 0x80001003,
|
||||
@@ -59,9 +59,7 @@ alignas(256) constexpr std::array<std::uint32_t, 99> SampleCode{
|
||||
0xe070123c, 0x80001903, 0xbf810000,
|
||||
};
|
||||
|
||||
alignas(256) constexpr std::array<std::array<std::uint32_t, 3>, 5> RefusedCode{{
|
||||
{0xf0820108u, 0x00820a04u, 0xbf810000u},
|
||||
{0xf1020108u, 0x00820a04u, 0xbf810000u},
|
||||
alignas(256) constexpr std::array<std::array<std::uint32_t, 3>, 3> RefusedCode{{
|
||||
{0xf1820308u, 0x00820a04u, 0xbf810000u},
|
||||
{0xf0452108u, 0x00020a08u, 0xbf810000u},
|
||||
{0xf0010108u, 0x0002ff08u, 0xbf810000u},
|
||||
@@ -282,7 +280,7 @@ void RunSample(AgcDriver::VulkanDevice& device) {
|
||||
}
|
||||
|
||||
void CheckRefused(AgcDriver::VulkanDevice& device) {
|
||||
constexpr std::array<const char*, 5> names{"image_sample lwe", "image_gather4 lwe", "image_get_lod lwe", "image_atomic_add tfe", "image_load tfe status past v255"};
|
||||
constexpr std::array<const char*, 3> names{"image_get_lod lwe", "image_atomic_add tfe", "image_load tfe status past v255"};
|
||||
std::vector<std::uint32_t> userData(16, 0u);
|
||||
for (std::uint32_t i = 0; i < RefusedCode.size(); ++i) {
|
||||
const std::span<const std::uint32_t> code(RefusedCode[i]);
|
||||
@@ -321,7 +319,7 @@ void CheckStorage() {
|
||||
}
|
||||
|
||||
void CheckSample() {
|
||||
constexpr std::array<const char*, SampleResults> names{"image_sample tfe", "image_sample tfe status", "image_gather4 tfe x", "image_gather4 tfe y", "image_gather4 tfe z", "image_gather4 tfe w", "image_gather4 tfe status", "image_get_resinfo tfe lwe width", "image_get_resinfo tfe lwe height", "image_get_resinfo tfe lwe status", "image_sample_l tfe", "image_sample_l tfe status", "image_load tfe lwe", "image_load tfe lwe status", "image_load tfe d16", "image_load tfe d16 status"};
|
||||
constexpr std::array<const char*, SampleResults> names{"image_sample tfe lwe", "image_sample tfe lwe status", "image_gather4 tfe lwe x", "image_gather4 tfe lwe y", "image_gather4 tfe lwe z", "image_gather4 tfe lwe w", "image_gather4 tfe lwe status", "image_get_resinfo tfe lwe width", "image_get_resinfo tfe lwe height", "image_get_resinfo tfe lwe status", "image_sample_l tfe", "image_sample_l tfe status", "image_load tfe lwe", "image_load tfe lwe status", "image_load tfe d16", "image_load tfe d16 status"};
|
||||
for (std::uint32_t tid = 0; tid < Threads; ++tid) {
|
||||
for (std::uint32_t j = 0; j < SampleResults; ++j) {
|
||||
Expect(names[j], tid, Buffer[Threads * Inputs + tid * Results + j], SampleExpected[tid][j]);
|
||||
|
||||
@@ -315,7 +315,7 @@ RdnaInstruction DecodeRdnaMimg(std::uint32_t programCounter, std::span<const std
|
||||
const auto opcode = ((word0 >> 18u) & 0x7Fu) | ((word0 & 1u) << 7u);
|
||||
const auto& info = lookupOpcode(opcode);
|
||||
const bool samplerOp = info.sample || info.gather || opcode == 0x60u;
|
||||
const auto texelStatusBits = samplerOp ? 0x00010000u : opcode <= 0x0eu ? 0x00030000u : 0u;
|
||||
const auto texelStatusBits = info.sample || info.gather || opcode <= 0x0eu ? 0x00030000u : samplerOp ? 0x00010000u : 0u;
|
||||
const auto reservedWord0 = (info.sample || info.gather ? 0x00035040u : info.atomic ? 0x000340C0u : 0x00034040u) & ~texelStatusBits;
|
||||
if ((word0 & reservedWord0) != 0u || (word1 & 0x3C000000u) != 0u) {
|
||||
char message[96];
|
||||
|
||||
@@ -219,7 +219,7 @@ Throughout the project, every function at every stage either **does exactly what
|
||||
- [sceKernelRaiseException](../../core/libs/prx/libkernel/System/src/Exception.cpp) reaches a thread that waits in an alertable `TimedWait` wait through an APC. A thread blocked anywhere else, including all waits under `APS5_COARSE_TIMED_WAITS` and host waits inside the emulator, is redirected and runs the handler only when that wait returns
|
||||
- [libSceUlt queues](../../core/libs/prx/libSceUlt/Export.cpp) use preallocated host storage instead of the supplied guest work area; its existing size formula and the 512-byte object layouts remain unverified. Waiting-queue pool thread limits and waiter priority ordering are not implemented. Finalization wakes blocked queue callers with `ULT_ERROR_STATE`.
|
||||
- [Thread cancellation](../../core/libs/prx/libkernel/Pthread/src/Thread.cpp) (libkernel) is not modelled: `scePthreadCancel` throws, so no cancel request is ever pending and `scePthreadTestcancel` and `pthread_testcancel` return without acting; the cancel state and type set by `scePthreadSetcancelstate` and `scePthreadSetcanceltype` are stored and not used
|
||||
- [MIMG `tfe` and `lwe`](../../core/shader/recompiler/RdnaDecoder/src/RdnaImageOpDecoder.cpp) never write the status VGPR after the data. On hardware it is written only when a texel fetch hits an unmapped page of a partially resident texture, or, for `lwe` on sample/gather, when the LOD is below the T# `MIN_LOD_WARN`; texture memory is always resident here, and `lwe` on sample, gather and `image_get_lod` throws.
|
||||
- [MIMG `tfe` and `lwe`](../../core/shader/recompiler/RdnaDecoder/src/RdnaImageOpDecoder.cpp) never write the status VGPR after the data. On hardware it is written only when a texel fetch hits an unmapped page of a partially resident texture, or, for `lwe` on sample/gather, when the LOD is below the T# `MIN_LOD_WARN`; texture memory is always resident here, the LOD warning (texture-streaming feedback, like the T# `MIN_LOD_WARN` itself) is never reported, and `lwe` on `image_get_lod` throws.
|
||||
- [Unnormalized S# coordinates](../../core/libs/prx/libSceAgcDriver/Graphics/src/GuestSamplerResource.cpp) (libSceAgcDriver) - `FORCE_UNNORMALIZED` uses a Vulkan `unnormalizedCoordinates` sampler, so the S# LOD range, LOD bias and mip filter are not applied, which is exact only on a one-level view.
|
||||
- [Unnormalized S#s](../../core/shader/recompiler/Optimization/src/DescriptorBindingBuilder.cpp) are accepted only when direct and used only by explicit-LOD `image_sample` without offset, comparison, derivatives or `_a`, on a single-level, single-layer 1D or 2D view of mip 0, even when the image is also sampled through a normalized S#.
|
||||
- An [unnormalized S#](../../core/libs/prx/libSceAgcDriver/Graphics/src/GuestSamplerResource.cpp) (libSceAgcDriver) throws with unequal minification and magnification filters, anisotropy, `TRUNC_COORD`, `MC_COORD_TRUNC` or X/Y clamping other than last-texel or border.
|
||||
|
||||
Reference in New Issue
Block a user