ReactOS 0.4.17-dev-923-g4c9a150
swapchain.c File Reference
#include "dxgi_private.h"
#include "wine/vulkan.h"
#include <vkd3d.h>
Include dependency graph for swapchain.c:

Go to the source code of this file.

Classes

struct  dxgi_vk_funcs
 
struct  d3d12_swapchain
 
struct  d3d12_swapchain_op
 

Macros

#define VKD3D_NO_VULKAN_H
 
#define VKD3D_NO_WIN32_TYPES
 
#define INVALID_VK_IMAGE_INDEX   (~(uint32_t)0)
 
#define LOAD_INSTANCE_PFN(name)
 
#define LOAD_DEVICE_PFN(name)
 

Enumerations

enum  d3d12_swapchain_op_type { D3D12_SWAPCHAIN_OP_PRESENT , D3D12_SWAPCHAIN_OP_RESIZE_BUFFERS }
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (dxgi)
 
 WINE_DECLARE_DEBUG_CHANNEL (winediag)
 
static DXGI_SWAP_EFFECT dxgi_swap_effect_from_wined3d (enum wined3d_swap_effect swap_effect)
 
static BOOL dxgi_validate_flip_swap_effect_format (DXGI_FORMAT format)
 
BOOL dxgi_validate_swapchain_desc (const DXGI_SWAP_CHAIN_DESC1 *desc)
 
HRESULT dxgi_get_output_from_window (IWineDXGIFactory *factory, HWND window, IDXGIOutput **dxgi_output)
 
static HRESULT dxgi_swapchain_resize_target (struct wined3d_swapchain_state *state, const DXGI_MODE_DESC *target_mode_desc)
 
static HWND d3d11_swapchain_get_hwnd (struct d3d11_swapchain *swapchain)
 
static struct d3d11_swapchain * d3d11_swapchain_from_IDXGISwapChain4 (IDXGISwapChain4 *iface)
 
static HRESULT STDMETHODCALLTYPE d3d11_swapchain_QueryInterface (IDXGISwapChain4 *iface, REFIID riid, void **object)
 
static ULONG STDMETHODCALLTYPE d3d11_swapchain_AddRef (IDXGISwapChain4 *iface)
 
static ULONG STDMETHODCALLTYPE d3d11_swapchain_Release (IDXGISwapChain4 *iface)
 
static HRESULT STDMETHODCALLTYPE d3d11_swapchain_SetPrivateData (IDXGISwapChain4 *iface, REFGUID guid, UINT data_size, const void *data)
 
static HRESULT STDMETHODCALLTYPE d3d11_swapchain_SetPrivateDataInterface (IDXGISwapChain4 *iface, REFGUID guid, const IUnknown *object)
 
static HRESULT STDMETHODCALLTYPE d3d11_swapchain_GetPrivateData (IDXGISwapChain4 *iface, REFGUID guid, UINT *data_size, void *data)
 
static HRESULT STDMETHODCALLTYPE d3d11_swapchain_GetParent (IDXGISwapChain4 *iface, REFIID riid, void **parent)
 
static HRESULT STDMETHODCALLTYPE d3d11_swapchain_GetDevice (IDXGISwapChain4 *iface, REFIID riid, void **device)
 
static HRESULT d3d11_swapchain_present (struct d3d11_swapchain *swapchain, unsigned int sync_interval, unsigned int flags)
 
static HRESULT STDMETHODCALLTYPE DECLSPEC_HOTPATCH d3d11_swapchain_Present (IDXGISwapChain4 *iface, UINT sync_interval, UINT flags)
 
static HRESULT STDMETHODCALLTYPE d3d11_swapchain_GetBuffer (IDXGISwapChain4 *iface, UINT buffer_idx, REFIID riid, void **surface)
 
static HRESULT STDMETHODCALLTYPE DECLSPEC_HOTPATCH d3d11_swapchain_SetFullscreenState (IDXGISwapChain4 *iface, BOOL fullscreen, IDXGIOutput *target)
 
static HRESULT STDMETHODCALLTYPE d3d11_swapchain_GetFullscreenState (IDXGISwapChain4 *iface, BOOL *fullscreen, IDXGIOutput **target)
 
static HRESULT STDMETHODCALLTYPE d3d11_swapchain_GetDesc (IDXGISwapChain4 *iface, DXGI_SWAP_CHAIN_DESC *desc)
 
static HRESULT d3d11_swapchain_create_d3d11_textures (struct d3d11_swapchain *swapchain, IWineDXGIDevice *device, struct wined3d_swapchain_desc *desc)
 
static HRESULT STDMETHODCALLTYPE d3d11_swapchain_ResizeBuffers (IDXGISwapChain4 *iface, UINT buffer_count, UINT width, UINT height, DXGI_FORMAT format, UINT flags)
 
static HRESULT STDMETHODCALLTYPE d3d11_swapchain_ResizeTarget (IDXGISwapChain4 *iface, const DXGI_MODE_DESC *target_mode_desc)
 
static HRESULT STDMETHODCALLTYPE d3d11_swapchain_GetContainingOutput (IDXGISwapChain4 *iface, IDXGIOutput **output)
 
static HRESULT STDMETHODCALLTYPE d3d11_swapchain_GetFrameStatistics (IDXGISwapChain4 *iface, DXGI_FRAME_STATISTICS *stats)
 
static HRESULT STDMETHODCALLTYPE d3d11_swapchain_GetLastPresentCount (IDXGISwapChain4 *iface, UINT *last_present_count)
 
static HRESULT STDMETHODCALLTYPE d3d11_swapchain_GetDesc1 (IDXGISwapChain4 *iface, DXGI_SWAP_CHAIN_DESC1 *desc)
 
static HRESULT STDMETHODCALLTYPE d3d11_swapchain_GetFullscreenDesc (IDXGISwapChain4 *iface, DXGI_SWAP_CHAIN_FULLSCREEN_DESC *desc)
 
static HRESULT STDMETHODCALLTYPE d3d11_swapchain_GetHwnd (IDXGISwapChain4 *iface, HWND *hwnd)
 
static HRESULT STDMETHODCALLTYPE d3d11_swapchain_GetCoreWindow (IDXGISwapChain4 *iface, REFIID iid, void **core_window)
 
static HRESULT STDMETHODCALLTYPE d3d11_swapchain_Present1 (IDXGISwapChain4 *iface, UINT sync_interval, UINT flags, const DXGI_PRESENT_PARAMETERS *present_parameters)
 
static BOOL STDMETHODCALLTYPE d3d11_swapchain_IsTemporaryMonoSupported (IDXGISwapChain4 *iface)
 
static HRESULT STDMETHODCALLTYPE d3d11_swapchain_GetRestrictToOutput (IDXGISwapChain4 *iface, IDXGIOutput **output)
 
static HRESULT STDMETHODCALLTYPE d3d11_swapchain_SetBackgroundColor (IDXGISwapChain4 *iface, const DXGI_RGBA *color)
 
static HRESULT STDMETHODCALLTYPE d3d11_swapchain_GetBackgroundColor (IDXGISwapChain4 *iface, DXGI_RGBA *color)
 
static HRESULT STDMETHODCALLTYPE d3d11_swapchain_SetRotation (IDXGISwapChain4 *iface, DXGI_MODE_ROTATION rotation)
 
static HRESULT STDMETHODCALLTYPE d3d11_swapchain_GetRotation (IDXGISwapChain4 *iface, DXGI_MODE_ROTATION *rotation)
 
static HRESULT STDMETHODCALLTYPE d3d11_swapchain_SetSourceSize (IDXGISwapChain4 *iface, UINT width, UINT height)
 
static HRESULT STDMETHODCALLTYPE d3d11_swapchain_GetSourceSize (IDXGISwapChain4 *iface, UINT *width, UINT *height)
 
static HRESULT STDMETHODCALLTYPE d3d11_swapchain_SetMaximumFrameLatency (IDXGISwapChain4 *iface, UINT max_latency)
 
static HRESULT STDMETHODCALLTYPE d3d11_swapchain_GetMaximumFrameLatency (IDXGISwapChain4 *iface, UINT *max_latency)
 
static HANDLE STDMETHODCALLTYPE d3d11_swapchain_GetFrameLatencyWaitableObject (IDXGISwapChain4 *iface)
 
static HRESULT STDMETHODCALLTYPE d3d11_swapchain_SetMatrixTransform (IDXGISwapChain4 *iface, const DXGI_MATRIX_3X2_F *matrix)
 
static HRESULT STDMETHODCALLTYPE d3d11_swapchain_GetMatrixTransform (IDXGISwapChain4 *iface, DXGI_MATRIX_3X2_F *matrix)
 
static UINT STDMETHODCALLTYPE d3d11_swapchain_GetCurrentBackBufferIndex (IDXGISwapChain4 *iface)
 
static HRESULT STDMETHODCALLTYPE d3d11_swapchain_CheckColorSpaceSupport (IDXGISwapChain4 *iface, DXGI_COLOR_SPACE_TYPE colour_space, UINT *colour_space_support)
 
static HRESULT STDMETHODCALLTYPE d3d11_swapchain_SetColorSpace1 (IDXGISwapChain4 *iface, DXGI_COLOR_SPACE_TYPE colour_space)
 
static HRESULT STDMETHODCALLTYPE d3d11_swapchain_ResizeBuffers1 (IDXGISwapChain4 *iface, UINT buffer_count, UINT width, UINT height, DXGI_FORMAT format, UINT flags, const UINT *node_mask, IUnknown *const *present_queue)
 
static HRESULT STDMETHODCALLTYPE d3d11_swapchain_SetHDRMetaData (IDXGISwapChain4 *iface, DXGI_HDR_METADATA_TYPE type, UINT size, void *metadata)
 
static void STDMETHODCALLTYPE d3d11_swapchain_wined3d_object_released (void *parent)
 
static struct d3d11_swapchain * d3d11_swapchain_from_wined3d_swapchain_state_parent (struct wined3d_swapchain_state_parent *parent)
 
static void CDECL d3d11_swapchain_windowed_state_changed (struct wined3d_swapchain_state_parent *parent, BOOL windowed)
 
HRESULT d3d11_swapchain_init (struct d3d11_swapchain *swapchain, struct dxgi_device *device, struct wined3d_swapchain_desc *desc)
 
static HRESULT hresult_from_vk_result (VkResult vr)
 
static void d3d12_swapchain_op_destroy (struct d3d12_swapchain *swapchain, struct d3d12_swapchain_op *op)
 
static HRESULT d3d12_swapchain_op_present_execute (struct d3d12_swapchain *swapchain, struct d3d12_swapchain_op *op)
 
static HRESULT d3d12_swapchain_op_resize_buffers_execute (struct d3d12_swapchain *swapchain, struct d3d12_swapchain_op *op)
 
static DWORD WINAPI d3d12_swapchain_worker_proc (void *data)
 
static DXGI_FORMAT dxgi_format_from_vk_format (VkFormat vk_format)
 
static VkFormat get_swapchain_fallback_format (VkFormat vk_format)
 
static HRESULT select_vk_format (const struct dxgi_vk_funcs *vk_funcs, VkPhysicalDevice vk_physical_device, VkSurfaceKHR vk_surface, const DXGI_SWAP_CHAIN_DESC1 *swapchain_desc, VkFormat *vk_format)
 
static HRESULT vk_select_memory_type (const struct dxgi_vk_funcs *vk_funcs, VkPhysicalDevice vk_physical_device, uint32_t memory_type_mask, VkMemoryPropertyFlags flags, uint32_t *memory_type_index)
 
static BOOL d3d12_swapchain_is_present_mode_supported (struct d3d12_swapchain *swapchain, VkPresentModeKHR present_mode)
 
static HRESULT d3d12_swapchain_create_user_buffers (struct d3d12_swapchain *swapchain)
 
static void vk_cmd_image_barrier (const struct dxgi_vk_funcs *vk_funcs, VkCommandBuffer cmd_buffer, VkPipelineStageFlags src_stage_mask, VkPipelineStageFlags dst_stage_mask, VkAccessFlags src_access_mask, VkAccessFlags dst_access_mask, VkImageLayout old_layout, VkImageLayout new_layout, VkImage image)
 
static VkResult d3d12_swapchain_record_swapchain_blit (struct d3d12_swapchain *swapchain, VkCommandBuffer vk_cmd_buffer, VkImage vk_dst_image, VkImage vk_src_image)
 
static HRESULT d3d12_swapchain_create_command_buffers (struct d3d12_swapchain *swapchain)
 
static HRESULT d3d12_swapchain_create_image_resources (struct d3d12_swapchain *swapchain)
 
static VkResult d3d12_swapchain_acquire_next_vulkan_image (struct d3d12_swapchain *swapchain)
 
static void d3d12_swapchain_destroy_vulkan_resources (struct d3d12_swapchain *swapchain)
 
static void d3d12_swapchain_destroy_d3d12_resources (struct d3d12_swapchain *swapchain)
 
static HRESULT d3d12_swapchain_create_vulkan_swapchain (struct d3d12_swapchain *swapchain)
 
static HRESULT d3d12_swapchain_create_vulkan_resources (struct d3d12_swapchain *swapchain)
 
static HRESULT d3d12_swapchain_create_d3d12_resources (struct d3d12_swapchain *swapchain)
 
static struct d3d12_swapchain * d3d12_swapchain_from_IDXGISwapChain4 (IDXGISwapChain4 *iface)
 
static HRESULT STDMETHODCALLTYPE d3d12_swapchain_QueryInterface (IDXGISwapChain4 *iface, REFIID iid, void **object)
 
static ULONG STDMETHODCALLTYPE d3d12_swapchain_AddRef (IDXGISwapChain4 *iface)
 
static void d3d12_swapchain_destroy (struct d3d12_swapchain *swapchain)
 
static ULONG STDMETHODCALLTYPE d3d12_swapchain_Release (IDXGISwapChain4 *iface)
 
static HRESULT STDMETHODCALLTYPE d3d12_swapchain_SetPrivateData (IDXGISwapChain4 *iface, REFGUID guid, UINT data_size, const void *data)
 
static HRESULT STDMETHODCALLTYPE d3d12_swapchain_SetPrivateDataInterface (IDXGISwapChain4 *iface, REFGUID guid, const IUnknown *object)
 
static HRESULT STDMETHODCALLTYPE d3d12_swapchain_GetPrivateData (IDXGISwapChain4 *iface, REFGUID guid, UINT *data_size, void *data)
 
static HRESULT STDMETHODCALLTYPE d3d12_swapchain_GetParent (IDXGISwapChain4 *iface, REFIID iid, void **parent)
 
static HRESULT STDMETHODCALLTYPE d3d12_swapchain_GetDevice (IDXGISwapChain4 *iface, REFIID iid, void **device)
 
static HRESULT d3d12_swapchain_set_sync_interval (struct d3d12_swapchain *swapchain, unsigned int sync_interval)
 
static VkResult d3d12_swapchain_queue_present (struct d3d12_swapchain *swapchain, VkImage vk_src_image, uint64_t frame_number)
 
static HRESULT d3d12_swapchain_present (struct d3d12_swapchain *swapchain, unsigned int sync_interval, unsigned int flags)
 
static HRESULT STDMETHODCALLTYPE d3d12_swapchain_Present (IDXGISwapChain4 *iface, UINT sync_interval, UINT flags)
 
static HRESULT STDMETHODCALLTYPE d3d12_swapchain_GetBuffer (IDXGISwapChain4 *iface, UINT buffer_idx, REFIID iid, void **surface)
 
static HRESULT STDMETHODCALLTYPE DECLSPEC_HOTPATCH d3d12_swapchain_SetFullscreenState (IDXGISwapChain4 *iface, BOOL fullscreen, IDXGIOutput *target)
 
static HRESULT STDMETHODCALLTYPE d3d12_swapchain_GetFullscreenState (IDXGISwapChain4 *iface, BOOL *fullscreen, IDXGIOutput **target)
 
static HRESULT STDMETHODCALLTYPE d3d12_swapchain_GetDesc (IDXGISwapChain4 *iface, DXGI_SWAP_CHAIN_DESC *desc)
 
static HRESULT d3d12_swapchain_resize_buffers (struct d3d12_swapchain *swapchain, UINT buffer_count, UINT width, UINT height, DXGI_FORMAT format, UINT flags)
 
static HRESULT STDMETHODCALLTYPE d3d12_swapchain_ResizeBuffers (IDXGISwapChain4 *iface, UINT buffer_count, UINT width, UINT height, DXGI_FORMAT format, UINT flags)
 
static HRESULT STDMETHODCALLTYPE d3d12_swapchain_ResizeTarget (IDXGISwapChain4 *iface, const DXGI_MODE_DESC *target_mode_desc)
 
static HRESULT STDMETHODCALLTYPE d3d12_swapchain_GetContainingOutput (IDXGISwapChain4 *iface, IDXGIOutput **output)
 
static HRESULT STDMETHODCALLTYPE d3d12_swapchain_GetFrameStatistics (IDXGISwapChain4 *iface, DXGI_FRAME_STATISTICS *stats)
 
static HRESULT STDMETHODCALLTYPE d3d12_swapchain_GetLastPresentCount (IDXGISwapChain4 *iface, UINT *last_present_count)
 
static HRESULT STDMETHODCALLTYPE d3d12_swapchain_GetDesc1 (IDXGISwapChain4 *iface, DXGI_SWAP_CHAIN_DESC1 *desc)
 
static HRESULT STDMETHODCALLTYPE d3d12_swapchain_GetFullscreenDesc (IDXGISwapChain4 *iface, DXGI_SWAP_CHAIN_FULLSCREEN_DESC *desc)
 
static HRESULT STDMETHODCALLTYPE d3d12_swapchain_GetHwnd (IDXGISwapChain4 *iface, HWND *hwnd)
 
static HRESULT STDMETHODCALLTYPE d3d12_swapchain_GetCoreWindow (IDXGISwapChain4 *iface, REFIID iid, void **core_window)
 
static HRESULT STDMETHODCALLTYPE d3d12_swapchain_Present1 (IDXGISwapChain4 *iface, UINT sync_interval, UINT flags, const DXGI_PRESENT_PARAMETERS *present_parameters)
 
static BOOL STDMETHODCALLTYPE d3d12_swapchain_IsTemporaryMonoSupported (IDXGISwapChain4 *iface)
 
static HRESULT STDMETHODCALLTYPE d3d12_swapchain_GetRestrictToOutput (IDXGISwapChain4 *iface, IDXGIOutput **output)
 
static HRESULT STDMETHODCALLTYPE d3d12_swapchain_SetBackgroundColor (IDXGISwapChain4 *iface, const DXGI_RGBA *color)
 
static HRESULT STDMETHODCALLTYPE d3d12_swapchain_GetBackgroundColor (IDXGISwapChain4 *iface, DXGI_RGBA *color)
 
static HRESULT STDMETHODCALLTYPE d3d12_swapchain_SetRotation (IDXGISwapChain4 *iface, DXGI_MODE_ROTATION rotation)
 
static HRESULT STDMETHODCALLTYPE d3d12_swapchain_GetRotation (IDXGISwapChain4 *iface, DXGI_MODE_ROTATION *rotation)
 
static HRESULT STDMETHODCALLTYPE d3d12_swapchain_SetSourceSize (IDXGISwapChain4 *iface, UINT width, UINT height)
 
static HRESULT STDMETHODCALLTYPE d3d12_swapchain_GetSourceSize (IDXGISwapChain4 *iface, UINT *width, UINT *height)
 
static HRESULT STDMETHODCALLTYPE d3d12_swapchain_SetMaximumFrameLatency (IDXGISwapChain4 *iface, UINT max_latency)
 
static HRESULT STDMETHODCALLTYPE d3d12_swapchain_GetMaximumFrameLatency (IDXGISwapChain4 *iface, UINT *max_latency)
 
static HANDLE STDMETHODCALLTYPE d3d12_swapchain_GetFrameLatencyWaitableObject (IDXGISwapChain4 *iface)
 
static HRESULT STDMETHODCALLTYPE d3d12_swapchain_SetMatrixTransform (IDXGISwapChain4 *iface, const DXGI_MATRIX_3X2_F *matrix)
 
static HRESULT STDMETHODCALLTYPE d3d12_swapchain_GetMatrixTransform (IDXGISwapChain4 *iface, DXGI_MATRIX_3X2_F *matrix)
 
static UINT STDMETHODCALLTYPE d3d12_swapchain_GetCurrentBackBufferIndex (IDXGISwapChain4 *iface)
 
static HRESULT STDMETHODCALLTYPE d3d12_swapchain_CheckColorSpaceSupport (IDXGISwapChain4 *iface, DXGI_COLOR_SPACE_TYPE colour_space, UINT *colour_space_support)
 
static HRESULT STDMETHODCALLTYPE d3d12_swapchain_SetColorSpace1 (IDXGISwapChain4 *iface, DXGI_COLOR_SPACE_TYPE colour_space)
 
static HRESULT STDMETHODCALLTYPE d3d12_swapchain_ResizeBuffers1 (IDXGISwapChain4 *iface, UINT buffer_count, UINT width, UINT height, DXGI_FORMAT format, UINT flags, const UINT *node_mask, IUnknown *const *present_queue)
 
static HRESULT STDMETHODCALLTYPE d3d12_swapchain_SetHDRMetaData (IDXGISwapChain4 *iface, DXGI_HDR_METADATA_TYPE type, UINT size, void *metadata)
 
static BOOL init_vk_funcs (struct dxgi_vk_funcs *dxgi, VkInstance vk_instance, VkDevice vk_device)
 
static struct d3d12_swapchain * d3d12_swapchain_from_wined3d_swapchain_state_parent (struct wined3d_swapchain_state_parent *parent)
 
static void CDECL d3d12_swapchain_windowed_state_changed (struct wined3d_swapchain_state_parent *parent, BOOL windowed)
 
static HRESULT d3d12_swapchain_init (struct d3d12_swapchain *swapchain, IWineDXGIFactory *factory, ID3D12Device *device, ID3D12CommandQueue *queue, HWND window, const DXGI_SWAP_CHAIN_DESC1 *swapchain_desc, const DXGI_SWAP_CHAIN_FULLSCREEN_DESC *fullscreen_desc)
 
HRESULT d3d12_swapchain_create (IWineDXGIFactory *factory, ID3D12CommandQueue *queue, HWND window, const DXGI_SWAP_CHAIN_DESC1 *swapchain_desc, const DXGI_SWAP_CHAIN_FULLSCREEN_DESC *fullscreen_desc, IDXGISwapChain1 **swapchain)
 

Variables

static const struct IDXGISwapChain4Vtbl d3d11_swapchain_vtbl
 
static const struct wined3d_parent_ops d3d11_swapchain_wined3d_parent_ops
 
static const struct wined3d_swapchain_state_parent_ops d3d11_swapchain_state_parent_ops
 
static const struct IDXGISwapChain4Vtbl d3d12_swapchain_vtbl
 
static const struct wined3d_swapchain_state_parent_ops d3d12_swapchain_state_parent_ops
 

Macro Definition Documentation

◆ INVALID_VK_IMAGE_INDEX

#define INVALID_VK_IMAGE_INDEX   (~(uint32_t)0)

Definition at line 1129 of file swapchain.c.

◆ LOAD_DEVICE_PFN

