Nikolay Sivov : dxva2: Return some static render target formats.

Alexandre Julliard julliard at winehq.org
Fri Sep 18 15:52:50 CDT 2020


Module: wine
Branch: master
Commit: 97136a8707412614b4a0266d402674bfb3b6e111
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=97136a8707412614b4a0266d402674bfb3b6e111

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Fri Sep 18 17:25:15 2020 +0300

dxva2: Return some static render target formats.

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/dxva2/main.c            | 18 +++++++++++++++++-
 dlls/dxva2/tests/Makefile.in |  2 +-
 dlls/dxva2/tests/dxva2.c     | 23 ++++++++++++++++++++++-
 3 files changed, 40 insertions(+), 3 deletions(-)

diff --git a/dlls/dxva2/main.c b/dlls/dxva2/main.c
index 22a35c4fbb..6ebc4f0018 100644
--- a/dlls/dxva2/main.c
+++ b/dlls/dxva2/main.c
@@ -195,7 +195,23 @@ static HRESULT WINAPI device_manager_processor_service_GetVideoProcessorRenderTa
         IDirectXVideoProcessorService *iface, REFGUID deviceguid, const DXVA2_VideoDesc *video_desc, UINT *count,
         D3DFORMAT **formats)
 {
-    FIXME("%p, %s, %p, %p, %p.\n", iface, debugstr_guid(deviceguid), video_desc, count, formats);
+    TRACE("%p, %s, %p, %p, %p.\n", iface, debugstr_guid(deviceguid), video_desc, count, formats);
+
+    if (IsEqualGUID(deviceguid, &DXVA2_VideoProcSoftwareDevice))
+    {
+        /* FIXME: filter some input formats */
+
+        if (!(*formats = CoTaskMemAlloc(2 * sizeof(**formats))))
+            return E_OUTOFMEMORY;
+
+        *count = 2;
+        (*formats)[0] = D3DFMT_X8R8G8B8;
+        (*formats)[1] = D3DFMT_A8R8G8B8;
+
+        return S_OK;
+    }
+    else
+        FIXME("Unsupported device %s.\n", debugstr_guid(deviceguid));
 
     return E_NOTIMPL;
 }
diff --git a/dlls/dxva2/tests/Makefile.in b/dlls/dxva2/tests/Makefile.in
index c86c5ab42f..ccd03940a2 100644
--- a/dlls/dxva2/tests/Makefile.in
+++ b/dlls/dxva2/tests/Makefile.in
@@ -1,5 +1,5 @@
 TESTDLL   = dxva2.dll
-IMPORTS   = dxva2 user32 d3d9
+IMPORTS   = dxva2 user32 d3d9 ole32
 
 C_SRCS = \
 	dxva2.c
diff --git a/dlls/dxva2/tests/dxva2.c b/dlls/dxva2/tests/dxva2.c
index 58b0231420..f5b28ed3f8 100644
--- a/dlls/dxva2/tests/dxva2.c
+++ b/dlls/dxva2/tests/dxva2.c
@@ -82,13 +82,16 @@ static void test_device_manager(void)
     IDirectXVideoProcessorService *processor_service;
     IDirectXVideoAccelerationService *accel_service;
     IDirect3DDevice9 *device, *device2, *device3;
+    IDirectXVideoProcessorService *proc_service;
     IDirect3DDeviceManager9 *manager;
     IDirect3DSurface9 *surfaces[2];
+    DXVA2_VideoDesc video_desc;
     int refcount, refcount2;
     HANDLE handle, handle1;
+    D3DFORMAT *formats;
+    UINT token, count;
     IDirect3D9 *d3d;
     HWND window;
-    UINT token;
     HRESULT hr;
     RECT rect;
 
@@ -297,6 +300,24 @@ static void test_device_manager(void)
 
     IDirectXVideoAccelerationService_Release(accel_service);
 
+    /* RT formats. */
+    hr = DXVA2CreateVideoService(device, &IID_IDirectXVideoProcessorService, (void **)&proc_service);
+    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+
+    memset(&video_desc, 0, sizeof(video_desc));
+    video_desc.SampleWidth = 64;
+    video_desc.SampleHeight = 64;
+    video_desc.Format = D3DFMT_A8R8G8B8;
+
+    count = 0;
+    hr = IDirectXVideoProcessorService_GetVideoProcessorRenderTargets(proc_service, &DXVA2_VideoProcSoftwareDevice,
+            &video_desc, &count, &formats);
+    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(count, "Unexpected format count %u.\n", count);
+    CoTaskMemFree(formats);
+
+    IDirectXVideoProcessorService_Release(proc_service);
+
     hr = IDirect3DDeviceManager9_OpenDeviceHandle(manager, &handle);
     ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
 




More information about the wine-cvs mailing list