From 05243b86ff8bf9e5f7d0873097b5892bdbe3c4a5 Mon Sep 17 00:00:00 2001 From: Burhan Rajgara Date: Thu, 2 Jan 2025 20:01:54 -0800 Subject: [PATCH] fixed texture copy more --- src/pica/hostshaders/gpu.frag | 2 +- src/services/gsp.c | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/pica/hostshaders/gpu.frag b/src/pica/hostshaders/gpu.frag index cf6c132..14a7539 100644 --- a/src/pica/hostshaders/gpu.frag +++ b/src/pica/hostshaders/gpu.frag @@ -100,7 +100,7 @@ void calc_lighting(out vec4 primary, out vec4 secondary) { } else { l = normalize(quatrot(nq, view + light[i].vec.xyz)); } - vec3 h = normalize((l + v) / 2); + vec3 h = normalize(l + v); // right now we just use phong shading // TODO: implement this properly diff --git a/src/services/gsp.c b/src/services/gsp.c index f64a2d5..ae01dea 100644 --- a/src/services/gsp.c +++ b/src/services/gsp.c @@ -298,17 +298,20 @@ void gsp_handle_command(E3DS* s) { addrin, pitchin, gapin, addrout, pitchout, gapout, copysize, flags); - // texture copy can be used to copy between framebuffers and this wont work right now - u8* src = PTR(addrin); u8* dst = PTR(addrout); int cnt = 0; + int curline = 0; while (cnt < copysize) { memcpy(dst, src, pitchin); cnt += pitchin; + curline += pitchin; src += pitchin + gapin; - dst += pitchout + gapout; + if (curline >= pitchout) { + dst += pitchout + gapout; + curline = 0; + } } gsp_handle_event(s, GSPEVENT_PPF);