#define LOAD_DEVICE_PFN (   name)
Value:
if (!(dxgi->p_##name = (void *)vkGetDeviceProcAddr(vk_device, #name))) \
{ \
ERR("Failed to get device proc "#name".\n"); \
FreeLibrary(dxgi->vulkan_module); \
return FALSE; \
}
#define FALSE
Definition: types.h:117
Definition: name.c:39
PFN_vkVoidFunction VKAPI_CALL vkGetDeviceProcAddr(VkDevice device, const char *pName)

◆ LOAD_INSTANCE_PFN

#define LOAD_INSTANCE_PFN (   name)
Value:
if (!(dxgi->p_##name = (void *)vkGetInstanceProcAddr(vk_instance, #name))) \
{ \
ERR("Failed to get instance proc "#name".\n"); \
FreeLibrary(dxgi->vulkan_module); \
return FALSE; \
}
PFN_vkVoidFunction VKAPI_CALL vkGetInstanceProcAddr(VkInstance instance, const char *pName)

◆ VKD3D_NO_VULKAN_H

#define VKD3D_NO_VULKAN_H

Definition at line 22 of file swapchain.c.

◆ VKD3D_NO_WIN32_TYPES

#define VKD3D_NO_WIN32_TYPES

Definition at line 23 of file swapchain.c.

Enumeration Type Documentation

◆ d3d12_swapchain_op_type

Enumerator
D3D12_SWAPCHAIN_OP_PRESENT 
D3D12_SWAPCHAIN_OP_RESIZE_BUFFERS 

Definition at line 1201 of file swapchain.c.

1202{
1205};
@ D3D12_SWAPCHAIN_OP_PRESENT
Definition: swapchain.c:1203
@ D3D12_SWAPCHAIN_OP_RESIZE_BUFFERS
Definition: swapchain.c:1204

Function Documentation

◆ d3d11_swapchain_AddRef()

static ULONG STDMETHODCALLTYPE d3d11_swapchain_AddRef ( IDXGISwapChain4 *  iface)
static

Definition at line 214 of file swapchain.c.

215{
216 struct d3d11_swapchain *swapchain = d3d11_swapchain_from_IDXGISwapChain4(iface);
218
219 TRACE("%p increasing refcount to %lu.\n", swapchain, refcount);
220
221 if (refcount == 1)
223
224 return refcount;
225}
#define InterlockedIncrement
Definition: armddk.h:53
static struct d3d11_swapchain * d3d11_swapchain_from_IDXGISwapChain4(IDXGISwapChain4 *iface)
Definition: swapchain.c:183
#define TRACE(s)
Definition: solgame.cpp:4
struct wined3d_swapchain * wined3d_swapchain
Definition: dxgi_private.h:178
uint32_t ULONG
Definition: typedefs.h:59
ULONG CDECL wined3d_swapchain_incref(struct wined3d_swapchain *swapchain)
Definition: swapchain.c:135

◆ d3d11_swapchain_CheckColorSpaceSupport()

static HRESULT STDMETHODCALLTYPE d3d11_swapchain_CheckColorSpaceSupport ( IDXGISwapChain4 *  iface,
DXGI_COLOR_SPACE_TYPE  colour_space,
UINT *  colour_space_support 
)
static

Definition at line 828 of file swapchain.c.

830{
831 FIXME("iface %p, colour_space %#x, colour_space_support %p stub!\n",
832 iface, colour_space, colour_space_support);
833
834 return E_NOTIMPL;
835}
#define FIXME(fmt,...)
Definition: precomp.h:53
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ d3d11_swapchain_create_d3d11_textures()

static HRESULT d3d11_swapchain_create_d3d11_textures ( struct d3d11_swapchain *  swapchain,
IWineDXGIDevice *  device,
struct wined3d_swapchain_desc *  desc 
)
static

Definition at line 956 of file swapchain.c.

958{
959 IWineDXGIDeviceParent *dxgi_device_parent;
960 unsigned int texture_flags = 0;
961 unsigned int i;
962 HRESULT hr;
963
964 if (FAILED(hr = IWineDXGIDevice_QueryInterface(device,
965 &IID_IWineDXGIDeviceParent, (void **)&dxgi_device_parent)))
966 {
967 ERR("Device should implement IWineDXGIDeviceParent.\n");
968 return E_FAIL;
969 }
970
972 texture_flags |= WINED3D_TEXTURE_CREATE_GET_DC;
973
974 for (i = 0; i < desc->backbuffer_count; ++i)
975 {
976 IDXGISurface *surface;
977
978 if (FAILED(hr = IWineDXGIDeviceParent_register_swapchain_texture(dxgi_device_parent,
979 wined3d_swapchain_get_back_buffer(swapchain->wined3d_swapchain, i), texture_flags, &surface)))
980 {
981 ERR("Failed to create parent swapchain texture, hr %#lx.\n", hr);
982 break;
983 }
984 IDXGISurface_Release(surface);
985 }
986
987 IWineDXGIDeviceParent_Release(dxgi_device_parent);
988 return hr;
989}
#define ERR(fmt,...)
Definition: precomp.h:57
#define E_FAIL
Definition: ddrawi.h:102
HRESULT hr
Definition: delayimp.cpp:582
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define FAILED(hr)
Definition: intsafe.h:51
D3D11_SHADER_VARIABLE_DESC desc
Definition: reflection.c:1683
Definition: devices.h:37
struct wined3d_texture *CDECL wined3d_swapchain_get_back_buffer(const struct wined3d_swapchain *swapchain, UINT back_buffer_idx)
Definition: swapchain.c:256
#define WINED3D_SWAPCHAIN_GDI_COMPATIBLE
Definition: wined3d.h:900
#define WINED3D_TEXTURE_CREATE_GET_DC
Definition: wined3d.h:1565

Referenced by d3d11_swapchain_init(), and d3d11_swapchain_ResizeBuffers().

◆ d3d11_swapchain_from_IDXGISwapChain4()

◆ d3d11_swapchain_from_wined3d_swapchain_state_parent()

static struct d3d11_swapchain * d3d11_swapchain_from_wined3d_swapchain_state_parent ( struct wined3d_swapchain_state_parent *  parent)
inlinestatic

Definition at line 932 of file swapchain.c.

933{
934 return CONTAINING_RECORD(parent, struct d3d11_swapchain, state_parent);
935}
r parent
Definition: btrfs.c:3010

Referenced by d3d11_swapchain_windowed_state_changed().

◆ d3d11_swapchain_get_hwnd()

static HWND d3d11_swapchain_get_hwnd ( struct d3d11_swapchain *  swapchain)
static

Definition at line 172 of file swapchain.c.

173{
174 struct wined3d_swapchain_desc wined3d_desc;
175
177 wined3d_swapchain_get_desc(swapchain->wined3d_swapchain, &wined3d_desc);
179
180 return wined3d_desc.device_window;
181}
void CDECL wined3d_swapchain_get_desc(const struct wined3d_swapchain *swapchain, struct wined3d_swapchain_desc *desc)
Definition: swapchain.c:345
void WINAPI wined3d_mutex_unlock(void)
Definition: wined3d_main.c:544
void WINAPI wined3d_mutex_lock(void)
Definition: wined3d_main.c:539

Referenced by d3d11_swapchain_GetContainingOutput(), d3d11_swapchain_GetHwnd(), and d3d11_swapchain_present().

◆ d3d11_swapchain_GetBackgroundColor()

static HRESULT STDMETHODCALLTYPE d3d11_swapchain_GetBackgroundColor ( IDXGISwapChain4 *  iface,
DXGI_RGBA *  color 
)
static

Definition at line 745 of file swapchain.c.

746{
747 FIXME("iface %p, color %p stub!\n", iface, color);
748
749 return E_NOTIMPL;
750}
GLuint color
Definition: glext.h:6243

◆ d3d11_swapchain_GetBuffer()

static HRESULT STDMETHODCALLTYPE d3d11_swapchain_GetBuffer ( IDXGISwapChain4 *  iface,
UINT  buffer_idx,
REFIID  riid,
void **  surface 
)
static

Definition at line 340 of file swapchain.c.

342{
343 struct d3d11_swapchain *swapchain = d3d11_swapchain_from_IDXGISwapChain4(iface);
344 struct wined3d_texture *texture;
346 HRESULT hr;
347
348 TRACE("iface %p, buffer_idx %u, riid %s, surface %p\n",
349 iface, buffer_idx, debugstr_guid(riid), surface);
350
352
353 if (!(texture = wined3d_swapchain_get_back_buffer(swapchain->wined3d_swapchain, buffer_idx)))
354 {
357 }
358
360 hr = IUnknown_QueryInterface(parent, riid, surface);
362
363 return hr;
364}
void *CDECL wined3d_texture_get_parent(const struct wined3d_texture *texture)
Definition: texture.c:1690
GLenum GLuint texture
Definition: glext.h:6295
REFIID riid
Definition: atlbase.h:39
#define debugstr_guid
Definition: kernel32.h:35
struct wined3d_swapchain * swapchain
#define DXGI_ERROR_INVALID_CALL
Definition: winerror.h:7120

◆ d3d11_swapchain_GetContainingOutput()

static HRESULT STDMETHODCALLTYPE d3d11_swapchain_GetContainingOutput ( IDXGISwapChain4 *  iface,
IDXGIOutput **  output 
)
static

Definition at line 573 of file swapchain.c.

574{
575 struct d3d11_swapchain *swapchain = d3d11_swapchain_from_IDXGISwapChain4(iface);
576 HWND window;
577
578 TRACE("iface %p, output %p.\n", iface, output);
579
580 if (swapchain->target)
581 {
582 IDXGIOutput_AddRef(*output = swapchain->target);
583 return S_OK;
584 }
585
586 window = d3d11_swapchain_get_hwnd(swapchain);
587 return dxgi_get_output_from_window(swapchain->factory, window, output);
588}
HRESULT dxgi_get_output_from_window(IWineDXGIFactory *factory, HWND window, IDXGIOutput **dxgi_output)
Definition: swapchain.c:103
static HWND d3d11_swapchain_get_hwnd(struct d3d11_swapchain *swapchain)
Definition: swapchain.c:172
#define S_OK
Definition: intsafe.h:52
static IHTMLWindow2 * window
Definition: events.c:77
IDXGIOutput * target
Definition: dxgi_private.h:183
IWineDXGIFactory * factory
Definition: dxgi_private.h:181

◆ d3d11_swapchain_GetCoreWindow()

static HRESULT STDMETHODCALLTYPE d3d11_swapchain_GetCoreWindow ( IDXGISwapChain4 *  iface,
REFIID  iid,
void **  core_window 
)
static

Definition at line 692 of file swapchain.c.

694{
695 FIXME("iface %p, iid %s, core_window %p stub!\n", iface, debugstr_guid(iid), core_window);
696
697 if (core_window)
698 *core_window = NULL;
699
701}
#define NULL
Definition: types.h:112

◆ d3d11_swapchain_GetCurrentBackBufferIndex()

static UINT STDMETHODCALLTYPE d3d11_swapchain_GetCurrentBackBufferIndex ( IDXGISwapChain4 *  iface)
static

Definition at line 821 of file swapchain.c.

822{
823 FIXME("iface %p stub!\n", iface);
824
825 return 0;
826}

◆ d3d11_swapchain_GetDesc()

static HRESULT STDMETHODCALLTYPE d3d11_swapchain_GetDesc ( IDXGISwapChain4 *  iface,
DXGI_SWAP_CHAIN_DESC *  desc 
)
static

Definition at line 475 of file swapchain.c.

476{
477 struct d3d11_swapchain *swapchain = d3d11_swapchain_from_IDXGISwapChain4(iface);
478 struct wined3d_swapchain_desc wined3d_desc;
479
480 TRACE("iface %p, desc %p.\n", iface, desc);
481
482 if (!desc)
483 {
484 WARN("Invalid pointer.\n");
485 return E_INVALIDARG;
486 }
487
489 wined3d_swapchain_get_desc(swapchain->wined3d_swapchain, &wined3d_desc);
491
492 FIXME("Ignoring ScanlineOrdering and Scaling.\n");
493
494 desc->BufferDesc.Width = wined3d_desc.backbuffer_width;
495 desc->BufferDesc.Height = wined3d_desc.backbuffer_height;
496 desc->BufferDesc.RefreshRate.Numerator = wined3d_desc.refresh_rate;
497 desc->BufferDesc.RefreshRate.Denominator = 1;
498 desc->BufferDesc.Format = dxgi_format_from_wined3dformat(wined3d_desc.backbuffer_format);
499 desc->BufferDesc.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED;
500 desc->BufferDesc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED;
502 wined3d_desc.multisample_type, wined3d_desc.multisample_quality);
503 desc->BufferUsage = dxgi_usage_from_wined3d_bind_flags(wined3d_desc.backbuffer_bind_flags);
504 desc->BufferCount = wined3d_desc.backbuffer_count;
505 desc->OutputWindow = wined3d_desc.device_window;
506 desc->Windowed = wined3d_desc.windowed;
507 desc->SwapEffect = dxgi_swap_effect_from_wined3d(wined3d_desc.swap_effect);
508 desc->Flags = dxgi_swapchain_flags_from_wined3d(wined3d_desc.flags);
509
510 return S_OK;
511}
#define WARN(fmt,...)
Definition: precomp.h:61
DXGI_FORMAT dxgi_format_from_wined3dformat(enum wined3d_format_id format)
Definition: utils.c:210
#define E_INVALIDARG
Definition: ddrawi.h:101
static DXGI_SWAP_EFFECT dxgi_swap_effect_from_wined3d(enum wined3d_swap_effect swap_effect)
Definition: swapchain.c:30
unsigned int dxgi_swapchain_flags_from_wined3d(unsigned int wined3d_flags)
Definition: utils.c:525
void dxgi_sample_desc_from_wined3d(DXGI_SAMPLE_DESC *desc, enum wined3d_multisample_type wined3d_type, unsigned int wined3d_quality)
Definition: utils.c:447
DXGI_USAGE dxgi_usage_from_wined3d_bind_flags(unsigned int wined3d_bind_flags)
Definition: utils.c:490
@ DXGI_MODE_SCALING_UNSPECIFIED
Definition: dxgitype.idl:46
@ DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED
Definition: dxgitype.idl:38

◆ d3d11_swapchain_GetDesc1()

static HRESULT STDMETHODCALLTYPE d3d11_swapchain_GetDesc1 ( IDXGISwapChain4 *  iface,
DXGI_SWAP_CHAIN_DESC1 *  desc 
)
static

Definition at line 612 of file swapchain.c.

613{
614 struct d3d11_swapchain *swapchain = d3d11_swapchain_from_IDXGISwapChain4(iface);
615 struct wined3d_swapchain_desc wined3d_desc;
616
617 TRACE("iface %p, desc %p.\n", iface, desc);
618
619 if (!desc)
620 {
621 WARN("Invalid pointer.\n");
622 return E_INVALIDARG;
623 }
624
626 wined3d_swapchain_get_desc(swapchain->wined3d_swapchain, &wined3d_desc);
628
629 FIXME("Ignoring Stereo, Scaling and AlphaMode.\n");
630
631 desc->Width = wined3d_desc.backbuffer_width;
632 desc->Height = wined3d_desc.backbuffer_height;
633 desc->Format = dxgi_format_from_wined3dformat(wined3d_desc.backbuffer_format);
634 desc->Stereo = FALSE;
636 wined3d_desc.multisample_type, wined3d_desc.multisample_quality);
637 desc->BufferUsage = dxgi_usage_from_wined3d_bind_flags(wined3d_desc.backbuffer_bind_flags);
638 desc->BufferCount = wined3d_desc.backbuffer_count;
639 desc->Scaling = DXGI_SCALING_STRETCH;
640 desc->SwapEffect = dxgi_swap_effect_from_wined3d(wined3d_desc.swap_effect);
641 desc->AlphaMode = DXGI_ALPHA_MODE_IGNORE;
642 desc->Flags = dxgi_swapchain_flags_from_wined3d(wined3d_desc.flags);
643
644 return S_OK;
645}
@ DXGI_ALPHA_MODE_IGNORE
Definition: dxgi1_2.idl:37

◆ d3d11_swapchain_GetDevice()

static HRESULT STDMETHODCALLTYPE d3d11_swapchain_GetDevice ( IDXGISwapChain4 *  iface,
REFIID  riid,
void **  device 
)
static

Definition at line 293 of file swapchain.c.

294{
295 struct d3d11_swapchain *swapchain = d3d11_swapchain_from_IDXGISwapChain4(iface);
296
297 TRACE("iface %p, riid %s, device %p.\n", iface, debugstr_guid(riid), device);
298
299 return IWineDXGIDevice_QueryInterface(swapchain->device, riid, device);
300}
IWineDXGIDevice * device
Definition: dxgi_private.h:180

◆ d3d11_swapchain_GetFrameLatencyWaitableObject()

static HANDLE STDMETHODCALLTYPE d3d11_swapchain_GetFrameLatencyWaitableObject ( IDXGISwapChain4 *  iface)
static

Definition at line 796 of file swapchain.c.

797{
798 FIXME("iface %p stub!\n", iface);
799
800 return NULL;
801}

◆ d3d11_swapchain_GetFrameStatistics()

static HRESULT STDMETHODCALLTYPE d3d11_swapchain_GetFrameStatistics ( IDXGISwapChain4 *  iface,
DXGI_FRAME_STATISTICS *  stats 
)
static

Definition at line 590 of file swapchain.c.

592{
593 FIXME("iface %p, stats %p stub!\n", iface, stats);
594
595 return E_NOTIMPL;
596}

◆ d3d11_swapchain_GetFullscreenDesc()

static HRESULT STDMETHODCALLTYPE d3d11_swapchain_GetFullscreenDesc ( IDXGISwapChain4 *  iface,
DXGI_SWAP_CHAIN_FULLSCREEN_DESC *  desc 
)
static

Definition at line 647 of file swapchain.c.

649{
650 struct d3d11_swapchain *swapchain = d3d11_swapchain_from_IDXGISwapChain4(iface);
651 struct wined3d_swapchain_desc wined3d_desc;
652
653 TRACE("iface %p, desc %p.\n", iface, desc);
654
655 if (!desc)
656 {
657 WARN("Invalid pointer.\n");
658 return E_INVALIDARG;
659 }
660
662 wined3d_swapchain_get_desc(swapchain->wined3d_swapchain, &wined3d_desc);
664
665 FIXME("Ignoring ScanlineOrdering and Scaling.\n");
666
667 desc->RefreshRate.Numerator = wined3d_desc.refresh_rate;
668 desc->RefreshRate.Denominator = 1;
669 desc->ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED;
671 desc->Windowed = wined3d_desc.windowed;
672
673 return S_OK;
674}

◆ d3d11_swapchain_GetFullscreenState()

static HRESULT STDMETHODCALLTYPE d3d11_swapchain_GetFullscreenState ( IDXGISwapChain4 *  iface,
BOOL *  fullscreen,
IDXGIOutput **  target 
)
static

Definition at line 437 of file swapchain.c.

439{
440 struct d3d11_swapchain *swapchain = d3d11_swapchain_from_IDXGISwapChain4(iface);
441 struct wined3d_swapchain_desc swapchain_desc;
442 HRESULT hr;
443
444 TRACE("iface %p, fullscreen %p, target %p.\n", iface, fullscreen, target);
445
446 if (fullscreen || target)
447 {
449 wined3d_swapchain_get_desc(swapchain->wined3d_swapchain, &swapchain_desc);
451 }
452
453 if (fullscreen)
454 *fullscreen = !swapchain_desc.windowed;
455
456 if (target)
457 {
458 if (!swapchain_desc.windowed)
459 {
460 if (!swapchain->target && FAILED(hr = IDXGISwapChain4_GetContainingOutput(iface, &swapchain->target)))
461 return hr;
462
463 *target = swapchain->target;
464 IDXGIOutput_AddRef(*target);
465 }
466 else
467 {
468 *target = NULL;
469 }
470 }
471
472 return S_OK;
473}
BOOL fullscreen
Definition: 3dtext.c:44
Definition: tools.h:99

◆ d3d11_swapchain_GetHwnd()

static HRESULT STDMETHODCALLTYPE d3d11_swapchain_GetHwnd ( IDXGISwapChain4 *  iface,
HWND *  hwnd 
)
static

Definition at line 676 of file swapchain.c.

677{
678 struct d3d11_swapchain *swapchain = d3d11_swapchain_from_IDXGISwapChain4(iface);
679
680 TRACE("iface %p, hwnd %p.\n", iface, hwnd);
681
682 if (!hwnd)
683 {
684 WARN("Invalid pointer.\n");
686 }
687
688 *hwnd = d3d11_swapchain_get_hwnd(swapchain);
689 return S_OK;
690}
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023

◆ d3d11_swapchain_GetLastPresentCount()

static HRESULT STDMETHODCALLTYPE d3d11_swapchain_GetLastPresentCount ( IDXGISwapChain4 *  iface,
UINT *  last_present_count 
)
static

Definition at line 598 of file swapchain.c.

600{
601 struct d3d11_swapchain *swapchain = d3d11_swapchain_from_IDXGISwapChain4(iface);
602
603 TRACE("iface %p, last_present_count %p.\n", iface, last_present_count);
604
605 *last_present_count = swapchain->present_count;
606
607 return S_OK;
608}

◆ d3d11_swapchain_GetMatrixTransform()

static HRESULT STDMETHODCALLTYPE d3d11_swapchain_GetMatrixTransform ( IDXGISwapChain4 *  iface,
DXGI_MATRIX_3X2_F *  matrix 
)
static

Definition at line 811 of file swapchain.c.

813{
814 FIXME("iface %p, matrix %p stub!\n", iface, matrix);
815
816 return E_NOTIMPL;
817}
GLuint GLenum matrix
Definition: glext.h:9407

◆ d3d11_swapchain_GetMaximumFrameLatency()

static HRESULT STDMETHODCALLTYPE d3d11_swapchain_GetMaximumFrameLatency ( IDXGISwapChain4 *  iface,
UINT *  max_latency 
)
static

Definition at line 789 of file swapchain.c.

790{
791 FIXME("iface %p, max_latency %p stub!\n", iface, max_latency);
792
793 return E_NOTIMPL;
794}

◆ d3d11_swapchain_GetParent()

static HRESULT STDMETHODCALLTYPE d3d11_swapchain_GetParent ( IDXGISwapChain4 *  iface,
REFIID  riid,
void **  parent 
)
static

Definition at line 282 of file swapchain.c.

283{
284 struct d3d11_swapchain *swapchain = d3d11_swapchain_from_IDXGISwapChain4(iface);
285
286 TRACE("iface %p, riid %s, parent %p.\n", iface, debugstr_guid(riid), parent);
287
288 return IWineDXGIFactory_QueryInterface(swapchain->factory, riid, parent);
289}

◆ d3d11_swapchain_GetPrivateData()

static HRESULT STDMETHODCALLTYPE d3d11_swapchain_GetPrivateData ( IDXGISwapChain4 *  iface,
REFGUID  guid,
UINT *  data_size,
void *  data 
)
static

Definition at line 272 of file swapchain.c.

274{
275 struct d3d11_swapchain *swapchain = d3d11_swapchain_from_IDXGISwapChain4(iface);
276
277 TRACE("iface %p, guid %s, data_size %p, data %p.\n", iface, debugstr_guid(guid), data_size, data);
278
279 return dxgi_get_private_data(&swapchain->private_store, guid, data_size, data);
280}
GUID guid
Definition: version.c:147
HRESULT dxgi_get_private_data(struct wined3d_private_store *store, REFGUID guid, UINT *data_size, void *data)
Definition: utils.c:624
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
struct wined3d_private_store private_store
Definition: dxgi_private.h:177

◆ d3d11_swapchain_GetRestrictToOutput()

static HRESULT STDMETHODCALLTYPE d3d11_swapchain_GetRestrictToOutput ( IDXGISwapChain4 *  iface,
IDXGIOutput **  output 
)
static

Definition at line 724 of file swapchain.c.

725{
726 FIXME("iface %p, output %p stub!\n", iface, output);
727
728 if (!output)
729 {
730 WARN("Invalid pointer.\n");
731 return E_INVALIDARG;
732 }
733
734 *output = NULL;
735 return E_NOTIMPL;
736}

◆ d3d11_swapchain_GetRotation()

static HRESULT STDMETHODCALLTYPE d3d11_swapchain_GetRotation ( IDXGISwapChain4 *  iface,
DXGI_MODE_ROTATION *  rotation 
)
static

Definition at line 759 of file swapchain.c.

760{
761 FIXME("iface %p, rotation %p stub!\n", iface, rotation);
762
763 return E_NOTIMPL;
764}

◆ d3d11_swapchain_GetSourceSize()

static HRESULT STDMETHODCALLTYPE d3d11_swapchain_GetSourceSize ( IDXGISwapChain4 *  iface,
UINT *  width,
UINT *  height 
)
static

Definition at line 775 of file swapchain.c.

776{
777 FIXME("iface %p, width %p, height %p stub!\n", iface, width, height);
778
779 return E_NOTIMPL;
780}
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546

◆ d3d11_swapchain_init()

HRESULT d3d11_swapchain_init ( struct d3d11_swapchain *  swapchain,
struct dxgi_device *  device,
struct wined3d_swapchain_desc *  desc 
)

Definition at line 991 of file swapchain.c.

993{
996 HRESULT hr;
997
998 if (desc->backbuffer_format == WINED3DFMT_UNKNOWN)
999 return E_INVALIDARG;
1000
1001 if (FAILED(hr = IWineDXGIAdapter_GetParent(device->adapter,
1002 &IID_IWineDXGIFactory, (void **)&swapchain->factory)))
1003 {
1004 WARN("Failed to get adapter parent, hr %#lx.\n", hr);
1005 return hr;
1006 }
1007 IWineDXGIDevice_AddRef(swapchain->device = &device->IWineDXGIDevice_iface);
1008
1009 swapchain->IDXGISwapChain4_iface.lpVtbl = &d3d11_swapchain_vtbl;
1011 swapchain->refcount = 1;
1014
1015 if (!desc->windowed && (!desc->backbuffer_width || !desc->backbuffer_height))
1016 FIXME("Fullscreen swapchain with back buffer width/height equal to 0 not supported properly.\n");
1017
1018 fullscreen = !desc->windowed;
1019 desc->windowed = TRUE;
1020 if (FAILED(hr = wined3d_swapchain_create(device->wined3d_device, desc, &swapchain->state_parent,
1021 swapchain, &d3d11_swapchain_wined3d_parent_ops, &swapchain->wined3d_swapchain)))
1022 {
1023 WARN("Failed to create wined3d swapchain, hr %#lx.\n", hr);
1025 hr = E_INVALIDARG;
1026 goto cleanup;
1027 }
1028
1030 wined3d_swapchain_state_get_size(state, &desc->backbuffer_width, &desc->backbuffer_height);
1031
1032 if (FAILED(hr = d3d11_swapchain_create_d3d11_textures(swapchain, &device->IWineDXGIDevice_iface, desc)))
1033 {
1034 ERR("Failed to create d3d11 textures, hr %#lx.\n", hr);
1035 goto cleanup;
1036 }
1037
1038 swapchain->target = NULL;
1039 if (fullscreen)
1040 {
1041 desc->windowed = FALSE;
1042
1043 if (FAILED(hr = IDXGISwapChain4_GetContainingOutput(&swapchain->IDXGISwapChain4_iface,
1044 &swapchain->target)))
1045 {
1046 WARN("Failed to get target output for fullscreen swapchain, hr %#lx.\n", hr);
1048 goto cleanup;
1049 }
1050
1052 {
1053 WARN("Failed to set fullscreen state, hr %#lx.\n", hr);
1054 IDXGIOutput_Release(swapchain->target);
1056 goto cleanup;
1057 }
1058
1059 }
1061
1062 return S_OK;
1063
1064cleanup:
1067 IWineDXGIFactory_Release(swapchain->factory);
1068 IWineDXGIDevice_Release(swapchain->device);
1069 return hr;
1070}
static int state
Definition: maze.c:121
#define TRUE
Definition: types.h:120
static void cleanup(void)
Definition: main.c:1335
static const struct wined3d_parent_ops d3d11_swapchain_wined3d_parent_ops
Definition: swapchain.c:927
static const struct wined3d_swapchain_state_parent_ops d3d11_swapchain_state_parent_ops
Definition: swapchain.c:951
static HRESULT d3d11_swapchain_create_d3d11_textures(struct d3d11_swapchain *swapchain, IWineDXGIDevice *device, struct wined3d_swapchain_desc *desc)
Definition: swapchain.c:956
static const struct IDXGISwapChain4Vtbl d3d11_swapchain_vtbl
Definition: swapchain.c:866
unsigned int BOOL
Definition: ntddk_ex.h:94
struct wined3d_swapchain_state_parent state_parent
Definition: dxgi_private.h:179
IDXGISwapChain4 IDXGISwapChain4_iface
Definition: dxgi_private.h:175
ULONG CDECL wined3d_swapchain_decref(struct wined3d_swapchain *swapchain)
Definition: swapchain.c:144
HRESULT CDECL wined3d_swapchain_create(struct wined3d_device *device, const struct wined3d_swapchain_desc *desc, struct wined3d_swapchain_state_parent *state_parent, void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_swapchain **swapchain)
Definition: swapchain.c:1732
HRESULT CDECL wined3d_swapchain_state_set_fullscreen(struct wined3d_swapchain_state *state, const struct wined3d_swapchain_desc *swapchain_desc, const struct wined3d_display_mode *mode)
Definition: swapchain.c:2344
void CDECL wined3d_swapchain_state_get_size(const struct wined3d_swapchain_state *state, unsigned int *width, unsigned int *height)
Definition: swapchain.c:2458
struct wined3d_swapchain_state *CDECL wined3d_swapchain_get_state(struct wined3d_swapchain *swapchain)
Definition: swapchain.c:311
static void wined3d_private_store_cleanup(struct wined3d_private_store *store)
Definition: wined3d.h:2636
@ WINED3DFMT_UNKNOWN
Definition: wined3d.h:127
static void wined3d_private_store_init(struct wined3d_private_store *store)
Definition: wined3d.h:2607
#define WINED3DERR_INVALIDCALL
Definition: wined3d.h:44

Referenced by dxgi_swapchain_factory_create_swapchain().

◆ d3d11_swapchain_IsTemporaryMonoSupported()

static BOOL STDMETHODCALLTYPE d3d11_swapchain_IsTemporaryMonoSupported ( IDXGISwapChain4 *  iface)
static

Definition at line 717 of file swapchain.c.

718{
719 FIXME("iface %p stub!\n", iface);
720
721 return FALSE;
722}

◆ d3d11_swapchain_Present()

static HRESULT STDMETHODCALLTYPE DECLSPEC_HOTPATCH d3d11_swapchain_Present ( IDXGISwapChain4 *  iface,
UINT  sync_interval,
UINT  flags 
)
static

Definition at line 331 of file swapchain.c.

332{
333 struct d3d11_swapchain *swapchain = d3d11_swapchain_from_IDXGISwapChain4(iface);
334
335 TRACE("iface %p, sync_interval %u, flags %#x.\n", iface, sync_interval, flags);
336
337 return d3d11_swapchain_present(swapchain, sync_interval, flags);
338}
static HRESULT d3d11_swapchain_present(struct d3d11_swapchain *swapchain, unsigned int sync_interval, unsigned int flags)
Definition: swapchain.c:304
GLbitfield flags
Definition: glext.h:7161

◆ d3d11_swapchain_present()

static HRESULT d3d11_swapchain_present ( struct d3d11_swapchain *  swapchain,
unsigned int  sync_interval,
unsigned int  flags 
)
static

Definition at line 304 of file swapchain.c.

306{
307 HRESULT hr;
308
309 if (sync_interval > 4)
310 {
311 WARN("Invalid sync interval %u.\n", sync_interval);
313 }
314
315 if (IsIconic(d3d11_swapchain_get_hwnd(swapchain)))
317
318 if (flags & ~DXGI_PRESENT_TEST)
319 FIXME("Unimplemented flags %#x.\n", flags);
320 if (flags & DXGI_PRESENT_TEST)
321 {
322 WARN("Returning S_OK for DXGI_PRESENT_TEST.\n");
323 return S_OK;
324 }
325
326 if (SUCCEEDED(hr = wined3d_swapchain_present(swapchain->wined3d_swapchain, NULL, NULL, NULL, sync_interval, 0)))
328 return hr;
329}
#define SUCCEEDED(hr)
Definition: intsafe.h:50
BOOL WINAPI IsIconic(_In_ HWND)
HRESULT CDECL wined3d_swapchain_present(struct wined3d_swapchain *swapchain, const RECT *src_rect, const RECT *dst_rect, HWND dst_window_override, unsigned int swap_interval, uint32_t flags)
Definition: swapchain.c:192
#define DXGI_STATUS_OCCLUDED
Definition: winerror.h:7119

Referenced by d3d11_swapchain_Present(), and d3d11_swapchain_Present1().

◆ d3d11_swapchain_Present1()

static HRESULT STDMETHODCALLTYPE d3d11_swapchain_Present1 ( IDXGISwapChain4 *  iface,
UINT  sync_interval,
UINT  flags,
const DXGI_PRESENT_PARAMETERS *  present_parameters 
)
static

Definition at line 703 of file swapchain.c.

705{
706 struct d3d11_swapchain *swapchain = d3d11_swapchain_from_IDXGISwapChain4(iface);
707
708 TRACE("iface %p, sync_interval %u, flags %#x, present_parameters %p.\n",
709 iface, sync_interval, flags, present_parameters);
710
711 if (present_parameters)
712 FIXME("Ignored present parameters %p.\n", present_parameters);
713
714 return d3d11_swapchain_present(swapchain, sync_interval, flags);
715}

◆ d3d11_swapchain_QueryInterface()

static HRESULT STDMETHODCALLTYPE d3d11_swapchain_QueryInterface ( IDXGISwapChain4 *  iface,
REFIID  riid,
void **  object 
)
static

Definition at line 190 of file swapchain.c.

191{
192 TRACE("iface %p, riid %s, object %p\n", iface, debugstr_guid(riid), object);
193
195 || IsEqualGUID(riid, &IID_IDXGIObject)
196 || IsEqualGUID(riid, &IID_IDXGIDeviceSubObject)
197 || IsEqualGUID(riid, &IID_IDXGISwapChain)
198 || IsEqualGUID(riid, &IID_IDXGISwapChain1)
199 || IsEqualGUID(riid, &IID_IDXGISwapChain2)
200 || IsEqualGUID(riid, &IID_IDXGISwapChain3)
201 || IsEqualGUID(riid, &IID_IDXGISwapChain4))
202 {
203 IUnknown_AddRef(iface);
204 *object = iface;
205 return S_OK;
206 }
207
208 WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid));
209
210 *object = NULL;
211 return E_NOINTERFACE;
212}
const GUID IID_IUnknown
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define E_NOINTERFACE
Definition: winerror.h:3479

◆ d3d11_swapchain_Release()

static ULONG STDMETHODCALLTYPE d3d11_swapchain_Release ( IDXGISwapChain4 *  iface)
static

Definition at line 227 of file swapchain.c.

228{
229 struct d3d11_swapchain *swapchain = d3d11_swapchain_from_IDXGISwapChain4(iface);
231
232 TRACE("%p decreasing refcount to %lu.\n", swapchain, refcount);
233
234 if (!refcount)
235 {
236 IWineDXGIDevice *device = swapchain->device;
237 if (swapchain->target)
238 {
239 WARN("Releasing fullscreen swapchain.\n");
240 IDXGIOutput_Release(swapchain->target);
241 }
242 IWineDXGIFactory_Release(swapchain->factory);
244 IWineDXGIDevice_Release(device);
245 }
246
247 return refcount;
248}
#define InterlockedDecrement
Definition: armddk.h:52

◆ d3d11_swapchain_ResizeBuffers()

static HRESULT STDMETHODCALLTYPE d3d11_swapchain_ResizeBuffers ( IDXGISwapChain4 *  iface,
UINT  buffer_count,
UINT  width,
UINT  height,
DXGI_FORMAT  format,
UINT  flags 
)
static

Definition at line 516 of file swapchain.c.

518{
519 struct d3d11_swapchain *swapchain = d3d11_swapchain_from_IDXGISwapChain4(iface);
520 struct wined3d_swapchain_desc wined3d_desc;
521 struct wined3d_texture *texture;
523 unsigned int i;
524 HRESULT hr;
525
526 TRACE("iface %p, buffer_count %u, width %u, height %u, format %s, flags %#x.\n",
528
529 if (flags)
530 FIXME("Ignoring flags %#x.\n", flags);
531
533 wined3d_swapchain_get_desc(swapchain->wined3d_swapchain, &wined3d_desc);
534 for (i = 0; i < wined3d_desc.backbuffer_count; ++i)
535 {
538 IUnknown_AddRef(parent);
539 if (IUnknown_Release(parent))
540 {
543 }
544 }
546 wined3d_desc.backbuffer_format = wined3dformat_from_dxgi_format(format);
548 wined3d_desc.backbuffer_format, wined3d_desc.multisample_type, wined3d_desc.multisample_quality);
549 /* wined3d_swapchain_resize_buffers() may recreate swapchain textures.
550 * We do not need to remove the reference to the wined3d swapchain from the
551 * old d3d11 textures: we just validated above that they have 0 references,
552 * and therefore they are not actually holding a reference to the wined3d
553 * swapchain, and will not do anything with it when they are destroyed. */
556
557 return hr;
558}
const char * debug_dxgi_format(DXGI_FORMAT format)
Definition: utils.c:46
enum wined3d_format_id wined3dformat_from_dxgi_format(DXGI_FORMAT format)
Definition: utils.c:323
@ DXGI_FORMAT_UNKNOWN
Definition: dxgiformat.idl:23
HRESULT CDECL wined3d_swapchain_resize_buffers(struct wined3d_swapchain *swapchain, unsigned int buffer_count, unsigned int width, unsigned int height, enum wined3d_format_id format_id, enum wined3d_multisample_type multisample_type, unsigned int multisample_quality)
Definition: swapchain.c:1923
size_t const buffer_count
Definition: xtoa.cpp:36

◆ d3d11_swapchain_ResizeBuffers1()

static HRESULT STDMETHODCALLTYPE d3d11_swapchain_ResizeBuffers1 ( IDXGISwapChain4 *  iface,
UINT  buffer_count,
UINT  width,
UINT  height,
DXGI_FORMAT  format,
UINT  flags,
const UINT *  node_mask,
IUnknown *const *  present_queue 
)
static

Definition at line 845 of file swapchain.c.

848{
849 FIXME("iface %p, buffer_count %u, width %u, height %u, format %s, flags %#x, "
850 "node_mask %p, present_queue %p stub!\n",
851 iface, buffer_count, width, height, debug_dxgi_format(format), flags, node_mask, present_queue);
852
853 return E_NOTIMPL;
854}

◆ d3d11_swapchain_ResizeTarget()

static HRESULT STDMETHODCALLTYPE d3d11_swapchain_ResizeTarget ( IDXGISwapChain4 *  iface,
const DXGI_MODE_DESC *  target_mode_desc 
)
static

Definition at line 560 of file swapchain.c.

562{
563 struct d3d11_swapchain *swapchain = d3d11_swapchain_from_IDXGISwapChain4(iface);
565
566 TRACE("iface %p, target_mode_desc %p.\n", iface, target_mode_desc);
567
569
570 return dxgi_swapchain_resize_target(state, target_mode_desc);
571}
static HRESULT dxgi_swapchain_resize_target(struct wined3d_swapchain_state *state, const DXGI_MODE_DESC *target_mode_desc)
Definition: swapchain.c:151

◆ d3d11_swapchain_SetBackgroundColor()

static HRESULT STDMETHODCALLTYPE d3d11_swapchain_SetBackgroundColor ( IDXGISwapChain4 *  iface,
const DXGI_RGBA *  color 
)
static

Definition at line 738 of file swapchain.c.

739{
740 FIXME("iface %p, color %p stub!\n", iface, color);
741
742 return E_NOTIMPL;
743}

◆ d3d11_swapchain_SetColorSpace1()

static HRESULT STDMETHODCALLTYPE d3d11_swapchain_SetColorSpace1 ( IDXGISwapChain4 *  iface,
DXGI_COLOR_SPACE_TYPE  colour_space 
)
static

Definition at line 837 of file swapchain.c.

839{
840 FIXME("iface %p, colour_space %#x stub!\n", iface, colour_space);
841
842 return E_NOTIMPL;
843}

◆ d3d11_swapchain_SetFullscreenState()

static HRESULT STDMETHODCALLTYPE DECLSPEC_HOTPATCH d3d11_swapchain_SetFullscreenState ( IDXGISwapChain4 *  iface,
BOOL  fullscreen,
IDXGIOutput *  target 
)
static

Definition at line 366 of file swapchain.c.

368{
369 struct d3d11_swapchain *swapchain = d3d11_swapchain_from_IDXGISwapChain4(iface);
370 struct wined3d_swapchain_desc swapchain_desc;
372 struct dxgi_output *dxgi_output;
373 LONG in_set_fullscreen_state;
374 BOOL old_fs;
375 HRESULT hr;
376
377 TRACE("iface %p, fullscreen %#x, target %p.\n", iface, fullscreen, target);
378
379 if (!fullscreen && target)
380 {
381 WARN("Invalid call.\n");
383 }
384
385 if (target)
386 {
387 IDXGIOutput_AddRef(target);
388 }
389 else if (FAILED(hr = IDXGISwapChain4_GetContainingOutput(iface, &target)))
390 {
391 WARN("Failed to get target output for swapchain, hr %#lx.\n", hr);
392 return hr;
393 }
395
396 /* DXGI catches nested SetFullscreenState invocations, earlier versions of d3d
397 * do not. Final Fantasy XIV depends on this behavior. It tries to call SFS on
398 * WM_WINDOWPOSCHANGED messages. */
399 in_set_fullscreen_state = InterlockedExchange(&swapchain->in_set_fullscreen_state, 1);
400 if (in_set_fullscreen_state)
401 {
402 WARN("Nested invocation of SetFullscreenState.\n");
403 IDXGIOutput_Release(target);
404 IDXGISwapChain4_GetFullscreenState(iface, &old_fs, NULL);
406 }
407
410 wined3d_swapchain_get_desc(swapchain->wined3d_swapchain, &swapchain_desc);
411 swapchain_desc.output = dxgi_output->wined3d_output;
412 swapchain_desc.windowed = !fullscreen;
414 if (FAILED(hr))
415 {
416 IDXGIOutput_Release(target);
418 goto done;
419 }
420
421 if (!fullscreen)
422 {
423 IDXGIOutput_Release(target);
424 target = NULL;
425 }
426
427 if (swapchain->target)
428 IDXGIOutput_Release(swapchain->target);
429 swapchain->target = target;
430
431done:
434 return hr;
435}
#define InterlockedExchange
Definition: armddk.h:54
struct dxgi_output * unsafe_impl_from_IDXGIOutput(IDXGIOutput *iface)
Definition: output.c:706
long LONG
Definition: pedump.c:60
LONG in_set_fullscreen_state
Definition: dxgi_private.h:185
struct wined3d_output * wined3d_output
Definition: dxgi_private.h:148
#define DXGI_STATUS_MODE_CHANGE_IN_PROGRESS
Definition: winerror.h:7132
#define DXGI_ERROR_NOT_CURRENTLY_AVAILABLE
Definition: winerror.h:7140

◆ d3d11_swapchain_SetHDRMetaData()

static HRESULT STDMETHODCALLTYPE d3d11_swapchain_SetHDRMetaData ( IDXGISwapChain4 *  iface,
DXGI_HDR_METADATA_TYPE  type,
UINT  size,
void *  metadata 
)
static

Definition at line 858 of file swapchain.c.

860{
861 FIXME("iface %p, type %#x, size %#x, metadata %p stub!\n", iface, type, size, metadata);
862
863 return E_NOTIMPL;
864}
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLsizeiptr size
Definition: glext.h:5919

◆ d3d11_swapchain_SetMatrixTransform()

static HRESULT STDMETHODCALLTYPE d3d11_swapchain_SetMatrixTransform ( IDXGISwapChain4 *  iface,
const DXGI_MATRIX_3X2_F *  matrix 
)
static

Definition at line 803 of file swapchain.c.

805{
806 FIXME("iface %p, matrix %p stub!\n", iface, matrix);
807
808 return E_NOTIMPL;
809}

◆ d3d11_swapchain_SetMaximumFrameLatency()

static HRESULT STDMETHODCALLTYPE d3d11_swapchain_SetMaximumFrameLatency ( IDXGISwapChain4 *  iface,
UINT  max_latency 
)
static

Definition at line 782 of file swapchain.c.

783{
784 FIXME("iface %p, max_latency %u stub!\n", iface, max_latency);
785
786 return E_NOTIMPL;
787}

◆ d3d11_swapchain_SetPrivateData()

static HRESULT STDMETHODCALLTYPE d3d11_swapchain_SetPrivateData ( IDXGISwapChain4 *  iface,
REFGUID  guid,
UINT  data_size,
const void *  data 
)
static

Definition at line 252 of file swapchain.c.

254{
255 struct d3d11_swapchain *swapchain = d3d11_swapchain_from_IDXGISwapChain4(iface);
256
257 TRACE("iface %p, guid %s, data_size %u, data %p.\n", iface, debugstr_guid(guid), data_size, data);
258
259 return dxgi_set_private_data(&swapchain->private_store, guid, data_size, data);
260}
HRESULT dxgi_set_private_data(struct wined3d_private_store *store, REFGUID guid, UINT data_size, const void *data)
Definition: utils.c:666

◆ d3d11_swapchain_SetPrivateDataInterface()

static HRESULT STDMETHODCALLTYPE d3d11_swapchain_SetPrivateDataInterface ( IDXGISwapChain4 *  iface,
REFGUID  guid,
const IUnknown *  object 
)
static

Definition at line 262 of file swapchain.c.

264{
265 struct d3d11_swapchain *swapchain = d3d11_swapchain_from_IDXGISwapChain4(iface);
266
267 TRACE("iface %p, guid %s, object %p.\n", iface, debugstr_guid(guid), object);
268
269 return dxgi_set_private_data_interface(&swapchain->private_store, guid, object);
270}
HRESULT dxgi_set_private_data_interface(struct wined3d_private_store *store, REFGUID guid, const IUnknown *object)
Definition: utils.c:694

◆ d3d11_swapchain_SetRotation()

static HRESULT STDMETHODCALLTYPE d3d11_swapchain_SetRotation ( IDXGISwapChain4 *  iface,
DXGI_MODE_ROTATION  rotation 
)
static

Definition at line 752 of file swapchain.c.

753{
754 FIXME("iface %p, rotation %#x stub!\n", iface, rotation);
755
756 return E_NOTIMPL;
757}

◆ d3d11_swapchain_SetSourceSize()

static HRESULT STDMETHODCALLTYPE d3d11_swapchain_SetSourceSize ( IDXGISwapChain4 *  iface,
UINT  width,
UINT  height 
)
static

Definition at line 768 of file swapchain.c.

769{
770 FIXME("iface %p, width %u, height %u stub!\n", iface, width, height);
771
772 return E_NOTIMPL;
773}

◆ d3d11_swapchain_windowed_state_changed()

static void CDECL d3d11_swapchain_windowed_state_changed ( struct wined3d_swapchain_state_parent *  parent,
BOOL  windowed 
)
static

Definition at line 937 of file swapchain.c.

939{
941
942 TRACE("parent %p, windowed %d.\n", parent, windowed);
943
944 if (windowed && swapchain->target)
945 {
946 IDXGIOutput_Release(swapchain->target);
947 swapchain->target = NULL;
948 }
949}
static struct d3d11_swapchain * d3d11_swapchain_from_wined3d_swapchain_state_parent(struct wined3d_swapchain_state_parent *parent)
Definition: swapchain.c:932

◆ d3d11_swapchain_wined3d_object_released()

static void STDMETHODCALLTYPE d3d11_swapchain_wined3d_object_released ( void *  parent)
static

Definition at line 919 of file swapchain.c.

920{
921 struct d3d11_swapchain *swapchain = parent;
922
924 free(parent);
925}
#define free
Definition: debug_ros.c:5

◆ d3d12_swapchain_acquire_next_vulkan_image()

static VkResult d3d12_swapchain_acquire_next_vulkan_image ( struct d3d12_swapchain *  swapchain)
static

Definition at line 1752 of file swapchain.c.

1753{
1754 const struct dxgi_vk_funcs *vk_funcs = &swapchain->vk_funcs;
1755 VkDevice vk_device = swapchain->vk_device;
1756 VkFence vk_fence = swapchain->vk_fence;
1757 VkResult vr;
1758
1760
1761 if ((vr = vk_funcs->p_vkAcquireNextImageKHR(vk_device, swapchain->vk_swapchain, UINT64_MAX,
1762 VK_NULL_HANDLE, vk_fence, &swapchain->vk_image_index)) < 0)
1763 {
1764 WARN("Failed to acquire next Vulkan image, vr %d.\n", vr);
1765 return vr;
1766 }
1767
1768 if ((vr = vk_funcs->p_vkWaitForFences(vk_device, 1, &vk_fence, VK_TRUE, UINT64_MAX)) != VK_SUCCESS)
1769 {
1770 ERR("Failed to wait for fence, vr %d.\n", vr);
1771 return vr;
1772 }
1773 if ((vr = vk_funcs->p_vkResetFences(vk_device, 1, &vk_fence)) < 0)
1774 ERR("Failed to reset fence, vr %d.\n", vr);
1775
1776 return vr;
1777}
#define UINT64_MAX
Definition: stdint.h:86
#define INVALID_VK_IMAGE_INDEX
Definition: swapchain.c:1129
VkFence vk_fence
Definition: swapchain.c:1141
struct dxgi_vk_funcs vk_funcs
Definition: swapchain.c:1182
uint32_t vk_image_index
Definition: swapchain.c:1180
VkDevice vk_device
Definition: swapchain.c:1143
VkSwapchainKHR vk_swapchain
Definition: swapchain.c:1168
PFN_vkWaitForFences p_vkWaitForFences
Definition: swapchain.c:1109
PFN_vkResetFences p_vkResetFences
Definition: swapchain.c:1108
PFN_vkAcquireNextImageKHR p_vkAcquireNextImageKHR
Definition: swapchain.c:1074
#define VK_TRUE
Definition: vulkan.h:55
VkResult
Definition: vulkan.h:4639
@ VK_SUCCESS
Definition: vulkan.h:4672
#define VK_NULL_HANDLE
Definition: vulkan.h:861

Referenced by d3d12_swapchain_queue_present().

◆ d3d12_swapchain_AddRef()

static ULONG STDMETHODCALLTYPE d3d12_swapchain_AddRef ( IDXGISwapChain4 *  iface)
static

Definition at line 2013 of file swapchain.c.

2014{
2015 struct d3d12_swapchain *swapchain = d3d12_swapchain_from_IDXGISwapChain4(iface);
2017
2018 TRACE("%p increasing refcount to %lu.\n", swapchain, refcount);
2019
2020 return refcount;
2021}
static struct d3d12_swapchain * d3d12_swapchain_from_IDXGISwapChain4(IDXGISwapChain4 *iface)
Definition: swapchain.c:1982

◆ d3d12_swapchain_CheckColorSpaceSupport()

static HRESULT STDMETHODCALLTYPE d3d12_swapchain_CheckColorSpaceSupport ( IDXGISwapChain4 *  iface,
DXGI_COLOR_SPACE_TYPE  colour_space,
UINT *  colour_space_support 
)
static

Definition at line 2961 of file swapchain.c.

2963{
2964 UINT support_flags = 0;
2965
2966 FIXME("iface %p, colour_space %#x, colour_space_support %p semi-stub!\n",
2967 iface, colour_space, colour_space_support);
2968
2969 if (!colour_space_support)
2970 return E_INVALIDARG;
2971
2972 if (colour_space == DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709)
2974
2975 *colour_space_support = support_flags;
2976 return S_OK;
2977}
@ DXGI_SWAP_CHAIN_COLOR_SPACE_SUPPORT_FLAG_PRESENT
Definition: dxgi1_4.idl:23
@ DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709
Definition: dxgicommon.idl:28
unsigned int UINT
Definition: sysinfo.c:13

◆ d3d12_swapchain_create()

HRESULT d3d12_swapchain_create ( IWineDXGIFactory *  factory,
ID3D12CommandQueue *  queue,
HWND  window,
const DXGI_SWAP_CHAIN_DESC1 *  swapchain_desc,
const DXGI_SWAP_CHAIN_FULLSCREEN_DESC *  fullscreen_desc,
IDXGISwapChain1 **  swapchain 
)

Definition at line 3399 of file swapchain.c.

3402{
3403 DXGI_SWAP_CHAIN_FULLSCREEN_DESC default_fullscreen_desc;
3405 struct d3d12_swapchain *object;
3407 HRESULT hr;
3408
3409 if (swapchain_desc->Format == DXGI_FORMAT_UNKNOWN)
3411
3412 queue_desc = ID3D12CommandQueue_GetDesc(queue);
3415
3416 if (!fullscreen_desc)
3417 {
3418 memset(&default_fullscreen_desc, 0, sizeof(default_fullscreen_desc));
3419 default_fullscreen_desc.Windowed = TRUE;
3420 fullscreen_desc = &default_fullscreen_desc;
3421 }
3422
3423 if (!(object = calloc(1, sizeof(*object))))
3424 return E_OUTOFMEMORY;
3425
3426 if (FAILED(hr = ID3D12CommandQueue_GetDevice(queue, &IID_ID3D12Device, (void **)&device)))
3427 {
3428 ERR("Failed to get d3d12 device, hr %#lx.\n", hr);
3429 free(object);
3430 return hr;
3431 }
3432
3433 hr = d3d12_swapchain_init(object, factory, device, queue, window, swapchain_desc, fullscreen_desc);
3434 ID3D12Device_Release(device);
3435 if (FAILED(hr))
3436 {
3437 free(object);
3438 return hr;
3439 }
3440
3441 TRACE("Created swapchain %p.\n", object);
3442
3443 *swapchain = (IDXGISwapChain1 *)&object->IDXGISwapChain4_iface;
3444
3445 return S_OK;
3446}
@ D3D12_COMMAND_LIST_TYPE_DIRECT
Definition: d3d12.idl:2189
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static HRESULT d3d12_swapchain_init(struct d3d12_swapchain *swapchain, IWineDXGIFactory *factory, ID3D12Device *device, ID3D12CommandQueue *queue, HWND window, const DXGI_SWAP_CHAIN_DESC1 *swapchain_desc, const DXGI_SWAP_CHAIN_FULLSCREEN_DESC *fullscreen_desc)
Definition: swapchain.c:3176
#define calloc
Definition: rosglue.h:14
#define memset(x, y, z)
Definition: compat.h:39
DXGI_FORMAT Format
Definition: dxgi1_2.idl:223
ID3D12Device * device
Definition: swapchain.c:1185
DXGI_SWAP_CHAIN_FULLSCREEN_DESC fullscreen_desc
Definition: swapchain.c:1191
Definition: main.c:439
Definition: queue.c:179

Referenced by dxgi_factory_CreateSwapChainForHwnd().

◆ d3d12_swapchain_create_command_buffers()

static HRESULT d3d12_swapchain_create_command_buffers ( struct d3d12_swapchain *  swapchain)
static

Definition at line 1653 of file swapchain.c.

1654{
1655 const struct dxgi_vk_funcs *vk_funcs = &swapchain->vk_funcs;
1656 VkDevice vk_device = swapchain->vk_device;
1657 VkCommandBufferAllocateInfo allocate_info;
1658 VkSemaphoreCreateInfo semaphore_info;
1659 VkCommandPoolCreateInfo pool_info;
1660 unsigned int i;
1661 VkResult vr;
1662
1664 pool_info.pNext = NULL;
1667
1668 assert(swapchain->vk_cmd_pool == VK_NULL_HANDLE);
1669 if ((vr = vk_funcs->p_vkCreateCommandPool(vk_device, &pool_info,
1670 NULL, &swapchain->vk_cmd_pool)) < 0)
1671 {
1672 WARN("Failed to create command pool, vr %d.\n", vr);
1673 swapchain->vk_cmd_pool = VK_NULL_HANDLE;
1674 return hresult_from_vk_result(vr);
1675 }
1676
1678 allocate_info.pNext = NULL;
1679 allocate_info.commandPool = swapchain->vk_cmd_pool;
1680 allocate_info.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY;
1681 allocate_info.commandBufferCount = swapchain->buffer_count;
1682
1683 if ((vr = vk_funcs->p_vkAllocateCommandBuffers(vk_device, &allocate_info,
1684 swapchain->vk_cmd_buffers)) < 0)
1685 {
1686 WARN("Failed to allocate command buffers, vr %d.\n", vr);
1687 return hresult_from_vk_result(vr);
1688 }
1689
1690 for (i = 0; i < swapchain->buffer_count; ++i)
1691 {
1693 semaphore_info.pNext = NULL;
1694 semaphore_info.flags = 0;
1695
1696 assert(swapchain->vk_semaphores[i] == VK_NULL_HANDLE);
1697 if ((vr = vk_funcs->p_vkCreateSemaphore(vk_device, &semaphore_info,
1698 NULL, &swapchain->vk_semaphores[i])) < 0)
1699 {
1700 WARN("Failed to create semaphore, vr %d.\n", vr);
1701 swapchain->vk_semaphores[i] = VK_NULL_HANDLE;
1702 return hresult_from_vk_result(vr);
1703 }
1704 }
1705
1706 return S_OK;
1707}
#define assert(_expr)
Definition: assert.h:32
static HRESULT hresult_from_vk_result(VkResult vr)
Definition: swapchain.c:1114
VkStructureType sType
Definition: vulkan.h:7821
VkCommandBufferLevel level
Definition: vulkan.h:7824
const void * pNext
Definition: vulkan.h:7873
VkStructureType sType
Definition: vulkan.h:7872
uint32_t queueFamilyIndex
Definition: vulkan.h:7875
VkCommandPoolCreateFlags flags
Definition: vulkan.h:7874
VkStructureType sType
Definition: vulkan.h:13937
VkSemaphoreCreateFlags flags
Definition: vulkan.h:13939
const void * pNext
Definition: vulkan.h:13938
VkCommandBuffer vk_cmd_buffers[DXGI_MAX_SWAP_CHAIN_BUFFERS]
Definition: swapchain.c:1171
VkSemaphore vk_semaphores[DXGI_MAX_SWAP_CHAIN_BUFFERS]
Definition: swapchain.c:1172
VkCommandPool vk_cmd_pool
Definition: swapchain.c:1169
unsigned int buffer_count
Definition: swapchain.c:1155
ID3D12CommandQueue * command_queue
Definition: swapchain.c:1184
PFN_vkCreateSemaphore p_vkCreateSemaphore
Definition: swapchain.c:1084
PFN_vkAllocateCommandBuffers p_vkAllocateCommandBuffers
Definition: swapchain.c:1075
PFN_vkCreateCommandPool p_vkCreateCommandPool
Definition: swapchain.c:1081
VKD3D_API uint32_t vkd3d_get_vk_queue_family_index(ID3D12CommandQueue *queue)
Definition: command.c:7486
@ VK_COMMAND_BUFFER_LEVEL_PRIMARY
Definition: vulkan.h:2140
@ VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT
Definition: vulkan.h:2162
@ VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO
Definition: vulkan.h:4973
@ VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO
Definition: vulkan.h:5004
@ VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO
Definition: vulkan.h:5003

Referenced by d3d12_swapchain_create_vulkan_resources().

◆ d3d12_swapchain_create_d3d12_resources()

static HRESULT d3d12_swapchain_create_d3d12_resources ( struct d3d12_swapchain *  swapchain)
static

Definition at line 1966 of file swapchain.c.

1967{
1968 HRESULT hr;
1969
1970 if (!(swapchain->vk_format = vkd3d_get_vk_format(swapchain->desc.Format)))
1971 {
1972 WARN("Invalid format %#x.\n", swapchain->desc.Format);
1974 }
1975
1977 return hr;
1978
1980}
static HRESULT d3d12_swapchain_create_user_buffers(struct d3d12_swapchain *swapchain)
Definition: swapchain.c:1457
static HRESULT d3d12_swapchain_create_image_resources(struct d3d12_swapchain *swapchain)
Definition: swapchain.c:1709
VkFormat vk_format
Definition: swapchain.c:1160
DXGI_SWAP_CHAIN_DESC1 desc
Definition: swapchain.c:1190
VKD3D_API VkFormat vkd3d_get_vk_format(DXGI_FORMAT format)
Definition: utils.c:520

Referenced by d3d12_swapchain_init(), and d3d12_swapchain_resize_buffers().

◆ d3d12_swapchain_create_image_resources()

static HRESULT d3d12_swapchain_create_image_resources ( struct d3d12_swapchain *  swapchain)
static

Definition at line 1709 of file swapchain.c.

1710{
1711 struct vkd3d_image_resource_create_info resource_info;
1712 ID3D12Device *device = swapchain->device;
1713 unsigned int i;
1714 HRESULT hr;
1715
1717 resource_info.next = NULL;
1718 resource_info.desc.Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE2D;
1719 resource_info.desc.Alignment = 0;
1720 resource_info.desc.Width = swapchain->desc.Width;
1721 resource_info.desc.Height = swapchain->desc.Height;
1722 resource_info.desc.DepthOrArraySize = 1;
1723 resource_info.desc.MipLevels = 1;
1724 resource_info.desc.Format = dxgi_format_from_vk_format(swapchain->vk_format);
1725 resource_info.desc.SampleDesc.Count = 1;
1726 resource_info.desc.SampleDesc.Quality = 0;
1727 resource_info.desc.Layout = D3D12_TEXTURE_LAYOUT_UNKNOWN;
1728 resource_info.desc.Flags = D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET;
1730 resource_info.present_state = D3D12_RESOURCE_STATE_COPY_SOURCE;
1731
1732 for (i = 0; i < swapchain->desc.BufferCount; ++i)
1733 {
1734 assert(swapchain->vk_images[i]);
1735 assert(!swapchain->buffers[i]);
1736
1737 resource_info.vk_image = swapchain->vk_images[i];
1738
1739 if (FAILED(hr = vkd3d_create_image_resource(device, &resource_info, &swapchain->buffers[i])))
1740 {
1741 WARN("Failed to create vkd3d resource for Vulkan image %u, hr %#lx.\n", i, hr);
1742 return hr;
1743 }
1744
1745 vkd3d_resource_incref(swapchain->buffers[i]);
1746 ID3D12Resource_Release(swapchain->buffers[i]);
1747 }
1748
1749 return S_OK;
1750}
@ D3D12_RESOURCE_STATE_COPY_SOURCE
Definition: d3d12.idl:916
@ D3D12_RESOURCE_DIMENSION_TEXTURE2D
Definition: d3d12.idl:985
@ D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET
Definition: d3d12.idl:1000
@ D3D12_TEXTURE_LAYOUT_UNKNOWN
Definition: d3d12.idl:991
static DXGI_FORMAT dxgi_format_from_vk_format(VkFormat vk_format)
Definition: swapchain.c:1296
ID3D12Resource * buffers[DXGI_MAX_SWAP_CHAIN_BUFFERS]
Definition: swapchain.c:1158
VkImage vk_images[DXGI_MAX_SWAP_CHAIN_BUFFERS]
Definition: swapchain.c:1157
VKD3D_API ULONG vkd3d_resource_incref(ID3D12Resource *resource)
Definition: resource.c:2317
@ VKD3D_STRUCTURE_TYPE_IMAGE_RESOURCE_CREATE_INFO
Definition: vkd3d.h:57
VKD3D_API HRESULT vkd3d_create_image_resource(ID3D12Device *device, const struct vkd3d_image_resource_create_info *create_info, ID3D12Resource **resource)
Definition: resource.c:2264
#define VKD3D_RESOURCE_PRESENT_STATE_TRANSITION
Definition: vkd3d.h:330
#define VKD3D_RESOURCE_INITIAL_STATE_TRANSITION
Definition: vkd3d.h:325

Referenced by d3d12_swapchain_create_d3d12_resources().

◆ d3d12_swapchain_create_user_buffers()

static HRESULT d3d12_swapchain_create_user_buffers ( struct d3d12_swapchain *  swapchain)
static

Definition at line 1457 of file swapchain.c.

1458{
1459 const struct dxgi_vk_funcs *vk_funcs = &swapchain->vk_funcs;
1460 VkDeviceSize image_offset[DXGI_MAX_SWAP_CHAIN_BUFFERS];
1461 VkDevice vk_device = swapchain->vk_device;
1462 VkMemoryAllocateInfo allocate_info;
1463 VkMemoryRequirements requirements;
1464 VkImageCreateInfo image_info;
1465 uint32_t memory_type_mask;
1466 VkDeviceSize memory_size;
1467 unsigned int i;
1468 VkResult vr;
1469 HRESULT hr;
1470
1471 memset(&image_info, 0, sizeof(image_info));
1474 image_info.imageType = VK_IMAGE_TYPE_2D;
1475 image_info.format = swapchain->vk_format;
1476 image_info.extent.width = swapchain->desc.Width;
1477 image_info.extent.height = swapchain->desc.Height;
1478 image_info.extent.depth = 1;
1479 image_info.mipLevels = 1;
1480 image_info.arrayLayers = 1;
1481 image_info.samples = VK_SAMPLE_COUNT_1_BIT;
1482 image_info.tiling = VK_IMAGE_TILING_OPTIMAL;
1486 if (swapchain->desc.BufferUsage & DXGI_USAGE_SHADER_INPUT)
1487 image_info.usage |= VK_IMAGE_USAGE_SAMPLED_BIT;
1489 image_info.queueFamilyIndexCount = 0;
1490 image_info.pQueueFamilyIndices = NULL;
1492
1493 for (i = 0; i < swapchain->desc.BufferCount; ++i)
1494 {
1495 assert(swapchain->vk_images[i] == VK_NULL_HANDLE);
1496 if ((vr = vk_funcs->p_vkCreateImage(vk_device, &image_info, NULL, &swapchain->vk_images[i])) < 0)
1497 {
1498 WARN("Failed to create Vulkan image, vr %d.\n", vr);
1499 swapchain->vk_images[i] = VK_NULL_HANDLE;
1500 return hresult_from_vk_result(vr);
1501 }
1502 }
1503
1504 memory_size = 0;
1505 memory_type_mask = ~0u;
1506 for (i = 0; i < swapchain->desc.BufferCount; ++i)
1507 {
1508 vk_funcs->p_vkGetImageMemoryRequirements(vk_device, swapchain->vk_images[i], &requirements);
1509
1510 TRACE("Size %s, alignment %s, memory types %#x.\n",
1511 wine_dbgstr_longlong(requirements.size), wine_dbgstr_longlong(requirements.alignment),
1512 requirements.memoryTypeBits);
1513
1514 image_offset[i] = (memory_size + (requirements.alignment - 1)) & ~(requirements.alignment - 1);
1515 memory_size = image_offset[i] + requirements.size;
1516
1517 memory_type_mask &= requirements.memoryTypeBits;
1518 }
1519
1520 TRACE("Allocating %s bytes for user images.\n", wine_dbgstr_longlong(memory_size));
1521
1523 allocate_info.pNext = NULL;
1524 allocate_info.allocationSize = memory_size;
1525
1526 if (FAILED(hr = vk_select_memory_type(vk_funcs, swapchain->vk_physical_device,
1527 memory_type_mask, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, &allocate_info.memoryTypeIndex)))
1528 return hr;
1529
1530 assert(swapchain->vk_memory == VK_NULL_HANDLE);
1531 if ((vr = vk_funcs->p_vkAllocateMemory(vk_device, &allocate_info, NULL, &swapchain->vk_memory)) < 0)
1532 {
1533 WARN("Failed to allocate device memory, vr %d.\n", vr);
1534 swapchain->vk_memory = VK_NULL_HANDLE;
1535 return hresult_from_vk_result(vr);
1536 }
1537
1538 for (i = 0; i < swapchain->desc.BufferCount; ++i)
1539 {
1540 if ((vr = vk_funcs->p_vkBindImageMemory(vk_device, swapchain->vk_images[i],
1541 swapchain->vk_memory, image_offset[i])) < 0)
1542 {
1543 WARN("Failed to bind image memory, vr %d.\n", vr);
1544 return hresult_from_vk_result(vr);
1545 }
1546 }
1547
1548 return S_OK;
1549}
UINT32 uint32_t
Definition: types.h:75
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:49
static HRESULT vk_select_memory_type(const struct dxgi_vk_funcs *vk_funcs, VkPhysicalDevice vk_physical_device, uint32_t memory_type_mask, VkMemoryPropertyFlags flags, uint32_t *memory_type_index)
Definition: swapchain.c:1388
const DXGI_USAGE DXGI_USAGE_SHADER_INPUT
Definition: dxgi.idl:43
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
DXGI_USAGE BufferUsage
Definition: dxgi1_2.idl:226
uint32_t depth
Definition: vulkan.h:8674
uint32_t height
Definition: vulkan.h:8673
uint32_t width
Definition: vulkan.h:8672
VkImageCreateFlags flags
Definition: vulkan.h:8974
VkSharingMode sharingMode
Definition: vulkan.h:8983
VkImageLayout initialLayout
Definition: vulkan.h:8986
uint32_t mipLevels
Definition: vulkan.h:8978
const uint32_t * pQueueFamilyIndices
Definition: vulkan.h:8985
uint32_t arrayLayers
Definition: vulkan.h:8979
VkSampleCountFlagBits samples
Definition: vulkan.h:8980
VkExtent3D extent
Definition: vulkan.h:8977
VkFormat format
Definition: vulkan.h:8976
uint32_t queueFamilyIndexCount
Definition: vulkan.h:8984
VkImageType imageType
Definition: vulkan.h:8975
VkImageTiling tiling
Definition: vulkan.h:8981
VkStructureType sType
Definition: vulkan.h:8972
VkImageUsageFlags usage
Definition: vulkan.h:8982
VkStructureType sType
Definition: vulkan.h:9351
uint32_t memoryTypeIndex
Definition: vulkan.h:9354
const void * pNext
Definition: vulkan.h:9352
uint32_t memoryTypeBits
Definition: vulkan.h:9460
VkDeviceMemory vk_memory
Definition: swapchain.c:1156
VkPhysicalDevice vk_physical_device
Definition: swapchain.c:1144
PFN_vkGetImageMemoryRequirements p_vkGetImageMemoryRequirements
Definition: swapchain.c:1096
PFN_vkCreateImage p_vkCreateImage
Definition: swapchain.c:1083
PFN_vkBindImageMemory p_vkBindImageMemory
Definition: swapchain.c:1078
PFN_vkAllocateMemory p_vkAllocateMemory
Definition: swapchain.c:1076
@ VK_IMAGE_LAYOUT_UNDEFINED
Definition: vulkan.h:3451
@ VK_SHARING_MODE_EXCLUSIVE
Definition: vulkan.h:4921
@ VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT
Definition: vulkan.h:3770
uint64_t VkDeviceSize
Definition: vulkan.h:948
@ VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT
Definition: vulkan.h:3423
@ VK_IMAGE_TILING_OPTIMAL
Definition: vulkan.h:3495
@ VK_IMAGE_USAGE_TRANSFER_DST_BIT
Definition: vulkan.h:3511
@ VK_IMAGE_USAGE_SAMPLED_BIT
Definition: vulkan.h:3512
@ VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT
Definition: vulkan.h:3514
@ VK_IMAGE_USAGE_TRANSFER_SRC_BIT
Definition: vulkan.h:3510
@ VK_SAMPLE_COUNT_1_BIT
Definition: vulkan.h:4701
@ VK_IMAGE_TYPE_2D
Definition: vulkan.h:3503
@ VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO
Definition: vulkan.h:4978
@ VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO
Definition: vulkan.h:4969

Referenced by d3d12_swapchain_create_d3d12_resources().

◆ d3d12_swapchain_create_vulkan_resources()

static HRESULT d3d12_swapchain_create_vulkan_resources ( struct d3d12_swapchain *  swapchain)
static

Definition at line 1956 of file swapchain.c.

1957{
1958 HRESULT hr;
1959
1961 return hr;
1962
1964}
static HRESULT d3d12_swapchain_create_command_buffers(struct d3d12_swapchain *swapchain)
Definition: swapchain.c:1653
static HRESULT d3d12_swapchain_create_vulkan_swapchain(struct d3d12_swapchain *swapchain)
Definition: swapchain.c:1830

Referenced by d3d12_swapchain_init(), d3d12_swapchain_op_present_execute(), d3d12_swapchain_op_resize_buffers_execute(), and d3d12_swapchain_set_sync_interval().

◆ d3d12_swapchain_create_vulkan_swapchain()

static HRESULT d3d12_swapchain_create_vulkan_swapchain ( struct d3d12_swapchain *  swapchain)
static

Definition at line 1830 of file swapchain.c.

1831{
1832 VkPhysicalDevice vk_physical_device = swapchain->vk_physical_device;
1833 const struct dxgi_vk_funcs *vk_funcs = &swapchain->vk_funcs;
1834 VkSwapchainCreateInfoKHR vk_swapchain_desc;
1835 VkDevice vk_device = swapchain->vk_device;
1836 unsigned int width, height, image_count;
1837 VkSurfaceCapabilitiesKHR surface_caps;
1838 VkFormat vk_swapchain_format;
1839 VkSwapchainKHR vk_swapchain;
1841 VkResult vr;
1842 HRESULT hr;
1843
1844 if (FAILED(hr = select_vk_format(vk_funcs, vk_physical_device,
1845 swapchain->vk_surface, &swapchain->backend_desc, &vk_swapchain_format)))
1846 return hr;
1847
1848 if ((vr = vk_funcs->p_vkGetPhysicalDeviceSurfaceCapabilitiesKHR(vk_physical_device,
1849 swapchain->vk_surface, &surface_caps)) < 0)
1850 {
1851 WARN("Failed to get surface capabilities, vr %d.\n", vr);
1852 return hresult_from_vk_result(vr);
1853 }
1854
1855 image_count = swapchain->backend_desc.BufferCount;
1856 image_count = max(image_count, surface_caps.minImageCount);
1857 if (surface_caps.maxImageCount)
1858 image_count = min(image_count, surface_caps.maxImageCount);
1859
1860 if (image_count != swapchain->backend_desc.BufferCount)
1861 {
1862 WARN("Buffer count %u is not supported (%u-%u).\n", swapchain->backend_desc.BufferCount,
1863 surface_caps.minImageCount, surface_caps.maxImageCount);
1864 }
1865
1866 width = swapchain->backend_desc.Width;
1867 height = swapchain->backend_desc.Height;
1868 width = max(width, surface_caps.minImageExtent.width);
1869 width = min(width, surface_caps.maxImageExtent.width);
1870 height = max(height, surface_caps.minImageExtent.height);
1871 height = min(height, surface_caps.maxImageExtent.height);
1872
1873 if (width != swapchain->backend_desc.Width || height != swapchain->backend_desc.Height)
1874 {
1875 WARN("Swapchain dimensions %ux%u are not supported (%u-%u x %u-%u).\n",
1876 swapchain->backend_desc.Width, swapchain->backend_desc.Height,
1877 surface_caps.minImageExtent.width, surface_caps.maxImageExtent.width,
1878 surface_caps.minImageExtent.height, surface_caps.maxImageExtent.height);
1879 }
1880
1881 TRACE("Vulkan swapchain extent %ux%u.\n", width, height);
1882
1884 {
1885 FIXME("Unsupported alpha mode.\n");
1887 }
1888
1893 WARN("Transfer not supported for swapchain images.\n");
1895 {
1898 WARN("Sampling not supported for swapchain images.\n");
1899 }
1900
1902 vk_swapchain_desc.pNext = NULL;
1903 vk_swapchain_desc.flags = 0;
1904 vk_swapchain_desc.surface = swapchain->vk_surface;
1905 vk_swapchain_desc.minImageCount = image_count;
1906 vk_swapchain_desc.imageFormat = vk_swapchain_format;
1908 vk_swapchain_desc.imageExtent.width = width;
1909 vk_swapchain_desc.imageExtent.height = height;
1910 vk_swapchain_desc.imageArrayLayers = 1;
1911 vk_swapchain_desc.imageUsage = usage;
1912 vk_swapchain_desc.imageSharingMode = VK_SHARING_MODE_EXCLUSIVE;
1913 vk_swapchain_desc.queueFamilyIndexCount = 0;
1914 vk_swapchain_desc.pQueueFamilyIndices = NULL;
1915 vk_swapchain_desc.preTransform = surface_caps.currentTransform;
1917 vk_swapchain_desc.presentMode = swapchain->present_mode;
1918 vk_swapchain_desc.clipped = VK_TRUE;
1919 vk_swapchain_desc.oldSwapchain = swapchain->vk_swapchain;
1920 if ((vr = vk_funcs->p_vkCreateSwapchainKHR(vk_device, &vk_swapchain_desc, NULL, &vk_swapchain)) < 0)
1921 {
1922 WARN("Failed to create Vulkan swapchain, vr %d.\n", vr);
1923 return hresult_from_vk_result(vr);
1924 }
1925
1926 if (swapchain->vk_swapchain)
1927 vk_funcs->p_vkDestroySwapchainKHR(swapchain->vk_device, swapchain->vk_swapchain, NULL);
1928
1929 if ((vr = vk_funcs->p_vkGetSwapchainImagesKHR(vk_device, vk_swapchain, &image_count, NULL)) < 0)
1930 {
1931 WARN("Failed to get Vulkan swapchain images, vr %d.\n", vr);
1932 return hresult_from_vk_result(vr);
1933 }
1934 if (image_count > ARRAY_SIZE(swapchain->vk_swapchain_images))
1935 {
1936 FIXME("Unsupported Vulkan swapchain image count %u.\n", image_count);
1937 return E_FAIL;
1938 }
1939 swapchain->buffer_count = image_count;
1940 if ((vr = vk_funcs->p_vkGetSwapchainImagesKHR(vk_device, vk_swapchain,
1941 &image_count, swapchain->vk_swapchain_images)) < 0)
1942 {
1943 WARN("Failed to get Vulkan swapchain images, vr %d.\n", vr);
1944 return hresult_from_vk_result(vr);
1945 }
1946
1947 swapchain->vk_swapchain = vk_swapchain;
1948 swapchain->vk_swapchain_width = width;
1949 swapchain->vk_swapchain_height = height;
1950
1952
1953 return S_OK;
1954}
#define ARRAY_SIZE(A)
Definition: main.h:20
static HRESULT select_vk_format(const struct dxgi_vk_funcs *vk_funcs, VkPhysicalDevice vk_physical_device, VkSurfaceKHR vk_surface, const DXGI_SWAP_CHAIN_DESC1 *swapchain_desc, VkFormat *vk_format)
Definition: swapchain.c:1324
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
#define min(a, b)
Definition: monoChain.cc:55
uint32_t width
Definition: vulkan.h:8666
uint32_t height
Definition: vulkan.h:8667
VkSurfaceTransformFlagBitsKHR currentTransform
Definition: vulkan.h:14320
VkCompositeAlphaFlagsKHR supportedCompositeAlpha
Definition: vulkan.h:14321
VkExtent2D maxImageExtent
Definition: vulkan.h:14317
VkExtent2D minImageExtent
Definition: vulkan.h:14316
VkImageUsageFlags supportedUsageFlags
Definition: vulkan.h:14322
const void * pNext
Definition: vulkan.h:14367
VkPresentModeKHR presentMode
Definition: vulkan.h:14381
VkImageUsageFlags imageUsage
Definition: vulkan.h:14375
VkSharingMode imageSharingMode
Definition: vulkan.h:14376
VkStructureType sType
Definition: vulkan.h:14366
VkSwapchainCreateFlagsKHR flags
Definition: vulkan.h:14368
VkColorSpaceKHR imageColorSpace
Definition: vulkan.h:14372
uint32_t queueFamilyIndexCount
Definition: vulkan.h:14377
VkSurfaceTransformFlagBitsKHR preTransform
Definition: vulkan.h:14379
const uint32_t * pQueueFamilyIndices
Definition: vulkan.h:14378
VkCompositeAlphaFlagBitsKHR compositeAlpha
Definition: vulkan.h:14380
VkExtent2D imageExtent
Definition: vulkan.h:14373
DXGI_SWAP_CHAIN_DESC1 backend_desc
Definition: swapchain.c:1176
unsigned int vk_swapchain_width
Definition: swapchain.c:1173
VkImage vk_swapchain_images[DXGI_MAX_SWAP_CHAIN_BUFFERS]
Definition: swapchain.c:1170
unsigned int vk_swapchain_height
Definition: swapchain.c:1174
VkPresentModeKHR present_mode
Definition: swapchain.c:1175
VkSurfaceKHR vk_surface
Definition: swapchain.c:1140
PFN_vkDestroySwapchainKHR p_vkDestroySwapchainKHR
Definition: swapchain.c:1093
PFN_vkCreateSwapchainKHR p_vkCreateSwapchainKHR
Definition: swapchain.c:1085
PFN_vkGetSwapchainImagesKHR p_vkGetSwapchainImagesKHR
Definition: swapchain.c:1104
PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR p_vkGetPhysicalDeviceSurfaceCapabilitiesKHR
Definition: swapchain.c:1099
#define max(a, b)
Definition: svc.c:63
VkFlags VkImageUsageFlags
Definition: vulkan.h:1050
@ VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR
Definition: vulkan.h:2232
VkFormat
Definition: vulkan.h:2815
@ VK_COLOR_SPACE_SRGB_NONLINEAR_KHR
Definition: vulkan.h:2118
@ VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR
Definition: vulkan.h:5021
#define DXGI_ERROR_UNSUPPORTED
Definition: winerror.h:7125

Referenced by d3d12_swapchain_create_vulkan_resources().

◆ d3d12_swapchain_destroy()

static void d3d12_swapchain_destroy ( struct d3d12_swapchain *  swapchain)
static

Definition at line 2023 of file swapchain.c.

2024{
2025 const struct dxgi_vk_funcs *vk_funcs = &swapchain->vk_funcs;
2026 void *vulkan_module = vk_funcs->vulkan_module;
2027 struct d3d12_swapchain_op *op, *op2;
2028 DWORD ret;
2029
2030 EnterCriticalSection(&swapchain->worker_cs);
2031 swapchain->worker_running = false;
2033 LeaveCriticalSection(&swapchain->worker_cs);
2034
2035 if (swapchain->worker_thread)
2036 {
2038 ERR("Failed to wait for worker thread, return value %ld.\n", ret);
2039
2040 if (!CloseHandle(swapchain->worker_thread))
2041 ERR("Failed to close worker thread, last error %ld.\n", GetLastError());
2042 }
2043
2044 DeleteCriticalSection(&swapchain->worker_cs);
2045
2047 {
2048 d3d12_swapchain_op_destroy(swapchain, op);
2049 }
2050
2053
2054 if (swapchain->present_fence)
2055 ID3D12Fence_Release(swapchain->present_fence);
2056
2057 if (swapchain->frame_latency_event)
2058 CloseHandle(swapchain->frame_latency_event);
2059
2060 if (swapchain->frame_latency_fence)
2061 ID3D12Fence_Release(swapchain->frame_latency_fence);
2062
2063 if (swapchain->command_queue)
2064 ID3D12CommandQueue_Release(swapchain->command_queue);
2065
2067
2068 if (swapchain->vk_device)
2069 {
2070 vk_funcs->p_vkDestroyFence(swapchain->vk_device, swapchain->vk_fence, NULL);
2071 vk_funcs->p_vkDestroySwapchainKHR(swapchain->vk_device, swapchain->vk_swapchain, NULL);
2072 }
2073
2074 if (swapchain->vk_instance)
2075 vk_funcs->p_vkDestroySurfaceKHR(swapchain->vk_instance, swapchain->vk_surface, NULL);
2076
2077 if (swapchain->target)
2078 {
2079 WARN("Destroying fullscreen swapchain.\n");
2080 IDXGIOutput_Release(swapchain->target);
2081 }
2082
2083 if (swapchain->device)
2084 ID3D12Device_Release(swapchain->device);
2085
2086 if (swapchain->factory)
2087 IWineDXGIFactory_Release(swapchain->factory);
2088
2090
2092}
static HMODULE vulkan_module
Definition: d3d12_main.c:39
UINT op
Definition: effect.c:235
#define CloseHandle
Definition: compat.h:739
#define FreeLibrary(x)
Definition: compat.h:748
VOID WINAPI WakeAllConditionVariable(PCONDITION_VARIABLE ConditionVariable)
Definition: sync.c:91
return ret
Definition: mutex.c:147
#define INFINITE
Definition: serial.h:102
static void d3d12_swapchain_op_destroy(struct d3d12_swapchain *swapchain, struct d3d12_swapchain_op *op)
Definition: swapchain.c:1232
static void d3d12_swapchain_destroy_vulkan_resources(struct d3d12_swapchain *swapchain)
Definition: swapchain.c:1779
static void d3d12_swapchain_destroy_d3d12_resources(struct d3d12_swapchain *swapchain)
Definition: swapchain.c:1805
unsigned long DWORD
Definition: ntddk_ex.h:95
uint32_t entry
Definition: isohybrid.c:63
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:242
ID3D12Fence * present_fence
Definition: swapchain.c:1178
CRITICAL_SECTION worker_cs
Definition: swapchain.c:1147
HANDLE frame_latency_event
Definition: swapchain.c:1195
IDXGIOutput * target
Definition: swapchain.c:1189
ID3D12Fence * frame_latency_fence
Definition: swapchain.c:1194
struct wined3d_swapchain_state * state
Definition: swapchain.c:1137
HANDLE worker_thread
Definition: swapchain.c:1146
IWineDXGIFactory * factory
Definition: swapchain.c:1186
CONDITION_VARIABLE worker_cv
Definition: swapchain.c:1148
struct wined3d_private_store private_store
Definition: swapchain.c:1135
struct list worker_ops
Definition: swapchain.c:1150
VkInstance vk_instance
Definition: swapchain.c:1142
PFN_vkDestroySurfaceKHR p_vkDestroySurfaceKHR
Definition: swapchain.c:1091
PFN_vkDestroyFence p_vkDestroyFence
Definition: swapchain.c:1088
void * vulkan_module
Definition: swapchain.c:1111
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
#define WAIT_OBJECT_0
Definition: winbase.h:383
void CDECL wined3d_swapchain_state_destroy(struct wined3d_swapchain_state *state)
Definition: swapchain.c:2467

Referenced by d3d12_swapchain_init(), and d3d12_swapchain_Release().

◆ d3d12_swapchain_destroy_d3d12_resources()

static void d3d12_swapchain_destroy_d3d12_resources ( struct d3d12_swapchain *  swapchain)
static

Definition at line 1805 of file swapchain.c.

1806{
1807 const struct dxgi_vk_funcs *vk_funcs = &swapchain->vk_funcs;
1808 unsigned int i;
1809
1810 for (i = 0; i < swapchain->desc.BufferCount; ++i)
1811 {
1812 if (swapchain->buffers[i])
1813 {
1814 vkd3d_resource_decref(swapchain->buffers[i]);
1815 swapchain->buffers[i] = NULL;
1816 }
1817 if (swapchain->vk_device)
1818 {
1819 vk_funcs->p_vkDestroyImage(swapchain->vk_device, swapchain->vk_images[i], NULL);
1820 swapchain->vk_images[i] = VK_NULL_HANDLE;
1821 }
1822 }
1823 if (swapchain->vk_device)
1824 {
1825 vk_funcs->p_vkFreeMemory(swapchain->vk_device, swapchain->vk_memory, NULL);
1826 swapchain->vk_memory = VK_NULL_HANDLE;
1827 }
1828}
PFN_vkFreeMemory p_vkFreeMemory
Definition: swapchain.c:1095
PFN_vkDestroyImage p_vkDestroyImage
Definition: swapchain.c:1089
VKD3D_API ULONG vkd3d_resource_decref(ID3D12Resource *resource)
Definition: resource.c:2323

Referenced by d3d12_swapchain_destroy(), and d3d12_swapchain_resize_buffers().

◆ d3d12_swapchain_destroy_vulkan_resources()

static void d3d12_swapchain_destroy_vulkan_resources ( struct d3d12_swapchain *  swapchain)
static

Definition at line 1779 of file swapchain.c.

1780{
1781 const struct dxgi_vk_funcs *vk_funcs = &swapchain->vk_funcs;
1782 VkQueue vk_queue;
1783 unsigned int i;
1784
1785 if (swapchain->command_queue)
1786 {
1787 vk_queue = vkd3d_acquire_vk_queue(swapchain->command_queue);
1788 vk_funcs->p_vkQueueWaitIdle(vk_queue);
1790 }
1791
1792 if (swapchain->vk_device)
1793 {
1794 for (i = 0; i < swapchain->buffer_count; ++i)
1795 {
1796 vk_funcs->p_vkDestroySemaphore(swapchain->vk_device, swapchain->vk_semaphores[i], NULL);
1797 swapchain->vk_semaphores[i] = VK_NULL_HANDLE;
1798 }
1799
1800 vk_funcs->p_vkDestroyCommandPool(swapchain->vk_device, swapchain->vk_cmd_pool, NULL);
1801 swapchain->vk_cmd_pool = VK_NULL_HANDLE;
1802 }
1803}
PFN_vkDestroySemaphore p_vkDestroySemaphore
Definition: swapchain.c:1090
PFN_vkQueueWaitIdle p_vkQueueWaitIdle
Definition: swapchain.c:1107
PFN_vkDestroyCommandPool p_vkDestroyCommandPool
Definition: swapchain.c:1087
VKD3D_API VkQueue vkd3d_acquire_vk_queue(ID3D12CommandQueue *queue)
Definition: command.c:7493
VKD3D_API void vkd3d_release_vk_queue(ID3D12CommandQueue *queue)
Definition: command.c:7506

Referenced by d3d12_swapchain_destroy(), d3d12_swapchain_op_present_execute(), d3d12_swapchain_op_resize_buffers_execute(), and d3d12_swapchain_set_sync_interval().

◆ d3d12_swapchain_from_IDXGISwapChain4()

◆ d3d12_swapchain_from_wined3d_swapchain_state_parent()

static struct d3d12_swapchain * d3d12_swapchain_from_wined3d_swapchain_state_parent ( struct wined3d_swapchain_state_parent *  parent)
inlinestatic

Definition at line 3152 of file swapchain.c.

3153{
3154 return CONTAINING_RECORD(parent, struct d3d12_swapchain, state_parent);
3155}

Referenced by d3d12_swapchain_windowed_state_changed().

◆ d3d12_swapchain_GetBackgroundColor()

static HRESULT STDMETHODCALLTYPE d3d12_swapchain_GetBackgroundColor ( IDXGISwapChain4 *  iface,
DXGI_RGBA *  color 
)
static

Definition at line 2834 of file swapchain.c.

2835{
2836 FIXME("iface %p, color %p stub!\n", iface, color);
2837
2838 return E_NOTIMPL;
2839}

◆ d3d12_swapchain_GetBuffer()

static HRESULT STDMETHODCALLTYPE d3d12_swapchain_GetBuffer ( IDXGISwapChain4 *  iface,
UINT  buffer_idx,
REFIID  iid,
void **  surface 
)
static

Definition at line 2386 of file swapchain.c.

2388{
2389 struct d3d12_swapchain *swapchain = d3d12_swapchain_from_IDXGISwapChain4(iface);
2390
2391 TRACE("iface %p, buffer_idx %u, iid %s, surface %p.\n",
2392 iface, buffer_idx, debugstr_guid(iid), surface);
2393
2394 if (buffer_idx >= swapchain->desc.BufferCount)
2395 {
2396 WARN("Invalid buffer index %u.\n", buffer_idx);
2398 }
2399
2400 assert(swapchain->buffers[buffer_idx]);
2401 return ID3D12Resource_QueryInterface(swapchain->buffers[buffer_idx], iid, surface);
2402}

◆ d3d12_swapchain_GetContainingOutput()

static HRESULT STDMETHODCALLTYPE d3d12_swapchain_GetContainingOutput ( IDXGISwapChain4 *  iface,
IDXGIOutput **  output 
)
static

Definition at line 2666 of file swapchain.c.

2668{
2669 struct d3d12_swapchain *swapchain = d3d12_swapchain_from_IDXGISwapChain4(iface);
2670 IUnknown *device_parent;
2673 HRESULT hr;
2674
2675 TRACE("iface %p, output %p.\n", iface, output);
2676
2677 if (swapchain->target)
2678 {
2679 IDXGIOutput_AddRef(*output = swapchain->target);
2680 return S_OK;
2681 }
2682
2683 device_parent = vkd3d_get_device_parent(swapchain->device);
2684
2685 if (FAILED(hr = IUnknown_QueryInterface(device_parent, &IID_IDXGIAdapter, (void **)&adapter)))
2686 {
2687 WARN("Failed to get adapter, hr %#lx.\n", hr);
2688 return hr;
2689 }
2690
2691 if (FAILED(hr = IDXGIAdapter_GetParent(adapter, &IID_IWineDXGIFactory, (void **)&factory)))
2692 {
2693 WARN("Failed to get factory, hr %#lx.\n", hr);
2694 IDXGIAdapter_Release(adapter);
2695 return hr;
2696 }
2697
2698 hr = dxgi_get_output_from_window(factory, swapchain->window, output);
2699 IWineDXGIFactory_Release(factory);
2700 IDXGIAdapter_Release(adapter);
2701 return hr;
2702}
return adapter
VKD3D_API IUnknown * vkd3d_get_device_parent(ID3D12Device *device)
Definition: device.c:5694

◆ d3d12_swapchain_GetCoreWindow()

static HRESULT STDMETHODCALLTYPE d3d12_swapchain_GetCoreWindow ( IDXGISwapChain4 *  iface,
REFIID  iid,
void **  core_window 
)
static

Definition at line 2781 of file swapchain.c.

2783{
2784 FIXME("iface %p, iid %s, core_window %p stub!\n", iface, debugstr_guid(iid), core_window);
2785
2786 if (core_window)
2787 *core_window = NULL;
2788
2790}

◆ d3d12_swapchain_GetCurrentBackBufferIndex()

static UINT STDMETHODCALLTYPE d3d12_swapchain_GetCurrentBackBufferIndex ( IDXGISwapChain4 *  iface)
static

Definition at line 2950 of file swapchain.c.

2951{
2952 struct d3d12_swapchain *swapchain = d3d12_swapchain_from_IDXGISwapChain4(iface);
2953
2954 TRACE("iface %p.\n", iface);
2955
2956 TRACE("Current back buffer index %u.\n", swapchain->current_buffer_index);
2957 assert(swapchain->current_buffer_index < swapchain->desc.BufferCount);
2958 return swapchain->current_buffer_index;
2959}
unsigned int current_buffer_index
Definition: swapchain.c:1159

◆ d3d12_swapchain_GetDesc()

static HRESULT STDMETHODCALLTYPE d3d12_swapchain_GetDesc ( IDXGISwapChain4 *  iface,
DXGI_SWAP_CHAIN_DESC *  desc 
)
static

Definition at line 2516 of file swapchain.c.

2517{
2518 struct d3d12_swapchain *swapchain = d3d12_swapchain_from_IDXGISwapChain4(iface);
2520 const DXGI_SWAP_CHAIN_DESC1 *swapchain_desc = &swapchain->desc;
2521 BOOL windowed;
2522
2523 TRACE("iface %p, desc %p.\n", iface, desc);
2524
2525 if (!desc)
2526 {
2527 WARN("Invalid pointer.\n");
2528 return E_INVALIDARG;
2529 }
2530
2532 windowed = wined3d_swapchain_state_is_windowed(swapchain->state);
2534
2535 desc->BufferDesc.Width = swapchain_desc->Width;
2536 desc->BufferDesc.Height = swapchain_desc->Height;
2537 desc->BufferDesc.RefreshRate = fullscreen_desc->RefreshRate;
2538 desc->BufferDesc.Format = swapchain_desc->Format;
2539 desc->BufferDesc.ScanlineOrdering = fullscreen_desc->ScanlineOrdering;
2540 desc->BufferDesc.Scaling = fullscreen_desc->Scaling;
2541 desc->SampleDesc = swapchain_desc->SampleDesc;
2542 desc->BufferUsage = swapchain_desc->BufferUsage;
2543 desc->BufferCount = swapchain_desc->BufferCount;
2544 desc->OutputWindow = swapchain->window;
2545 desc->Windowed = windowed;
2546 desc->SwapEffect = swapchain_desc->SwapEffect;
2547 desc->Flags = swapchain_desc->Flags;
2548
2549 return S_OK;
2550}
DXGI_SWAP_EFFECT SwapEffect
Definition: dxgi1_2.idl:229
DXGI_SAMPLE_DESC SampleDesc
Definition: dxgi1_2.idl:225
DXGI_MODE_SCANLINE_ORDER ScanlineOrdering
Definition: dxgi1_2.idl:236
DXGI_MODE_SCALING Scaling
Definition: dxgi1_2.idl:237
BOOL CDECL wined3d_swapchain_state_is_windowed(const struct wined3d_swapchain_state *state)
Definition: swapchain.c:2451

◆ d3d12_swapchain_GetDesc1()

static HRESULT STDMETHODCALLTYPE d3d12_swapchain_GetDesc1 ( IDXGISwapChain4 *  iface,
DXGI_SWAP_CHAIN_DESC1 *  desc 
)
static

Definition at line 2726 of file swapchain.c.

2727{
2728 struct d3d12_swapchain *swapchain = d3d12_swapchain_from_IDXGISwapChain4(iface);
2729
2730 TRACE("iface %p, desc %p.\n", iface, desc);
2731
2732 if (!desc)
2733 {
2734 WARN("Invalid pointer.\n");
2735 return E_INVALIDARG;
2736 }
2737
2738 *desc = swapchain->desc;
2739 return S_OK;
2740}

◆ d3d12_swapchain_GetDevice()

static HRESULT STDMETHODCALLTYPE d3d12_swapchain_GetDevice ( IDXGISwapChain4 *  iface,
REFIID  iid,
void **  device 
)
static

Definition at line 2153 of file swapchain.c.

2154{
2155 struct d3d12_swapchain *swapchain = d3d12_swapchain_from_IDXGISwapChain4(iface);
2156
2157 TRACE("iface %p, iid %s, device %p.\n", iface, debugstr_guid(iid), device);
2158
2159 return ID3D12Device_QueryInterface(swapchain->device, iid, device);
2160}

◆ d3d12_swapchain_GetFrameLatencyWaitableObject()

static HANDLE STDMETHODCALLTYPE d3d12_swapchain_GetFrameLatencyWaitableObject ( IDXGISwapChain4 *  iface)
static

Definition at line 2909 of file swapchain.c.

2910{
2911 struct d3d12_swapchain *swapchain = d3d12_swapchain_from_IDXGISwapChain4(iface);
2912 HANDLE dup;
2913 BOOL ret;
2914
2915 TRACE("iface %p.\n", iface);
2916
2917 if (!swapchain->frame_latency_event)
2918 return NULL;
2919
2922
2923 if (!ret)
2924 {
2925 ERR("Cannot duplicate handle, last error %lu.\n", GetLastError());
2926 return NULL;
2927 }
2928
2929 return dup;
2930}
#define GetCurrentProcess()
Definition: compat.h:759
BOOL WINAPI DuplicateHandle(IN HANDLE hSourceProcessHandle, IN HANDLE hSourceHandle, IN HANDLE hTargetProcessHandle, OUT LPHANDLE lpTargetHandle, IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN DWORD dwOptions)
Definition: handle.c:149
#define dup
Definition: syshdrs.h:51
#define DUPLICATE_SAME_ACCESS

◆ d3d12_swapchain_GetFrameStatistics()

static HRESULT STDMETHODCALLTYPE d3d12_swapchain_GetFrameStatistics ( IDXGISwapChain4 *  iface,
DXGI_FRAME_STATISTICS *  stats 
)
static

Definition at line 2704 of file swapchain.c.

2706{
2707 FIXME("iface %p, stats %p stub!\n", iface, stats);
2708
2709 return E_NOTIMPL;
2710}

◆ d3d12_swapchain_GetFullscreenDesc()

static HRESULT STDMETHODCALLTYPE d3d12_swapchain_GetFullscreenDesc ( IDXGISwapChain4 *  iface,
DXGI_SWAP_CHAIN_FULLSCREEN_DESC *  desc 
)
static

Definition at line 2742 of file swapchain.c.

2744{
2745 struct d3d12_swapchain *swapchain = d3d12_swapchain_from_IDXGISwapChain4(iface);
2746 BOOL windowed;
2747
2748 TRACE("iface %p, desc %p.\n", iface, desc);
2749
2750 if (!desc)
2751 {
2752 WARN("Invalid pointer.\n");
2753 return E_INVALIDARG;
2754 }
2755
2757 windowed = wined3d_swapchain_state_is_windowed(swapchain->state);
2759
2760 *desc = swapchain->fullscreen_desc;
2761 desc->Windowed = windowed;
2762 return S_OK;
2763}

◆ d3d12_swapchain_GetFullscreenState()

static HRESULT STDMETHODCALLTYPE d3d12_swapchain_GetFullscreenState ( IDXGISwapChain4 *  iface,
BOOL *  fullscreen,
IDXGIOutput **  target 
)
static

Definition at line 2477 of file swapchain.c.

2479{
2480 struct d3d12_swapchain *swapchain = d3d12_swapchain_from_IDXGISwapChain4(iface);
2481 BOOL windowed;
2482 HRESULT hr;
2483
2484 TRACE("iface %p, fullscreen %p, target %p.\n", iface, fullscreen, target);
2485
2486 if (fullscreen || target)
2487 {
2489 windowed = wined3d_swapchain_state_is_windowed(swapchain->state);
2491 }
2492
2493 if (fullscreen)
2494 *fullscreen = !windowed;
2495
2496 if (target)
2497 {
2498 if (!windowed)
2499 {
2500 if (!swapchain->target && FAILED(hr = IDXGISwapChain4_GetContainingOutput(iface,
2501 &swapchain->target)))
2502 return hr;
2503
2504 *target = swapchain->target;
2505 IDXGIOutput_AddRef(*target);
2506 }
2507 else
2508 {
2509 *target = NULL;
2510 }
2511 }
2512
2513 return S_OK;
2514}

◆ d3d12_swapchain_GetHwnd()

static HRESULT STDMETHODCALLTYPE d3d12_swapchain_GetHwnd ( IDXGISwapChain4 *  iface,
HWND *  hwnd 
)
static

Definition at line 2765 of file swapchain.c.

2766{
2767 struct d3d12_swapchain *swapchain = d3d12_swapchain_from_IDXGISwapChain4(iface);
2768
2769 TRACE("iface %p, hwnd %p.\n", iface, hwnd);
2770
2771 if (!hwnd)
2772 {
2773 WARN("Invalid pointer.\n");
2775 }
2776
2777 *hwnd = swapchain->window;
2778 return S_OK;
2779}

◆ d3d12_swapchain_GetLastPresentCount()

static HRESULT STDMETHODCALLTYPE d3d12_swapchain_GetLastPresentCount ( IDXGISwapChain4 *  iface,
UINT *  last_present_count 
)
static

Definition at line 2712 of file swapchain.c.

2714{
2715 struct d3d12_swapchain *swapchain = d3d12_swapchain_from_IDXGISwapChain4(iface);
2716
2717 TRACE("iface %p, last_present_count %p.\n", iface, last_present_count);
2718
2719 *last_present_count = swapchain->frame_number;
2720
2721 return S_OK;
2722}
uint64_t frame_number
Definition: swapchain.c:1197

◆ d3d12_swapchain_GetMatrixTransform()

static HRESULT STDMETHODCALLTYPE d3d12_swapchain_GetMatrixTransform ( IDXGISwapChain4 *  iface,
DXGI_MATRIX_3X2_F *  matrix 
)
static

Definition at line 2940 of file swapchain.c.

2942{
2943 FIXME("iface %p, matrix %p stub!\n", iface, matrix);
2944
2945 return E_NOTIMPL;
2946}

◆ d3d12_swapchain_GetMaximumFrameLatency()

static HRESULT STDMETHODCALLTYPE d3d12_swapchain_GetMaximumFrameLatency ( IDXGISwapChain4 *  iface,
UINT *  max_latency 
)
static

Definition at line 2893 of file swapchain.c.

2894{
2895 struct d3d12_swapchain *swapchain = d3d12_swapchain_from_IDXGISwapChain4(iface);
2896
2897 TRACE("iface %p, max_latency %p.\n", iface, max_latency);
2898
2900 {
2901 WARN("DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT not set for swap chain %p.\n", iface);
2903 }
2904
2905 *max_latency = swapchain->frame_latency;
2906 return S_OK;
2907}
@ DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT
Definition: dxgi.idl:125
uint32_t frame_latency
Definition: swapchain.c:1198

◆ d3d12_swapchain_GetParent()

static HRESULT STDMETHODCALLTYPE d3d12_swapchain_GetParent ( IDXGISwapChain4 *  iface,
REFIID  iid,
void **  parent 
)
static

Definition at line 2142 of file swapchain.c.

2143{
2144 struct d3d12_swapchain *swapchain = d3d12_swapchain_from_IDXGISwapChain4(iface);
2145
2146 TRACE("iface %p, iid %s, parent %p.\n", iface, debugstr_guid(iid), parent);
2147
2148 return IWineDXGIFactory_QueryInterface(swapchain->factory, iid, parent);
2149}

◆ d3d12_swapchain_GetPrivateData()

static HRESULT STDMETHODCALLTYPE d3d12_swapchain_GetPrivateData ( IDXGISwapChain4 *  iface,
REFGUID  guid,
UINT *  data_size,
void *  data 
)
static

Definition at line 2132 of file swapchain.c.

2134{
2135 struct d3d12_swapchain *swapchain = d3d12_swapchain_from_IDXGISwapChain4(iface);
2136
2137 TRACE("iface %p, guid %s, data_size %p, data %p.\n", iface, debugstr_guid(guid), data_size, data);
2138
2139 return dxgi_get_private_data(&swapchain->private_store, guid, data_size, data);
2140}

◆ d3d12_swapchain_GetRestrictToOutput()

static HRESULT STDMETHODCALLTYPE d3d12_swapchain_GetRestrictToOutput ( IDXGISwapChain4 *  iface,
IDXGIOutput **  output 
)
static

Definition at line 2813 of file swapchain.c.

2814{
2815 FIXME("iface %p, output %p stub!\n", iface, output);
2816
2817 if (!output)
2818 {
2819 WARN("Invalid pointer.\n");
2820 return E_INVALIDARG;
2821 }
2822
2823 *output = NULL;
2824 return E_NOTIMPL;
2825}

◆ d3d12_swapchain_GetRotation()

static HRESULT STDMETHODCALLTYPE d3d12_swapchain_GetRotation ( IDXGISwapChain4 *  iface,
DXGI_MODE_ROTATION *  rotation 
)
static

Definition at line 2848 of file swapchain.c.

2849{
2850 FIXME("iface %p, rotation %p stub!\n", iface, rotation);
2851
2852 return E_NOTIMPL;
2853}

◆ d3d12_swapchain_GetSourceSize()

static HRESULT STDMETHODCALLTYPE d3d12_swapchain_GetSourceSize ( IDXGISwapChain4 *  iface,
UINT *  width,
UINT *  height 
)
static

Definition at line 2864 of file swapchain.c.

2865{
2866 FIXME("iface %p, width %p, height %p stub!\n", iface, width, height);
2867
2868 return E_NOTIMPL;
2869}

◆ d3d12_swapchain_init()

static HRESULT d3d12_swapchain_init ( struct d3d12_swapchain *  swapchain,
IWineDXGIFactory *  factory,
ID3D12Device *  device,
ID3D12CommandQueue *  queue,
HWND  window,
const DXGI_SWAP_CHAIN_DESC1 *  swapchain_desc,
const DXGI_SWAP_CHAIN_FULLSCREEN_DESC *  fullscreen_desc 
)
static

Definition at line 3176 of file swapchain.c.

3179{
3180 const struct dxgi_vk_funcs *vk_funcs = &swapchain->vk_funcs;
3181 struct wined3d_swapchain_desc wined3d_desc;
3182 VkWin32SurfaceCreateInfoKHR surface_desc;
3183 VkPhysicalDevice vk_physical_device;
3184 struct dxgi_factory *dxgi_factory;
3185 VkFenceCreateInfo fence_desc;
3186 uint32_t queue_family_index;
3187 VkSurfaceKHR vk_surface;
3188 VkInstance vk_instance;
3189 IDXGIOutput *output;
3190 VkBool32 supported;
3191 VkDevice vk_device;
3192 VkFence vk_fence;
3193 bool fullscreen;
3194 VkResult vr;
3195 HRESULT hr;
3196
3197 if (window == GetDesktopWindow())
3198 {
3199 WARN("D3D12 swapchain cannot be created on desktop window.\n");
3200 return E_ACCESSDENIED;
3201 }
3202
3203 swapchain->IDXGISwapChain4_iface.lpVtbl = &d3d12_swapchain_vtbl;
3205 swapchain->refcount = 1;
3206
3207 swapchain->window = window;
3208 swapchain->desc = *swapchain_desc;
3209 swapchain->backend_desc = *swapchain_desc;
3210 swapchain->fullscreen_desc = *fullscreen_desc;
3211
3213
3214 switch (swapchain_desc->SwapEffect)
3215 {
3218 FIXME("Ignoring swap effect %#x.\n", swapchain_desc->SwapEffect);
3219 break;
3220 default:
3221 WARN("Invalid swap effect %#x.\n", swapchain_desc->SwapEffect);
3223 }
3224
3226 {
3227 WARN("Failed to get output from window %p, hr %#lx.\n", window, hr);
3228 return hr;
3229 }
3230
3231 hr = wined3d_swapchain_desc_from_dxgi(&wined3d_desc, output, window, swapchain_desc,
3232 fullscreen_desc);
3233 if (FAILED(hr))
3234 {
3235 IDXGIOutput_Release(output);
3236 return hr;
3237 }
3238
3239 fullscreen = !wined3d_desc.windowed;
3240 wined3d_desc.windowed = TRUE;
3241
3244 &swapchain->state_parent, &swapchain->state)))
3245 {
3246 IDXGIOutput_Release(output);
3247 return hr;
3248 }
3249
3250 wined3d_swapchain_state_get_size(swapchain->state, &swapchain->desc.Width, &swapchain->desc.Height);
3251
3252 if (fullscreen)
3253 {
3254 wined3d_desc.windowed = FALSE;
3255 hr = wined3d_swapchain_state_set_fullscreen(swapchain->state, &wined3d_desc, NULL);
3256 if (FAILED(hr))
3257 {
3259 IDXGIOutput_Release(output);
3260 return hr;
3261 }
3262
3263 swapchain->target = output;
3264 }
3265 else
3266 {
3267 IDXGIOutput_Release(output);
3268 }
3269
3271 FIXME("Ignoring buffer usage %#x.\n", swapchain_desc->BufferUsage & ~(DXGI_USAGE_RENDER_TARGET_OUTPUT | DXGI_USAGE_SHADER_INPUT));
3272 if (swapchain_desc->Scaling != DXGI_SCALING_STRETCH && swapchain_desc->Scaling != DXGI_SCALING_NONE)
3273 FIXME("Ignoring scaling %#x.\n", swapchain_desc->Scaling);
3274 if (swapchain_desc->AlphaMode && swapchain_desc->AlphaMode != DXGI_ALPHA_MODE_IGNORE)
3275 FIXME("Ignoring alpha mode %#x.\n", swapchain_desc->AlphaMode);
3277 FIXME("Ignoring swapchain flags %#x.\n", swapchain_desc->Flags);
3278
3279 if (fullscreen_desc->RefreshRate.Numerator || fullscreen_desc->RefreshRate.Denominator)
3280 FIXME("Ignoring refresh rate.\n");
3281 if (fullscreen_desc->ScanlineOrdering)
3282 FIXME("Unhandled scanline ordering %#x.\n", fullscreen_desc->ScanlineOrdering);
3283 if (fullscreen_desc->Scaling)
3284 FIXME("Unhandled mode scaling %#x.\n", fullscreen_desc->Scaling);
3285
3287 vk_physical_device = vkd3d_get_vk_physical_device(device);
3288 vk_device = vkd3d_get_vk_device(device);
3289
3290 swapchain->vk_instance = vk_instance;
3291 swapchain->vk_device = vk_device;
3292 swapchain->vk_physical_device = vk_physical_device;
3293
3294 if (!init_vk_funcs(&swapchain->vk_funcs, vk_instance, vk_device))
3295 {
3297 return E_FAIL;
3298 }
3299
3301
3304 swapchain->worker_running = true;
3305 list_init(&swapchain->worker_ops);
3306
3308 surface_desc.pNext = NULL;
3309 surface_desc.flags = 0;
3310 surface_desc.hinstance = GetModuleHandleA("dxgi.dll");
3311 surface_desc.hwnd = window;
3312 if ((vr = vk_funcs->p_vkCreateWin32SurfaceKHR(vk_instance, &surface_desc, NULL, &vk_surface)) < 0)
3313 {
3314 WARN("Failed to create Vulkan surface, vr %d.\n", vr);
3315 d3d12_swapchain_destroy(swapchain);
3316 return hresult_from_vk_result(vr);
3317 }
3318 swapchain->vk_surface = vk_surface;
3319
3320 queue_family_index = vkd3d_get_vk_queue_family_index(queue);
3321 if ((vr = vk_funcs->p_vkGetPhysicalDeviceSurfaceSupportKHR(vk_physical_device,
3322 queue_family_index, vk_surface, &supported)) < 0 || !supported)
3323 {
3324 FIXME("Queue family does not support presentation, vr %d.\n", vr);
3325 d3d12_swapchain_destroy(swapchain);
3327 }
3328
3329 ID3D12CommandQueue_AddRef(swapchain->command_queue = queue);
3330 ID3D12Device_AddRef(swapchain->device = device);
3331
3333 {
3334 d3d12_swapchain_destroy(swapchain);
3335 return hr;
3336 }
3337
3339 {
3340 d3d12_swapchain_destroy(swapchain);
3341 return hr;
3342 }
3343
3345 fence_desc.pNext = NULL;
3346 fence_desc.flags = 0;
3347 if ((vr = vk_funcs->p_vkCreateFence(vk_device, &fence_desc, NULL, &vk_fence)) < 0)
3348 {
3349 WARN("Failed to create Vulkan fence, vr %d.\n", vr);
3350 d3d12_swapchain_destroy(swapchain);
3351 return hresult_from_vk_result(vr);
3352 }
3353 swapchain->vk_fence = vk_fence;
3354
3355 swapchain->current_buffer_index = 0;
3356
3358 {
3359 swapchain->frame_latency = 1;
3360
3361 if (FAILED(hr = ID3D12Device_CreateFence(device, DXGI_MAX_SWAP_CHAIN_BUFFERS,
3362 0, &IID_ID3D12Fence, (void **)&swapchain->frame_latency_fence)))
3363 {
3364 WARN("Failed to create frame latency fence, hr %#lx.\n", hr);
3365 d3d12_swapchain_destroy(swapchain);
3366 return hr;
3367 }
3368
3369 if (!(swapchain->frame_latency_event = CreateEventW(NULL, FALSE, TRUE, NULL)))
3370 {
3372 WARN("Failed to create frame latency event, hr %#lx.\n", hr);
3373 d3d12_swapchain_destroy(swapchain);
3374 return hr;
3375 }
3376 }
3377
3378 if (FAILED(hr = ID3D12Device_CreateFence(device, 0, 0,
3379 &IID_ID3D12Fence, (void **)&swapchain->present_fence)))
3380 {
3381 WARN("Failed to create present fence, hr %#lx.\n", hr);
3382 d3d12_swapchain_destroy(swapchain);
3383 return hr;
3384 }
3385
3386 IWineDXGIFactory_AddRef(swapchain->factory = factory);
3387
3388 if (!(swapchain->worker_thread = CreateThread(NULL, 0, d3d12_swapchain_worker_proc, swapchain, 0, NULL)))
3389 {
3391 WARN("Failed to create worker thread, hr %#lx.\n", hr);
3392 d3d12_swapchain_destroy(swapchain);
3393 return hr;
3394 }
3395
3396 return S_OK;
3397}
static void list_init(struct list_entry *head)
Definition: list.h:51
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:137
VOID WINAPI InitializeConditionVariable(PCONDITION_VARIABLE ConditionVariable)
Definition: sync.c:22
static HRESULT d3d12_swapchain_create_d3d12_resources(struct d3d12_swapchain *swapchain)
Definition: swapchain.c:1966
static const struct IDXGISwapChain4Vtbl d3d12_swapchain_vtbl
Definition: swapchain.c:3029
static const struct wined3d_swapchain_state_parent_ops d3d12_swapchain_state_parent_ops
Definition: swapchain.c:3171
static DWORD WINAPI d3d12_swapchain_worker_proc(void *data)
Definition: swapchain.c:1253
static HRESULT d3d12_swapchain_create_vulkan_resources(struct d3d12_swapchain *swapchain)
Definition: swapchain.c:1956
static void d3d12_swapchain_destroy(struct d3d12_swapchain *swapchain)
Definition: swapchain.c:2023
static BOOL init_vk_funcs(struct dxgi_vk_funcs *dxgi, VkInstance vk_instance, VkDevice vk_device)
Definition: swapchain.c:3082
@ DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL
Definition: dxgi.idl:67
@ DXGI_SWAP_EFFECT_FLIP_DISCARD
Definition: dxgi.idl:68
const DXGI_USAGE DXGI_USAGE_RENDER_TARGET_OUTPUT
Definition: dxgi.idl:44
struct dxgi_factory * unsafe_impl_from_IDXGIFactory(IDXGIFactory *iface)
Definition: factory.c:546
HRESULT wined3d_swapchain_desc_from_dxgi(struct wined3d_swapchain_desc *wined3d_desc, IDXGIOutput *dxgi_containing_output, HWND window, const DXGI_SWAP_CHAIN_DESC1 *dxgi_desc, const DXGI_SWAP_CHAIN_FULLSCREEN_DESC *dxgi_fullscreen_desc)
Definition: utils.c:571
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:628
DXGI_ALPHA_MODE AlphaMode
Definition: dxgi1_2.idl:230
DXGI_SCALING Scaling
Definition: dxgi1_2.idl:228
const void * pNext
Definition: vulkan.h:8731
VkFenceCreateFlags flags
Definition: vulkan.h:8732
VkStructureType sType
Definition: vulkan.h:8730
struct wined3d_swapchain_state_parent state_parent
Definition: swapchain.c:1138
IDXGISwapChain4 IDXGISwapChain4_iface
Definition: swapchain.c:1133
struct wined3d * wined3d
Definition: dxgi_private.h:117
PFN_vkGetPhysicalDeviceSurfaceSupportKHR p_vkGetPhysicalDeviceSurfaceSupportKHR
Definition: swapchain.c:1102
PFN_vkCreateWin32SurfaceKHR p_vkCreateWin32SurfaceKHR
Definition: swapchain.c:1086
PFN_vkCreateFence p_vkCreateFence
Definition: swapchain.c:1082
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
Definition: synch.c:687
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:587
VKD3D_API VkInstance vkd3d_instance_get_vk_instance(struct vkd3d_instance *instance)
Definition: device.c:803
VKD3D_API struct vkd3d_instance * vkd3d_instance_from_device(ID3D12Device *device)
Definition: device.c:5715
VKD3D_API VkDevice vkd3d_get_vk_device(ID3D12Device *device)
Definition: device.c:5701
VKD3D_API VkPhysicalDevice vkd3d_get_vk_physical_device(ID3D12Device *device)
Definition: device.c:5708
@ VK_PRESENT_MODE_FIFO_KHR
Definition: vulkan.h:4420
uint32_t VkBool32
Definition: vulkan.h:946
@ VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR
Definition: vulkan.h:5023
@ VK_STRUCTURE_TYPE_FENCE_CREATE_INFO
Definition: vulkan.h:4972
HRESULT CDECL wined3d_swapchain_state_create(const struct wined3d_swapchain_desc *desc, HWND window, struct wined3d *wined3d, struct wined3d_swapchain_state_parent *state_parent, struct wined3d_swapchain_state **state)
Definition: swapchain.c:2473
static HRESULT HRESULT_FROM_WIN32(unsigned int x)
Definition: winerror.h:210
#define E_ACCESSDENIED
Definition: winerror.h:4116

