mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-29 12:15:39 +00:00
refactor(graphics): add new graphics pipeline log + remove redunant ones
This commit is contained in:
1 parent
8be7c9d191
commit
3da76b9b33
6 files changed
+23
-9
No files matched your search
@@ -63,7 +63,7 @@ int APS5_VABI sceAgcCreateShader(Shader** dst, void* header, const volatile void
|
||||
|
||||
AgcDriverRegisterShader_nid_postfix(h);
|
||||
*dst = h;
|
||||
APS5_LOG_OUT_IF(APS5_AGC_CREATE_LOG, "OK type=%u sh_regs=%u shader_size=%u", h->type, h->num_sh_registers, h->shader_size);
|
||||
// APS5_LOG_OUT_IF(APS5_AGC_CREATE_LOG, "OK type=%u sh_regs=%u shader_size=%u", h->type, h->num_sh_registers, h->shader_size);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "prx/libSceAgcDriver/Execution/include/Pm4.hpp"
|
||||
#include "prx/libSceAgcDriver/Execution/include/GuestMemory.hpp"
|
||||
#include "prx/libc/include/General.hpp"
|
||||
#include <algorithm>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
@@ -31,6 +32,7 @@ Registers& registersFor(QueueState& queue, std::uint32_t opcode) {
|
||||
}
|
||||
|
||||
void writeRegister(QueueState& queue, std::uint32_t opcode, std::uint32_t offset, std::uint32_t value) {
|
||||
if ((opcode == 0x69 || opcode == 0x9f) && (offset == 0x8e || offset == 0x8f || offset == 0x318 || offset == 0x31b || offset == 0x31c || offset == 0x31d || offset == 0x390 || offset == 0x3b0 || offset == 0x3b8)) APS5_LOG_OUT("CONTEXT WRITE opcode=0x%x offset=0x%x value=0x%x", opcode, offset, value);
|
||||
registersFor(queue, opcode).insert_or_assign(offset, value);
|
||||
if ((opcode == 0x64 || opcode == 0x79 || opcode == 0x7a) && offset == 0x243) queue.indexType = value & 3u;
|
||||
}
|
||||
@@ -257,6 +259,7 @@ IndexedDraw ResolveDraw(std::span<const std::uint32_t> packet, const QueueState&
|
||||
const auto bytes = static_cast<std::uint64_t>(packet[3]) * indexSize;
|
||||
require(bytes <= std::numeric_limits<std::size_t>::max(), "index range size overflow");
|
||||
GuestMemory::CheckRange(reinterpret_cast<const void*>(address), static_cast<std::size_t>(bytes), indexSize);
|
||||
APS5_LOG_OUT("ResolveDraw context targetMask=0x%x shaderMask=0x%x indexCount=%u indexType=%u instances=%u", queue.context.contains(0x8e) ? queue.context.at(0x8e) : 0u, queue.context.contains(0x8f) ? queue.context.at(0x8f) : 0u, packet[3], queue.indexType, queue.instanceCount);
|
||||
return {address, packet[3], indexSize, queue.instanceCount, packet[4]};
|
||||
}
|
||||
|
||||
@@ -273,6 +276,7 @@ void Execute(std::span<const std::uint32_t> packet, QueueState& queue) {
|
||||
queue.markers.pop_back();
|
||||
return;
|
||||
case 0x1a:
|
||||
APS5_LOG_OUT("CONTEXT_STATE operation=%u targetMaskBefore=0x%x shaderMaskBefore=0x%x", packet[1], queue.context.contains(0x8e) ? queue.context.at(0x8e) : 0u, queue.context.contains(0x8f) ? queue.context.at(0x8f) : 0u);
|
||||
switch (packet[1]) {
|
||||
case 0: queue.ClearContext(); break;
|
||||
case 1: case 3:
|
||||
@@ -286,13 +290,16 @@ void Execute(std::span<const std::uint32_t> packet, QueueState& queue) {
|
||||
queue.savedContext.reset();
|
||||
break;
|
||||
}
|
||||
APS5_LOG_OUT("CONTEXT_STATE done operation=%u targetMaskAfter=0x%x shaderMaskAfter=0x%x", packet[1], queue.context.contains(0x8e) ? queue.context.at(0x8e) : 0u, queue.context.contains(0x8f) ? queue.context.at(0x8f) : 0u);
|
||||
return;
|
||||
default: throw std::runtime_error("custom packet requires driver execution");
|
||||
}
|
||||
case 0x11:
|
||||
((packet[0] & 2u) == 0 ? queue.drawIndirectBase : queue.dispatchIndirectBase) = address(packet[2], packet[3]);
|
||||
return;
|
||||
case 0x12: queue.ClearContext(); return;
|
||||
case 0x12:
|
||||
APS5_LOG_OUT("CLEAR_STATE targetMaskBefore=0x%x shaderMaskBefore=0x%x", queue.context.contains(0x8e) ? queue.context.at(0x8e) : 0u, queue.context.contains(0x8f) ? queue.context.at(0x8f) : 0u);
|
||||
queue.ClearContext(); return;
|
||||
case 0x13: queue.indexBufferSize = packet[1]; return;
|
||||
case 0x26: queue.indexBase = address(packet[1], packet[2]); return;
|
||||
case 0x2a: queue.indexType = packet[1]; return;
|
||||
|
||||
@@ -29,12 +29,12 @@ FileStream* APS5_VABI fopen_nid_postfix(const char* filename, const char* mode)
|
||||
}
|
||||
}
|
||||
if (!sibling.empty()) {
|
||||
APS5_LOG_OUT("%s: \"%s\": %s. Sibling: \"%s\"", FOPEN_MSG_NOT_FOUND, abs_path.c_str(), reason, sibling.filename().string().c_str());
|
||||
// APS5_LOG_OUT("%s: \"%s\": %s. Sibling: \"%s\"", FOPEN_MSG_NOT_FOUND, abs_path.c_str(), reason, sibling.filename().string().c_str());
|
||||
return nullptr;
|
||||
}
|
||||
throw std::runtime_error(std::string(__func__) + ": " + FOPEN_MSG_OPEN_FAILED + ": \"" + abs_path + "\": " + reason);
|
||||
}
|
||||
APS5_LOG_OUT("success: \"%s\"", abs_path.c_str());
|
||||
// APS5_LOG_OUT("success: \"%s\"", abs_path.c_str());
|
||||
auto stream = std::make_unique<FileStream>(handle.get(), true);
|
||||
handle.release();
|
||||
return stream.release();
|
||||
|
||||
@@ -39,7 +39,7 @@ static void FinishThread(PthreadPrivate* self, void* retval) {
|
||||
}
|
||||
|
||||
static void RunThread(std::unique_ptr<ThreadArgs> args) {
|
||||
fprintf(stdout, "RunThread started\n");
|
||||
APS5_LOG_OUT("RunThread entry=0x%llx arg=%p self=%p", static_cast<unsigned long long>(reinterpret_cast<std::uintptr_t>(args->entry)), args->arg, static_cast<void*>(args->self));
|
||||
const auto entry = args->entry;
|
||||
void* arg = args->arg;
|
||||
PthreadPrivate* self = args->self;
|
||||
|
||||
@@ -240,8 +240,12 @@ WindowsEntryStub WindowsEntryStubBuilder::Build(const std::uint32_t dataRva, con
|
||||
code.Emit({0x8d, 0x48, 1});
|
||||
code.Rip({0x48, 0x8d, 0x3d}, resolvedPaths[index]);
|
||||
code.Emit({0xf3, 0xa4});
|
||||
writeString(loading);
|
||||
writeString(resolvedPaths[index]);
|
||||
|
||||
if (dependencyDiagnostics) {
|
||||
writeString(loading);
|
||||
writeString(resolvedPaths[index]);
|
||||
}
|
||||
|
||||
code.Rip({0x48, 0x8d, 0x0d}, resolvedPaths[index]);
|
||||
code.Emit({0x31, 0xd2, 0x41, 0xb8, 0, 0x11, 0, 0});
|
||||
call("LoadLibraryExA");
|
||||
@@ -258,7 +262,10 @@ WindowsEntryStub WindowsEntryStubBuilder::Build(const std::uint32_t dataRva, con
|
||||
raise(0xc0000135u);
|
||||
code.PatchBranch(loadSucceeded, code.GetRva());
|
||||
code.Rip({0x48, 0x89, 0x05}, CheckedRva(handles + index * 8));
|
||||
writeString(loaded);
|
||||
|
||||
if (dependencyDiagnostics) {
|
||||
writeString(loaded);
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<std::size_t> unresolvedBranches;
|
||||
|
||||
@@ -129,7 +129,7 @@ RecompileResult RecompileImpl(const RecompileRequest& request) {
|
||||
}
|
||||
|
||||
RecompileResult Recompile(const RecompileRequest& request) {
|
||||
// return RecompileDummy(request);
|
||||
return RecompileDummy(request);
|
||||
try {
|
||||
return RecompileImpl(request);
|
||||
} catch (const std::exception& e) {
|
||||
|
||||
Reference in new issue
Block a user