mirror of
https://github.com/KytyPS5/KytyPS5.git
synced 2026-10-20 10:56:58 +02:00
graphics: synchronize host file writes and depth clipping
Map paired PS5 depth-clip state through Vulkan pipeline creation and preserve asymmetric hard failures. Prepare GPU-mapped guest ranges before kernel file reads so buffer, texture, and alias ownership remains coherent. Add focused regression coverage and update the current launch target.
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
#include "common/logging/log.h"
|
||||
#include "common/stringUtils.h"
|
||||
#include "common/threads.h"
|
||||
#include "kernel/memory.h"
|
||||
#include "libs/errno.h"
|
||||
#include "libs/libs.h"
|
||||
#include "libs/network.h"
|
||||
@@ -502,6 +503,11 @@ int64_t KYTY_SYSV_ABI KernelRead(int d, void* buf, size_t nbytes) {
|
||||
file->mutex.Lock();
|
||||
|
||||
bool is_invalid = file->f.IsInvalid();
|
||||
const auto pos = file->f.Tell();
|
||||
const auto file_size = file->f.Size();
|
||||
const auto remaining = pos < file_size ? file_size - pos : 0;
|
||||
Memory::PrepareHostWrite(reinterpret_cast<uint64_t>(buf),
|
||||
std::min<uint64_t>(nbytes, remaining));
|
||||
uint32_t bytes_read = 0;
|
||||
file->f.Read(buf, static_cast<uint32_t>(nbytes), &bytes_read);
|
||||
|
||||
@@ -622,6 +628,12 @@ int64_t KYTY_SYSV_ABI KernelPread(int d, void* buf, size_t nbytes, int64_t offse
|
||||
|
||||
bool is_invalid = file->f.IsInvalid();
|
||||
auto pos = file->f.Tell();
|
||||
const auto file_size = file->f.Size();
|
||||
const auto remaining = static_cast<uint64_t>(offset) < file_size
|
||||
? file_size - static_cast<uint64_t>(offset)
|
||||
: 0;
|
||||
Memory::PrepareHostWrite(reinterpret_cast<uint64_t>(buf),
|
||||
std::min<uint64_t>(nbytes, remaining));
|
||||
uint32_t bytes_read = 0;
|
||||
file->f.Seek(offset);
|
||||
file->f.Read(buf, static_cast<uint32_t>(nbytes), &bytes_read);
|
||||
|
||||
@@ -882,6 +882,13 @@ void WriteBacking(uint64_t vaddr, const void* data, uint64_t size) noexcept {
|
||||
}
|
||||
}
|
||||
|
||||
void PrepareHostWrite(uint64_t vaddr, uint64_t size) {
|
||||
if (size == 0 || Graphics::g_render_ctx == nullptr) {
|
||||
return;
|
||||
}
|
||||
Graphics::g_render_ctx->GetGpuResources()->PrepareHostWrite(vaddr, size);
|
||||
}
|
||||
|
||||
struct PrtAperture {
|
||||
uint64_t address = 0;
|
||||
uint64_t size = 0;
|
||||
|
||||
@@ -99,6 +99,7 @@ void SetFlexibleMemorySize(uint64_t size);
|
||||
bool TryWriteBacking(uint64_t vaddr, const void* data, uint64_t size);
|
||||
bool TryReadBacking(uint64_t vaddr, void* data, uint64_t size);
|
||||
void WriteBacking(uint64_t vaddr, const void* data, uint64_t size) noexcept;
|
||||
void PrepareHostWrite(uint64_t vaddr, uint64_t size);
|
||||
|
||||
int KYTY_SYSV_ABI KernelMapNamedFlexibleMemory(void** addr_in_out, size_t len, int prot, int flags,
|
||||
const char* name);
|
||||
|
||||
Reference in New Issue
Block a user