From ea1d2f5ce9280c3bef6d10c0d5f57a3cd3e180cc Mon Sep 17 00:00:00 2001 From: tykkiman Date: Tue, 24 Oct 2023 21:42:36 +0300 Subject: [PATCH] scaling test --- examples/rdpqdemo/assets/abc2_3x.png | Bin 0 -> 498 bytes examples/rdpqdemo/assets/abc2_3x_baseline.png | Bin 0 -> 1238 bytes examples/rdpqdemo/assets/downscaled_2x.png | Bin 0 -> 2370 bytes examples/rdpqdemo/assets/downscaled_3x.png | Bin 0 -> 1511 bytes examples/rdpqdemo/assets/pattern.png | Bin 0 -> 642 bytes examples/rdpqdemo/assets/rdplol_3x.png | Bin 0 -> 491 bytes .../rdpqdemo/assets/rdplol_3x_baseline.png | Bin 0 -> 1511 bytes examples/rdpqdemo/rdpqdemo.c | 39 +++++++++++++++++- 8 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 examples/rdpqdemo/assets/abc2_3x.png create mode 100644 examples/rdpqdemo/assets/abc2_3x_baseline.png create mode 100644 examples/rdpqdemo/assets/downscaled_2x.png create mode 100644 examples/rdpqdemo/assets/downscaled_3x.png create mode 100644 examples/rdpqdemo/assets/pattern.png create mode 100644 examples/rdpqdemo/assets/rdplol_3x.png create mode 100644 examples/rdpqdemo/assets/rdplol_3x_baseline.png diff --git a/examples/rdpqdemo/assets/abc2_3x.png b/examples/rdpqdemo/assets/abc2_3x.png new file mode 100644 index 0000000000000000000000000000000000000000..cd830fa396c4d8020dd0754c1affd613ef7a5346 GIT binary patch literal 498 zcmVmB^oiH_Zwhj1zyx1SUs6Yl zs9Xu@<@4SrGrk>Np{4U~Lu=u3)a}ejFco oTq=4t{!D&M82)CaGoxlkiF->*q*^4Rf&`075KT(35g`(H(N#&s!cr^*ksv}uh=oWkuxLoc z!U78sm$;O;HC4Atq)Jt5+OwGdj8XLe&)J;Cd6wV%eDCvKzYl=_6p#-af*}6>{x+NK z`$UYz#$F2!apAZyySuxzv?LOVXqxtTJTy)7`Ft3LQ50o4 zG)>#>_W1bte+I}YSy{m_Od^piEG+Eq z?j|NCdO1N5q^723d3m|Ewl+34HYzGgEEWp{g5PKhg~ILaZJka>Q525jIF6T;lo*Xh zkx0aHii(OX7E5<`x6x>{+wDU`Lt3p?tJPLkR>sA}!7$85pi-%HI^EXR*1^Gn!C>g< z=wPi3K2?UIsHv$bg+k$UI!z`MvoH>aBPAszD=TY%f1jb{=H}}4`qR@>nx+9~@A-T_ zK@dGXJwro7j0pgMqG)h%Fhx;rxBLG7-s=_l*n14a+S}WuQfXmfA%egmTrOwjold9CW>YGa4-XGqUnEIZRaG@NH&0AVuup}{<+{DSy}iBlRdWb})M~Za zY*wjMUM7+xcXoDKTU*%^nM`IfnLE%*;%q z(Wq9dy?O%xKoDene0*+hj>r2|s(^riv$Hd)RQffC#>Pg2!4Mi63IHf8E4#kFJ~%ko z{~HE_L95krcYy~0h>D6D92{I(S(%)ibi3VNPHCFHzrUACrQAmzMbYT!=;PyKE;BYZ zwymvgdU~2^%G=x9<>h5fO^ws(WC%GqIVB|}{r&yyWbl}%mzS5jySwdn`!|*O4iE%+ zEp$vw%*4dR-QC^D$Ot=(4u|97;)0bA2?;LmL1vFfcGWI_h${*b}$g zT~Se?(P-l1z;r>c*B>1n zv7CSSAalU9-$&UH1Q7@X%p5SE5JUD|>Hib{0u_@LE__d~g#Z8m07*qoM6N<$f<3%n AFaQ7m literal 0 HcmV?d00001 diff --git a/examples/rdpqdemo/assets/downscaled_2x.png b/examples/rdpqdemo/assets/downscaled_2x.png new file mode 100644 index 0000000000000000000000000000000000000000..c8f0c4adfd5bbd0d647bcea05575261c63be499a GIT binary patch literal 2370 zcmV-I3BC4-P)$`!P=wTTNclRdEnL{Wq&is_`fN07;S{Nz#}`{_(hmY{z{csl$yMH;|i~i^Yo_GBY#b_xrJN<3=cof@#yH;nPn)eZuMM*RLZtHy2r1S@8S)C@n1o zNhBvHBO@c@nS!%eESNQG76O3)R;^kEpU(%I%{HdKBPPHw3`8OkL?RI=ih{1LE_8Qy zn{tv*=qri>MN!b--;X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dpqdemo/assets/downscaled_3x.png b/examples/rdpqdemo/assets/downscaled_3x.png new file mode 100644 index 0000000000000000000000000000000000000000..ae99664b26094061d6a071d56e017d0d7a55d0a1 GIT binary patch literal 1511 zcmVo-P34a5#j|=hO6GzkU^0u3Ql&lS$0P07Q9txp2GPV%@rR zbH-2w@Bc8ucUV$5bU1qB7Xe*K#M{{DFrM@L6_ z|NcD%1qCc!x^&u^UXRUYWB2ae96WfCXf#S!SJ#3hB}t;9qJj$-F7V{Z6MB1lId$q3 zsi~>h?e^aj1&Bl<FMcV!-fr5tyU%`CU7_$IGs+S(I`Hj50}fu)YQ~(GvoLBak*SfOiXb5 z_HDAVvM4Jn!)P?p(b2*A^XC~KALsMu&wT&>9U-P0r^MeaRHxISC<@VNR4c?YWAS*L zcs#C^6qv3Mkw|3D`IKdua5$_vUkI`+qu1*-J6V=VPftft6o!U|2#3P}Bqb$jG3F5c z(=qSXF9cOpS+;B$U%q@HFE5Yb;bB6d5L>ryMNt$wIyz7kh1AqkzJ2?~nl)?a>+3^N z6t->K#>B(~ot>SerKKTB5(5JRSS%LYZa1M&C?TQ=JxUA)1NHUw*lac$8ym^U$iU%n zP*haJ=FOYAcI_IOnVHP*oMD(@B1QK704>rKYBa<;$1jbULZ5tfZ={ z3cWs|JZbo4&z&vB#l^zo@d%sECbF}$MSFX@$jrCz?f>C-1+u~-s{J0l5YRHxIidi83&UM~d& z1zMq(WqFRQUAq>K$3tOZA+cBtS(dd6DM=DZNlC0&u>!x}Pkw&B<|iQzi5TVQ=d)|q zF6?$Yxw*MmtybFF+GuEKps}%$ckkX|wOYx|&84!kl9G}VR8{5U$B$gSdX@V6dRkgq z*tc&Vfk1%Mr%z+I+qKr42ok#WMxzmf!9Xw=Bqb$9d#kQoxe{5Hal74G*2c!hNKH*8 z6bd1Pz+$m5H8n+VZ!c!EnMfqUEX>4Tx04R}tkv&MmKpe$i(@LdO6xu<=AwzYtAS&XhRVYG*P%E_RU~>J0CJjl7 zi=*ILaPVWX>fqw6tAnc`2!4RLx;QDiNQwVT3N2zhIPS;0dyl(!fY7Wm)eMXSs%9DK zWJ1j5R>j~eLKr{<0fc2{>T{Bmg6H_UhmWs!ah~OU?$6PeFPIGQiNv!^H!R`};^|FG z=e$oGWo0=}d`>)O&;^MfxvseU#<}FMz%!#pCOuCaB^FCvtaLFe8!GV>aV)QDlrLmm z&U4=4tXAu+eNXeSad^gZEa<4bO1wgWnpw> zWFU8GbZ8()Nlj2!fese{003G^L_t(I%k7ZM4uCKS1ZVsI|GXaBDn3ZsdNXnv64)>S zj169;0E2z;r_$~9jtN;K207*qoM6N<$f-5H#MgRZ+ literal 0 HcmV?d00001 diff --git a/examples/rdpqdemo/assets/rdplol_3x.png b/examples/rdpqdemo/assets/rdplol_3x.png new file mode 100644 index 0000000000000000000000000000000000000000..f5d635779c15427b99bb36a67478f80120391b65 GIT binary patch literal 491 zcmV}5|?C2-%jD= zr993f0LK*tKyTr?BIp%7))N$kaWw$LDxf+XZUnu+1>mhqm$3#X;bFr$@ZfU( z?Sb0U_i)&%k`x3j07}^LXMhnQ;kSe)FaV}6PB05Nz)KRoJ_yvG%?$sBrRnTTXqIy6 z7W!iNg6crA%*j)+s0*wJMRps2W^H&SNpp4#;N-aqn@>33K z^4~E0ft~?we`Itf1MhRowWk69jnYKd)FtzLs-$eG(}v6OP+n21_)hf9cw(LvU!4uh hCu-kS>^JQp?JtwZ(rr8~mdpSE002ovPDHLkV1nmx;fVkM literal 0 HcmV?d00001 diff --git a/examples/rdpqdemo/assets/rdplol_3x_baseline.png b/examples/rdpqdemo/assets/rdplol_3x_baseline.png new file mode 100644 index 0000000000000000000000000000000000000000..ae99664b26094061d6a071d56e017d0d7a55d0a1 GIT binary patch literal 1511 zcmVo-P34a5#j|=hO6GzkU^0u3Ql&lS$0P07Q9txp2GPV%@rR zbH-2w@Bc8ucUV$5bU1qB7Xe*K#M{{DFrM@L6_ z|NcD%1qCc!x^&u^UXRUYWB2ae96WfCXf#S!SJ#3hB}t;9qJj$-F7V{Z6MB1lId$q3 zsi~>h?e^aj1&Bl<FMcV!-fr5tyU%`CU7_$IGs+S(I`Hj50}fu)YQ~(GvoLBak*SfOiXb5 z_HDAVvM4Jn!)P?p(b2*A^XC~KALsMu&wT&>9U-P0r^MeaRHxISC<@VNR4c?YWAS*L zcs#C^6qv3Mkw|3D`IKdua5$_vUkI`+qu1*-J6V=VPftft6o!U|2#3P}Bqb$jG3F5c z(=qSXF9cOpS+;B$U%q@HFE5Yb;bB6d5L>ryMNt$wIyz7kh1AqkzJ2?~nl)?a>+3^N z6t->K#>B(~ot>SerKKTB5(5JRSS%LYZa1M&C?TQ=JxUA)1NHUw*lac$8ym^U$iU%n zP*haJ=FOYAcI_IOnVHP*oMD(@B1QK704>rKYBa<;$1jbULZ5tfZ={ z3cWs|JZbo4&z&vB#l^zo@d%sECbF}$MSFX@$jrCz?f>C-1+u~-s{J0l5YRHxIidi83&UM~d& z1zMq(WqFRQUAq>K$3tOZA+cBtS(dd6DM=DZNlC0&u>!x}Pkw&B<|iQzi5TVQ=d)|q zF6?$Yxw*MmtybFF+GuEKps}%$ckkX|wOYx|&84!kl9G}VR8{5U$B$gSdX@V6dRkgq z*tc&Vfk1%Mr%z+I+qKr42ok#WMxzmf!9Xw=Bqb$9d#kQoxe{5Hal74G*2c!hNKH*8 z6bd1Pz+$m5H8n+VZ!c!EnMfqU= 1) + rdpq_mode_dithering(DITHER_NONE_NONE); // for (uint32_t i = 0; i < num_objs; i++) // { @@ -99,6 +102,28 @@ void render(int cur_frame) // }); // } + rdpq_mode_push(); + + if (true) { + int scale = 127; + int sub = 191; + // Set y = (x - 0.75) * 0.5 + 1 + rdpq_set_env_color((color_t){sub,sub,sub,0}); + rdpq_set_prim_color((color_t){scale,scale,scale,255}); + rdpq_mode_combiner(RDPQ_COMBINER1((TEX0,ENV,PRIM,TEX0), (0,0,0,1))); + } + + rdpq_mode_antialias(AA_NONE); + rdpq_blitparms_t parms = {}; + parms.flip_y = false; + parms.scale_x = 3.f; + parms.scale_y = 3.f; + rdpq_sprite_blit(pattern_sprite, 16, 16, &parms); + rdpq_sprite_blit(baseline_sprite, 16, 16 + baseline_sprite->height * parms.scale_y + 8, &parms); + + rdpq_mode_pop(); + + if (false) { sprite_t* spritelist[] = {baseline_sprite, yuverror_sprite}; int spritesizes[][2] = {{64,64}, {64,64}, {64,64}}; @@ -146,6 +171,7 @@ void render(int cur_frame) parms.scale_y = 2.f; rdpq_sprite_blit(rgba16_sprite, 8, 8, &parms); } + } rdpq_detach_show(); } @@ -155,8 +181,9 @@ int main() debug_init_isviewer(); debug_init_usblog(); - display_init(RESOLUTION_320x240, DEPTH_16_BPP, 3, GAMMA_NONE, FILTERS_RESAMPLE); - + display_init(RESOLUTION_640x480, DEPTH_16_BPP, 3, GAMMA_NONE, FILTERS_DISABLED); + // *(volatile uint32_t*)0xA4400000 |= 0x300; // disable AA + controller_init(); timer_init(); @@ -176,6 +203,14 @@ int main() rgba16_sprite = sprite_load("rom:/rgba16/"IMGNAME".sprite"); ci4_sprite = sprite_load("rom:/ci4/"IMGNAME".sprite"); + // pattern_sprite = sprite_load("rom:/abc2_3x.sprite"); + // baseline_sprite = sprite_load("rom:/abc2_3x_baseline.sprite"); + pattern_sprite = sprite_load("rom:/rdplol_3x.sprite"); + baseline_sprite = sprite_load("rom:/rdplol_3x_baseline.sprite"); + // pattern_sprite = sprite_load("rom:/pattern.sprite"); + + #undef IMGNAME + obj_max_x = display_width - brew_sprite->width; obj_max_y = display_height - brew_sprite->height;