Referenced by d3d12_swapchain_create().

◆ d3d12_swapchain_is_present_mode_supported()

static BOOL d3d12_swapchain_is_present_mode_supported ( struct d3d12_swapchain *  swapchain,
VkPresentModeKHR  present_mode 
)
static

Definition at line 1412 of file swapchain.c.

1414{
1415 VkPhysicalDevice vk_physical_device = swapchain->vk_physical_device;
1416 const struct dxgi_vk_funcs *vk_funcs = &swapchain->vk_funcs;
1417 VkPresentModeKHR *modes;
1418 uint32_t count, i;
1419 BOOL supported;
1420 VkResult vr;
1421
1422 if (present_mode == VK_PRESENT_MODE_FIFO_KHR)
1423 return TRUE;
1424
1425 if ((vr = vk_funcs->p_vkGetPhysicalDeviceSurfacePresentModesKHR(vk_physical_device,
1426 swapchain->vk_surface, &count, NULL)) < 0)
1427 {
1428 WARN("Failed to get count of available present modes, vr %d.\n", vr);
1429 return FALSE;
1430 }
1431
1432 supported = FALSE;
1433
1434 if (!(modes = calloc(count, sizeof(*modes))))
1435 return FALSE;
1436 if ((vr = vk_funcs->p_vkGetPhysicalDeviceSurfacePresentModesKHR(vk_physical_device,
1437 swapchain->vk_surface, &count, modes)) >= 0)
1438 {
1439 for (i = 0; i < count; ++i)
1440 {
1441 if (modes[i] == present_mode)
1442 {
1443 supported = TRUE;
1444 break;
1445 }
1446 }
1447 }
1448 else
1449 {
1450 WARN("Failed to get available present modes, vr %d.\n", vr);
1451 }
1452 free(modes);
1453
1454 return supported;
1455}
GLuint GLuint GLsizei count
Definition: gl.h:1545
PFN_vkGetPhysicalDeviceSurfacePresentModesKHR p_vkGetPhysicalDeviceSurfacePresentModesKHR
Definition: swapchain.c:1101
VkPresentModeKHR
Definition: vulkan.h:4417

