diff --git a/core/libs/prx/libSceAgc/Acb/Export.cpp b/core/libs/prx/libSceAgc/Acb/Export.cpp deleted file mode 100644 index aa4cf636c..000000000 --- a/core/libs/prx/libSceAgc/Acb/Export.cpp +++ /dev/null @@ -1,131 +0,0 @@ -#include "prx/libSceAgc/Command/Memory.hpp" -#include "prx/libSceAgc/Command/Packet.hpp" -#include -#include -#include "SceTypes.hpp" -#include "prx/libc/include/General.hpp" - -extern "C" { - -uint32_t* APS5_VABI sceAgcAcbAcquireMem(CommandBuffer* buf, uint32_t gcr_cntl, const volatile void* base, uint64_t size_bytes, uint32_t poll_cycles) { - (void)buf; - (void)gcr_cntl; - (void)base; - (void)size_bytes; - (void)poll_cycles; - NotImplemented_nid_no_patch(__func__); - return nullptr; -} - -uint32_t APS5_VABI sceAgcAcbAcquireMemGetSize(void) { - NotImplemented_nid_no_patch(__func__); - return 0; -} - -uint32_t* APS5_VABI sceAgcAcbCondExec(CommandBuffer* buf, const volatile uint32_t* address, uint32_t num_dwords) { - (void)buf; - (void)address; - (void)num_dwords; - NotImplemented_nid_no_patch(__func__); - return nullptr; -} - -uint32_t APS5_VABI sceAgcAcbCondExecGetSize(void) { - NotImplemented_nid_no_patch(__func__); - return 0; -} - -uint32_t* APS5_VABI sceAgcAcbCopyData(CommandBuffer* buf, uint8_t dst, uint8_t dst_cache_policy, uint64_t dst_address, uint8_t src, uint8_t src_cache_policy, uint64_t src_address_or_immediate, uint8_t item_size, uint8_t write_confirm) { - (void)buf; - (void)dst; - (void)dst_cache_policy; - (void)dst_address; - (void)src; - (void)src_cache_policy; - (void)src_address_or_immediate; - (void)item_size; - (void)write_confirm; - NotImplemented_nid_no_patch(__func__); - return nullptr; -} - -uint32_t* APS5_VABI sceAgcAcbDispatchIndirect(CommandBuffer* buf, const volatile void* indirect_args, uint32_t modifier) { - (void)buf; - (void)indirect_args; - (void)modifier; - NotImplemented_nid_no_patch(__func__); - return nullptr; -} - -std::uint32_t* APS5_VABI sceAgcAcbDmaData(CommandBuffer* buf, std::uint8_t dst, std::uint8_t dstCachePolicy, std::uint64_t dstAddress, std::uint8_t src, std::uint8_t srcCachePolicy, std::uint64_t srcAddress, std::uint32_t numBytes, std::uint8_t waitForPrevious, std::uint8_t writeConfirm) { - return Agc::Command::WriteDma(buf, true, 0, dst, dstCachePolicy, dstAddress, src, srcCachePolicy, srcAddress, numBytes, waitForPrevious, writeConfirm, 0, __func__); -} - -std::uint32_t* APS5_VABI sceAgcAcbEventWrite(CommandBuffer* buf, std::uint8_t eventType, const volatile void* address) { - Agc::Command::CheckBits(eventType, 0x3fu, __func__); - Agc::Command::Require(address == nullptr, __func__, "ACB event address is not supported"); - return Agc::Command::Emit(buf, 0x46u, {eventType | (eventType == 7 ? 0x400u : 0u)}, __func__); -} - -uint32_t APS5_VABI sceAgcAcbJumpGetSize(void) { - NotImplemented_nid_no_patch(__func__); - return 0; -} - -uint32_t* APS5_VABI sceAgcAcbPopMarker(CommandBuffer* buf) { - (void)buf; - NotImplemented_nid_no_patch(__func__); - return nullptr; -} - -uint32_t* APS5_VABI sceAgcAcbPushMarker(CommandBuffer* buf, const char* str, uint32_t color) { - (void)buf; - (void)str; - (void)color; - NotImplemented_nid_no_patch(__func__); - return nullptr; -} - -uint32_t* APS5_VABI sceAgcAcbResetQueue(CommandBuffer* buf, uint32_t op) { - (void)buf; - (void)op; - NotImplemented_nid_no_patch(__func__); - return nullptr; -} - -uint32_t* APS5_VABI sceAgcAcbSetMarker(CommandBuffer* buf, const char* str, uint32_t color) { - (void)buf; - (void)str; - (void)color; - NotImplemented_nid_no_patch(__func__); - return nullptr; -} - -std::uint32_t* APS5_VABI sceAgcAcbWaitRegMem(CommandBuffer* buf, std::uint8_t size, std::uint8_t compareFunction, std::uint8_t cachePolicy, const volatile void* address, std::uint64_t reference, std::uint64_t mask, std::uint32_t pollCycles) { - return Agc::Command::WriteWait(buf, size, compareFunction, 0, cachePolicy, address, reference, mask, pollCycles, __func__); -} - -std::uint32_t* APS5_VABI sceAgcAcbWriteData(CommandBuffer* buf, std::uint8_t dst, std::uint8_t cachePolicy, std::uint64_t address, const void* data, std::uint32_t numDwords, std::uint8_t increment, std::uint8_t writeConfirm) { - return Agc::Command::WriteData(buf, true, dst, cachePolicy, address, data, numDwords, increment, writeConfirm, __func__); -} -std::uint64_t APS5_VABI sceAgcAcbCopyDataGetSize() { - NotImplemented_nid_no_patch(__func__); - return 0; -} - -std::uint32_t* APS5_VABI sceAgcAcbJump(CommandBuffer* buf, std::uint8_t cachePolicy, const std::uint32_t* target, std::uint32_t sizeInDwords) { - (void)buf; - (void)cachePolicy; - (void)target; - (void)sizeInDwords; - NotImplemented_nid_no_patch(__func__); - return 0; -} - -std::uint64_t APS5_VABI sceAgcAcbWaitOnAddressGetSize(std::uint8_t size) { - (void)size; - NotImplemented_nid_no_patch(__func__); - return 0; -} - -} diff --git a/core/libs/prx/libSceAgc/Acb/include/Control.hpp b/core/libs/prx/libSceAgc/Acb/include/Control.hpp new file mode 100644 index 000000000..c22dc4e61 --- /dev/null +++ b/core/libs/prx/libSceAgc/Acb/include/Control.hpp @@ -0,0 +1,4 @@ +#ifndef CORE_LIBS_PRX_LIBSCEAGC_ACB_INCLUDE_CONTROL_HPP +#define CORE_LIBS_PRX_LIBSCEAGC_ACB_INCLUDE_CONTROL_HPP + +#endif diff --git a/core/libs/prx/libSceAgc/Acb/include/Dispatch.hpp b/core/libs/prx/libSceAgc/Acb/include/Dispatch.hpp new file mode 100644 index 000000000..e207781ef --- /dev/null +++ b/core/libs/prx/libSceAgc/Acb/include/Dispatch.hpp @@ -0,0 +1,4 @@ +#ifndef CORE_LIBS_PRX_LIBSCEAGC_ACB_INCLUDE_DISPATCH_HPP +#define CORE_LIBS_PRX_LIBSCEAGC_ACB_INCLUDE_DISPATCH_HPP + +#endif diff --git a/core/libs/prx/libSceAgc/Acb/include/Memory.hpp b/core/libs/prx/libSceAgc/Acb/include/Memory.hpp new file mode 100644 index 000000000..78e8668cb --- /dev/null +++ b/core/libs/prx/libSceAgc/Acb/include/Memory.hpp @@ -0,0 +1,4 @@ +#ifndef CORE_LIBS_PRX_LIBSCEAGC_ACB_INCLUDE_MEMORY_HPP +#define CORE_LIBS_PRX_LIBSCEAGC_ACB_INCLUDE_MEMORY_HPP + +#endif diff --git a/core/libs/prx/libSceAgc/Acb/include/Sync.hpp b/core/libs/prx/libSceAgc/Acb/include/Sync.hpp new file mode 100644 index 000000000..ca3084b8b --- /dev/null +++ b/core/libs/prx/libSceAgc/Acb/include/Sync.hpp @@ -0,0 +1,4 @@ +#ifndef CORE_LIBS_PRX_LIBSCEAGC_ACB_INCLUDE_SYNC_HPP +#define CORE_LIBS_PRX_LIBSCEAGC_ACB_INCLUDE_SYNC_HPP + +#endif diff --git a/core/libs/prx/libSceAgc/Acb/src/Control.cpp b/core/libs/prx/libSceAgc/Acb/src/Control.cpp new file mode 100644 index 000000000..746fea3cb --- /dev/null +++ b/core/libs/prx/libSceAgc/Acb/src/Control.cpp @@ -0,0 +1,55 @@ +#include "prx/libSceAgc/Acb/include/Control.hpp" + +#include "prx/libSceAgc/Command/include/Memory.hpp" +#include "prx/libSceAgc/Command/include/Packet.hpp" +#include +#include +#include "SceTypes.hpp" +#include "prx/libc/include/General.hpp" + +extern "C" { + +std::uint32_t* APS5_VABI sceAgcAcbJump(CommandBuffer* buf, std::uint8_t cachePolicy, const std::uint32_t* target, std::uint32_t sizeInDwords) { + (void)buf; + (void)cachePolicy; + (void)target; + (void)sizeInDwords; + NotImplemented_nid_no_patch(__func__); + return 0; +} + +uint32_t APS5_VABI sceAgcAcbJumpGetSize(void) { + NotImplemented_nid_no_patch(__func__); + return 0; +} + +uint32_t* APS5_VABI sceAgcAcbResetQueue(CommandBuffer* buf, uint32_t op) { + (void)buf; + (void)op; + NotImplemented_nid_no_patch(__func__); + return nullptr; +} + +uint32_t* APS5_VABI sceAgcAcbPushMarker(CommandBuffer* buf, const char* str, uint32_t color) { + (void)buf; + (void)str; + (void)color; + NotImplemented_nid_no_patch(__func__); + return nullptr; +} + +uint32_t* APS5_VABI sceAgcAcbPopMarker(CommandBuffer* buf) { + (void)buf; + NotImplemented_nid_no_patch(__func__); + return nullptr; +} + +uint32_t* APS5_VABI sceAgcAcbSetMarker(CommandBuffer* buf, const char* str, uint32_t color) { + (void)buf; + (void)str; + (void)color; + NotImplemented_nid_no_patch(__func__); + return nullptr; +} + +} diff --git a/core/libs/prx/libSceAgc/Acb/src/Dispatch.cpp b/core/libs/prx/libSceAgc/Acb/src/Dispatch.cpp new file mode 100644 index 000000000..37595eb37 --- /dev/null +++ b/core/libs/prx/libSceAgc/Acb/src/Dispatch.cpp @@ -0,0 +1,20 @@ +#include "prx/libSceAgc/Acb/include/Dispatch.hpp" + +#include "prx/libSceAgc/Command/include/Memory.hpp" +#include "prx/libSceAgc/Command/include/Packet.hpp" +#include +#include +#include "SceTypes.hpp" +#include "prx/libc/include/General.hpp" + +extern "C" { + +uint32_t* APS5_VABI sceAgcAcbDispatchIndirect(CommandBuffer* buf, const volatile void* indirect_args, uint32_t modifier) { + (void)buf; + (void)indirect_args; + (void)modifier; + NotImplemented_nid_no_patch(__func__); + return nullptr; +} + +} diff --git a/core/libs/prx/libSceAgc/Acb/src/Memory.cpp b/core/libs/prx/libSceAgc/Acb/src/Memory.cpp new file mode 100644 index 000000000..bffa62e1e --- /dev/null +++ b/core/libs/prx/libSceAgc/Acb/src/Memory.cpp @@ -0,0 +1,54 @@ +#include "prx/libSceAgc/Acb/include/Memory.hpp" + +#include "prx/libSceAgc/Command/include/Memory.hpp" +#include "prx/libSceAgc/Command/include/Packet.hpp" +#include +#include +#include "SceTypes.hpp" +#include "prx/libc/include/General.hpp" + +extern "C" { + +uint32_t* APS5_VABI sceAgcAcbAcquireMem(CommandBuffer* buf, uint32_t gcr_cntl, const volatile void* base, uint64_t size_bytes, uint32_t poll_cycles) { + (void)buf; + (void)gcr_cntl; + (void)base; + (void)size_bytes; + (void)poll_cycles; + NotImplemented_nid_no_patch(__func__); + return nullptr; +} + +uint32_t APS5_VABI sceAgcAcbAcquireMemGetSize(void) { + NotImplemented_nid_no_patch(__func__); + return 0; +} + +uint32_t* APS5_VABI sceAgcAcbCopyData(CommandBuffer* buf, uint8_t dst, uint8_t dst_cache_policy, uint64_t dst_address, uint8_t src, uint8_t src_cache_policy, uint64_t src_address_or_immediate, uint8_t item_size, uint8_t write_confirm) { + (void)buf; + (void)dst; + (void)dst_cache_policy; + (void)dst_address; + (void)src; + (void)src_cache_policy; + (void)src_address_or_immediate; + (void)item_size; + (void)write_confirm; + NotImplemented_nid_no_patch(__func__); + return nullptr; +} + +std::uint64_t APS5_VABI sceAgcAcbCopyDataGetSize() { + NotImplemented_nid_no_patch(__func__); + return 0; +} + +std::uint32_t* APS5_VABI sceAgcAcbDmaData(CommandBuffer* buf, std::uint8_t dst, std::uint8_t dstCachePolicy, std::uint64_t dstAddress, std::uint8_t src, std::uint8_t srcCachePolicy, std::uint64_t srcAddress, std::uint32_t numBytes, std::uint8_t waitForPrevious, std::uint8_t writeConfirm) { + return Agc::Command::WriteDma(buf, true, 0, dst, dstCachePolicy, dstAddress, src, srcCachePolicy, srcAddress, numBytes, waitForPrevious, writeConfirm, 0, __func__); +} + +std::uint32_t* APS5_VABI sceAgcAcbWriteData(CommandBuffer* buf, std::uint8_t dst, std::uint8_t cachePolicy, std::uint64_t address, const void* data, std::uint32_t numDwords, std::uint8_t increment, std::uint8_t writeConfirm) { + return Agc::Command::WriteData(buf, true, dst, cachePolicy, address, data, numDwords, increment, writeConfirm, __func__); +} + +} diff --git a/core/libs/prx/libSceAgc/Acb/src/Sync.cpp b/core/libs/prx/libSceAgc/Acb/src/Sync.cpp new file mode 100644 index 000000000..4ea4b70df --- /dev/null +++ b/core/libs/prx/libSceAgc/Acb/src/Sync.cpp @@ -0,0 +1,41 @@ +#include "prx/libSceAgc/Acb/include/Sync.hpp" + +#include "prx/libSceAgc/Command/include/Memory.hpp" +#include "prx/libSceAgc/Command/include/Packet.hpp" +#include +#include +#include "SceTypes.hpp" +#include "prx/libc/include/General.hpp" + +extern "C" { + +uint32_t* APS5_VABI sceAgcAcbCondExec(CommandBuffer* buf, const volatile uint32_t* address, uint32_t num_dwords) { + (void)buf; + (void)address; + (void)num_dwords; + NotImplemented_nid_no_patch(__func__); + return nullptr; +} + +uint32_t APS5_VABI sceAgcAcbCondExecGetSize(void) { + NotImplemented_nid_no_patch(__func__); + return 0; +} + +std::uint32_t* APS5_VABI sceAgcAcbWaitRegMem(CommandBuffer* buf, std::uint8_t size, std::uint8_t compareFunction, std::uint8_t cachePolicy, const volatile void* address, std::uint64_t reference, std::uint64_t mask, std::uint32_t pollCycles) { + return Agc::Command::WriteWait(buf, size, compareFunction, 0, cachePolicy, address, reference, mask, pollCycles, __func__); +} + +std::uint64_t APS5_VABI sceAgcAcbWaitOnAddressGetSize(std::uint8_t size) { + (void)size; + NotImplemented_nid_no_patch(__func__); + return 0; +} + +std::uint32_t* APS5_VABI sceAgcAcbEventWrite(CommandBuffer* buf, std::uint8_t eventType, const volatile void* address) { + Agc::Command::CheckBits(eventType, 0x3fu, __func__); + Agc::Command::Require(address == nullptr, __func__, "ACB event address is not supported"); + return Agc::Command::Emit(buf, 0x46u, {eventType | (eventType == 7 ? 0x400u : 0u)}, __func__); +} + +} diff --git a/core/libs/prx/libSceAgc/CMakeLists.txt b/core/libs/prx/libSceAgc/CMakeLists.txt index 15356c5d9..7122dedd6 100644 --- a/core/libs/prx/libSceAgc/CMakeLists.txt +++ b/core/libs/prx/libSceAgc/CMakeLists.txt @@ -1,17 +1,47 @@ add_library(libSceAgc SHARED EXCLUDE_FROM_ALL - ${CMAKE_CURRENT_SOURCE_DIR}/Command/Packet.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/Command/Memory.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/Export.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/Shader/Export.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/Shader/ShaderUtils.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/Acb/Export.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/Cb/Export.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/DcbDraw/Export.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/DcbState/Export.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/DcbFlow/Export.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/Patch/Export.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/Predication/Export.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/Misc/Export.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Acb/src/Control.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Acb/src/Dispatch.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Acb/src/Memory.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Acb/src/Sync.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Cb/src/Branch.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Cb/src/Dispatch.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Cb/src/Registers.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Cb/src/Sync.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Command/src/Memory.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Command/src/Packet.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/DcbDraw/src/DrawIndexed.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/DcbDraw/src/DrawNonIndexed.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/DcbDraw/src/IndexBuffer.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/DcbDraw/src/Instancing.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/DcbDraw/src/Stats.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/DcbFlow/src/Control.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/DcbFlow/src/Dispatch.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/DcbFlow/src/Memory.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/DcbFlow/src/Sync.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/DcbState/src/ContextState.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/DcbState/src/Display.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/DcbState/src/Init.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/DcbState/src/Marker.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/DcbState/src/Predication.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/DcbState/src/Registers.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/DcbState/src/Workload.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Misc/src/PacketInfo.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Misc/src/RegisterDefaults.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Misc/src/ShaderFusion.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Misc/src/Suspend.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Patch/src/CondExec.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Patch/src/Dma.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Patch/src/IndirectRegisters.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Patch/src/Jump.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Patch/src/Nop.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Patch/src/QueueEndOfPipeAction.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Patch/src/Rewind.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Patch/src/WaitRegMem.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Predication/src/Predication.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Shader/src/CreateShader.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Shader/src/InterpolantMapping.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Shader/src/PrimState.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Shader/src/ShaderUtils.cpp ) target_include_directories(libSceAgc PRIVATE ${LIBS_INCLUDE_DIR}) diff --git a/core/libs/prx/libSceAgc/Cb/Export.cpp b/core/libs/prx/libSceAgc/Cb/Export.cpp deleted file mode 100644 index fbcf030fc..000000000 --- a/core/libs/prx/libSceAgc/Cb/Export.cpp +++ /dev/null @@ -1,102 +0,0 @@ -#include "prx/libSceAgc/Command/Packet.hpp" -#include -#include -#include "SceTypes.hpp" -#include "prx/libc/include/General.hpp" - -extern "C" { - -std::uint32_t* APS5_VABI sceAgcCbBranch(CommandBuffer* buf, std::uint8_t mode, std::uint8_t compareFunction, const volatile std::uint64_t* compareAddress, std::uint64_t mask, std::uint64_t reference, std::uint8_t cachePolicy1, const volatile std::uint32_t* buffer1, std::uint32_t sizeInDwords1, std::uint8_t cachePolicy2, const volatile std::uint32_t* buffer2, std::uint32_t sizeInDwords2) { - Agc::Command::CheckBits(mode, 3, __func__); - Agc::Command::CheckBits(compareFunction, 7, __func__); - Agc::Command::CheckBits(cachePolicy1, 3, __func__); - Agc::Command::CheckBits(cachePolicy2, 3, __func__); - Agc::Command::CheckBits(sizeInDwords1, 0xfffffu, __func__); - Agc::Command::CheckBits(sizeInDwords2, 0xfffffu, __func__); - const auto address = reinterpret_cast(compareAddress); - const auto first = reinterpret_cast(buffer1); - const auto second = reinterpret_cast(buffer2); - Agc::Command::CheckAddress(address, 8, __func__); - Agc::Command::CheckAddress(first, 4, __func__); - Agc::Command::CheckAddress(second, 4, __func__); - return Agc::Command::Emit(buf, 0x3fu, {mode | (static_cast(compareFunction) << 8u), static_cast(address), static_cast(address >> 32u), static_cast(mask), static_cast(mask >> 32u), static_cast(reference), static_cast(reference >> 32u), static_cast(first), static_cast(first >> 32u), sizeInDwords1 | (static_cast(cachePolicy1) << 28u), static_cast(second), static_cast(second >> 32u), sizeInDwords2 | (static_cast(cachePolicy2) << 28u)}, __func__); -} - -std::uint32_t* APS5_VABI sceAgcCbSetUcRegisterRangeDirect(CommandBuffer* buf, std::uint32_t offset, const std::uint32_t* values, std::uint32_t numValues) { - return Agc::Command::WriteRegisterRange(buf, 0x79u, offset, values, numValues, __func__); -} - -uint32_t* APS5_VABI sceAgcCbCondWrite(CommandBuffer* buf, uint32_t cond, uint32_t a, uint32_t b, uint32_t c) { - (void)buf; - (void)cond; - (void)a; - (void)b; - (void)c; - NotImplemented_nid_no_patch(__func__); - return nullptr; -} - -std::uint32_t APS5_VABI sceAgcCbBranchGetSize() { - return 56; -} - -std::uint32_t* APS5_VABI sceAgcCbDispatch(CommandBuffer* buf, std::uint32_t threadGroupX, std::uint32_t threadGroupY, std::uint32_t threadGroupZ, std::uint32_t modifier) { - Agc::Command::CheckBits(modifier, 0xa038u, __func__); - return Agc::Command::Emit(buf, 0x15u, {threadGroupX, threadGroupY, threadGroupZ, modifier | 0x41u}, __func__); -} - -uint32_t APS5_VABI sceAgcCbDispatchGetSize(void) { - NotImplemented_nid_no_patch(__func__); - return 0; -} - -std::uint32_t* APS5_VABI sceAgcCbNop_nid_postfix(CommandBuffer* buf, std::uint32_t sizeInDwords) { - return Agc::Command::WriteNop(buf, sizeInDwords, __func__); -} - -uint32_t APS5_VABI sceAgcCbNopGetSize(uint32_t size_in_dwords) { - (void)size_in_dwords; - NotImplemented_nid_no_patch(__func__); - return 0; -} - -uint32_t APS5_VABI sceAgcCbQueueEndOfPipeActionGetSize(void) { - NotImplemented_nid_no_patch(__func__); - return 0; -} - -uint32_t* APS5_VABI sceAgcCbReleaseMem(CommandBuffer* buf, uint8_t action, uint16_t gcr_cntl, uint8_t dst, uint8_t cache_policy, const volatile Label* address, uint8_t data_sel, uint64_t data, uint16_t gds_offset, uint16_t gds_size, uint8_t interrupt, uint32_t interrupt_ctx_id) { - (void)buf; - (void)action; - (void)gcr_cntl; - (void)dst; - (void)cache_policy; - (void)address; - (void)data_sel; - (void)data; - (void)gds_offset; - (void)gds_size; - (void)interrupt; - (void)interrupt_ctx_id; - NotImplemented_nid_no_patch(__func__); - return nullptr; -} - -std::uint32_t* APS5_VABI sceAgcCbSetShRegisterRangeDirect(CommandBuffer* buf, std::uint32_t offset, const std::uint32_t* values, std::uint32_t numValues) { - return Agc::Command::WriteRegisterRange(buf, 0x76u, offset, values, numValues, __func__); -} - -uint32_t APS5_VABI sceAgcCbSetShRegisterRangeDirectGetSize(uint32_t num_values) { - (void)num_values; - NotImplemented_nid_no_patch(__func__); - return 0; -} - -std::uint32_t* APS5_VABI sceAgcCbSetShRegistersDirect(CommandBuffer* buf, const volatile ShaderRegister* regs, std::uint32_t numRegs) { - return Agc::Command::WriteRegisters(buf, 0x76u, regs, numRegs, true, __func__); -} -std::uint32_t* APS5_VABI sceAgcCbSetUcRegistersDirect(CommandBuffer* buf, const volatile ShaderRegister* regs, std::uint32_t numRegs) { - return Agc::Command::WriteRegisters(buf, 0x79u, regs, numRegs, false, __func__); -} - -} diff --git a/core/libs/prx/libSceAgc/Cb/include/Branch.hpp b/core/libs/prx/libSceAgc/Cb/include/Branch.hpp new file mode 100644 index 000000000..5c74f0246 --- /dev/null +++ b/core/libs/prx/libSceAgc/Cb/include/Branch.hpp @@ -0,0 +1,4 @@ +#ifndef CORE_LIBS_PRX_LIBSCEAGC_CB_INCLUDE_BRANCH_HPP +#define CORE_LIBS_PRX_LIBSCEAGC_CB_INCLUDE_BRANCH_HPP + +#endif diff --git a/core/libs/prx/libSceAgc/Cb/include/Dispatch.hpp b/core/libs/prx/libSceAgc/Cb/include/Dispatch.hpp new file mode 100644 index 000000000..5881aaf5a --- /dev/null +++ b/core/libs/prx/libSceAgc/Cb/include/Dispatch.hpp @@ -0,0 +1,4 @@ +#ifndef CORE_LIBS_PRX_LIBSCEAGC_CB_INCLUDE_DISPATCH_HPP +#define CORE_LIBS_PRX_LIBSCEAGC_CB_INCLUDE_DISPATCH_HPP + +#endif diff --git a/core/libs/prx/libSceAgc/Cb/include/Registers.hpp b/core/libs/prx/libSceAgc/Cb/include/Registers.hpp new file mode 100644 index 000000000..e5634b8ad --- /dev/null +++ b/core/libs/prx/libSceAgc/Cb/include/Registers.hpp @@ -0,0 +1,4 @@ +#ifndef CORE_LIBS_PRX_LIBSCEAGC_CB_INCLUDE_REGISTERS_HPP +#define CORE_LIBS_PRX_LIBSCEAGC_CB_INCLUDE_REGISTERS_HPP + +#endif diff --git a/core/libs/prx/libSceAgc/Cb/include/Sync.hpp b/core/libs/prx/libSceAgc/Cb/include/Sync.hpp new file mode 100644 index 000000000..4626a7e45 --- /dev/null +++ b/core/libs/prx/libSceAgc/Cb/include/Sync.hpp @@ -0,0 +1,4 @@ +#ifndef CORE_LIBS_PRX_LIBSCEAGC_CB_INCLUDE_SYNC_HPP +#define CORE_LIBS_PRX_LIBSCEAGC_CB_INCLUDE_SYNC_HPP + +#endif diff --git a/core/libs/prx/libSceAgc/Cb/src/Branch.cpp b/core/libs/prx/libSceAgc/Cb/src/Branch.cpp new file mode 100644 index 000000000..929c07e7e --- /dev/null +++ b/core/libs/prx/libSceAgc/Cb/src/Branch.cpp @@ -0,0 +1,41 @@ +#include "prx/libSceAgc/Cb/include/Branch.hpp" + +#include "prx/libSceAgc/Command/include/Packet.hpp" +#include +#include +#include "SceTypes.hpp" +#include "prx/libc/include/General.hpp" + +extern "C" { + +std::uint32_t* APS5_VABI sceAgcCbBranch(CommandBuffer* buf, std::uint8_t mode, std::uint8_t compareFunction, const volatile std::uint64_t* compareAddress, std::uint64_t mask, std::uint64_t reference, std::uint8_t cachePolicy1, const volatile std::uint32_t* buffer1, std::uint32_t sizeInDwords1, std::uint8_t cachePolicy2, const volatile std::uint32_t* buffer2, std::uint32_t sizeInDwords2) { + Agc::Command::CheckBits(mode, 3, __func__); + Agc::Command::CheckBits(compareFunction, 7, __func__); + Agc::Command::CheckBits(cachePolicy1, 3, __func__); + Agc::Command::CheckBits(cachePolicy2, 3, __func__); + Agc::Command::CheckBits(sizeInDwords1, 0xfffffu, __func__); + Agc::Command::CheckBits(sizeInDwords2, 0xfffffu, __func__); + const auto address = reinterpret_cast(compareAddress); + const auto first = reinterpret_cast(buffer1); + const auto second = reinterpret_cast(buffer2); + Agc::Command::CheckAddress(address, 8, __func__); + Agc::Command::CheckAddress(first, 4, __func__); + Agc::Command::CheckAddress(second, 4, __func__); + return Agc::Command::Emit(buf, 0x3fu, {mode | (static_cast(compareFunction) << 8u), static_cast(address), static_cast(address >> 32u), static_cast(mask), static_cast(mask >> 32u), static_cast(reference), static_cast(reference >> 32u), static_cast(first), static_cast(first >> 32u), sizeInDwords1 | (static_cast(cachePolicy1) << 28u), static_cast(second), static_cast(second >> 32u), sizeInDwords2 | (static_cast(cachePolicy2) << 28u)}, __func__); +} + +std::uint32_t APS5_VABI sceAgcCbBranchGetSize() { + return 56; +} + +uint32_t* APS5_VABI sceAgcCbCondWrite(CommandBuffer* buf, uint32_t cond, uint32_t a, uint32_t b, uint32_t c) { + (void)buf; + (void)cond; + (void)a; + (void)b; + (void)c; + NotImplemented_nid_no_patch(__func__); + return nullptr; +} + +} diff --git a/core/libs/prx/libSceAgc/Cb/src/Dispatch.cpp b/core/libs/prx/libSceAgc/Cb/src/Dispatch.cpp new file mode 100644 index 000000000..088b23012 --- /dev/null +++ b/core/libs/prx/libSceAgc/Cb/src/Dispatch.cpp @@ -0,0 +1,21 @@ +#include "prx/libSceAgc/Cb/include/Dispatch.hpp" + +#include "prx/libSceAgc/Command/include/Packet.hpp" +#include +#include +#include "SceTypes.hpp" +#include "prx/libc/include/General.hpp" + +extern "C" { + +std::uint32_t* APS5_VABI sceAgcCbDispatch(CommandBuffer* buf, std::uint32_t threadGroupX, std::uint32_t threadGroupY, std::uint32_t threadGroupZ, std::uint32_t modifier) { + Agc::Command::CheckBits(modifier, 0xa038u, __func__); + return Agc::Command::Emit(buf, 0x15u, {threadGroupX, threadGroupY, threadGroupZ, modifier | 0x41u}, __func__); +} + +uint32_t APS5_VABI sceAgcCbDispatchGetSize(void) { + NotImplemented_nid_no_patch(__func__); + return 0; +} + +} diff --git a/core/libs/prx/libSceAgc/Cb/src/Registers.cpp b/core/libs/prx/libSceAgc/Cb/src/Registers.cpp new file mode 100644 index 000000000..8c8f7eb14 --- /dev/null +++ b/core/libs/prx/libSceAgc/Cb/src/Registers.cpp @@ -0,0 +1,33 @@ +#include "prx/libSceAgc/Cb/include/Registers.hpp" + +#include "prx/libSceAgc/Command/include/Packet.hpp" +#include +#include +#include "SceTypes.hpp" +#include "prx/libc/include/General.hpp" + +extern "C" { + +std::uint32_t* APS5_VABI sceAgcCbSetUcRegisterRangeDirect(CommandBuffer* buf, std::uint32_t offset, const std::uint32_t* values, std::uint32_t numValues) { + return Agc::Command::WriteRegisterRange(buf, 0x79u, offset, values, numValues, __func__); +} + +std::uint32_t* APS5_VABI sceAgcCbSetShRegisterRangeDirect(CommandBuffer* buf, std::uint32_t offset, const std::uint32_t* values, std::uint32_t numValues) { + return Agc::Command::WriteRegisterRange(buf, 0x76u, offset, values, numValues, __func__); +} + +uint32_t APS5_VABI sceAgcCbSetShRegisterRangeDirectGetSize(uint32_t num_values) { + (void)num_values; + NotImplemented_nid_no_patch(__func__); + return 0; +} + +std::uint32_t* APS5_VABI sceAgcCbSetShRegistersDirect(CommandBuffer* buf, const volatile ShaderRegister* regs, std::uint32_t numRegs) { + return Agc::Command::WriteRegisters(buf, 0x76u, regs, numRegs, true, __func__); +} + +std::uint32_t* APS5_VABI sceAgcCbSetUcRegistersDirect(CommandBuffer* buf, const volatile ShaderRegister* regs, std::uint32_t numRegs) { + return Agc::Command::WriteRegisters(buf, 0x79u, regs, numRegs, false, __func__); +} + +} diff --git a/core/libs/prx/libSceAgc/Cb/src/Sync.cpp b/core/libs/prx/libSceAgc/Cb/src/Sync.cpp new file mode 100644 index 000000000..ef54a99af --- /dev/null +++ b/core/libs/prx/libSceAgc/Cb/src/Sync.cpp @@ -0,0 +1,43 @@ +#include "prx/libSceAgc/Cb/include/Sync.hpp" + +#include "prx/libSceAgc/Command/include/Packet.hpp" +#include +#include +#include "SceTypes.hpp" +#include "prx/libc/include/General.hpp" + +extern "C" { + +std::uint32_t* APS5_VABI sceAgcCbNop_nid_postfix(CommandBuffer* buf, std::uint32_t sizeInDwords) { + return Agc::Command::WriteNop(buf, sizeInDwords, __func__); +} + +uint32_t APS5_VABI sceAgcCbNopGetSize(uint32_t size_in_dwords) { + (void)size_in_dwords; + NotImplemented_nid_no_patch(__func__); + return 0; +} + +uint32_t APS5_VABI sceAgcCbQueueEndOfPipeActionGetSize(void) { + NotImplemented_nid_no_patch(__func__); + return 0; +} + +uint32_t* APS5_VABI sceAgcCbReleaseMem(CommandBuffer* buf, uint8_t action, uint16_t gcr_cntl, uint8_t dst, uint8_t cache_policy, const volatile Label* address, uint8_t data_sel, uint64_t data, uint16_t gds_offset, uint16_t gds_size, uint8_t interrupt, uint32_t interrupt_ctx_id) { + (void)buf; + (void)action; + (void)gcr_cntl; + (void)dst; + (void)cache_policy; + (void)address; + (void)data_sel; + (void)data; + (void)gds_offset; + (void)gds_size; + (void)interrupt; + (void)interrupt_ctx_id; + NotImplemented_nid_no_patch(__func__); + return nullptr; +} + +} diff --git a/core/libs/prx/libSceAgc/Command/Memory.hpp b/core/libs/prx/libSceAgc/Command/include/Memory.hpp similarity index 85% rename from core/libs/prx/libSceAgc/Command/Memory.hpp rename to core/libs/prx/libSceAgc/Command/include/Memory.hpp index 07743f1d5..a2442a3cb 100644 --- a/core/libs/prx/libSceAgc/Command/Memory.hpp +++ b/core/libs/prx/libSceAgc/Command/include/Memory.hpp @@ -1,7 +1,7 @@ -#ifndef CORE_LIBS_PRX_LIBSCEAGC_COMMAND_MEMORY_HPP -#define CORE_LIBS_PRX_LIBSCEAGC_COMMAND_MEMORY_HPP +#ifndef CORE_LIBS_PRX_LIBSCEAGC_COMMAND_INCLUDE_MEMORY_HPP +#define CORE_LIBS_PRX_LIBSCEAGC_COMMAND_INCLUDE_MEMORY_HPP -#include "prx/libSceAgc/Command/Packet.hpp" +#include "prx/libSceAgc/Command/include/Packet.hpp" namespace Agc::Command { diff --git a/core/libs/prx/libSceAgc/Command/Packet.hpp b/core/libs/prx/libSceAgc/Command/include/Packet.hpp similarity index 93% rename from core/libs/prx/libSceAgc/Command/Packet.hpp rename to core/libs/prx/libSceAgc/Command/include/Packet.hpp index cb8362e87..271dbc98d 100644 --- a/core/libs/prx/libSceAgc/Command/Packet.hpp +++ b/core/libs/prx/libSceAgc/Command/include/Packet.hpp @@ -1,5 +1,5 @@ -#ifndef CORE_LIBS_PRX_LIBSCEAGC_COMMAND_PACKET_HPP -#define CORE_LIBS_PRX_LIBSCEAGC_COMMAND_PACKET_HPP +#ifndef CORE_LIBS_PRX_LIBSCEAGC_COMMAND_INCLUDE_PACKET_HPP +#define CORE_LIBS_PRX_LIBSCEAGC_COMMAND_INCLUDE_PACKET_HPP #include #include diff --git a/core/libs/prx/libSceAgc/Command/Memory.cpp b/core/libs/prx/libSceAgc/Command/src/Memory.cpp similarity index 99% rename from core/libs/prx/libSceAgc/Command/Memory.cpp rename to core/libs/prx/libSceAgc/Command/src/Memory.cpp index de2b83018..04f08584e 100644 --- a/core/libs/prx/libSceAgc/Command/Memory.cpp +++ b/core/libs/prx/libSceAgc/Command/src/Memory.cpp @@ -1,4 +1,4 @@ -#include "prx/libSceAgc/Command/Memory.hpp" +#include "prx/libSceAgc/Command/include/Memory.hpp" #include #include diff --git a/core/libs/prx/libSceAgc/Command/Packet.cpp b/core/libs/prx/libSceAgc/Command/src/Packet.cpp similarity index 99% rename from core/libs/prx/libSceAgc/Command/Packet.cpp rename to core/libs/prx/libSceAgc/Command/src/Packet.cpp index 6e32ea23e..9471bb86e 100644 --- a/core/libs/prx/libSceAgc/Command/Packet.cpp +++ b/core/libs/prx/libSceAgc/Command/src/Packet.cpp @@ -1,4 +1,4 @@ -#include "prx/libSceAgc/Command/Packet.hpp" +#include "prx/libSceAgc/Command/include/Packet.hpp" #include #include diff --git a/core/libs/prx/libSceAgc/DcbDraw/Export.cpp b/core/libs/prx/libSceAgc/DcbDraw/Export.cpp deleted file mode 100644 index d19085219..000000000 --- a/core/libs/prx/libSceAgc/DcbDraw/Export.cpp +++ /dev/null @@ -1,172 +0,0 @@ -#include "prx/libSceAgc/Command/Packet.hpp" -#include -#include -#include "SceTypes.hpp" -#include "prx/libc/include/General.hpp" - -extern "C" { - -uint32_t* APS5_VABI sceAgcDcbDrawIndex(CommandBuffer* buf, uint32_t index_count, const volatile void* index_addr, uint64_t modifier) { - (void)buf; - (void)index_count; - (void)index_addr; - (void)modifier; - NotImplemented_nid_no_patch(__func__); - return nullptr; -} - -uint32_t* APS5_VABI sceAgcDcbDrawIndirectMulti(CommandBuffer* buf, uint32_t data_offset_in_bytes, uint32_t count_indirect, uint32_t max_count_or_count, const volatile void* count_addr, uint32_t stride_in_bytes, uint64_t modifier) { - (void)buf; - (void)data_offset_in_bytes; - (void)count_indirect; - (void)max_count_or_count; - (void)count_addr; - (void)stride_in_bytes; - (void)modifier; - NotImplemented_nid_no_patch(__func__); - return nullptr; -} - -uint32_t APS5_VABI sceAgcDcbDrawIndirectMultiGetSize() { - NotImplemented_nid_no_patch(__func__); - return 0; -} - -uint32_t APS5_VABI sceAgcDcbDrawIndexIndirectMultiGetSize() { - NotImplemented_nid_no_patch(__func__); - return 0; -} - -uint32_t APS5_VABI sceAgcDcbDrawIndexIndirectGetSize() { - NotImplemented_nid_no_patch(__func__); - return 0; -} - -uint32_t APS5_VABI sceAgcDcbDrawIndexGetSize(void) { - NotImplemented_nid_no_patch(__func__); - return 0; -} - -uint32_t* APS5_VABI sceAgcDcbDrawIndexAuto(CommandBuffer* buf, uint32_t index_count, uint64_t modifier) { - (void)buf; - (void)index_count; - (void)modifier; - NotImplemented_nid_no_patch(__func__); - return nullptr; -} - -uint32_t APS5_VABI sceAgcDcbDrawIndexAutoGetSize(void) { - NotImplemented_nid_no_patch(__func__); - return 0; -} - -uint32_t* APS5_VABI sceAgcDcbDrawIndexIndirect(CommandBuffer* buf, uint32_t data_offset_in_bytes, uint64_t modifier) { - (void)buf; - (void)data_offset_in_bytes; - (void)modifier; - NotImplemented_nid_no_patch(__func__); - return nullptr; -} - -uint32_t* APS5_VABI sceAgcDcbDrawIndexIndirectMulti(CommandBuffer* buf, uint32_t data_offset_in_bytes, uint32_t count_indirect, uint32_t max_count_or_count, const volatile void* count_addr, uint32_t stride_in_bytes, uint64_t modifier) { - (void)buf; - (void)data_offset_in_bytes; - (void)count_indirect; - (void)max_count_or_count; - (void)count_addr; - (void)stride_in_bytes; - (void)modifier; - NotImplemented_nid_no_patch(__func__); - return nullptr; -} - -uint32_t* APS5_VABI sceAgcDcbDrawIndexMultiInstanced(CommandBuffer* buf, uint32_t index_count, const volatile void* index_addr, const volatile void* object_ids, uint32_t instance_count, uint64_t modifier) { - (void)buf; - (void)index_count; - (void)index_addr; - (void)object_ids; - (void)instance_count; - (void)modifier; - NotImplemented_nid_no_patch(__func__); - return nullptr; -} - -uint32_t APS5_VABI sceAgcDcbDrawIndexMultiInstancedGetSize(void) { - NotImplemented_nid_no_patch(__func__); - return 0; -} - -uint32_t* APS5_VABI sceAgcDcbDrawIndexOffset(CommandBuffer* buf, uint32_t index_offset, uint32_t index_count, uint64_t modifier) { - (void)buf; - (void)index_offset; - (void)index_count; - (void)modifier; - NotImplemented_nid_no_patch(__func__); - return nullptr; -} - -uint32_t APS5_VABI sceAgcDcbDrawIndexOffsetGetSize(void) { - NotImplemented_nid_no_patch(__func__); - return 0; -} - -uint32_t* APS5_VABI sceAgcDcbDrawIndirect(CommandBuffer* buf, uint32_t data_offset_in_bytes, uint64_t modifier) { - (void)buf; - (void)data_offset_in_bytes; - (void)modifier; - NotImplemented_nid_no_patch(__func__); - return nullptr; -} - -uint32_t APS5_VABI sceAgcDcbDrawIndirectGetSize(void) { - NotImplemented_nid_no_patch(__func__); - return 0; -} - -std::uint32_t* APS5_VABI sceAgcDcbSetIndexBuffer(CommandBuffer* buf, std::uint64_t indexAddress) { - Agc::Command::CheckAddress(indexAddress, 2, __func__); - return Agc::Command::Emit(buf, 0x26u, {static_cast(indexAddress), static_cast(indexAddress >> 32u)}, __func__); -} - -uint32_t* APS5_VABI sceAgcDcbSetIndexCount(CommandBuffer* buf, uint32_t index_count) { - (void)buf; - (void)index_count; - NotImplemented_nid_no_patch(__func__); - return nullptr; -} - -std::uint32_t* APS5_VABI sceAgcDcbSetIndexSize(CommandBuffer* buf, std::uint8_t indexSize, std::uint8_t cachePolicy) { - Agc::Command::Require(indexSize <= 2, __func__, "invalid index element size"); - Agc::Command::CheckBits(cachePolicy, 3, __func__); - return Agc::Command::Emit(buf, 0x7au, {0x20000243u, 0x400u | indexSize | (static_cast(cachePolicy) << 6u)}, __func__); -} - -std::uint32_t* APS5_VABI sceAgcDcbSetNumInstances(CommandBuffer* buf, std::uint32_t numInstances) { - return Agc::Command::Emit(buf, 0x2fu, {numInstances}, __func__); -} - -std::uint32_t APS5_VABI sceAgcDcbSetNumInstancesGetSize() { - return 8; -} - -uint32_t* APS5_VABI sceAgcDcbSetBaseIndirectArgs(CommandBuffer* buf, uint32_t shader_type, const volatile void* indirect_base_addr) { - (void)buf; - (void)shader_type; - (void)indirect_base_addr; - NotImplemented_nid_no_patch(__func__); - return nullptr; -} - -std::uint32_t* APS5_VABI sceAgcDcbGetLodStats(CommandBuffer* buf, std::uint8_t cachePolicy, const volatile void* buffer, std::uint32_t bufferSizeInBytes, std::uint32_t resetCount, std::uint8_t forceReset, std::uint8_t reportAndReset, std::uint32_t reportingIntervalIn100kClocks) { - Agc::Command::CheckBits(cachePolicy, 3, __func__); - Agc::Command::CheckBits(resetCount, 0xffu, __func__); - Agc::Command::CheckBits(forceReset, 1, __func__); - Agc::Command::CheckBits(reportAndReset, 1, __func__); - Agc::Command::CheckBits(reportingIntervalIn100kClocks, 0xffu, __func__); - const auto address = reinterpret_cast(buffer); - Agc::Command::CheckAddress(address, 64, __func__); - const auto control = (static_cast(cachePolicy) << 28u) | (static_cast(reportAndReset) << 19u) | (static_cast(forceReset) << 18u) | (resetCount << 10u) | (reportingIntervalIn100kClocks << 2u); - return Agc::Command::Emit(buf, 0x8eu, {bufferSizeInBytes, static_cast(address), static_cast(address >> 32u), control}, __func__); -} - -} diff --git a/core/libs/prx/libSceAgc/DcbDraw/include/DrawIndexed.hpp b/core/libs/prx/libSceAgc/DcbDraw/include/DrawIndexed.hpp new file mode 100644 index 000000000..e134de925 --- /dev/null +++ b/core/libs/prx/libSceAgc/DcbDraw/include/DrawIndexed.hpp @@ -0,0 +1,4 @@ +#ifndef CORE_LIBS_PRX_LIBSCEAGC_DCBDRAW_INCLUDE_DRAWINDEXED_HPP +#define CORE_LIBS_PRX_LIBSCEAGC_DCBDRAW_INCLUDE_DRAWINDEXED_HPP + +#endif diff --git a/core/libs/prx/libSceAgc/DcbDraw/include/DrawNonIndexed.hpp b/core/libs/prx/libSceAgc/DcbDraw/include/DrawNonIndexed.hpp new file mode 100644 index 000000000..19705ed1f --- /dev/null +++ b/core/libs/prx/libSceAgc/DcbDraw/include/DrawNonIndexed.hpp @@ -0,0 +1,4 @@ +#ifndef CORE_LIBS_PRX_LIBSCEAGC_DCBDRAW_INCLUDE_DRAWNONINDEXED_HPP +#define CORE_LIBS_PRX_LIBSCEAGC_DCBDRAW_INCLUDE_DRAWNONINDEXED_HPP + +#endif diff --git a/core/libs/prx/libSceAgc/DcbDraw/include/IndexBuffer.hpp b/core/libs/prx/libSceAgc/DcbDraw/include/IndexBuffer.hpp new file mode 100644 index 000000000..b90a2a40d --- /dev/null +++ b/core/libs/prx/libSceAgc/DcbDraw/include/IndexBuffer.hpp @@ -0,0 +1,4 @@ +#ifndef CORE_LIBS_PRX_LIBSCEAGC_DCBDRAW_INCLUDE_INDEXBUFFER_HPP +#define CORE_LIBS_PRX_LIBSCEAGC_DCBDRAW_INCLUDE_INDEXBUFFER_HPP + +#endif diff --git a/core/libs/prx/libSceAgc/DcbDraw/include/Instancing.hpp b/core/libs/prx/libSceAgc/DcbDraw/include/Instancing.hpp new file mode 100644 index 000000000..b67b2b5ba --- /dev/null +++ b/core/libs/prx/libSceAgc/DcbDraw/include/Instancing.hpp @@ -0,0 +1,4 @@ +#ifndef CORE_LIBS_PRX_LIBSCEAGC_DCBDRAW_INCLUDE_INSTANCING_HPP +#define CORE_LIBS_PRX_LIBSCEAGC_DCBDRAW_INCLUDE_INSTANCING_HPP + +#endif diff --git a/core/libs/prx/libSceAgc/DcbDraw/include/Stats.hpp b/core/libs/prx/libSceAgc/DcbDraw/include/Stats.hpp new file mode 100644 index 000000000..a2bd44d8b --- /dev/null +++ b/core/libs/prx/libSceAgc/DcbDraw/include/Stats.hpp @@ -0,0 +1,4 @@ +#ifndef CORE_LIBS_PRX_LIBSCEAGC_DCBDRAW_INCLUDE_STATS_HPP +#define CORE_LIBS_PRX_LIBSCEAGC_DCBDRAW_INCLUDE_STATS_HPP + +#endif diff --git a/core/libs/prx/libSceAgc/DcbDraw/src/DrawIndexed.cpp b/core/libs/prx/libSceAgc/DcbDraw/src/DrawIndexed.cpp new file mode 100644 index 000000000..9f7502175 --- /dev/null +++ b/core/libs/prx/libSceAgc/DcbDraw/src/DrawIndexed.cpp @@ -0,0 +1,98 @@ +#include "prx/libSceAgc/DcbDraw/include/DrawIndexed.hpp" + +#include "prx/libSceAgc/Command/include/Packet.hpp" +#include +#include +#include "SceTypes.hpp" +#include "prx/libc/include/General.hpp" + +extern "C" { + +uint32_t* APS5_VABI sceAgcDcbDrawIndex(CommandBuffer* buf, uint32_t index_count, const volatile void* index_addr, uint64_t modifier) { + (void)buf; + (void)index_count; + (void)index_addr; + (void)modifier; + NotImplemented_nid_no_patch(__func__); + return nullptr; +} + +uint32_t APS5_VABI sceAgcDcbDrawIndexGetSize(void) { + NotImplemented_nid_no_patch(__func__); + return 0; +} + +uint32_t* APS5_VABI sceAgcDcbDrawIndexAuto(CommandBuffer* buf, uint32_t index_count, uint64_t modifier) { + (void)buf; + (void)index_count; + (void)modifier; + NotImplemented_nid_no_patch(__func__); + return nullptr; +} + +uint32_t APS5_VABI sceAgcDcbDrawIndexAutoGetSize(void) { + NotImplemented_nid_no_patch(__func__); + return 0; +} + +uint32_t* APS5_VABI sceAgcDcbDrawIndexOffset(CommandBuffer* buf, uint32_t index_offset, uint32_t index_count, uint64_t modifier) { + (void)buf; + (void)index_offset; + (void)index_count; + (void)modifier; + NotImplemented_nid_no_patch(__func__); + return nullptr; +} + +uint32_t APS5_VABI sceAgcDcbDrawIndexOffsetGetSize(void) { + NotImplemented_nid_no_patch(__func__); + return 0; +} + +uint32_t* APS5_VABI sceAgcDcbDrawIndexIndirect(CommandBuffer* buf, uint32_t data_offset_in_bytes, uint64_t modifier) { + (void)buf; + (void)data_offset_in_bytes; + (void)modifier; + NotImplemented_nid_no_patch(__func__); + return nullptr; +} + +uint32_t APS5_VABI sceAgcDcbDrawIndexIndirectGetSize() { + NotImplemented_nid_no_patch(__func__); + return 0; +} + +uint32_t* APS5_VABI sceAgcDcbDrawIndexIndirectMulti(CommandBuffer* buf, uint32_t data_offset_in_bytes, uint32_t count_indirect, uint32_t max_count_or_count, const volatile void* count_addr, uint32_t stride_in_bytes, uint64_t modifier) { + (void)buf; + (void)data_offset_in_bytes; + (void)count_indirect; + (void)max_count_or_count; + (void)count_addr; + (void)stride_in_bytes; + (void)modifier; + NotImplemented_nid_no_patch(__func__); + return nullptr; +} + +uint32_t APS5_VABI sceAgcDcbDrawIndexIndirectMultiGetSize() { + NotImplemented_nid_no_patch(__func__); + return 0; +} + +uint32_t* APS5_VABI sceAgcDcbDrawIndexMultiInstanced(CommandBuffer* buf, uint32_t index_count, const volatile void* index_addr, const volatile void* object_ids, uint32_t instance_count, uint64_t modifier) { + (void)buf; + (void)index_count; + (void)index_addr; + (void)object_ids; + (void)instance_count; + (void)modifier; + NotImplemented_nid_no_patch(__func__); + return nullptr; +} + +uint32_t APS5_VABI sceAgcDcbDrawIndexMultiInstancedGetSize(void) { + NotImplemented_nid_no_patch(__func__); + return 0; +} + +} diff --git a/core/libs/prx/libSceAgc/DcbDraw/src/DrawNonIndexed.cpp b/core/libs/prx/libSceAgc/DcbDraw/src/DrawNonIndexed.cpp new file mode 100644 index 000000000..f32f5c8f9 --- /dev/null +++ b/core/libs/prx/libSceAgc/DcbDraw/src/DrawNonIndexed.cpp @@ -0,0 +1,41 @@ +#include "prx/libSceAgc/DcbDraw/include/DrawNonIndexed.hpp" + +#include "prx/libSceAgc/Command/include/Packet.hpp" +#include +#include +#include "SceTypes.hpp" +#include "prx/libc/include/General.hpp" + +extern "C" { + +uint32_t* APS5_VABI sceAgcDcbDrawIndirect(CommandBuffer* buf, uint32_t data_offset_in_bytes, uint64_t modifier) { + (void)buf; + (void)data_offset_in_bytes; + (void)modifier; + NotImplemented_nid_no_patch(__func__); + return nullptr; +} + +uint32_t APS5_VABI sceAgcDcbDrawIndirectGetSize(void) { + NotImplemented_nid_no_patch(__func__); + return 0; +} + +uint32_t* APS5_VABI sceAgcDcbDrawIndirectMulti(CommandBuffer* buf, uint32_t data_offset_in_bytes, uint32_t count_indirect, uint32_t max_count_or_count, const volatile void* count_addr, uint32_t stride_in_bytes, uint64_t modifier) { + (void)buf; + (void)data_offset_in_bytes; + (void)count_indirect; + (void)max_count_or_count; + (void)count_addr; + (void)stride_in_bytes; + (void)modifier; + NotImplemented_nid_no_patch(__func__); + return nullptr; +} + +uint32_t APS5_VABI sceAgcDcbDrawIndirectMultiGetSize() { + NotImplemented_nid_no_patch(__func__); + return 0; +} + +} diff --git a/core/libs/prx/libSceAgc/DcbDraw/src/IndexBuffer.cpp b/core/libs/prx/libSceAgc/DcbDraw/src/IndexBuffer.cpp new file mode 100644 index 000000000..319f50504 --- /dev/null +++ b/core/libs/prx/libSceAgc/DcbDraw/src/IndexBuffer.cpp @@ -0,0 +1,29 @@ +#include "prx/libSceAgc/DcbDraw/include/IndexBuffer.hpp" + +#include "prx/libSceAgc/Command/include/Packet.hpp" +#include +#include +#include "SceTypes.hpp" +#include "prx/libc/include/General.hpp" + +extern "C" { + +std::uint32_t* APS5_VABI sceAgcDcbSetIndexBuffer(CommandBuffer* buf, std::uint64_t indexAddress) { + Agc::Command::CheckAddress(indexAddress, 2, __func__); + return Agc::Command::Emit(buf, 0x26u, {static_cast(indexAddress), static_cast(indexAddress >> 32u)}, __func__); +} + +uint32_t* APS5_VABI sceAgcDcbSetIndexCount(CommandBuffer* buf, uint32_t index_count) { + (void)buf; + (void)index_count; + NotImplemented_nid_no_patch(__func__); + return nullptr; +} + +std::uint32_t* APS5_VABI sceAgcDcbSetIndexSize(CommandBuffer* buf, std::uint8_t indexSize, std::uint8_t cachePolicy) { + Agc::Command::Require(indexSize <= 2, __func__, "invalid index element size"); + Agc::Command::CheckBits(cachePolicy, 3, __func__); + return Agc::Command::Emit(buf, 0x7au, {0x20000243u, 0x400u | indexSize | (static_cast(cachePolicy) << 6u)}, __func__); +} + +} diff --git a/core/libs/prx/libSceAgc/DcbDraw/src/Instancing.cpp b/core/libs/prx/libSceAgc/DcbDraw/src/Instancing.cpp new file mode 100644 index 000000000..c1e7ad986 --- /dev/null +++ b/core/libs/prx/libSceAgc/DcbDraw/src/Instancing.cpp @@ -0,0 +1,27 @@ +#include "prx/libSceAgc/DcbDraw/include/Instancing.hpp" + +#include "prx/libSceAgc/Command/include/Packet.hpp" +#include +#include +#include "SceTypes.hpp" +#include "prx/libc/include/General.hpp" + +extern "C" { + +std::uint32_t* APS5_VABI sceAgcDcbSetNumInstances(CommandBuffer* buf, std::uint32_t numInstances) { + return Agc::Command::Emit(buf, 0x2fu, {numInstances}, __func__); +} + +std::uint32_t APS5_VABI sceAgcDcbSetNumInstancesGetSize() { + return 8; +} + +uint32_t* APS5_VABI sceAgcDcbSetBaseIndirectArgs(CommandBuffer* buf, uint32_t shader_type, const volatile void* indirect_base_addr) { + (void)buf; + (void)shader_type; + (void)indirect_base_addr; + NotImplemented_nid_no_patch(__func__); + return nullptr; +} + +} diff --git a/core/libs/prx/libSceAgc/DcbDraw/src/Stats.cpp b/core/libs/prx/libSceAgc/DcbDraw/src/Stats.cpp new file mode 100644 index 000000000..5b062c78a --- /dev/null +++ b/core/libs/prx/libSceAgc/DcbDraw/src/Stats.cpp @@ -0,0 +1,23 @@ +#include "prx/libSceAgc/DcbDraw/include/Stats.hpp" + +#include "prx/libSceAgc/Command/include/Packet.hpp" +#include +#include +#include "SceTypes.hpp" +#include "prx/libc/include/General.hpp" + +extern "C" { + +std::uint32_t* APS5_VABI sceAgcDcbGetLodStats(CommandBuffer* buf, std::uint8_t cachePolicy, const volatile void* buffer, std::uint32_t bufferSizeInBytes, std::uint32_t resetCount, std::uint8_t forceReset, std::uint8_t reportAndReset, std::uint32_t reportingIntervalIn100kClocks) { + Agc::Command::CheckBits(cachePolicy, 3, __func__); + Agc::Command::CheckBits(resetCount, 0xffu, __func__); + Agc::Command::CheckBits(forceReset, 1, __func__); + Agc::Command::CheckBits(reportAndReset, 1, __func__); + Agc::Command::CheckBits(reportingIntervalIn100kClocks, 0xffu, __func__); + const auto address = reinterpret_cast(buffer); + Agc::Command::CheckAddress(address, 64, __func__); + const auto control = (static_cast(cachePolicy) << 28u) | (static_cast(reportAndReset) << 19u) | (static_cast(forceReset) << 18u) | (resetCount << 10u) | (reportingIntervalIn100kClocks << 2u); + return Agc::Command::Emit(buf, 0x8eu, {bufferSizeInBytes, static_cast(address), static_cast(address >> 32u), control}, __func__); +} + +} diff --git a/core/libs/prx/libSceAgc/DcbFlow/Export.cpp b/core/libs/prx/libSceAgc/DcbFlow/Export.cpp deleted file mode 100644 index 33ee7999e..000000000 --- a/core/libs/prx/libSceAgc/DcbFlow/Export.cpp +++ /dev/null @@ -1,171 +0,0 @@ -#include "prx/libSceAgc/Command/Memory.hpp" -#include "prx/libSceAgc/Command/Packet.hpp" -#include -#include -#include "SceTypes.hpp" -#include "prx/libc/include/General.hpp" -#include "shader/recompilier/Recompiler.hpp" - -extern "C" { - -uint32_t* APS5_VABI sceAgcDcbAcquireMem(CommandBuffer* buf, uint8_t engine, uint32_t cb_db_op, uint32_t gcr_cntl, const volatile void* base, uint64_t size_bytes, uint32_t poll_cycles) { - (void)buf; - (void)engine; - (void)cb_db_op; - (void)gcr_cntl; - (void)base; - (void)size_bytes; - (void)poll_cycles; - NotImplemented_nid_no_patch(__func__); - return nullptr; -} - -uint32_t APS5_VABI sceAgcDcbAcquireMemGetSize(void) { - NotImplemented_nid_no_patch(__func__); - return 0; -} - -uint32_t* APS5_VABI sceAgcDcbCondExec(CommandBuffer* buf, const volatile uint32_t* address, uint32_t num_dwords) { - (void)buf; - (void)address; - (void)num_dwords; - NotImplemented_nid_no_patch(__func__); - return nullptr; -} - -uint32_t APS5_VABI sceAgcDcbCondExecGetSize(void) { - NotImplemented_nid_no_patch(__func__); - return 0; -} - -uint32_t* APS5_VABI sceAgcDcbCopyData(CommandBuffer* buf, uint8_t dst, uint8_t dst_cache_policy, uint64_t dst_address, uint8_t src, uint8_t src_cache_policy, uint64_t src_address_or_immediate, uint8_t item_size, uint8_t write_confirm) { - (void)buf; - (void)dst; - (void)dst_cache_policy; - (void)dst_address; - (void)src; - (void)src_cache_policy; - (void)src_address_or_immediate; - (void)item_size; - (void)write_confirm; - NotImplemented_nid_no_patch(__func__); - return nullptr; -} - -std::uint32_t* APS5_VABI sceAgcDcbDmaData(CommandBuffer* buf, std::uint8_t engine, std::uint8_t dst, std::uint8_t dstCachePolicy, std::uint64_t dstAddress, std::uint8_t src, std::uint8_t srcCachePolicy, std::uint64_t srcAddress, std::uint32_t numBytes, std::uint8_t waitForPrevious, std::uint8_t writeConfirm, std::uint8_t blockEngine) { - return Agc::Command::WriteDma(buf, false, engine, dst, dstCachePolicy, dstAddress, src, srcCachePolicy, srcAddress, numBytes, waitForPrevious, writeConfirm, blockEngine, __func__); -} - -uint32_t* APS5_VABI sceAgcDcbDispatchIndirect(CommandBuffer* buf, uint32_t data_offset_in_bytes, uint32_t flags) { - (void)buf; - (void)data_offset_in_bytes; - (void)flags; - NotImplemented_nid_no_patch(__func__); - return nullptr; -} - -uint32_t APS5_VABI sceAgcDcbDispatchIndirectGetSize(void) { - NotImplemented_nid_no_patch(__func__); - return 0; -} - -std::uint32_t* APS5_VABI sceAgcDcbEventWrite(CommandBuffer* buf, std::uint8_t eventType, const volatile void* address) { - Agc::Command::CheckBits(eventType, 0x3fu, __func__); - if ((eventType & 0xfeu) == 0x38u) { - const auto guestAddress = reinterpret_cast(address); - Agc::Command::CheckAddress(guestAddress, 8, __func__); - return Agc::Command::Emit(buf, 0x46u, {0x100u | eventType, static_cast(guestAddress), static_cast(guestAddress >> 32u)}, __func__); - } - Agc::Command::Require(address == nullptr, __func__, "this event does not use an address"); - const auto eventIndex = eventType == 7 || eventType == 15 || eventType == 16 ? 0x400u : 0u; - return Agc::Command::Emit(buf, 0x46u, {eventIndex | eventType}, __func__); -} - -uint32_t* APS5_VABI sceAgcDcbJump(CommandBuffer* buf, uint8_t mode, uint8_t cache_policy, const uint32_t* target, uint32_t size_in_dwords) { - (void)buf; - (void)mode; - (void)cache_policy; - (void)target; - (void)size_in_dwords; - NotImplemented_nid_no_patch(__func__); - return nullptr; -} - -uint32_t APS5_VABI sceAgcDcbJumpGetSize(void) { - NotImplemented_nid_no_patch(__func__); - return 0; -} - -uint32_t* APS5_VABI sceAgcDcbResetQueue(CommandBuffer* buf, uint32_t op, uint32_t state) { - (void)buf; - (void)op; - (void)state; - const std::array code = {0xbf810000u}; - const std::array capabilities = {1u}; - const std::array shaderRegisters = {{{0x207u, 1u}, {0x208u, 1u}, {0x209u, 1u}}}; - const std::array memory = {{{0x10000u, std::as_bytes(std::span(code))}}}; - const ShaderRecompiler::RecompileRequest request{ - {ShaderRecompiler::ShaderStage::Compute, 0x10000u, code, 0, {}}, - {64, 0, {}, shaderRegisters, {}, {}, memory}, - {0x00403000u, 0x00010600u, 64, capabilities, {}, {1024, 1024, 64}, 1024, 32768}, - {0, 0, 0, 0} - }; - (void)ShaderRecompiler::Recompile(request); - return nullptr; -} - -uint32_t* APS5_VABI sceAgcDcbRewind(CommandBuffer* buf, uint32_t initial_state) { - (void)buf; - (void)initial_state; - NotImplemented_nid_no_patch(__func__); - return nullptr; -} - -uint32_t APS5_VABI sceAgcDcbRewindGetSize(void) { - NotImplemented_nid_no_patch(__func__); - return 0; -} - -std::uint32_t* APS5_VABI sceAgcDcbStallCommandBufferParser(CommandBuffer* buf) { - return Agc::Command::Emit(buf, 0x42u, {0}, __func__); -} - -std::uint32_t* APS5_VABI sceAgcDcbWaitRegMem(CommandBuffer* buf, std::uint8_t size, std::uint8_t compareFunction, std::uint8_t operation, std::uint8_t cachePolicy, const volatile void* address, std::uint64_t reference, std::uint64_t mask, std::uint32_t pollCycles) { - return Agc::Command::WriteWait(buf, size, compareFunction, operation, cachePolicy, address, reference, mask, pollCycles, __func__); -} - -uint32_t APS5_VABI sceAgcDcbWaitOnAddressGetSize(uint32_t size) { - (void)size; - NotImplemented_nid_no_patch(__func__); - return 0; -} - -uint32_t* APS5_VABI sceAgcDcbWaitUntilSafeForRendering(CommandBuffer* buf, uint32_t video_out_handle, uint32_t display_buffer_index) { - (void)buf; - (void)video_out_handle; - (void)display_buffer_index; - NotImplemented_nid_no_patch(__func__); - return nullptr; -} - -std::uint32_t* APS5_VABI sceAgcDcbWriteData(CommandBuffer* buf, std::uint8_t dst, std::uint8_t cachePolicy, std::uint64_t address, const void* data, std::uint32_t numDwords, std::uint8_t increment, std::uint8_t writeConfirm) { - return Agc::Command::WriteData(buf, false, dst, cachePolicy, address, data, numDwords, increment, writeConfirm, __func__); -} - -uint32_t APS5_VABI sceAgcDcbWriteDataGetSize(uint32_t num_dwords) { - (void)num_dwords; - NotImplemented_nid_no_patch(__func__); - return 0; -} -std::uint64_t APS5_VABI sceAgcDcbEventWriteGetSize(std::uint8_t eventType) { - (void)eventType; - NotImplemented_nid_no_patch(__func__); - return 0; -} - -std::uint64_t APS5_VABI sceAgcDcbCopyDataGetSize() { - NotImplemented_nid_no_patch(__func__); - return 0; -} - -} diff --git a/core/libs/prx/libSceAgc/DcbFlow/include/Control.hpp b/core/libs/prx/libSceAgc/DcbFlow/include/Control.hpp new file mode 100644 index 000000000..46c70ed15 --- /dev/null +++ b/core/libs/prx/libSceAgc/DcbFlow/include/Control.hpp @@ -0,0 +1,4 @@ +#ifndef CORE_LIBS_PRX_LIBSCEAGC_DCBFLOW_INCLUDE_CONTROL_HPP +#define CORE_LIBS_PRX_LIBSCEAGC_DCBFLOW_INCLUDE_CONTROL_HPP + +#endif diff --git a/core/libs/prx/libSceAgc/DcbFlow/include/Dispatch.hpp b/core/libs/prx/libSceAgc/DcbFlow/include/Dispatch.hpp new file mode 100644 index 000000000..025f84ad5 --- /dev/null +++ b/core/libs/prx/libSceAgc/DcbFlow/include/Dispatch.hpp @@ -0,0 +1,4 @@ +#ifndef CORE_LIBS_PRX_LIBSCEAGC_DCBFLOW_INCLUDE_DISPATCH_HPP +#define CORE_LIBS_PRX_LIBSCEAGC_DCBFLOW_INCLUDE_DISPATCH_HPP + +#endif diff --git a/core/libs/prx/libSceAgc/DcbFlow/include/Memory.hpp b/core/libs/prx/libSceAgc/DcbFlow/include/Memory.hpp new file mode 100644 index 000000000..3137a5cc9 --- /dev/null +++ b/core/libs/prx/libSceAgc/DcbFlow/include/Memory.hpp @@ -0,0 +1,4 @@ +#ifndef CORE_LIBS_PRX_LIBSCEAGC_DCBFLOW_INCLUDE_MEMORY_HPP +#define CORE_LIBS_PRX_LIBSCEAGC_DCBFLOW_INCLUDE_MEMORY_HPP + +#endif diff --git a/core/libs/prx/libSceAgc/DcbFlow/include/Sync.hpp b/core/libs/prx/libSceAgc/DcbFlow/include/Sync.hpp new file mode 100644 index 000000000..8f5517adc --- /dev/null +++ b/core/libs/prx/libSceAgc/DcbFlow/include/Sync.hpp @@ -0,0 +1,4 @@ +#ifndef CORE_LIBS_PRX_LIBSCEAGC_DCBFLOW_INCLUDE_SYNC_HPP +#define CORE_LIBS_PRX_LIBSCEAGC_DCBFLOW_INCLUDE_SYNC_HPP + +#endif diff --git a/core/libs/prx/libSceAgc/DcbFlow/src/Control.cpp b/core/libs/prx/libSceAgc/DcbFlow/src/Control.cpp new file mode 100644 index 000000000..028ca26bb --- /dev/null +++ b/core/libs/prx/libSceAgc/DcbFlow/src/Control.cpp @@ -0,0 +1,66 @@ +#include "prx/libSceAgc/DcbFlow/include/Control.hpp" + +#include "prx/libSceAgc/Command/include/Memory.hpp" +#include "prx/libSceAgc/Command/include/Packet.hpp" +#include +#include +#include "SceTypes.hpp" +#include "prx/libc/include/General.hpp" +#include "shader/recompilier/Recompiler.hpp" + +extern "C" { + +uint32_t* APS5_VABI sceAgcDcbJump(CommandBuffer* buf, uint8_t mode, uint8_t cache_policy, const uint32_t* target, uint32_t size_in_dwords) { + (void)buf; + (void)mode; + (void)cache_policy; + (void)target; + (void)size_in_dwords; + NotImplemented_nid_no_patch(__func__); + return nullptr; +} + +uint32_t APS5_VABI sceAgcDcbJumpGetSize(void) { + NotImplemented_nid_no_patch(__func__); + return 0; +} + +uint32_t* APS5_VABI sceAgcDcbResetQueue(CommandBuffer* buf, uint32_t op, uint32_t state) { + (void)buf; + (void)op; + (void)state; + const std::array code = {0xbf810000u}; + const std::array capabilities = {1u}; + const std::array shaderRegisters = {{{0x207u, 1u}, {0x208u, 1u}, {0x209u, 1u}}}; + const std::array memory = {{{0x10000u, std::as_bytes(std::span(code))}}}; + const ShaderRecompiler::RecompileRequest request{ + {ShaderRecompiler::ShaderStage::Compute, 0x10000u, code, 0, {}}, + {64, 0, {}, shaderRegisters, {}, {}, memory}, + {0x00403000u, 0x00010600u, 64, capabilities, {}, {1024, 1024, 64}, 1024, 32768}, + {0, 0, 0, 0} + }; + (void)ShaderRecompiler::Recompile(request); + return nullptr; +} + +uint32_t* APS5_VABI sceAgcDcbRewind(CommandBuffer* buf, uint32_t initial_state) { + (void)buf; + (void)initial_state; + NotImplemented_nid_no_patch(__func__); + return nullptr; +} + +uint32_t APS5_VABI sceAgcDcbRewindGetSize(void) { + NotImplemented_nid_no_patch(__func__); + return 0; +} + +uint32_t* APS5_VABI sceAgcDcbWaitUntilSafeForRendering(CommandBuffer* buf, uint32_t video_out_handle, uint32_t display_buffer_index) { + (void)buf; + (void)video_out_handle; + (void)display_buffer_index; + NotImplemented_nid_no_patch(__func__); + return nullptr; +} + +} diff --git a/core/libs/prx/libSceAgc/DcbFlow/src/Dispatch.cpp b/core/libs/prx/libSceAgc/DcbFlow/src/Dispatch.cpp new file mode 100644 index 000000000..abde2b1bd --- /dev/null +++ b/core/libs/prx/libSceAgc/DcbFlow/src/Dispatch.cpp @@ -0,0 +1,26 @@ +#include "prx/libSceAgc/DcbFlow/include/Dispatch.hpp" + +#include "prx/libSceAgc/Command/include/Memory.hpp" +#include "prx/libSceAgc/Command/include/Packet.hpp" +#include +#include +#include "SceTypes.hpp" +#include "prx/libc/include/General.hpp" +#include "shader/recompilier/Recompiler.hpp" + +extern "C" { + +uint32_t* APS5_VABI sceAgcDcbDispatchIndirect(CommandBuffer* buf, uint32_t data_offset_in_bytes, uint32_t flags) { + (void)buf; + (void)data_offset_in_bytes; + (void)flags; + NotImplemented_nid_no_patch(__func__); + return nullptr; +} + +uint32_t APS5_VABI sceAgcDcbDispatchIndirectGetSize(void) { + NotImplemented_nid_no_patch(__func__); + return 0; +} + +} diff --git a/core/libs/prx/libSceAgc/DcbFlow/src/Memory.cpp b/core/libs/prx/libSceAgc/DcbFlow/src/Memory.cpp new file mode 100644 index 000000000..776b8364e --- /dev/null +++ b/core/libs/prx/libSceAgc/DcbFlow/src/Memory.cpp @@ -0,0 +1,63 @@ +#include "prx/libSceAgc/DcbFlow/include/Memory.hpp" + +#include "prx/libSceAgc/Command/include/Memory.hpp" +#include "prx/libSceAgc/Command/include/Packet.hpp" +#include +#include +#include "SceTypes.hpp" +#include "prx/libc/include/General.hpp" +#include "shader/recompilier/Recompiler.hpp" + +extern "C" { + +uint32_t* APS5_VABI sceAgcDcbAcquireMem(CommandBuffer* buf, uint8_t engine, uint32_t cb_db_op, uint32_t gcr_cntl, const volatile void* base, uint64_t size_bytes, uint32_t poll_cycles) { + (void)buf; + (void)engine; + (void)cb_db_op; + (void)gcr_cntl; + (void)base; + (void)size_bytes; + (void)poll_cycles; + NotImplemented_nid_no_patch(__func__); + return nullptr; +} + +uint32_t APS5_VABI sceAgcDcbAcquireMemGetSize(void) { + NotImplemented_nid_no_patch(__func__); + return 0; +} + +uint32_t* APS5_VABI sceAgcDcbCopyData(CommandBuffer* buf, uint8_t dst, uint8_t dst_cache_policy, uint64_t dst_address, uint8_t src, uint8_t src_cache_policy, uint64_t src_address_or_immediate, uint8_t item_size, uint8_t write_confirm) { + (void)buf; + (void)dst; + (void)dst_cache_policy; + (void)dst_address; + (void)src; + (void)src_cache_policy; + (void)src_address_or_immediate; + (void)item_size; + (void)write_confirm; + NotImplemented_nid_no_patch(__func__); + return nullptr; +} + +std::uint64_t APS5_VABI sceAgcDcbCopyDataGetSize() { + NotImplemented_nid_no_patch(__func__); + return 0; +} + +std::uint32_t* APS5_VABI sceAgcDcbDmaData(CommandBuffer* buf, std::uint8_t engine, std::uint8_t dst, std::uint8_t dstCachePolicy, std::uint64_t dstAddress, std::uint8_t src, std::uint8_t srcCachePolicy, std::uint64_t srcAddress, std::uint32_t numBytes, std::uint8_t waitForPrevious, std::uint8_t writeConfirm, std::uint8_t blockEngine) { + return Agc::Command::WriteDma(buf, false, engine, dst, dstCachePolicy, dstAddress, src, srcCachePolicy, srcAddress, numBytes, waitForPrevious, writeConfirm, blockEngine, __func__); +} + +std::uint32_t* APS5_VABI sceAgcDcbWriteData(CommandBuffer* buf, std::uint8_t dst, std::uint8_t cachePolicy, std::uint64_t address, const void* data, std::uint32_t numDwords, std::uint8_t increment, std::uint8_t writeConfirm) { + return Agc::Command::WriteData(buf, false, dst, cachePolicy, address, data, numDwords, increment, writeConfirm, __func__); +} + +uint32_t APS5_VABI sceAgcDcbWriteDataGetSize(uint32_t num_dwords) { + (void)num_dwords; + NotImplemented_nid_no_patch(__func__); + return 0; +} + +} diff --git a/core/libs/prx/libSceAgc/DcbFlow/src/Sync.cpp b/core/libs/prx/libSceAgc/DcbFlow/src/Sync.cpp new file mode 100644 index 000000000..389cce2e8 --- /dev/null +++ b/core/libs/prx/libSceAgc/DcbFlow/src/Sync.cpp @@ -0,0 +1,58 @@ +#include "prx/libSceAgc/DcbFlow/include/Sync.hpp" + +#include "prx/libSceAgc/Command/include/Memory.hpp" +#include "prx/libSceAgc/Command/include/Packet.hpp" +#include +#include +#include "SceTypes.hpp" +#include "prx/libc/include/General.hpp" +#include "shader/recompilier/Recompiler.hpp" + +extern "C" { + +uint32_t* APS5_VABI sceAgcDcbCondExec(CommandBuffer* buf, const volatile uint32_t* address, uint32_t num_dwords) { + (void)buf; + (void)address; + (void)num_dwords; + NotImplemented_nid_no_patch(__func__); + return nullptr; +} + +uint32_t APS5_VABI sceAgcDcbCondExecGetSize(void) { + NotImplemented_nid_no_patch(__func__); + return 0; +} + +std::uint32_t* APS5_VABI sceAgcDcbWaitRegMem(CommandBuffer* buf, std::uint8_t size, std::uint8_t compareFunction, std::uint8_t operation, std::uint8_t cachePolicy, const volatile void* address, std::uint64_t reference, std::uint64_t mask, std::uint32_t pollCycles) { + return Agc::Command::WriteWait(buf, size, compareFunction, operation, cachePolicy, address, reference, mask, pollCycles, __func__); +} + +uint32_t APS5_VABI sceAgcDcbWaitOnAddressGetSize(uint32_t size) { + (void)size; + NotImplemented_nid_no_patch(__func__); + return 0; +} + +std::uint32_t* APS5_VABI sceAgcDcbEventWrite(CommandBuffer* buf, std::uint8_t eventType, const volatile void* address) { + Agc::Command::CheckBits(eventType, 0x3fu, __func__); + if ((eventType & 0xfeu) == 0x38u) { + const auto guestAddress = reinterpret_cast(address); + Agc::Command::CheckAddress(guestAddress, 8, __func__); + return Agc::Command::Emit(buf, 0x46u, {0x100u | eventType, static_cast(guestAddress), static_cast(guestAddress >> 32u)}, __func__); + } + Agc::Command::Require(address == nullptr, __func__, "this event does not use an address"); + const auto eventIndex = eventType == 7 || eventType == 15 || eventType == 16 ? 0x400u : 0u; + return Agc::Command::Emit(buf, 0x46u, {eventIndex | eventType}, __func__); +} + +std::uint64_t APS5_VABI sceAgcDcbEventWriteGetSize(std::uint8_t eventType) { + (void)eventType; + NotImplemented_nid_no_patch(__func__); + return 0; +} + +std::uint32_t* APS5_VABI sceAgcDcbStallCommandBufferParser(CommandBuffer* buf) { + return Agc::Command::Emit(buf, 0x42u, {0}, __func__); +} + +} diff --git a/core/libs/prx/libSceAgc/DcbState/Export.cpp b/core/libs/prx/libSceAgc/DcbState/Export.cpp deleted file mode 100644 index 0468f7b45..000000000 --- a/core/libs/prx/libSceAgc/DcbState/Export.cpp +++ /dev/null @@ -1,169 +0,0 @@ -#include "prx/libSceAgc/Command/Packet.hpp" -#include -#include -#include "SceTypes.hpp" -#include "prx/libc/include/General.hpp" - -extern "C" { - -uint32_t* APS5_VABI sceAgcDcbSetCxRegisterDirect(CommandBuffer* buf, ShaderRegister reg) { - (void)buf; - (void)reg; - NotImplemented_nid_no_patch(__func__); - return nullptr; -} - -uint32_t APS5_VABI sceAgcDcbSetBaseDispatchIndirectArgsGetSize() { - NotImplemented_nid_no_patch(__func__); - return 0; -} - -uint32_t APS5_VABI sceAgcDcbQueueEndOfShaderActionGetSize() { - NotImplemented_nid_no_patch(__func__); - return 0; -} - -std::uint32_t APS5_VABI sceAgcDcbGetLodStatsGetSize() { - return 20; -} - -std::uint32_t APS5_VABI sceAgcDcbSetShRegistersIndirectGetSize(std::uint32_t numRegs) { - Agc::Command::CheckBits(numRegs, 0x3fffu, __func__); - return 20; -} - -uint32_t APS5_VABI sceAgcDcbSetBaseDrawIndirectArgsGetSize() { - NotImplemented_nid_no_patch(__func__); - return 0; -} - -uint64_t APS5_VABI sceAgcDcbContextStateOpGetSize(uint32_t operation) { - (void)operation; - NotImplemented_nid_no_patch(__func__); - return 0; -} - -uint32_t APS5_VABI sceAgcDcbSetCxRegisterDirectGetSize(void) { - NotImplemented_nid_no_patch(__func__); - return 0; -} - -std::uint32_t* APS5_VABI sceAgcDcbSetCxRegistersIndirect(CommandBuffer* buf, const volatile ShaderRegister* regs, std::uint32_t numRegs) { - return Agc::Command::WriteIndirectRegisters(buf, 0x9fu, regs, numRegs, __func__); -} - -uint32_t* APS5_VABI sceAgcDcbSetShRegisterDirect(CommandBuffer* buf, ShaderRegister reg) { - (void)buf; - (void)reg; - NotImplemented_nid_no_patch(__func__); - return nullptr; -} - -std::uint32_t* APS5_VABI sceAgcDcbSetShRegistersIndirect(CommandBuffer* buf, const volatile ShaderRegister* regs, std::uint32_t numRegs) { - return Agc::Command::WriteIndirectRegisters(buf, 0x63u, regs, numRegs, __func__); -} - -uint32_t* APS5_VABI sceAgcDcbSetUcRegisterDirect(CommandBuffer* buf, ShaderRegister reg) { - (void)buf; - (void)reg; - NotImplemented_nid_no_patch(__func__); - return nullptr; -} - -std::uint32_t* APS5_VABI sceAgcDcbSetUcRegistersIndirect(CommandBuffer* buf, const volatile ShaderRegister* regs, std::uint32_t numRegs) { - return Agc::Command::WriteIndirectRegisters(buf, 0x64u, regs, numRegs, __func__); -} - -uint32_t* APS5_VABI sceAgcDcbContextStateOp(CommandBuffer* buf, uint32_t operation) { - (void)buf; - (void)operation; - NotImplemented_nid_no_patch(__func__); - return nullptr; -} - -uint32_t* APS5_VABI sceAgcDcbSetFlip(CommandBuffer* buf, uint32_t video_out_handle, int32_t display_buffer_index, uint32_t flip_mode, int64_t flip_arg) { - (void)buf; - (void)video_out_handle; - (void)display_buffer_index; - (void)flip_mode; - (void)flip_arg; - NotImplemented_nid_no_patch(__func__); - return nullptr; -} - -APS5_EXPORT("23LRUSvYu1M", sceAgcInit); -int APS5_VABI sceAgcInit(uint32_t* state, uint32_t ver) { - (void)state; - (void)ver; - NotImplemented_nid_no_patch(__func__); - return 0; -} - - -APS5_EXPORT("qj7QZpgr9Uw", sceAgcDcbContextStateAnotherOp); -uint32_t* APS5_VABI sceAgcDcbContextStateAnotherOp(CommandBuffer* buf, uint32_t operation) { - (void)buf; - (void)operation; - NotImplemented_nid_no_patch(__func__); - return nullptr; -} - -// unconfirmed signature -uint32_t* APS5_VABI sceAgcDcbPrimeUtcl2(CommandBuffer* buf, const volatile void* address, uint32_t size_in_bytes) { - (void)buf; - (void)address; - (void)size_in_bytes; - NotImplemented_nid_no_patch(__func__); - return nullptr; -} - -uint32_t* APS5_VABI sceAgcDcbSetPredication(CommandBuffer* buf, uint8_t condition, uint8_t op, uint8_t wait_op, const volatile void* address, uint32_t count_in_dwords) { - (void)buf; - (void)condition; - (void)op; - (void)wait_op; - (void)address; - (void)count_in_dwords; - NotImplemented_nid_no_patch(__func__); - return nullptr; -} - -uint32_t* APS5_VABI sceAgcDcbSetMarker(CommandBuffer* buf, const char* str, uint32_t color) { - (void)buf; - (void)str; - (void)color; - NotImplemented_nid_no_patch(__func__); - return nullptr; -} - -uint32_t* APS5_VABI sceAgcDcbPopMarker(CommandBuffer* buf) { - (void)buf; - NotImplemented_nid_no_patch(__func__); - return nullptr; -} - -uint32_t* APS5_VABI sceAgcDcbPushMarker(CommandBuffer* buf, const char* str, uint32_t color) { - (void)buf; - (void)str; - (void)color; - NotImplemented_nid_no_patch(__func__); - return nullptr; -} - -uint32_t* APS5_VABI sceAgcDcbSetWorkloadComplete(CommandBuffer* buf, uint32_t stream_id, uint32_t workload_id) { - (void)buf; - (void)stream_id; - (void)workload_id; - NotImplemented_nid_no_patch(__func__); - return nullptr; -} - -uint32_t* APS5_VABI sceAgcDcbSetWorkloadsActive(CommandBuffer* buf, uint32_t stream_id, const uint32_t* workload_ids, uint32_t workload_count) { - (void)buf; - (void)stream_id; - (void)workload_ids; - (void)workload_count; - NotImplemented_nid_no_patch(__func__); - return nullptr; -} -} diff --git a/core/libs/prx/libSceAgc/DcbState/include/ContextState.hpp b/core/libs/prx/libSceAgc/DcbState/include/ContextState.hpp new file mode 100644 index 000000000..409da75f3 --- /dev/null +++ b/core/libs/prx/libSceAgc/DcbState/include/ContextState.hpp @@ -0,0 +1,4 @@ +#ifndef CORE_LIBS_PRX_LIBSCEAGC_DCBSTATE_INCLUDE_CONTEXTSTATE_HPP +#define CORE_LIBS_PRX_LIBSCEAGC_DCBSTATE_INCLUDE_CONTEXTSTATE_HPP + +#endif diff --git a/core/libs/prx/libSceAgc/DcbState/include/Display.hpp b/core/libs/prx/libSceAgc/DcbState/include/Display.hpp new file mode 100644 index 000000000..74fb8caf0 --- /dev/null +++ b/core/libs/prx/libSceAgc/DcbState/include/Display.hpp @@ -0,0 +1,4 @@ +#ifndef CORE_LIBS_PRX_LIBSCEAGC_DCBSTATE_INCLUDE_DISPLAY_HPP +#define CORE_LIBS_PRX_LIBSCEAGC_DCBSTATE_INCLUDE_DISPLAY_HPP + +#endif diff --git a/core/libs/prx/libSceAgc/DcbState/include/Init.hpp b/core/libs/prx/libSceAgc/DcbState/include/Init.hpp new file mode 100644 index 000000000..de641fea3 --- /dev/null +++ b/core/libs/prx/libSceAgc/DcbState/include/Init.hpp @@ -0,0 +1,4 @@ +#ifndef CORE_LIBS_PRX_LIBSCEAGC_DCBSTATE_INCLUDE_INIT_HPP +#define CORE_LIBS_PRX_LIBSCEAGC_DCBSTATE_INCLUDE_INIT_HPP + +#endif diff --git a/core/libs/prx/libSceAgc/DcbState/include/Marker.hpp b/core/libs/prx/libSceAgc/DcbState/include/Marker.hpp new file mode 100644 index 000000000..d974b008a --- /dev/null +++ b/core/libs/prx/libSceAgc/DcbState/include/Marker.hpp @@ -0,0 +1,4 @@ +#ifndef CORE_LIBS_PRX_LIBSCEAGC_DCBSTATE_INCLUDE_MARKER_HPP +#define CORE_LIBS_PRX_LIBSCEAGC_DCBSTATE_INCLUDE_MARKER_HPP + +#endif diff --git a/core/libs/prx/libSceAgc/DcbState/include/Predication.hpp b/core/libs/prx/libSceAgc/DcbState/include/Predication.hpp new file mode 100644 index 000000000..65f64a14e --- /dev/null +++ b/core/libs/prx/libSceAgc/DcbState/include/Predication.hpp @@ -0,0 +1,4 @@ +#ifndef CORE_LIBS_PRX_LIBSCEAGC_DCBSTATE_INCLUDE_PREDICATION_HPP +#define CORE_LIBS_PRX_LIBSCEAGC_DCBSTATE_INCLUDE_PREDICATION_HPP + +#endif diff --git a/core/libs/prx/libSceAgc/DcbState/include/Registers.hpp b/core/libs/prx/libSceAgc/DcbState/include/Registers.hpp new file mode 100644 index 000000000..b7beea149 --- /dev/null +++ b/core/libs/prx/libSceAgc/DcbState/include/Registers.hpp @@ -0,0 +1,4 @@ +#ifndef CORE_LIBS_PRX_LIBSCEAGC_DCBSTATE_INCLUDE_REGISTERS_HPP +#define CORE_LIBS_PRX_LIBSCEAGC_DCBSTATE_INCLUDE_REGISTERS_HPP + +#endif diff --git a/core/libs/prx/libSceAgc/DcbState/include/Workload.hpp b/core/libs/prx/libSceAgc/DcbState/include/Workload.hpp new file mode 100644 index 000000000..3d5d6cac7 --- /dev/null +++ b/core/libs/prx/libSceAgc/DcbState/include/Workload.hpp @@ -0,0 +1,4 @@ +#ifndef CORE_LIBS_PRX_LIBSCEAGC_DCBSTATE_INCLUDE_WORKLOAD_HPP +#define CORE_LIBS_PRX_LIBSCEAGC_DCBSTATE_INCLUDE_WORKLOAD_HPP + +#endif diff --git a/core/libs/prx/libSceAgc/DcbState/src/ContextState.cpp b/core/libs/prx/libSceAgc/DcbState/src/ContextState.cpp new file mode 100644 index 000000000..839760dc5 --- /dev/null +++ b/core/libs/prx/libSceAgc/DcbState/src/ContextState.cpp @@ -0,0 +1,51 @@ +#include "prx/libSceAgc/DcbState/include/ContextState.hpp" + +#include "prx/libSceAgc/Command/include/Packet.hpp" +#include +#include +#include "SceTypes.hpp" +#include "prx/libc/include/General.hpp" + +extern "C" { + +uint32_t* APS5_VABI sceAgcDcbContextStateOp(CommandBuffer* buf, uint32_t operation) { + (void)buf; + (void)operation; + NotImplemented_nid_no_patch(__func__); + return nullptr; +} + +uint64_t APS5_VABI sceAgcDcbContextStateOpGetSize(uint32_t operation) { + (void)operation; + NotImplemented_nid_no_patch(__func__); + return 0; +} + +APS5_EXPORT("qj7QZpgr9Uw", sceAgcDcbContextStateAnotherOp); +uint32_t* APS5_VABI sceAgcDcbContextStateAnotherOp(CommandBuffer* buf, uint32_t operation) { + (void)buf; + (void)operation; + NotImplemented_nid_no_patch(__func__); + return nullptr; +} + +uint32_t APS5_VABI sceAgcDcbSetBaseDispatchIndirectArgsGetSize() { + NotImplemented_nid_no_patch(__func__); + return 0; +} + +uint32_t APS5_VABI sceAgcDcbSetBaseDrawIndirectArgsGetSize() { + NotImplemented_nid_no_patch(__func__); + return 0; +} + +uint32_t APS5_VABI sceAgcDcbQueueEndOfShaderActionGetSize() { + NotImplemented_nid_no_patch(__func__); + return 0; +} + +std::uint32_t APS5_VABI sceAgcDcbGetLodStatsGetSize() { + return 20; +} + +} diff --git a/core/libs/prx/libSceAgc/DcbState/src/Display.cpp b/core/libs/prx/libSceAgc/DcbState/src/Display.cpp new file mode 100644 index 000000000..82eb7479f --- /dev/null +++ b/core/libs/prx/libSceAgc/DcbState/src/Display.cpp @@ -0,0 +1,29 @@ +#include "prx/libSceAgc/DcbState/include/Display.hpp" + +#include "prx/libSceAgc/Command/include/Packet.hpp" +#include +#include +#include "SceTypes.hpp" +#include "prx/libc/include/General.hpp" + +extern "C" { + +uint32_t* APS5_VABI sceAgcDcbSetFlip(CommandBuffer* buf, uint32_t video_out_handle, int32_t display_buffer_index, uint32_t flip_mode, int64_t flip_arg) { + (void)buf; + (void)video_out_handle; + (void)display_buffer_index; + (void)flip_mode; + (void)flip_arg; + NotImplemented_nid_no_patch(__func__); + return nullptr; +} + +uint32_t* APS5_VABI sceAgcDcbPrimeUtcl2(CommandBuffer* buf, const volatile void* address, uint32_t size_in_bytes) { + (void)buf; + (void)address; + (void)size_in_bytes; + NotImplemented_nid_no_patch(__func__); + return nullptr; +} + +} diff --git a/core/libs/prx/libSceAgc/DcbState/src/Init.cpp b/core/libs/prx/libSceAgc/DcbState/src/Init.cpp new file mode 100644 index 000000000..da372b02a --- /dev/null +++ b/core/libs/prx/libSceAgc/DcbState/src/Init.cpp @@ -0,0 +1,19 @@ +#include "prx/libSceAgc/DcbState/include/Init.hpp" + +#include "prx/libSceAgc/Command/include/Packet.hpp" +#include +#include +#include "SceTypes.hpp" +#include "prx/libc/include/General.hpp" + +extern "C" { + +APS5_EXPORT("23LRUSvYu1M", sceAgcInit); +int APS5_VABI sceAgcInit(uint32_t* state, uint32_t ver) { + (void)state; + (void)ver; + NotImplemented_nid_no_patch(__func__); + return 0; +} + +} diff --git a/core/libs/prx/libSceAgc/DcbState/src/Marker.cpp b/core/libs/prx/libSceAgc/DcbState/src/Marker.cpp new file mode 100644 index 000000000..d2d66306c --- /dev/null +++ b/core/libs/prx/libSceAgc/DcbState/src/Marker.cpp @@ -0,0 +1,33 @@ +#include "prx/libSceAgc/DcbState/include/Marker.hpp" + +#include "prx/libSceAgc/Command/include/Packet.hpp" +#include +#include +#include "SceTypes.hpp" +#include "prx/libc/include/General.hpp" + +extern "C" { + +uint32_t* APS5_VABI sceAgcDcbSetMarker(CommandBuffer* buf, const char* str, uint32_t color) { + (void)buf; + (void)str; + (void)color; + NotImplemented_nid_no_patch(__func__); + return nullptr; +} + +uint32_t* APS5_VABI sceAgcDcbPopMarker(CommandBuffer* buf) { + (void)buf; + NotImplemented_nid_no_patch(__func__); + return nullptr; +} + +uint32_t* APS5_VABI sceAgcDcbPushMarker(CommandBuffer* buf, const char* str, uint32_t color) { + (void)buf; + (void)str; + (void)color; + NotImplemented_nid_no_patch(__func__); + return nullptr; +} + +} diff --git a/core/libs/prx/libSceAgc/DcbState/src/Predication.cpp b/core/libs/prx/libSceAgc/DcbState/src/Predication.cpp new file mode 100644 index 000000000..67852ab05 --- /dev/null +++ b/core/libs/prx/libSceAgc/DcbState/src/Predication.cpp @@ -0,0 +1,22 @@ +#include "prx/libSceAgc/DcbState/include/Predication.hpp" + +#include "prx/libSceAgc/Command/include/Packet.hpp" +#include +#include +#include "SceTypes.hpp" +#include "prx/libc/include/General.hpp" + +extern "C" { + +uint32_t* APS5_VABI sceAgcDcbSetPredication(CommandBuffer* buf, uint8_t condition, uint8_t op, uint8_t wait_op, const volatile void* address, uint32_t count_in_dwords) { + (void)buf; + (void)condition; + (void)op; + (void)wait_op; + (void)address; + (void)count_in_dwords; + NotImplemented_nid_no_patch(__func__); + return nullptr; +} + +} diff --git a/core/libs/prx/libSceAgc/DcbState/src/Registers.cpp b/core/libs/prx/libSceAgc/DcbState/src/Registers.cpp new file mode 100644 index 000000000..c5f5a3c03 --- /dev/null +++ b/core/libs/prx/libSceAgc/DcbState/src/Registers.cpp @@ -0,0 +1,54 @@ +#include "prx/libSceAgc/DcbState/include/Registers.hpp" + +#include "prx/libSceAgc/Command/include/Packet.hpp" +#include +#include +#include "SceTypes.hpp" +#include "prx/libc/include/General.hpp" + +extern "C" { + +uint32_t* APS5_VABI sceAgcDcbSetCxRegisterDirect(CommandBuffer* buf, ShaderRegister reg) { + (void)buf; + (void)reg; + NotImplemented_nid_no_patch(__func__); + return nullptr; +} + +uint32_t APS5_VABI sceAgcDcbSetCxRegisterDirectGetSize(void) { + NotImplemented_nid_no_patch(__func__); + return 0; +} + +std::uint32_t* APS5_VABI sceAgcDcbSetCxRegistersIndirect(CommandBuffer* buf, const volatile ShaderRegister* regs, std::uint32_t numRegs) { + return Agc::Command::WriteIndirectRegisters(buf, 0x9fu, regs, numRegs, __func__); +} + +uint32_t* APS5_VABI sceAgcDcbSetShRegisterDirect(CommandBuffer* buf, ShaderRegister reg) { + (void)buf; + (void)reg; + NotImplemented_nid_no_patch(__func__); + return nullptr; +} + +std::uint32_t* APS5_VABI sceAgcDcbSetShRegistersIndirect(CommandBuffer* buf, const volatile ShaderRegister* regs, std::uint32_t numRegs) { + return Agc::Command::WriteIndirectRegisters(buf, 0x63u, regs, numRegs, __func__); +} + +std::uint32_t APS5_VABI sceAgcDcbSetShRegistersIndirectGetSize(std::uint32_t numRegs) { + Agc::Command::CheckBits(numRegs, 0x3fffu, __func__); + return 20; +} + +uint32_t* APS5_VABI sceAgcDcbSetUcRegisterDirect(CommandBuffer* buf, ShaderRegister reg) { + (void)buf; + (void)reg; + NotImplemented_nid_no_patch(__func__); + return nullptr; +} + +std::uint32_t* APS5_VABI sceAgcDcbSetUcRegistersIndirect(CommandBuffer* buf, const volatile ShaderRegister* regs, std::uint32_t numRegs) { + return Agc::Command::WriteIndirectRegisters(buf, 0x64u, regs, numRegs, __func__); +} + +} diff --git a/core/libs/prx/libSceAgc/DcbState/src/Workload.cpp b/core/libs/prx/libSceAgc/DcbState/src/Workload.cpp new file mode 100644 index 000000000..2ce29cfe2 --- /dev/null +++ b/core/libs/prx/libSceAgc/DcbState/src/Workload.cpp @@ -0,0 +1,28 @@ +#include "prx/libSceAgc/DcbState/include/Workload.hpp" + +#include "prx/libSceAgc/Command/include/Packet.hpp" +#include +#include +#include "SceTypes.hpp" +#include "prx/libc/include/General.hpp" + +extern "C" { + +uint32_t* APS5_VABI sceAgcDcbSetWorkloadComplete(CommandBuffer* buf, uint32_t stream_id, uint32_t workload_id) { + (void)buf; + (void)stream_id; + (void)workload_id; + NotImplemented_nid_no_patch(__func__); + return nullptr; +} + +uint32_t* APS5_VABI sceAgcDcbSetWorkloadsActive(CommandBuffer* buf, uint32_t stream_id, const uint32_t* workload_ids, uint32_t workload_count) { + (void)buf; + (void)stream_id; + (void)workload_ids; + (void)workload_count; + NotImplemented_nid_no_patch(__func__); + return nullptr; +} + +} diff --git a/core/libs/prx/libSceAgc/Export.cpp b/core/libs/prx/libSceAgc/Export.cpp deleted file mode 100644 index bbf71b4cc..000000000 --- a/core/libs/prx/libSceAgc/Export.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include -#include -#include "SceTypes.hpp" -#include "prx/libc/include/General.hpp" - -extern "C" { -} diff --git a/core/libs/prx/libSceAgc/Misc/include/PacketInfo.hpp b/core/libs/prx/libSceAgc/Misc/include/PacketInfo.hpp new file mode 100644 index 000000000..535ebefb4 --- /dev/null +++ b/core/libs/prx/libSceAgc/Misc/include/PacketInfo.hpp @@ -0,0 +1,4 @@ +#ifndef CORE_LIBS_PRX_LIBSCEAGC_MISC_INCLUDE_PACKETINFO_HPP +#define CORE_LIBS_PRX_LIBSCEAGC_MISC_INCLUDE_PACKETINFO_HPP + +#endif diff --git a/core/libs/prx/libSceAgc/Misc/include/RegisterDefaults.hpp b/core/libs/prx/libSceAgc/Misc/include/RegisterDefaults.hpp new file mode 100644 index 000000000..cb296a816 --- /dev/null +++ b/core/libs/prx/libSceAgc/Misc/include/RegisterDefaults.hpp @@ -0,0 +1,4 @@ +#ifndef CORE_LIBS_PRX_LIBSCEAGC_MISC_INCLUDE_REGISTERDEFAULTS_HPP +#define CORE_LIBS_PRX_LIBSCEAGC_MISC_INCLUDE_REGISTERDEFAULTS_HPP + +#endif diff --git a/core/libs/prx/libSceAgc/Misc/include/ShaderFusion.hpp b/core/libs/prx/libSceAgc/Misc/include/ShaderFusion.hpp new file mode 100644 index 000000000..fa487f701 --- /dev/null +++ b/core/libs/prx/libSceAgc/Misc/include/ShaderFusion.hpp @@ -0,0 +1,4 @@ +#ifndef CORE_LIBS_PRX_LIBSCEAGC_MISC_INCLUDE_SHADERFUSION_HPP +#define CORE_LIBS_PRX_LIBSCEAGC_MISC_INCLUDE_SHADERFUSION_HPP + +#endif diff --git a/core/libs/prx/libSceAgc/Misc/include/Suspend.hpp b/core/libs/prx/libSceAgc/Misc/include/Suspend.hpp new file mode 100644 index 000000000..25b2dd5bf --- /dev/null +++ b/core/libs/prx/libSceAgc/Misc/include/Suspend.hpp @@ -0,0 +1,4 @@ +#ifndef CORE_LIBS_PRX_LIBSCEAGC_MISC_INCLUDE_SUSPEND_HPP +#define CORE_LIBS_PRX_LIBSCEAGC_MISC_INCLUDE_SUSPEND_HPP + +#endif diff --git a/core/libs/prx/libSceAgc/Misc/src/PacketInfo.cpp b/core/libs/prx/libSceAgc/Misc/src/PacketInfo.cpp new file mode 100644 index 000000000..50653886e --- /dev/null +++ b/core/libs/prx/libSceAgc/Misc/src/PacketInfo.cpp @@ -0,0 +1,33 @@ +#include "prx/libSceAgc/Misc/include/PacketInfo.hpp" + +#include +#include +#include "SceTypes.hpp" +#include "prx/libc/include/General.hpp" + +extern "C" { + +uint32_t APS5_VABI sceAgcGetPacketSize(uint32_t* packet) { + (void)packet; + NotImplemented_nid_no_patch(__func__); + return 0; +} + +int APS5_VABI sceAgcGetDataPacketPayloadAddress(uint32_t** addr, uint32_t* cmd, int type) { + (void)addr; + (void)cmd; + (void)type; + NotImplemented_nid_no_patch(__func__); + return 0; +} + +APS5_EXPORT("V++UgBtQhn0", sceAgcGetDataPacketPayloadAnotherAddress); +int APS5_VABI sceAgcGetDataPacketPayloadAnotherAddress(uint32_t** addr, uint32_t* cmd, int type) { + (void)addr; + (void)cmd; + (void)type; + NotImplemented_nid_no_patch(__func__); + return 0; +} + +} diff --git a/core/libs/prx/libSceAgc/Misc/src/RegisterDefaults.cpp b/core/libs/prx/libSceAgc/Misc/src/RegisterDefaults.cpp new file mode 100644 index 000000000..1b7e43bfc --- /dev/null +++ b/core/libs/prx/libSceAgc/Misc/src/RegisterDefaults.cpp @@ -0,0 +1,22 @@ +#include "prx/libSceAgc/Misc/include/RegisterDefaults.hpp" + +#include +#include +#include "SceTypes.hpp" +#include "prx/libc/include/General.hpp" + +extern "C" { + +void* APS5_VABI sceAgcGetRegisterDefaults2(uint32_t ver) { + (void)ver; + NotImplemented_nid_no_patch(__func__); + return nullptr; +} + +void* APS5_VABI sceAgcGetRegisterDefaults2Internal(uint32_t ver) { + (void)ver; + NotImplemented_nid_no_patch(__func__); + return nullptr; +} + +} diff --git a/core/libs/prx/libSceAgc/Misc/Export.cpp b/core/libs/prx/libSceAgc/Misc/src/ShaderFusion.cpp similarity index 52% rename from core/libs/prx/libSceAgc/Misc/Export.cpp rename to core/libs/prx/libSceAgc/Misc/src/ShaderFusion.cpp index 330d47d12..519e720bd 100644 --- a/core/libs/prx/libSceAgc/Misc/Export.cpp +++ b/core/libs/prx/libSceAgc/Misc/src/ShaderFusion.cpp @@ -1,3 +1,5 @@ +#include "prx/libSceAgc/Misc/include/ShaderFusion.hpp" + #include #include #include "SceTypes.hpp" @@ -10,18 +12,6 @@ struct SizeAlign { extern "C" { -uint32_t APS5_VABI sceAgcGetPacketSize(uint32_t* packet) { - (void)packet; - NotImplemented_nid_no_patch(__func__); - return 0; -} - -void* APS5_VABI sceAgcGetRegisterDefaults2(uint32_t ver) { - (void)ver; - NotImplemented_nid_no_patch(__func__); - return nullptr; -} - APS5_EXPORT("fd5Bp5tGTgo", sceAgcUnknownFuseShaderHalves); int APS5_VABI sceAgcUnknownFuseShaderHalves(Shader* fused_result, const Shader* front, const Shader* back, void* scratch_mem) { (void)fused_result; @@ -41,15 +31,6 @@ int APS5_VABI sceAgcUnknownGetFusedShaderSize(SizeAlign* dst, const Shader* fron return 0; } -APS5_EXPORT("V++UgBtQhn0", sceAgcGetDataPacketPayloadAnotherAddress); -int APS5_VABI sceAgcGetDataPacketPayloadAnotherAddress(uint32_t** addr, uint32_t* cmd, int type) { - (void)addr; - (void)cmd; - (void)type; - NotImplemented_nid_no_patch(__func__); - return 0; -} - APS5_EXPORT("k0E7vkgqAuE", sceAgcCreateInterpolantMappingVsPs); int APS5_VABI sceAgcCreateInterpolantMappingVsPs(ShaderRegister* regs, const Shader* vs, const Shader* ps) { (void)regs; @@ -59,23 +40,4 @@ int APS5_VABI sceAgcCreateInterpolantMappingVsPs(ShaderRegister* regs, const Sha return 0; } -void* APS5_VABI sceAgcGetRegisterDefaults2Internal(uint32_t ver) { - (void)ver; - NotImplemented_nid_no_patch(__func__); - return nullptr; -} - -int APS5_VABI sceAgcGetDataPacketPayloadAddress(uint32_t** addr, uint32_t* cmd, int type) { - (void)addr; - (void)cmd; - (void)type; - NotImplemented_nid_no_patch(__func__); - return 0; -} - -int APS5_VABI sceAgcSuspendPoint(void) { - NotImplemented_nid_no_patch(__func__); - return 0; -} - } diff --git a/core/libs/prx/libSceAgc/Misc/src/Suspend.cpp b/core/libs/prx/libSceAgc/Misc/src/Suspend.cpp new file mode 100644 index 000000000..c44542417 --- /dev/null +++ b/core/libs/prx/libSceAgc/Misc/src/Suspend.cpp @@ -0,0 +1,15 @@ +#include "prx/libSceAgc/Misc/include/Suspend.hpp" + +#include +#include +#include "SceTypes.hpp" +#include "prx/libc/include/General.hpp" + +extern "C" { + +int APS5_VABI sceAgcSuspendPoint(void) { + NotImplemented_nid_no_patch(__func__); + return 0; +} + +} diff --git a/core/libs/prx/libSceAgc/Patch/Export.cpp b/core/libs/prx/libSceAgc/Patch/Export.cpp deleted file mode 100644 index f098c6d6d..000000000 --- a/core/libs/prx/libSceAgc/Patch/Export.cpp +++ /dev/null @@ -1,157 +0,0 @@ -#include "prx/libSceAgc/Command/Memory.hpp" -#include "prx/libSceAgc/Command/Packet.hpp" -#include -#include -#include "SceTypes.hpp" -#include "prx/libc/include/General.hpp" - -extern "C" { - -int APS5_VABI sceAgcDmaDataPatchSetDstAddressOrOffset(std::uint32_t* cmd, std::uint64_t address) { - Agc::Command::ValidatePacket(cmd, 0x50u, 7, __func__); - cmd[4] = static_cast(address); - cmd[5] = static_cast(address >> 32u); - return 0; -} - -int APS5_VABI sceAgcDmaDataPatchSetSrcAddressOrOffsetOrImmediate(std::uint32_t* cmd, std::uint64_t address) { - Agc::Command::ValidatePacket(cmd, 0x50u, 7, __func__); - cmd[2] = static_cast(address); - cmd[3] = static_cast(address >> 32u); - return 0; -} - -int APS5_VABI sceAgcJumpPatchSetTarget(uint32_t* cmd, const volatile uint32_t* target, uint32_t size_in_dwords) { - (void)cmd; - (void)target; - (void)size_in_dwords; - NotImplemented_nid_no_patch(__func__); - return 0; -} - -int APS5_VABI sceAgcQueueEndOfPipeActionPatchAddress(uint32_t* cmd, const volatile Label* address) { - (void)cmd; - (void)address; - NotImplemented_nid_no_patch(__func__); - return 0; -} - -std::uint32_t* APS5_VABI sceAgcSetNop(CommandBuffer* buf, std::uint32_t sizeDw) { - return Agc::Command::WriteNop(buf, sizeDw, __func__); -} - -int APS5_VABI sceAgcQueueEndOfPipeActionPatchData(uint32_t* cmd, uint32_t context_id, uint32_t data_sel, uint64_t data) { - (void)cmd; - (void)context_id; - (void)data_sel; - (void)data; - NotImplemented_nid_no_patch(__func__); - return 0; -} - -int APS5_VABI sceAgcRewindPatchSetRewindState(uint32_t* cmd, uint8_t state) { - (void)cmd; - (void)state; - NotImplemented_nid_no_patch(__func__); - return 0; -} - -int APS5_VABI sceAgcWaitRegMemPatchAddress(std::uint32_t* cmd, const volatile void* address) { - auto* wait = Agc::Command::ValidateWait(cmd, __func__); - const auto guestAddress = reinterpret_cast(address); - const auto alignment = ((wait[0] >> 8u) & 0xffu) == 0x3cu ? 4u : 8u; - Agc::Command::CheckAddress(guestAddress, alignment, __func__); - Agc::Command::CheckBits(guestAddress, 0xffffffffffffull, __func__); - cmd[2] = (cmd[2] & 0xffff0000u) | static_cast(guestAddress >> 32u); - cmd[3] = static_cast(guestAddress); - wait[2] = static_cast(guestAddress); - wait[3] = static_cast(guestAddress >> 32u); - return 0; -} - -int APS5_VABI sceAgcWaitRegMemPatchReference(std::uint32_t* cmd, std::uint64_t reference) { - auto* wait = Agc::Command::ValidateWait(cmd, __func__); - Agc::Command::CheckBits(reference, 0xffffffffu, __func__); - wait[4] = static_cast(reference); - return 0; -} - -int APS5_VABI sceAgcCondExecPatchSetCommandAddress(uint32_t* cmd, const volatile uint32_t* command) { - (void)cmd; - (void)command; - NotImplemented_nid_no_patch(__func__); - return 0; -} - -int APS5_VABI sceAgcCondExecPatchSetEnd(uint32_t* cmd, const volatile uint32_t* buffer) { - (void)cmd; - (void)buffer; - NotImplemented_nid_no_patch(__func__); - return 0; -} - -int APS5_VABI sceAgcSetCxRegIndirectPatchAddRegisters(std::uint32_t* cmd, std::uint32_t numRegs) { - Agc::Command::PatchIndirectCount(cmd, 0x9fu, numRegs, __func__); - return 0; -} - -int APS5_VABI sceAgcSetCxRegIndirectPatchSetAddress(std::uint32_t* cmd, const volatile ShaderRegister* regs) { - Agc::Command::PatchIndirectAddress(cmd, 0x9fu, regs, __func__); - return 0; -} - -int APS5_VABI sceAgcSetCxRegIndirectPatchSetNumRegisters(uint32_t* cmd, uint32_t num_regs) { - (void)cmd; - (void)num_regs; - NotImplemented_nid_no_patch(__func__); - return 0; -} - -int APS5_VABI sceAgcSetShRegIndirectPatchAddRegisters(std::uint32_t* cmd, std::uint32_t numRegs) { - Agc::Command::PatchIndirectCount(cmd, 0x63u, numRegs, __func__); - return 0; -} - -int APS5_VABI sceAgcSetShRegIndirectPatchSetAddress(std::uint32_t* cmd, const volatile ShaderRegister* regs) { - Agc::Command::PatchIndirectAddress(cmd, 0x63u, regs, __func__); - return 0; -} - -int APS5_VABI sceAgcSetShRegIndirectPatchSetNumRegisters(uint32_t* cmd, uint32_t num_regs) { - (void)cmd; - (void)num_regs; - NotImplemented_nid_no_patch(__func__); - return 0; -} - -int APS5_VABI sceAgcSetUcRegIndirectPatchAddRegisters(std::uint32_t* cmd, std::uint32_t numRegs) { - Agc::Command::PatchIndirectCount(cmd, 0x64u, numRegs, __func__); - return 0; -} - -int APS5_VABI sceAgcSetUcRegIndirectPatchSetAddress(std::uint32_t* cmd, const volatile ShaderRegister* regs) { - Agc::Command::PatchIndirectAddress(cmd, 0x64u, regs, __func__); - return 0; -} - -int APS5_VABI sceAgcSetUcRegIndirectPatchSetNumRegisters(uint32_t* cmd, uint32_t num_regs) { - (void)cmd; - (void)num_regs; - NotImplemented_nid_no_patch(__func__); - return 0; -} -int APS5_VABI sceAgcAsyncCondExecPatchSetCommandAddress(std::uint32_t* cmd, const volatile std::uint32_t* command) { - (void)cmd; - (void)command; - NotImplemented_nid_no_patch(__func__); - return 0; -} - -int APS5_VABI sceAgcAsyncCondExecPatchSetEnd(std::uint32_t* cmd, const volatile std::uint32_t* buffer) { - (void)cmd; - (void)buffer; - NotImplemented_nid_no_patch(__func__); - return 0; -} - -} diff --git a/core/libs/prx/libSceAgc/Patch/include/CondExec.hpp b/core/libs/prx/libSceAgc/Patch/include/CondExec.hpp new file mode 100644 index 000000000..8d81efe67 --- /dev/null +++ b/core/libs/prx/libSceAgc/Patch/include/CondExec.hpp @@ -0,0 +1,4 @@ +#ifndef CORE_LIBS_PRX_LIBSCEAGC_PATCH_INCLUDE_CONDEXEC_HPP +#define CORE_LIBS_PRX_LIBSCEAGC_PATCH_INCLUDE_CONDEXEC_HPP + +#endif diff --git a/core/libs/prx/libSceAgc/Patch/include/Dma.hpp b/core/libs/prx/libSceAgc/Patch/include/Dma.hpp new file mode 100644 index 000000000..d28d24df8 --- /dev/null +++ b/core/libs/prx/libSceAgc/Patch/include/Dma.hpp @@ -0,0 +1,4 @@ +#ifndef CORE_LIBS_PRX_LIBSCEAGC_PATCH_INCLUDE_DMA_HPP +#define CORE_LIBS_PRX_LIBSCEAGC_PATCH_INCLUDE_DMA_HPP + +#endif diff --git a/core/libs/prx/libSceAgc/Patch/include/IndirectRegisters.hpp b/core/libs/prx/libSceAgc/Patch/include/IndirectRegisters.hpp new file mode 100644 index 000000000..72863129b --- /dev/null +++ b/core/libs/prx/libSceAgc/Patch/include/IndirectRegisters.hpp @@ -0,0 +1,4 @@ +#ifndef CORE_LIBS_PRX_LIBSCEAGC_PATCH_INCLUDE_INDIRECTREGISTERS_HPP +#define CORE_LIBS_PRX_LIBSCEAGC_PATCH_INCLUDE_INDIRECTREGISTERS_HPP + +#endif diff --git a/core/libs/prx/libSceAgc/Patch/include/Jump.hpp b/core/libs/prx/libSceAgc/Patch/include/Jump.hpp new file mode 100644 index 000000000..b5820f260 --- /dev/null +++ b/core/libs/prx/libSceAgc/Patch/include/Jump.hpp @@ -0,0 +1,4 @@ +#ifndef CORE_LIBS_PRX_LIBSCEAGC_PATCH_INCLUDE_JUMP_HPP +#define CORE_LIBS_PRX_LIBSCEAGC_PATCH_INCLUDE_JUMP_HPP + +#endif diff --git a/core/libs/prx/libSceAgc/Patch/include/Nop.hpp b/core/libs/prx/libSceAgc/Patch/include/Nop.hpp new file mode 100644 index 000000000..9958a2cbc --- /dev/null +++ b/core/libs/prx/libSceAgc/Patch/include/Nop.hpp @@ -0,0 +1,4 @@ +#ifndef CORE_LIBS_PRX_LIBSCEAGC_PATCH_INCLUDE_NOP_HPP +#define CORE_LIBS_PRX_LIBSCEAGC_PATCH_INCLUDE_NOP_HPP + +#endif diff --git a/core/libs/prx/libSceAgc/Patch/include/QueueEndOfPipeAction.hpp b/core/libs/prx/libSceAgc/Patch/include/QueueEndOfPipeAction.hpp new file mode 100644 index 000000000..eb06c3a58 --- /dev/null +++ b/core/libs/prx/libSceAgc/Patch/include/QueueEndOfPipeAction.hpp @@ -0,0 +1,4 @@ +#ifndef CORE_LIBS_PRX_LIBSCEAGC_PATCH_INCLUDE_QUEUEENDOFPIPEACTION_HPP +#define CORE_LIBS_PRX_LIBSCEAGC_PATCH_INCLUDE_QUEUEENDOFPIPEACTION_HPP + +#endif diff --git a/core/libs/prx/libSceAgc/Patch/include/Rewind.hpp b/core/libs/prx/libSceAgc/Patch/include/Rewind.hpp new file mode 100644 index 000000000..52e1bc262 --- /dev/null +++ b/core/libs/prx/libSceAgc/Patch/include/Rewind.hpp @@ -0,0 +1,4 @@ +#ifndef CORE_LIBS_PRX_LIBSCEAGC_PATCH_INCLUDE_REWIND_HPP +#define CORE_LIBS_PRX_LIBSCEAGC_PATCH_INCLUDE_REWIND_HPP + +#endif diff --git a/core/libs/prx/libSceAgc/Patch/include/WaitRegMem.hpp b/core/libs/prx/libSceAgc/Patch/include/WaitRegMem.hpp new file mode 100644 index 000000000..8e14191a5 --- /dev/null +++ b/core/libs/prx/libSceAgc/Patch/include/WaitRegMem.hpp @@ -0,0 +1,4 @@ +#ifndef CORE_LIBS_PRX_LIBSCEAGC_PATCH_INCLUDE_WAITREGMEM_HPP +#define CORE_LIBS_PRX_LIBSCEAGC_PATCH_INCLUDE_WAITREGMEM_HPP + +#endif diff --git a/core/libs/prx/libSceAgc/Patch/src/CondExec.cpp b/core/libs/prx/libSceAgc/Patch/src/CondExec.cpp new file mode 100644 index 000000000..42b45d366 --- /dev/null +++ b/core/libs/prx/libSceAgc/Patch/src/CondExec.cpp @@ -0,0 +1,40 @@ +#include "prx/libSceAgc/Patch/include/CondExec.hpp" + +#include "prx/libSceAgc/Command/include/Memory.hpp" +#include "prx/libSceAgc/Command/include/Packet.hpp" +#include +#include +#include "SceTypes.hpp" +#include "prx/libc/include/General.hpp" + +extern "C" { + +int APS5_VABI sceAgcCondExecPatchSetCommandAddress(uint32_t* cmd, const volatile uint32_t* command) { + (void)cmd; + (void)command; + NotImplemented_nid_no_patch(__func__); + return 0; +} + +int APS5_VABI sceAgcCondExecPatchSetEnd(uint32_t* cmd, const volatile uint32_t* buffer) { + (void)cmd; + (void)buffer; + NotImplemented_nid_no_patch(__func__); + return 0; +} + +int APS5_VABI sceAgcAsyncCondExecPatchSetCommandAddress(std::uint32_t* cmd, const volatile std::uint32_t* command) { + (void)cmd; + (void)command; + NotImplemented_nid_no_patch(__func__); + return 0; +} + +int APS5_VABI sceAgcAsyncCondExecPatchSetEnd(std::uint32_t* cmd, const volatile std::uint32_t* buffer) { + (void)cmd; + (void)buffer; + NotImplemented_nid_no_patch(__func__); + return 0; +} + +} diff --git a/core/libs/prx/libSceAgc/Patch/src/Dma.cpp b/core/libs/prx/libSceAgc/Patch/src/Dma.cpp new file mode 100644 index 000000000..44dd516b8 --- /dev/null +++ b/core/libs/prx/libSceAgc/Patch/src/Dma.cpp @@ -0,0 +1,26 @@ +#include "prx/libSceAgc/Patch/include/Dma.hpp" + +#include "prx/libSceAgc/Command/include/Memory.hpp" +#include "prx/libSceAgc/Command/include/Packet.hpp" +#include +#include +#include "SceTypes.hpp" +#include "prx/libc/include/General.hpp" + +extern "C" { + +int APS5_VABI sceAgcDmaDataPatchSetDstAddressOrOffset(std::uint32_t* cmd, std::uint64_t address) { + Agc::Command::ValidatePacket(cmd, 0x50u, 7, __func__); + cmd[4] = static_cast(address); + cmd[5] = static_cast(address >> 32u); + return 0; +} + +int APS5_VABI sceAgcDmaDataPatchSetSrcAddressOrOffsetOrImmediate(std::uint32_t* cmd, std::uint64_t address) { + Agc::Command::ValidatePacket(cmd, 0x50u, 7, __func__); + cmd[2] = static_cast(address); + cmd[3] = static_cast(address >> 32u); + return 0; +} + +} diff --git a/core/libs/prx/libSceAgc/Patch/src/IndirectRegisters.cpp b/core/libs/prx/libSceAgc/Patch/src/IndirectRegisters.cpp new file mode 100644 index 000000000..f14d7b320 --- /dev/null +++ b/core/libs/prx/libSceAgc/Patch/src/IndirectRegisters.cpp @@ -0,0 +1,63 @@ +#include "prx/libSceAgc/Patch/include/IndirectRegisters.hpp" + +#include "prx/libSceAgc/Command/include/Memory.hpp" +#include "prx/libSceAgc/Command/include/Packet.hpp" +#include +#include +#include "SceTypes.hpp" +#include "prx/libc/include/General.hpp" + +extern "C" { + +int APS5_VABI sceAgcSetCxRegIndirectPatchAddRegisters(std::uint32_t* cmd, std::uint32_t numRegs) { + Agc::Command::PatchIndirectCount(cmd, 0x9fu, numRegs, __func__); + return 0; +} + +int APS5_VABI sceAgcSetCxRegIndirectPatchSetAddress(std::uint32_t* cmd, const volatile ShaderRegister* regs) { + Agc::Command::PatchIndirectAddress(cmd, 0x9fu, regs, __func__); + return 0; +} + +int APS5_VABI sceAgcSetCxRegIndirectPatchSetNumRegisters(uint32_t* cmd, uint32_t num_regs) { + (void)cmd; + (void)num_regs; + NotImplemented_nid_no_patch(__func__); + return 0; +} + +int APS5_VABI sceAgcSetShRegIndirectPatchAddRegisters(std::uint32_t* cmd, std::uint32_t numRegs) { + Agc::Command::PatchIndirectCount(cmd, 0x63u, numRegs, __func__); + return 0; +} + +int APS5_VABI sceAgcSetShRegIndirectPatchSetAddress(std::uint32_t* cmd, const volatile ShaderRegister* regs) { + Agc::Command::PatchIndirectAddress(cmd, 0x63u, regs, __func__); + return 0; +} + +int APS5_VABI sceAgcSetShRegIndirectPatchSetNumRegisters(uint32_t* cmd, uint32_t num_regs) { + (void)cmd; + (void)num_regs; + NotImplemented_nid_no_patch(__func__); + return 0; +} + +int APS5_VABI sceAgcSetUcRegIndirectPatchAddRegisters(std::uint32_t* cmd, std::uint32_t numRegs) { + Agc::Command::PatchIndirectCount(cmd, 0x64u, numRegs, __func__); + return 0; +} + +int APS5_VABI sceAgcSetUcRegIndirectPatchSetAddress(std::uint32_t* cmd, const volatile ShaderRegister* regs) { + Agc::Command::PatchIndirectAddress(cmd, 0x64u, regs, __func__); + return 0; +} + +int APS5_VABI sceAgcSetUcRegIndirectPatchSetNumRegisters(uint32_t* cmd, uint32_t num_regs) { + (void)cmd; + (void)num_regs; + NotImplemented_nid_no_patch(__func__); + return 0; +} + +} diff --git a/core/libs/prx/libSceAgc/Patch/src/Jump.cpp b/core/libs/prx/libSceAgc/Patch/src/Jump.cpp new file mode 100644 index 000000000..da33b9147 --- /dev/null +++ b/core/libs/prx/libSceAgc/Patch/src/Jump.cpp @@ -0,0 +1,20 @@ +#include "prx/libSceAgc/Patch/include/Jump.hpp" + +#include "prx/libSceAgc/Command/include/Memory.hpp" +#include "prx/libSceAgc/Command/include/Packet.hpp" +#include +#include +#include "SceTypes.hpp" +#include "prx/libc/include/General.hpp" + +extern "C" { + +int APS5_VABI sceAgcJumpPatchSetTarget(uint32_t* cmd, const volatile uint32_t* target, uint32_t size_in_dwords) { + (void)cmd; + (void)target; + (void)size_in_dwords; + NotImplemented_nid_no_patch(__func__); + return 0; +} + +} diff --git a/core/libs/prx/libSceAgc/Patch/src/Nop.cpp b/core/libs/prx/libSceAgc/Patch/src/Nop.cpp new file mode 100644 index 000000000..dce57c9c9 --- /dev/null +++ b/core/libs/prx/libSceAgc/Patch/src/Nop.cpp @@ -0,0 +1,16 @@ +#include "prx/libSceAgc/Patch/include/Nop.hpp" + +#include "prx/libSceAgc/Command/include/Memory.hpp" +#include "prx/libSceAgc/Command/include/Packet.hpp" +#include +#include +#include "SceTypes.hpp" +#include "prx/libc/include/General.hpp" + +extern "C" { + +std::uint32_t* APS5_VABI sceAgcSetNop(CommandBuffer* buf, std::uint32_t sizeDw) { + return Agc::Command::WriteNop(buf, sizeDw, __func__); +} + +} diff --git a/core/libs/prx/libSceAgc/Patch/src/QueueEndOfPipeAction.cpp b/core/libs/prx/libSceAgc/Patch/src/QueueEndOfPipeAction.cpp new file mode 100644 index 000000000..03f94b82f --- /dev/null +++ b/core/libs/prx/libSceAgc/Patch/src/QueueEndOfPipeAction.cpp @@ -0,0 +1,28 @@ +#include "prx/libSceAgc/Patch/include/QueueEndOfPipeAction.hpp" + +#include "prx/libSceAgc/Command/include/Memory.hpp" +#include "prx/libSceAgc/Command/include/Packet.hpp" +#include +#include +#include "SceTypes.hpp" +#include "prx/libc/include/General.hpp" + +extern "C" { + +int APS5_VABI sceAgcQueueEndOfPipeActionPatchAddress(uint32_t* cmd, const volatile Label* address) { + (void)cmd; + (void)address; + NotImplemented_nid_no_patch(__func__); + return 0; +} + +int APS5_VABI sceAgcQueueEndOfPipeActionPatchData(uint32_t* cmd, uint32_t context_id, uint32_t data_sel, uint64_t data) { + (void)cmd; + (void)context_id; + (void)data_sel; + (void)data; + NotImplemented_nid_no_patch(__func__); + return 0; +} + +} diff --git a/core/libs/prx/libSceAgc/Patch/src/Rewind.cpp b/core/libs/prx/libSceAgc/Patch/src/Rewind.cpp new file mode 100644 index 000000000..cdb7ac46a --- /dev/null +++ b/core/libs/prx/libSceAgc/Patch/src/Rewind.cpp @@ -0,0 +1,19 @@ +#include "prx/libSceAgc/Patch/include/Rewind.hpp" + +#include "prx/libSceAgc/Command/include/Memory.hpp" +#include "prx/libSceAgc/Command/include/Packet.hpp" +#include +#include +#include "SceTypes.hpp" +#include "prx/libc/include/General.hpp" + +extern "C" { + +int APS5_VABI sceAgcRewindPatchSetRewindState(uint32_t* cmd, uint8_t state) { + (void)cmd; + (void)state; + NotImplemented_nid_no_patch(__func__); + return 0; +} + +} diff --git a/core/libs/prx/libSceAgc/Patch/src/WaitRegMem.cpp b/core/libs/prx/libSceAgc/Patch/src/WaitRegMem.cpp new file mode 100644 index 000000000..fd6d8730e --- /dev/null +++ b/core/libs/prx/libSceAgc/Patch/src/WaitRegMem.cpp @@ -0,0 +1,32 @@ +#include "prx/libSceAgc/Patch/include/WaitRegMem.hpp" + +#include "prx/libSceAgc/Command/include/Memory.hpp" +#include "prx/libSceAgc/Command/include/Packet.hpp" +#include +#include +#include "SceTypes.hpp" +#include "prx/libc/include/General.hpp" + +extern "C" { + +int APS5_VABI sceAgcWaitRegMemPatchAddress(std::uint32_t* cmd, const volatile void* address) { + auto* wait = Agc::Command::ValidateWait(cmd, __func__); + const auto guestAddress = reinterpret_cast(address); + const auto alignment = ((wait[0] >> 8u) & 0xffu) == 0x3cu ? 4u : 8u; + Agc::Command::CheckAddress(guestAddress, alignment, __func__); + Agc::Command::CheckBits(guestAddress, 0xffffffffffffull, __func__); + cmd[2] = (cmd[2] & 0xffff0000u) | static_cast(guestAddress >> 32u); + cmd[3] = static_cast(guestAddress); + wait[2] = static_cast(guestAddress); + wait[3] = static_cast(guestAddress >> 32u); + return 0; +} + +int APS5_VABI sceAgcWaitRegMemPatchReference(std::uint32_t* cmd, std::uint64_t reference) { + auto* wait = Agc::Command::ValidateWait(cmd, __func__); + Agc::Command::CheckBits(reference, 0xffffffffu, __func__); + wait[4] = static_cast(reference); + return 0; +} + +} diff --git a/core/libs/prx/libSceAgc/Predication/include/Predication.hpp b/core/libs/prx/libSceAgc/Predication/include/Predication.hpp new file mode 100644 index 000000000..7ae84c8a7 --- /dev/null +++ b/core/libs/prx/libSceAgc/Predication/include/Predication.hpp @@ -0,0 +1,4 @@ +#ifndef CORE_LIBS_PRX_LIBSCEAGC_PREDICATION_INCLUDE_PREDICATION_HPP +#define CORE_LIBS_PRX_LIBSCEAGC_PREDICATION_INCLUDE_PREDICATION_HPP + +#endif diff --git a/core/libs/prx/libSceAgc/Predication/Export.cpp b/core/libs/prx/libSceAgc/Predication/src/Predication.cpp similarity index 88% rename from core/libs/prx/libSceAgc/Predication/Export.cpp rename to core/libs/prx/libSceAgc/Predication/src/Predication.cpp index 2c01761a1..2ae555e4d 100644 --- a/core/libs/prx/libSceAgc/Predication/Export.cpp +++ b/core/libs/prx/libSceAgc/Predication/src/Predication.cpp @@ -1,3 +1,5 @@ +#include "prx/libSceAgc/Predication/include/Predication.hpp" + #include #include #include "SceTypes.hpp" @@ -19,4 +21,5 @@ int APS5_VABI sceAgcSetRangePredication(uint32_t* start, const volatile uint32_t NotImplemented_nid_no_patch(__func__); return 0; } + } diff --git a/core/libs/prx/libSceAgc/Shader/Export.cpp b/core/libs/prx/libSceAgc/Shader/Export.cpp deleted file mode 100644 index 1c2959a59..000000000 --- a/core/libs/prx/libSceAgc/Shader/Export.cpp +++ /dev/null @@ -1,166 +0,0 @@ -#include -#include -#include - -#include "SceShaders.hpp" -#include "ShaderUtils.hpp" -#include "ShaderConstants.hpp" - -extern "C" { - -int APS5_VABI sceAgcCreateShader(Shader** dst, void* header, const volatile void* code) { - constexpr auto fn = __func__; - if (dst == nullptr) { - throw std::runtime_error(std::string(fn) + ": dst is null"); - } - if (header == nullptr) { - throw std::runtime_error(std::string(fn) + ": header is null"); - } - if (code == nullptr) { - throw std::runtime_error(std::string(fn) + ": code is null"); - } - - auto* h = static_cast(header); - - ResolveRelativePtr(h->cx_registers); - ResolveRelativePtr(h->sh_registers); - ResolveRelativePtr(h->user_data); - ResolveRelativePtr(h->specials); - ResolveRelativePtr(h->input_semantics); - ResolveRelativePtr(h->output_semantics); - - if (h->user_data != nullptr) { - ResolveRelativePtr(h->user_data->direct_resource_offset); - ResolveRelativePtr(h->user_data->sharp_resource_offset[0]); - ResolveRelativePtr(h->user_data->sharp_resource_offset[1]); - ResolveRelativePtr(h->user_data->sharp_resource_offset[2]); - ResolveRelativePtr(h->user_data->sharp_resource_offset[3]); - } - - h->code = code; - - if (h->file_header != ShaderRegs::SHADER_FILE_HEADER_MAGIC) { - throw std::runtime_error(std::string(fn) + ": invalid file_header magic"); - } - if (h->version != ShaderRegs::SHADER_VERSION) { - throw std::runtime_error(std::string(fn) + ": unsupported shader version"); - } - - const auto base = reinterpret_cast(code); - - if ((base & ShaderRegs::SHADER_BASE_ALIGN_MASK) != 0) { - throw std::runtime_error(std::string(fn) + ": code address violates alignment mask"); - } - - int result = PatchProgramAddressRegister(h->sh_registers, h->num_sh_registers, h->type, base); - if (result != 0) { - return result; - } - - *dst = h; - APS5_LOG_OUT("OK type=%u sh_regs=%u shader_size=%u", h->type, h->num_sh_registers, h->shader_size); - return 0; -} - -int APS5_VABI sceAgcCreatePrimState(ShaderRegister* cx_regs, ShaderRegister* uc_regs, const Shader* hs, const Shader* gs, std::uint32_t prim_type) { - if (cx_regs == nullptr && uc_regs == nullptr) { - return 0; - } - if (gs == nullptr) { - throw std::runtime_error(std::string(__func__) + ": gs is null"); - } - - if (cx_regs != nullptr) { - cx_regs[0] = gs->specials->vgt_shader_stages_en; - if ((cx_regs[0].value & ShaderRegs::VGT_SHADER_STAGES_GS_BIT) != 0) { - cx_regs[1] = gs->specials->vgt_gs_out_prim_type; - } else { - cx_regs[1].offset = ShaderRegs::VGT_GS_OUT_PRIM_TYPE; - cx_regs[1].value = GraphicsPrimTypeToGsOut(prim_type); - } - - if (hs != nullptr) { - cx_regs[0].value |= hs->specials->vgt_shader_stages_en.value; - if ((cx_regs[0].value & ShaderRegs::VGT_SHADER_STAGES_GS_BIT) == 0) { - cx_regs[1] = hs->specials->vgt_gs_out_prim_type; - } - } - } - - if (uc_regs != nullptr) { - uc_regs[0] = gs->specials->ge_cntl; - uc_regs[1] = gs->specials->ge_user_vgpr_en; - uc_regs[2].offset = ShaderRegs::VGT_PRIMITIVE_TYPE; - uc_regs[2].value = prim_type; - - if (hs != nullptr) { - uc_regs[1] = hs->specials->ge_user_vgpr_en; - } - } - - APS5_LOG_OUT("OK prim_type=%u", prim_type); - return 0; -} - -int APS5_VABI sceAgcUpdatePrimState(ShaderRegister* cx_regs, ShaderRegister* uc_regs, std::uint32_t prim_type) { - if (cx_regs != nullptr && (cx_regs[0].value & (ShaderRegs::VGT_SHADER_STAGES_GS_BIT | ShaderRegs::VGT_SHADER_STAGES_NGG_BIT)) == 0) { - cx_regs[1].value &= ~0x7u; - cx_regs[1].value |= GraphicsPrimTypeToGsOut(prim_type); - } - - if (uc_regs != nullptr) { - uc_regs[2].value &= ~0x1Fu; - uc_regs[2].value |= prim_type; - } - - APS5_LOG_OUT("OK prim_type=%u", prim_type); - return 0; -} - -APS5_EXPORT("HV4j+E0MBHE", sceAgcCreateInterpolantMapping); -int APS5_VABI sceAgcCreateInterpolantMapping(ShaderRegister* regs, const Shader* gs, const Shader* ps) { - constexpr auto fn = __func__; - if (regs == nullptr) { - throw std::runtime_error(std::string(fn) + ": regs is null"); - } - - if (ps == nullptr || ps->num_input_semantics == 0) { - FillIdentityInterpolants(regs, 0); - APS5_LOG_CHARS_OUT("OK identity ps_inputs=0"); - return 0; - } - - if (ps->num_input_semantics != 0 && ps->input_semantics == nullptr) { - throw std::runtime_error(std::string(fn) + ": ps->input_semantics is null but num_input_semantics != 0"); - } - - if (gs == nullptr) { - throw std::runtime_error(std::string(fn) + ": gs is null"); - } - - if (gs->num_output_semantics != 0 && gs->output_semantics == nullptr) { - throw std::runtime_error(std::string(fn) + ": gs->output_semantics is null but num_output_semantics != 0"); - } - - for (std::uint32_t i = 0; i < ps->num_input_semantics; ++i) { - const ShaderSemantic& psSemantic = ps->input_semantics[i]; - const ShaderSemantic* gsSemantic = FindOutputSemantic(gs, psSemantic.semantic); - const std::uint32_t psWord = ShaderSemanticWord(psSemantic); - - std::uint32_t value = ((psWord & 0x00300000u) != 0) - ? CreateInterpolantF16Value(psWord, gsSemantic) - : CreateInterpolantNonF16Value(psWord, gsSemantic); - - value = (gsSemantic == nullptr) - ? CreateInterpolantDefaultValue(value, psWord) - : CreateInterpolantMappingValue(value, psWord, ShaderSemanticWord(*gsSemantic)); - - SetInterpolantRegister(regs, i, value); - } - - FillIdentityInterpolants(regs, ps->num_input_semantics); - APS5_LOG_OUT("OK ps_inputs=%u gs_outputs=%u", ps->num_input_semantics, gs->num_output_semantics); - return 0; -} - -} diff --git a/core/libs/prx/libSceAgc/Shader/include/CreateShader.hpp b/core/libs/prx/libSceAgc/Shader/include/CreateShader.hpp new file mode 100644 index 000000000..68117f473 --- /dev/null +++ b/core/libs/prx/libSceAgc/Shader/include/CreateShader.hpp @@ -0,0 +1,4 @@ +#ifndef CORE_LIBS_PRX_LIBSCEAGC_SHADER_INCLUDE_CREATESHADER_HPP +#define CORE_LIBS_PRX_LIBSCEAGC_SHADER_INCLUDE_CREATESHADER_HPP + +#endif diff --git a/core/libs/prx/libSceAgc/Shader/include/InterpolantMapping.hpp b/core/libs/prx/libSceAgc/Shader/include/InterpolantMapping.hpp new file mode 100644 index 000000000..91ffb9eeb --- /dev/null +++ b/core/libs/prx/libSceAgc/Shader/include/InterpolantMapping.hpp @@ -0,0 +1,4 @@ +#ifndef CORE_LIBS_PRX_LIBSCEAGC_SHADER_INCLUDE_INTERPOLANTMAPPING_HPP +#define CORE_LIBS_PRX_LIBSCEAGC_SHADER_INCLUDE_INTERPOLANTMAPPING_HPP + +#endif diff --git a/core/libs/prx/libSceAgc/Shader/include/PrimState.hpp b/core/libs/prx/libSceAgc/Shader/include/PrimState.hpp new file mode 100644 index 000000000..1dda27a82 --- /dev/null +++ b/core/libs/prx/libSceAgc/Shader/include/PrimState.hpp @@ -0,0 +1,4 @@ +#ifndef CORE_LIBS_PRX_LIBSCEAGC_SHADER_INCLUDE_PRIMSTATE_HPP +#define CORE_LIBS_PRX_LIBSCEAGC_SHADER_INCLUDE_PRIMSTATE_HPP + +#endif diff --git a/core/libs/prx/libSceAgc/Shader/ShaderConstants.hpp b/core/libs/prx/libSceAgc/Shader/include/ShaderConstants.hpp similarity index 93% rename from core/libs/prx/libSceAgc/Shader/ShaderConstants.hpp rename to core/libs/prx/libSceAgc/Shader/include/ShaderConstants.hpp index e5c719174..811e9cb55 100644 --- a/core/libs/prx/libSceAgc/Shader/ShaderConstants.hpp +++ b/core/libs/prx/libSceAgc/Shader/include/ShaderConstants.hpp @@ -1,5 +1,5 @@ -#ifndef CORE_LIBS_LIBSCEAGC_SHADER_SHADERS_HPP -#define CORE_LIBS_LIBSCEAGC_SHADER_SHADERS_HPP +#ifndef CORE_LIBS_PRX_LIBSCEAGC_SHADER_INCLUDE_SHADERCONSTANTS_HPP +#define CORE_LIBS_PRX_LIBSCEAGC_SHADER_INCLUDE_SHADERCONSTANTS_HPP #include diff --git a/core/libs/prx/libSceAgc/Shader/ShaderUtils.hpp b/core/libs/prx/libSceAgc/Shader/include/ShaderUtils.hpp similarity index 88% rename from core/libs/prx/libSceAgc/Shader/ShaderUtils.hpp rename to core/libs/prx/libSceAgc/Shader/include/ShaderUtils.hpp index 39f1b3b5d..f4cb9cb6e 100644 --- a/core/libs/prx/libSceAgc/Shader/ShaderUtils.hpp +++ b/core/libs/prx/libSceAgc/Shader/include/ShaderUtils.hpp @@ -1,9 +1,9 @@ -#ifndef CORE_LIBS_LIBSCEAGC_SHADER_UTILS_HPP -#define CORE_LIBS_LIBSCEAGC_SHADER_UTILS_HPP +#ifndef CORE_LIBS_PRX_LIBSCEAGC_SHADER_INCLUDE_SHADERUTILS_HPP +#define CORE_LIBS_PRX_LIBSCEAGC_SHADER_INCLUDE_SHADERUTILS_HPP #include #include "SceShaders.hpp" -#include "ShaderConstants.hpp" +#include "prx/libSceAgc/Shader/include/ShaderConstants.hpp" template void ResolveRelativePtr(T*& field) { diff --git a/core/libs/prx/libSceAgc/Shader/src/CreateShader.cpp b/core/libs/prx/libSceAgc/Shader/src/CreateShader.cpp new file mode 100644 index 000000000..e01095370 --- /dev/null +++ b/core/libs/prx/libSceAgc/Shader/src/CreateShader.cpp @@ -0,0 +1,67 @@ +#include "prx/libSceAgc/Shader/include/CreateShader.hpp" + +#include +#include +#include + +#include "SceShaders.hpp" +#include "prx/libSceAgc/Shader/include/ShaderUtils.hpp" +#include "prx/libSceAgc/Shader/include/ShaderConstants.hpp" + +extern "C" { + +int APS5_VABI sceAgcCreateShader(Shader** dst, void* header, const volatile void* code) { + constexpr auto fn = __func__; + if (dst == nullptr) { + throw std::runtime_error(std::string(fn) + ": dst is null"); + } + if (header == nullptr) { + throw std::runtime_error(std::string(fn) + ": header is null"); + } + if (code == nullptr) { + throw std::runtime_error(std::string(fn) + ": code is null"); + } + + auto* h = static_cast(header); + + ResolveRelativePtr(h->cx_registers); + ResolveRelativePtr(h->sh_registers); + ResolveRelativePtr(h->user_data); + ResolveRelativePtr(h->specials); + ResolveRelativePtr(h->input_semantics); + ResolveRelativePtr(h->output_semantics); + + if (h->user_data != nullptr) { + ResolveRelativePtr(h->user_data->direct_resource_offset); + ResolveRelativePtr(h->user_data->sharp_resource_offset[0]); + ResolveRelativePtr(h->user_data->sharp_resource_offset[1]); + ResolveRelativePtr(h->user_data->sharp_resource_offset[2]); + ResolveRelativePtr(h->user_data->sharp_resource_offset[3]); + } + + h->code = code; + + if (h->file_header != ShaderRegs::SHADER_FILE_HEADER_MAGIC) { + throw std::runtime_error(std::string(fn) + ": invalid file_header magic"); + } + if (h->version != ShaderRegs::SHADER_VERSION) { + throw std::runtime_error(std::string(fn) + ": unsupported shader version"); + } + + const auto base = reinterpret_cast(code); + + if ((base & ShaderRegs::SHADER_BASE_ALIGN_MASK) != 0) { + throw std::runtime_error(std::string(fn) + ": code address violates alignment mask"); + } + + int result = PatchProgramAddressRegister(h->sh_registers, h->num_sh_registers, h->type, base); + if (result != 0) { + return result; + } + + *dst = h; + APS5_LOG_OUT("OK type=%u sh_regs=%u shader_size=%u", h->type, h->num_sh_registers, h->shader_size); + return 0; +} + +} diff --git a/core/libs/prx/libSceAgc/Shader/src/InterpolantMapping.cpp b/core/libs/prx/libSceAgc/Shader/src/InterpolantMapping.cpp new file mode 100644 index 000000000..6dee8d72b --- /dev/null +++ b/core/libs/prx/libSceAgc/Shader/src/InterpolantMapping.cpp @@ -0,0 +1,59 @@ +#include "prx/libSceAgc/Shader/include/InterpolantMapping.hpp" + +#include +#include +#include + +#include "SceShaders.hpp" +#include "prx/libSceAgc/Shader/include/ShaderUtils.hpp" +#include "prx/libSceAgc/Shader/include/ShaderConstants.hpp" + +extern "C" { + +APS5_EXPORT("HV4j+E0MBHE", sceAgcCreateInterpolantMapping); +int APS5_VABI sceAgcCreateInterpolantMapping(ShaderRegister* regs, const Shader* gs, const Shader* ps) { + constexpr auto fn = __func__; + if (regs == nullptr) { + throw std::runtime_error(std::string(fn) + ": regs is null"); + } + + if (ps == nullptr || ps->num_input_semantics == 0) { + FillIdentityInterpolants(regs, 0); + APS5_LOG_CHARS_OUT("OK identity ps_inputs=0"); + return 0; + } + + if (ps->num_input_semantics != 0 && ps->input_semantics == nullptr) { + throw std::runtime_error(std::string(fn) + ": ps->input_semantics is null but num_input_semantics != 0"); + } + + if (gs == nullptr) { + throw std::runtime_error(std::string(fn) + ": gs is null"); + } + + if (gs->num_output_semantics != 0 && gs->output_semantics == nullptr) { + throw std::runtime_error(std::string(fn) + ": gs->output_semantics is null but num_output_semantics != 0"); + } + + for (std::uint32_t i = 0; i < ps->num_input_semantics; ++i) { + const ShaderSemantic& psSemantic = ps->input_semantics[i]; + const ShaderSemantic* gsSemantic = FindOutputSemantic(gs, psSemantic.semantic); + const std::uint32_t psWord = ShaderSemanticWord(psSemantic); + + std::uint32_t value = ((psWord & 0x00300000u) != 0) + ? CreateInterpolantF16Value(psWord, gsSemantic) + : CreateInterpolantNonF16Value(psWord, gsSemantic); + + value = (gsSemantic == nullptr) + ? CreateInterpolantDefaultValue(value, psWord) + : CreateInterpolantMappingValue(value, psWord, ShaderSemanticWord(*gsSemantic)); + + SetInterpolantRegister(regs, i, value); + } + + FillIdentityInterpolants(regs, ps->num_input_semantics); + APS5_LOG_OUT("OK ps_inputs=%u gs_outputs=%u", ps->num_input_semantics, gs->num_output_semantics); + return 0; +} + +} diff --git a/core/libs/prx/libSceAgc/Shader/src/PrimState.cpp b/core/libs/prx/libSceAgc/Shader/src/PrimState.cpp new file mode 100644 index 000000000..640d228ae --- /dev/null +++ b/core/libs/prx/libSceAgc/Shader/src/PrimState.cpp @@ -0,0 +1,68 @@ +#include "prx/libSceAgc/Shader/include/PrimState.hpp" + +#include +#include +#include + +#include "SceShaders.hpp" +#include "prx/libSceAgc/Shader/include/ShaderUtils.hpp" +#include "prx/libSceAgc/Shader/include/ShaderConstants.hpp" + +extern "C" { + +int APS5_VABI sceAgcCreatePrimState(ShaderRegister* cx_regs, ShaderRegister* uc_regs, const Shader* hs, const Shader* gs, std::uint32_t prim_type) { + if (cx_regs == nullptr && uc_regs == nullptr) { + return 0; + } + if (gs == nullptr) { + throw std::runtime_error(std::string(__func__) + ": gs is null"); + } + + if (cx_regs != nullptr) { + cx_regs[0] = gs->specials->vgt_shader_stages_en; + if ((cx_regs[0].value & ShaderRegs::VGT_SHADER_STAGES_GS_BIT) != 0) { + cx_regs[1] = gs->specials->vgt_gs_out_prim_type; + } else { + cx_regs[1].offset = ShaderRegs::VGT_GS_OUT_PRIM_TYPE; + cx_regs[1].value = GraphicsPrimTypeToGsOut(prim_type); + } + + if (hs != nullptr) { + cx_regs[0].value |= hs->specials->vgt_shader_stages_en.value; + if ((cx_regs[0].value & ShaderRegs::VGT_SHADER_STAGES_GS_BIT) == 0) { + cx_regs[1] = hs->specials->vgt_gs_out_prim_type; + } + } + } + + if (uc_regs != nullptr) { + uc_regs[0] = gs->specials->ge_cntl; + uc_regs[1] = gs->specials->ge_user_vgpr_en; + uc_regs[2].offset = ShaderRegs::VGT_PRIMITIVE_TYPE; + uc_regs[2].value = prim_type; + + if (hs != nullptr) { + uc_regs[1] = hs->specials->ge_user_vgpr_en; + } + } + + APS5_LOG_OUT("OK prim_type=%u", prim_type); + return 0; +} + +int APS5_VABI sceAgcUpdatePrimState(ShaderRegister* cx_regs, ShaderRegister* uc_regs, std::uint32_t prim_type) { + if (cx_regs != nullptr && (cx_regs[0].value & (ShaderRegs::VGT_SHADER_STAGES_GS_BIT | ShaderRegs::VGT_SHADER_STAGES_NGG_BIT)) == 0) { + cx_regs[1].value &= ~0x7u; + cx_regs[1].value |= GraphicsPrimTypeToGsOut(prim_type); + } + + if (uc_regs != nullptr) { + uc_regs[2].value &= ~0x1Fu; + uc_regs[2].value |= prim_type; + } + + APS5_LOG_OUT("OK prim_type=%u", prim_type); + return 0; +} + +} diff --git a/core/libs/prx/libSceAgc/Shader/ShaderUtils.cpp b/core/libs/prx/libSceAgc/Shader/src/ShaderUtils.cpp similarity index 99% rename from core/libs/prx/libSceAgc/Shader/ShaderUtils.cpp rename to core/libs/prx/libSceAgc/Shader/src/ShaderUtils.cpp index a38969dc5..9eb22bdb4 100644 --- a/core/libs/prx/libSceAgc/Shader/ShaderUtils.cpp +++ b/core/libs/prx/libSceAgc/Shader/src/ShaderUtils.cpp @@ -1,5 +1,5 @@ #include -#include "ShaderUtils.hpp" +#include "prx/libSceAgc/Shader/include/ShaderUtils.hpp" using namespace ShaderRegs;