From: notaz Date: Mon, 14 Nov 2022 22:57:47 +0000 (+0200) Subject: gpulib: allow commands to span list entries X-Git-Tag: r24~278 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ae36bb287237de0a199f52de86dbfc6115d4cb70;p=pcsx_rearmed.git gpulib: allow commands to span list entries libretro/pcsx_rearmed#271 --- diff --git a/plugins/gpulib/gpu.c b/plugins/gpulib/gpu.c index f468cf8b..e9714e4c 100644 --- a/plugins/gpulib/gpu.c +++ b/plugins/gpulib/gpu.c @@ -551,12 +551,22 @@ long GPUdmaChain(uint32_t *rambase, uint32_t start_addr, uint32_t *progress_addr if (len > 0) cpu_cycles += 5 + len; - log_io(".chain %08x #%d\n", (list - rambase) * 4, len); + log_io(".chain %08lx #%d+%d\n", + (long)(list - rambase) * 4, len, gpu.cmd_len); + if (unlikely(gpu.cmd_len > 0)) { + memcpy(gpu.cmd_buffer + gpu.cmd_len, list + 1, len * 4); + gpu.cmd_len += len; + flush_cmd_buffer(); + continue; + } if (len) { left = do_cmd_buffer(list + 1, len); - if (left) - log_anomaly("GPUdmaChain: discarded %d/%d words\n", left, len); + if (left) { + memcpy(gpu.cmd_buffer, list + 1 + len - left, left * 4); + gpu.cmd_len = left; + log_anomaly("GPUdmaChain: %d/%d words left\n", left, len); + } } if (progress_addr) {