Referenced by d3d12_swapchain_set_sync_interval().

◆ d3d12_swapchain_IsTemporaryMonoSupported()

static BOOL STDMETHODCALLTYPE d3d12_swapchain_IsTemporaryMonoSupported ( IDXGISwapChain4 *  iface)
static

Definition at line 2806 of file swapchain.c.

2807{
2808 FIXME("iface %p stub!\n", iface);
2809
2810 return FALSE;
2811}

◆ d3d12_swapchain_op_destroy()

static void d3d12_swapchain_op_destroy ( struct d3d12_swapchain *  swapchain,
struct d3d12_swapchain_op *  op 
)
static

Definition at line 1232 of file swapchain.c.

1233{
1234 const struct dxgi_vk_funcs *vk_funcs = &swapchain->vk_funcs;
1235 unsigned int i;
1236
1238 {
1239 assert(swapchain->vk_device);
1240
1241 for (i = 0; i < DXGI_MAX_SWAP_CHAIN_BUFFERS; ++i)
1242 vk_funcs->p_vkDestroyImage(swapchain->vk_device, op->resize_buffers.vk_images[i], NULL);
1243
1244 vk_funcs->p_vkFreeMemory(swapchain->vk_device, op->resize_buffers.vk_memory, NULL);
1245 }
1246
1247 free(op);
1248}

