]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Remove software filter support
authorToni Wilen <twilen@winuae.net>
Sat, 8 Mar 2025 15:11:24 +0000 (17:11 +0200)
committerToni Wilen <twilen@winuae.net>
Sat, 8 Mar 2025 15:11:24 +0000 (17:11 +0200)
od-win32/win32_scaler.cpp

index 8c16d5e58f89fdb033bd118455318221c7dfd5e5..e17ecd41b75fb1f1323e8da21c56bc783782ba01 100644 (file)
 #define AUTORESIZE_FRAME_DELAY 10
 
 static float filteroffsetx, filteroffsety, filterxmult = 1.0, filterymult = 1.0;
-static int dst_width, dst_height, amiga_width, amiga_height, amiga_depth, dst_depth, scale;
-static int dst_width2, dst_height2, amiga_width2, amiga_height2, amiga_depth2, dst_depth2;
-static int temp_width, temp_height;
+static int dst_width, dst_height;
 uae_u8 *bufmem_ptr;
-static uae_u8 *tempsurf2, *tempsurf3;
 static int deskw, deskh;
 static bool inited;
 
@@ -827,7 +824,7 @@ uae_u8 *getfilterbuffer(int monid, int *widthp, int *heightp, int *pitch, int *d
 
        *widthp = 0;
        *heightp = 0;
-       *depth = amiga_depth;
+       *depth = 32;
        if (!vb)
                return NULL;
        if (!lockscr3d(vb)) {
@@ -845,357 +842,6 @@ uae_u8 *getfilterbuffer(int monid, int *widthp, int *heightp, int *pitch, int *d
        *heightp = h;
        *depth = vb->pixbytes * 8;
        return vb->bufmem;
-#if 0
-       RECT dr, sr, zr;
-       uae_u8 *p;
-       int w, h;
-       if (usedfilter->type == UAE_FILTER_DIRECT3D) {
-               return getfilterbuffer3d (widthp, heightp, pitch, depth);
-       } else {
-               getfilterrect2 (&dr, &sr, &zr, dst_width, dst_height, amiga_width, amiga_height, scale, temp_width, temp_height);
-       }
-       w = sr.right - sr.left;
-       h = sr.bottom - sr.top;
-       p = vb->bufmem;
-       if (pitch)
-               *pitch = vb->rowbytes;
-       p += (zr.top - (h / 2)) * vb->rowbytes + (zr.left - (w / 2)) * amiga_depth / 8;
-       *widthp = w;
-       *heightp = h;
-       return p;
-#endif
-}
-
-#if 0
-void S2X_configure(int monid, int rb, int gb, int bb, int rs, int gs, int bs)
-{
-       if (monid)
-               return;
-       Init_2xSaI(rb, gb, bb, rs, gs, bs);
-       hq_init(rb, gb, bb, rs, gs, bs);
-       PAL_init(monid);
-       bufmem_ptr = 0;
-}
-
-void S2X_reset(int monid)
-{
-       if (monid)
-               return;
-       if (!inited)
-               return;
-       S2X_init(monid, dst_width2, dst_height2, amiga_depth2);
-}
-
-void S2X_free(int monid)
-{
-       if (monid)
-               return;
-
-       changed_prefs.leds_on_screen &= ~STATUSLINE_TARGET;
-       currprefs.leds_on_screen &= ~STATUSLINE_TARGET;
-
-       xfree (tempsurf2);
-       tempsurf2 = 0;
-       xfree (tempsurf3);
-       tempsurf3 = 0;
-       filteroffsetx = 0;
-       filteroffsety = 0;
-       filterxmult = 1.0;
-       filterymult = 1.0;
-       scale = 1;
-       inited = false;
-}
-
-bool S2X_init(int monid, int dw, int dh, int dd)
-{
-       if (monid)
-               return false;
-
-       struct vidbuf_description *avidinfo = &adisplays[monid].gfxvidinfo;
-       struct amigadisplay *ad = &adisplays[monid];
-       struct vidbuffer *vb = avidinfo->outbuffer;
-       struct AmigaMonitor *mon = &AMonitors[monid];
-       struct uae_filter *usedfilter = mon->usedfilter;
-       int idx = ad->gf_index;
-       int flags = 0;
-
-       dst_width2 = dw;
-       dst_height2 = dh;
-       dst_depth2 = dd;
-       amiga_width2 = vb->outwidth;
-       amiga_height2 = vb->outheight;
-       amiga_depth2 = vb->pixbytes * 8;
-
-       S2X_free(monid);
-       changed_prefs.leds_on_screen |= STATUSLINE_TARGET;
-       currprefs.leds_on_screen |= STATUSLINE_TARGET;
-       statusline_set_multiplier(monid, dw, dh);
-
-       dd = amiga_depth2;
-
-       if (dd == 32)
-               alloc_colors_rgb (8, 8, 8, 16, 8, 0, 0, 0, 0, 0, rc, gc, bc);
-       else
-               alloc_colors_rgb (5, 6, 5, 11, 5, 0, 0, 0, 0, 0, rc, gc, bc);
-
-       if (WIN32GFX_IsPicassoScreen(mon))
-               return true;
-
-       if (!currprefs.gf[idx].gfx_filter || !usedfilter) {
-               usedfilter = &uaefilters[0];
-               scale = 1;
-       } else {
-               scale = usedfilter->intmul;
-               flags = usedfilter->flags;
-               if ((amiga_depth2 == 16 && !(flags & UAE_FILTER_MODE_16)) || (amiga_depth2 == 32 && !(flags & UAE_FILTER_MODE_32))) {
-                       usedfilter = &uaefilters[0];
-                       scale = 1;
-                       changed_prefs.gf[idx].gfx_filter = usedfilter->type;
-               }
-       }
-#if 0
-       int res_shift;
-       res_shift = RES_MAX - currprefs.gfx_resolution;
-       if (currprefs.gfx_xcenter_size > 0 && (currprefs.gfx_xcenter_size >> res_shift) < aw)
-               aw = currprefs.gfx_xcenter_size >> res_shift;
-       res_shift = VRES_MAX - currprefs.gfx_vresolution;
-       if (currprefs.gfx_ycenter_size > 0 && (currprefs.gfx_ycenter_size >> res_shift) < ah)
-               ah = currprefs.gfx_ycenter_size >> res_shift;
-#endif
-       dst_width = dw;
-       dst_height = dh;
-       dst_depth = dd;
-       amiga_width = vb->outwidth;
-       amiga_height = vb->outheight;
-       amiga_depth = vb->pixbytes * 8;
-
-       int mh = currprefs.gf[idx].gfx_filter_filtermodeh + 1;
-       if (mh < scale)
-               mh = scale;
-       temp_width = dst_width * mh;
-       int mv = currprefs.gf[idx].gfx_filter_filtermodev + 1;
-       if (mv < scale)
-               mv = scale;
-       temp_height = dst_height * mv;
-
-       if (usedfilter->type == UAE_FILTER_HQ2X || usedfilter->type == UAE_FILTER_HQ3X || usedfilter->type == UAE_FILTER_HQ4X) {
-               int w = amiga_width > dst_width ? amiga_width : dst_width;
-               int h = amiga_height > dst_height ? amiga_height : dst_height;
-               tempsurf2 = xmalloc (uae_u8, w * h * (amiga_depth / 8) * ((scale + 1) / 2));
-               tempsurf3 = xmalloc (uae_u8, w * h *(dst_depth / 8) * 4 * scale);
-       }
-       inited = true;
-       return true;
-}
-
-void S2X_render(int monid, int y_start, int y_end)
-{
-       struct AmigaMonitor *mon = &AMonitors[monid];
-       struct amigadisplay *ad = &adisplays[monid];
-       struct uae_filter *usedfilter = mon->usedfilter;
-       struct vidbuf_description *avidinfo = &adisplays[monid].gfxvidinfo;
-       struct vidbuffer *vb = avidinfo->outbuffer;
-       int idx = ad->gf_index;
-       int aw, ah, aws, ahs;
-       uae_u8 *dptr, *enddptr, *sptr, *endsptr;
-       int ok = 0;
-       int pitch, surf_height, surf_width;
-       uae_u8 *surfstart;
-
-       aw = amiga_width;
-       ah = amiga_height;
-       aws = aw * scale;
-       ahs = ah * scale;
-
-       if (ah < 16)
-               return;
-       if (aw < 16)
-               return;
-       if (!vb->bufmem)
-               return;
-
-       sptr = vb->bufmem;
-       endsptr = vb->bufmemend;
-       bufmem_ptr = sptr;
-
-       if (D3D_restore)
-               D3D_restore(monid, true);
-       surfstart = D3D_locktexture(monid, &pitch, &surf_width, &surf_height, y_start < -1 ? -1 : (y_start < 0 ? 1 : 0));
-       if (surfstart == NULL) {
-               return;
-       }
-       dptr = surfstart;
-       enddptr = dptr + pitch * surf_height;
-
-       if (!dptr) /* weird things can happen */
-               goto end;
-       if (dptr < surfstart)
-               dptr = surfstart;
-
-       if (usedfilter->type == UAE_FILTER_SCALE2X) { /* 16+32/2X */
-
-               if (dptr + pitch * ah * 2 >= enddptr)
-                       ah = (int)((enddptr - dptr) / (pitch * 2));
-
-               if (amiga_depth == 16 && dst_depth == 16) {
-                       AdMame2x (sptr, vb->rowbytes, dptr, pitch, aw, ah);
-                       ok = 1;
-               } else if (amiga_depth == 32 && dst_depth == 32) {
-                       AdMame2x32 (sptr, vb->rowbytes, dptr, pitch, aw, ah);
-                       ok = 1;
-               }
-
-       } else if (usedfilter->type == UAE_FILTER_HQ2X || usedfilter->type == UAE_FILTER_HQ3X || usedfilter->type == UAE_FILTER_HQ4X) { /* 32/2X+3X+4X */
-
-#ifndef CPU_64_BIT
-
-               if (tempsurf2 && scale >= 2 && scale <= 4) {
-                       /* Aaaaaaaarghhhghgh.. */
-                       uae_u8 *sptr2 = tempsurf3;
-                       uae_u8 *dptr2 = tempsurf2;
-                       int i;
-                       for (i = 0; i < ah; i++) {
-                               int w = aw * (amiga_depth / 8);
-                               memcpy (dptr2, sptr, w);
-                               dptr2 += w;
-                               sptr += vb->rowbytes;
-                       }
-                       if (amiga_depth == 16 && dst_depth == 32) {
-                               if (usedfilter->type == UAE_FILTER_HQ2X)
-                                       hq2x_32 (tempsurf2, tempsurf3, aw, ah, aws * 4);
-                               else if (usedfilter->type == UAE_FILTER_HQ3X)
-                                       hq3x_32 (tempsurf2, tempsurf3, aw, ah, aws * 4);
-                               else if (usedfilter->type == UAE_FILTER_HQ4X)
-                                       hq4x_32 (tempsurf2, tempsurf3, aw, ah, aws * 4);
-                               ok = 1;
-                       } else if (amiga_depth == 16 && dst_depth == 16) {
-                               if (usedfilter->type == UAE_FILTER_HQ2X)
-                                       hq2x_16 (tempsurf2, tempsurf3, aw, ah, aws * 2);
-                               else if (usedfilter->type == UAE_FILTER_HQ3X)
-                                       hq3x_16 (tempsurf2, tempsurf3, aw, ah, aws * 2);
-                               else if (usedfilter->type == UAE_FILTER_HQ4X)
-                                       hq4x_16 (tempsurf2, tempsurf3, aw, ah, aws * 2);
-                               ok = 1;
-                       }
-                       for (i = 0; i < ah * scale; i++) {
-                               int w = aw * scale * (dst_depth / 8);
-                               if (dptr + w > enddptr)
-                                       break;
-                               memcpy (dptr, sptr2, w);
-                               sptr2 += w;
-                               dptr += pitch;
-                       }
-               }
-#endif
-
-       } else if (usedfilter->type == UAE_FILTER_SUPEREAGLE) { /* 16/32/2X */
-
-               if (dptr + pitch * ah * 2 >= enddptr)
-                       ah = (int)((enddptr - dptr) / (pitch * 2));
-
-               if (scale == 2 && amiga_depth == 16) {
-                       if (dst_depth == 16) {
-                               SuperEagle_16 (sptr, vb->rowbytes, dptr, pitch, aw, ah);
-                               ok = 1;
-                       } else if (dst_depth == 32) {
-                               SuperEagle_32 (sptr, vb->rowbytes, dptr, pitch, aw, ah);
-                               ok = 1;
-                       }
-               }
-
-       } else if (usedfilter->type == UAE_FILTER_SUPER2XSAI) { /* 16/32/2X */
-
-               if (dptr + pitch * ah * 2 >= enddptr)
-                       ah = (int)((enddptr - dptr) / (pitch * 2));
-
-               if (scale == 2 && amiga_depth == 16) {
-                       if (dst_depth == 16) {
-                               Super2xSaI_16 (sptr, vb->rowbytes, dptr, pitch, aw, ah);
-                               ok = 1;
-                       } else if (dst_depth == 32) {
-                               Super2xSaI_32 (sptr, vb->rowbytes, dptr, pitch, aw, ah);
-                               ok = 1;
-                       }
-               }
-
-       } else if (usedfilter->type == UAE_FILTER_2XSAI) { /* 16/32/2X */
-
-               if (dptr + pitch * ah * 2 >= enddptr)
-                       ah = (int)((enddptr - dptr) / (pitch * 2));
-
-               if (scale == 2 && amiga_depth == 16) {
-                       if (dst_depth == 16) {
-                               _2xSaI_16 (sptr, vb->rowbytes, dptr, pitch, aw, ah);
-                               ok = 1;
-                       } else if (dst_depth == 32) {
-                               _2xSaI_32 (sptr, vb->rowbytes, dptr, pitch, aw, ah);
-                               ok = 1;
-                       }
-               }
-
-       } else if (usedfilter->type == UAE_FILTER_PAL) { /* 16/32/1X */
-
-               if (amiga_depth == 32 && dst_depth == 32) {
-                       PAL_1x1_32 ((uae_u32*)sptr, vb->rowbytes, (uae_u32*)dptr, pitch, aw, ah);
-                       ok = 1;
-               } else if (amiga_depth == 16 && dst_depth == 16) {
-                       PAL_1x1_16 ((uae_u16*)sptr, vb->rowbytes, (uae_u16*)dptr, pitch, aw, ah);
-                       ok = 1;
-               }
-
-       } else { /* null */
-
-               if (amiga_depth == dst_depth) {
-                       int w = aw * dst_depth / 8;
-                       if (y_start < 0) {
-                               uae_u8 *d = dptr;
-                               uae_u8 *s = sptr;
-                               for (int y = 0; y < ah && d + w <= enddptr; y++) {
-                                       memcpy(d, s, w);
-                                       s += vb->rowbytes;
-                                       d += pitch;
-                               }
-                       } else {
-                               uae_u8 *d = dptr + y_start * pitch;
-                               uae_u8 *s = sptr + y_start * vb->rowbytes;
-                               for (int y = y_start; y < ah && y < y_end && d + w <= enddptr; y++) {
-                                       memcpy(d, s, w);
-                                       s += vb->rowbytes;
-                                       d += pitch;
-                               }
-                       }
-               }
-               ok = 1;
-
-       }
-
-       if (ok == 0 && currprefs.gf[idx].gfx_filter) {
-               usedfilter = &uaefilters[0];
-               changed_prefs.gf[idx].gfx_filter = usedfilter->type;
-       }
-end:;
 }
 
-void S2X_refresh(int monid)
-{
-       if (monid)
-               return;
-       S2X_render(monid, -1, -1);
-}
-
-int S2X_getmult(int monid)
-{
-       if (monid)
-               return 1;
-       struct AmigaMonitor *mon = &AMonitors[monid];
-       struct uae_filter *usedfilter = mon->usedfilter;
-       if (!usedfilter)
-               return 1;
-       if (mon->screen_is_picasso)
-               return 1;
-       return usedfilter->intmul;
-}
-
-#endif
-
 #endif