Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions core/libs/prx/libSceAgc/DcbDraw/src/Stats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,13 @@ std::uint32_t* APS5_VABI sceAgcDcbGetLodStats(CommandBuffer* buf, std::uint8_t c
return Agc::Command::Emit(buf, 0x10u, {bufferSizeInBytes, static_cast<std::uint32_t>(address), static_cast<std::uint32_t>(address >> 32u), control}, __func__);
}

std::uint32_t APS5_VABI sceAgcDcbBeginOcclusionQueryGetSize() {
NotImplemented_nid_no_patch(__func__);
return 0;
std::uint32_t APS5_VABI sceAgcDcbBeginOcclusionQueryGetSize(std::uint8_t type) {
Agc::Command::Require(type == 0, __func__, "only occlusion query type 0 has a confirmed size");
return 16;
}

std::uint32_t APS5_VABI sceAgcDcbEndOcclusionQueryGetSize() {
NotImplemented_nid_no_patch(__func__);
return 0;
return 16;
}

}
11 changes: 11 additions & 0 deletions core/libs/prx/libSceAgc/tests/Commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ extern "C" std::uint32_t* APS5_VABI sceAgcAcbSetMarker(CommandBuffer* buf, const
extern "C" std::uint32_t* APS5_VABI sceAgcDcbSetIndexBuffer(CommandBuffer* buf, std::uint64_t indexAddress);
extern "C" std::uint32_t* APS5_VABI sceAgcDcbSetBaseIndirectArgs(CommandBuffer* buf, std::uint32_t shaderType, const volatile void* indirectBaseAddr);
extern "C" std::uint32_t* APS5_VABI sceAgcSetNop(CommandBuffer* buf, std::uint32_t sizeDw);
extern "C" std::uint32_t APS5_VABI sceAgcDcbBeginOcclusionQueryGetSize(std::uint8_t type);
extern "C" std::uint32_t APS5_VABI sceAgcDcbEndOcclusionQueryGetSize();

namespace {

Expand Down Expand Up @@ -203,6 +205,14 @@ void testMarkers() {
expectFailure([] { sceAgcAcbSetMarker(nullptr, "frame", 0); });
}

void testOcclusionQuerySizes() {
check(sceAgcDcbBeginOcclusionQueryGetSize(0) == 16, "occlusion query begin size mismatch");
check(sceAgcDcbEndOcclusionQueryGetSize() == 16, "occlusion query end size mismatch");
expectFailure([] { sceAgcDcbBeginOcclusionQueryGetSize(1); });
expectFailure([] { sceAgcDcbBeginOcclusionQueryGetSize(2); });
expectFailure([] { sceAgcDcbBeginOcclusionQueryGetSize(0xff); });
}

void testIndexBuffer() {
Storage storage;
alignas(4) std::uint16_t indices[2]{};
Expand Down Expand Up @@ -438,6 +448,7 @@ int main(int argc, char** argv) {
testClearState();
testIndexedIndirectDraws();
testMarkers();
testOcclusionQuerySizes();
testIndexBuffer();
testIndirectBase();
testContextState();
Expand Down
1 change: 1 addition & 0 deletions docs/dev/TechnicalDebt.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ Throughout the project, every function at every stage either **does exactly what
- [dbOlWdppb4o](../../core/libs/prx/libSceAgc/Shader/src/InterpolantMapping.cpp) (libSceAgc) - unknown name; same arguments as `sceAgcCreateInterpolantMapping_0100`; the `SPI_PS_INPUT_CNTL` bits for `is_f16` 2 inputs follow KytyPS5, not confirmed on hardware
- [sceAgcGetDataPacketPayloadRange](../../core/libs/prx/libSceAgc/Misc/src/PacketInfo.cpp) (libSceAgc) - signature, the `{base, size in bytes}` output and the type 0 range (header + 1, one dword longer than the type 1 payload) from KytyPS5 only, matching `sceAgcGetDataPacketPayloadAddress_0090`; prosper returns header + 2 for both types from that address function
- [sceAgcAsyncCondExecPatchSetCommandAddress, sceAgcAsyncCondExecPatchSetEnd](../../core/libs/prx/libSceAgc/Patch/src/CondExec.cpp) (libSceAgc) - no reference has a body for them; they are assumed to patch the COND_EXEC packet like `sceAgcCondExecPatchSetCommandAddress` and `sceAgcCondExecPatchSetEnd`, since `sceAgcAcbCondExec` writes the same packet as `sceAgcDcbCondExec`, as `sceAgcAsyncRewindPatchSetRewindState` does for REWIND
- [sceAgcDcbBeginOcclusionQueryGetSize, sceAgcDcbEndOcclusionQueryGetSize](../../core/libs/prx/libSceAgc/DcbDraw/src/Stats.cpp) (libSceAgc) - the builders are inline in the SDK and not exported, so the sizes cannot be checked against a packet. The end size (16 bytes) follows [OpenAGC](https://github.com/OpenAGC/OpenAGC/blob/main/src/game_compat.c), [prosper](https://github.com/mattias800/prosper) and [SharpProspero](https://github.com/SvenGDK/SharpProspero/blob/main/src/SharpProspero/Interop/Agc/SceAgc.cs). The begin size takes the query type as a byte, as OpenAGC does: type 0 is 16 bytes (OpenAGC, prosper). Every other type throws: OpenAGC's 288 bytes for type 1 has no second source (prosper's console golden passes no type and SharpProspero declares the argument as `uint queryMode`), so type 1 stays unimplemented until a title uses it; OpenAGC returns 0 for the other types
- [sceAgcAcbAtomicGds_0900](../../core/libs/prx/libSceAgc/Acb/src/Control.cpp) (libSceAgc) - name from its NID (`gQkqkLttcpw`), signature unknown
- [sceAgcDcbPrimeUtcl2](../../core/libs/prx/libSceAgc/DcbState/src/Display.cpp) (libSceAgc) - assumed to write the packet `sceAgcAcbPrimeUtcl2` writes: PRIME_UTCL2 has the same 5 dwords on the graphics and compute rings. Not confirmed on a title. Both write a NOP of that size, as there is no TLB to prime
- [sceAgcDcbQueueEndOfShaderActionGetSize](../../core/libs/prx/libSceAgc/DcbState/src/ContextState.cpp) (libSceAgc) - the builder is inline in the SDK and not exported; the size is assumed to be that of the RELEASE_MEM packet `sceAgcCbReleaseMem` writes (32 bytes), the same as `sceAgcAcbQueueEndOfShaderActionGetSize`, as in [OpenAGC](https://github.com/OpenAGC/OpenAGC/blob/main/src/game_compat.c) and [REmu](https://github.com/xnetcat/REmu/blob/main/crates/remu-runtime/src/agc_dcb.rs)
Expand Down
Loading