]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Return HDR screenshot depth
authorToni Wilen <twilen@winuae.net>
Mon, 10 Apr 2023 15:36:54 +0000 (18:36 +0300)
committerToni Wilen <twilen@winuae.net>
Mon, 10 Apr 2023 15:36:54 +0000 (18:36 +0300)
od-win32/avioutput.cpp
od-win32/direct3d.h
od-win32/direct3d11.cpp
od-win32/screenshot.cpp

index 2f71e14c9f0a27b2fc396d087cf3a035aa952498..add6a7486105654d3207574b49d38a019adef90f 100644 (file)
@@ -962,10 +962,10 @@ static void AVIOuput_WAVWriteAudio(uae_u8 *sndbuffer, int sndbufsize)
 static int getFromRenderTarget11(struct avientry *avie, bool renderTarget)
 {
        int ok = 0;
-       int w, h, pitch, bits = 32;
+       int w, h, pitch, bits = 32, d;
        void *data;
 
-       bool got = D3D11_capture(aviout_monid, &data, &w, &h, &pitch, renderTarget);
+       bool got = D3D11_capture(aviout_monid, &data, &w, &h, &d, &pitch, renderTarget);
        if (got) {
                int dpitch = ((aviout_width_out * avioutput_bits + 31) & ~31) / 8;
                for (int y = 0; y < h && y < aviout_height_out; y++) {
@@ -984,7 +984,7 @@ static int getFromRenderTarget11(struct avientry *avie, bool renderTarget)
                                }
                        }
                }
-               D3D11_capture(aviout_monid, NULL, NULL, NULL, NULL, renderTarget);
+               D3D11_capture(aviout_monid, NULL, NULL, NULL, NULL, NULL, renderTarget);
                ok = 1;
        }
        return ok;
index 05bbfccefb7341c94814b0490fb1bce8cf9d9480..7f310713fc5d16d2977902a27a5516120d61efff 100644 (file)
@@ -38,7 +38,7 @@ extern bool(*D3D_extoverlay)(struct extoverlay*, int);
 extern void(*D3D_paint)(void);
 
 extern LPDIRECT3DSURFACE9 D3D_capture(int, int*,int*,int*,bool);
-extern bool D3D11_capture(int, void**,int*, int*,int*,bool);
+extern bool D3D11_capture(int, void**,int*, int*, int*,int*,bool);
 
 void D3D_getpixelformat(int depth, int *rb, int *gb, int *bb, int *rs, int *gs, int *bs, int *ab, int *as, int *a);
 
index a5f7e917c9107fa9d19235c4d536fcc0215bab5a..2a0404ebd052dc259b79f7d1b5ad665041d68df6 100644 (file)
@@ -5198,7 +5198,7 @@ static HDC xD3D_getDC(int monid, HDC hdc)
        }
 }
 
-bool D3D11_capture(int monid, void **data, int *w, int *h, int *pitch, bool rendertarget)
+bool D3D11_capture(int monid, void **data, int *w, int *h, int *d, int *pitch, bool rendertarget)
 {
        struct d3d11struct *d3d = &d3d11data[monid];
        HRESULT hr;
@@ -5236,6 +5236,7 @@ bool D3D11_capture(int monid, void **data, int *w, int *h, int *pitch, bool rend
                        *pitch = map.RowPitch;
                        *w = desc.Width;
                        *h = desc.Height;
+                       *d = d3d->hdr ? 36 : 24;
                        return true;
                } else {
                        write_log(_T("Screenshot RenderTargetView->GetResource() failed\n"));
index c05fb7d9511d21db7eb67369d351193592d7e6ac..c7571ae46fc8beeeffebba5eda567abd6688bd57 100644 (file)
@@ -427,9 +427,9 @@ donormal:
                        height = state->Height;
                }
                if (D3D_isenabled(0) == 2) {
-                       int w, h, pitch, bits = 32;
+                       int w, h, pitch, bits = 32, d;
                        void *data;
-                       bool got = D3D11_capture(monid, &data, &w, &h, &pitch, renderTarget);
+                       bool got = D3D11_capture(monid, &data, &w, &h, &d, &pitch, renderTarget);
 
                        int dpitch = (((width * depth + 31) & ~31) / 8);
                        lpvBits = xmalloc(uae_u8, dpitch * height);
@@ -447,7 +447,7 @@ donormal:
                        bi->bmiHeader.biClrUsed = 0;
                        bi->bmiHeader.biClrImportant = 0;
 
-                       if (got && lpvBits) {
+                       if (got && lpvBits && d <= 32) {
                                for (int y = 0; y < h && y < height; y++) {
                                        uae_u8 *d = (uae_u8*)lpvBits + (height - y - 1) * dpitch;
                                        uae_u32 *s = (uae_u32*)((uae_u8*)data + y * pitch);
@@ -466,7 +466,7 @@ donormal:
                                }
                        }
                        if (got)
-                               D3D11_capture(monid, NULL, NULL, NULL, NULL, renderTarget);
+                               D3D11_capture(monid, NULL, NULL, NULL, NULL, NULL, renderTarget);
                        d3dcaptured = true;
 
                } else if (D3D_isenabled(0) == 1) {