From: Elizabeth Figura zfigura@codeweavers.com
--- dlls/d3d11/device.c | 14 ++++++++++---- dlls/wined3d/Makefile.in | 1 + dlls/wined3d/adapter_gl.c | 1 + dlls/wined3d/adapter_vk.c | 1 + dlls/wined3d/decoder.c | 29 +++++++++++++++++++++++++++++ dlls/wined3d/device.c | 27 +++++++++++++++++++++++++++ dlls/wined3d/directx.c | 1 + dlls/wined3d/wined3d.spec | 2 ++ dlls/wined3d/wined3d_private.h | 11 +++++++++++ include/wine/wined3d.h | 2 ++ 10 files changed, 85 insertions(+), 4 deletions(-) create mode 100644 dlls/wined3d/decoder.c
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c index 5c819f4e983..9d4c137b3de 100644 --- a/dlls/d3d11/device.c +++ b/dlls/d3d11/device.c @@ -7456,15 +7456,21 @@ static HRESULT STDMETHODCALLTYPE d3d11_video_device_CreateVideoProcessorEnumerat
static UINT STDMETHODCALLTYPE d3d11_video_device_GetVideoDecoderProfileCount(ID3D11VideoDevice1 *iface) { - FIXME("iface %p, stub!\n", iface); - return 0; + struct d3d_device *device = impl_from_ID3D11VideoDevice1(iface); + + TRACE("iface %p.\n", iface); + + return wined3d_device_get_video_decode_profile_count(device->wined3d_device); }
static HRESULT STDMETHODCALLTYPE d3d11_video_device_GetVideoDecoderProfile( ID3D11VideoDevice1 *iface, UINT index, GUID *profile) { - FIXME("iface %p, index %u, profile %p, stub!\n", iface, index, profile); - return E_NOTIMPL; + struct d3d_device *device = impl_from_ID3D11VideoDevice1(iface); + + TRACE("iface %p, index %u, profile %p.\n", iface, index, profile); + + return wined3d_device_get_video_decode_profile(device->wined3d_device, index, profile); }
static HRESULT STDMETHODCALLTYPE d3d11_video_device_CheckVideoDecoderFormat( diff --git a/dlls/wined3d/Makefile.in b/dlls/wined3d/Makefile.in index 128956c66be..19a36c25674 100644 --- a/dlls/wined3d/Makefile.in +++ b/dlls/wined3d/Makefile.in @@ -11,6 +11,7 @@ SOURCES = \ context_gl.c \ context_vk.c \ cs.c \ + decoder.c \ device.c \ directx.c \ ffp_gl.c \ diff --git a/dlls/wined3d/adapter_gl.c b/dlls/wined3d/adapter_gl.c index 0c90f67dcda..6f2e003b3ed 100644 --- a/dlls/wined3d/adapter_gl.c +++ b/dlls/wined3d/adapter_gl.c @@ -3693,6 +3693,7 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter_gl *adapter_gl, adapter->shader_backend = &glsl_shader_backend; adapter->vertex_pipe = &glsl_vertex_pipe; adapter->fragment_pipe = &glsl_fragment_pipe; + adapter->decoder_ops = &wined3d_null_decoder_ops;
if (gl_info->supported[ARB_FRAMEBUFFER_OBJECT]) { diff --git a/dlls/wined3d/adapter_vk.c b/dlls/wined3d/adapter_vk.c index 8dc944fafb6..1974535e52a 100644 --- a/dlls/wined3d/adapter_vk.c +++ b/dlls/wined3d/adapter_vk.c @@ -2528,6 +2528,7 @@ static BOOL wined3d_adapter_vk_init(struct wined3d_adapter_vk *adapter_vk, adapter->fragment_pipe = wined3d_spirv_fragment_pipe_init_vk(); adapter->misc_state_template = misc_state_template_vk; adapter->shader_backend = wined3d_spirv_shader_backend_init_vk(); + adapter->decoder_ops = &wined3d_null_decoder_ops;
wined3d_adapter_vk_init_d3d_info(adapter_vk, wined3d_creation_flags);
diff --git a/dlls/wined3d/decoder.c b/dlls/wined3d/decoder.c new file mode 100644 index 00000000000..44f36e551da --- /dev/null +++ b/dlls/wined3d/decoder.c @@ -0,0 +1,29 @@ +/* + * Copyright 2024 Elizabeth Figura for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "wined3d_private.h" + +static void wined3d_null_decoder_get_profiles(struct wined3d_adapter *adapter, unsigned int *count, GUID *profiles) +{ + *count = 0; +} + +const struct wined3d_decoder_ops wined3d_null_decoder_ops = +{ + .get_profiles = wined3d_null_decoder_get_profiles, +}; diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 9c0a6344229..02836acb861 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -5636,3 +5636,30 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL else return CallWindowProcA(proc, window, message, wparam, lparam); } + +unsigned int CDECL wined3d_device_get_video_decode_profile_count(struct wined3d_device *device) +{ + GUID profiles[WINED3D_DECODER_MAX_PROFILE_COUNT]; + unsigned int count; + + TRACE("device %p.\n", device); + + device->adapter->decoder_ops->get_profiles(device->adapter, &count, profiles); + return count; +} + +HRESULT CDECL wined3d_device_get_video_decode_profile(struct wined3d_device *device, unsigned int idx, GUID *profile) +{ + GUID profiles[WINED3D_DECODER_MAX_PROFILE_COUNT]; + unsigned int count; + + TRACE("device %p, idx %u.\n", device, idx); + + device->adapter->decoder_ops->get_profiles(device->adapter, &count, profiles); + + if (idx >= count) + return E_INVALIDARG; + + *profile = profiles[idx]; + return S_OK; +} diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index dfe6b35ed0a..22c69b97410 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -3353,6 +3353,7 @@ static struct wined3d_adapter *wined3d_adapter_no3d_create(unsigned int ordinal, adapter->fragment_pipe = &none_fragment_pipe; adapter->misc_state_template = misc_state_template_no3d; adapter->shader_backend = &none_shader_backend; + adapter->decoder_ops = &wined3d_null_decoder_ops;
wined3d_adapter_no3d_init_d3d_info(adapter, wined3d_creation_flags);
diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec index fa0dcd3ed39..e0b15c02b42 100644 --- a/dlls/wined3d/wined3d.spec +++ b/dlls/wined3d/wined3d.spec @@ -71,6 +71,8 @@ @ cdecl wined3d_device_get_state(ptr) @ cdecl wined3d_device_get_swapchain(ptr long) @ cdecl wined3d_device_get_swapchain_count(ptr) +@ cdecl wined3d_device_get_video_decode_profile_count(ptr) +@ cdecl wined3d_device_get_video_decode_profile(ptr long ptr) @ cdecl wined3d_device_get_wined3d(ptr) @ cdecl wined3d_device_incref(ptr) @ cdecl wined3d_device_process_vertices(ptr ptr long long long ptr ptr long long) diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 50d4d958e24..6ef9ace1345 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -43,6 +43,7 @@ #include "wingdi.h" #include "winuser.h" #include "winternl.h" +#include "dxva.h" #include "ddk/d3dkmthk.h" #include "wine/debug.h"
@@ -2622,6 +2623,7 @@ struct wined3d_adapter const struct wined3d_fragment_pipe_ops *fragment_pipe; const struct wined3d_state_entry_template *misc_state_template; const struct wined3d_shader_backend_ops *shader_backend; + const struct wined3d_decoder_ops *decoder_ops; const struct wined3d_adapter_ops *adapter_ops; };
@@ -4459,6 +4461,15 @@ struct wined3d_palette uint32_t flags; };
+#define WINED3D_DECODER_MAX_PROFILE_COUNT 1 + +struct wined3d_decoder_ops +{ + void (*get_profiles)(struct wined3d_adapter *adapter, unsigned int *count, GUID *profiles); +}; + +extern const struct wined3d_decoder_ops wined3d_null_decoder_ops; + /* DirectDraw utility functions */ extern enum wined3d_format_id pixelformat_for_depth(DWORD depth);
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index 85e12f8e621..1b2b37fdfd0 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -2403,6 +2403,8 @@ struct wined3d_state * __cdecl wined3d_device_get_state(struct wined3d_device *d struct wined3d_swapchain * __cdecl wined3d_device_get_swapchain(const struct wined3d_device *device, UINT swapchain_idx); UINT __cdecl wined3d_device_get_swapchain_count(const struct wined3d_device *device); +unsigned int __cdecl wined3d_device_get_video_decode_profile_count(struct wined3d_device *device); +HRESULT __cdecl wined3d_device_get_video_decode_profile(struct wined3d_device *device, unsigned int idx, GUID *profile); struct wined3d * __cdecl wined3d_device_get_wined3d(const struct wined3d_device *device); ULONG __cdecl wined3d_device_incref(struct wined3d_device *device); HRESULT __cdecl wined3d_device_process_vertices(struct wined3d_device *device, struct wined3d_stateblock *stateblock,