Referenced by d3d12_swapchain_destroy(), and d3d12_swapchain_worker_proc().

◆ d3d12_swapchain_op_present_execute()

static HRESULT d3d12_swapchain_op_present_execute ( struct d3d12_swapchain *  swapchain,
struct d3d12_swapchain_op *  op 
)
static

Definition at line 2270 of file swapchain.c.

2271{
2272 VkResult vr;
2273 HRESULT hr;
2274
2275 if (FAILED(hr = d3d12_swapchain_set_sync_interval(swapchain, op->present.sync_interval)))
2276 return hr;
2277
2278 vr = d3d12_swapchain_queue_present(swapchain, op->present.vk_image, op->present.frame_number);
2279 if (vr == VK_ERROR_OUT_OF_DATE_KHR)
2280 {
2281 TRACE("Recreating Vulkan swapchain.\n");
2282
2285 return hr;
2286
2287 if ((vr = d3d12_swapchain_queue_present(swapchain, op->present.vk_image, op->present.frame_number)) < 0)
2288 ERR("Failed to present after recreating swapchain, vr %d.\n", vr);
2289 }
2290
2291 if (vr < 0)
2292 {
2293 ERR("Failed to queue present, vr %d.\n", vr);
2294 return hresult_from_vk_result(vr);
2295 }
2296
2297 if (swapchain->frame_latency_fence)
2298 {
2299 /* Use the same bias as d3d12_swapchain_present(). Add one to
2300 * account for the "++swapchain->frame_number" there. */
2301 uint64_t number = op->present.frame_number + DXGI_MAX_SWAP_CHAIN_BUFFERS + 1;
2302
2303 if (FAILED(hr = ID3D12CommandQueue_Signal(swapchain->command_queue,
2304 swapchain->frame_latency_fence, number)))
2305 {
2306 ERR("Failed to signal frame latency fence, hr %#lx.\n", hr);
2307 return hr;
2308 }
2309 }
2310
2311 return S_OK;
2312}
UINT64 uint64_t
Definition: types.h:77
static VkResult d3d12_swapchain_queue_present(struct d3d12_swapchain *swapchain, VkImage vk_src_image, uint64_t frame_number)
Definition: swapchain.c:2195
static HRESULT d3d12_swapchain_set_sync_interval(struct d3d12_swapchain *swapchain, unsigned int sync_interval)
Definition: swapchain.c:2164
static unsigned int number
Definition: dsound.c:1479
@ VK_ERROR_OUT_OF_DATE_KHR
Definition: vulkan.h:4656

