From bd309b4639fc683e53c9ba387f5a5a738d21a2f1 Mon Sep 17 00:00:00 2001 From: Floogle <18466542+skyfloogle@users.noreply.github.com> Date: Wed, 19 Jun 2024 23:51:41 +0200 Subject: [PATCH] simplify repeated affine multimap --- gfx/maps/map1x1.png | Bin 312 -> 83 bytes gfx/maps/map1x1.t3s | 2 +- gfx/maps/map1x2.png | Bin 319 -> 89 bytes gfx/maps/map1x2.t3s | 2 +- gfx/maps/map1x4.png | Bin 326 -> 97 bytes gfx/maps/map1x4.t3s | 2 +- gfx/maps/map1x8.png | Bin 324 -> 95 bytes gfx/maps/map1x8.t3s | 2 +- gfx/maps/map2x1.png | Bin 317 -> 87 bytes gfx/maps/map2x1.t3s | 2 +- gfx/maps/map2x2.png | Bin 322 -> 93 bytes gfx/maps/map2x2.t3s | 2 +- gfx/maps/map2x4.png | Bin 322 -> 93 bytes gfx/maps/map2x4.t3s | 2 +- gfx/maps/map4x1.png | Bin 321 -> 92 bytes gfx/maps/map4x1.t3s | 2 +- gfx/maps/map4x2.png | Bin 321 -> 92 bytes gfx/maps/map4x2.t3s | 2 +- gfx/maps/map4x4.png | Bin 322 -> 93 bytes gfx/maps/map4x4.t3s | 2 +- gfx/maps/map8x1.png | Bin 321 -> 92 bytes gfx/maps/map8x1.t3s | 2 +- gfx/maps/map8x2.png | Bin 322 -> 93 bytes gfx/maps/map8x2.t3s | 2 +- gfx/maps/map8x4.png | Bin 322 -> 93 bytes gfx/maps/map8x4.t3s | 2 +- source/3ds/video_hard.c | 17 +++++------------ 27 files changed, 18 insertions(+), 25 deletions(-) diff --git a/gfx/maps/map1x1.png b/gfx/maps/map1x1.png index b447573ea2b8275e54ef42226e0041c7f9cfc547..58e329d72dcf2b4a16c0ea712431384221c3c619 100644 GIT binary patch delta 53 zcmdnN6g)vipEI(3)EF2VS{N990fib~ zFff!FFfhDIU|_JC!N4G1FlSew4N!tDz$e7@e|`PGfB({CXQ%>27?Zr+T^Ro}>D~i! z*h@TpUD;nSON$6AY`^;XJ5Y$*)5S4_<9c#}11kfA00ZN~qlyQC!m1^%5hW>!C8<`) zMX5lF!N|bKMAyJr*T_7?$iT|b(#ptG+rYrez(CB6c?yb#-29Zxv`X9>(xrE605xd9 kZ79jiO)V}-%q_swV{8Pm#FBZ*bD$muPgg&ebxsLQ0D&G*7XSbN diff --git a/gfx/maps/map1x1.t3s b/gfx/maps/map1x1.t3s index a445f13..c254a5c 100644 --- a/gfx/maps/map1x1.t3s +++ b/gfx/maps/map1x1.t3s @@ -1,2 +1,2 @@ --f rgb8 -z auto +-f rgba4 -z auto map1x1.png diff --git a/gfx/maps/map1x2.png b/gfx/maps/map1x2.png index 8580367a719a4265f7b31b7215cb902187904832..5686857a09a961bed24b281e1a16f5d4ef21a72f 100644 GIT binary patch delta 71 zcmdnb6gfe{k&&5!f#KglofANcEx;$lmEk`SGF+VPwGJr4=jq}YQZXkvp`q!&00)Br W1M}aUPJR=h41=eupUXO@geCyxa1^ot literal 319 zcmeAS@N?(olHy`uVBq!ia0vp^93afZ3?z3ZhDiV^g=CK)Uj~LMH3o);76yi2K%s^g z3=E|P3=FRl7#OT(FffQ0%-I!a1C-zl@Ck9P{||)q|NsBD*~a+_D9D)P?e4;q#$A&F z^^LL;Szo(012*>s01P7*t3kz5n1UQ&hMtuIU87QS%;u=ws zl30>zm0Xkxq!^40j7)S5jCGC7LyQcp3@xpUOtlRRtPBjq+?c1JXvob^$xN%ntsz}{ qw+2vy2Hb{{%-q!ClEmBsOg+X%5KAnXmpljRVeoYIb6Mw<&;$U_##8bD diff --git a/gfx/maps/map1x2.t3s b/gfx/maps/map1x2.t3s index 3a50eff..9b1afdc 100644 --- a/gfx/maps/map1x2.t3s +++ b/gfx/maps/map1x2.t3s @@ -1,2 +1,2 @@ --f rgb8 -z auto +-f rgba4 -z auto map1x2.png diff --git a/gfx/maps/map1x4.png b/gfx/maps/map1x4.png index 5c2355d76f1a0875ebaaa72425e8666c4dec2950..9c1738591d002add2ccbe391c47d8e4e1d594b75 100644 GIT binary patch delta 67 zcmX@clsG}fmNUR7#FYUE{sSSy_xVx_fox$<7srr_ImrnQObZt(Y{?Q8U}O+sVg4&| RG%pmS*3;F`Wt~$(69AHV6Gi|4 literal 326 zcmeAS@N?(olHy`uVBq!ia0vp^93afZ3?z3ZhDiV^g=CK)Uj~LMH3o);76yi2K%s^g z3=E|P3=FRl7#OT(FffQ0%-I!a1C-zi@Ck8kXlSVa4}|sq|NpO+Z#e`MXH4>TcVQOf z@%aSgu$OrHy0X7umKG6K*nai%cc754r;B3<$Mxg{2d0G!6}DuF3NSK=urU8s4?L3# zlvXWqjVMV;EJ?LWE=mPb3`Pb%fo&)tTc)I$ztaD0e0st3rRet~g diff --git a/gfx/maps/map1x4.t3s b/gfx/maps/map1x4.t3s index ed4aeee..64d70df 100644 --- a/gfx/maps/map1x4.t3s +++ b/gfx/maps/map1x4.t3s @@ -1,2 +1,2 @@ --f rgb8 -z auto +-f rgba4 -z auto map1x4.png diff --git a/gfx/maps/map1x8.png b/gfx/maps/map1x8.png index 416105d9defdd1a0bfe95792c944d8a8c3c7c5c9..e40719c46872844705859e7ffa49d468e2704e0a 100644 GIT binary patch delta 65 zcmX@Y6hA@5nlr#B#FYUE{sSSy_xVx_fowrf7srr_ImrnJ7#1$%Sslj6z$(o6|E_5D PQIJYcS3j3^P6TcVQOf z@%aSgu$OrHy0X7umKG6K*nai%cc74gTe~DWM4fFQZl- diff --git a/gfx/maps/map1x8.t3s b/gfx/maps/map1x8.t3s index 0d51bce..bb79956 100644 --- a/gfx/maps/map1x8.t3s +++ b/gfx/maps/map1x8.t3s @@ -1,2 +1,2 @@ --f rgb8 -z auto +-f rgba4 -z auto map1x8.png diff --git a/gfx/maps/map2x1.png b/gfx/maps/map2x1.png index 79b6e6ac01f87b0bd2a7b518020f9c33fe84bec2..d86c6cefb6f431aee69dd8cab5754655e16989c4 100644 GIT binary patch delta 69 zcmdnX6h1-1o{^b>f#KglofANcEx;$l^*@mDpW#yb`$8at$J50zq+(9;gLH>R2IdP4 Um2S2y?||YAp00i_>zopr0MKI<2LJ#7 literal 317 zcmeAS@N?(olHy`uVBq!ia0vp^93afZ3?z3ZhDiV^g=CK)Uj~LMH3o);76yi2K%s^g z3=E|P3=FRl7#OT(FffQ0%-I!a1C-zl@CkAKUteGUzyAOK|I7L`Oo4)oN#5=*OljOT zDL@W;iKnkC`wM1i5n+YxS3iFT3h{cnIEHXsPfp-SJv4Vyxm=x z1$lfv0Xgg?p1!W^FPNo8gcY`5{rnv$#P8|i7{YNqIl+Nx;pzt*4B}zTfA3#BI~gdY zTH+c}l9E`GYL#4+3Zxi}42(>44UBb-%tMR}tPCx!j7+r+46FS6G7^>bP0l+XkKE)rI! diff --git a/gfx/maps/map2x2.t3s b/gfx/maps/map2x2.t3s index 6e7f10d..e5868db 100644 --- a/gfx/maps/map2x2.t3s +++ b/gfx/maps/map2x2.t3s @@ -1,2 +1,2 @@ --f rgb8 -z auto +-f rgba4 -z auto map2x2.png diff --git a/gfx/maps/map2x4.png b/gfx/maps/map2x4.png index 44080cb4c3d2cb2d1ca739158d9460846f02dd04..1b51eb4f99e26fb2afb44b1d42bbdc53540db98a 100644 GIT binary patch delta 63 zcmX@a6gxr1k~6?3#Fc@8;XfFEY2IH4Wbk{sIEGZrNlrMxuyAz)2LtO~#{X*!FU|)_ OF?hQAxvXv4Vyxm=x z1$lfv0Xgg?p1!W^FPNo8gcY`5{rnv$#P8|i7{YNqIpF}q!qp8N46J(@|1WuSTpuW< zTH+c}l9E`GYL#4+3Zxi}42(>44UBb-%tMR}tPCx!j7+r+46FS6G7^>bP0l+XkKBm7p7 diff --git a/gfx/maps/map2x4.t3s b/gfx/maps/map2x4.t3s index 5d7aa48..67b5ec6 100644 --- a/gfx/maps/map2x4.t3s +++ b/gfx/maps/map2x4.t3s @@ -1,2 +1,2 @@ --f rgb8 -z auto +-f rgba4 -z auto map2x4.png diff --git a/gfx/maps/map4x1.png b/gfx/maps/map4x1.png index 129b7a9499504f1ad1e354cbf9821bbeb0ab9d86..ad40cebbced22332651de7cea584b25b22b9ba90 100644 GIT binary patch delta 62 zcmX@e6f;4^f-}G;#PvS|0|N*%FnB1j14%wl7srr_ImrpJM;mw<8SGV9D}yV43xO1P My85}Sb4q9e0PRT-8~^|S literal 321 zcmeAS@N?(olHy`uVBq!ia0vp^93afZ3?z3ZhDiV^g=CK)Uj~LMH3o);76yi2K%s^g z3=E|P3=FRl7#OT(FffQ0%-I!a1C-zi@CkAKUteGUzrLZN;s5{t7AqD^0E#mvdAqwX z3-b7U0&>_(Jbhi+UocCH2rF#A`uRIhh|kl-F@)oKazgCU23|%6dllBo$3bcFKpE8% z*NBpo#FA92CkWnduY#ykZ@LvDUbW?Cg~ t4e8RmHGmp4;5L+G=B5^xB<2=i>M=HgSYpY%qIEGZrNltKJ3glp6;Iv`P)K0$M0hD3z MboFyt=akR{03~1%FaQ7m literal 321 zcmeAS@N?(olHy`uVBq!ia0vp^93afZ3?z3ZhDiV^g=CK)Uj~LMH3o);76yi2K%s^g z3=E|P3=FRl7#OT(FffQ0%-I!a1C-zi@Ck8kXlVFfUtj;f{{R2~57n2-0>v4Vyxm=x z1$lfv0Xgg?p1!W^FPNo8gcY`5{rnv$#OLYa7{YNqIl+M`kb{MR(}po~wujeIpp0sX zYeY#(Vo9o1a#1RfVlXl=GSM|K)-^H@F*2|+w6roZ)iyA&GB6NxW1fPdAvZrIGp!Q0 thIHxO8bA#ia2rZ8b5n~;5_1bM^%xsLEU{!>@*Jp#!PC{xWt~$(69AGJQu6=+ diff --git a/gfx/maps/map4x2.t3s b/gfx/maps/map4x2.t3s index ba5c252..4c3c5dc 100644 --- a/gfx/maps/map4x2.t3s +++ b/gfx/maps/map4x2.t3s @@ -1,2 +1,2 @@ --f rgb8 -z auto +-f rgba4 -z auto map4x2.png diff --git a/gfx/maps/map4x4.png b/gfx/maps/map4x4.png index f7714b204d5b151e7452764d65588ce1f4b97e19..f3213fa26835a67ddd2092b769296efcbb51cae1 100644 GIT binary patch delta 63 zcmX@a6gxr1k~6?3#Fc@8;XfFEY2IH4Wbk{sIEGZrNlrMx5E$sd!oU*1nE5_3d;(C4 N!PC{xWt~$(697@>5{v)< literal 322 zcmeAS@N?(olHy`uVBq!ia0vp^93afZ3?z3ZhDiV^g=CK)Uj~LMH3o);76yi2K%s^g z3=E|P3=FRl7#OT(FffQ0%-I!a1C-zi@Ck8kXlVFfUtj;f{{R2~57n2-0>v4Vyxm=x z1$lfv0Xgg?p1!W^FPNo8gcY`5{rnv$#P8|i7{YNqIpF|9V4wpF14{s7=JOUu1)!8_ ziEBhjN@7W>RdP`(kYX@0Ff!3KFxE9P4>2;ZGPJZZGSxOPure?Zb7P)@q9HdwB{QuO uw}y1--5Nj*8gLs*GILXlOA>PnF!dN4K`gOkUh*8Mhr!d;&t;ucLK6UBo>Sxi diff --git a/gfx/maps/map4x4.t3s b/gfx/maps/map4x4.t3s index f6e2162..6103820 100644 --- a/gfx/maps/map4x4.t3s +++ b/gfx/maps/map4x4.t3s @@ -1,2 +1,2 @@ --f rgb8 -z auto +-f rgba4 -z auto map4x4.png diff --git a/gfx/maps/map8x1.png b/gfx/maps/map8x1.png index 6eca3efdcef6da091585948b5fbaad2ef4ca2671..2ebe608a133506b35cf06102bfaad658e676d4c8 100644 GIT binary patch delta 62 zcmX@e6f;4^f-}G;#PvS|0|N*%FnB1j14%wl7srr_Imr{EjyCWzGPp;uDYniQaRn*x MboFyt=akR{0PEBb&Hw-a literal 321 zcmeAS@N?(olHy`uVBq!ia0vp^93afZ3?z3ZhDiV^g=CK)Uj~LMH3o);76yi2K%s^g z3=E|P3=FRl7#OT(FffQ0%-I!a1C-zi@CkAKUteGUzrLZN;s5{t7AqD^0E#mvdAqwX z3-b7U0&>_(Jbhi+UocCH2rF#A`uRIhh|kl-F@)oK@`R|P4ZMsD?h$N?rW-mzPEjp! zjVMV;EJ?LWE=mPb3`Pb%fo&)tTc)I$ztaD0e0sw0gR1yFH diff --git a/gfx/maps/map8x1.t3s b/gfx/maps/map8x1.t3s index 96f3367..2171ef7 100644 --- a/gfx/maps/map8x1.t3s +++ b/gfx/maps/map8x1.t3s @@ -1,2 +1,2 @@ --f rgb8 -z auto +-f rgba4 -z auto map8x1.png diff --git a/gfx/maps/map8x2.png b/gfx/maps/map8x2.png index 947aeb15fd958887071772754c865623b07dee1c..e17ba0b931b22afba25a99297b714f8d7a2c7043 100644 GIT binary patch delta 63 zcmX@a6gxr1k~6?3#Fc@8;XfFEY2IH4Wbk{sIEGZrNltKJ;^Zt~VGxpFW@J3>Y)5TpPA literal 322 zcmeAS@N?(olHy`uVBq!ia0vp^93afZ3?z3ZhDiV^g=CK)Uj~LMH3o);76yi2K%s^g z3=E|P3=FRl7#OT(FffQ0%-I!a1C-zi@Ck8kXlVFfUtj;f{{R2~57n2-0>v4Vyxm=x z1$lfv0Xgg?p1!W^FPNo8gcY`5{rnv$#P8|i7{YNqIl+O6le2(@K}dp`ky9>I4k)Es z;u=wsl30>zm0Xkxq!^40j7)S5jCGC7LyQcp3@xpUOtlRRtPBjq+?c1JXvob^$xN%n utsz}{w+2vy2Hb{{%-q!ClEmBsOg+X%5KAnXmpljRVeoYIb6Mw<&;$UZOi@Gt diff --git a/gfx/maps/map8x2.t3s b/gfx/maps/map8x2.t3s index e19dae9..b9d0c53 100644 --- a/gfx/maps/map8x2.t3s +++ b/gfx/maps/map8x2.t3s @@ -1,2 +1,2 @@ --f rgb8 -z auto +-f rgba4 -z auto map8x2.png diff --git a/gfx/maps/map8x4.png b/gfx/maps/map8x4.png index 87f57d01e1d7c8c2257d20520e728746b29bd425..01e100b5a30e7e5eea64cc764877a472d67a97a1 100644 GIT binary patch delta 63 zcmX@a6gxr1k~6?3#Fc@8;XfFEY2IH4Wbk{sIEGZrNlrMxkeTVg!oc!?ab`$$;XI%e NgQu&X%Q~loCIDW}6Dt4! literal 322 zcmeAS@N?(olHy`uVBq!ia0vp^93afZ3?z3ZhDiV^g=CK)Uj~LMH3o);76yi2K%s^g z3=E|P3=FRl7#OT(FffQ0%-I!a1C-zi@Ck8kXlVFfUtj;f{{R2~57n2-0>v4Vyxm=x z1$lfv0Xgg?p1!W^FPNo8gcY`5{rnv$#P8|i7{YNqIpF|9W~KuR1Iq)(nK8@K^?*{U zC9V-ADTyViR>?)FK#IZ0z{o_`z*yJFJjBSr%Fxov$W+_Fz{piiX_$l+3hB u+#1rQcWVGOXuxeK$;?eHE=kNSz|>=G1hK@DdC7C29tKZWKbLh*2~7apz*L_A diff --git a/gfx/maps/map8x4.t3s b/gfx/maps/map8x4.t3s index d58a235..28b98b7 100644 --- a/gfx/maps/map8x4.t3s +++ b/gfx/maps/map8x4.t3s @@ -1,2 +1,2 @@ --f rgb8 -z auto +-f rgba4 -z auto map8x4.png diff --git a/source/3ds/video_hard.c b/source/3ds/video_hard.c index 2aa002a..77a11ae 100644 --- a/source/3ds/video_hard.c +++ b/source/3ds/video_hard.c @@ -310,22 +310,17 @@ void draw_affine_layer(avertex *vbufs[], C3D_Tex **textures, int count, int base C3D_TexEnvInit(C3D_GetTexEnv(i)); } } else { - if (count == 2) C3D_TexEnvBufUpdate(C3D_RGB | C3D_Alpha, GPU_TEV_BUFFER_WRITE_CONFIG(false, true, false, false)); for (int i = 0; i < count; i++) { C3D_TexBind(i, textures[i]); - C3D_TexEnv *env = C3D_GetTexEnv(i * 2); - C3D_TexEnvInit(env); - C3D_TexEnvColor(env, i == 0 ? 0x7f7fff : 0x7fff7f); - C3D_TexEnvSrc(env, C3D_Both, GPU_TEXTURE2, GPU_CONSTANT, 0); - C3D_TexEnvFunc(env, C3D_Both, GPU_DOT3_RGBA); - env = C3D_GetTexEnv(i * 2 + 1); + C3D_TexEnv *env = C3D_GetTexEnv(i); C3D_TexEnvInit(env); - C3D_TexEnvSrc(env, C3D_Both, GPU_PREVIOUS, GPU_TEXTURE0 + i, GPU_PREVIOUS_BUFFER); + C3D_TexEnvSrc(env, C3D_Both, GPU_TEXTURE0 + i, GPU_TEXTURE2, GPU_PREVIOUS); + C3D_TexEnvOpRgb(env, 0, i == 0 ? GPU_TEVOP_RGB_SRC_R : GPU_TEVOP_RGB_SRC_G, 0); + C3D_TexEnvOpAlpha(env, 0, i == 0 ? GPU_TEVOP_A_SRC_R : GPU_TEVOP_A_SRC_G, 0); C3D_TexEnvFunc(env, C3D_Both, i == 0 ? GPU_MODULATE : GPU_MULTIPLY_ADD); } if (count == 1) { - C3D_TexEnvInit(C3D_GetTexEnv(2)); - C3D_TexEnvInit(C3D_GetTexEnv(3)); + C3D_TexEnvInit(C3D_GetTexEnv(1)); } } @@ -340,7 +335,6 @@ void draw_affine_layer(avertex *vbufs[], C3D_Tex **textures, int count, int base C3D_BufInfo *bufInfo = C3D_GetBufInfo(); BufInfo_Init(bufInfo); BufInfo_Add(bufInfo, avbuf, sizeof(avertex), 3, 0x210); - C3D_AlphaTest(true, GPU_GREATER, 2); // 0 is fine on hardware, but just to make citra happy for (int eye = 0; eye < 2; eye++) { if (vbufs[eye] != NULL) { @@ -351,7 +345,6 @@ void draw_affine_layer(avertex *vbufs[], C3D_Tex **textures, int count, int base } } - C3D_AlphaTest(true, GPU_GREATER, 0); bufInfo = C3D_GetBufInfo(); BufInfo_Init(bufInfo); BufInfo_Add(bufInfo, vbuf, sizeof(vertex), 2, 0x10);