yuzu-emu
/
yuzu
Archived
1
0
Fork 0

GPU: Fix buffer cache issue, engine upload not inlining memory in multiline and pessismistic invalidation.

This commit is contained in:
Fernando Sahmkow 2022-11-24 14:02:58 +01:00
parent 168c9ee341
commit 3b582d5fb2
4 changed files with 9 additions and 15 deletions

View File

@ -1742,12 +1742,12 @@ bool BufferCache<P>::InlineMemory(VAddr dest_address, size_t copy_size,
SynchronizeBuffer(buffer, dest_address, static_cast<u32>(copy_size)); SynchronizeBuffer(buffer, dest_address, static_cast<u32>(copy_size));
if constexpr (USE_MEMORY_MAPS) { if constexpr (USE_MEMORY_MAPS) {
auto upload_staging = runtime.UploadStagingBuffer(copy_size);
std::array copies{BufferCopy{ std::array copies{BufferCopy{
.src_offset = 0, .src_offset = upload_staging.offset,
.dst_offset = buffer.Offset(dest_address), .dst_offset = buffer.Offset(dest_address),
.size = copy_size, .size = copy_size,
}}; }};
auto upload_staging = runtime.UploadStagingBuffer(copy_size);
u8* const src_pointer = upload_staging.mapped_span.data(); u8* const src_pointer = upload_staging.mapped_span.data();
std::memcpy(src_pointer, inlined_buffer.data(), copy_size); std::memcpy(src_pointer, inlined_buffer.data(), copy_size);
runtime.CopyBuffer(buffer, upload_staging.buffer, copies); runtime.CopyBuffer(buffer, upload_staging.buffer, copies);

View File

@ -51,11 +51,11 @@ void State::ProcessData(std::span<const u8> read_buffer) {
} else { } else {
for (u32 line = 0; line < regs.line_count; ++line) { for (u32 line = 0; line < regs.line_count; ++line) {
const GPUVAddr dest_line = address + static_cast<size_t>(line) * regs.dest.pitch; const GPUVAddr dest_line = address + static_cast<size_t>(line) * regs.dest.pitch;
memory_manager.WriteBlockUnsafe( std::span<const u8> buffer(read_buffer.data() +
dest_line, read_buffer.data() + static_cast<size_t>(line) * regs.line_length_in, static_cast<size_t>(line) * regs.line_length_in,
regs.line_length_in); regs.line_length_in);
rasterizer->AccelerateInlineToMemory(dest_line, regs.line_length_in, buffer);
} }
memory_manager.InvalidateRegion(address, regs.dest.pitch * regs.line_count);
} }
} else { } else {
u32 width = regs.dest.width; u32 width = regs.dest.width;

View File

@ -249,9 +249,6 @@ void Maxwell3D::ProcessMethodCall(u32 method, u32 argument, u32 nonshadow_argume
return; return;
case MAXWELL3D_REG_INDEX(fragment_barrier): case MAXWELL3D_REG_INDEX(fragment_barrier):
return rasterizer->FragmentBarrier(); return rasterizer->FragmentBarrier();
case MAXWELL3D_REG_INDEX(invalidate_texture_data_cache):
rasterizer->InvalidateGPUCache();
return rasterizer->WaitForIdle();
case MAXWELL3D_REG_INDEX(tiled_cache_barrier): case MAXWELL3D_REG_INDEX(tiled_cache_barrier):
return rasterizer->TiledCacheBarrier(); return rasterizer->TiledCacheBarrier();
} }
@ -511,10 +508,7 @@ void Maxwell3D::ProcessCounterReset() {
void Maxwell3D::ProcessSyncPoint() { void Maxwell3D::ProcessSyncPoint() {
const u32 sync_point = regs.sync_info.sync_point.Value(); const u32 sync_point = regs.sync_info.sync_point.Value();
const u32 cache_flush = regs.sync_info.clean_l2.Value(); [[maybe_unused]] const u32 cache_flush = regs.sync_info.clean_l2.Value();
if (cache_flush != 0) {
rasterizer->InvalidateGPUCache();
}
rasterizer->SignalSyncPoint(sync_point); rasterizer->SignalSyncPoint(sync_point);
} }

View File

@ -118,7 +118,7 @@ void Puller::ProcessSemaphoreRelease() {
std::function<void()> operation([this, sequence_address, payload] { std::function<void()> operation([this, sequence_address, payload] {
memory_manager.Write<u32>(sequence_address, payload); memory_manager.Write<u32>(sequence_address, payload);
}); });
rasterizer->SyncOperation(std::move(operation)); rasterizer->SignalFence(std::move(operation));
} }
void Puller::ProcessSemaphoreAcquire() { void Puller::ProcessSemaphoreAcquire() {
@ -151,8 +151,8 @@ void Puller::CallPullerMethod(const MethodCall& method_call) {
case BufferMethods::SemaphoreAddressLow: case BufferMethods::SemaphoreAddressLow:
case BufferMethods::SemaphoreSequencePayload: case BufferMethods::SemaphoreSequencePayload:
case BufferMethods::SyncpointPayload: case BufferMethods::SyncpointPayload:
break;
case BufferMethods::WrcacheFlush: case BufferMethods::WrcacheFlush:
break;
case BufferMethods::RefCnt: case BufferMethods::RefCnt:
rasterizer->SignalReference(); rasterizer->SignalReference();
break; break;