Referenced by d3d12_swapchain_worker_proc().

◆ d3d12_swapchain_op_resize_buffers_execute()

static HRESULT d3d12_swapchain_op_resize_buffers_execute ( struct d3d12_swapchain *  swapchain,
struct d3d12_swapchain_op *  op 
)
static

Definition at line 2552 of file swapchain.c.

2553{
2555
2556 swapchain->backend_desc = op->resize_buffers.desc;
2557
2559}

Referenced by d3d12_swapchain_worker_proc().

◆ d3d12_swapchain_Present()

static HRESULT STDMETHODCALLTYPE d3d12_swapchain_Present ( IDXGISwapChain4 *  iface,
UINT  sync_interval,
UINT  flags 
)
static

Definition at line 2377 of file swapchain.c.

2378{
2379 struct d3d12_swapchain *swapchain = d3d12_swapchain_from_IDXGISwapChain4(iface);
2380
2381 TRACE("iface %p, sync_interval %u, flags %#x.\n", iface, sync_interval, flags);
2382
2383 return d3d12_swapchain_present(swapchain, sync_interval, flags);
2384}
static HRESULT d3d12_swapchain_present(struct d3d12_swapchain *swapchain, unsigned int sync_interval, unsigned int flags)
Definition: swapchain.c:2314

◆ d3d12_swapchain_present()

static HRESULT d3d12_swapchain_present ( struct d3d12_swapchain *  swapchain,
unsigned int  sync_interval,
unsigned int  flags 
)
static

Definition at line 2314 of file swapchain.c.

2316{
2317 struct d3d12_swapchain_op *op;
2318 HANDLE frame_latency_event;
2319 HRESULT hr;
2320
2321 if (sync_interval > 4)
2322 {
2323 WARN("Invalid sync interval %u.\n", sync_interval);
2325 }
2326
2327 if (flags & ~DXGI_PRESENT_TEST)
2328 FIXME("Unimplemented flags %#x.\n", flags);
2329 if (flags & DXGI_PRESENT_TEST)
2330 {
2331 WARN("Returning S_OK for DXGI_PRESENT_TEST.\n");
2332 return S_OK;
2333 }
2334
2335 if (!(op = calloc(1, sizeof(*op))))
2336 {
2337 WARN("Cannot allocate memory.\n");
2338 return E_OUTOFMEMORY;
2339 }
2340
2342 op->present.sync_interval = sync_interval;
2343 op->present.vk_image = swapchain->vk_images[swapchain->current_buffer_index];
2344 op->present.frame_number = swapchain->frame_number;
2345
2346 EnterCriticalSection(&swapchain->worker_cs);
2347 list_add_tail(&swapchain->worker_ops, &op->entry);
2349 LeaveCriticalSection(&swapchain->worker_cs);
2350
2351 ++swapchain->frame_number;
2352 if ((frame_latency_event = swapchain->frame_latency_event))
2353 {
2354 /* Bias the frame number to avoid underflowing in
2355 * SetEventOnCompletion(). */
2356 uint64_t number = swapchain->frame_number + DXGI_MAX_SWAP_CHAIN_BUFFERS;
2357
2358 if (FAILED(hr = ID3D12Fence_SetEventOnCompletion(swapchain->frame_latency_fence,
2359 number - swapchain->frame_latency, frame_latency_event)))
2360 {
2361 ERR("Failed to enqueue frame latency event, hr %#lx.\n", hr);
2362 return hr;
2363 }
2364 }
2365
2366 if (FAILED(hr = ID3D12CommandQueue_Signal(swapchain->command_queue,
2367 swapchain->present_fence, swapchain->frame_number)))
2368 {
2369 ERR("Failed to signal present fence, hf %#lx.\n", hr);
2370 return hr;
2371 }
2372
2373 swapchain->current_buffer_index = (swapchain->current_buffer_index + 1) % swapchain->desc.BufferCount;
2374 return S_OK;
2375}
static void list_add_tail(struct list_entry *head, struct list_entry *entry)
Definition: list.h:83
unsigned int sync_interval
Definition: swapchain.c:1215

Referenced by d3d12_swapchain_Present(), and d3d12_swapchain_Present1().

◆ d3d12_swapchain_Present1()

static HRESULT STDMETHODCALLTYPE d3d12_swapchain_Present1 ( IDXGISwapChain4 *  iface,
UINT  sync_interval,
UINT  flags,
const DXGI_PRESENT_PARAMETERS *  present_parameters 
)
static

Definition at line 2792 of file swapchain.c.

2794{
2795 struct d3d12_swapchain *swapchain = d3d12_swapchain_from_IDXGISwapChain4(iface);
2796
2797 TRACE("iface %p, sync_interval %u, flags %#x, present_parameters %p.\n",
2798 iface, sync_interval, flags, present_parameters);
2799
2800 if (present_parameters)
2801 FIXME("Ignored present parameters %p.\n", present_parameters);
2802
2803 return d3d12_swapchain_present(swapchain, sync_interval, flags);
2804}

◆ d3d12_swapchain_QueryInterface()

static HRESULT STDMETHODCALLTYPE d3d12_swapchain_QueryInterface ( IDXGISwapChain4 *  iface,
REFIID  iid,
void **  object 
)
static

Definition at line 1989 of file swapchain.c.

1990{
1991 TRACE("iface %p, iid %s, object %p.\n", iface, debugstr_guid(iid), object);
1992
1993 if (IsEqualGUID(iid, &IID_IUnknown)
1994 || IsEqualGUID(iid, &IID_IDXGIObject)
1995 || IsEqualGUID(iid, &IID_IDXGIDeviceSubObject)
1996 || IsEqualGUID(iid, &IID_IDXGISwapChain)
1997 || IsEqualGUID(iid, &IID_IDXGISwapChain1)
1998 || IsEqualGUID(iid, &IID_IDXGISwapChain2)
1999 || IsEqualGUID(iid, &IID_IDXGISwapChain3)
2000 || IsEqualGUID(iid, &IID_IDXGISwapChain4))
2001 {
2002 IUnknown_AddRef(iface);
2003 *object = iface;
2004 return S_OK;
2005 }
2006
2007 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid));
2008
2009 *object = NULL;
2010 return E_NOINTERFACE;
2011}

◆ d3d12_swapchain_queue_present()

static VkResult d3d12_swapchain_queue_present ( struct d3d12_swapchain *  swapchain,
VkImage  vk_src_image,
uint64_t  frame_number 
)
static

Definition at line 2195 of file swapchain.c.

