mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-10 01:28:44 +02:00
feat(agc): implement sceAgcDriverGetEqContextId
Return the id a graphics event was registered with in sceAgcDriverAddEqEvent, which titles derive from their context (PPSA12544: 0 or 1 for graphics, 0x20 + 8 * pipe + queue for compute) and read back to dispatch the event. Other event filters, a null or misaligned event and an id above 32 bits throw. The meaning is an assumption and recorded in the technical debt. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -4,5 +4,6 @@
|
||||
#include "SceTypes.hpp"
|
||||
|
||||
extern "C" int APS5_VABI sceAgcDriverGetEqEventType(const KernelEvent* ev);
|
||||
extern "C" uint32_t APS5_VABI sceAgcDriverGetEqContextId(const KernelEvent* ev);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -11,9 +11,16 @@
|
||||
extern "C" {
|
||||
|
||||
uint32_t APS5_VABI sceAgcDriverGetEqContextId(const KernelEvent* ev) {
|
||||
(void)ev;
|
||||
NotImplemented_nid_no_patch(__func__);
|
||||
return 0;
|
||||
if (ev == nullptr || reinterpret_cast<std::uintptr_t>(ev) % alignof(KernelEvent) != 0) {
|
||||
throw std::runtime_error(std::string(__func__) + ": null or misaligned event");
|
||||
}
|
||||
if (ev->filter != -14) {
|
||||
throw std::runtime_error(std::string(__func__) + ": not a graphics event");
|
||||
}
|
||||
if (ev->ident > std::numeric_limits<uint32_t>::max()) {
|
||||
throw std::runtime_error(std::string(__func__) + ": context id overflow");
|
||||
}
|
||||
return static_cast<uint32_t>(ev->ident);
|
||||
}
|
||||
|
||||
int APS5_VABI sceAgcDriverGetEqEventType(const KernelEvent* ev) {
|
||||
|
||||
@@ -63,6 +63,14 @@ void testEvents() {
|
||||
expectFailure([&] { sceAgcDriverGetEqEventType(&event); });
|
||||
expectFailure([] { sceAgcDriverGetEqEventType(nullptr); });
|
||||
expectFailure([&] { sceAgcDriverGetEqEventType(reinterpret_cast<const KernelEvent*>(reinterpret_cast<const std::byte*>(&event) + 1)); });
|
||||
event.ident = 0x29;
|
||||
check(sceAgcDriverGetEqContextId(&event) == 0x29, "graphics event context id uses wrong field");
|
||||
event.ident = std::numeric_limits<std::uintptr_t>::max();
|
||||
expectFailure([&] { sceAgcDriverGetEqContextId(&event); });
|
||||
event.ident = 1;
|
||||
event.filter = -1;
|
||||
expectFailure([&] { sceAgcDriverGetEqContextId(&event); });
|
||||
expectFailure([] { sceAgcDriverGetEqContextId(nullptr); });
|
||||
}
|
||||
|
||||
void testValidation() {
|
||||
|
||||
@@ -70,6 +70,7 @@ Throughout the project, every function at every stage either **does exactly what
|
||||
- [sceUserServiceGetUserColor](../../core/libs/prx/libSceUserService/Export.cpp) (libSceUserService) - the default profile colour is assumed to be blue (0)
|
||||
- [kP2L8t3j-aM](../../core/libs/prx/libSceVideoOut/src/Output.cpp) (libSceVideoOut) - unknown name, signature
|
||||
- [LibwuIonIBw](../../core/libs/prx/libSceVideoOut/src/Output.cpp) (libSceVideoOut) - unknown name, signature
|
||||
- [sceAgcDriverGetEqContextId](../../core/libs/prx/libSceAgcDriver/Eq/src/Query.cpp) (libSceAgcDriver) - assumed to return the id the graphics event was registered with in `sceAgcDriverAddEqEvent` (PPSA12544 derives that id from its context: 0 or 1 for graphics, 0x20 + 8 * pipe + queue for compute); other event filters throw
|
||||
- [sceAgcSetSubmitMode](../../core/libs/prx/libSceAgc/Misc/src/Suspend.cpp) (libSceAgc) - mode values unknown; only 0 is accepted
|
||||
- [User data registers](../../core/libs/prx/libSceAgcDriver/Execution/src/Driver/Diagnostics.cpp) (AGC driver) - a `SPI_SHADER_USER_DATA_*` or `COMPUTE_USER_DATA_*` register the title never wrote reads as 0 when a stage's RSRC2 count covers it, as Kyty (zeroed `UserSgprInfo`) and SharpEmu (missing registers read 0) do, and as AMD PAL and Mesa initialize them; the console's value is not confirmed
|
||||
- [SET_PREDICATION](../../core/libs/prx/libSceAgcDriver/Execution/src/Pm4.cpp) (AGC driver) - boolean predication follows the AMD PM4 encoding [Mesa](https://gitlab.freedesktop.org/mesa/mesa/-/blob/main/src/amd/common/sid.h) uses: operation 3 reads 64 bits and 4 reads 32 bits, and bit 8 runs predicated packets when the value is non-zero (clear: when it is zero); the bit 12 hint is ignored. The address must have its low 4 bits clear, as `sceAgcDcbSetPredication` writes it. Query predication (Z-pass, primitive count), a predicated COND_EXEC, predicated command buffer chains and flips in predicated command buffers throw
|
||||
|
||||
Reference in New Issue
Block a user