]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Screenshot was always non-filtered when d3d + shader filter enabled.
authorToni Wilen <twilen@winuae.net>
Wed, 27 Aug 2014 18:01:43 +0000 (21:01 +0300)
committerToni Wilen <twilen@winuae.net>
Wed, 27 Aug 2014 18:01:43 +0000 (21:01 +0300)
od-win32/screenshot.cpp
od-win32/win32_scaler.cpp
od-win32/win32gfx.cpp
od-win32/win32gfx.h

index da5dabcc78dae08a7bc710d068132641d05ff950..2b48c55b54009d7836abb09c6548b2b82c03c5bb 100644 (file)
@@ -211,8 +211,12 @@ static int screenshot_prepare (int imagemode, struct vidbuffer *vb)
                                dst -= dpitch;
                        }
                }
-               if (WIN32GFX_IsPicassoScreen () && !vb)
-                       freertgbuffer (mem);
+               if (!vb) {
+                       if (WIN32GFX_IsPicassoScreen ())
+                               freertgbuffer (mem);
+                       else
+                               freefilterbuffer(mem);
+               }
 
        } else {
 donormal:
index fdb7adc00cda3891176f5745dea8c8ad07e5588b..8dff364ef21c80945c7dfaba349dbb4d52c66784 100644 (file)
@@ -650,6 +650,15 @@ end:
 
 }
 
+void freefilterbuffer(uae_u8 *buf)
+{
+       struct vidbuffer *vb = gfxvidinfo.outbuffer;
+
+       if (usedfilter == NULL) {
+               unlockscr3d(vb);
+       }
+}
+
 uae_u8 *getfilterbuffer (int *widthp, int *heightp, int *pitch, int *depth)
 {
        struct vidbuffer *vb = gfxvidinfo.outbuffer;
@@ -657,8 +666,11 @@ uae_u8 *getfilterbuffer (int *widthp, int *heightp, int *pitch, int *depth)
        *widthp = 0;
        *heightp = 0;
        *depth = amiga_depth;
-       if (usedfilter == NULL)
-               return NULL;
+       if (usedfilter == NULL) {
+               if (!lockscr3d(vb)) {
+                       return NULL;
+               }
+       }
        *widthp = vb->outwidth;
        *heightp = vb->outheight;
        if (pitch)
index 5e6172a306aef1f8ed3ca62291596fc67b252e8c..59bb6ca74d5f43cd5e551e4cd530c47e481e250c 100644 (file)
@@ -1108,6 +1108,27 @@ static uae_u8 *ddraw_dolock (void)
        return gfxvidinfo.outbuffer->bufmem;
 }
 
+bool lockscr3d(struct vidbuffer *vb)
+{
+       if (currentmode->flags & DM_D3D) {
+               if (!(currentmode->flags & DM_SWSCALE)) {
+                       vb->bufmem = D3D_locktexture(&vb->rowbytes, NULL, false);
+                       if (vb->bufmem) 
+                               return true;
+               }
+       }
+       return false;
+}
+
+void unlockscr3d(struct vidbuffer *vb)
+{
+       if (currentmode->flags & DM_D3D) {
+               if (!(currentmode->flags & DM_SWSCALE)) {
+                       D3D_unlocktexture();
+               }
+       }
+}
+
 int lockscr (struct vidbuffer *vb, bool fullupdate)
 {
        int ret = 0;
index 15965b00e453ad657fc06fc9f5ec2dc28557f386..63ff292f7d5d0d682449162a74ea78400213bedf 100644 (file)
@@ -38,6 +38,9 @@ extern int is3dmode (void);
 extern void gfx_lock (void);
 extern void gfx_unlock (void);
 
+extern bool lockscr3d(struct vidbuffer *vb);
+extern void unlockscr3d(struct vidbuffer *vb);
+
 void DX_Fill (int dstx, int dsty, int width, int height, uae_u32 color);
 void DX_Blit (int x, int y, int w, int h);
 void centerdstrect (RECT *);