2197{
2198 const struct dxgi_vk_funcs *vk_funcs = &swapchain->vk_funcs;
2199 VkPresentInfoKHR present_info;
2200 VkCommandBuffer vk_cmd_buffer;
2201 VkSubmitInfo submit_info;
2202 VkImage vk_dst_image;
2203 VkQueue vk_queue;
2204 VkResult vr;
2205 HRESULT hr;
2206
2207 if (swapchain->vk_image_index == INVALID_VK_IMAGE_INDEX)
2208 {
2209 if ((vr = d3d12_swapchain_acquire_next_vulkan_image(swapchain)) < 0)
2210 return vr;
2211 }
2212
2213 assert(swapchain->vk_image_index < swapchain->buffer_count);
2214
2215 vk_cmd_buffer = swapchain->vk_cmd_buffers[swapchain->vk_image_index];
2216 vk_dst_image = swapchain->vk_swapchain_images[swapchain->vk_image_index];
2217
2218 if ((vr = vk_funcs->p_vkResetCommandBuffer(vk_cmd_buffer, 0)) < 0)
2219 {
2220 ERR("Failed to reset command buffer, vr %d.\n", vr);
2221 return vr;
2222 }
2223
2224 if ((vr = d3d12_swapchain_record_swapchain_blit(swapchain,
2225 vk_cmd_buffer, vk_dst_image, vk_src_image)) < 0 )
2226 return vr;
2227
2228 if (FAILED(hr = ID3D12Fence_SetEventOnCompletion(swapchain->present_fence, frame_number + 1, NULL)))
2229 {
2230 ERR("Failed to wait for present event, hr %#lx.\n", hr);
2231 return VK_ERROR_UNKNOWN;
2232 }
2233
2234 vk_queue = vkd3d_acquire_vk_queue(swapchain->command_queue);
2235
2237 submit_info.pNext = NULL;
2238 submit_info.waitSemaphoreCount = 0;
2239 submit_info.pWaitSemaphores = NULL;
2240 submit_info.pWaitDstStageMask = NULL;
2241 submit_info.commandBufferCount = 1;
2242 submit_info.pCommandBuffers = &vk_cmd_buffer;
2243 submit_info.signalSemaphoreCount = 1;
2244 submit_info.pSignalSemaphores = &swapchain->vk_semaphores[swapchain->vk_image_index];
2245
2246 if ((vr = vk_funcs->p_vkQueueSubmit(vk_queue, 1, &submit_info, VK_NULL_HANDLE)) < 0)
2247 {
2248 ERR("Failed to blit swapchain buffer, vr %d.\n", vr);
2250 return vr;
2251 }
2252
2254 present_info.pNext = NULL;
2255 present_info.waitSemaphoreCount = 1;
2256 present_info.pWaitSemaphores = &swapchain->vk_semaphores[swapchain->vk_image_index];
2257 present_info.swapchainCount = 1;
2258 present_info.pSwapchains = &swapchain->vk_swapchain;
2259 present_info.pImageIndices = &swapchain->vk_image_index;
2260 present_info.pResults = NULL;
2261
2262 if ((vr = vk_funcs->p_vkQueuePresentKHR(vk_queue, &present_info)) >= 0)
2264
2266
2267 return vr;
2268}
static VkResult d3d12_swapchain_acquire_next_vulkan_image(struct d3d12_swapchain *swapchain)
Definition: swapchain.c:1752
static VkResult d3d12_swapchain_record_swapchain_blit(struct d3d12_swapchain *swapchain, VkCommandBuffer vk_cmd_buffer, VkImage vk_dst_image, VkImage vk_src_image)
Definition: swapchain.c:1577
const VkSemaphore * pWaitSemaphores
Definition: vulkan.h:13417
VkResult * pResults
Definition: vulkan.h:13421
uint32_t waitSemaphoreCount
Definition: vulkan.h:13416
uint32_t swapchainCount
Definition: vulkan.h:13418
const uint32_t * pImageIndices
Definition: vulkan.h:13420
VkStructureType sType
Definition: vulkan.h:13414
const VkSwapchainKHR * pSwapchains
Definition: vulkan.h:13419
const void * pNext
Definition: vulkan.h:13415
uint32_t waitSemaphoreCount
Definition: vulkan.h:14150
const VkPipelineStageFlags * pWaitDstStageMask
Definition: vulkan.h:14152
uint32_t commandBufferCount
Definition: vulkan.h:14153
const VkSemaphore * pWaitSemaphores
Definition: vulkan.h:14151
uint32_t signalSemaphoreCount
Definition: vulkan.h:14155
const VkCommandBuffer * pCommandBuffers
Definition: vulkan.h:14154
const void * pNext
Definition: vulkan.h:14149
const VkSemaphore * pSignalSemaphores
Definition: vulkan.h:14156
VkStructureType sType
Definition: vulkan.h:14148
PFN_vkResetCommandBuffer p_vkResetCommandBuffer
Definition: swapchain.c:1092
PFN_vkQueueSubmit p_vkQueueSubmit
Definition: swapchain.c:1106
PFN_vkQueuePresentKHR p_vkQueuePresentKHR
Definition: swapchain.c:1105
@ VK_ERROR_UNKNOWN
Definition: vulkan.h:4659
@ VK_STRUCTURE_TYPE_SUBMIT_INFO
Definition: vulkan.h:4968
@ VK_STRUCTURE_TYPE_PRESENT_INFO_KHR
Definition: vulkan.h:5022

Referenced by d3d12_swapchain_op_present_execute().

◆ d3d12_swapchain_record_swapchain_blit()

static VkResult d3d12_swapchain_record_swapchain_blit ( struct d3d12_swapchain *  swapchain,
VkCommandBuffer  vk_cmd_buffer,
VkImage  vk_dst_image,
VkImage  vk_src_image 
)
static

Definition at line 1577 of file swapchain.c.

1579{
1580 const struct dxgi_vk_funcs *vk_funcs = &swapchain->vk_funcs;
1581 VkCommandBufferBeginInfo begin_info;
1582 VkImageBlit blit;
1584 VkResult vr;
1585
1586 if (swapchain->desc.Width != swapchain->vk_swapchain_width
1587 || swapchain->desc.Height != swapchain->vk_swapchain_height)
1589 else
1591
1593 begin_info.pNext = NULL;
1594 begin_info.flags = 0;
1595 begin_info.pInheritanceInfo = NULL;
1596
1597 if ((vr = vk_funcs->p_vkBeginCommandBuffer(vk_cmd_buffer, &begin_info)) < 0)
1598 {
1599 WARN("Failed to begin command buffer, vr %d.\n", vr);
1600 return vr;
1601 }
1602
1603 vk_cmd_image_barrier(vk_funcs, vk_cmd_buffer,
1607
1609 blit.srcSubresource.mipLevel = 0;
1611 blit.srcSubresource.layerCount = 1;
1612 blit.srcOffsets[0].x = 0;
1613 blit.srcOffsets[0].y = 0;
1614 blit.srcOffsets[0].z = 0;
1615 blit.srcOffsets[1].x = swapchain->desc.Width;
1616 blit.srcOffsets[1].y = swapchain->desc.Height;
1617 blit.srcOffsets[1].z = 1;
1618 blit.dstSubresource = blit.srcSubresource;
1619 blit.dstOffsets[0].x = 0;
1620 blit.dstOffsets[0].y = 0;
1621 blit.dstOffsets[0].z = 0;
1622 if (swapchain->desc.Scaling == DXGI_SCALING_NONE)
1623 {
1624 blit.srcOffsets[1].x = min(swapchain->vk_swapchain_width, blit.srcOffsets[1].x);
1625 blit.srcOffsets[1].y = min(swapchain->vk_swapchain_height, blit.srcOffsets[1].y);
1626 blit.dstOffsets[1].x = blit.srcOffsets[1].x;
1627 blit.dstOffsets[1].y = blit.srcOffsets[1].y;
1628 }
1629 else
1630 {
1631 /* FIXME: handle DXGI_SCALING_ASPECT_RATIO_STRETCH. */
1632 blit.dstOffsets[1].x = swapchain->vk_swapchain_width;
1633 blit.dstOffsets[1].y = swapchain->vk_swapchain_height;
1634 }
1635 blit.dstOffsets[1].z = 1;
1636
1637 vk_funcs->p_vkCmdBlitImage(vk_cmd_buffer,
1640 1, &blit, filter);
1641
1642 vk_cmd_image_barrier(vk_funcs, vk_cmd_buffer,
1646
1647 if ((vr = vk_funcs->p_vkEndCommandBuffer(vk_cmd_buffer)) < 0)
1648 WARN("Failed to end command buffer, vr %d.\n", vr);
1649
1650 return vr;
1651}
static void vk_cmd_image_barrier(const struct dxgi_vk_funcs *vk_funcs, VkCommandBuffer cmd_buffer, VkPipelineStageFlags src_stage_mask, VkPipelineStageFlags dst_stage_mask, VkAccessFlags src_access_mask, VkAccessFlags dst_access_mask, VkImageLayout old_layout, VkImageLayout new_layout, VkImage image)
Definition: swapchain.c:1551
const VkCommandBufferInheritanceInfo * pInheritanceInfo
Definition: vulkan.h:16042
VkStructureType sType
Definition: vulkan.h:16039
const void * pNext
Definition: vulkan.h:16040
VkCommandBufferUsageFlags flags
Definition: vulkan.h:16041
VkOffset3D srcOffsets[2]
Definition: vulkan.h:16351
VkImageSubresourceLayers srcSubresource
Definition: vulkan.h:16350
VkOffset3D dstOffsets[2]
Definition: vulkan.h:16353
VkImageSubresourceLayers dstSubresource
Definition: vulkan.h:16352
VkImageAspectFlags aspectMask
Definition: vulkan.h:9065
int32_t x
Definition: vulkan.h:9579
int32_t y
Definition: vulkan.h:9580
int32_t z
Definition: vulkan.h:9581
PFN_vkEndCommandBuffer p_vkEndCommandBuffer
Definition: swapchain.c:1094
PFN_vkCmdBlitImage p_vkCmdBlitImage
Definition: swapchain.c:1079
PFN_vkBeginCommandBuffer p_vkBeginCommandBuffer
Definition: swapchain.c:1077
Definition: filter.c:165
@ VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL
Definition: vulkan.h:3457
@ VK_IMAGE_LAYOUT_PRESENT_SRC_KHR
Definition: vulkan.h:3460
@ VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL
Definition: vulkan.h:3458
@ VK_IMAGE_ASPECT_COLOR_BIT
Definition: vulkan.h:3365
VkFilter
Definition: vulkan.h:2806
@ VK_FILTER_NEAREST
Definition: vulkan.h:2807
@ VK_FILTER_LINEAR
Definition: vulkan.h:2808
@ VK_ACCESS_TRANSFER_WRITE_BIT
Definition: vulkan.h:1641
@ VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT
Definition: vulkan.h:4272
@ VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT
Definition: vulkan.h:4285
@ VK_PIPELINE_STAGE_TRANSFER_BIT
Definition: vulkan.h:4284
@ VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO
Definition: vulkan.h:5006

Referenced by d3d12_swapchain_queue_present().

◆ d3d12_swapchain_Release()

static ULONG STDMETHODCALLTYPE d3d12_swapchain_Release ( IDXGISwapChain4 *  iface)
static

Definition at line 2094 of file swapchain.c.

2095{
2096 struct d3d12_swapchain *swapchain = d3d12_swapchain_from_IDXGISwapChain4(iface);
2098
2099 TRACE("%p decreasing refcount to %lu.\n", swapchain, refcount);
2100
2101 if (!refcount)
2102 {
2103 d3d12_swapchain_destroy(swapchain);
2104 free(swapchain);
2105 }
2106
2107 return refcount;
2108}

◆ d3d12_swapchain_resize_buffers()

static HRESULT d3d12_swapchain_resize_buffers ( struct d3d12_swapchain *  swapchain,
UINT  buffer_count,
UINT  width,
UINT  height,
DXGI_FORMAT  format,
UINT  flags 
)
static

Definition at line 2561 of file swapchain.c.

2563{
2564 DXGI_SWAP_CHAIN_DESC1 *desc, new_desc;
2565 struct d3d12_swapchain_op *op;
2566 unsigned int i;
2567 ULONG refcount;
2568
2569 if (flags)
2570 FIXME("Ignoring flags %#x.\n", flags);
2571
2572 for (i = 0; i < swapchain->desc.BufferCount; ++i)
2573 {
2574 ID3D12Resource_AddRef(swapchain->buffers[i]);
2575 if ((refcount = ID3D12Resource_Release(swapchain->buffers[i])))
2576 {
2577 WARN("Buffer %p has %lu references left.\n", swapchain->buffers[i], refcount);
2579 }
2580 }
2581
2582 desc = &swapchain->desc;
2583 new_desc = swapchain->desc;
2584
2585 if (buffer_count)
2586 new_desc.BufferCount = buffer_count;
2587 if (!width || !height)
2588 {
2589 RECT client_rect;
2590
2591 if (!GetClientRect(swapchain->window, &client_rect))
2592 {
2593 WARN("Failed to get client rect, last error %#lx.\n", GetLastError());
2595 }
2596
2597 if (!width)
2598 width = client_rect.right;
2599 if (!height)
2600 height = client_rect.bottom;
2601 }
2602 new_desc.Width = width;
2603 new_desc.Height = height;
2604
2605 if (format)
2606 new_desc.Format = format;
2607
2608 if (!dxgi_validate_swapchain_desc(&new_desc))
2610
2611 if (desc->Width == new_desc.Width && desc->Height == new_desc.Height
2612 && desc->Format == new_desc.Format && desc->BufferCount == new_desc.BufferCount)
2613 {
2614 swapchain->current_buffer_index = 0;
2615 return S_OK;
2616 }
2617
2618 if (!(op = calloc(1, sizeof(*op))))
2619 {
2620 WARN("Cannot allocate memory.\n");
2621 return E_OUTOFMEMORY;
2622 }
2623
2625 op->resize_buffers.vk_memory = swapchain->vk_memory;
2626 swapchain->vk_memory = VK_NULL_HANDLE;
2627 memcpy(&op->resize_buffers.vk_images, &swapchain->vk_images, sizeof(swapchain->vk_images));
2628 memset(&swapchain->vk_images, 0, sizeof(swapchain->vk_images));
2629 op->resize_buffers.desc = new_desc;
2630
2631 EnterCriticalSection(&swapchain->worker_cs);
2632 list_add_tail(&swapchain->worker_ops, &op->entry);
2634 LeaveCriticalSection(&swapchain->worker_cs);
2635
2636 swapchain->current_buffer_index = 0;
2637
2639
2640 swapchain->desc = new_desc;
2641
2643}
BOOL dxgi_validate_swapchain_desc(const DXGI_SWAP_CHAIN_DESC1 *desc)
Definition: swapchain.c:63
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
Definition: dcommon.idl:28
long bottom
Definition: dcommon.idl:29
long right
Definition: dcommon.idl:29

Referenced by d3d12_swapchain_ResizeBuffers(), and d3d12_swapchain_ResizeBuffers1().

◆ d3d12_swapchain_ResizeBuffers()

static HRESULT STDMETHODCALLTYPE d3d12_swapchain_ResizeBuffers ( IDXGISwapChain4 *  iface,
UINT  buffer_count,
UINT  width,
UINT  height,
DXGI_FORMAT  format,
UINT  flags 
)
static

Definition at line 2645 of file swapchain.c.

2647{
2648 struct d3d12_swapchain *swapchain = d3d12_swapchain_from_IDXGISwapChain4(iface);
2649
2650 TRACE("iface %p, buffer_count %u, width %u, height %u, format %s, flags %#x.\n",
2652
2654}
static HRESULT d3d12_swapchain_resize_buffers(struct d3d12_swapchain *swapchain, UINT buffer_count, UINT width, UINT height, DXGI_FORMAT format, UINT flags)
Definition: swapchain.c:2561

◆ d3d12_swapchain_ResizeBuffers1()

static HRESULT STDMETHODCALLTYPE d3d12_swapchain_ResizeBuffers1 ( IDXGISwapChain4 *  iface,
UINT  buffer_count,
UINT  width,
UINT  height,
DXGI_FORMAT  format,
UINT  flags,
const UINT *  node_mask,
IUnknown *const *  present_queue 
)
static

Definition at line 2993 of file swapchain.c.

2996{
2997 struct d3d12_swapchain *swapchain = d3d12_swapchain_from_IDXGISwapChain4(iface);
2998 size_t i, count;
2999
3000 TRACE("iface %p, buffer_count %u, width %u, height %u, format %s, flags %#x, "
3001 "node_mask %p, present_queue %p.\n",
3002 iface, buffer_count, width, height, debug_dxgi_format(format), flags, node_mask, present_queue);
3003
3004 if (!node_mask || !present_queue)
3006
3008 for (i = 0; i < count; ++i)
3009 {
3010 if (node_mask[i] > 1 || !present_queue[i])
3012 if ((ID3D12CommandQueue*)present_queue[i] != swapchain->command_queue)
3013 FIXME("Ignoring present queue %p.\n", present_queue[i]);
3014 }
3015
3017}

◆ d3d12_swapchain_ResizeTarget()

static HRESULT STDMETHODCALLTYPE d3d12_swapchain_ResizeTarget ( IDXGISwapChain4 *  iface,
const DXGI_MODE_DESC *  target_mode_desc 
)
static

Definition at line 2656 of file swapchain.c.

2658{
2659 struct d3d12_swapchain *swapchain = d3d12_swapchain_from_IDXGISwapChain4(iface);
2660
2661 TRACE("iface %p, target_mode_desc %p.\n", iface, target_mode_desc);
2662
2663 return dxgi_swapchain_resize_target(swapchain->state, target_mode_desc);
2664}

◆ d3d12_swapchain_set_sync_interval()

static HRESULT d3d12_swapchain_set_sync_interval ( struct d3d12_swapchain *  swapchain,
unsigned int  sync_interval 
)
static

Definition at line 2164 of file swapchain.c.

2166{
2167 VkPresentModeKHR present_mode;
2168
2169 switch (sync_interval)
2170 {
2171 case 0:
2172 present_mode = VK_PRESENT_MODE_IMMEDIATE_KHR;
2173 break;
2174 default:
2175 FIXME("Unsupported sync interval %u.\n", sync_interval);
2176 case 1:
2177 present_mode = VK_PRESENT_MODE_FIFO_KHR;
2178 break;
2179 }
2180
2181 if (swapchain->present_mode == present_mode)
2182 return S_OK;
2183
2184 if (!d3d12_swapchain_is_present_mode_supported(swapchain, present_mode))
2185 {
2186 FIXME("Vulkan present mode %#x is not supported.\n", present_mode);
2187 return S_OK;
2188 }
2189
2191 swapchain->present_mode = present_mode;
2193}
static BOOL d3d12_swapchain_is_present_mode_supported(struct d3d12_swapchain *swapchain, VkPresentModeKHR present_mode)
Definition: swapchain.c:1412
@ VK_PRESENT_MODE_IMMEDIATE_KHR
Definition: vulkan.h:4418

Referenced by d3d12_swapchain_op_present_execute().

◆ d3d12_swapchain_SetBackgroundColor()

static HRESULT STDMETHODCALLTYPE d3d12_swapchain_SetBackgroundColor ( IDXGISwapChain4 *  iface,
const DXGI_RGBA *  color 
)
static

Definition at line 2827 of file swapchain.c.

2828{
2829 FIXME("iface %p, color %p stub!\n", iface, color);
2830
2831 return E_NOTIMPL;
2832}

◆ d3d12_swapchain_SetColorSpace1()

static HRESULT STDMETHODCALLTYPE d3d12_swapchain_SetColorSpace1 ( IDXGISwapChain4 *  iface,
DXGI_COLOR_SPACE_TYPE  colour_space 
)
static

Definition at line 2979 of file swapchain.c.

2981{
2982 FIXME("iface %p, colour_space %#x semi-stub!\n", iface, colour_space);
2983
2984 if (colour_space != DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709)
2985 {
2986 WARN("Colour space %u not supported.\n", colour_space);
2987 return E_INVALIDARG;
2988 }
2989
2990 return S_OK;
2991}

◆ d3d12_swapchain_SetFullscreenState()

static HRESULT STDMETHODCALLTYPE DECLSPEC_HOTPATCH d3d12_swapchain_SetFullscreenState ( IDXGISwapChain4 *  iface,
BOOL  fullscreen,
IDXGIOutput *  target 
)
static

Definition at line 2404 of file swapchain.c.

2406{
2407 struct d3d12_swapchain *swapchain = d3d12_swapchain_from_IDXGISwapChain4(iface);
2409 const DXGI_SWAP_CHAIN_DESC1 *swapchain_desc = &swapchain->desc;
2410 struct wined3d_swapchain_desc wined3d_desc;
2411 HWND window = swapchain->window;
2412 LONG in_set_fullscreen_state;
2413 BOOL old_fs;
2414 HRESULT hr;
2415
2416 TRACE("iface %p, fullscreen %#x, target %p.\n", iface, fullscreen, target);
2417
2418 if (!fullscreen && target)
2419 {
2420 WARN("Invalid call.\n");
2422 }
2423
2424 if (target)
2425 {
2426 IDXGIOutput_AddRef(target);
2427 }
2428 else if (FAILED(hr = IDXGISwapChain4_GetContainingOutput(iface, &target)))
2429 {
2430 WARN("Failed to get target output for swapchain, hr %#lx.\n", hr);
2431 return hr;
2432 }
2433
2434 if (FAILED(hr = wined3d_swapchain_desc_from_dxgi(&wined3d_desc, target, window, swapchain_desc,
2435 fullscreen_desc)))
2436 {
2437 IDXGIOutput_Release(target);
2438 return hr;
2439 }
2440
2441 in_set_fullscreen_state = InterlockedExchange(&swapchain->in_set_fullscreen_state, 1);
2442 if (in_set_fullscreen_state)
2443 {
2444 WARN("Nested invocation of SetFullscreenState.\n");
2445 IDXGIOutput_Release(target);
2446 IDXGISwapChain4_GetFullscreenState(iface, &old_fs, NULL);
2448 }
2449
2451 wined3d_desc.windowed = !fullscreen;
2452 hr = wined3d_swapchain_state_set_fullscreen(swapchain->state, &wined3d_desc, NULL);
2453 if (FAILED(hr))
2454 {
2455 IDXGIOutput_Release(target);
2457 goto done;
2458 }
2459
2460 fullscreen_desc->Windowed = wined3d_desc.windowed;
2461 if (!fullscreen)
2462 {
2463 IDXGIOutput_Release(target);
2464 target = NULL;
2465 }
2466
2467 if (swapchain->target)
2468 IDXGIOutput_Release(swapchain->target);
2469 swapchain->target = target;
2470
2471done:
2474 return hr;
2475}
LONG in_set_fullscreen_state
Definition: swapchain.c:1192

◆ d3d12_swapchain_SetHDRMetaData()

static HRESULT STDMETHODCALLTYPE d3d12_swapchain_SetHDRMetaData ( IDXGISwapChain4 *  iface,
DXGI_HDR_METADATA_TYPE  type,
UINT  size,
void *  metadata 
)
static

Definition at line 3021 of file swapchain.c.

3023{
3024 FIXME("iface %p, type %#x, size %#x, metadata %p stub!\n", iface, type, size, metadata);
3025
3026 return E_NOTIMPL;
3027}

◆ d3d12_swapchain_SetMatrixTransform()

static HRESULT STDMETHODCALLTYPE d3d12_swapchain_SetMatrixTransform ( IDXGISwapChain4 *  iface,
const DXGI_MATRIX_3X2_F *  matrix 
)
static

Definition at line 2932 of file swapchain.c.

2934{
2935 FIXME("iface %p, matrix %p stub!\n", iface, matrix);
2936
2937 return E_NOTIMPL;
2938}

◆ d3d12_swapchain_SetMaximumFrameLatency()

static HRESULT STDMETHODCALLTYPE d3d12_swapchain_SetMaximumFrameLatency ( IDXGISwapChain4 *  iface,
UINT  max_latency 
)
static

Definition at line 2871 of file swapchain.c.

2872{
2873 struct d3d12_swapchain *swapchain = d3d12_swapchain_from_IDXGISwapChain4(iface);
2874
2875 TRACE("iface %p, max_latency %u.\n", iface, max_latency);
2876
2878 {
2879 WARN("DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT not set for swap chain %p.\n", iface);
2881 }
2882
2883 if (!max_latency)
2884 {
2885 WARN("Invalid maximum frame latency %u.\n", max_latency);
2887 }
2888
2889 swapchain->frame_latency = max_latency;
2890 return S_OK;
2891}

◆ d3d12_swapchain_SetPrivateData()

static HRESULT STDMETHODCALLTYPE d3d12_swapchain_SetPrivateData ( IDXGISwapChain4 *  iface,
REFGUID  guid,
UINT  data_size,
const void *  data 
)
static

Definition at line 2112 of file swapchain.c.

2114{
2115 struct d3d12_swapchain *swapchain = d3d12_swapchain_from_IDXGISwapChain4(iface);
2116
2117 TRACE("iface %p, guid %s, data_size %u, data %p.\n", iface, debugstr_guid(guid), data_size, data);
2118
2119 return dxgi_set_private_data(&swapchain->private_store, guid, data_size, data);
2120}

◆ d3d12_swapchain_SetPrivateDataInterface()

static HRESULT STDMETHODCALLTYPE d3d12_swapchain_SetPrivateDataInterface ( IDXGISwapChain4 *  iface,
REFGUID  guid,
const IUnknown *  object 
)
static

Definition at line 2122 of file swapchain.c.

2124{
2125 struct d3d12_swapchain *swapchain = d3d12_swapchain_from_IDXGISwapChain4(iface);
2126
2127 TRACE("iface %p, guid %s, object %p.\n", iface, debugstr_guid(guid), object);
2128
2129 return dxgi_set_private_data_interface(&swapchain->private_store, guid, object);
2130}

◆ d3d12_swapchain_SetRotation()

static HRESULT STDMETHODCALLTYPE d3d12_swapchain_SetRotation ( IDXGISwapChain4 *  iface,
DXGI_MODE_ROTATION  rotation 
)
static

Definition at line 2841 of file swapchain.c.

2842{
2843 FIXME("iface %p, rotation %#x stub!\n", iface, rotation);
2844
2845 return E_NOTIMPL;
2846}

◆ d3d12_swapchain_SetSourceSize()

static HRESULT STDMETHODCALLTYPE d3d12_swapchain_SetSourceSize ( IDXGISwapChain4 *  iface,
UINT  width,
UINT  height 
)
static

Definition at line 2857 of file swapchain.c.

2858{
2859 FIXME("iface %p, width %u, height %u stub!\n", iface, width, height);
2860
2861 return E_NOTIMPL;
2862}

◆ d3d12_swapchain_windowed_state_changed()

static void CDECL d3d12_swapchain_windowed_state_changed ( struct wined3d_swapchain_state_parent *  parent,
BOOL  windowed 
)
static

Definition at line 3157 of file swapchain.c.

3159{
3161
3162 TRACE("parent %p, windowed %d.\n", parent, windowed);
3163
3164 if (windowed && swapchain->target)
3165 {
3166 IDXGIOutput_Release(swapchain->target);
3167 swapchain->target = NULL;
3168 }
3169}
static struct d3d12_swapchain * d3d12_swapchain_from_wined3d_swapchain_state_parent(struct wined3d_swapchain_state_parent *parent)
Definition: swapchain.c:3152

◆ d3d12_swapchain_worker_proc()

static DWORD WINAPI d3d12_swapchain_worker_proc ( void *  data)
static

Definition at line 1253 of file swapchain.c.

1254{
1255 struct d3d12_swapchain *swapchain = data;
1256
1257 EnterCriticalSection(&swapchain->worker_cs);
1258
1259 while (swapchain->worker_running)
1260 {
1261 if (!list_empty(&swapchain->worker_ops))
1262 {
1264
1265 list_remove(&op->entry);
1266
1267 LeaveCriticalSection(&swapchain->worker_cs);
1268
1269 switch (op->type)
1270 {
1273 break;
1274
1277 break;
1278 }
1279
1280 d3d12_swapchain_op_destroy(swapchain, op);
1281
1282 EnterCriticalSection(&swapchain->worker_cs);
1283 }
1284 else if (!SleepConditionVariableCS(&swapchain->worker_cv, &swapchain->worker_cs, INFINITE))
1285 {
1286 ERR("Cannot sleep on condition variable, last error %ld.\n", GetLastError());
1287 break;
1288 }
1289 }
1290
1291 LeaveCriticalSection(&swapchain->worker_cs);
1292
1293 return 0;
1294}
static void list_remove(struct list_entry *entry)
Definition: list.h:90
static int list_empty(struct list_entry *head)
Definition: list.h:58
BOOL WINAPI SleepConditionVariableCS(PCONDITION_VARIABLE ConditionVariable, PCRITICAL_SECTION CriticalSection, DWORD Timeout)
Definition: sync.c:59
static HRESULT d3d12_swapchain_op_resize_buffers_execute(struct d3d12_swapchain *swapchain, struct d3d12_swapchain_op *op)
Definition: swapchain.c:2552
static HRESULT d3d12_swapchain_op_present_execute(struct d3d12_swapchain *swapchain, struct d3d12_swapchain_op *op)
Definition: swapchain.c:2270
Definition: list.h:15
#define LIST_ENTRY(type)
Definition: queue.h:175

Referenced by d3d12_swapchain_init().

◆ dxgi_format_from_vk_format()

static DXGI_FORMAT dxgi_format_from_vk_format ( VkFormat  vk_format)
static

Definition at line 1296 of file swapchain.c.

1297{
1298 switch (vk_format)
1299 {
1304 default:
1305 WARN("Unhandled format %#x.\n", vk_format);
1306 return DXGI_FORMAT_UNKNOWN;
1307 }
1308}
@ DXGI_FORMAT_B8G8R8A8_UNORM
Definition: dxgiformat.idl:110
@ DXGI_FORMAT_R10G10B10A2_UNORM
Definition: dxgiformat.idl:47
@ DXGI_FORMAT_R16G16B16A16_FLOAT
Definition: dxgiformat.idl:33
@ DXGI_FORMAT_R8G8B8A8_UNORM
Definition: dxgiformat.idl:51
@ VK_FORMAT_B8G8R8A8_UNORM
Definition: vulkan.h:2860
@ VK_FORMAT_A2B10G10R10_UNORM_PACK32
Definition: vulkan.h:2880
@ VK_FORMAT_R8G8B8A8_UNORM
Definition: vulkan.h:2853
@ VK_FORMAT_R16G16B16A16_SFLOAT
Definition: vulkan.h:2913

Referenced by d3d12_swapchain_create_image_resources().

◆ dxgi_get_output_from_window()

HRESULT dxgi_get_output_from_window ( IWineDXGIFactory *  factory,
HWND  window,
IDXGIOutput **  dxgi_output 
)

Definition at line 103 of file swapchain.c.

104{
105 unsigned int adapter_idx, output_idx;
108 IDXGIOutput *output;
109 HMONITOR monitor;
110 HRESULT hr;
111
112 if (!(monitor = MonitorFromWindow(window, MONITOR_DEFAULTTONEAREST)))
113 {
114 WARN("Failed to get monitor from window.\n");
116 }
117
118 for (adapter_idx = 0; SUCCEEDED(hr = IWineDXGIFactory_EnumAdapters(factory, adapter_idx, &adapter));
119 ++adapter_idx)
120 {
121 for (output_idx = 0; SUCCEEDED(hr = IDXGIAdapter_EnumOutputs(adapter, output_idx,
122 &output)); ++output_idx)
123 {
124 if (FAILED(hr = IDXGIOutput_GetDesc(output, &desc)))
125 {
126 WARN("Adapter %u output %u: Failed to get output desc, hr %#lx.\n", adapter_idx,
127 output_idx, hr);
128 IDXGIOutput_Release(output);
129 continue;
130 }
131
132 if (desc.Monitor == monitor)
133 {
134 *dxgi_output = output;
135 IDXGIAdapter_Release(adapter);
136 return S_OK;
137 }
138
139 IDXGIOutput_Release(output);
140 }
141 IDXGIAdapter_Release(adapter);
142 }
143
145 WARN("Failed to enumerate outputs, hr %#lx.\n", hr);
146
147 WARN("Output could not be found.\n");
149}
HMONITOR WINAPI MonitorFromWindow(HWND, DWORD)
#define DXGI_ERROR_NOT_FOUND
Definition: winerror.h:7122

Referenced by d3d11_swapchain_GetContainingOutput(), d3d12_swapchain_GetContainingOutput(), d3d12_swapchain_init(), dxgi_device_init(), and dxgi_swapchain_factory_create_swapchain().

◆ dxgi_swap_effect_from_wined3d()

static DXGI_SWAP_EFFECT dxgi_swap_effect_from_wined3d ( enum wined3d_swap_effect  swap_effect)
static

Definition at line 30 of file swapchain.c.

31{
32 switch (swap_effect)
33 {
42 default:
43 FIXME("Invalid swap effect %#x.\n", swap_effect);
45 }
46}
@ DXGI_SWAP_EFFECT_SEQUENTIAL
Definition: dxgi.idl:66
@ DXGI_SWAP_EFFECT_DISCARD
Definition: dxgi.idl:65
@ WINED3D_SWAP_EFFECT_FLIP_DISCARD
Definition: wined3d.h:536
@ WINED3D_SWAP_EFFECT_SEQUENTIAL
Definition: wined3d.h:535
@ WINED3D_SWAP_EFFECT_DISCARD
Definition: wined3d.h:534
@ WINED3D_SWAP_EFFECT_FLIP_SEQUENTIAL
Definition: wined3d.h:537

Referenced by d3d11_swapchain_GetDesc(), and d3d11_swapchain_GetDesc1().

◆ dxgi_swapchain_resize_target()

static HRESULT dxgi_swapchain_resize_target ( struct wined3d_swapchain_state *  state,
const DXGI_MODE_DESC *  target_mode_desc 
)
static

Definition at line 151 of file swapchain.c.

153{
155
156 if (!target_mode_desc)
157 {
158 WARN("Invalid pointer.\n");
160 }
161
162 TRACE("Mode: %s.\n", debug_dxgi_mode(target_mode_desc));
163
164 if (target_mode_desc->Scaling)
165 FIXME("Ignoring scaling %#x.\n", target_mode_desc->Scaling);
166
167 wined3d_display_mode_from_dxgi(&mode, target_mode_desc);
168
170}
void wined3d_display_mode_from_dxgi(struct wined3d_display_mode *wined3d_mode, const DXGI_MODE_DESC *mode)
Definition: utils.c:469
const char * debug_dxgi_mode(const DXGI_MODE_DESC *desc)
Definition: utils.c:388
GLenum mode
Definition: glext.h:6217
DXGI_MODE_SCALING Scaling
Definition: dxgitype.idl:70
HRESULT CDECL wined3d_swapchain_state_resize_target(struct wined3d_swapchain_state *state, const struct wined3d_display_mode *mode)
Definition: swapchain.c:2065

Referenced by d3d11_swapchain_ResizeTarget(), and d3d12_swapchain_ResizeTarget().

◆ dxgi_validate_flip_swap_effect_format()

static BOOL dxgi_validate_flip_swap_effect_format ( DXGI_FORMAT  format)
static

Definition at line 48 of file swapchain.c.

49{
50 switch (format)
51 {
56 return TRUE;
57 default:
58 WARN("Invalid swapchain format %#x for flip presentation model.\n", format);
59 return FALSE;
60 }
61}

Referenced by dxgi_validate_swapchain_desc().

◆ dxgi_validate_swapchain_desc()

BOOL dxgi_validate_swapchain_desc ( const DXGI_SWAP_CHAIN_DESC1 *  desc)

Definition at line 63 of file swapchain.c.

64{
65 unsigned int min_buffer_count;
66
67 switch (desc->SwapEffect)
68 {
71 min_buffer_count = 1;
72 break;
73
76 min_buffer_count = 2;
77
78 if (desc->Format && !dxgi_validate_flip_swap_effect_format(desc->Format))
79 return FALSE;
80
81 if (desc->SampleDesc.Count != 1 || desc->SampleDesc.Quality)
82 {
83 WARN("Invalid sample desc %u, %u for swap effect %#x.\n",
84 desc->SampleDesc.Count, desc->SampleDesc.Quality, desc->SwapEffect);
85 return FALSE;
86 }
87 break;
88
89 default:
90 WARN("Invalid swap effect %u used.\n", desc->SwapEffect);
91 return FALSE;
92 }
93
94 if (desc->BufferCount < min_buffer_count || desc->BufferCount > DXGI_MAX_SWAP_CHAIN_BUFFERS)
95 {
96 WARN("BufferCount is %u.\n", desc->BufferCount);
97 return FALSE;
98 }
99
100 return TRUE;
101}
static BOOL dxgi_validate_flip_swap_effect_format(DXGI_FORMAT format)
Definition: swapchain.c:48

Referenced by d3d12_swapchain_resize_buffers(), and dxgi_factory_CreateSwapChainForHwnd().

◆ get_swapchain_fallback_format()

static VkFormat get_swapchain_fallback_format ( VkFormat  vk_format)
static

Definition at line 1310 of file swapchain.c.

1311{
1312 switch (vk_format)
1313 {
1318 default:
1319 WARN("Unhandled format %#x.\n", vk_format);
1320 return VK_FORMAT_UNDEFINED;
1321 }
1322}
@ VK_FORMAT_UNDEFINED
Definition: vulkan.h:2816

Referenced by select_vk_format(), and wined3d_swapchain_vk_select_vk_format().

◆ hresult_from_vk_result()

static HRESULT hresult_from_vk_result ( VkResult  vr)
static

Definition at line 1114 of file swapchain.c.

1115{
1116 switch (vr)
1117 {
1118 case VK_SUCCESS:
1119 return S_OK;
1122 return E_OUTOFMEMORY;
1123 default:
1124 FIXME("Unhandled VkResult %d.\n", vr);
1125 return E_FAIL;
1126 }
1127}
@ VK_ERROR_OUT_OF_HOST_MEMORY
Definition: vulkan.h:4671
@ VK_ERROR_OUT_OF_DEVICE_MEMORY
Definition: vulkan.h:4670

Referenced by create_shader_stage(), d3d12_command_allocator_allocate_command_buffer(), d3d12_command_allocator_init(), d3d12_command_allocator_Reset(), d3d12_command_list_begin_command_buffer(), d3d12_command_list_Close(), d3d12_command_queue_signal(), d3d12_command_queue_wait_binary_semaphore_locked(), d3d12_command_queue_wait_locked(), d3d12_descriptor_heap_create_descriptor_pool(), d3d12_descriptor_heap_create_descriptor_set(), d3d12_device_check_multisample_quality_levels(), d3d12_fence_init(), d3d12_heap_init(), d3d12_query_heap_create(), d3d12_swapchain_create_command_buffers(), d3d12_swapchain_create_user_buffers(), d3d12_swapchain_create_vulkan_swapchain(), d3d12_swapchain_init(), d3d12_swapchain_op_present_execute(), select_vk_format(), vkd3d_allocate_buffer_memory(), vkd3d_allocate_device_memory(), vkd3d_allocate_image_memory(), vkd3d_bind_heap_memory(), vkd3d_check_device_extensions(), vkd3d_create_buffer(), vkd3d_create_compute_pipeline(), vkd3d_create_descriptor_set_layout(), vkd3d_create_image(), vkd3d_create_pipeline_layout(), vkd3d_create_static_sampler(), vkd3d_create_vk_descriptor_heap_layout(), vkd3d_create_vk_device(), vkd3d_init_instance_caps(), vkd3d_init_null_resources_data(), vkd3d_instance_init(), vkd3d_render_pass_cache_create_pass_locked(), vkd3d_select_physical_device(), and vkd3d_uav_clear_state_init().

◆ init_vk_funcs()

static BOOL init_vk_funcs ( struct dxgi_vk_funcs *  dxgi,
VkInstance  vk_instance,
VkDevice  vk_device 
)
static

Definition at line 3082 of file swapchain.c.

3083{
3086
3087 dxgi->vulkan_module = LoadLibraryA("vulkan-1.dll");
3088 if (!(vkGetInstanceProcAddr = (void *)GetProcAddress(dxgi->vulkan_module, "vkGetInstanceProcAddr")))
3089 {
3090 ERR_(winediag)("Failed to load Vulkan.\n");
3091 return FALSE;
3092 }
3093
3094 vkGetDeviceProcAddr = (void *)vkGetInstanceProcAddr(vk_instance, "vkGetDeviceProcAddr");
3095
3096#define LOAD_INSTANCE_PFN(name) \
3097 if (!(dxgi->p_##name = (void *)vkGetInstanceProcAddr(vk_instance, #name))) \
3098 { \
3099 ERR("Failed to get instance proc "#name".\n"); \
3100 FreeLibrary(dxgi->vulkan_module); \
3101 return FALSE; \
3102 }
3111#undef LOAD_INSTANCE_PFN
3112
3113#define LOAD_DEVICE_PFN(name) \
3114 if (!(dxgi->p_##name = (void *)vkGetDeviceProcAddr(vk_device, #name))) \
3115 { \
3116 ERR("Failed to get device proc "#name".\n"); \
3117 FreeLibrary(dxgi->vulkan_module); \
3118 return FALSE; \
3119 }
3147#undef LOAD_DEVICE_PFN
3148
3149 return TRUE;
3150}
#define GetProcAddress(x, y)
Definition: compat.h:753
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
#define LOAD_DEVICE_PFN(name)
#define LOAD_INSTANCE_PFN(name)
#define ERR_(ch,...)
Definition: debug.h:156
void VKAPI_CALL vkGetPhysicalDeviceMemoryProperties(VkPhysicalDevice physicalDevice, VkPhysicalDeviceMemoryProperties *pMemoryProperties)
VkResult VKAPI_CALL vkBindImageMemory(VkDevice device, VkImage image, VkDeviceMemory memory, VkDeviceSize memoryOffset)
VkResult VKAPI_CALL vkCreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSwapchainKHR *pSwapchain)
void VKAPI_CALL vkDestroySemaphore(VkDevice device, VkSemaphore semaphore, const VkAllocationCallbacks *pAllocator)
VkResult VKAPI_CALL vkQueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo *pSubmits, VkFence fence)
VkResult VKAPI_CALL vkQueueWaitIdle(VkQueue queue)
VkResult VKAPI_CALL vkGetPhysicalDeviceSurfacePresentModesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t *pPresentModeCount, VkPresentModeKHR *pPresentModes)
VkResult VKAPI_CALL vkAcquireNextImageKHR(VkDevice device, VkSwapchainKHR swapchain, uint64_t timeout, VkSemaphore semaphore, VkFence fence, uint32_t *pImageIndex)
void VKAPI_CALL vkCmdBlitImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageBlit *pRegions, VkFilter filter)
void VKAPI_CALL vkDestroySwapchainKHR(VkDevice device, VkSwapchainKHR swapchain, const VkAllocationCallbacks *pAllocator)
VkResult VKAPI_CALL vkBeginCommandBuffer(VkCommandBuffer commandBuffer, const VkCommandBufferBeginInfo *pBeginInfo)
VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, VkSurfaceCapabilitiesKHR *pSurfaceCapabilities)
PFN_vkVoidFunction(VKAPI_PTR * PFN_vkGetInstanceProcAddr)(VkInstance, const char *)
Definition: vulkan.h:18143
VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceSupportKHR(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, VkSurfaceKHR surface, VkBool32 *pSupported)
void VKAPI_CALL vkFreeMemory(VkDevice device, VkDeviceMemory memory, const VkAllocationCallbacks *pAllocator)
PFN_vkVoidFunction(VKAPI_PTR * PFN_vkGetDeviceProcAddr)(VkDevice, const char *)
Definition: vulkan.h:18117
void VKAPI_CALL vkDestroyCommandPool(VkDevice device, VkCommandPool commandPool, const VkAllocationCallbacks *pAllocator)
void VKAPI_CALL vkDestroyFence(VkDevice device, VkFence fence, const VkAllocationCallbacks *pAllocator)
void VKAPI_CALL vkGetImageMemoryRequirements(VkDevice device, VkImage image, VkMemoryRequirements *pMemoryRequirements)
VkResult VKAPI_CALL vkAllocateCommandBuffers(VkDevice device, const VkCommandBufferAllocateInfo *pAllocateInfo, VkCommandBuffer *pCommandBuffers)
VkResult VKAPI_CALL vkEndCommandBuffer(VkCommandBuffer commandBuffer)
VkResult VKAPI_CALL vkWaitForFences(VkDevice device, uint32_t fenceCount, const VkFence *pFences, VkBool32 waitAll, uint64_t timeout)
VkResult VKAPI_CALL vkAllocateMemory(VkDevice device, const VkMemoryAllocateInfo *pAllocateInfo, const VkAllocationCallbacks *pAllocator, VkDeviceMemory *pMemory)
VkResult VKAPI_CALL vkResetCommandBuffer(VkCommandBuffer commandBuffer, VkCommandBufferResetFlags flags)
VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t *pSurfaceFormatCount, VkSurfaceFormatKHR *pSurfaceFormats)
VkResult VKAPI_CALL vkCreateSemaphore(VkDevice device, const VkSemaphoreCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSemaphore *pSemaphore)
VkResult VKAPI_CALL vkCreateWin32SurfaceKHR(VkInstance instance, const VkWin32SurfaceCreateInfoKHR *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface)
VkResult VKAPI_CALL vkQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR *pPresentInfo)
VkResult VKAPI_CALL vkResetFences(VkDevice device, uint32_t fenceCount, const VkFence *pFences)
VkResult VKAPI_CALL vkGetSwapchainImagesKHR(VkDevice device, VkSwapchainKHR swapchain, uint32_t *pSwapchainImageCount, VkImage *pSwapchainImages)
VkResult VKAPI_CALL vkCreateFence(VkDevice device, const VkFenceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkFence *pFence)
void VKAPI_CALL vkCmdPipelineBarrier(VkCommandBuffer commandBuffer, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, VkDependencyFlags dependencyFlags, uint32_t memoryBarrierCount, const VkMemoryBarrier *pMemoryBarriers, uint32_t bufferMemoryBarrierCount, const VkBufferMemoryBarrier *pBufferMemoryBarriers, uint32_t imageMemoryBarrierCount, const VkImageMemoryBarrier *pImageMemoryBarriers)
void VKAPI_CALL vkDestroySurfaceKHR(VkInstance instance, VkSurfaceKHR surface, const VkAllocationCallbacks *pAllocator)
VkResult VKAPI_CALL vkCreateCommandPool(VkDevice device, const VkCommandPoolCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkCommandPool *pCommandPool)
VkResult VKAPI_CALL vkCreateImage(VkDevice device, const VkImageCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkImage *pImage)
void VKAPI_CALL vkDestroyImage(VkDevice device, VkImage image, const VkAllocationCallbacks *pAllocator)
VkBool32 VKAPI_CALL vkGetPhysicalDeviceWin32PresentationSupportKHR(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex)

Referenced by d3d12_swapchain_init().

◆ select_vk_format()

static HRESULT select_vk_format ( const struct dxgi_vk_funcs *  vk_funcs,
VkPhysicalDevice  vk_physical_device,
VkSurfaceKHR  vk_surface,
const DXGI_SWAP_CHAIN_DESC1 *  swapchain_desc,
VkFormat *  vk_format 
)
static

Definition at line 1324 of file swapchain.c.

1327{
1329 uint32_t format_count;
1331 unsigned int i;
1332 VkResult vr;
1333
1334 *vk_format = VK_FORMAT_UNDEFINED;
1335
1336 format = vkd3d_get_vk_format(swapchain_desc->Format);
1337
1338 vr = vk_funcs->p_vkGetPhysicalDeviceSurfaceFormatsKHR(vk_physical_device, vk_surface, &format_count, NULL);
1339 if (vr < 0 || !format_count)
1340 {
1341 WARN("Failed to get supported surface formats, vr %d.\n", vr);
1343 }
1344
1345 if (!(formats = calloc(format_count, sizeof(*formats))))
1346 return E_OUTOFMEMORY;
1347
1348 if ((vr = vk_funcs->p_vkGetPhysicalDeviceSurfaceFormatsKHR(vk_physical_device,
1349 vk_surface, &format_count, formats)) < 0)
1350 {
1351 WARN("Failed to enumerate supported surface formats, vr %d.\n", vr);
1352 free(formats);
1353 return hresult_from_vk_result(vr);
1354 }
1355
1356 for (i = 0; i < format_count; ++i)
1357 {
1359 break;
1360 }
1361 if (i == format_count)
1362 {
1363 /* Try to create a swapchain with format conversion. */
1365 WARN("Failed to find Vulkan swapchain format for %s.\n", debug_dxgi_format(swapchain_desc->Format));
1366 for (i = 0; i < format_count; ++i)
1367 {
1369 {
1370 format = formats[i].format;
1371 break;
1372 }
1373 }
1374 }
1375 free(formats);
1376 if (i == format_count)
1377 {
1378 FIXME("Failed to find Vulkan swapchain format for %s.\n", debug_dxgi_format(swapchain_desc->Format));
1380 }
1381
1382 TRACE("Using Vulkan swapchain format %#x.\n", format);
1383
1384 *vk_format = format;
1385 return S_OK;
1386}
static const struct pixel_format_desc formats[]
Definition: util.c:31
static VkFormat get_swapchain_fallback_format(VkFormat vk_format)
Definition: swapchain.c:1310
PFN_vkGetPhysicalDeviceSurfaceFormatsKHR p_vkGetPhysicalDeviceSurfaceFormatsKHR
Definition: swapchain.c:1100

Referenced by d3d12_swapchain_create_vulkan_swapchain().

◆ vk_cmd_image_barrier()

static void vk_cmd_image_barrier ( const struct dxgi_vk_funcs *  vk_funcs,
VkCommandBuffer  cmd_buffer,
VkPipelineStageFlags  src_stage_mask,
VkPipelineStageFlags  dst_stage_mask,
VkAccessFlags  src_access_mask,
VkAccessFlags  dst_access_mask,
VkImageLayout  old_layout,
VkImageLayout  new_layout,
VkImage  image 
)
static

Definition at line 1551 of file swapchain.c.

1555{
1556 VkImageMemoryBarrier barrier;
1557
1559 barrier.pNext = NULL;
1560 barrier.srcAccessMask = src_access_mask;
1561 barrier.dstAccessMask = dst_access_mask;
1562 barrier.oldLayout = old_layout;
1563 barrier.newLayout = new_layout;
1566 barrier.image = image;
1568 barrier.subresourceRange.baseMipLevel = 0;
1570 barrier.subresourceRange.baseArrayLayer = 0;
1572
1573 vk_funcs->p_vkCmdPipelineBarrier(cmd_buffer,
1574 src_stage_mask, dst_stage_mask, 0, 0, NULL, 0, NULL, 1, &barrier);
1575}
VkAccessFlags dstAccessMask
Definition: vulkan.h:16393
uint32_t dstQueueFamilyIndex
Definition: vulkan.h:16397
VkAccessFlags srcAccessMask
Definition: vulkan.h:16392
VkStructureType sType
Definition: vulkan.h:16390
VkImageLayout newLayout
Definition: vulkan.h:16395
const void * pNext
Definition: vulkan.h:16391
VkImageSubresourceRange subresourceRange
Definition: vulkan.h:16399
VkImageLayout oldLayout
Definition: vulkan.h:16394
uint32_t srcQueueFamilyIndex
Definition: vulkan.h:16396
uint32_t baseArrayLayer
Definition: vulkan.h:9076
VkImageAspectFlags aspectMask
Definition: vulkan.h:9073
PFN_vkCmdPipelineBarrier p_vkCmdPipelineBarrier
Definition: swapchain.c:1080
Definition: image.c:84
#define VK_REMAINING_MIP_LEVELS
Definition: vulkan.h:50
#define VK_REMAINING_ARRAY_LAYERS
Definition: vulkan.h:51
#define VK_QUEUE_FAMILY_IGNORED
Definition: vulkan.h:57
@ VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER
Definition: vulkan.h:5009

Referenced by d3d12_swapchain_record_swapchain_blit().

◆ vk_select_memory_type()

static HRESULT vk_select_memory_type ( const struct dxgi_vk_funcs *  vk_funcs,
VkPhysicalDevice  vk_physical_device,
uint32_t  memory_type_mask,
VkMemoryPropertyFlags  flags,
uint32_t *  memory_type_index 
)
static

Definition at line 1388 of file swapchain.c.

1391{
1392 VkPhysicalDeviceMemoryProperties memory_properties;
1393 unsigned int i;
1394
1395 vk_funcs->p_vkGetPhysicalDeviceMemoryProperties(vk_physical_device, &memory_properties);
1396 for (i = 0; i < memory_properties.memoryTypeCount; ++i)
1397 {
1398 if (!(memory_type_mask & (1u << i)))
1399 continue;
1400
1401 if ((memory_properties.memoryTypes[i].propertyFlags & flags) == flags)
1402 {
1403 *memory_type_index = i;
1404 return S_OK;
1405 }
1406 }
1407
1408 FIXME("Failed to find memory type (allowed types %#x).\n", memory_type_mask);
1409 return E_FAIL;
1410}
VkMemoryPropertyFlags propertyFlags
Definition: vulkan.h:9474
VkMemoryType memoryTypes[VK_MAX_MEMORY_TYPES]
Definition: vulkan.h:11320
PFN_vkGetPhysicalDeviceMemoryProperties p_vkGetPhysicalDeviceMemoryProperties
Definition: swapchain.c:1098

Referenced by d3d12_swapchain_create_user_buffers().

◆ WINE_DECLARE_DEBUG_CHANNEL()

WINE_DECLARE_DEBUG_CHANNEL ( winediag  )

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( dxgi  )

Variable Documentation

◆ d3d11_swapchain_state_parent_ops

const struct wined3d_swapchain_state_parent_ops d3d11_swapchain_state_parent_ops
static
Initial value:
=
{
}
static void CDECL d3d11_swapchain_windowed_state_changed(struct wined3d_swapchain_state_parent *parent, BOOL windowed)
Definition: swapchain.c:937

Definition at line 951 of file swapchain.c.

Referenced by d3d11_swapchain_init().

◆ d3d11_swapchain_vtbl

const struct IDXGISwapChain4Vtbl d3d11_swapchain_vtbl
static

Definition at line 866 of file swapchain.c.

Referenced by d3d11_swapchain_init().

◆ d3d11_swapchain_wined3d_parent_ops

const struct wined3d_parent_ops d3d11_swapchain_wined3d_parent_ops
static
Initial value:
=
{
}
static void STDMETHODCALLTYPE d3d11_swapchain_wined3d_object_released(void *parent)
Definition: swapchain.c:919

Definition at line 927 of file swapchain.c.

Referenced by d3d11_swapchain_init().

◆ d3d12_swapchain_state_parent_ops

const struct wined3d_swapchain_state_parent_ops d3d12_swapchain_state_parent_ops
static
Initial value:
=
{
}
static void CDECL d3d12_swapchain_windowed_state_changed(struct wined3d_swapchain_state_parent *parent, BOOL windowed)
Definition: swapchain.c:3157

Definition at line 3171 of file swapchain.c.

Referenced by d3d12_swapchain_init().

◆ d3d12_swapchain_vtbl

const struct IDXGISwapChain4Vtbl d3d12_swapchain_vtbl
static

Definition at line 3029 of file swapchain.c.

Referenced by d3d12_swapchain_init().