ReactOS 0.4.17-dev-934-g091855f
device.c File Reference
#include "vkd3d_private.h"
#include "vkd3d_version.h"
Include dependency graph for device.c:

Go to the source code of this file.

Classes

struct  vkd3d_struct
 
struct  vkd3d_optional_extension_info
 
struct  vkd3d_physical_device_info
 
struct  vkd3d_device_queue_info
 
struct  d3d12_cache_session
 

Macros

#define VKD3D_MAX_UAV_CLEAR_DESCRIPTORS_PER_TYPE   256u
 
#define vkd3d_find_struct(c, t)   vkd3d_find_struct_(c, VKD3D_STRUCTURE_TYPE_##t)
 
#define VK_EXTENSION(name, member)    {VK_ ## name ## _EXTENSION_NAME, offsetof(struct vkd3d_vulkan_info, member)}
 
#define VK_DEBUG_EXTENSION(name, member)    {VK_ ## name ## _EXTENSION_NAME, offsetof(struct vkd3d_vulkan_info, member), true}
 
#define VK_KHR_PORTABILITY_SUBSET_EXTENSION_NAME   "VK_KHR_portability_subset"
 
#define VKD3D_DEFAULT_HOST_TICKS_PER_SECOND   10000000
 
#define CHECK_MIN_REQUIREMENT(name, value)
 
#define CHECK_MAX_REQUIREMENT(name, value)
 
#define CHECK_FEATURE(name)
 
#define VKD3D_VA_FALLBACK_BASE   0x8000000000000000ull
 
#define VKD3D_VA_SLAB_BASE   0x0000001000000000ull
 
#define VKD3D_VA_SLAB_SIZE_SHIFT   32
 
#define VKD3D_VA_SLAB_SIZE   (1ull << VKD3D_VA_SLAB_SIZE_SHIFT)
 
#define VKD3D_VA_SLAB_COUNT   (64 * 1024)
 

Enumerations

enum  vkd3d_queue_family { VKD3D_QUEUE_FAMILY_DIRECT , VKD3D_QUEUE_FAMILY_COMPUTE , VKD3D_QUEUE_FAMILY_TRANSFER , VKD3D_QUEUE_FAMILY_COUNT }
 

Functions

static const void * vkd3d_find_struct_ (const struct vkd3d_struct *chain, enum vkd3d_structure_type type)
 
static uint32_t vkd3d_get_vk_version (void)
 
static HRESULT vkd3d_create_vk_descriptor_heap_layout (struct d3d12_device *device, unsigned int index)
 
static void vkd3d_vk_descriptor_heap_layouts_cleanup (struct d3d12_device *device)
 
static HRESULT vkd3d_vk_descriptor_heap_layouts_init (struct d3d12_device *device)
 
static unsigned int get_spec_version (const VkExtensionProperties *extensions, unsigned int count, const char *extension_name)
 
static bool is_extension_disabled (const char *extension_name)
 
static bool has_extension (const VkExtensionProperties *extensions, unsigned int count, const char *extension_name)
 
static unsigned int vkd3d_check_extensions (const VkExtensionProperties *extensions, unsigned int count, const char *const *required_extensions, unsigned int required_extension_count, const struct vkd3d_optional_extension_info *optional_extensions, unsigned int optional_extension_count, const char *const *user_extensions, unsigned int user_extension_count, const char *const *optional_user_extensions, unsigned int optional_user_extension_count, bool *user_extension_supported, struct vkd3d_vulkan_info *vulkan_info, const char *extension_type, bool is_debug_enabled)
 
static unsigned int vkd3d_append_extension (const char *extensions[], unsigned int extension_count, const char *extension_name)
 
static unsigned int vkd3d_enable_extensions (const char *extensions[], const char *const *required_extensions, unsigned int required_extension_count, const struct vkd3d_optional_extension_info *optional_extensions, unsigned int optional_extension_count, const char *const *user_extensions, unsigned int user_extension_count, const char *const *optional_user_extensions, unsigned int optional_user_extension_count, bool *user_extension_supported, const struct vkd3d_vulkan_info *vulkan_info)
 
static HRESULT vkd3d_init_instance_caps (struct vkd3d_instance *instance, const struct vkd3d_instance_create_info *create_info, uint32_t *instance_extension_count, bool **user_extension_supported)
 
static HRESULT vkd3d_init_vk_global_procs (struct vkd3d_instance *instance, PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr)
 
static VkBool32 VKAPI_PTR vkd3d_debug_report_callback (VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT object_type, uint64_t object, size_t location, int32_t message_code, const char *layer_prefix, const char *message, void *user_data)
 
static void vkd3d_init_debug_report (struct vkd3d_instance *instance)
 
static uint64_t vkd3d_init_config_flags (void)
 
static HRESULT vkd3d_instance_init (struct vkd3d_instance *instance, const struct vkd3d_instance_create_info *create_info)
 
HRESULT vkd3d_create_instance (const struct vkd3d_instance_create_info *create_info, struct vkd3d_instance **instance)
 
static void vkd3d_destroy_instance (struct vkd3d_instance *instance)
 
ULONG vkd3d_instance_incref (struct vkd3d_instance *instance)
 
ULONG vkd3d_instance_decref (struct vkd3d_instance *instance)
 
VkInstance vkd3d_instance_get_vk_instance (struct vkd3d_instance *instance)
 
static bool d3d12_device_environment_is_vulkan_min_1_1 (struct d3d12_device *device)
 
static void vkd3d_chain_physical_device_info_structures (struct vkd3d_physical_device_info *info, struct d3d12_device *device)
 
static void vkd3d_physical_device_info_init (struct vkd3d_physical_device_info *info, struct d3d12_device *device)
 
static void vkd3d_trace_physical_device_properties (const VkPhysicalDeviceProperties *properties)
 
static void vkd3d_trace_physical_device (VkPhysicalDevice device, const struct vkd3d_physical_device_info *info, const struct vkd3d_vk_instance_procs *vk_procs)
 
static void vkd3d_trace_physical_device_limits (const struct vkd3d_physical_device_info *info)
 
static void vkd3d_trace_physical_device_features (const struct vkd3d_physical_device_info *info)
 
static void vkd3d_init_feature_level (struct vkd3d_vulkan_info *vk_info, const VkPhysicalDeviceFeatures *features, const D3D12_FEATURE_DATA_D3D12_OPTIONS *d3d12_options)
 
static void vkd3d_device_descriptor_limits_init (struct vkd3d_device_descriptor_limits *limits, const VkPhysicalDeviceLimits *device_limits)
 
static void vkd3d_device_vk_heaps_descriptor_limits_init (struct vkd3d_device_descriptor_limits *limits, const VkPhysicalDeviceDescriptorIndexingPropertiesEXT *properties)
 
static bool d3d12_device_supports_typed_uav_load_additional_formats (const struct d3d12_device *device)
 
static HRESULT vkd3d_check_device_extensions (struct d3d12_device *device, const struct vkd3d_device_create_info *create_info, VkExtensionProperties **vk_extensions, uint32_t *vk_extension_count, uint32_t *device_extension_count, bool **user_extension_supported)
 
static void vkd3d_override_caps (struct d3d12_device *device)
 
static HRESULT vkd3d_init_device_caps (struct d3d12_device *device, const struct vkd3d_device_create_info *create_info, struct vkd3d_physical_device_info *physical_device_info, uint32_t *device_extension_count, bool **user_extension_supported)
 
static HRESULT vkd3d_select_physical_device (struct vkd3d_instance *instance, unsigned int device_index, VkPhysicalDevice *selected_device)
 
static void d3d12_device_destroy_vkd3d_queues (struct d3d12_device *device)
 
static HRESULT d3d12_device_create_vkd3d_queues (struct d3d12_device *device, const struct vkd3d_device_queue_info *queue_info)
 
static HRESULT vkd3d_select_queues (const struct vkd3d_instance *vkd3d_instance, VkPhysicalDevice physical_device, struct vkd3d_device_queue_info *info)
 
static bool d3d12_is_64k_msaa_supported (struct d3d12_device *device)
 
static HRESULT vkd3d_create_vk_device (struct d3d12_device *device, const struct vkd3d_device_create_info *create_info)
 
static HRESULT d3d12_device_init_pipeline_cache (struct d3d12_device *device)
 
static void d3d12_device_destroy_pipeline_cache (struct d3d12_device *device)
 
static D3D12_GPU_VIRTUAL_ADDRESS vkd3d_gpu_va_allocator_allocate_slab (struct vkd3d_gpu_va_allocator *allocator, uint64_t aligned_size, void *ptr)
 
static D3D12_GPU_VIRTUAL_ADDRESS vkd3d_gpu_va_allocator_allocate_fallback (struct vkd3d_gpu_va_allocator *allocator, size_t alignment, uint64_t aligned_size, void *ptr)
 
D3D12_GPU_VIRTUAL_ADDRESS vkd3d_gpu_va_allocator_allocate (struct vkd3d_gpu_va_allocator *allocator, size_t alignment, uint64_t size, void *ptr)
 
static void * vkd3d_gpu_va_allocator_dereference_slab (struct vkd3d_gpu_va_allocator *allocator, D3D12_GPU_VIRTUAL_ADDRESS address)
 
static int vkd3d_gpu_va_allocation_compare (const void *k, const void *e)
 
static void * vkd3d_gpu_va_allocator_dereference_fallback (struct vkd3d_gpu_va_allocator *allocator, D3D12_GPU_VIRTUAL_ADDRESS address)
 
void * vkd3d_gpu_va_allocator_dereference (struct vkd3d_gpu_va_allocator *allocator, D3D12_GPU_VIRTUAL_ADDRESS address)
 
static void vkd3d_gpu_va_allocator_free_slab (struct vkd3d_gpu_va_allocator *allocator, D3D12_GPU_VIRTUAL_ADDRESS address)
 
static void vkd3d_gpu_va_allocator_free_fallback (struct vkd3d_gpu_va_allocator *allocator, D3D12_GPU_VIRTUAL_ADDRESS address)
 
void vkd3d_gpu_va_allocator_free (struct vkd3d_gpu_va_allocator *allocator, D3D12_GPU_VIRTUAL_ADDRESS address)
 
static bool vkd3d_gpu_va_allocator_init (struct vkd3d_gpu_va_allocator *allocator)
 
static void vkd3d_gpu_va_allocator_cleanup (struct vkd3d_gpu_va_allocator *allocator)
 
static bool have_vk_time_domain (VkTimeDomainEXT *domains, unsigned int count, VkTimeDomainEXT domain)
 
static void vkd3d_time_domains_init (struct d3d12_device *device)
 
static void device_init_descriptor_pool_sizes (struct d3d12_device *device)
 
static void vkd3d_desc_object_cache_init (struct vkd3d_desc_object_cache *cache, size_t size)
 
static void vkd3d_desc_object_cache_cleanup (struct vkd3d_desc_object_cache *cache)
 
static struct d3d12_cache_session * impl_from_ID3D12ShaderCacheSession (ID3D12ShaderCacheSession *iface)
 
static HRESULT STDMETHODCALLTYPE d3d12_cache_session_QueryInterface (ID3D12ShaderCacheSession *iface, REFIID iid, void **object)
 
static ULONG STDMETHODCALLTYPE d3d12_cache_session_AddRef (ID3D12ShaderCacheSession *iface)
 
static void d3d12_cache_session_destroy (struct d3d12_cache_session *session)
 
static ULONG STDMETHODCALLTYPE d3d12_cache_session_Release (ID3D12ShaderCacheSession *iface)
 
static HRESULT STDMETHODCALLTYPE d3d12_cache_session_GetPrivateData (ID3D12ShaderCacheSession *iface, REFGUID guid, UINT *data_size, void *data)
 
static HRESULT STDMETHODCALLTYPE d3d12_cache_session_SetPrivateData (ID3D12ShaderCacheSession *iface, REFGUID guid, UINT data_size, const void *data)
 
static HRESULT STDMETHODCALLTYPE d3d12_cache_session_SetPrivateDataInterface (ID3D12ShaderCacheSession *iface, REFGUID guid, const IUnknown *data)
 
static HRESULT STDMETHODCALLTYPE d3d12_cache_session_SetName (ID3D12ShaderCacheSession *iface, const WCHAR *name)
 
static HRESULT STDMETHODCALLTYPE d3d12_cache_session_GetDevice (ID3D12ShaderCacheSession *iface, REFIID iid, void **device)
 
static HRESULT STDMETHODCALLTYPE d3d12_cache_session_FindValue (ID3D12ShaderCacheSession *iface, const void *key, UINT key_size, void *value, UINT *value_size)
 
static HRESULT STDMETHODCALLTYPE d3d12_cache_session_StoreValue (ID3D12ShaderCacheSession *iface, const void *key, UINT key_size, const void *value, UINT value_size)
 
static void STDMETHODCALLTYPE d3d12_cache_session_SetDeleteOnDestroy (ID3D12ShaderCacheSession *iface)
 
static D3D12_SHADER_CACHE_SESSION_DESC *STDMETHODCALLTYPE d3d12_cache_session_GetDesc (ID3D12ShaderCacheSession *iface, D3D12_SHADER_CACHE_SESSION_DESC *desc)
 
static HRESULT d3d12_cache_session_init (struct d3d12_cache_session *session, struct d3d12_device *device, const D3D12_SHADER_CACHE_SESSION_DESC *desc)
 
static struct d3d12_device * impl_from_ID3D12Device9 (ID3D12Device9 *iface)
 
static HRESULT STDMETHODCALLTYPE d3d12_device_QueryInterface (ID3D12Device9 *iface, REFIID riid, void **object)
 
static ULONG STDMETHODCALLTYPE d3d12_device_AddRef (ID3D12Device9 *iface)
 
static HRESULT device_worker_stop (struct d3d12_device *device)
 
static ULONG STDMETHODCALLTYPE d3d12_device_Release (ID3D12Device9 *iface)
 
static HRESULT STDMETHODCALLTYPE d3d12_device_GetPrivateData (ID3D12Device9 *iface, REFGUID guid, UINT *data_size, void *data)
 
static HRESULT STDMETHODCALLTYPE d3d12_device_SetPrivateData (ID3D12Device9 *iface, REFGUID guid, UINT data_size, const void *data)
 
static HRESULT STDMETHODCALLTYPE d3d12_device_SetPrivateDataInterface (ID3D12Device9 *iface, REFGUID guid, const IUnknown *data)
 
static HRESULT STDMETHODCALLTYPE d3d12_device_SetName (ID3D12Device9 *iface, const WCHAR *name)
 
static UINT STDMETHODCALLTYPE d3d12_device_GetNodeCount (ID3D12Device9 *iface)
 
static HRESULT STDMETHODCALLTYPE d3d12_device_CreateCommandQueue (ID3D12Device9 *iface, const D3D12_COMMAND_QUEUE_DESC *desc, REFIID riid, void **command_queue)
 
static HRESULT STDMETHODCALLTYPE d3d12_device_CreateCommandAllocator (ID3D12Device9 *iface, D3D12_COMMAND_LIST_TYPE type, REFIID riid, void **command_allocator)
 
static HRESULT STDMETHODCALLTYPE d3d12_device_CreateGraphicsPipelineState (ID3D12Device9 *iface, const D3D12_GRAPHICS_PIPELINE_STATE_DESC *desc, REFIID riid, void **pipeline_state)
 
static HRESULT STDMETHODCALLTYPE d3d12_device_CreateComputePipelineState (ID3D12Device9 *iface, const D3D12_COMPUTE_PIPELINE_STATE_DESC *desc, REFIID riid, void **pipeline_state)
 
static HRESULT STDMETHODCALLTYPE d3d12_device_CreateCommandList (ID3D12Device9 *iface, UINT node_mask, D3D12_COMMAND_LIST_TYPE type, ID3D12CommandAllocator *command_allocator, ID3D12PipelineState *initial_pipeline_state, REFIID riid, void **command_list)
 
static void vkd3d_restrict_format_support_for_feature_level (D3D12_FEATURE_DATA_FORMAT_SUPPORT *format_support)
 
static HRESULT d3d12_device_check_multisample_quality_levels (struct d3d12_device *device, D3D12_FEATURE_DATA_MULTISAMPLE_QUALITY_LEVELS *data)
 
bool d3d12_device_is_uma (struct d3d12_device *device, bool *coherent)
 
static HRESULT STDMETHODCALLTYPE d3d12_device_CheckFeatureSupport (ID3D12Device9 *iface, D3D12_FEATURE feature, void *feature_data, UINT feature_data_size)
 
static HRESULT STDMETHODCALLTYPE d3d12_device_CreateDescriptorHeap (ID3D12Device9 *iface, const D3D12_DESCRIPTOR_HEAP_DESC *desc, REFIID riid, void **descriptor_heap)
 
static UINT STDMETHODCALLTYPE d3d12_device_GetDescriptorHandleIncrementSize (ID3D12Device9 *iface, D3D12_DESCRIPTOR_HEAP_TYPE descriptor_heap_type)
 
static HRESULT STDMETHODCALLTYPE d3d12_device_CreateRootSignature (ID3D12Device9 *iface, UINT node_mask, const void *bytecode, SIZE_T bytecode_length, REFIID riid, void **root_signature)
 
static void STDMETHODCALLTYPE d3d12_device_CreateConstantBufferView (ID3D12Device9 *iface, const D3D12_CONSTANT_BUFFER_VIEW_DESC *desc, D3D12_CPU_DESCRIPTOR_HANDLE descriptor)
 
static void STDMETHODCALLTYPE d3d12_device_CreateShaderResourceView (ID3D12Device9 *iface, ID3D12Resource *resource, const D3D12_SHADER_RESOURCE_VIEW_DESC *desc, D3D12_CPU_DESCRIPTOR_HANDLE descriptor)
 
static void STDMETHODCALLTYPE d3d12_device_CreateUnorderedAccessView (ID3D12Device9 *iface, ID3D12Resource *resource, ID3D12Resource *counter_resource, const D3D12_UNORDERED_ACCESS_VIEW_DESC *desc, D3D12_CPU_DESCRIPTOR_HANDLE descriptor)
 
static void STDMETHODCALLTYPE d3d12_device_CreateRenderTargetView (ID3D12Device9 *iface, ID3D12Resource *resource, const D3D12_RENDER_TARGET_VIEW_DESC *desc, D3D12_CPU_DESCRIPTOR_HANDLE descriptor)
 
static void STDMETHODCALLTYPE d3d12_device_CreateDepthStencilView (ID3D12Device9 *iface, ID3D12Resource *resource, const D3D12_DEPTH_STENCIL_VIEW_DESC *desc, D3D12_CPU_DESCRIPTOR_HANDLE descriptor)
 
static void STDMETHODCALLTYPE d3d12_device_CreateSampler (ID3D12Device9 *iface, const D3D12_SAMPLER_DESC *desc, D3D12_CPU_DESCRIPTOR_HANDLE descriptor)
 
static void STDMETHODCALLTYPE d3d12_device_CopyDescriptors (ID3D12Device9 *iface, UINT dst_descriptor_range_count, const D3D12_CPU_DESCRIPTOR_HANDLE *dst_descriptor_range_offsets, const UINT *dst_descriptor_range_sizes, UINT src_descriptor_range_count, const D3D12_CPU_DESCRIPTOR_HANDLE *src_descriptor_range_offsets, const UINT *src_descriptor_range_sizes, D3D12_DESCRIPTOR_HEAP_TYPE descriptor_heap_type)
 
static void STDMETHODCALLTYPE d3d12_device_CopyDescriptorsSimple (ID3D12Device9 *iface, UINT descriptor_count, const D3D12_CPU_DESCRIPTOR_HANDLE dst_descriptor_range_offset, const D3D12_CPU_DESCRIPTOR_HANDLE src_descriptor_range_offset, D3D12_DESCRIPTOR_HEAP_TYPE descriptor_heap_type)
 
static void d3d12_resource_allocation_info1_from_vkd3d (D3D12_RESOURCE_ALLOCATION_INFO1 *result, const struct vkd3d_resource_allocation_info *info)
 
static void d3d12_device_get_resource1_allocation_info (struct d3d12_device *device, D3D12_RESOURCE_ALLOCATION_INFO1 *infos1, unsigned int count, const D3D12_RESOURCE_DESC1 *resource_descs, D3D12_RESOURCE_ALLOCATION_INFO *result)
 
static void d3d12_device_get_resource_allocation_info (struct d3d12_device *device, D3D12_RESOURCE_ALLOCATION_INFO1 *infos1, unsigned int count, const D3D12_RESOURCE_DESC *resource_descs, D3D12_RESOURCE_ALLOCATION_INFO *result)
 
static D3D12_RESOURCE_ALLOCATION_INFO *STDMETHODCALLTYPE d3d12_device_GetResourceAllocationInfo (ID3D12Device9 *iface, D3D12_RESOURCE_ALLOCATION_INFO *info, UINT visible_mask, UINT count, const D3D12_RESOURCE_DESC *resource_descs)
 
static D3D12_HEAP_PROPERTIES *STDMETHODCALLTYPE d3d12_device_GetCustomHeapProperties (ID3D12Device9 *iface, D3D12_HEAP_PROPERTIES *heap_properties, UINT node_mask, D3D12_HEAP_TYPE heap_type)
 
static HRESULT STDMETHODCALLTYPE d3d12_device_CreateCommittedResource (ID3D12Device9 *iface, const D3D12_HEAP_PROPERTIES *heap_properties, D3D12_HEAP_FLAGS heap_flags, const D3D12_RESOURCE_DESC *desc, D3D12_RESOURCE_STATES initial_state, const D3D12_CLEAR_VALUE *optimized_clear_value, REFIID iid, void **resource)
 
static HRESULT STDMETHODCALLTYPE d3d12_device_CreateHeap (ID3D12Device9 *iface, const D3D12_HEAP_DESC *desc, REFIID iid, void **heap)
 
static HRESULT STDMETHODCALLTYPE d3d12_device_CreatePlacedResource (ID3D12Device9 *iface, ID3D12Heap *heap, UINT64 heap_offset, const D3D12_RESOURCE_DESC *desc, D3D12_RESOURCE_STATES initial_state, const D3D12_CLEAR_VALUE *optimized_clear_value, REFIID iid, void **resource)
 
static HRESULT STDMETHODCALLTYPE d3d12_device_CreateReservedResource (ID3D12Device9 *iface, const D3D12_RESOURCE_DESC *desc, D3D12_RESOURCE_STATES initial_state, const D3D12_CLEAR_VALUE *optimized_clear_value, REFIID iid, void **resource)
 
static HRESULT STDMETHODCALLTYPE d3d12_device_CreateSharedHandle (ID3D12Device9 *iface, ID3D12DeviceChild *object, const SECURITY_ATTRIBUTES *attributes, DWORD access, const WCHAR *name, HANDLE *handle)
 
static HRESULT STDMETHODCALLTYPE d3d12_device_OpenSharedHandle (ID3D12Device9 *iface, HANDLE handle, REFIID riid, void **object)
 
static HRESULT STDMETHODCALLTYPE d3d12_device_OpenSharedHandleByName (ID3D12Device9 *iface, const WCHAR *name, DWORD access, HANDLE *handle)
 
static HRESULT STDMETHODCALLTYPE d3d12_device_MakeResident (ID3D12Device9 *iface, UINT object_count, ID3D12Pageable *const *objects)
 
static HRESULT STDMETHODCALLTYPE d3d12_device_Evict (ID3D12Device9 *iface, UINT object_count, ID3D12Pageable *const *objects)
 
static HRESULT STDMETHODCALLTYPE d3d12_device_CreateFence (ID3D12Device9 *iface, UINT64 initial_value, D3D12_FENCE_FLAGS flags, REFIID riid, void **fence)
 
static HRESULT STDMETHODCALLTYPE d3d12_device_GetDeviceRemovedReason (ID3D12Device9 *iface)
 
static void d3d12_device_get_copyable_footprints (struct d3d12_device *device, const D3D12_RESOURCE_DESC1 *desc, unsigned int first_sub_resource, unsigned int sub_resource_count, uint64_t base_offset, D3D12_PLACED_SUBRESOURCE_FOOTPRINT *layouts, UINT *row_counts, UINT64 *row_sizes, UINT64 *total_bytes)
 
static void STDMETHODCALLTYPE d3d12_device_GetCopyableFootprints (ID3D12Device9 *iface, const D3D12_RESOURCE_DESC *desc, UINT first_sub_resource, UINT sub_resource_count, UINT64 base_offset, D3D12_PLACED_SUBRESOURCE_FOOTPRINT *layouts, UINT *row_counts, UINT64 *row_sizes, UINT64 *total_bytes)
 
static HRESULT STDMETHODCALLTYPE d3d12_device_CreateQueryHeap (ID3D12Device9 *iface, const D3D12_QUERY_HEAP_DESC *desc, REFIID iid, void **heap)
 
static HRESULT STDMETHODCALLTYPE d3d12_device_SetStablePowerState (ID3D12Device9 *iface, BOOL enable)
 
static HRESULT STDMETHODCALLTYPE d3d12_device_CreateCommandSignature (ID3D12Device9 *iface, const D3D12_COMMAND_SIGNATURE_DESC *desc, ID3D12RootSignature *root_signature, REFIID iid, void **command_signature)
 
static void STDMETHODCALLTYPE d3d12_device_GetResourceTiling (ID3D12Device9 *iface, ID3D12Resource *resource, UINT *total_tile_count, D3D12_PACKED_MIP_INFO *packed_mip_info, D3D12_TILE_SHAPE *standard_tile_shape, UINT *sub_resource_tiling_count, UINT first_sub_resource_tiling, D3D12_SUBRESOURCE_TILING *sub_resource_tilings)
 
static LUID *STDMETHODCALLTYPE d3d12_device_GetAdapterLuid (ID3D12Device9 *iface, LUID *luid)
 
static HRESULT STDMETHODCALLTYPE d3d12_device_CreatePipelineLibrary (ID3D12Device9 *iface, const void *blob, SIZE_T blob_size, REFIID iid, void **lib)
 
static HRESULT STDMETHODCALLTYPE d3d12_device_SetEventOnMultipleFenceCompletion (ID3D12Device9 *iface, ID3D12Fence *const *fences, const UINT64 *values, UINT fence_count, D3D12_MULTIPLE_FENCE_WAIT_FLAGS flags, HANDLE event)
 
static HRESULT STDMETHODCALLTYPE d3d12_device_SetResidencyPriority (ID3D12Device9 *iface, UINT object_count, ID3D12Pageable *const *objects, const D3D12_RESIDENCY_PRIORITY *priorities)
 
static HRESULT STDMETHODCALLTYPE d3d12_device_CreatePipelineState (ID3D12Device9 *iface, const D3D12_PIPELINE_STATE_STREAM_DESC *desc, REFIID iid, void **pipeline_state)
 
static HRESULT STDMETHODCALLTYPE d3d12_device_OpenExistingHeapFromAddress (ID3D12Device9 *iface, const void *address, REFIID iid, void **heap)
 
static HRESULT STDMETHODCALLTYPE d3d12_device_OpenExistingHeapFromFileMapping (ID3D12Device9 *iface, HANDLE file_mapping, REFIID iid, void **heap)
 
static HRESULT STDMETHODCALLTYPE d3d12_device_EnqueueMakeResident (ID3D12Device9 *iface, D3D12_RESIDENCY_FLAGS flags, UINT num_objects, ID3D12Pageable *const *objects, ID3D12Fence *fence, UINT64 fence_value)
 
static HRESULT STDMETHODCALLTYPE d3d12_device_CreateCommandList1 (ID3D12Device9 *iface, UINT node_mask, D3D12_COMMAND_LIST_TYPE type, D3D12_COMMAND_LIST_FLAGS flags, REFIID iid, void **command_list)
 
static HRESULT STDMETHODCALLTYPE d3d12_device_CreateProtectedResourceSession (ID3D12Device9 *iface, const D3D12_PROTECTED_RESOURCE_SESSION_DESC *desc, REFIID iid, void **session)
 
static HRESULT STDMETHODCALLTYPE d3d12_device_CreateCommittedResource1 (ID3D12Device9 *iface, const D3D12_HEAP_PROPERTIES *heap_properties, D3D12_HEAP_FLAGS heap_flags, const D3D12_RESOURCE_DESC *desc, D3D12_RESOURCE_STATES initial_state, const D3D12_CLEAR_VALUE *optimized_clear_value, ID3D12ProtectedResourceSession *protected_session, REFIID iid, void **resource)
 
static HRESULT STDMETHODCALLTYPE d3d12_device_CreateHeap1 (ID3D12Device9 *iface, const D3D12_HEAP_DESC *desc, ID3D12ProtectedResourceSession *protected_session, REFIID iid, void **heap)
 
static HRESULT STDMETHODCALLTYPE d3d12_device_CreateReservedResource1 (ID3D12Device9 *iface, const D3D12_RESOURCE_DESC *desc, D3D12_RESOURCE_STATES initial_state, const D3D12_CLEAR_VALUE *optimized_clear_value, ID3D12ProtectedResourceSession *protected_session, REFIID iid, void **resource)
 
static D3D12_RESOURCE_ALLOCATION_INFO *STDMETHODCALLTYPE d3d12_device_GetResourceAllocationInfo1 (ID3D12Device9 *iface, D3D12_RESOURCE_ALLOCATION_INFO *info, UINT visible_mask, UINT count, const D3D12_RESOURCE_DESC *resource_descs, D3D12_RESOURCE_ALLOCATION_INFO1 *info1)
 
static HRESULT STDMETHODCALLTYPE d3d12_device_CreateLifetimeTracker (ID3D12Device9 *iface, ID3D12LifetimeOwner *owner, REFIID iid, void **tracker)
 
static void STDMETHODCALLTYPE d3d12_device_RemoveDevice (ID3D12Device9 *iface)
 
static HRESULT STDMETHODCALLTYPE d3d12_device_EnumerateMetaCommands (ID3D12Device9 *iface, UINT *num_meta_commands, D3D12_META_COMMAND_DESC *command_desc)
 
static HRESULT STDMETHODCALLTYPE d3d12_device_EnumerateMetaCommandParameters (ID3D12Device9 *iface, REFGUID command_id, D3D12_META_COMMAND_PARAMETER_STAGE stage, UINT *size_in_bytes, UINT *parameter_count, D3D12_META_COMMAND_PARAMETER_DESC *parameter_desc)
 
static HRESULT STDMETHODCALLTYPE d3d12_device_CreateMetaCommand (ID3D12Device9 *iface, REFGUID command_id, UINT node_mask, const void *parameters_data, SIZE_T data_size_in_bytes, REFIID iid, void **meta_command)
 
static HRESULT STDMETHODCALLTYPE d3d12_device_CreateStateObject (ID3D12Device9 *iface, const D3D12_STATE_OBJECT_DESC *desc, REFIID iid, void **state_object)
 
static void STDMETHODCALLTYPE d3d12_device_GetRaytracingAccelerationStructurePrebuildInfo (ID3D12Device9 *iface, const D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_INPUTS *desc, D3D12_RAYTRACING_ACCELERATION_STRUCTURE_PREBUILD_INFO *info)
 
static D3D12_DRIVER_MATCHING_IDENTIFIER_STATUS STDMETHODCALLTYPE d3d12_device_CheckDriverMatchingIdentifier (ID3D12Device9 *iface, D3D12_SERIALIZED_DATA_TYPE data_type, const D3D12_SERIALIZED_DATA_DRIVER_MATCHING_IDENTIFIER *identifier)
 
static HRESULT STDMETHODCALLTYPE d3d12_device_SetBackgroundProcessingMode (ID3D12Device9 *iface, D3D12_BACKGROUND_PROCESSING_MODE mode, D3D12_MEASUREMENTS_ACTION action, HANDLE event, BOOL *further_measurements_desired)
 
static HRESULT STDMETHODCALLTYPE d3d12_device_AddToStateObject (ID3D12Device9 *iface, const D3D12_STATE_OBJECT_DESC *addition, ID3D12StateObject *state_object_to_grow_from, REFIID riid, void **new_state_object)
 
static HRESULT STDMETHODCALLTYPE d3d12_device_CreateProtectedResourceSession1 (ID3D12Device9 *iface, const D3D12_PROTECTED_RESOURCE_SESSION_DESC1 *desc, REFIID riid, void **session)
 
static D3D12_RESOURCE_ALLOCATION_INFO *STDMETHODCALLTYPE d3d12_device_GetResourceAllocationInfo2 (ID3D12Device9 *iface, D3D12_RESOURCE_ALLOCATION_INFO *info, UINT visible_mask, UINT count, const D3D12_RESOURCE_DESC1 *resource_descs, D3D12_RESOURCE_ALLOCATION_INFO1 *info1)
 
static HRESULT STDMETHODCALLTYPE d3d12_device_CreateCommittedResource2 (ID3D12Device9 *iface, const D3D12_HEAP_PROPERTIES *heap_properties, D3D12_HEAP_FLAGS heap_flags, const D3D12_RESOURCE_DESC1 *desc, D3D12_RESOURCE_STATES initial_state, const D3D12_CLEAR_VALUE *optimized_clear_value, ID3D12ProtectedResourceSession *protected_session, REFIID iid, void **resource)
 
static HRESULT STDMETHODCALLTYPE d3d12_device_CreatePlacedResource1 (ID3D12Device9 *iface, ID3D12Heap *heap, UINT64 heap_offset, const D3D12_RESOURCE_DESC1 *resource_desc, D3D12_RESOURCE_STATES initial_state, const D3D12_CLEAR_VALUE *optimized_clear_value, REFIID iid, void **resource)
 
static void STDMETHODCALLTYPE d3d12_device_CreateSamplerFeedbackUnorderedAccessView (ID3D12Device9 *iface, ID3D12Resource *target_resource, ID3D12Resource *feedback_resource, D3D12_CPU_DESCRIPTOR_HANDLE descriptor)
 
static void STDMETHODCALLTYPE d3d12_device_GetCopyableFootprints1 (ID3D12Device9 *iface, const D3D12_RESOURCE_DESC1 *desc, UINT first_sub_resource, UINT sub_resource_count, UINT64 base_offset, D3D12_PLACED_SUBRESOURCE_FOOTPRINT *layouts, UINT *row_counts, UINT64 *row_sizes, UINT64 *total_bytes)
 
static HRESULT STDMETHODCALLTYPE d3d12_device_CreateShaderCacheSession (ID3D12Device9 *iface, const D3D12_SHADER_CACHE_SESSION_DESC *desc, REFIID iid, void **session)
 
static HRESULT STDMETHODCALLTYPE d3d12_device_ShaderCacheControl (ID3D12Device9 *iface, D3D12_SHADER_CACHE_KIND_FLAGS kinds, D3D12_SHADER_CACHE_CONTROL_FLAGS control)
 
static HRESULT STDMETHODCALLTYPE d3d12_device_CreateCommandQueue1 (ID3D12Device9 *iface, const D3D12_COMMAND_QUEUE_DESC *desc, REFIID creator_id, REFIID iid, void **command_queue)
 
struct d3d12_device * unsafe_impl_from_ID3D12Device9 (ID3D12Device9 *iface)
 
static void * device_worker_main (void *arg)
 
static HRESULT d3d12_device_init (struct d3d12_device *device, struct vkd3d_instance *instance, const struct vkd3d_device_create_info *create_info)
 
HRESULT d3d12_device_create (struct vkd3d_instance *instance, const struct vkd3d_device_create_info *create_info, struct d3d12_device **device)
 
void d3d12_device_mark_as_removed (struct d3d12_device *device, HRESULT reason, const char *message,...)
 
HRESULT d3d12_device_add_descriptor_heap (struct d3d12_device *device, struct d3d12_descriptor_heap *heap)
 
void d3d12_device_remove_descriptor_heap (struct d3d12_device *device, struct d3d12_descriptor_heap *heap)
 
HRESULT vkd3d_create_thread (struct vkd3d_instance *instance, PFN_vkd3d_thread thread_main, void *data, union vkd3d_thread_handle *thread)
 
HRESULT vkd3d_join_thread (struct vkd3d_instance *instance, union vkd3d_thread_handle *thread)
 
IUnknown * vkd3d_get_device_parent (ID3D12Device *device)
 
VkDevice vkd3d_get_vk_device (ID3D12Device *device)
 
VkPhysicalDevice vkd3d_get_vk_physical_device (ID3D12Device *device)
 
struct vkd3d_instance * vkd3d_instance_from_device (ID3D12Device *device)
 

Variables

static const struct vkd3d_optional_extension_info optional_instance_extensions []
 
static const char *const required_device_extensions []
 
static const struct vkd3d_optional_extension_info optional_device_extensions []
 
static const struct vkd3d_debug_option vkd3d_config_options []
 
static float queue_priorities [] = {1.0f}
 
static struct vkd3d_mutex cache_list_mutex = VKD3D_MUTEX_INITIALIZER
 
static struct list cache_list = LIST_INIT(cache_list)
 
static const struct ID3D12ShaderCacheSessionVtbl d3d12_cache_session_vtbl
 
static const struct ID3D12Device9Vtbl d3d12_device_vtbl
 

Macro Definition Documentation

◆ CHECK_FEATURE

#define CHECK_FEATURE (   name)
Value:
if (!features->name) \
{ \
WARN(#name " is not supported.\n"); \
have_11_0 = false; \
}
Definition: name.c:39

◆ CHECK_MAX_REQUIREMENT

#define CHECK_MAX_REQUIREMENT (   name,
  value 
)
Value:
if (vk_info->device_limits.name > value) \
WARN(#name " does not meet feature level 11_0 requirements.\n");
Definition: pdh_main.c:64

◆ CHECK_MIN_REQUIREMENT

#define CHECK_MIN_REQUIREMENT (   name,
  value 
)
Value:
if (vk_info->device_limits.name < value) \
WARN(#name " does not meet feature level 11_0 requirements.\n");

◆ VK_DEBUG_EXTENSION

#define VK_DEBUG_EXTENSION (   name,
  member 
)     {VK_ ## name ## _EXTENSION_NAME, offsetof(struct vkd3d_vulkan_info, member), true}

Definition at line 62 of file device.c.

◆ VK_EXTENSION

#define VK_EXTENSION (   name,
  member 
)     {VK_ ## name ## _EXTENSION_NAME, offsetof(struct vkd3d_vulkan_info, member)}

Definition at line 60 of file device.c.

◆ VK_KHR_PORTABILITY_SUBSET_EXTENSION_NAME

#define VK_KHR_PORTABILITY_SUBSET_EXTENSION_NAME   "VK_KHR_portability_subset"

Definition at line 84 of file device.c.

◆ VKD3D_DEFAULT_HOST_TICKS_PER_SECOND

#define VKD3D_DEFAULT_HOST_TICKS_PER_SECOND   10000000

Definition at line 570 of file device.c.

◆ vkd3d_find_struct

#define vkd3d_find_struct (   c,
  t 
)    vkd3d_find_struct_(c, VKD3D_STRUCTURE_TYPE_##t)

Definition at line 30 of file device.c.

◆ VKD3D_MAX_UAV_CLEAR_DESCRIPTORS_PER_TYPE

#define VKD3D_MAX_UAV_CLEAR_DESCRIPTORS_PER_TYPE   256u

Definition at line 22 of file device.c.

◆ VKD3D_VA_FALLBACK_BASE

#define VKD3D_VA_FALLBACK_BASE   0x8000000000000000ull

Definition at line 2364 of file device.c.

◆ VKD3D_VA_SLAB_BASE

#define VKD3D_VA_SLAB_BASE   0x0000001000000000ull

Definition at line 2365 of file device.c.

◆ VKD3D_VA_SLAB_COUNT

#define VKD3D_VA_SLAB_COUNT   (64 * 1024)

Definition at line 2368 of file device.c.

◆ VKD3D_VA_SLAB_SIZE

#define VKD3D_VA_SLAB_SIZE   (1ull << VKD3D_VA_SLAB_SIZE_SHIFT)

Definition at line 2367 of file device.c.

◆ VKD3D_VA_SLAB_SIZE_SHIFT

#define VKD3D_VA_SLAB_SIZE_SHIFT   32

Definition at line 2366 of file device.c.

Enumeration Type Documentation

◆ vkd3d_queue_family

Enumerator
VKD3D_QUEUE_FAMILY_DIRECT 
VKD3D_QUEUE_FAMILY_COMPUTE 
VKD3D_QUEUE_FAMILY_TRANSFER 
VKD3D_QUEUE_FAMILY_COUNT 

Definition at line 2038 of file device.c.

2039{
2043
2045};
@ VKD3D_QUEUE_FAMILY_DIRECT
Definition: device.c:2040
@ VKD3D_QUEUE_FAMILY_COUNT
Definition: device.c:2044
@ VKD3D_QUEUE_FAMILY_COMPUTE
Definition: device.c:2041
@ VKD3D_QUEUE_FAMILY_TRANSFER
Definition: device.c:2042

Function Documentation

◆ d3d12_cache_session_AddRef()

static ULONG STDMETHODCALLTYPE d3d12_cache_session_AddRef ( ID3D12ShaderCacheSession *  iface)
static

Definition at line 2786 of file device.c.

2787{
2789 unsigned int refcount = vkd3d_atomic_increment_u32(&session->refcount);
2790
2791 TRACE("%p increasing refcount to %u.\n", session, refcount);
2792
2793 return refcount;
2794}
static struct d3d12_cache_session * impl_from_ID3D12ShaderCacheSession(ID3D12ShaderCacheSession *iface)
Definition: device.c:2754
#define TRACE(s)
Definition: solgame.cpp:4
unsigned int refcount
Definition: device.c:2741
static uint32_t vkd3d_atomic_increment_u32(uint32_t volatile *x)
Definition: vkd3d_common.h:482

◆ d3d12_cache_session_destroy()

static void d3d12_cache_session_destroy ( struct d3d12_cache_session *  session)
static

Definition at line 2796 of file device.c.

2797{
2798 struct d3d12_device *device = session->device;
2799
2800 TRACE("Destroying cache session %p.\n", session);
2801
2803 list_remove(&session->cache_list_entry);
2805
2807 vkd3d_private_store_destroy(&session->private_store);
2809
2811}
static void list_remove(struct list_entry *entry)
Definition: list.h:90
unsigned int vkd3d_shader_cache_decref(struct vkd3d_shader_cache *cache)
Definition: cache.c:115
static struct vkd3d_mutex cache_list_mutex
Definition: device.c:2751
Definition: devices.h:37
static void vkd3d_mutex_unlock(struct vkd3d_mutex *lock)
Definition: vkd3d_common.h:584
static void vkd3d_mutex_lock(struct vkd3d_mutex *lock)
Definition: vkd3d_common.h:572
static void vkd3d_free(void *ptr)
Definition: vkd3d_memory.h:52
static void vkd3d_private_store_destroy(struct vkd3d_private_store *store)
static ULONG d3d12_device_release(struct d3d12_device *device)

Referenced by d3d12_cache_session_Release().

◆ d3d12_cache_session_FindValue()

static HRESULT STDMETHODCALLTYPE d3d12_cache_session_FindValue ( ID3D12ShaderCacheSession *  iface,
const void *  key,
UINT  key_size,
void *  value,
UINT *  value_size 
)
static

Definition at line 2876 of file device.c.

2878{
2880 enum vkd3d_result ret;
2881 size_t size;
2882
2883 TRACE("iface %p, key %p, key_size %#x, value %p, value_size %p.\n",
2884 iface, key, key_size, value, value_size);
2885
2886 if (!value_size)
2887 {
2888 WARN("value_size is NULL, returning E_INVALIDARG.\n");
2889 return E_INVALIDARG;
2890 }
2891
2892 size = *value_size;
2893 ret = vkd3d_shader_cache_get(session->cache, key, key_size, value, &size);
2894 *value_size = size;
2895
2897}
#define WARN(fmt,...)
Definition: precomp.h:61
static HRESULT hresult_from_vkd3d_result(int vkd3d_result)
Definition: compiler.c:30
#define E_INVALIDARG
Definition: ddrawi.h:101
return ret
Definition: mutex.c:147
GLsizeiptr size
Definition: glext.h:5919
int vkd3d_shader_cache_get(struct vkd3d_shader_cache *cache, const void *key, size_t key_size, void *value, size_t *value_size)
Definition: cache.c:208
Definition: copy.c:22
vkd3d_result
Definition: vkd3d_types.h:41

◆ d3d12_cache_session_GetDesc()

static D3D12_SHADER_CACHE_SESSION_DESC *STDMETHODCALLTYPE d3d12_cache_session_GetDesc ( ID3D12ShaderCacheSession *  iface,
D3D12_SHADER_CACHE_SESSION_DESC *  desc 
)
static

Definition at line 2923 of file device.c.

2925{
2927
2928 TRACE("iface %p.\n", iface);
2929 *desc = session->desc;
2930 return desc;
2931}
D3D11_SHADER_VARIABLE_DESC desc
Definition: reflection.c:1683

◆ d3d12_cache_session_GetDevice()

static HRESULT STDMETHODCALLTYPE d3d12_cache_session_GetDevice ( ID3D12ShaderCacheSession *  iface,
REFIID  iid,
void **  device 
)
static

Definition at line 2866 of file device.c.

2868{
2870
2871 TRACE("iface %p, iid %s, device %p.\n", iface, debugstr_guid(iid), device);
2872
2873 return d3d12_device_query_interface(session->device, iid, device);
2874}
#define debugstr_guid
Definition: kernel32.h:35
static HRESULT d3d12_device_query_interface(struct d3d12_device *device, REFIID iid, void **object)

◆ d3d12_cache_session_GetPrivateData()

static HRESULT STDMETHODCALLTYPE d3d12_cache_session_GetPrivateData ( ID3D12ShaderCacheSession *  iface,
REFGUID  guid,
UINT *  data_size,
void *  data 
)
static

Definition at line 2826 of file device.c.

2828{
2830
2831 TRACE("iface %p, guid %s, data_size %p, data %p.\n", iface, debugstr_guid(guid), data_size, data);
2832
2833 return vkd3d_get_private_data(&session->private_store, guid, data_size, data);
2834}
GUID guid
Definition: version.c:147
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
HRESULT vkd3d_get_private_data(struct vkd3d_private_store *store, const GUID *tag, unsigned int *out_size, void *out)
Definition: utils.c:994

◆ d3d12_cache_session_init()

static HRESULT d3d12_cache_session_init ( struct d3d12_cache_session *  session,
struct d3d12_device *  device,
const D3D12_SHADER_CACHE_SESSION_DESC *  desc 
)
static

Definition at line 2953 of file device.c.

2955{
2956 struct d3d12_cache_session *i;
2957 enum vkd3d_result ret;
2958 HRESULT hr;
2959
2960 session->ID3D12ShaderCacheSession_iface.lpVtbl = &d3d12_cache_session_vtbl;
2961 session->refcount = 1;
2962 session->desc = *desc;
2963 session->cache = NULL;
2964
2965 if (!session->desc.MaximumValueFileSizeBytes)
2966 session->desc.MaximumValueFileSizeBytes = 128 * 1024 * 1024;
2967 if (!session->desc.MaximumInMemoryCacheSizeBytes)
2968 session->desc.MaximumInMemoryCacheSizeBytes = 1024 * 1024;
2969 if (!session->desc.MaximumInMemoryCacheEntries)
2970 session->desc.MaximumInMemoryCacheEntries = 128;
2971
2972 if (FAILED(hr = vkd3d_private_store_init(&session->private_store)))
2973 return hr;
2974
2976
2977 /* We expect the number of open caches to be small. */
2979 {
2980 if (!memcmp(&i->desc.Identifier, &desc->Identifier, sizeof(desc->Identifier)))
2981 {
2982 TRACE("Found an existing cache %p from session %p.\n", i->cache, i);
2983 if (desc->Version == i->desc.Version)
2984 {
2985 session->desc = i->desc;
2986 vkd3d_shader_cache_incref(session->cache = i->cache);
2987 break;
2988 }
2989 else
2990 {
2991 WARN("version mismatch: Existing %"PRIu64" new %"PRIu64".\n",
2992 i->desc.Version, desc->Version);
2994 goto error;
2995 }
2996 }
2997 }
2998
2999 if (!session->cache)
3000 {
3001 if (session->desc.Mode == D3D12_SHADER_CACHE_MODE_DISK)
3002 FIXME("Disk caches are not yet implemented.\n");
3003
3005 if (ret)
3006 {
3007 WARN("Failed to open shader cache.\n");
3009 goto error;
3010 }
3011 }
3012
3013 /* Add it to the list even if we reused an existing cache. The other session might be destroyed,
3014 * but the cache stays alive and can be opened a third time. */
3015 list_add_tail(&cache_list, &session->cache_list_entry);
3017
3019 return S_OK;
3020
3021error:
3022 vkd3d_private_store_destroy(&session->private_store);
3024 return hr;
3025}
static void list_add_tail(struct list_entry *head, struct list_entry *entry)
Definition: list.h:83
#define FIXME(fmt,...)
Definition: precomp.h:53
HRESULT hr
Definition: delayimp.cpp:582
#define NULL
Definition: types.h:112
_ACRTIMP int __cdecl memcmp(const void *, const void *, size_t)
Definition: string.c:2807
#define PRIu64
Definition: inttypes.h:28
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 S_OK
Definition: intsafe.h:52
#define FAILED(hr)
Definition: intsafe.h:51
#define error(str)
Definition: mkdosfs.c:1605
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:236
unsigned int vkd3d_shader_cache_incref(struct vkd3d_shader_cache *cache)
Definition: cache.c:101
int vkd3d_shader_open_cache(struct vkd3d_shader_cache **cache)
Definition: cache.c:82
static const struct ID3D12ShaderCacheSessionVtbl d3d12_cache_session_vtbl
Definition: device.c:2933
static struct list cache_list
Definition: device.c:2752
struct list cache_list_entry
Definition: device.c:2743
static ULONG d3d12_device_add_ref(struct d3d12_device *device)
static HRESULT vkd3d_private_store_init(struct vkd3d_private_store *store)
#define DXGI_ERROR_ALREADY_EXISTS
Definition: winerror.h:7160

Referenced by d3d12_device_CreateShaderCacheSession().

◆ d3d12_cache_session_QueryInterface()

static HRESULT STDMETHODCALLTYPE d3d12_cache_session_QueryInterface ( ID3D12ShaderCacheSession *  iface,
REFIID  iid,
void **  object 
)
static

Definition at line 2759 of file device.c.

2761{
2762 TRACE("iface %p, iid %s, object %p.\n", iface, debugstr_guid(iid), object);
2763
2764 if (!object)
2765 {
2766 WARN("Output pointer is NULL, returning E_POINTER.\n");
2767 return E_POINTER;
2768 }
2769
2770 if (IsEqualGUID(iid, &IID_ID3D12ShaderCacheSession)
2771 || IsEqualGUID(iid, &IID_ID3D12DeviceChild)
2772 || IsEqualGUID(iid, &IID_ID3D12Object)
2773 || IsEqualGUID(iid, &IID_IUnknown))
2774 {
2775 ID3D12ShaderCacheSession_AddRef(iface);
2776 *object = iface;
2777 return S_OK;
2778 }
2779
2780 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid));
2781
2782 *object = NULL;
2783 return E_NOINTERFACE;
2784}
const GUID IID_IUnknown
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define E_NOINTERFACE
Definition: winerror.h:3479
#define E_POINTER
Definition: winerror.h:3480

◆ d3d12_cache_session_Release()

static ULONG STDMETHODCALLTYPE d3d12_cache_session_Release ( ID3D12ShaderCacheSession *  iface)
static

Definition at line 2813 of file device.c.

2814{
2816 unsigned int refcount = vkd3d_atomic_decrement_u32(&session->refcount);
2817
2818 TRACE("%p decreasing refcount to %u.\n", session, refcount);
2819
2820 if (!refcount)
2822
2823 return refcount;
2824}
static void d3d12_cache_session_destroy(struct d3d12_cache_session *session)
Definition: device.c:2796
static uint32_t vkd3d_atomic_decrement_u32(uint32_t volatile *x)
Definition: vkd3d_common.h:477

◆ d3d12_cache_session_SetDeleteOnDestroy()

static void STDMETHODCALLTYPE d3d12_cache_session_SetDeleteOnDestroy ( ID3D12ShaderCacheSession *  iface)
static

Definition at line 2918 of file device.c.

2919{
2920 FIXME("iface %p stub!\n", iface);
2921}

◆ d3d12_cache_session_SetName()

static HRESULT STDMETHODCALLTYPE d3d12_cache_session_SetName ( ID3D12ShaderCacheSession *  iface,
const WCHAR *  name 
)
static

Definition at line 2856 of file device.c.

2858{
2860
2861 TRACE("iface %p, name %s.\n", iface, debugstr_w(name, session->device->wchar_size));
2862
2863 return name ? S_OK : E_INVALIDARG;
2864}
#define debugstr_w
Definition: kernel32.h:32

◆ d3d12_cache_session_SetPrivateData()

static HRESULT STDMETHODCALLTYPE d3d12_cache_session_SetPrivateData ( ID3D12ShaderCacheSession *  iface,
REFGUID  guid,
UINT  data_size,
const void *  data 
)
static

Definition at line 2836 of file device.c.

2838{
2840
2841 TRACE("iface %p, guid %s, data_size %u, data %p.\n", iface, debugstr_guid(guid), data_size, data);
2842
2843 return vkd3d_set_private_data(&session->private_store, guid, data_size, data);
2844}
HRESULT vkd3d_set_private_data(struct vkd3d_private_store *store, const GUID *tag, unsigned int data_size, const void *data)
Definition: utils.c:1033

◆ d3d12_cache_session_SetPrivateDataInterface()

static HRESULT STDMETHODCALLTYPE d3d12_cache_session_SetPrivateDataInterface ( ID3D12ShaderCacheSession *  iface,
REFGUID  guid,
const IUnknown *  data 
)
static

Definition at line 2846 of file device.c.

2848{
2850
2851 TRACE("iface %p, guid %s, data %p.\n", iface, debugstr_guid(guid), data);
2852
2853 return vkd3d_set_private_data_interface(&session->private_store, guid, data);
2854}
HRESULT vkd3d_set_private_data_interface(struct vkd3d_private_store *store, const GUID *tag, const IUnknown *object)
Definition: utils.c:1046

◆ d3d12_cache_session_StoreValue()

static HRESULT STDMETHODCALLTYPE d3d12_cache_session_StoreValue ( ID3D12ShaderCacheSession *  iface,
const void *  key,
UINT  key_size,
const void *  value,
UINT  value_size 
)
static

Definition at line 2899 of file device.c.

2901{
2903 enum vkd3d_result ret;
2904
2905 TRACE("iface %p, key %p, key_size %#x, value %p, value_size %u.\n",
2906 iface, key, key_size, value, value_size);
2907
2908 if (!key || !key_size || !value || !value_size)
2909 {
2910 WARN("Invalid input parameters, returning E_INVALIDARG.\n");
2911 return E_INVALIDARG;
2912 }
2913
2914 ret = vkd3d_shader_cache_put(session->cache, key, key_size, value, value_size);
2916}
int vkd3d_shader_cache_put(struct vkd3d_shader_cache *cache, const void *key, size_t key_size, const void *value, size_t value_size)
Definition: cache.c:153

◆ d3d12_device_add_descriptor_heap()

HRESULT d3d12_device_add_descriptor_heap ( struct d3d12_device *  device,
struct d3d12_descriptor_heap *  heap 
)

Definition at line 5569 of file device.c.

5570{
5571 vkd3d_mutex_lock(&device->worker_mutex);
5572
5573 if (!vkd3d_array_reserve((void **)&device->heaps, &device->heap_capacity, device->heap_count + 1,
5574 sizeof(*device->heaps)))
5575 {
5576 vkd3d_mutex_unlock(&device->worker_mutex);
5577 return E_OUTOFMEMORY;
5578 }
5579 device->heaps[device->heap_count++] = heap;
5580
5581 vkd3d_mutex_unlock(&device->worker_mutex);
5582
5583 return S_OK;
5584}
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
Definition: heap.c:86
bool vkd3d_array_reserve(void **elements, size_t *capacity, size_t element_count, size_t element_size)
Definition: memory.c:22

Referenced by d3d12_descriptor_heap_create().

◆ d3d12_device_AddRef()

static ULONG STDMETHODCALLTYPE d3d12_device_AddRef ( ID3D12Device9 *  iface)
static

Definition at line 3062 of file device.c.

3063{
3065 unsigned int refcount = vkd3d_atomic_increment_u32(&device->refcount);
3066
3067 TRACE("%p increasing refcount to %u.\n", device, refcount);
3068
3069 return refcount;
3070}
static struct d3d12_device * impl_from_ID3D12Device9(ID3D12Device9 *iface)
Definition: device.c:3028
unsigned int refcount

◆ d3d12_device_AddToStateObject()

static HRESULT STDMETHODCALLTYPE d3d12_device_AddToStateObject ( ID3D12Device9 *  iface,
const D3D12_STATE_OBJECT_DESC *  addition,
ID3D12StateObject *  state_object_to_grow_from,
REFIID  riid,
void **  new_state_object 
)
static

Definition at line 5128 of file device.c.

5131{
5132 FIXME("iface %p, addition %p, state_object_to_grow_from %p, riid %s, new_state_object %p stub!\n",
5133 iface, addition, state_object_to_grow_from, debugstr_guid(riid), new_state_object);
5134
5135 return E_NOTIMPL;
5136}
#define E_NOTIMPL
Definition: ddrawi.h:99
REFIID riid
Definition: atlbase.h:39

◆ d3d12_device_check_multisample_quality_levels()

static HRESULT d3d12_device_check_multisample_quality_levels ( struct d3d12_device *  device,
D3D12_FEATURE_DATA_MULTISAMPLE_QUALITY_LEVELS *  data 
)
static

Definition at line 3294 of file device.c.

3296{
3297 const struct vkd3d_vk_device_procs *vk_procs = &device->vk_procs;
3298 VkImageFormatProperties vk_properties;
3299 const struct vkd3d_format *format;
3300 VkSampleCountFlagBits vk_samples;
3301 VkImageUsageFlags vk_usage = 0;
3302 VkResult vr;
3303
3304 TRACE("Format %#x, sample count %u, flags %#x.\n", data->Format, data->SampleCount, data->Flags);
3305
3306 data->NumQualityLevels = 0;
3307
3308 if (!(vk_samples = vk_samples_from_sample_count(data->SampleCount)))
3309 WARN("Invalid sample count %u.\n", data->SampleCount);
3310 if (!data->SampleCount)
3311 return E_FAIL;
3312
3313 if (data->SampleCount == 1)
3314 {
3315 data->NumQualityLevels = 1;
3316 goto done;
3317 }
3318
3319 if (data->Format == DXGI_FORMAT_UNKNOWN)
3320 goto done;
3321
3322 if (!(format = vkd3d_get_format(device, data->Format, false)))
3323 format = vkd3d_get_format(device, data->Format, true);
3324 if (!format)
3325 {
3326 FIXME("Unhandled format %#x.\n", data->Format);
3327 return E_INVALIDARG;
3328 }
3329 if (data->Flags)
3330 FIXME("Ignoring flags %#x.\n", data->Flags);
3331
3332 if (format->vk_aspect_mask & VK_IMAGE_ASPECT_COLOR_BIT)
3334 else
3336
3338 format->vk_format, VK_IMAGE_TYPE_2D, VK_IMAGE_TILING_OPTIMAL, vk_usage, 0, &vk_properties));
3340 {
3341 WARN("Format %#x is not supported.\n", format->dxgi_format);
3342 goto done;
3343 }
3344 if (vr < 0)
3345 {
3346 ERR("Failed to get image format properties, vr %d.\n", vr);
3347 return hresult_from_vk_result(vr);
3348 }
3349
3350 if (vk_properties.sampleCounts & vk_samples)
3351 data->NumQualityLevels = 1;
3352
3353done:
3354 TRACE("Returning %u quality levels.\n", data->NumQualityLevels);
3355 return S_OK;
3356}
#define ERR(fmt,...)
Definition: precomp.h:57
#define E_FAIL
Definition: ddrawi.h:102
static HRESULT hresult_from_vk_result(VkResult vr)
Definition: swapchain.c:1114
@ DXGI_FORMAT_UNKNOWN
Definition: dxgiformat.idl:23
VkSampleCountFlagBits vk_samples_from_sample_count(unsigned int sample_count)
Definition: resource.c:618
const struct vkd3d_format * vkd3d_get_format(const struct d3d12_device *device, DXGI_FORMAT dxgi_format, bool depth_stencil)
Definition: utils.c:442
VkSampleCountFlags sampleCounts
Definition: vulkan.h:9003
VkFlags VkImageUsageFlags
Definition: vulkan.h:1050
@ VK_IMAGE_TILING_OPTIMAL
Definition: vulkan.h:3495
@ VK_IMAGE_ASPECT_COLOR_BIT
Definition: vulkan.h:3365
@ VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT
Definition: vulkan.h:3515
@ VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT
Definition: vulkan.h:3514
VkResult VKAPI_CALL vkGetPhysicalDeviceImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, VkImageFormatProperties *pImageFormatProperties)
VkSampleCountFlagBits
Definition: vulkan.h:4700
@ VK_IMAGE_TYPE_2D
Definition: vulkan.h:3503
VkResult
Definition: vulkan.h:4639
@ VK_ERROR_FORMAT_NOT_SUPPORTED
Definition: vulkan.h:4661
#define VK_CALL(f)
Definition: wined3d_vk.h:272

Referenced by d3d12_device_CheckFeatureSupport().

◆ d3d12_device_CheckDriverMatchingIdentifier()

static D3D12_DRIVER_MATCHING_IDENTIFIER_STATUS STDMETHODCALLTYPE d3d12_device_CheckDriverMatchingIdentifier ( ID3D12Device9 *  iface,
D3D12_SERIALIZED_DATA_TYPE  data_type,
const D3D12_SERIALIZED_DATA_DRIVER_MATCHING_IDENTIFIER *  identifier 
)
static

Definition at line 5109 of file device.c.

5111{
5112 FIXME("iface %p, data_type %u, identifier %p stub!\n", iface, data_type, identifier);
5113
5115}
@ D3D12_DRIVER_MATCHING_IDENTIFIER_UNRECOGNIZED
Definition: d3d12.idl:3938
enum wined3d_data_type data_type
Definition: glsl_shader.c:71

◆ d3d12_device_CheckFeatureSupport()

static HRESULT STDMETHODCALLTYPE d3d12_device_CheckFeatureSupport ( ID3D12Device9 *  iface,
D3D12_FEATURE  feature,
void *  feature_data,
UINT  feature_data_size 
)
static

Definition at line 3377 of file device.c.

3379{
3381
3382 TRACE("iface %p, feature %#x, feature_data %p, feature_data_size %u.\n",
3383 iface, feature, feature_data, feature_data_size);
3384
3385 switch (feature)
3386 {
3388 {
3389 D3D12_FEATURE_DATA_D3D12_OPTIONS *data = feature_data;
3390
3391 if (feature_data_size != sizeof(*data))
3392 {
3393 WARN("Invalid size %u.\n", feature_data_size);
3394 return E_INVALIDARG;
3395 }
3396
3397 *data = device->feature_options;
3398
3399 TRACE("Double precision shader ops %#x.\n", data->DoublePrecisionFloatShaderOps);
3400 TRACE("Output merger logic op %#x.\n", data->OutputMergerLogicOp);
3401 TRACE("Shader min precision support %#x.\n", data->MinPrecisionSupport);
3402 TRACE("Tiled resources tier %#x.\n", data->TiledResourcesTier);
3403 TRACE("Resource binding tier %#x.\n", data->ResourceBindingTier);
3404 TRACE("PS specified stencil ref %#x.\n", data->PSSpecifiedStencilRefSupported);
3405 TRACE("Typed UAV load and additional formats %#x.\n", data->TypedUAVLoadAdditionalFormats);
3406 TRACE("ROV %#x.\n", data->ROVsSupported);
3407 TRACE("Conservative rasterization tier %#x.\n", data->ConservativeRasterizationTier);
3408 TRACE("Max GPU virtual address bits per resource %u.\n", data->MaxGPUVirtualAddressBitsPerResource);
3409 TRACE("Standard swizzle 64KB %#x.\n", data->StandardSwizzle64KBSupported);
3410 TRACE("Cross-node sharing tier %#x.\n", data->CrossNodeSharingTier);
3411 TRACE("Cross-adapter row-major texture %#x.\n", data->CrossAdapterRowMajorTextureSupported);
3412 TRACE("VP and RT array index from any shader without GS emulation %#x.\n",
3413 data->VPAndRTArrayIndexFromAnyShaderFeedingRasterizerSupportedWithoutGSEmulation);
3414 TRACE("Resource heap tier %#x.\n", data->ResourceHeapTier);
3415 return S_OK;
3416 }
3417
3419 {
3420 D3D12_FEATURE_DATA_ARCHITECTURE *data = feature_data;
3421 bool coherent;
3422
3423 if (feature_data_size != sizeof(*data))
3424 {
3425 WARN("Invalid size %u.\n", feature_data_size);
3426 return E_INVALIDARG;
3427 }
3428
3429 if (data->NodeIndex)
3430 {
3431 FIXME("Multi-adapter not supported.\n");
3432 return E_INVALIDARG;
3433 }
3434
3435 WARN("Assuming device does not support tile based rendering.\n");
3436 data->TileBasedRenderer = FALSE;
3437
3438 data->UMA = d3d12_device_is_uma(device, &coherent);
3439 data->CacheCoherentUMA = data->UMA && coherent;
3440
3441 TRACE("Tile based renderer %#x, UMA %#x, cache coherent UMA %#x.\n",
3442 data->TileBasedRenderer, data->UMA, data->CacheCoherentUMA);
3443 return S_OK;
3444 }
3445
3447 {
3448 struct vkd3d_vulkan_info *vulkan_info = &device->vk_info;
3450 unsigned int i;
3451
3452 if (feature_data_size != sizeof(*data))
3453 {
3454 WARN("Invalid size %u.\n", feature_data_size);
3455 return E_INVALIDARG;
3456 }
3457 if (!data->NumFeatureLevels)
3458 return E_INVALIDARG;
3459
3460 data->MaxSupportedFeatureLevel = 0;
3461 for (i = 0; i < data->NumFeatureLevels; ++i)
3462 {
3463 D3D_FEATURE_LEVEL fl = data->pFeatureLevelsRequested[i];
3464 if (data->MaxSupportedFeatureLevel < fl && fl <= vulkan_info->max_feature_level)
3465 data->MaxSupportedFeatureLevel = fl;
3466 }
3467
3468 TRACE("Max supported feature level %#x.\n", data->MaxSupportedFeatureLevel);
3469 return S_OK;
3470 }
3471
3473 {
3474 const struct vkd3d_vk_device_procs *vk_procs = &device->vk_procs;
3476 VkFormatFeatureFlagBits image_features;
3477 const struct vkd3d_format *format;
3478 VkFormatProperties properties;
3479
3480 if (feature_data_size != sizeof(*data))
3481 {
3482 WARN("Invalid size %u.\n", feature_data_size);
3483 return E_INVALIDARG;
3484 }
3485
3486 data->Support1 = D3D12_FORMAT_SUPPORT1_NONE;
3487 data->Support2 = D3D12_FORMAT_SUPPORT2_NONE;
3488 if (!(format = vkd3d_get_format(device, data->Format, false)))
3489 format = vkd3d_get_format(device, data->Format, true);
3490 if (!format)
3491 {
3492 FIXME("Unhandled format %#x.\n", data->Format);
3493 return E_INVALIDARG;
3494 }
3495
3496 VK_CALL(vkGetPhysicalDeviceFormatProperties(device->vk_physical_device, format->vk_format, &properties));
3497 image_features = properties.linearTilingFeatures | properties.optimalTilingFeatures;
3498
3499 if (properties.bufferFeatures)
3503 if (data->Format == DXGI_FORMAT_R16_UINT || data->Format == DXGI_FORMAT_R32_UINT)
3505 if (image_features)
3508 if (image_features & VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT)
3509 {
3513 {
3516 }
3517 if (format->vk_aspect_mask & VK_IMAGE_ASPECT_DEPTH_BIT)
3520 }
3521 if (image_features & VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT)
3527 if (image_features & VK_FORMAT_FEATURE_BLIT_SRC_BIT)
3529 if (image_features & VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT)
3530 {
3532 if (device->vk_info.uav_read_without_format)
3534 /* We effectively require shaderStorageImageWriteWithoutFormat,
3535 * so we can just report UAV_TYPED_STORE unconditionally. */
3537 }
3538
3539 if (image_features & VK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT)
3546
3548
3549 TRACE("Format %#x, support1 %#x, support2 %#x.\n", data->Format, data->Support1, data->Support2);
3550 return S_OK;
3551 }
3552
3554 {
3556
3557 if (feature_data_size != sizeof(*data))
3558 {
3559 WARN("Invalid size %u.\n", feature_data_size);
3560 return E_INVALIDARG;
3561 }
3562
3564 }
3565
3567 {
3568 D3D12_FEATURE_DATA_FORMAT_INFO *data = feature_data;
3569 const struct vkd3d_format *format;
3570
3571 if (feature_data_size != sizeof(*data))
3572 {
3573 WARN("Invalid size %u.\n", feature_data_size);
3574 return E_INVALIDARG;
3575 }
3576
3577 if (data->Format == DXGI_FORMAT_UNKNOWN)
3578 {
3579 data->PlaneCount = 1;
3580 return S_OK;
3581 }
3582
3583 if (!(format = vkd3d_get_format(device, data->Format, false)))
3584 format = vkd3d_get_format(device, data->Format, true);
3585 if (!format)
3586 {
3587 FIXME("Unhandled format %#x.\n", data->Format);
3588 return E_INVALIDARG;
3589 }
3590
3591 data->PlaneCount = format->plane_count;
3592
3593 TRACE("Format %#x, plane count %"PRIu8".\n", data->Format, data->PlaneCount);
3594 return S_OK;
3595 }
3596
3598 {
3599 const D3D12_FEATURE_DATA_D3D12_OPTIONS *options = &device->feature_options;
3601
3602 if (feature_data_size != sizeof(*data))
3603 {
3604 WARN("Invalid size %u.\n", feature_data_size);
3605 return E_INVALIDARG;
3606 }
3607
3608 data->MaxGPUVirtualAddressBitsPerResource = options->MaxGPUVirtualAddressBitsPerResource;
3609 data->MaxGPUVirtualAddressBitsPerProcess = options->MaxGPUVirtualAddressBitsPerResource;
3610
3611 TRACE("Max GPU virtual address bits per resource %u, Max GPU virtual address bits per process %u.\n",
3612 data->MaxGPUVirtualAddressBitsPerResource, data->MaxGPUVirtualAddressBitsPerProcess);
3613 return S_OK;
3614 }
3615
3617 {
3618 D3D12_FEATURE_DATA_SHADER_MODEL *data = feature_data;
3619
3620 if (feature_data_size != sizeof(*data))
3621 {
3622 WARN("Invalid size %u.\n", feature_data_size);
3623 return E_INVALIDARG;
3624 }
3625
3626 if (data->HighestShaderModel != D3D_SHADER_MODEL_5_1
3627 && (data->HighestShaderModel < D3D_SHADER_MODEL_6_0
3628 || data->HighestShaderModel > D3D_HIGHEST_SHADER_MODEL))
3629 {
3630 WARN("Unknown shader model %#x.\n", data->HighestShaderModel);
3631 return E_INVALIDARG;
3632 }
3633
3634 TRACE("Request shader model %#x.\n", data->HighestShaderModel);
3635
3636#ifdef VKD3D_SHADER_UNSUPPORTED_DXIL
3637 data->HighestShaderModel = min(data->HighestShaderModel, D3D_SHADER_MODEL_6_0);
3638#else
3639 data->HighestShaderModel = min(data->HighestShaderModel, D3D_SHADER_MODEL_5_1);
3640#endif
3641
3642 TRACE("Shader model %#x.\n", data->HighestShaderModel);
3643 return S_OK;
3644 }
3645
3647 {
3649
3650 if (feature_data_size != sizeof(*data))
3651 {
3652 WARN("Invalid size %u.\n", feature_data_size);
3653 return E_INVALIDARG;
3654 }
3655
3656 *data = device->feature_options1;
3657
3658 TRACE("Wave ops %#x.\n", data->WaveOps);
3659 TRACE("Min wave lane count %#x.\n", data->WaveLaneCountMin);
3660 TRACE("Max wave lane count %#x.\n", data->WaveLaneCountMax);
3661 TRACE("Total lane count %#x.\n", data->TotalLaneCount);
3662 TRACE("Expanded compute resource states %#x.\n", data->ExpandedComputeResourceStates);
3663 TRACE("Int64 shader ops %#x.\n", data->Int64ShaderOps);
3664 return S_OK;
3665 }
3666
3668 {
3670
3671 if (feature_data_size != sizeof(*data))
3672 {
3673 WARN("Invalid size %u.\n", feature_data_size);
3674 return E_INVALIDARG;
3675 }
3676
3677 TRACE("Root signature requested %#x.\n", data->HighestVersion);
3678 data->HighestVersion = min(data->HighestVersion, D3D_ROOT_SIGNATURE_VERSION_1_1);
3679 if (device->vkd3d_instance->api_version < VKD3D_API_VERSION_1_2)
3680 data->HighestVersion = min(data->HighestVersion, D3D_ROOT_SIGNATURE_VERSION_1_0);
3681
3682 TRACE("Root signature version %#x.\n", data->HighestVersion);
3683 return S_OK;
3684 }
3685
3687 {
3688 D3D12_FEATURE_DATA_ARCHITECTURE1 *data = feature_data;
3689 bool coherent;
3690
3691 if (feature_data_size != sizeof(*data))
3692 {
3693 WARN("Invalid size %u.\n", feature_data_size);
3694 return E_INVALIDARG;
3695 }
3696
3697 if (data->NodeIndex)
3698 {
3699 FIXME("Multi-adapter not supported.\n");
3700 return E_INVALIDARG;
3701 }
3702
3703 WARN("Assuming device does not support tile based rendering.\n");
3704 data->TileBasedRenderer = FALSE;
3705
3706 data->UMA = d3d12_device_is_uma(device, &coherent);
3707 data->CacheCoherentUMA = data->UMA && coherent;
3708
3709 WARN("Assuming device does not have an isolated memory management unit.\n");
3710 data->IsolatedMMU = FALSE;
3711
3712 TRACE("Tile based renderer %#x, UMA %#x, cache coherent UMA %#x, isolated MMU %#x.\n",
3713 data->TileBasedRenderer, data->UMA, data->CacheCoherentUMA, data->IsolatedMMU);
3714 return S_OK;
3715 }
3716
3718 {
3720
3721 if (feature_data_size != sizeof(*data))
3722 {
3723 WARN("Invalid size %u.\n", feature_data_size);
3724 return E_INVALIDARG;
3725 }
3726
3727 *data = device->feature_options2;
3728
3729 TRACE("Depth bounds test %#x.\n", data->DepthBoundsTestSupported);
3730 TRACE("Programmable sample positions tier %#x.\n", data->ProgrammableSamplePositionsTier);
3731 return S_OK;
3732 }
3733
3735 {
3736 D3D12_FEATURE_DATA_SHADER_CACHE *data = feature_data;
3737
3738 if (feature_data_size != sizeof(*data))
3739 {
3740 WARN("Invalid size %u.\n", feature_data_size);
3741 return E_INVALIDARG;
3742 }
3743
3744 /* FIXME: The d3d12 documentation states that
3745 * D3D12_SHADER_CACHE_SUPPORT_SINGLE_PSO is always supported, but
3746 * the CachedPSO field of D3D12_GRAPHICS_PIPELINE_STATE_DESC is
3747 * ignored and GetCachedBlob() is a stub. */
3748 data->SupportFlags = D3D12_SHADER_CACHE_SUPPORT_NONE;
3749
3750 TRACE("Shader cache support %#x.\n", data->SupportFlags);
3751 return S_OK;
3752 }
3753
3755 {
3757
3758 if (feature_data_size != sizeof(*data))
3759 {
3760 WARN("Invalid size %u.\n", feature_data_size);
3761 return E_INVALIDARG;
3762 }
3763
3764 switch (data->CommandListType)
3765 {
3769 data->PriorityForTypeIsSupported = FALSE;
3770 TRACE("Command list type %#x, priority %u, supported %#x.\n",
3771 data->CommandListType, data->Priority, data->PriorityForTypeIsSupported);
3772 return S_OK;
3773
3774 default:
3775 FIXME("Unhandled command list type %#x.\n", data->CommandListType);
3776 return E_INVALIDARG;
3777 }
3778 }
3779
3781 {
3783
3784 if (feature_data_size != sizeof(*data))
3785 {
3786 WARN("Invalid size %u.\n", feature_data_size);
3787 return E_INVALIDARG;
3788 }
3789
3790 *data = device->feature_options3;
3791
3792 TRACE("Copy queue timestamp queries %#x.\n", data->CopyQueueTimestampQueriesSupported);
3793 TRACE("Casting fully typed format %#x.\n", data->CastingFullyTypedFormatSupported);
3794 TRACE("Write buffer immediate %#x.\n", data->WriteBufferImmediateSupportFlags);
3795 TRACE("View instancing tier %#x.\n", data->ViewInstancingTier);
3796 TRACE("Barycentrics %#x.\n", data->BarycentricsSupported);
3797 return S_OK;
3798 }
3799
3801 {
3803
3804 if (feature_data_size != sizeof(*data))
3805 {
3806 WARN("Invalid size %u.\n", feature_data_size);
3807 return E_INVALIDARG;
3808 }
3809
3810 data->Supported = FALSE;
3811
3812 TRACE("Existing heaps %#x.\n", data->Supported);
3813 return S_OK;
3814 }
3815
3817 {
3819
3820 if (feature_data_size != sizeof(*data))
3821 {
3822 WARN("Invalid size %u.\n", feature_data_size);
3823 return E_INVALIDARG;
3824 }
3825
3826 *data = device->feature_options4;
3827
3828 TRACE("64 KiB aligned MSAA textures %#x.\n", data->MSAA64KBAlignedTextureSupported);
3829 TRACE("Shared resource compatibility tier %#x.\n", data->SharedResourceCompatibilityTier);
3830 TRACE("Native 16-bit shader ops %#x.\n", data->Native16BitShaderOpsSupported);
3831 return S_OK;
3832 }
3833
3835 {
3836 D3D12_FEATURE_DATA_SERIALIZATION *data = feature_data;
3837
3838 if (feature_data_size != sizeof(*data))
3839 {
3840 WARN("Invalid size %u.\n", feature_data_size);
3841 return E_INVALIDARG;
3842 }
3843
3844 if (data->NodeIndex)
3845 {
3846 FIXME("Multi-adapter not supported.\n");
3847 return E_INVALIDARG;
3848 }
3849
3850 data->HeapSerializationTier = D3D12_HEAP_SERIALIZATION_TIER_0;
3851
3852 TRACE("Heap serialisation tier %#x.\n", data->HeapSerializationTier);
3853 return S_OK;
3854 }
3855
3857 {
3858 D3D12_FEATURE_DATA_CROSS_NODE *data = feature_data;
3859
3860 if (feature_data_size != sizeof(*data))
3861 {
3862 WARN("Invalid size %u.\n", feature_data_size);
3863 return E_INVALIDARG;
3864 }
3865
3866 data->SharingTier = device->feature_options.CrossNodeSharingTier;
3867 data->AtomicShaderInstructions = FALSE;
3868
3869 TRACE("Cross node sharing tier %#x.\n", data->SharingTier);
3870 TRACE("Cross node shader atomics %#x.\n", data->AtomicShaderInstructions);
3871 return S_OK;
3872 }
3873
3875 {
3877
3878 if (feature_data_size != sizeof(*data))
3879 {
3880 WARN("Invalid size %u.\n", feature_data_size);
3881 return E_INVALIDARG;
3882 }
3883
3884 *data = device->feature_options5;
3885
3886 TRACE("SRV tiled resource tier 3 only %#x.\n", data->SRVOnlyTiledResourceTier3);
3887 TRACE("Render pass tier %#x.\n", data->RenderPassesTier);
3888 TRACE("Ray tracing tier %#x.\n", data->RaytracingTier);
3889 return S_OK;
3890 }
3891
3893 {
3895
3896 if (feature_data_size != sizeof(*data))
3897 {
3898 WARN("Invalid size %u.\n", feature_data_size);
3899 return E_INVALIDARG;
3900 }
3901
3902 data->AdditionalShadingRatesSupported = FALSE;
3903 data->PerPrimitiveShadingRateSupportedWithViewportIndexing = FALSE;
3904 data->VariableShadingRateTier = D3D12_VARIABLE_SHADING_RATE_TIER_NOT_SUPPORTED;
3905 data->ShadingRateImageTileSize = 0;
3906 data->BackgroundProcessingSupported = FALSE;
3907
3908 TRACE("Additional shading rates support %#x.\n", data->AdditionalShadingRatesSupported);
3909 TRACE("Per-primitive shading rates with viewport indexing %#x.\n",
3910 data->PerPrimitiveShadingRateSupportedWithViewportIndexing);
3911 TRACE("Variable shading rate tier %#x.\n", data->VariableShadingRateTier);
3912 TRACE("Shading rate image tile size %#x.\n", data->ShadingRateImageTileSize);
3913 TRACE("Background processing support %#x.\n", data->BackgroundProcessingSupported);
3914 return S_OK;
3915 }
3916
3918 {
3920
3921 if (feature_data_size != sizeof(*data))
3922 {
3923 WARN("Invalid size %u.\n", feature_data_size);
3924 return E_INVALIDARG;
3925 }
3926
3928 data->SamplerFeedbackTier = D3D12_SAMPLER_FEEDBACK_TIER_NOT_SUPPORTED;
3929
3930 TRACE("Mesh shading tier %#x.\n", data->MeshShaderTier);
3931 TRACE("Sampler feedback tier %#x.\n", data->SamplerFeedbackTier);
3932 return S_OK;
3933 }
3934
3936 {
3938
3939 if (feature_data_size != sizeof(*data))
3940 {
3941 WARN("Invalid size %u.\n", feature_data_size);
3942 return E_INVALIDARG;
3943 }
3944
3945 /* Vulkan does not restrict block texture alignment. */
3946 data->UnalignedBlockTexturesSupported = TRUE;
3947
3948 TRACE("Unaligned block texture support %#x.\n", data->UnalignedBlockTexturesSupported);
3949 return S_OK;
3950 }
3951
3953 {
3955
3956 if (feature_data_size != sizeof(*data))
3957 {
3958 WARN("Invalid size %u.\n", feature_data_size);
3959 return E_INVALIDARG;
3960 }
3961
3962 data->MeshShaderPipelineStatsSupported = FALSE;
3963 data->MeshShaderSupportsFullRangeRenderTargetArrayIndex = FALSE;
3964 data->AtomicInt64OnTypedResourceSupported = FALSE;
3965 data->AtomicInt64OnGroupSharedSupported = FALSE;
3966 data->DerivativesInMeshAndAmplificationShadersSupported = FALSE;
3968
3969 TRACE("Mesh shader pipeline stats support %#x.\n", data->MeshShaderPipelineStatsSupported);
3970 TRACE("Mesh shader RT array index full range %#x.\n", data->MeshShaderSupportsFullRangeRenderTargetArrayIndex);
3971 TRACE("Atomic int64 on typed resource %#x.\n", data->AtomicInt64OnTypedResourceSupported);
3972 TRACE("Atomic int64 on group shared mem %#x.\n", data->AtomicInt64OnGroupSharedSupported);
3973 TRACE("Derivatives in mesh and amp shaders %#x.\n", data->DerivativesInMeshAndAmplificationShadersSupported);
3974 TRACE("Wave MMA tier %#x.\n", data->WaveMMATier);
3975 return S_OK;
3976 }
3977
3979 {
3981
3982 if (feature_data_size != sizeof(*data))
3983 {
3984 WARN("Invalid size %u.\n", feature_data_size);
3985 return E_INVALIDARG;
3986 }
3987
3988 data->VariableRateShadingSumCombinerSupported = FALSE;
3989 data->MeshShaderPerPrimitiveShadingRateSupported = FALSE;
3990
3991 TRACE("Variable rate shading sum combiner %#x.\n", data->VariableRateShadingSumCombinerSupported);
3992 TRACE("Mesh shader per primitive shading rate %#x.\n", data->MeshShaderPerPrimitiveShadingRateSupported);
3993 return S_OK;
3994 }
3995
3997 {
3999
4000 if (feature_data_size != sizeof(*data))
4001 {
4002 WARN("Invalid size %u.\n", feature_data_size);
4003 return E_INVALIDARG;
4004 }
4005
4006 data->AtomicInt64OnDescriptorHeapResourceSupported = FALSE;
4007
4008 TRACE("Atomic int64 on descriptor heap resource %#x.\n", data->AtomicInt64OnDescriptorHeapResourceSupported);
4009 return S_OK;
4010 }
4011
4013 {
4015
4016 if (feature_data_size != sizeof(*data))
4017 {
4018 WARN("Invalid size %u.\n", feature_data_size);
4019 return E_INVALIDARG;
4020 }
4021
4022 data->MSPrimitivesPipelineStatisticIncludesCulledPrimitives = D3D12_TRI_STATE_UNKNOWN;
4023 data->EnhancedBarriersSupported = FALSE;
4024 data->RelaxedFormatCastingSupported = FALSE;
4025
4026 TRACE("Mesh shader primitives pipeline stats include cull primitives %#x.\n",
4027 data->MSPrimitivesPipelineStatisticIncludesCulledPrimitives);
4028 TRACE("Enhanced barriers %#x.\n", data->EnhancedBarriersSupported);
4029 TRACE("Relaxed format casting %#x.\n", data->RelaxedFormatCastingSupported);
4030 return S_OK;
4031 }
4032
4034 {
4036
4037 if (feature_data_size != sizeof(*data))
4038 {
4039 WARN("Invalid size %u.\n", feature_data_size);
4040 return E_INVALIDARG;
4041 }
4042
4043 data->UnrestrictedBufferTextureCopyPitchSupported = FALSE;
4044 data->UnrestrictedVertexElementAlignmentSupported = FALSE;
4045 data->InvertedViewportHeightFlipsYSupported = FALSE;
4046 data->InvertedViewportDepthFlipsZSupported = FALSE;
4047 data->TextureCopyBetweenDimensionsSupported = FALSE;
4048 data->AlphaBlendFactorSupported = FALSE;
4049
4050 TRACE("Unrestricted buffer-texture copy pitch %#x.\n", data->UnrestrictedBufferTextureCopyPitchSupported);
4051 TRACE("Unrestricted vertex element alignment %#x.\n", data->UnrestrictedVertexElementAlignmentSupported);
4052 TRACE("Inverted viewport height flips Y %#x.\n", data->InvertedViewportHeightFlipsYSupported);
4053 TRACE("Inverted viewport depth flips Z %#x.\n", data->InvertedViewportDepthFlipsZSupported);
4054 TRACE("Texture copy between dimensions %#x.\n", data->TextureCopyBetweenDimensionsSupported);
4055 TRACE("Alpha blend factor support %#x.\n", data->AlphaBlendFactorSupported);
4056 return S_OK;
4057 }
4058
4060 {
4062
4063 if (feature_data_size != sizeof(*data))
4064 {
4065 WARN("Invalid size %u.\n", feature_data_size);
4066 }
4067
4068 data->AdvancedTextureOpsSupported = FALSE;
4069 data->WriteableMSAATexturesSupported = FALSE;
4070 data->IndependentFrontAndBackStencilRefMaskSupported = FALSE;
4071
4072 TRACE("Advanced texture ops %#x.\n", data->AdvancedTextureOpsSupported);
4073 TRACE("Writeable MSAA textures %#x.\n", data->WriteableMSAATexturesSupported);
4074 TRACE("Independent front and back stencil ref mask %#x.\n", data->IndependentFrontAndBackStencilRefMaskSupported);
4075 return S_OK;
4076 }
4077
4079 {
4081
4082 if (feature_data_size != sizeof(*data))
4083 {
4084 WARN("Invalid size %u.\n", feature_data_size);
4085 }
4086
4087 data->TriangleFanSupported = FALSE;
4088 data->DynamicIndexBufferStripCutSupported = FALSE;
4089
4090 TRACE("Triangle fan %#x.\n", data->TriangleFanSupported);
4091 TRACE("Dynamic index buffer strip cut %#x.\n", data->DynamicIndexBufferStripCutSupported);
4092 return S_OK;
4093 }
4094
4096 {
4098
4099 if (feature_data_size != sizeof(*data))
4100 {
4101 WARN("Invalid size %u.\n", feature_data_size);
4102 }
4103
4104 data->DynamicDepthBiasSupported = FALSE;
4105 data->GPUUploadHeapSupported = FALSE;
4106
4107 TRACE("Dynamic depth bias %#x.\n", data->DynamicDepthBiasSupported);
4108 TRACE("GPU upload heap %#x.\n", data->GPUUploadHeapSupported);
4109 return S_OK;
4110 }
4111
4113 {
4115
4116 if (feature_data_size != sizeof(*data))
4117 {
4118 WARN("Invalid size %u.\n", feature_data_size);
4119 }
4120
4121 data->NonNormalizedCoordinateSamplersSupported = FALSE;
4122 data->ManualWriteTrackingResourceSupported = FALSE;
4123
4124 TRACE("Non-normalized coordinate samplers %#x.\n", data->NonNormalizedCoordinateSamplersSupported);
4125 TRACE("Manual write tracking resource %#x.\n", data->ManualWriteTrackingResourceSupported);
4126 return S_OK;
4127 }
4128
4130 {
4132
4133 if (feature_data_size != sizeof(*data))
4134 {
4135 WARN("Invalid size %u.\n", feature_data_size);
4136 }
4137
4138 data->RenderPassesValid = FALSE;
4139
4140 TRACE("Render passes valid %#x.\n", data->RenderPassesValid);
4141 return S_OK;
4142 }
4143
4144 default:
4145 FIXME("Unhandled feature %#x.\n", feature);
4146 return E_NOTIMPL;
4147 }
4148}
@ D3D12_HEAP_SERIALIZATION_TIER_0
Definition: d3d12.idl:618
@ D3D12_FORMAT_SUPPORT1_TEXTURE1D
Definition: d3d12.idl:509
@ D3D12_FORMAT_SUPPORT1_IA_INDEX_BUFFER
Definition: d3d12.idl:507
@ D3D12_FORMAT_SUPPORT1_TEXTURECUBE
Definition: d3d12.idl:512
@ D3D12_FORMAT_SUPPORT1_SHADER_SAMPLE_COMPARISON
Definition: d3d12.idl:515
@ D3D12_FORMAT_SUPPORT1_MULTISAMPLE_RENDERTARGET
Definition: d3d12.idl:524
@ D3D12_FORMAT_SUPPORT1_RENDER_TARGET
Definition: d3d12.idl:518
@ D3D12_FORMAT_SUPPORT1_MULTISAMPLE_LOAD
Definition: d3d12.idl:525
@ D3D12_FORMAT_SUPPORT1_SHADER_GATHER_COMPARISON
Definition: d3d12.idl:529
@ D3D12_FORMAT_SUPPORT1_BLENDABLE
Definition: d3d12.idl:519
@ D3D12_FORMAT_SUPPORT1_BUFFER
Definition: d3d12.idl:505
@ D3D12_FORMAT_SUPPORT1_MIP
Definition: d3d12.idl:517
@ D3D12_FORMAT_SUPPORT1_IA_VERTEX_BUFFER
Definition: d3d12.idl:506
@ D3D12_FORMAT_SUPPORT1_NONE
Definition: d3d12.idl:504
@ D3D12_FORMAT_SUPPORT1_TEXTURE3D
Definition: d3d12.idl:511
@ D3D12_FORMAT_SUPPORT1_SHADER_GATHER
Definition: d3d12.idl:526
@ D3D12_FORMAT_SUPPORT1_TEXTURE2D
Definition: d3d12.idl:510
@ D3D12_FORMAT_SUPPORT1_TYPED_UNORDERED_ACCESS_VIEW
Definition: d3d12.idl:528
@ D3D12_FORMAT_SUPPORT1_DEPTH_STENCIL
Definition: d3d12.idl:520
@ D3D12_FORMAT_SUPPORT1_SHADER_SAMPLE
Definition: d3d12.idl:514
@ D3D12_FORMAT_SUPPORT1_MULTISAMPLE_RESOLVE
Definition: d3d12.idl:521
@ D3D12_FORMAT_SUPPORT1_SHADER_LOAD
Definition: d3d12.idl:513
@ D3D_SHADER_MODEL_6_0
Definition: d3d12.idl:2255
@ D3D_SHADER_MODEL_5_1
Definition: d3d12.idl:2254
@ D3D_HIGHEST_SHADER_MODEL
Definition: d3d12.idl:2263
@ D3D_ROOT_SIGNATURE_VERSION_1_0
Definition: d3d12.idl:1405
@ D3D_ROOT_SIGNATURE_VERSION_1_1
Definition: d3d12.idl:1406
@ D3D12_WAVE_MMA_TIER_NOT_SUPPORTED
Definition: d3d12.idl:2400
@ D3D12_COMMAND_LIST_TYPE_COPY
Definition: d3d12.idl:2192
@ D3D12_COMMAND_LIST_TYPE_DIRECT
Definition: d3d12.idl:2189
@ D3D12_COMMAND_LIST_TYPE_COMPUTE
Definition: d3d12.idl:2191
@ D3D12_VARIABLE_SHADING_RATE_TIER_NOT_SUPPORTED
Definition: d3d12.idl:2350
@ D3D12_TRI_STATE_UNKNOWN
Definition: d3d12.idl:2427
@ D3D12_FORMAT_SUPPORT2_UAV_ATOMIC_EXCHANGE
Definition: d3d12.idl:543
@ D3D12_FORMAT_SUPPORT2_NONE
Definition: d3d12.idl:539
@ D3D12_FORMAT_SUPPORT2_UAV_ATOMIC_SIGNED_MIN_OR_MAX
Definition: d3d12.idl:544
@ D3D12_FORMAT_SUPPORT2_UAV_ATOMIC_COMPARE_STORE_OR_COMPARE_EXCHANGE
Definition: d3d12.idl:542
@ D3D12_FORMAT_SUPPORT2_UAV_TYPED_LOAD
Definition: d3d12.idl:546
@ D3D12_FORMAT_SUPPORT2_UAV_TYPED_STORE
Definition: d3d12.idl:547
@ D3D12_FORMAT_SUPPORT2_UAV_ATOMIC_BITWISE_OPS
Definition: d3d12.idl:541
@ D3D12_FORMAT_SUPPORT2_UAV_ATOMIC_UNSIGNED_MIN_OR_MAX
Definition: d3d12.idl:545
@ D3D12_FORMAT_SUPPORT2_UAV_ATOMIC_ADD
Definition: d3d12.idl:540
@ D3D12_SAMPLER_FEEDBACK_TIER_NOT_SUPPORTED
Definition: d3d12.idl:2372
@ D3D12_MESH_SHADER_TIER_NOT_SUPPORTED
Definition: d3d12.idl:2366
@ D3D12_SHADER_CACHE_SUPPORT_NONE
Definition: d3d12.idl:571
@ D3D12_FEATURE_D3D12_OPTIONS9
Definition: d3d12.idl:2509
@ D3D12_FEATURE_D3D12_OPTIONS8
Definition: d3d12.idl:2508
@ D3D12_FEATURE_FORMAT_SUPPORT
Definition: d3d12.idl:2484
@ D3D12_FEATURE_FEATURE_LEVELS
Definition: d3d12.idl:2483
@ D3D12_FEATURE_FORMAT_INFO
Definition: d3d12.idl:2486
@ D3D12_FEATURE_D3D12_OPTIONS16
Definition: d3d12.idl:2516
@ D3D12_FEATURE_D3D12_OPTIONS18
Definition: d3d12.idl:2518
@ D3D12_FEATURE_D3D12_OPTIONS
Definition: d3d12.idl:2481
@ D3D12_FEATURE_D3D12_OPTIONS2
Definition: d3d12.idl:2493
@ D3D12_FEATURE_SHADER_CACHE
Definition: d3d12.idl:2494
@ D3D12_FEATURE_SHADER_MODEL
Definition: d3d12.idl:2488
@ D3D12_FEATURE_EXISTING_HEAPS
Definition: d3d12.idl:2497
@ D3D12_FEATURE_D3D12_OPTIONS3
Definition: d3d12.idl:2496
@ D3D12_FEATURE_ARCHITECTURE
Definition: d3d12.idl:2482
@ D3D12_FEATURE_D3D12_OPTIONS6
Definition: d3d12.idl:2503
@ D3D12_FEATURE_COMMAND_QUEUE_PRIORITY
Definition: d3d12.idl:2495
@ D3D12_FEATURE_D3D12_OPTIONS7
Definition: d3d12.idl:2505
@ D3D12_FEATURE_D3D12_OPTIONS13
Definition: d3d12.idl:2513
@ D3D12_FEATURE_ARCHITECTURE1
Definition: d3d12.idl:2492
@ D3D12_FEATURE_D3D12_OPTIONS11
Definition: d3d12.idl:2511
@ D3D12_FEATURE_MULTISAMPLE_QUALITY_LEVELS
Definition: d3d12.idl:2485
@ D3D12_FEATURE_D3D12_OPTIONS15
Definition: d3d12.idl:2515
@ D3D12_FEATURE_D3D12_OPTIONS4
Definition: d3d12.idl:2498
@ D3D12_FEATURE_GPU_VIRTUAL_ADDRESS_SUPPORT
Definition: d3d12.idl:2487
@ D3D12_FEATURE_D3D12_OPTIONS12
Definition: d3d12.idl:2512
@ D3D12_FEATURE_ROOT_SIGNATURE
Definition: d3d12.idl:2491
@ D3D12_FEATURE_D3D12_OPTIONS17
Definition: d3d12.idl:2517
@ D3D12_FEATURE_D3D12_OPTIONS1
Definition: d3d12.idl:2489
@ D3D12_FEATURE_CROSS_NODE
Definition: d3d12.idl:2500
@ D3D12_FEATURE_SERIALIZATION
Definition: d3d12.idl:2499
@ D3D12_FEATURE_D3D12_OPTIONS5
Definition: d3d12.idl:2501
@ D3D12_FEATURE_D3D12_OPTIONS10
Definition: d3d12.idl:2510
@ D3D12_FEATURE_D3D12_OPTIONS14
Definition: d3d12.idl:2514
D3D_FEATURE_LEVEL
Definition: d3dcommon.idl:102
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define PRIu8
Definition: inttypes.h:82
@ DXGI_FORMAT_R16_UINT
Definition: dxgiformat.idl:80
@ DXGI_FORMAT_R32_UINT
Definition: dxgiformat.idl:65
INTERNETFEATURELIST feature
Definition: misc.c:1807
#define min(a, b)
Definition: monoChain.cc:55
static HRESULT d3d12_device_check_multisample_quality_levels(struct d3d12_device *device, D3D12_FEATURE_DATA_MULTISAMPLE_QUALITY_LEVELS *data)
Definition: device.c:3294
static void vkd3d_restrict_format_support_for_feature_level(D3D12_FEATURE_DATA_FORMAT_SUPPORT *format_support)
Definition: device.c:3272
bool d3d12_device_is_uma(struct d3d12_device *device, bool *coherent)
Definition: device.c:3358
VkFormatFeatureFlags linearTilingFeatures
Definition: vulkan.h:8745
VkFormatFeatureFlags optimalTilingFeatures
Definition: vulkan.h:8746
VkFormatFeatureFlags bufferFeatures
Definition: vulkan.h:8747
D3D_FEATURE_LEVEL max_feature_level
@ VKD3D_API_VERSION_1_2
Definition: vkd3d.h:89
VkFormatFeatureFlagBits
Definition: vulkan.h:3127
@ VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT
Definition: vulkan.h:3140
@ VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT
Definition: vulkan.h:3136
@ VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT
Definition: vulkan.h:3137
@ VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT
Definition: vulkan.h:3129
@ VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT
Definition: vulkan.h:3134
@ VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT
Definition: vulkan.h:3128
@ VK_FORMAT_FEATURE_BLIT_SRC_BIT
Definition: vulkan.h:3138
@ VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT
Definition: vulkan.h:3135
@ VK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT
Definition: vulkan.h:3130
void VKAPI_CALL vkGetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties *pFormatProperties)
@ VK_IMAGE_ASPECT_DEPTH_BIT
Definition: vulkan.h:3366
_In_ FLONG fl
Definition: winddi.h:1279

◆ d3d12_device_CopyDescriptors()

static void STDMETHODCALLTYPE d3d12_device_CopyDescriptors ( ID3D12Device9 *  iface,
UINT  dst_descriptor_range_count,
const D3D12_CPU_DESCRIPTOR_HANDLE *  dst_descriptor_range_offsets,
const UINT *  dst_descriptor_range_sizes,
UINT  src_descriptor_range_count,
const D3D12_CPU_DESCRIPTOR_HANDLE *  src_descriptor_range_offsets,
const UINT *  src_descriptor_range_sizes,
D3D12_DESCRIPTOR_HEAP_TYPE  descriptor_heap_type 
)
static

Definition at line 4285 of file device.c.

4291{
4293 unsigned int dst_range_idx, dst_idx, src_range_idx, src_idx;
4294 unsigned int dst_range_size, src_range_size;
4295 struct d3d12_descriptor_heap *dst_heap;
4296 const struct d3d12_desc *src;
4297 struct d3d12_desc *dst;
4298
4299 TRACE("iface %p, dst_descriptor_range_count %u, dst_descriptor_range_offsets %p, "
4300 "dst_descriptor_range_sizes %p, src_descriptor_range_count %u, "
4301 "src_descriptor_range_offsets %p, src_descriptor_range_sizes %p, "
4302 "descriptor_heap_type %#x.\n",
4303 iface, dst_descriptor_range_count, dst_descriptor_range_offsets,
4304 dst_descriptor_range_sizes, src_descriptor_range_count, src_descriptor_range_offsets,
4305 src_descriptor_range_sizes, descriptor_heap_type);
4306
4307 if (descriptor_heap_type != D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV
4308 && descriptor_heap_type != D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER)
4309 {
4310 FIXME("Unhandled descriptor heap type %#x.\n", descriptor_heap_type);
4311 return;
4312 }
4313
4314 if (!dst_descriptor_range_count)
4315 return;
4316
4317 dst_range_idx = dst_idx = 0;
4318 src_range_idx = src_idx = 0;
4319 while (dst_range_idx < dst_descriptor_range_count && src_range_idx < src_descriptor_range_count)
4320 {
4321 dst_range_size = dst_descriptor_range_sizes ? dst_descriptor_range_sizes[dst_range_idx] : 1;
4322 src_range_size = src_descriptor_range_sizes ? src_descriptor_range_sizes[src_range_idx] : 1;
4323
4324 dst = d3d12_desc_from_cpu_handle(dst_descriptor_range_offsets[dst_range_idx]);
4326 src = d3d12_desc_from_cpu_handle(src_descriptor_range_offsets[src_range_idx]);
4327
4328 for (; dst_idx < dst_range_size && src_idx < src_range_size; ++dst_idx, ++src_idx)
4329 {
4330 if (dst[dst_idx].s.u.object == src[src_idx].s.u.object)
4331 continue;
4332 d3d12_desc_copy(&dst[dst_idx], &src[src_idx], dst_heap, device);
4333 }
4334
4335 if (dst_idx >= dst_range_size)
4336 {
4337 ++dst_range_idx;
4338 dst_idx = 0;
4339 }
4340 if (src_idx >= src_range_size)
4341 {
4342 ++src_range_idx;
4343 src_idx = 0;
4344 }
4345 }
4346}
@ D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV
Definition: d3d12.idl:1421
@ D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER
Definition: d3d12.idl:1422
GLdouble s
Definition: gl.h:2039
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340
void d3d12_desc_copy(struct d3d12_desc *dst, const struct d3d12_desc *src, struct d3d12_descriptor_heap *dst_heap, struct d3d12_device *device)
Definition: resource.c:2723
static struct d3d12_desc * d3d12_desc_from_cpu_handle(D3D12_CPU_DESCRIPTOR_HANDLE cpu_handle)
static struct d3d12_descriptor_heap * d3d12_desc_get_descriptor_heap(const struct d3d12_desc *descriptor)

Referenced by d3d12_device_CopyDescriptorsSimple().

◆ d3d12_device_CopyDescriptorsSimple()

static void STDMETHODCALLTYPE d3d12_device_CopyDescriptorsSimple ( ID3D12Device9 *  iface,
UINT  descriptor_count,
const D3D12_CPU_DESCRIPTOR_HANDLE  dst_descriptor_range_offset,
const D3D12_CPU_DESCRIPTOR_HANDLE  src_descriptor_range_offset,
D3D12_DESCRIPTOR_HEAP_TYPE  descriptor_heap_type 
)
static

Definition at line 4348 of file device.c.

4352{
4353 TRACE("iface %p, descriptor_count %u, dst_descriptor_range_offset %s, "
4354 "src_descriptor_range_offset %s, descriptor_heap_type %#x.\n",
4355 iface, descriptor_count, debug_cpu_handle(dst_descriptor_range_offset),
4356 debug_cpu_handle(src_descriptor_range_offset), descriptor_heap_type);
4357
4358 d3d12_device_CopyDescriptors(iface, 1, &dst_descriptor_range_offset, &descriptor_count,
4359 1, &src_descriptor_range_offset, &descriptor_count, descriptor_heap_type);
4360}
static void STDMETHODCALLTYPE d3d12_device_CopyDescriptors(ID3D12Device9 *iface, UINT dst_descriptor_range_count, const D3D12_CPU_DESCRIPTOR_HANDLE *dst_descriptor_range_offsets, const UINT *dst_descriptor_range_sizes, UINT src_descriptor_range_count, const D3D12_CPU_DESCRIPTOR_HANDLE *src_descriptor_range_offsets, const UINT *src_descriptor_range_sizes, D3D12_DESCRIPTOR_HEAP_TYPE descriptor_heap_type)
Definition: device.c:4285
const char * debug_cpu_handle(D3D12_CPU_DESCRIPTOR_HANDLE handle)
Definition: utils.c:645

◆ d3d12_device_create()

HRESULT d3d12_device_create ( struct vkd3d_instance *  instance,
const struct vkd3d_device_create_info *  create_info,
struct d3d12_device **  device 
)

Definition at line 5534 of file device.c.

5536{
5537 struct d3d12_device *object;
5538 HRESULT hr;
5539
5540 if (!(object = vkd3d_malloc(sizeof(*object))))
5541 return E_OUTOFMEMORY;
5542
5543 if (FAILED(hr = d3d12_device_init(object, instance, create_info)))
5544 {
5545 vkd3d_free(object);
5546 return hr;
5547 }
5548
5549 TRACE("Created device %p.\n", object);
5550
5551 *device = object;
5552
5553 return S_OK;
5554}
static HINSTANCE instance
Definition: main.c:35
static HRESULT d3d12_device_init(struct d3d12_device *device, struct vkd3d_instance *instance, const struct vkd3d_device_create_info *create_info)
Definition: device.c:5440
static void * vkd3d_malloc(size_t size)
Definition: vkd3d_memory.h:28

Referenced by vkd3d_create_device().

◆ d3d12_device_create_vkd3d_queues()

static HRESULT d3d12_device_create_vkd3d_queues ( struct d3d12_device *  device,
const struct vkd3d_device_queue_info *  queue_info 
)
static

Definition at line 2071 of file device.c.

2073{
2074 uint32_t transfer_family_index = queue_info->family_index[VKD3D_QUEUE_FAMILY_TRANSFER];
2075 uint32_t compute_family_index = queue_info->family_index[VKD3D_QUEUE_FAMILY_COMPUTE];
2076 uint32_t direct_family_index = queue_info->family_index[VKD3D_QUEUE_FAMILY_DIRECT];
2077 HRESULT hr;
2078
2079 device->direct_queue = NULL;
2080 device->compute_queue = NULL;
2081 device->copy_queue = NULL;
2082
2083 device->queue_family_count = 0;
2084 memset(device->queue_family_indices, 0, sizeof(device->queue_family_indices));
2085
2086 if (SUCCEEDED((hr = vkd3d_queue_create(device, direct_family_index,
2087 &queue_info->vk_properties[VKD3D_QUEUE_FAMILY_DIRECT], &device->direct_queue))))
2088 device->queue_family_indices[device->queue_family_count++] = direct_family_index;
2089 else
2090 goto out_destroy_queues;
2091
2092 if (compute_family_index == direct_family_index)
2093 device->compute_queue = device->direct_queue;
2094 else if (SUCCEEDED(hr = vkd3d_queue_create(device, compute_family_index,
2095 &queue_info->vk_properties[VKD3D_QUEUE_FAMILY_COMPUTE], &device->compute_queue)))
2096 device->queue_family_indices[device->queue_family_count++] = compute_family_index;
2097 else
2098 goto out_destroy_queues;
2099
2100 if (transfer_family_index == direct_family_index)
2101 device->copy_queue = device->direct_queue;
2102 else if (transfer_family_index == compute_family_index)
2103 device->copy_queue = device->compute_queue;
2104 else if (SUCCEEDED(hr = vkd3d_queue_create(device, transfer_family_index,
2105 &queue_info->vk_properties[VKD3D_QUEUE_FAMILY_TRANSFER], &device->copy_queue)))
2106 device->queue_family_indices[device->queue_family_count++] = transfer_family_index;
2107 else
2108 goto out_destroy_queues;
2109
2110 device->feature_options3.CopyQueueTimestampQueriesSupported = !!device->copy_queue->timestamp_bits;
2111
2112 return S_OK;
2113
2114out_destroy_queues:
2116 return hr;
2117}
HRESULT vkd3d_queue_create(struct d3d12_device *device, uint32_t family_index, const VkQueueFamilyProperties *properties, struct vkd3d_queue **queue)
Definition: command.c:34
UINT32 uint32_t
Definition: types.h:75
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define memset(x, y, z)
Definition: compat.h:39
static void d3d12_device_destroy_vkd3d_queues(struct d3d12_device *device)
Definition: device.c:2056
VkQueueFamilyProperties vk_properties[VKD3D_QUEUE_FAMILY_COUNT]
Definition: device.c:2050
unsigned int family_index[VKD3D_QUEUE_FAMILY_COUNT]
Definition: device.c:2049

Referenced by vkd3d_create_vk_device().

◆ d3d12_device_CreateCommandAllocator()

static HRESULT STDMETHODCALLTYPE d3d12_device_CreateCommandAllocator ( ID3D12Device9 *  iface,
D3D12_COMMAND_LIST_TYPE  type,
REFIID  riid,
void **  command_allocator 
)
static

Definition at line 3199 of file device.c.

3201{
3204 HRESULT hr;
3205
3206 TRACE("iface %p, type %#x, riid %s, command_allocator %p.\n",
3207 iface, type, debugstr_guid(riid), command_allocator);
3208
3210 return hr;
3211
3212 return return_interface(&object->ID3D12CommandAllocator_iface, &IID_ID3D12CommandAllocator,
3213 riid, command_allocator);
3214}
HRESULT d3d12_command_allocator_create(struct d3d12_device *device, D3D12_COMMAND_LIST_TYPE type, struct d3d12_command_allocator **allocator)
Definition: command.c:1895
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
HRESULT return_interface(void *iface, REFIID iface_iid, REFIID requested_iid, void **object)
Definition: utils.c:628

◆ d3d12_device_CreateCommandList()

static HRESULT STDMETHODCALLTYPE d3d12_device_CreateCommandList ( ID3D12Device9 *  iface,
UINT  node_mask,
D3D12_COMMAND_LIST_TYPE  type,
ID3D12CommandAllocator *  command_allocator,
ID3D12PipelineState *  initial_pipeline_state,
REFIID  riid,
void **  command_list 
)
static

Definition at line 3250 of file device.c.

3253{
3255 struct d3d12_command_list *object;
3256 HRESULT hr;
3257
3258 TRACE("iface %p, node_mask 0x%08x, type %#x, command_allocator %p, "
3259 "initial_pipeline_state %p, riid %s, command_list %p.\n",
3260 iface, node_mask, type, command_allocator,
3261 initial_pipeline_state, debugstr_guid(riid), command_list);
3262
3263 if (FAILED(hr = d3d12_command_list_create(device, node_mask, type, command_allocator,
3264 initial_pipeline_state, &object)))
3265 return hr;
3266
3267 return return_interface(&object->ID3D12GraphicsCommandList6_iface,
3268 &IID_ID3D12GraphicsCommandList6, riid, command_list);
3269}
HRESULT d3d12_command_list_create(struct d3d12_device *device, UINT node_mask, D3D12_COMMAND_LIST_TYPE type, ID3D12CommandAllocator *allocator_iface, ID3D12PipelineState *initial_pipeline_state, struct d3d12_command_list **list)
Definition: command.c:6262

◆ d3d12_device_CreateCommandList1()

static HRESULT STDMETHODCALLTYPE d3d12_device_CreateCommandList1 ( ID3D12Device9 *  iface,
UINT  node_mask,
D3D12_COMMAND_LIST_TYPE  type,
D3D12_COMMAND_LIST_FLAGS  flags,
REFIID  iid,
void **  command_list 
)
static

Definition at line 4952 of file device.c.

4955{
4956 FIXME("iface %p, node_mask 0x%08x, type %#x, flags %#x, iid %s, command_list %p stub!\n",
4957 iface, node_mask, type, flags, debugstr_guid(iid), command_list);
4958
4959 return E_NOTIMPL;
4960}
GLbitfield flags
Definition: glext.h:7161

◆ d3d12_device_CreateCommandQueue()

static HRESULT STDMETHODCALLTYPE d3d12_device_CreateCommandQueue ( ID3D12Device9 *  iface,
const D3D12_COMMAND_QUEUE_DESC *  desc,
REFIID  riid,
void **  command_queue 
)
static

Definition at line 3182 of file device.c.

3184{
3187 HRESULT hr;
3188
3189 TRACE("iface %p, desc %p, riid %s, command_queue %p.\n",
3190 iface, desc, debugstr_guid(riid), command_queue);
3191
3193 return hr;
3194
3195 return return_interface(&object->ID3D12CommandQueue_iface, &IID_ID3D12CommandQueue,
3196 riid, command_queue);
3197}
HRESULT d3d12_command_queue_create(struct d3d12_device *device, const D3D12_COMMAND_QUEUE_DESC *desc, struct d3d12_command_queue **queue)
Definition: command.c:7464

◆ d3d12_device_CreateCommandQueue1()

static HRESULT STDMETHODCALLTYPE d3d12_device_CreateCommandQueue1 ( ID3D12Device9 *  iface,
const D3D12_COMMAND_QUEUE_DESC *  desc,
REFIID  creator_id,
REFIID  iid,
void **  command_queue 
)
static

Definition at line 5296 of file device.c.

5299{
5300 FIXME("iface %p, desc %p, creator %s, iid %s, queue %p stub!\n", iface, desc,
5301 debugstr_guid(creator_id), debugstr_guid(iid), command_queue);
5302
5303 return E_NOTIMPL;
5304}

◆ d3d12_device_CreateCommandSignature()

static HRESULT STDMETHODCALLTYPE d3d12_device_CreateCommandSignature ( ID3D12Device9 *  iface,
const D3D12_COMMAND_SIGNATURE_DESC *  desc,
ID3D12RootSignature *  root_signature,
REFIID  iid,
void **  command_signature 
)
static

Definition at line 4834 of file device.c.

4837{
4840 HRESULT hr;
4841
4842 TRACE("iface %p, desc %p, root_signature %p, iid %s, command_signature %p.\n",
4843 iface, desc, root_signature, debugstr_guid(iid), command_signature);
4844
4846 return hr;
4847
4848 return return_interface(&object->ID3D12CommandSignature_iface,
4849 &IID_ID3D12CommandSignature, iid, command_signature);
4850}
HRESULT d3d12_command_signature_create(struct d3d12_device *device, const D3D12_COMMAND_SIGNATURE_DESC *desc, struct d3d12_command_signature **signature)
Definition: command.c:7635

◆ d3d12_device_CreateCommittedResource()

static HRESULT STDMETHODCALLTYPE d3d12_device_CreateCommittedResource ( ID3D12Device9 *  iface,
const D3D12_HEAP_PROPERTIES *  heap_properties,
D3D12_HEAP_FLAGS  heap_flags,
const D3D12_RESOURCE_DESC *  desc,
D3D12_RESOURCE_STATES  initial_state,
const D3D12_CLEAR_VALUE *  optimized_clear_value,
REFIID  iid,
void **  resource 
)
static

Definition at line 4537 of file device.c.

4541{
4543 D3D12_RESOURCE_DESC1 resource_desc;
4544 struct d3d12_resource *object;
4545 HRESULT hr;
4546
4547 TRACE("iface %p, heap_properties %p, heap_flags %#x, desc %p, initial_state %#x, "
4548 "optimized_clear_value %p, iid %s, resource %p.\n",
4549 iface, heap_properties, heap_flags, desc, initial_state,
4550 optimized_clear_value, debugstr_guid(iid), resource);
4551
4552 d3d12_resource_desc1_from_desc(&resource_desc, desc);
4553
4554 if (FAILED(hr = d3d12_committed_resource_create(device, heap_properties, heap_flags,
4555 &resource_desc, initial_state, optimized_clear_value, NULL, &object)))
4556 {
4557 *resource = NULL;
4558 return hr;
4559 }
4560
4561 return return_interface(&object->ID3D12Resource2_iface, &IID_ID3D12Resource2, iid, resource);
4562}
HRESULT d3d12_committed_resource_create(struct d3d12_device *device, const D3D12_HEAP_PROPERTIES *heap_properties, D3D12_HEAP_FLAGS heap_flags, const D3D12_RESOURCE_DESC1 *desc, D3D12_RESOURCE_STATES initial_state, const D3D12_CLEAR_VALUE *optimized_clear_value, ID3D12ProtectedResourceSession *protected_session, struct d3d12_resource **resource)
Definition: resource.c:2112
D3D12_RESOURCE_STATES initial_state
static void d3d12_resource_desc1_from_desc(D3D12_RESOURCE_DESC1 *desc1, const D3D12_RESOURCE_DESC *desc)

◆ d3d12_device_CreateCommittedResource1()

static HRESULT STDMETHODCALLTYPE d3d12_device_CreateCommittedResource1 ( ID3D12Device9 *  iface,
const D3D12_HEAP_PROPERTIES *  heap_properties,
D3D12_HEAP_FLAGS  heap_flags,
const D3D12_RESOURCE_DESC *  desc,
D3D12_RESOURCE_STATES  initial_state,
const D3D12_CLEAR_VALUE *  optimized_clear_value,
ID3D12ProtectedResourceSession *  protected_session,
REFIID  iid,
void **  resource 
)
static

Definition at line 4970 of file device.c.

4975{
4977 D3D12_RESOURCE_DESC1 resource_desc;
4978 struct d3d12_resource *object;
4979 HRESULT hr;
4980
4981 TRACE("iface %p, heap_properties %p, heap_flags %#x, desc %p, initial_state %#x, "
4982 "optimized_clear_value %p, protected_session %p, iid %s, resource %p.\n",
4983 iface, heap_properties, heap_flags, desc, initial_state,
4984 optimized_clear_value, protected_session, debugstr_guid(iid), resource);
4985
4986 d3d12_resource_desc1_from_desc(&resource_desc, desc);
4987
4988 if (FAILED(hr = d3d12_committed_resource_create(device, heap_properties, heap_flags,
4989 &resource_desc, initial_state, optimized_clear_value, protected_session, &object)))
4990 {
4991 *resource = NULL;
4992 return hr;
4993 }
4994
4995 return return_interface(&object->ID3D12Resource2_iface, &IID_ID3D12Resource2, iid, resource);
4996}

◆ d3d12_device_CreateCommittedResource2()

static HRESULT STDMETHODCALLTYPE d3d12_device_CreateCommittedResource2 ( ID3D12Device9 *  iface,
const D3D12_HEAP_PROPERTIES *  heap_properties,
D3D12_HEAP_FLAGS  heap_flags,
const D3D12_RESOURCE_DESC1 *  desc,
D3D12_RESOURCE_STATES  initial_state,
const D3D12_CLEAR_VALUE *  optimized_clear_value,
ID3D12ProtectedResourceSession *  protected_session,
REFIID  iid,
void **  resource 
)
static

Definition at line 5162 of file device.c.

5166{
5168 struct d3d12_resource *object;
5169 HRESULT hr;
5170
5171 TRACE("iface %p, heap_properties %p, heap_flags %#x, desc %p, initial_state %#x, "
5172 "optimized_clear_value %p, protected_session %p, iid %s, resource %p.\n",
5173 iface, heap_properties, heap_flags, desc, initial_state,
5174 optimized_clear_value, protected_session, debugstr_guid(iid), resource);
5175
5176 if (FAILED(hr = d3d12_committed_resource_create(device, heap_properties, heap_flags,
5177 desc, initial_state, optimized_clear_value, protected_session, &object)))
5178 {
5179 *resource = NULL;
5180 return hr;
5181 }
5182
5183 return return_interface(&object->ID3D12Resource2_iface, &IID_ID3D12Resource2, iid, resource);
5184}

◆ d3d12_device_CreateComputePipelineState()

static HRESULT STDMETHODCALLTYPE d3d12_device_CreateComputePipelineState ( ID3D12Device9 *  iface,
const D3D12_COMPUTE_PIPELINE_STATE_DESC *  desc,
REFIID  riid,
void **  pipeline_state 
)
static

Definition at line 3233 of file device.c.

3235{
3238 HRESULT hr;
3239
3240 TRACE("iface %p, desc %p, riid %s, pipeline_state %p.\n",
3241 iface, desc, debugstr_guid(riid), pipeline_state);
3242
3244 return hr;
3245
3246 return return_interface(&object->ID3D12PipelineState_iface,
3247 &IID_ID3D12PipelineState, riid, pipeline_state);
3248}
HRESULT d3d12_pipeline_state_create_compute(struct d3d12_device *device, const D3D12_COMPUTE_PIPELINE_STATE_DESC *desc, struct d3d12_pipeline_state **state)
Definition: state.c:2621

◆ d3d12_device_CreateConstantBufferView()

static void STDMETHODCALLTYPE d3d12_device_CreateConstantBufferView ( ID3D12Device9 *  iface,
const D3D12_CONSTANT_BUFFER_VIEW_DESC *  desc,
D3D12_CPU_DESCRIPTOR_HANDLE  descriptor 
)
static

Definition at line 4210 of file device.c.

4212{
4214 struct d3d12_desc tmp = {0};
4215
4216 TRACE("iface %p, desc %p, descriptor %s.\n", iface, desc, debug_cpu_handle(descriptor));
4217
4220}
descriptor
Definition: scsi.h:3997
void d3d12_desc_create_cbv(struct d3d12_desc *descriptor, struct d3d12_device *device, const D3D12_CONSTANT_BUFFER_VIEW_DESC *desc)
Definition: resource.c:3140
void d3d12_desc_write_atomic(struct d3d12_desc *dst, const struct d3d12_desc *src, struct d3d12_device *device)
Definition: resource.c:2710

◆ d3d12_device_CreateDepthStencilView()

static void STDMETHODCALLTYPE d3d12_device_CreateDepthStencilView ( ID3D12Device9 *  iface,
ID3D12Resource *  resource,
const D3D12_DEPTH_STENCIL_VIEW_DESC *  desc,
D3D12_CPU_DESCRIPTOR_HANDLE  descriptor 
)
static

Definition at line 4262 of file device.c.

4265{
4266 TRACE("iface %p, resource %p, desc %p, descriptor %s.\n",
4268
4271}
void d3d12_dsv_desc_create_dsv(struct d3d12_dsv_desc *dsv_desc, struct d3d12_device *device, struct d3d12_resource *resource, const D3D12_DEPTH_STENCIL_VIEW_DESC *desc)
Definition: resource.c:3931
struct d3d12_resource * unsafe_impl_from_ID3D12Resource(ID3D12Resource *iface)
Definition: resource.c:1770
static struct d3d12_dsv_desc * d3d12_dsv_desc_from_cpu_handle(D3D12_CPU_DESCRIPTOR_HANDLE cpu_handle)

◆ d3d12_device_CreateDescriptorHeap()

static HRESULT STDMETHODCALLTYPE d3d12_device_CreateDescriptorHeap ( ID3D12Device9 *  iface,
const D3D12_DESCRIPTOR_HEAP_DESC *  desc,
REFIID  riid,
void **  descriptor_heap 
)
static

Definition at line 4150 of file device.c.

4152{
4155 HRESULT hr;
4156
4157 TRACE("iface %p, desc %p, riid %s, descriptor_heap %p.\n",
4158 iface, desc, debugstr_guid(riid), descriptor_heap);
4159
4161 return hr;
4162
4163 return return_interface(&object->ID3D12DescriptorHeap_iface,
4164 &IID_ID3D12DescriptorHeap, riid, descriptor_heap);
4165}
HRESULT d3d12_descriptor_heap_create(struct d3d12_device *device, const D3D12_DESCRIPTOR_HEAP_DESC *desc, struct d3d12_descriptor_heap **descriptor_heap)
Definition: resource.c:4366

◆ d3d12_device_CreateFence()

static HRESULT STDMETHODCALLTYPE d3d12_device_CreateFence ( ID3D12Device9 *  iface,
UINT64  initial_value,
D3D12_FENCE_FLAGS  flags,
REFIID  riid,
void **  fence 
)
static

Definition at line 4689 of file device.c.

4691{
4693 struct d3d12_fence *object;
4694 HRESULT hr;
4695
4696 TRACE("iface %p, initial_value %#"PRIx64", flags %#x, riid %s, fence %p.\n",
4697 iface, initial_value, flags, debugstr_guid(riid), fence);
4698
4699 if (FAILED(hr = d3d12_fence_create(device, initial_value, flags, &object)))
4700 return hr;
4701
4702 return return_interface(&object->ID3D12Fence1_iface, &IID_ID3D12Fence1, riid, fence);
4703}
HRESULT d3d12_fence_create(struct d3d12_device *device, uint64_t initial_value, D3D12_FENCE_FLAGS flags, struct d3d12_fence **fence)
Definition: command.c:1222
#define PRIx64
Definition: inttypes.h:29

◆ d3d12_device_CreateGraphicsPipelineState()

static HRESULT STDMETHODCALLTYPE d3d12_device_CreateGraphicsPipelineState ( ID3D12Device9 *  iface,
const D3D12_GRAPHICS_PIPELINE_STATE_DESC *  desc,
REFIID  riid,
void **  pipeline_state 
)
static

Definition at line 3216 of file device.c.

3218{
3221 HRESULT hr;
3222
3223 TRACE("iface %p, desc %p, riid %s, pipeline_state %p.\n",
3224 iface, desc, debugstr_guid(riid), pipeline_state);
3225
3227 return hr;
3228
3229 return return_interface(&object->ID3D12PipelineState_iface,
3230 &IID_ID3D12PipelineState, riid, pipeline_state);
3231}
HRESULT d3d12_pipeline_state_create_graphics(struct d3d12_device *device, const D3D12_GRAPHICS_PIPELINE_STATE_DESC *desc, struct d3d12_pipeline_state **state)
Definition: state.c:3630

◆ d3d12_device_CreateHeap()

static HRESULT STDMETHODCALLTYPE d3d12_device_CreateHeap ( ID3D12Device9 *  iface,
const D3D12_HEAP_DESC *  desc,
REFIID  iid,
void **  heap 
)
static

Definition at line 4564 of file device.c.

4566{
4568 struct d3d12_heap *object;
4569 HRESULT hr;
4570
4571 TRACE("iface %p, desc %p, iid %s, heap %p.\n",
4572 iface, desc, debugstr_guid(iid), heap);
4573
4574 if (FAILED(hr = d3d12_heap_create(device, desc, NULL, NULL, &object)))
4575 {
4576 *heap = NULL;
4577 return hr;
4578 }
4579
4580 return return_interface(&object->ID3D12Heap_iface, &IID_ID3D12Heap, iid, heap);
4581}
HRESULT d3d12_heap_create(struct d3d12_device *device, const D3D12_HEAP_DESC *desc, const struct d3d12_resource *resource, ID3D12ProtectedResourceSession *protected_session, struct d3d12_heap **heap)
Definition: resource.c:576

◆ d3d12_device_CreateHeap1()

static HRESULT STDMETHODCALLTYPE d3d12_device_CreateHeap1 ( ID3D12Device9 *  iface,
const D3D12_HEAP_DESC *  desc,
ID3D12ProtectedResourceSession *  protected_session,
REFIID  iid,
void **  heap 
)
static

Definition at line 4998 of file device.c.

5001{
5003 struct d3d12_heap *object;
5004 HRESULT hr;
5005
5006 TRACE("iface %p, desc %p, protected_session %p, iid %s, heap %p.\n",
5007 iface, desc, protected_session, debugstr_guid(iid), heap);
5008
5009 if (FAILED(hr = d3d12_heap_create(device, desc, NULL, protected_session, &object)))
5010 {
5011 *heap = NULL;
5012 return hr;
5013 }
5014
5015 return return_interface(&object->ID3D12Heap_iface, &IID_ID3D12Heap, iid, heap);
5016}

◆ d3d12_device_CreateLifetimeTracker()

static HRESULT STDMETHODCALLTYPE d3d12_device_CreateLifetimeTracker ( ID3D12Device9 *  iface,
ID3D12LifetimeOwner *  owner,
REFIID  iid,
void **  tracker 
)
static

Definition at line 5048 of file device.c.

5050{
5051 FIXME("iface %p, owner %p, iid %s, tracker %p stub!\n", iface, owner, debugstr_guid(iid), tracker);
5052
5053 return E_NOTIMPL;
5054}

◆ d3d12_device_CreateMetaCommand()

static HRESULT STDMETHODCALLTYPE d3d12_device_CreateMetaCommand ( ID3D12Device9 *  iface,
REFGUID  command_id,
UINT  node_mask,
const void *  parameters_data,
SIZE_T  data_size_in_bytes,
REFIID  iid,
void **  meta_command 
)
static

Definition at line 5082 of file device.c.

5085{
5086 FIXME("iface %p, command_id %s, node_mask %#x, parameters_data %p, "
5087 "data_size_in_bytes %"PRIuPTR", iid %s, meta_command %p stub!\n", iface,
5088 debugstr_guid(command_id), node_mask, parameters_data,
5089 (uintptr_t)data_size_in_bytes, debugstr_guid(iid), meta_command);
5090
5091 return E_NOTIMPL;
5092}
unsigned int uintptr_t
Definition: corecrt.h:185
#define PRIuPTR
Definition: inttypes.h:226

◆ d3d12_device_CreatePipelineLibrary()

static HRESULT STDMETHODCALLTYPE d3d12_device_CreatePipelineLibrary ( ID3D12Device9 *  iface,
const void *  blob,
SIZE_T  blob_size,
REFIID  iid,
void **  lib 
)
static

Definition at line 4883 of file device.c.

4885{
4886 FIXME("iface %p, blob %p, blob_size %"PRIuPTR", iid %s, lib %p stub!\n",
4887 iface, blob, (uintptr_t)blob_size, debugstr_guid(iid), lib);
4888
4890}
UINT blob_size
Definition: effect.c:1153
Definition: image.c:229
#define DXGI_ERROR_UNSUPPORTED
Definition: winerror.h:7125

◆ d3d12_device_CreatePipelineState()

static HRESULT STDMETHODCALLTYPE d3d12_device_CreatePipelineState ( ID3D12Device9 *  iface,
const D3D12_PIPELINE_STATE_STREAM_DESC *  desc,
REFIID  iid,
void **  pipeline_state 
)
static

Definition at line 4910 of file device.c.

4912{
4915 HRESULT hr;
4916
4917 TRACE("iface %p, desc %p, iid %s, pipeline_state %p.\n", iface, desc, debugstr_guid(iid), pipeline_state);
4918
4920 return hr;
4921
4922 return return_interface(&object->ID3D12PipelineState_iface, &IID_ID3D12PipelineState, iid, pipeline_state);
4923}
HRESULT d3d12_pipeline_state_create(struct d3d12_device *device, const D3D12_PIPELINE_STATE_STREAM_DESC *desc, struct d3d12_pipeline_state **state)
Definition: state.c:3655

◆ d3d12_device_CreatePlacedResource()

static HRESULT STDMETHODCALLTYPE d3d12_device_CreatePlacedResource ( ID3D12Device9 *  iface,
ID3D12Heap *  heap,
UINT64  heap_offset,
const D3D12_RESOURCE_DESC *  desc,
D3D12_RESOURCE_STATES  initial_state,
const D3D12_CLEAR_VALUE *  optimized_clear_value,
REFIID  iid,
void **  resource 
)
static

Definition at line 4583 of file device.c.

4587{
4589 D3D12_RESOURCE_DESC1 resource_desc;
4590 struct d3d12_heap *heap_object;
4591 struct d3d12_resource *object;
4592 HRESULT hr;
4593
4594 TRACE("iface %p, heap %p, heap_offset %#"PRIx64", desc %p, initial_state %#x, "
4595 "optimized_clear_value %p, iid %s, resource %p.\n",
4597 optimized_clear_value, debugstr_guid(iid), resource);
4598
4599 heap_object = unsafe_impl_from_ID3D12Heap(heap);
4600 d3d12_resource_desc1_from_desc(&resource_desc, desc);
4601
4603 &resource_desc, initial_state, optimized_clear_value, &object)))
4604 return hr;
4605
4606 return return_interface(&object->ID3D12Resource2_iface, &IID_ID3D12Resource2, iid, resource);
4607}
struct d3d12_heap * unsafe_impl_from_ID3D12Heap(ID3D12Heap *iface)
Definition: resource.c:442
HRESULT d3d12_placed_resource_create(struct d3d12_device *device, struct d3d12_heap *heap, uint64_t heap_offset, const D3D12_RESOURCE_DESC1 *desc, D3D12_RESOURCE_STATES initial_state, const D3D12_CLEAR_VALUE *optimized_clear_value, struct d3d12_resource **resource)
Definition: resource.c:2216
uint64_t heap_offset

◆ d3d12_device_CreatePlacedResource1()

static HRESULT STDMETHODCALLTYPE d3d12_device_CreatePlacedResource1 ( ID3D12Device9 *  iface,
ID3D12Heap *  heap,
UINT64  heap_offset,
const D3D12_RESOURCE_DESC1 *  resource_desc,
D3D12_RESOURCE_STATES  initial_state,
const D3D12_CLEAR_VALUE *  optimized_clear_value,
REFIID  iid,
void **  resource 
)
static

Definition at line 5186 of file device.c.

5190{
5192 struct d3d12_heap *heap_object;
5193 struct d3d12_resource *object;
5194 HRESULT hr;
5195
5196 TRACE("iface %p, heap %p, heap_offset %#"PRIx64", desc %p, initial_state %#x, "
5197 "optimized_clear_value %p, iid %s, resource %p.\n",
5198 iface, heap, heap_offset, resource_desc, initial_state,
5199 optimized_clear_value, debugstr_guid(iid), resource);
5200
5201 heap_object = unsafe_impl_from_ID3D12Heap(heap);
5202
5204 resource_desc, initial_state, optimized_clear_value, &object)))
5205 return hr;
5206
5207 return return_interface(&object->ID3D12Resource2_iface, &IID_ID3D12Resource2, iid, resource);
5208}

◆ d3d12_device_CreateProtectedResourceSession()

static HRESULT STDMETHODCALLTYPE d3d12_device_CreateProtectedResourceSession ( ID3D12Device9 *  iface,
const D3D12_PROTECTED_RESOURCE_SESSION_DESC *  desc,
REFIID  iid,
void **  session 
)
static

Definition at line 4962 of file device.c.

4964{
4965 FIXME("iface %p, desc %p, iid %s, session %p stub!\n", iface, desc, debugstr_guid(iid), session);
4966
4967 return E_NOTIMPL;
4968}

◆ d3d12_device_CreateProtectedResourceSession1()

static HRESULT STDMETHODCALLTYPE d3d12_device_CreateProtectedResourceSession1 ( ID3D12Device9 *  iface,
const D3D12_PROTECTED_RESOURCE_SESSION_DESC1 *  desc,
REFIID  riid,
void **  session 
)
static

Definition at line 5138 of file device.c.

5140{
5141 FIXME("iface %p, desc %p, riid %s, session %p stub!\n", iface, desc, debugstr_guid(riid), session);
5142
5143 return E_NOTIMPL;
5144}

◆ d3d12_device_CreateQueryHeap()

static HRESULT STDMETHODCALLTYPE d3d12_device_CreateQueryHeap ( ID3D12Device9 *  iface,
const D3D12_QUERY_HEAP_DESC *  desc,
REFIID  iid,
void **  heap 
)
static

Definition at line 4811 of file device.c.

4813{
4815 struct d3d12_query_heap *object;
4816 HRESULT hr;
4817
4818 TRACE("iface %p, desc %p, iid %s, heap %p.\n",
4819 iface, desc, debugstr_guid(iid), heap);
4820
4821 if (FAILED(hr = d3d12_query_heap_create(device, desc, &object)))
4822 return hr;
4823
4824 return return_interface(&object->ID3D12QueryHeap_iface, &IID_ID3D12QueryHeap, iid, heap);
4825}
HRESULT d3d12_query_heap_create(struct d3d12_device *device, const D3D12_QUERY_HEAP_DESC *desc, struct d3d12_query_heap **heap)
Definition: resource.c:4568

◆ d3d12_device_CreateRenderTargetView()

static void STDMETHODCALLTYPE d3d12_device_CreateRenderTargetView ( ID3D12Device9 *  iface,
ID3D12Resource *  resource,
const D3D12_RENDER_TARGET_VIEW_DESC *  desc,
D3D12_CPU_DESCRIPTOR_HANDLE  descriptor 
)
static

Definition at line 4251 of file device.c.

4254{
4255 TRACE("iface %p, resource %p, desc %p, descriptor %s.\n",
4257
4260}
void d3d12_rtv_desc_create_rtv(struct d3d12_rtv_desc *rtv_desc, struct d3d12_device *device, struct d3d12_resource *resource, const D3D12_RENDER_TARGET_VIEW_DESC *desc)
Definition: resource.c:3835
static struct d3d12_rtv_desc * d3d12_rtv_desc_from_cpu_handle(D3D12_CPU_DESCRIPTOR_HANDLE cpu_handle)

◆ d3d12_device_CreateReservedResource()

static HRESULT STDMETHODCALLTYPE d3d12_device_CreateReservedResource ( ID3D12Device9 *  iface,
const D3D12_RESOURCE_DESC *  desc,
D3D12_RESOURCE_STATES  initial_state,
const D3D12_CLEAR_VALUE *  optimized_clear_value,
REFIID  iid,
void **  resource 
)
static

Definition at line 4609 of file device.c.

4612{
4614 D3D12_RESOURCE_DESC1 resource_desc;
4615 struct d3d12_resource *object;
4616 HRESULT hr;
4617
4618 TRACE("iface %p, desc %p, initial_state %#x, optimized_clear_value %p, iid %s, resource %p.\n",
4619 iface, desc, initial_state, optimized_clear_value, debugstr_guid(iid), resource);
4620
4621 d3d12_resource_desc1_from_desc(&resource_desc, desc);
4622
4624 &resource_desc, initial_state, optimized_clear_value, &object)))
4625 return hr;
4626
4627 return return_interface(&object->ID3D12Resource2_iface, &IID_ID3D12Resource2, iid, resource);
4628}
HRESULT d3d12_reserved_resource_create(struct d3d12_device *device, const D3D12_RESOURCE_DESC1 *desc, D3D12_RESOURCE_STATES initial_state, const D3D12_CLEAR_VALUE *optimized_clear_value, struct d3d12_resource **resource)
Definition: resource.c:2240

◆ d3d12_device_CreateReservedResource1()

static HRESULT STDMETHODCALLTYPE d3d12_device_CreateReservedResource1 ( ID3D12Device9 *  iface,
const D3D12_RESOURCE_DESC *  desc,
D3D12_RESOURCE_STATES  initial_state,
const D3D12_CLEAR_VALUE *  optimized_clear_value,
ID3D12ProtectedResourceSession *  protected_session,
REFIID  iid,
void **  resource 
)
static

Definition at line 5018 of file device.c.

5022{
5023 FIXME("iface %p, desc %p, initial_state %#x, optimized_clear_value %p, "
5024 "protected_session %p, iid %s, resource %p stub!\n",
5025 iface, desc, initial_state, optimized_clear_value, protected_session,
5026 debugstr_guid(iid), resource);
5027
5028 return E_NOTIMPL;
5029}

◆ d3d12_device_CreateRootSignature()

static HRESULT STDMETHODCALLTYPE d3d12_device_CreateRootSignature ( ID3D12Device9 *  iface,
UINT  node_mask,
const void *  bytecode,
SIZE_T  bytecode_length,
REFIID  riid,
void **  root_signature 
)
static

Definition at line 4190 of file device.c.

4193{
4196 HRESULT hr;
4197
4198 TRACE("iface %p, node_mask 0x%08x, bytecode %p, bytecode_length %"PRIuPTR", riid %s, root_signature %p.\n",
4199 iface, node_mask, bytecode, (uintptr_t)bytecode_length, debugstr_guid(riid), root_signature);
4200
4201 debug_ignored_node_mask(node_mask);
4202
4203 if (FAILED(hr = d3d12_root_signature_create(device, bytecode, bytecode_length, &object)))
4204 return hr;
4205
4206 return return_interface(&object->ID3D12RootSignature_iface,
4207 &IID_ID3D12RootSignature, riid, root_signature);
4208}
HRESULT d3d12_root_signature_create(struct d3d12_device *device, const void *bytecode, size_t bytecode_length, struct d3d12_root_signature **root_signature)
Definition: state.c:1630
static void debug_ignored_node_mask(unsigned int mask)

◆ d3d12_device_CreateSampler()

static void STDMETHODCALLTYPE d3d12_device_CreateSampler ( ID3D12Device9 *  iface,
const D3D12_SAMPLER_DESC *  desc,
D3D12_CPU_DESCRIPTOR_HANDLE  descriptor 
)
static

Definition at line 4273 of file device.c.

4275{
4277 struct d3d12_desc tmp = {0};
4278
4279 TRACE("iface %p, desc %p, descriptor %s.\n", iface, desc, debug_cpu_handle(descriptor));
4280
4283}
void d3d12_desc_create_sampler(struct d3d12_desc *sampler, struct d3d12_device *device, const D3D12_SAMPLER_DESC *desc)
Definition: resource.c:3780

◆ d3d12_device_CreateSamplerFeedbackUnorderedAccessView()

static void STDMETHODCALLTYPE d3d12_device_CreateSamplerFeedbackUnorderedAccessView ( ID3D12Device9 *  iface,
ID3D12Resource *  target_resource,
ID3D12Resource *  feedback_resource,
D3D12_CPU_DESCRIPTOR_HANDLE  descriptor 
)
static

Definition at line 5210 of file device.c.

5212{
5213 FIXME("iface %p, target_resource %p, feedback_resource %p, descriptor %s stub!\n",
5214 iface, target_resource, feedback_resource, debug_cpu_handle(descriptor));
5215}

◆ d3d12_device_CreateShaderCacheSession()

static HRESULT STDMETHODCALLTYPE d3d12_device_CreateShaderCacheSession ( ID3D12Device9 *  iface,
const D3D12_SHADER_CACHE_SESSION_DESC *  desc,
REFIID  iid,
void **  session 
)
static

Definition at line 5233 of file device.c.

5235{
5238 static const GUID guid_null = {0};
5239 HRESULT hr;
5240
5241 static const UINT valid_flags = D3D12_SHADER_CACHE_FLAG_DRIVER_VERSIONED
5243
5244 TRACE("iface %p, desc %p, iid %s, session %p.\n", iface, desc, debugstr_guid(iid), session);
5245
5246 if (!desc || !memcmp(&desc->Identifier, &guid_null, sizeof(desc->Identifier)))
5247 {
5248 WARN("No description or identifier, returning E_INVALIDARG.\n");
5249 return E_INVALIDARG;
5250 }
5251 if (desc->MaximumValueFileSizeBytes > 1024 * 1024 * 1024)
5252 {
5253 WARN("Requested size is larger than 1GiB, returning E_INVALIDARG.\n");
5254 return E_INVALIDARG;
5255 }
5256 if (desc->Flags & ~valid_flags)
5257 {
5258 WARN("Invalid flags %#x, returning E_INVALIDARG.\n", desc->Flags);
5259 return E_INVALIDARG;
5260 }
5261 if (desc->Mode != D3D12_SHADER_CACHE_MODE_MEMORY && desc->Mode != D3D12_SHADER_CACHE_MODE_DISK)
5262 {
5263 WARN("Invalid mode %#x, returning E_INVALIDARG.\n", desc->Mode);
5264 return E_INVALIDARG;
5265 }
5266 if (!session)
5267 {
5268 WARN("No output pointer, returning S_FALSE.\n");
5269 return S_FALSE;
5270 }
5271 *session = NULL;
5272
5273 if (!(object = vkd3d_malloc(sizeof(*object))))
5274 return E_OUTOFMEMORY;
5275
5276 if (FAILED(hr = d3d12_cache_session_init(object, device, desc)))
5277 {
5278 vkd3d_free(object);
5279 return hr;
5280 }
5281
5282 hr = ID3D12ShaderCacheSession_QueryInterface(&object->ID3D12ShaderCacheSession_iface, iid,
5283 session);
5284 ID3D12ShaderCacheSession_Release(&object->ID3D12ShaderCacheSession_iface);
5285 return hr;
5286}
@ D3D12_SHADER_CACHE_FLAG_USE_WORKING_DIR
Definition: d3d12.idl:4703
@ D3D12_SHADER_CACHE_FLAG_DRIVER_VERSIONED
Definition: d3d12.idl:4702
unsigned int UINT
Definition: sysinfo.c:13
static HRESULT d3d12_cache_session_init(struct d3d12_cache_session *session, struct d3d12_device *device, const D3D12_SHADER_CACHE_SESSION_DESC *desc)
Definition: device.c:2953
#define S_FALSE
Definition: winerror.h:3451

◆ d3d12_device_CreateShaderResourceView()

static void STDMETHODCALLTYPE d3d12_device_CreateShaderResourceView ( ID3D12Device9 *  iface,
ID3D12Resource *  resource,
const D3D12_SHADER_RESOURCE_VIEW_DESC *  desc,
D3D12_CPU_DESCRIPTOR_HANDLE  descriptor 
)
static

Definition at line 4222 of file device.c.

4225{
4227 struct d3d12_desc tmp = {0};
4228
4229 TRACE("iface %p, resource %p, desc %p, descriptor %s.\n",
4231
4234}
void d3d12_desc_create_srv(struct d3d12_desc *descriptor, struct d3d12_device *device, struct d3d12_resource *resource, const D3D12_SHADER_RESOURCE_VIEW_DESC *desc)
Definition: resource.c:3302

◆ d3d12_device_CreateSharedHandle()

static HRESULT STDMETHODCALLTYPE d3d12_device_CreateSharedHandle ( ID3D12Device9 *  iface,
ID3D12DeviceChild *  object,
const SECURITY_ATTRIBUTES *  attributes,
DWORD  access,
const WCHAR *  name,
HANDLE *  handle 
)
static

Definition at line 4630 of file device.c.

4633{
4635
4636 FIXME("iface %p, object %p, attributes %p, access %#x, name %s, handle %p stub!\n",
4637 iface, object, attributes, (uint32_t)access, debugstr_w(name, device->wchar_size), handle);
4638
4639 return E_NOTIMPL;
4640}
GLuint GLint GLboolean GLint GLenum access
Definition: glext.h:7866
static HANDLE ACCESS_MASK ULONG attributes
Definition: om.c:94

◆ d3d12_device_CreateStateObject()

static HRESULT STDMETHODCALLTYPE d3d12_device_CreateStateObject ( ID3D12Device9 *  iface,
const D3D12_STATE_OBJECT_DESC *  desc,
REFIID  iid,
void **  state_object 
)
static

Definition at line 5094 of file device.c.

5096{
5097 FIXME("iface %p, desc %p, iid %s, state_object %p stub!\n", iface, desc, debugstr_guid(iid), state_object);
5098
5099 return E_NOTIMPL;
5100}

◆ d3d12_device_CreateUnorderedAccessView()

static void STDMETHODCALLTYPE d3d12_device_CreateUnorderedAccessView ( ID3D12Device9 *  iface,
ID3D12Resource *  resource,
ID3D12Resource *  counter_resource,
const D3D12_UNORDERED_ACCESS_VIEW_DESC *  desc,
D3D12_CPU_DESCRIPTOR_HANDLE  descriptor 
)
static

Definition at line 4236 of file device.c.

4239{
4241 struct d3d12_desc tmp = {0};
4242
4243 TRACE("iface %p, resource %p, counter_resource %p, desc %p, descriptor %s.\n",
4244 iface, resource, counter_resource, desc, debug_cpu_handle(descriptor));
4245
4247 unsafe_impl_from_ID3D12Resource(counter_resource), desc);
4249}
void d3d12_desc_create_uav(struct d3d12_desc *descriptor, struct d3d12_device *device, struct d3d12_resource *resource, struct d3d12_resource *counter_resource, const D3D12_UNORDERED_ACCESS_VIEW_DESC *desc)
Definition: resource.c:3589

◆ d3d12_device_destroy_pipeline_cache()

static void d3d12_device_destroy_pipeline_cache ( struct d3d12_device *  device)
static

Definition at line 2354 of file device.c.

2355{
2356 const struct vkd3d_vk_device_procs *vk_procs = &device->vk_procs;
2357
2358 if (device->vk_pipeline_cache)
2359 VK_CALL(vkDestroyPipelineCache(device->vk_device, device->vk_pipeline_cache, NULL));
2360
2361 vkd3d_mutex_destroy(&device->pipeline_cache_mutex);
2362}
static void vkd3d_mutex_destroy(struct vkd3d_mutex *lock)
Definition: vkd3d_common.h:596
void VKAPI_CALL vkDestroyPipelineCache(VkDevice device, VkPipelineCache pipelineCache, const VkAllocationCallbacks *pAllocator)

Referenced by d3d12_device_init(), and d3d12_device_Release().

◆ d3d12_device_destroy_vkd3d_queues()

static void d3d12_device_destroy_vkd3d_queues ( struct d3d12_device *  device)
static

Definition at line 2056 of file device.c.

2057{
2058 if (device->direct_queue)
2059 vkd3d_queue_destroy(device->direct_queue, device);
2060 if (device->compute_queue && device->compute_queue != device->direct_queue)
2061 vkd3d_queue_destroy(device->compute_queue, device);
2062 if (device->copy_queue && device->copy_queue != device->direct_queue
2063 && device->copy_queue != device->compute_queue)
2064 vkd3d_queue_destroy(device->copy_queue, device);
2065
2066 device->direct_queue = NULL;
2067 device->compute_queue = NULL;
2068 device->copy_queue = NULL;
2069}
void vkd3d_queue_destroy(struct vkd3d_queue *queue, struct d3d12_device *device)
Definition: command.c:67

Referenced by d3d12_device_create_vkd3d_queues(), and d3d12_device_Release().

◆ d3d12_device_EnqueueMakeResident()

static HRESULT STDMETHODCALLTYPE d3d12_device_EnqueueMakeResident ( ID3D12Device9 *  iface,
D3D12_RESIDENCY_FLAGS  flags,
UINT  num_objects,
ID3D12Pageable *const *  objects,
ID3D12Fence *  fence,
UINT64  fence_value 
)
static

Definition at line 4941 of file device.c.

4944{
4945 FIXME_ONCE("iface %p, flags %#x, num_objects %u, objects %p, fence %p, fence_value %#"PRIx64" stub!\n",
4946 iface, flags, num_objects, objects, fence, fence_value);
4947
4948 ID3D12Fence_Signal(fence, fence_value);
4949 return S_OK;
4950}
static const CLSID * objects[]
Definition: apphelp.c:112
#define FIXME_ONCE
Definition: vkd3d_common.h:228

◆ d3d12_device_EnumerateMetaCommandParameters()

static HRESULT STDMETHODCALLTYPE d3d12_device_EnumerateMetaCommandParameters ( ID3D12Device9 *  iface,
REFGUID  command_id,
D3D12_META_COMMAND_PARAMETER_STAGE  stage,
UINT *  size_in_bytes,
UINT *  parameter_count,
D3D12_META_COMMAND_PARAMETER_DESC *  parameter_desc 
)
static

Definition at line 5070 of file device.c.

5074{
5075 FIXME("iface %p, command_id %s, stage %u, size_in_bytes %p, "
5076 "parameter_count %p, parameter_desc %p stub!\n", iface,
5077 debugstr_guid(command_id), stage, size_in_bytes, parameter_count, parameter_desc);
5078
5079 return E_NOTIMPL;
5080}

◆ d3d12_device_EnumerateMetaCommands()

static HRESULT STDMETHODCALLTYPE d3d12_device_EnumerateMetaCommands ( ID3D12Device9 *  iface,
UINT *  num_meta_commands,
D3D12_META_COMMAND_DESC *  command_desc 
)
static

Definition at line 5061 of file device.c.

5063{
5064 FIXME("iface %p, num_meta_commands %p, command_desc %p stub!\n", iface,
5065 num_meta_commands, command_desc);
5066
5067 return E_NOTIMPL;
5068}

◆ d3d12_device_environment_is_vulkan_min_1_1()

static bool d3d12_device_environment_is_vulkan_min_1_1 ( struct d3d12_device *  device)
static

Definition at line 808 of file device.c.

809{
811}
@ VKD3D_SHADER_SPIRV_ENVIRONMENT_VULKAN_1_1

Referenced by vkd3d_chain_physical_device_info_structures().

◆ d3d12_device_Evict()

static HRESULT STDMETHODCALLTYPE d3d12_device_Evict ( ID3D12Device9 *  iface,
UINT  object_count,
ID3D12Pageable *const *  objects 
)
static

Definition at line 4680 of file device.c.

4682{
4683 FIXME_ONCE("iface %p, object_count %u, objects %p stub!\n",
4684 iface, object_count, objects);
4685
4686 return S_OK;
4687}
long object_count
Definition: nc_alloc.cpp:37

◆ d3d12_device_get_copyable_footprints()

static void d3d12_device_get_copyable_footprints ( struct d3d12_device *  device,
const D3D12_RESOURCE_DESC1 *  desc,
unsigned int  first_sub_resource,
unsigned int  sub_resource_count,
uint64_t  base_offset,
D3D12_PLACED_SUBRESOURCE_FOOTPRINT *  layouts,
UINT *  row_counts,
UINT64 *  row_sizes,
UINT64 *  total_bytes 
)
static

Definition at line 4714 of file device.c.

4718{
4719 unsigned int i, sub_resource_idx, miplevel_idx, row_count, row_size, row_pitch;
4720 unsigned int width, height, depth, plane_count, sub_resources_per_plane;
4721 const struct vkd3d_format *format;
4723
4724 if (layouts)
4725 memset(layouts, 0xff, sizeof(*layouts) * sub_resource_count);
4726 if (row_counts)
4727 memset(row_counts, 0xff, sizeof(*row_counts) * sub_resource_count);
4728 if (row_sizes)
4729 memset(row_sizes, 0xff, sizeof(*row_sizes) * sub_resource_count);
4730 if (total_bytes)
4731 *total_bytes = ~(uint64_t)0;
4732
4734 {
4735 WARN("Invalid format %#x.\n", desc->Format);
4736 return;
4737 }
4738
4740 {
4741 WARN("Invalid resource desc.\n");
4742 return;
4743 }
4744
4745 plane_count = ((format->vk_aspect_mask & VK_IMAGE_ASPECT_DEPTH_BIT)
4746 && (format->vk_aspect_mask & VK_IMAGE_ASPECT_STENCIL_BIT)) ? 2 : 1;
4747 sub_resources_per_plane = d3d12_resource_desc_get_sub_resource_count(desc);
4748
4749 if (!vkd3d_bound_range(first_sub_resource, sub_resource_count, sub_resources_per_plane * plane_count))
4750 {
4751 WARN("Invalid sub-resource range %u-%u for resource.\n", first_sub_resource, sub_resource_count);
4752 return;
4753 }
4754
4755 offset = 0;
4756 total = 0;
4757 for (i = 0; i < sub_resource_count; ++i)
4758 {
4759 sub_resource_idx = (first_sub_resource + i) % sub_resources_per_plane;
4760 miplevel_idx = sub_resource_idx % desc->MipLevels;
4761 width = align(d3d12_resource_desc_get_width(desc, miplevel_idx), format->block_width);
4762 height = align(d3d12_resource_desc_get_height(desc, miplevel_idx), format->block_height);
4763 depth = d3d12_resource_desc_get_depth(desc, miplevel_idx);
4764 row_count = height / format->block_height;
4765 row_size = (width / format->block_width) * format->byte_count * format->block_byte_count;
4766 row_pitch = align(row_size, D3D12_TEXTURE_DATA_PITCH_ALIGNMENT);
4767
4768 if (layouts)
4769 {
4770 layouts[i].Offset = base_offset + offset;
4771 layouts[i].Footprint.Format = desc->Format;
4772 layouts[i].Footprint.Width = width;
4773 layouts[i].Footprint.Height = height;
4774 layouts[i].Footprint.Depth = depth;
4775 layouts[i].Footprint.RowPitch = row_pitch;
4776 }
4777 if (row_counts)
4778 row_counts[i] = row_count;
4779 if (row_sizes)
4780 row_sizes[i] = row_size;
4781
4782 size = max(0, row_count - 1) * row_pitch + row_size;
4784
4785 total = offset + size;
4787 }
4788 if (total_bytes)
4789 *total_bytes = total;
4790}
const UINT D3D12_TEXTURE_DATA_PITCH_ALIGNMENT
Definition: d3d12.idl:419
const UINT D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT
Definition: d3d12.idl:420
UINT64 uint64_t
Definition: types.h:77
size_t total
GLint GLint GLsizei GLsizei GLsizei depth
Definition: gl.h:1546
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
GLintptr offset
Definition: glext.h:5920
#define uint64_t
Definition: nsiface.idl:62
HRESULT d3d12_resource_validate_desc(const D3D12_RESOURCE_DESC1 *desc, struct d3d12_device *device)
Definition: resource.c:1850
D3D12_SUBRESOURCE_FOOTPRINT Footprint
Definition: d3d12.idl:1082
unsigned int plane_count
#define max(a, b)
Definition: svc.c:63
static bool vkd3d_bound_range(size_t start, size_t count, size_t limit)
Definition: vkd3d_common.h:360
static unsigned int d3d12_resource_desc_get_sub_resource_count(const D3D12_RESOURCE_DESC1 *desc)
static unsigned int d3d12_resource_desc_get_width(const D3D12_RESOURCE_DESC1 *desc, unsigned int miplevel_idx)
static const struct vkd3d_format * vkd3d_format_from_d3d12_resource_desc(const struct d3d12_device *device, const D3D12_RESOURCE_DESC1 *desc, DXGI_FORMAT view_format)
static unsigned int d3d12_resource_desc_get_height(const D3D12_RESOURCE_DESC1 *desc, unsigned int miplevel_idx)
static unsigned int d3d12_resource_desc_get_depth(const D3D12_RESOURCE_DESC1 *desc, unsigned int miplevel_idx)
@ VK_IMAGE_ASPECT_STENCIL_BIT
Definition: vulkan.h:3367
static size_t align(size_t addr, size_t alignment)

Referenced by d3d12_device_GetCopyableFootprints(), and d3d12_device_GetCopyableFootprints1().

◆ d3d12_device_get_resource1_allocation_info()

static void d3d12_device_get_resource1_allocation_info ( struct d3d12_device *  device,
D3D12_RESOURCE_ALLOCATION_INFO1 *  infos1,
unsigned int  count,
const D3D12_RESOURCE_DESC1 *  resource_descs,
D3D12_RESOURCE_ALLOCATION_INFO *  result 
)
static

Definition at line 4370 of file device.c.

4373{
4376 uint64_t requested_alignment;
4377 unsigned int i;
4378
4379 result->Alignment = 0;
4380 result->SizeInBytes = 0;
4381
4382 info.offset = 0;
4383
4384 for (i = 0; i < count; ++i)
4385 {
4386 desc = &resource_descs[i];
4387
4389 {
4390 WARN("Invalid resource desc.\n");
4391 goto invalid;
4392 }
4393
4394 if (desc->Dimension == D3D12_RESOURCE_DIMENSION_BUFFER)
4395 {
4397 info.offset = align(info.offset, info.alignment);
4399 }
4400 else
4401 {
4403 {
4404 WARN("Failed to get allocation info for texture.\n");
4405 goto invalid;
4406 }
4407
4408 requested_alignment = desc->Alignment
4410 info.alignment = max(info.alignment, requested_alignment);
4411 info.size_in_bytes = align(info.size_in_bytes, info.alignment);
4412
4413 /* Pad by the maximum heap offset increase which may be needed to align to a higher
4414 * Vulkan requirement an offset supplied by the calling application. This allows
4415 * us to return the standard D3D12 alignment and adjust resource placement later. */
4416 if (info.alignment > requested_alignment)
4417 {
4418 info.size_in_bytes += info.alignment - requested_alignment;
4419 info.alignment = requested_alignment;
4420 }
4421
4422 info.offset = align(info.offset, info.alignment);
4423 }
4424
4425 if (infos1)
4427
4428 info.offset += info.size_in_bytes;
4429
4430 result->Alignment = max(result->Alignment, info.alignment);
4431 result->SizeInBytes = info.offset;
4432 }
4433
4434 return;
4435
4436invalid:
4437 result->SizeInBytes = UINT64_MAX;
4438
4439 /* FIXME: Should we support D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT for small MSAA resources? */
4440 if (desc->SampleDesc.Count != 1)
4442 else
4444
4445 TRACE("Alignment %#"PRIx64".\n", result->Alignment);
4446}
@ D3D12_RESOURCE_DIMENSION_BUFFER
Definition: d3d12.idl:983
const UINT D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT
Definition: d3d12.idl:140
const UINT D3D12_DEFAULT_MSAA_RESOURCE_PLACEMENT_ALIGNMENT
Definition: d3d12.idl:138
#define UINT64_MAX
Definition: stdint.h:86
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLuint64EXT * result
Definition: glext.h:11304
static void d3d12_resource_allocation_info1_from_vkd3d(D3D12_RESOURCE_ALLOCATION_INFO1 *result, const struct vkd3d_resource_allocation_info *info)
Definition: device.c:4362
HRESULT vkd3d_get_image_allocation_info(struct d3d12_device *device, const D3D12_RESOURCE_DESC1 *desc, struct vkd3d_resource_allocation_info *allocation_info)
Definition: resource.c:942

Referenced by d3d12_device_get_resource_allocation_info(), and d3d12_device_GetResourceAllocationInfo2().

◆ d3d12_device_get_resource_allocation_info()

static void d3d12_device_get_resource_allocation_info ( struct d3d12_device *  device,
D3D12_RESOURCE_ALLOCATION_INFO1 *  infos1,
unsigned int  count,
const D3D12_RESOURCE_DESC *  resource_descs,
D3D12_RESOURCE_ALLOCATION_INFO *  result 
)
static

Definition at line 4448 of file device.c.

4451{
4452 /* Avoid spurious compiler warning for uninitialized use. */
4453 D3D12_RESOURCE_DESC1 resource_descs1[4] = {0};
4454 D3D12_RESOURCE_DESC1 *descs1;
4455 unsigned int i;
4456
4457 if (count <= ARRAY_SIZE(resource_descs1))
4458 {
4459 descs1 = resource_descs1;
4460 }
4461 else if (!(descs1 = vkd3d_calloc(count, sizeof(*descs1))))
4462 {
4463 ERR("Failed to allocate %u resource descriptions.\n", count);
4464 result->SizeInBytes = UINT64_MAX;
4466 return;
4467 }
4468
4469 for (i = 0; i < count; ++i)
4470 d3d12_resource_desc1_from_desc(&descs1[i], &resource_descs[i]);
4471
4473
4474 if (descs1 != resource_descs1)
4475 vkd3d_free(descs1);
4476}
#define ARRAY_SIZE(A)
Definition: main.h:20
static void d3d12_device_get_resource1_allocation_info(struct d3d12_device *device, D3D12_RESOURCE_ALLOCATION_INFO1 *infos1, unsigned int count, const D3D12_RESOURCE_DESC1 *resource_descs, D3D12_RESOURCE_ALLOCATION_INFO *result)
Definition: device.c:4370
static void * vkd3d_calloc(size_t count, size_t size)
Definition: vkd3d_memory.h:43

Referenced by d3d12_device_GetResourceAllocationInfo(), and d3d12_device_GetResourceAllocationInfo1().

◆ d3d12_device_GetAdapterLuid()

static LUID *STDMETHODCALLTYPE d3d12_device_GetAdapterLuid ( ID3D12Device9 *  iface,
LUID *  luid 
)
static

Definition at line 4872 of file device.c.

4873{
4875
4876 TRACE("iface %p, luid %p.\n", iface, luid);
4877
4878 *luid = device->adapter_luid;
4879
4880 return luid;
4881}

◆ d3d12_device_GetCopyableFootprints()

static void STDMETHODCALLTYPE d3d12_device_GetCopyableFootprints ( ID3D12Device9 *  iface,
const D3D12_RESOURCE_DESC *  desc,
UINT  first_sub_resource,
UINT  sub_resource_count,
UINT64  base_offset,
D3D12_PLACED_SUBRESOURCE_FOOTPRINT *  layouts,
UINT *  row_counts,
UINT64 *  row_sizes,
UINT64 *  total_bytes 
)
static

Definition at line 4792 of file device.c.

4796{
4798 D3D12_RESOURCE_DESC1 resource_desc;
4799
4800 TRACE("iface %p, desc %p, first_sub_resource %u, sub_resource_count %u, base_offset %#"PRIx64", "
4801 "layouts %p, row_counts %p, row_sizes %p, total_bytes %p.\n",
4802 iface, desc, first_sub_resource, sub_resource_count, base_offset,
4803 layouts, row_counts, row_sizes, total_bytes);
4804
4805 d3d12_resource_desc1_from_desc(&resource_desc, desc);
4806
4807 d3d12_device_get_copyable_footprints(device, &resource_desc, first_sub_resource, sub_resource_count,
4808 base_offset, layouts, row_counts, row_sizes, total_bytes);
4809}
static void d3d12_device_get_copyable_footprints(struct d3d12_device *device, const D3D12_RESOURCE_DESC1 *desc, unsigned int first_sub_resource, unsigned int sub_resource_count, uint64_t base_offset, D3D12_PLACED_SUBRESOURCE_FOOTPRINT *layouts, UINT *row_counts, UINT64 *row_sizes, UINT64 *total_bytes)
Definition: device.c:4714

◆ d3d12_device_GetCopyableFootprints1()

static void STDMETHODCALLTYPE d3d12_device_GetCopyableFootprints1 ( ID3D12Device9 *  iface,
const D3D12_RESOURCE_DESC1 *  desc,
UINT  first_sub_resource,
UINT  sub_resource_count,
UINT64  base_offset,
D3D12_PLACED_SUBRESOURCE_FOOTPRINT *  layouts,
UINT *  row_counts,
UINT64 *  row_sizes,
UINT64 *  total_bytes 
)
static

Definition at line 5217 of file device.c.

5221{
5223
5224 TRACE("iface %p, desc %p, first_sub_resource %u, sub_resource_count %u, base_offset %#"PRIx64", "
5225 "layouts %p, row_counts %p, row_sizes %p, total_bytes %p.\n",
5226 iface, desc, first_sub_resource, sub_resource_count, base_offset,
5227 layouts, row_counts, row_sizes, total_bytes);
5228
5229 d3d12_device_get_copyable_footprints(device, desc, first_sub_resource, sub_resource_count,
5230 base_offset, layouts, row_counts, row_sizes, total_bytes);
5231}

◆ d3d12_device_GetCustomHeapProperties()

static D3D12_HEAP_PROPERTIES *STDMETHODCALLTYPE d3d12_device_GetCustomHeapProperties ( ID3D12Device9 *  iface,
D3D12_HEAP_PROPERTIES *  heap_properties,
UINT  node_mask,
D3D12_HEAP_TYPE  heap_type 
)
static

Definition at line 4494 of file device.c.

4496{
4498 bool coherent;
4499
4500 TRACE("iface %p, heap_properties %p, node_mask 0x%08x, heap_type %#x.\n",
4501 iface, heap_properties, node_mask, heap_type);
4502
4503 debug_ignored_node_mask(node_mask);
4504
4505 heap_properties->Type = D3D12_HEAP_TYPE_CUSTOM;
4506
4507 switch (heap_type)
4508 {
4513 break;
4514
4516 heap_properties->CPUPageProperty = d3d12_device_is_uma(device, &coherent) && coherent
4518 heap_properties->MemoryPoolPreference = D3D12_MEMORY_POOL_L0;
4519 break;
4520
4523 heap_properties->MemoryPoolPreference = D3D12_MEMORY_POOL_L0;
4524 break;
4525
4526 default:
4527 FIXME("Unhandled heap type %#x.\n", heap_type);
4528 break;
4529 };
4530
4531 heap_properties->CreationNodeMask = 1;
4532 heap_properties->VisibleNodeMask = 1;
4533
4534 return heap_properties;
4535}
@ D3D12_MEMORY_POOL_L1
Definition: d3d12.idl:799
@ D3D12_MEMORY_POOL_L0
Definition: d3d12.idl:798
@ D3D12_CPU_PAGE_PROPERTY_WRITE_BACK
Definition: d3d12.idl:792
@ D3D12_CPU_PAGE_PROPERTY_WRITE_COMBINE
Definition: d3d12.idl:791
@ D3D12_CPU_PAGE_PROPERTY_NOT_AVAILABLE
Definition: d3d12.idl:790
@ D3D12_HEAP_TYPE_DEFAULT
Definition: d3d12.idl:781
@ D3D12_HEAP_TYPE_READBACK
Definition: d3d12.idl:783
@ D3D12_HEAP_TYPE_UPLOAD
Definition: d3d12.idl:782
@ D3D12_HEAP_TYPE_CUSTOM
Definition: d3d12.idl:784
D3D12_CPU_PAGE_PROPERTY CPUPageProperty
Definition: d3d12.idl:805
D3D12_HEAP_TYPE Type
Definition: d3d12.idl:804
D3D12_MEMORY_POOL MemoryPoolPreference
Definition: d3d12.idl:806

◆ d3d12_device_GetDescriptorHandleIncrementSize()

static UINT STDMETHODCALLTYPE d3d12_device_GetDescriptorHandleIncrementSize ( ID3D12Device9 *  iface,
D3D12_DESCRIPTOR_HEAP_TYPE  descriptor_heap_type 
)
static

Definition at line 4167 of file device.c.

4169{
4170 TRACE("iface %p, descriptor_heap_type %#x.\n", iface, descriptor_heap_type);
4171
4172 switch (descriptor_heap_type)
4173 {
4176 return sizeof(struct d3d12_desc);
4177
4179 return sizeof(struct d3d12_rtv_desc);
4180
4182 return sizeof(struct d3d12_dsv_desc);
4183
4184 default:
4185 FIXME("Unhandled type %#x.\n", descriptor_heap_type);
4186 return 0;
4187 }
4188}
@ D3D12_DESCRIPTOR_HEAP_TYPE_RTV
Definition: d3d12.idl:1423
@ D3D12_DESCRIPTOR_HEAP_TYPE_DSV
Definition: d3d12.idl:1424

◆ d3d12_device_GetDeviceRemovedReason()

static HRESULT STDMETHODCALLTYPE d3d12_device_GetDeviceRemovedReason ( ID3D12Device9 *  iface)
static

Definition at line 4705 of file device.c.

4706{
4708
4709 TRACE("iface %p.\n", iface);
4710
4711 return device->removed_reason;
4712}

◆ d3d12_device_GetNodeCount()

static UINT STDMETHODCALLTYPE d3d12_device_GetNodeCount ( ID3D12Device9 *  iface)
static

Definition at line 3175 of file device.c.

3176{
3177 TRACE("iface %p.\n", iface);
3178
3179 return 1;
3180}

◆ d3d12_device_GetPrivateData()

static HRESULT STDMETHODCALLTYPE d3d12_device_GetPrivateData ( ID3D12Device9 *  iface,
REFGUID  guid,
UINT *  data_size,
void *  data 
)
static

Definition at line 3133 of file device.c.

3135{
3137
3138 TRACE("iface %p, guid %s, data_size %p, data %p.\n",
3139 iface, debugstr_guid(guid), data_size, data);
3140
3141 return vkd3d_get_private_data(&device->private_store, guid, data_size, data);
3142}

◆ d3d12_device_GetRaytracingAccelerationStructurePrebuildInfo()

static void STDMETHODCALLTYPE d3d12_device_GetRaytracingAccelerationStructurePrebuildInfo ( ID3D12Device9 *  iface,
const D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_INPUTS *  desc,
D3D12_RAYTRACING_ACCELERATION_STRUCTURE_PREBUILD_INFO *  info 
)
static

Definition at line 5102 of file device.c.

5105{
5106 FIXME("iface %p, desc %p, info %p stub!\n", iface, desc, info);
5107}

◆ d3d12_device_GetResourceAllocationInfo()

static D3D12_RESOURCE_ALLOCATION_INFO *STDMETHODCALLTYPE d3d12_device_GetResourceAllocationInfo ( ID3D12Device9 *  iface,
D3D12_RESOURCE_ALLOCATION_INFO *  info,
UINT  visible_mask,
UINT  count,
const D3D12_RESOURCE_DESC *  resource_descs 
)
static

Definition at line 4478 of file device.c.

4481{
4483
4484 TRACE("iface %p, info %p, visible_mask 0x%08x, count %u, resource_descs %p.\n",
4485 iface, info, visible_mask, count, resource_descs);
4486
4487 debug_ignored_node_mask(visible_mask);
4488
4490
4491 return info;
4492}
static void d3d12_device_get_resource_allocation_info(struct d3d12_device *device, D3D12_RESOURCE_ALLOCATION_INFO1 *infos1, unsigned int count, const D3D12_RESOURCE_DESC *resource_descs, D3D12_RESOURCE_ALLOCATION_INFO *result)
Definition: device.c:4448

◆ d3d12_device_GetResourceAllocationInfo1()

static D3D12_RESOURCE_ALLOCATION_INFO *STDMETHODCALLTYPE d3d12_device_GetResourceAllocationInfo1 ( ID3D12Device9 *  iface,
D3D12_RESOURCE_ALLOCATION_INFO *  info,
UINT  visible_mask,
UINT  count,
const D3D12_RESOURCE_DESC *  resource_descs,
D3D12_RESOURCE_ALLOCATION_INFO1 *  info1 
)
static

Definition at line 5031 of file device.c.

5035{
5037
5038 TRACE("iface %p, info %p, visible_mask 0x%08x, count %u, resource_descs %p, info1 %p.\n",
5039 iface, info, visible_mask, count, resource_descs, info1);
5040
5041 debug_ignored_node_mask(visible_mask);
5042
5044
5045 return info;
5046}

◆ d3d12_device_GetResourceAllocationInfo2()

static D3D12_RESOURCE_ALLOCATION_INFO *STDMETHODCALLTYPE d3d12_device_GetResourceAllocationInfo2 ( ID3D12Device9 *  iface,
D3D12_RESOURCE_ALLOCATION_INFO *  info,
UINT  visible_mask,
UINT  count,
const D3D12_RESOURCE_DESC1 *  resource_descs,
D3D12_RESOURCE_ALLOCATION_INFO1 *  info1 
)
static

Definition at line 5146 of file device.c.

5149{
5151
5152 TRACE("iface %p, info %p, visible_mask 0x%08x, count %u, resource_descs %p, info1 %p.\n",
5153 iface, info, visible_mask, count, resource_descs, info1);
5154
5155 debug_ignored_node_mask(visible_mask);
5156
5158
5159 return info;
5160}

◆ d3d12_device_GetResourceTiling()

static void STDMETHODCALLTYPE d3d12_device_GetResourceTiling ( ID3D12Device9 *  iface,
ID3D12Resource *  resource,
UINT *  total_tile_count,
D3D12_PACKED_MIP_INFO *  packed_mip_info,
D3D12_TILE_SHAPE *  standard_tile_shape,
UINT *  sub_resource_tiling_count,
UINT  first_sub_resource_tiling,
D3D12_SUBRESOURCE_TILING *  sub_resource_tilings 
)
static

Definition at line 4852 of file device.c.

4857{
4858 const struct d3d12_resource *resource_impl = impl_from_ID3D12Resource(resource);
4860
4861 TRACE("iface %p, resource %p, total_tile_count %p, packed_mip_info %p, "
4862 "standard_title_shape %p, sub_resource_tiling_count %p, "
4863 "first_sub_resource_tiling %u, sub_resource_tilings %p.\n",
4864 iface, resource, total_tile_count, packed_mip_info, standard_tile_shape,
4865 sub_resource_tiling_count, first_sub_resource_tiling,
4866 sub_resource_tilings);
4867
4868 d3d12_resource_get_tiling(device, resource_impl, total_tile_count, packed_mip_info, standard_tile_shape,
4869 sub_resource_tiling_count, first_sub_resource_tiling, sub_resource_tilings);
4870}
void d3d12_resource_get_tiling(struct d3d12_device *device, const struct d3d12_resource *resource, UINT *total_tile_count, D3D12_PACKED_MIP_INFO *packed_mip_info, D3D12_TILE_SHAPE *standard_tile_shape, UINT *subresource_tiling_count, UINT first_subresource_tiling, D3D12_SUBRESOURCE_TILING *subresource_tilings)
Definition: resource.c:1085
static struct d3d12_resource * impl_from_ID3D12Resource(ID3D12Resource *iface)

◆ d3d12_device_init()

static HRESULT d3d12_device_init ( struct d3d12_device *  device,
struct vkd3d_instance *  instance,
const struct vkd3d_device_create_info *  create_info 
)
static

Definition at line 5440 of file device.c.

5442{
5443 const struct vkd3d_vk_device_procs *vk_procs;
5444 HRESULT hr;
5445
5446 device->ID3D12Device9_iface.lpVtbl = &d3d12_device_vtbl;
5447 device->refcount = 1;
5448
5449 vkd3d_instance_incref(device->vkd3d_instance = instance);
5450 device->vk_info = instance->vk_info;
5451 device->signal_event = instance->signal_event;
5452 device->wchar_size = instance->wchar_size;
5453 device->environment = (instance->vk_api_version >= VK_API_VERSION_1_1)
5455
5456 device->adapter_luid = create_info->adapter_luid;
5457 device->removed_reason = S_OK;
5458
5459 device->vk_device = VK_NULL_HANDLE;
5460
5461 device->heaps = NULL;
5462 device->heap_capacity = 0;
5463 device->heap_count = 0;
5464 memset(&device->worker_thread, 0, sizeof(device->worker_thread));
5465 device->worker_should_exit = false;
5466 vkd3d_mutex_init(&device->worker_mutex);
5467 vkd3d_cond_init(&device->worker_cond);
5468
5469 if (FAILED(hr = vkd3d_create_vk_device(device, create_info)))
5470 goto out_free_instance;
5471
5473 goto out_free_vk_resources;
5474
5475 if (FAILED(hr = vkd3d_private_store_init(&device->private_store)))
5476 goto out_free_pipeline_cache;
5477
5479 goto out_free_private_store;
5480
5481 if (FAILED(hr = vkd3d_init_null_resources(&device->null_resources, device)))
5482 goto out_cleanup_format_info;
5483
5484 if (FAILED(hr = vkd3d_uav_clear_state_init(&device->uav_clear_state, device)))
5485 goto out_destroy_null_resources;
5486
5488 goto out_cleanup_uav_clear_state;
5489
5490 if (device->use_vk_heaps && FAILED(hr = vkd3d_create_thread(device->vkd3d_instance,
5491 device_worker_main, device, &device->worker_thread)))
5492 {
5493 WARN("Failed to create worker thread, hr %s.\n", debugstr_hresult(hr));
5494 goto out_cleanup_descriptor_heap_layouts;
5495 }
5496
5497 vkd3d_render_pass_cache_init(&device->render_pass_cache);
5498 vkd3d_gpu_va_allocator_init(&device->gpu_va_allocator);
5500
5501 device->blocked_queue_count = 0;
5502 vkd3d_mutex_init(&device->blocked_queues_mutex);
5503
5504 vkd3d_desc_object_cache_init(&device->view_desc_cache, sizeof(struct vkd3d_view));
5505 vkd3d_desc_object_cache_init(&device->cbuffer_desc_cache, sizeof(struct vkd3d_cbuffer_desc));
5506
5508
5509 if ((device->parent = create_info->parent))
5510 IUnknown_AddRef(device->parent);
5511
5512 return S_OK;
5513
5514out_cleanup_descriptor_heap_layouts:
5516out_cleanup_uav_clear_state:
5517 vkd3d_uav_clear_state_cleanup(&device->uav_clear_state, device);
5518out_destroy_null_resources:
5519 vkd3d_destroy_null_resources(&device->null_resources, device);
5520out_cleanup_format_info:
5522out_free_private_store:
5523 vkd3d_private_store_destroy(&device->private_store);
5524out_free_pipeline_cache:
5526out_free_vk_resources:
5527 vk_procs = &device->vk_procs;
5528 VK_CALL(vkDestroyDevice(device->vk_device, NULL));
5529out_free_instance:
5530 vkd3d_instance_decref(device->vkd3d_instance);
5531 return hr;
5532}
static void * device_worker_main(void *arg)
Definition: device.c:5406
static void vkd3d_vk_descriptor_heap_layouts_cleanup(struct d3d12_device *device)
Definition: device.c:190
static HRESULT vkd3d_vk_descriptor_heap_layouts_init(struct d3d12_device *device)
Definition: device.c:200
static void vkd3d_desc_object_cache_init(struct vkd3d_desc_object_cache *cache, size_t size)
Definition: device.c:2715
static void device_init_descriptor_pool_sizes(struct d3d12_device *device)
Definition: device.c:2677
ULONG vkd3d_instance_decref(struct vkd3d_instance *instance)
Definition: device.c:791
static HRESULT d3d12_device_init_pipeline_cache(struct d3d12_device *device)
Definition: device.c:2331
static HRESULT vkd3d_create_vk_device(struct d3d12_device *device, const struct vkd3d_device_create_info *create_info)
Definition: device.c:2229
static void d3d12_device_destroy_pipeline_cache(struct d3d12_device *device)
Definition: device.c:2354
static void vkd3d_time_domains_init(struct d3d12_device *device)
Definition: device.c:2628
static const struct ID3D12Device9Vtbl d3d12_device_vtbl
Definition: device.c:5306
ULONG vkd3d_instance_incref(struct vkd3d_instance *instance)
Definition: device.c:782
HRESULT vkd3d_create_thread(struct vkd3d_instance *instance, PFN_vkd3d_thread thread_main, void *data, union vkd3d_thread_handle *thread)
Definition: device.c:5620
static bool vkd3d_gpu_va_allocator_init(struct vkd3d_gpu_va_allocator *allocator)
Definition: device.c:2581
void vkd3d_destroy_null_resources(struct vkd3d_null_resources *null_resources, struct d3d12_device *device)
Definition: resource.c:4965
HRESULT vkd3d_init_null_resources(struct vkd3d_null_resources *null_resources, struct d3d12_device *device)
Definition: resource.c:4846
void vkd3d_render_pass_cache_init(struct vkd3d_render_pass_cache *cache)
Definition: state.c:1838
HRESULT vkd3d_uav_clear_state_init(struct vkd3d_uav_clear_state *state, struct d3d12_device *device)
Definition: state.c:4068
void vkd3d_uav_clear_state_cleanup(struct vkd3d_uav_clear_state *state, struct d3d12_device *device)
Definition: state.c:4054
HRESULT vkd3d_init_format_info(struct d3d12_device *device)
Definition: utils.c:401
void vkd3d_cleanup_format_info(struct d3d12_device *device)
Definition: utils.c:414
IUnknown * parent
Definition: vkd3d.h:288
static const char * debugstr_hresult(HRESULT hr)
Definition: vkd3d_common.h:244
static void vkd3d_cond_init(struct vkd3d_cond *cond)
Definition: vkd3d_common.h:617
static void vkd3d_mutex_init(struct vkd3d_mutex *lock)
Definition: vkd3d_common.h:560
@ VKD3D_SHADER_SPIRV_ENVIRONMENT_VULKAN_1_0
void VKAPI_CALL vkDestroyDevice(VkDevice device, const VkAllocationCallbacks *pAllocator)
#define VK_NULL_HANDLE
Definition: vulkan.h:861
#define VK_API_VERSION_1_1
Definition: vulkan.h:843

Referenced by d3d12_device_create().

◆ d3d12_device_init_pipeline_cache()

static HRESULT d3d12_device_init_pipeline_cache ( struct d3d12_device *  device)
static

Definition at line 2331 of file device.c.

2332{
2333 const struct vkd3d_vk_device_procs *vk_procs = &device->vk_procs;
2334 VkPipelineCacheCreateInfo cache_info;
2335 VkResult vr;
2336
2337 vkd3d_mutex_init(&device->pipeline_cache_mutex);
2338
2340 cache_info.pNext = NULL;
2341 cache_info.flags = 0;
2342 cache_info.initialDataSize = 0;
2343 cache_info.pInitialData = NULL;
2344 if ((vr = VK_CALL(vkCreatePipelineCache(device->vk_device, &cache_info, NULL,
2345 &device->vk_pipeline_cache))) < 0)
2346 {
2347 ERR("Failed to create Vulkan pipeline cache, vr %d.\n", vr);
2348 device->vk_pipeline_cache = VK_NULL_HANDLE;
2349 }
2350
2351 return S_OK;
2352}
VkPipelineCacheCreateFlags flags
Definition: vulkan.h:13011
const void * pInitialData
Definition: vulkan.h:13013
VkStructureType sType
Definition: vulkan.h:13009
VkResult VKAPI_CALL vkCreatePipelineCache(VkDevice device, const VkPipelineCacheCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkPipelineCache *pPipelineCache)
@ VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO
Definition: vulkan.h:4981

Referenced by d3d12_device_init().

◆ d3d12_device_is_uma()

bool d3d12_device_is_uma ( struct d3d12_device *  device,
bool *  coherent 
)

Definition at line 3358 of file device.c.

3359{
3360 unsigned int i;
3361
3362 if (coherent)
3363 *coherent = true;
3364
3365 for (i = 0; i < device->memory_properties.memoryTypeCount; ++i)
3366 {
3367 if (!(device->memory_properties.memoryTypes[i].propertyFlags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT))
3368 return false;
3369 if (coherent && !(device->memory_properties.memoryTypes[i].propertyFlags
3371 *coherent = false;
3372 }
3373
3374 return true;
3375}
@ VK_MEMORY_PROPERTY_HOST_COHERENT_BIT
Definition: vulkan.h:3772
@ VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT
Definition: vulkan.h:3771

Referenced by d3d12_device_CheckFeatureSupport(), d3d12_device_GetCustomHeapProperties(), and vkd3d_select_memory_type().

◆ d3d12_device_MakeResident()

static HRESULT STDMETHODCALLTYPE d3d12_device_MakeResident ( ID3D12Device9 *  iface,
UINT  object_count,
ID3D12Pageable *const *  objects 
)
static

Definition at line 4662 of file device.c.

4664{
4665 ID3D12Fence *fence;
4666 HRESULT hr;
4667
4668 TRACE("iface %p, object_count %u, objects %p.\n", iface, object_count, objects);
4669
4670 if (FAILED(hr = ID3D12Device9_CreateFence(iface, 0, 0, &IID_ID3D12Fence, (void **)&fence)))
4671 return hr;
4672
4673 hr = ID3D12Device9_EnqueueMakeResident(iface, 0, object_count, objects, fence, 1);
4674 if (SUCCEEDED(hr))
4675 ID3D12Fence_SetEventOnCompletion(fence, 1, NULL);
4676 ID3D12Fence_Release(fence);
4677 return hr;
4678}

◆ d3d12_device_mark_as_removed()

void d3d12_device_mark_as_removed ( struct d3d12_device *  device,
HRESULT  reason,
const char *  message,
  ... 
)

Definition at line 5556 of file device.c.

5558{
5559 va_list args;
5560
5562 WARN("Device %p is lost (reason %s, \"%s\").\n",
5564 va_end(args);
5565
5566 device->removed_reason = reason;
5567}
static WCHAR reason[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1971
#define va_end(v)
Definition: stdarg.h:28
#define va_start(v, l)
Definition: stdarg.h:26
char * va_list
Definition: vadefs.h:50
#define args
Definition: format.c:66
Definition: match.c:390
Definition: tftpd.h:60
const char const char * vkd3d_dbg_vsprintf(const char *fmt, va_list args)
Definition: debug.c:134

Referenced by d3d12_command_queue_ExecuteCommandLists().

◆ d3d12_device_OpenExistingHeapFromAddress()

static HRESULT STDMETHODCALLTYPE d3d12_device_OpenExistingHeapFromAddress ( ID3D12Device9 *  iface,
const void *  address,
REFIID  iid,
void **  heap 
)
static

Definition at line 4925 of file device.c.

4927{
4928 FIXME("iface %p, address %p, iid %s, heap %p stub!\n", iface, address, debugstr_guid(iid), heap);
4929
4930 return E_NOTIMPL;
4931}
GLuint address
Definition: glext.h:9393

◆ d3d12_device_OpenExistingHeapFromFileMapping()

static HRESULT STDMETHODCALLTYPE d3d12_device_OpenExistingHeapFromFileMapping ( ID3D12Device9 *  iface,
HANDLE  file_mapping,
REFIID  iid,
void **  heap 
)
static

Definition at line 4933 of file device.c.

4935{
4936 FIXME("iface %p, file_mapping %p, iid %s, heap %p stub!\n", iface, file_mapping, debugstr_guid(iid), heap);
4937
4938 return E_NOTIMPL;
4939}

◆ d3d12_device_OpenSharedHandle()

static HRESULT STDMETHODCALLTYPE d3d12_device_OpenSharedHandle ( ID3D12Device9 *  iface,
HANDLE  handle,
REFIID  riid,
void **  object 
)
static

Definition at line 4642 of file device.c.

4644{
4645 FIXME("iface %p, handle %p, riid %s, object %p stub!\n",
4646 iface, handle, debugstr_guid(riid), object);
4647
4648 return E_NOTIMPL;
4649}

◆ d3d12_device_OpenSharedHandleByName()

static HRESULT STDMETHODCALLTYPE d3d12_device_OpenSharedHandleByName ( ID3D12Device9 *  iface,
const WCHAR *  name,
DWORD  access,
HANDLE *  handle 
)
static

Definition at line 4651 of file device.c.

4653{
4655
4656 FIXME("iface %p, name %s, access %#x, handle %p stub!\n",
4657 iface, debugstr_w(name, device->wchar_size), (uint32_t)access, handle);
4658
4659 return E_NOTIMPL;
4660}

◆ d3d12_device_QueryInterface()

static HRESULT STDMETHODCALLTYPE d3d12_device_QueryInterface ( ID3D12Device9 *  iface,
REFIID  riid,
void **  object 
)
static

Definition at line 3033 of file device.c.

3035{
3036 TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object);
3037
3038 if (IsEqualGUID(riid, &IID_ID3D12Device9)
3039 || IsEqualGUID(riid, &IID_ID3D12Device8)
3040 || IsEqualGUID(riid, &IID_ID3D12Device7)
3041 || IsEqualGUID(riid, &IID_ID3D12Device6)
3042 || IsEqualGUID(riid, &IID_ID3D12Device5)
3043 || IsEqualGUID(riid, &IID_ID3D12Device4)
3044 || IsEqualGUID(riid, &IID_ID3D12Device3)
3045 || IsEqualGUID(riid, &IID_ID3D12Device2)
3046 || IsEqualGUID(riid, &IID_ID3D12Device1)
3047 || IsEqualGUID(riid, &IID_ID3D12Device)
3048 || IsEqualGUID(riid, &IID_ID3D12Object)
3050 {
3051 ID3D12Device9_AddRef(iface);
3052 *object = iface;
3053 return S_OK;
3054 }
3055
3056 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
3057
3058 *object = NULL;
3059 return E_NOINTERFACE;
3060}

◆ d3d12_device_Release()

static ULONG STDMETHODCALLTYPE d3d12_device_Release ( ID3D12Device9 *  iface)
static

Definition at line 3094 of file device.c.

3095{
3097 unsigned int refcount = vkd3d_atomic_decrement_u32(&device->refcount);
3098
3099 TRACE("%p decreasing refcount to %u.\n", device, refcount);
3100
3101 if (!refcount)
3102 {
3103 const struct vkd3d_vk_device_procs *vk_procs = &device->vk_procs;
3104
3105 vkd3d_mutex_destroy(&device->blocked_queues_mutex);
3106
3107 vkd3d_private_store_destroy(&device->private_store);
3108
3111 vkd3d_uav_clear_state_cleanup(&device->uav_clear_state, device);
3112 vkd3d_destroy_null_resources(&device->null_resources, device);
3113 vkd3d_gpu_va_allocator_cleanup(&device->gpu_va_allocator);
3114 vkd3d_render_pass_cache_cleanup(&device->render_pass_cache, device);
3117 vkd3d_desc_object_cache_cleanup(&device->view_desc_cache);
3118 vkd3d_desc_object_cache_cleanup(&device->cbuffer_desc_cache);
3119 if (device->use_vk_heaps)
3121 vkd3d_free(device->heaps);
3122 VK_CALL(vkDestroyDevice(device->vk_device, NULL));
3123 if (device->parent)
3124 IUnknown_Release(device->parent);
3125 vkd3d_instance_decref(device->vkd3d_instance);
3126
3128 }
3129
3130 return refcount;
3131}
static HRESULT device_worker_stop(struct d3d12_device *device)
Definition: device.c:3072
static void vkd3d_gpu_va_allocator_cleanup(struct vkd3d_gpu_va_allocator *allocator)
Definition: device.c:2608
static void vkd3d_desc_object_cache_cleanup(struct vkd3d_desc_object_cache *cache)
Definition: device.c:2721
void vkd3d_render_pass_cache_cleanup(struct vkd3d_render_pass_cache *cache, struct d3d12_device *device)
Definition: state.c:1845

◆ d3d12_device_remove_descriptor_heap()

void d3d12_device_remove_descriptor_heap ( struct d3d12_device *  device,
struct d3d12_descriptor_heap *  heap 
)

Definition at line 5586 of file device.c.

5587{
5588 size_t i;
5589
5590 vkd3d_mutex_lock(&device->worker_mutex);
5591
5592 for (i = 0; i < device->heap_count; ++i)
5593 {
5594 if (device->heaps[i] == heap)
5595 {
5596 device->heaps[i] = device->heaps[--device->heap_count];
5597 break;
5598 }
5599 }
5600
5601 vkd3d_mutex_unlock(&device->worker_mutex);
5602}

Referenced by d3d12_descriptor_heap_Release().

◆ d3d12_device_RemoveDevice()

static void STDMETHODCALLTYPE d3d12_device_RemoveDevice ( ID3D12Device9 *  iface)
static

Definition at line 5056 of file device.c.

5057{
5058 FIXME("iface %p stub!\n", iface);
5059}

◆ d3d12_device_SetBackgroundProcessingMode()

static HRESULT STDMETHODCALLTYPE d3d12_device_SetBackgroundProcessingMode ( ID3D12Device9 *  iface,
D3D12_BACKGROUND_PROCESSING_MODE  mode,
D3D12_MEASUREMENTS_ACTION  action,
HANDLE  event,
BOOL *  further_measurements_desired 
)
static

Definition at line 5117 of file device.c.

5120{
5121 FIXME("iface %p, mode %#x, action %#x, event %p, further_measurements_desired %p stub!\n",
5122 iface, mode, action, event, further_measurements_desired);
5123
5124 return E_NOTIMPL;
5125}
action
Definition: namespace.c:707
GLenum mode
Definition: glext.h:6217
Definition: filter.c:185

◆ d3d12_device_SetEventOnMultipleFenceCompletion()

static HRESULT STDMETHODCALLTYPE d3d12_device_SetEventOnMultipleFenceCompletion ( ID3D12Device9 *  iface,
ID3D12Fence *const *  fences,
const UINT64 *  values,
UINT  fence_count,
D3D12_MULTIPLE_FENCE_WAIT_FLAGS  flags,
HANDLE  event 
)
static

Definition at line 4892 of file device.c.

4895{
4896 FIXME("iface %p, fences %p, values %p, fence_count %u, flags %#x, event %p stub!\n",
4897 iface, fences, values, fence_count, flags, event);
4898
4899 return E_NOTIMPL;
4900}
GLboolean GLenum GLenum GLvoid * values
Definition: glext.h:5666
const GLuint * fences
Definition: glext.h:9249

◆ d3d12_device_SetName()

static HRESULT STDMETHODCALLTYPE d3d12_device_SetName ( ID3D12Device9 *  iface,
const WCHAR *  name 
)
static

Definition at line 3165 of file device.c.

3166{
3168
3169 TRACE("iface %p, name %s.\n", iface, debugstr_w(name, device->wchar_size));
3170
3173}
HRESULT vkd3d_set_vk_object_name(struct d3d12_device *device, uint64_t vk_object, VkDebugReportObjectTypeEXT vk_object_type, const WCHAR *name)
Definition: utils.c:1077
@ VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT
Definition: vulkan.h:2332

◆ d3d12_device_SetPrivateData()

static HRESULT STDMETHODCALLTYPE d3d12_device_SetPrivateData ( ID3D12Device9 *  iface,
REFGUID  guid,
UINT  data_size,
const void *  data 
)
static

Definition at line 3144 of file device.c.

3146{
3148
3149 TRACE("iface %p, guid %s, data_size %u, data %p.\n",
3150 iface, debugstr_guid(guid), data_size, data);
3151
3152 return vkd3d_set_private_data(&device->private_store, guid, data_size, data);
3153}

◆ d3d12_device_SetPrivateDataInterface()

static HRESULT STDMETHODCALLTYPE d3d12_device_SetPrivateDataInterface ( ID3D12Device9 *  iface,
REFGUID  guid,
const IUnknown *  data 
)
static

Definition at line 3155 of file device.c.

3157{
3159
3160 TRACE("iface %p, guid %s, data %p.\n", iface, debugstr_guid(guid), data);
3161
3162 return vkd3d_set_private_data_interface(&device->private_store, guid, data);
3163}

◆ d3d12_device_SetResidencyPriority()

static HRESULT STDMETHODCALLTYPE d3d12_device_SetResidencyPriority ( ID3D12Device9 *  iface,
UINT  object_count,
ID3D12Pageable *const *  objects,
const D3D12_RESIDENCY_PRIORITY *  priorities 
)
static

Definition at line 4902 of file device.c.

4904{
4905 FIXME_ONCE("iface %p, object_count %u, objects %p, priorities %p stub!\n", iface, object_count, objects, priorities);
4906
4907 return S_OK;
4908}
const GLuint const GLclampf * priorities
Definition: glext.h:8103

◆ d3d12_device_SetStablePowerState()

static HRESULT STDMETHODCALLTYPE d3d12_device_SetStablePowerState ( ID3D12Device9 *  iface,
BOOL  enable 
)
static

Definition at line 4827 of file device.c.

4828{
4829 FIXME("iface %p, enable %#x stub!\n", iface, enable);
4830
4831 return E_NOTIMPL;
4832}
GLboolean enable
Definition: glext.h:11120

◆ d3d12_device_ShaderCacheControl()

static HRESULT STDMETHODCALLTYPE d3d12_device_ShaderCacheControl ( ID3D12Device9 *  iface,
D3D12_SHADER_CACHE_KIND_FLAGS  kinds,
D3D12_SHADER_CACHE_CONTROL_FLAGS  control 
)
static

Definition at line 5288 of file device.c.

5290{
5291 FIXME("iface %p, kinds %#x control %#x stub!\n", iface, kinds, control);
5292
5293 return E_NOTIMPL;
5294}
Definition: dialog.c:52

◆ d3d12_device_supports_typed_uav_load_additional_formats()

static bool d3d12_device_supports_typed_uav_load_additional_formats ( const struct d3d12_device *  device)
static

Definition at line 1489 of file device.c.

1490{
1491 const struct vkd3d_vk_instance_procs *vk_procs = &device->vkd3d_instance->vk_procs;
1492 const struct vkd3d_format *format;
1493 VkFormatProperties properties;
1494 unsigned int i;
1495
1496 static const DXGI_FORMAT additional_formats[] =
1497 {
1513 };
1514
1515 for (i = 0; i < ARRAY_SIZE(additional_formats); ++i)
1516 {
1517 format = vkd3d_get_format(device, additional_formats[i], false);
1519
1520 VK_CALL(vkGetPhysicalDeviceFormatProperties(device->vk_physical_device, format->vk_format, &properties));
1522 return false;
1523 }
1524
1525 return true;
1526}
DXGI_FORMAT
Definition: dxgiformat.idl:22
@ DXGI_FORMAT_R32G32B32A32_SINT
Definition: dxgiformat.idl:27
@ DXGI_FORMAT_R32G32B32A32_UINT
Definition: dxgiformat.idl:26
@ DXGI_FORMAT_R16_SINT
Definition: dxgiformat.idl:82
@ DXGI_FORMAT_R16G16B16A16_UINT
Definition: dxgiformat.idl:35
@ DXGI_FORMAT_R8G8B8A8_SINT
Definition: dxgiformat.idl:55
@ DXGI_FORMAT_R8G8B8A8_UINT
Definition: dxgiformat.idl:53
@ DXGI_FORMAT_R16G16B16A16_FLOAT
Definition: dxgiformat.idl:33
@ DXGI_FORMAT_R8_UNORM
Definition: dxgiformat.idl:84
@ DXGI_FORMAT_R8G8B8A8_UNORM
Definition: dxgiformat.idl:51
@ DXGI_FORMAT_R16_FLOAT
Definition: dxgiformat.idl:77
@ DXGI_FORMAT_R8_SINT
Definition: dxgiformat.idl:87
@ DXGI_FORMAT_R32G32B32A32_FLOAT
Definition: dxgiformat.idl:25
@ DXGI_FORMAT_R16G16B16A16_SINT
Definition: dxgiformat.idl:37
@ DXGI_FORMAT_R8_UINT
Definition: dxgiformat.idl:85
#define VKD3D_ASSERT(cond)
Definition: vkd3d_common.h:49

Referenced by vkd3d_init_device_caps().

◆ d3d12_is_64k_msaa_supported()

static bool d3d12_is_64k_msaa_supported ( struct d3d12_device *  device)
static

Definition at line 2207 of file device.c.

2208{
2210 D3D12_RESOURCE_DESC1 resource_desc;
2211
2212 memset(&resource_desc, 0, sizeof(resource_desc));
2213 resource_desc.Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE2D;
2214 resource_desc.Width = 1024;
2215 resource_desc.Height = 1025;
2216 resource_desc.DepthOrArraySize = 1;
2217 resource_desc.MipLevels = 1;
2218 resource_desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
2219 resource_desc.SampleDesc.Count = 4;
2220 resource_desc.Flags = D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET;
2221
2222 /* FIXME: in some cases Vulkan requires 0x20000 or more for non-MSAA
2223 * resources, which must have 0x10000 in their description, so we might
2224 * reasonably return true here for 0x20000 or 0x40000. */
2225 return SUCCEEDED(vkd3d_get_image_allocation_info(device, &resource_desc, &info))
2226 && info.alignment <= 0x10000;
2227}
@ D3D12_RESOURCE_DIMENSION_TEXTURE2D
Definition: d3d12.idl:985
@ D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET
Definition: d3d12.idl:1000

Referenced by vkd3d_create_vk_device().

◆ d3d12_resource_allocation_info1_from_vkd3d()

static void d3d12_resource_allocation_info1_from_vkd3d ( D3D12_RESOURCE_ALLOCATION_INFO1 *  result,
const struct vkd3d_resource_allocation_info *  info 
)
static

Definition at line 4362 of file device.c.

4364{
4365 result->Offset = info->offset;
4366 result->Alignment = info->alignment;
4367 result->SizeInBytes = info->size_in_bytes;
4368}

Referenced by d3d12_device_get_resource1_allocation_info().

◆ device_init_descriptor_pool_sizes()

static void device_init_descriptor_pool_sizes ( struct d3d12_device *  device)
static

Definition at line 2677 of file device.c.

2678{
2679 const struct vkd3d_device_descriptor_limits *limits = &device->vk_info.descriptor_limits;
2680 VkDescriptorPoolSize *pool_sizes = device->vk_pool_sizes;
2681
2682 if (device->use_vk_heaps)
2683 {
2685 pool_sizes[0].descriptorCount = min(limits->storage_image_max_descriptors,
2687 pool_sizes[1].type = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE;
2688 pool_sizes[1].descriptorCount = pool_sizes[0].descriptorCount;
2689 pool_sizes[2].type = VK_DESCRIPTOR_TYPE_SAMPLER;
2691 device->vk_pool_count = 3;
2692 return;
2693 }
2694
2695 VKD3D_ASSERT(ARRAY_SIZE(device->vk_pool_sizes) >= 6);
2697 pool_sizes[0].descriptorCount = min(limits->uniform_buffer_max_descriptors,
2700 pool_sizes[1].descriptorCount = min(limits->sampled_image_max_descriptors,
2702 pool_sizes[2].type = VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE;
2703 pool_sizes[2].descriptorCount = pool_sizes[1].descriptorCount;
2705 pool_sizes[3].descriptorCount = min(limits->storage_image_max_descriptors,
2707 pool_sizes[4].type = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE;
2708 pool_sizes[4].descriptorCount = pool_sizes[3].descriptorCount;
2709 pool_sizes[5].type = VK_DESCRIPTOR_TYPE_SAMPLER;
2710 pool_sizes[5].descriptorCount = min(limits->sampler_max_descriptors,
2712 device->vk_pool_count = 6;
2713};
const UINT D3D12_MAX_LIVE_STATIC_SAMPLERS
Definition: d3d12.idl:276
#define VKD3D_MAX_UAV_CLEAR_DESCRIPTORS_PER_TYPE
Definition: device.c:22
uint32_t descriptorCount
Definition: vulkan.h:8280
VkDescriptorType type
Definition: vulkan.h:8279
unsigned int storage_image_max_descriptors
unsigned int uniform_buffer_max_descriptors
unsigned int sampled_image_max_descriptors
#define VKD3D_MAX_VIRTUAL_HEAP_DESCRIPTORS_PER_TYPE
Definition: vkd3d_private.h:66
@ VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER
Definition: vulkan.h:2469
@ VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE
Definition: vulkan.h:2466
@ VK_DESCRIPTOR_TYPE_SAMPLER
Definition: vulkan.h:2464
@ VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER
Definition: vulkan.h:2470
@ VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER
Definition: vulkan.h:2468
@ VK_DESCRIPTOR_TYPE_STORAGE_IMAGE
Definition: vulkan.h:2467

Referenced by d3d12_device_init().

◆ device_worker_main()

static void * device_worker_main ( void *  arg)
static

Definition at line 5406 of file device.c.

5407{
5409 struct d3d12_device *device = arg;
5410 size_t i;
5411
5412 vkd3d_set_thread_name("device_worker");
5413
5414 vkd3d_mutex_lock(&device->worker_mutex);
5415
5416 while (!device->worker_should_exit)
5417 {
5418 for (i = 0; i < device->heap_count; ++i)
5419 {
5420 /* Descriptor updates are not written to Vulkan descriptor sets until a command list
5421 * is submitted to a queue, while the client is free to write d3d12 descriptors earlier,
5422 * from any thread. This causes a delay right before command list execution, so
5423 * handling these updates in a worker thread can speed up execution significantly. */
5424 heap = device->heaps[i];
5425 if (heap->dirty_list_head == UINT_MAX)
5426 continue;
5427 vkd3d_mutex_lock(&heap->vk_sets_mutex);
5429 vkd3d_mutex_unlock(&heap->vk_sets_mutex);
5430 }
5431
5432 vkd3d_cond_wait(&device->worker_cond, &device->worker_mutex);
5433 }
5434
5435 vkd3d_mutex_unlock(&device->worker_mutex);
5436
5437 return NULL;
5438}
#define UINT_MAX
Definition: limits.h:27
void d3d12_desc_flush_vk_heap_updates_locked(struct d3d12_descriptor_heap *descriptor_heap, struct d3d12_device *device)
Definition: resource.c:2639
void vkd3d_set_thread_name(const char *name)
Definition: debug.c:405
static void vkd3d_cond_wait(struct vkd3d_cond *cond, struct vkd3d_mutex *lock)
Definition: vkd3d_common.h:653
void * arg
Definition: msvc.h:10

Referenced by d3d12_device_init().

◆ device_worker_stop()

static HRESULT device_worker_stop ( struct d3d12_device *  device)
static

Definition at line 3072 of file device.c.

3073{
3074 HRESULT hr;
3075
3076 TRACE("device %p.\n", device);
3077
3078 vkd3d_mutex_lock(&device->worker_mutex);
3079
3080 device->worker_should_exit = true;
3081 vkd3d_cond_signal(&device->worker_cond);
3082
3083 vkd3d_mutex_unlock(&device->worker_mutex);
3084
3085 if (FAILED(hr = vkd3d_join_thread(device->vkd3d_instance, &device->worker_thread)))
3086 return hr;
3087
3088 vkd3d_mutex_destroy(&device->worker_mutex);
3089 vkd3d_cond_destroy(&device->worker_cond);
3090
3091 return S_OK;
3092}
HRESULT vkd3d_join_thread(struct vkd3d_instance *instance, union vkd3d_thread_handle *thread)
Definition: device.c:5663
static void vkd3d_cond_destroy(struct vkd3d_cond *cond)
Definition: vkd3d_common.h:666
static void vkd3d_cond_signal(struct vkd3d_cond *cond)
Definition: vkd3d_common.h:629

Referenced by d3d12_device_Release().

◆ get_spec_version()

static unsigned int get_spec_version ( const VkExtensionProperties *  extensions,
unsigned int  count,
const char *  extension_name 
)
static

Definition at line 262 of file device.c.

264{
265 unsigned int i;
266
267 for (i = 0; i < count; ++i)
268 {
269 if (!strcmp(extensions[i].extensionName, extension_name))
270 return extensions[i].specVersion;
271 }
272 return 0;
273}
_ACRTIMP int __cdecl strcmp(const char *, const char *)
Definition: string.c:3324
uint32_t specVersion
Definition: vulkan.h:8661

Referenced by vkd3d_init_device_caps().

◆ has_extension()

static bool has_extension ( const VkExtensionProperties *  extensions,
unsigned int  count,
const char *  extension_name 
)
static

Definition at line 285 of file device.c.

287{
288 unsigned int i;
289
290 for (i = 0; i < count; ++i)
291 {
292 if (!strcmp(extensions[i].extensionName, extension_name))
293 {
294 if (is_extension_disabled(extension_name))
295 {
296 WARN("Extension %s is disabled.\n", debugstr_a(extension_name));
297 return false;
298 }
299 return true;
300 }
301 }
302 return false;
303}
#define debugstr_a
Definition: kernel32.h:31
static bool is_extension_disabled(const char *extension_name)
Definition: device.c:275

Referenced by vkd3d_check_extensions().

◆ have_vk_time_domain()

static bool have_vk_time_domain ( VkTimeDomainEXT *  domains,
unsigned int  count,
VkTimeDomainEXT  domain 
)
static

Definition at line 2617 of file device.c.

2618{
2619 unsigned int i;
2620
2621 for (i = 0; i < count; ++i)
2622 if (domains[i] == domain)
2623 return true;
2624
2625 return false;
2626}
Definition: cookie.c:42

Referenced by vkd3d_time_domains_init().

◆ impl_from_ID3D12Device9()

static struct d3d12_device * impl_from_ID3D12Device9 ( ID3D12Device9 *  iface)
inlinestatic

Definition at line 3028 of file device.c.

3029{
3030 return CONTAINING_RECORD(iface, struct d3d12_device, ID3D12Device9_iface);
3031}
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

Referenced by d3d12_device_AddRef(), d3d12_device_CheckFeatureSupport(), d3d12_device_CopyDescriptors(), d3d12_device_CreateCommandAllocator(), d3d12_device_CreateCommandList(), d3d12_device_CreateCommandQueue(), d3d12_device_CreateCommandSignature(), d3d12_device_CreateCommittedResource(), d3d12_device_CreateCommittedResource1(), d3d12_device_CreateCommittedResource2(), d3d12_device_CreateComputePipelineState(), d3d12_device_CreateConstantBufferView(), d3d12_device_CreateDepthStencilView(), d3d12_device_CreateDescriptorHeap(), d3d12_device_CreateFence(), d3d12_device_CreateGraphicsPipelineState(), d3d12_device_CreateHeap(), d3d12_device_CreateHeap1(), d3d12_device_CreatePipelineState(), d3d12_device_CreatePlacedResource(), d3d12_device_CreatePlacedResource1(), d3d12_device_CreateQueryHeap(), d3d12_device_CreateRenderTargetView(), d3d12_device_CreateReservedResource(), d3d12_device_CreateRootSignature(), d3d12_device_CreateSampler(), d3d12_device_CreateShaderCacheSession(), d3d12_device_CreateShaderResourceView(), d3d12_device_CreateSharedHandle(), d3d12_device_CreateUnorderedAccessView(), d3d12_device_GetAdapterLuid(), d3d12_device_GetCopyableFootprints(), d3d12_device_GetCopyableFootprints1(), d3d12_device_GetCustomHeapProperties(), d3d12_device_GetDeviceRemovedReason(), d3d12_device_GetPrivateData(), d3d12_device_GetResourceAllocationInfo(), d3d12_device_GetResourceAllocationInfo1(), d3d12_device_GetResourceAllocationInfo2(), d3d12_device_GetResourceTiling(), d3d12_device_OpenSharedHandleByName(), d3d12_device_Release(), d3d12_device_SetName(), d3d12_device_SetPrivateData(), d3d12_device_SetPrivateDataInterface(), unsafe_impl_from_ID3D12Device9(), vkd3d_get_device_parent(), vkd3d_get_vk_device(), vkd3d_get_vk_physical_device(), and vkd3d_instance_from_device().

◆ impl_from_ID3D12ShaderCacheSession()

◆ is_extension_disabled()

static bool is_extension_disabled ( const char *  extension_name)
static

Definition at line 275 of file device.c.

276{
277 const char *disabled_extensions;
278
279 if (!(disabled_extensions = getenv("VKD3D_DISABLE_EXTENSIONS")))
280 return false;
281
282 return vkd3d_debug_list_has_member(disabled_extensions, extension_name);
283}
char *CDECL getenv(const char *name)
Definition: environ.c:227
bool vkd3d_debug_list_has_member(const char *string, const char *member)
Definition: debug.c:348

Referenced by has_extension().

◆ unsafe_impl_from_ID3D12Device9()

struct d3d12_device * unsafe_impl_from_ID3D12Device9 ( ID3D12Device9 *  iface)

Definition at line 5398 of file device.c.

5399{
5400 if (!iface)
5401 return NULL;
5402 VKD3D_ASSERT(iface->lpVtbl == &d3d12_device_vtbl);
5403 return impl_from_ID3D12Device9(iface);
5404}

Referenced by vkd3d_create_image_resource().

◆ vkd3d_append_extension()

static unsigned int vkd3d_append_extension ( const char *  extensions[],
unsigned int  extension_count,
const char *  extension_name 
)
static

Definition at line 371 of file device.c.

373{
374 unsigned int i;
375
376 /* avoid duplicates */
377 for (i = 0; i < extension_count; ++i)
378 {
379 if (!strcmp(extensions[i], extension_name))
380 return extension_count;
381 }
382
383 extensions[extension_count++] = extension_name;
384 return extension_count;
385}

Referenced by vkd3d_enable_extensions().

◆ vkd3d_chain_physical_device_info_structures()

static void vkd3d_chain_physical_device_info_structures ( struct vkd3d_physical_device_info *  info,
struct d3d12_device *  device 
)
static

Definition at line 842 of file device.c.

844{
845 struct vkd3d_vulkan_info *vulkan_info = &device->vk_info;
846
847 info->features2.pNext = NULL;
848
849 if (vulkan_info->EXT_conditional_rendering)
850 vk_prepend_struct(&info->features2, &info->conditional_rendering_features);
851 if (vulkan_info->EXT_depth_clip_enable)
852 vk_prepend_struct(&info->features2, &info->depth_clip_features);
853 if (vulkan_info->EXT_descriptor_indexing)
854 vk_prepend_struct(&info->features2, &info->descriptor_indexing_features);
855 if (vulkan_info->EXT_fragment_shader_interlock)
856 vk_prepend_struct(&info->features2, &info->fragment_shader_interlock_features);
857 if (vulkan_info->EXT_robustness2)
858 vk_prepend_struct(&info->features2, &info->robustness2_features);
860 vk_prepend_struct(&info->features2, &info->demote_features);
861 if (vulkan_info->EXT_texel_buffer_alignment)
862 vk_prepend_struct(&info->features2, &info->texel_buffer_alignment_features);
863 if (vulkan_info->EXT_transform_feedback)
864 vk_prepend_struct(&info->features2, &info->xfb_features);
865 if (vulkan_info->EXT_vertex_attribute_divisor)
866 vk_prepend_struct(&info->features2, &info->vertex_divisor_features);
867 if (vulkan_info->KHR_timeline_semaphore)
868 vk_prepend_struct(&info->features2, &info->timeline_semaphore_features);
869 if (vulkan_info->EXT_mutable_descriptor_type)
870 vk_prepend_struct(&info->features2, &info->mutable_features);
871 if (vulkan_info->EXT_4444_formats)
872 vk_prepend_struct(&info->features2, &info->formats4444_features);
873
874 info->properties2.pNext = NULL;
875
876 if (vulkan_info->KHR_maintenance3)
877 vk_prepend_struct(&info->properties2, &info->maintenance3_properties);
878 if (vulkan_info->EXT_descriptor_indexing)
879 vk_prepend_struct(&info->properties2, &info->descriptor_indexing_properties);
880 if (vulkan_info->EXT_texel_buffer_alignment)
881 vk_prepend_struct(&info->properties2, &info->texel_buffer_alignment_properties);
882 if (vulkan_info->EXT_transform_feedback)
883 vk_prepend_struct(&info->properties2, &info->xfb_properties);
884 if (vulkan_info->EXT_vertex_attribute_divisor)
885 vk_prepend_struct(&info->properties2, &info->vertex_divisor_properties);
887 vk_prepend_struct(&info->properties2, &info->subgroup_properties);
888}
static bool d3d12_device_environment_is_vulkan_min_1_1(struct d3d12_device *device)
Definition: device.c:808
bool EXT_fragment_shader_interlock
bool EXT_texel_buffer_alignment
bool EXT_vertex_attribute_divisor
bool EXT_conditional_rendering
bool EXT_shader_demote_to_helper_invocation
bool EXT_mutable_descriptor_type
static void vk_prepend_struct(void *header, void *structure)

Referenced by vkd3d_init_device_caps(), and vkd3d_physical_device_info_init().

◆ vkd3d_check_device_extensions()

static HRESULT vkd3d_check_device_extensions ( struct d3d12_device *  device,
const struct vkd3d_device_create_info *  create_info,
VkExtensionProperties **  vk_extensions,
uint32_t *  vk_extension_count,
uint32_t *  device_extension_count,
bool **  user_extension_supported 
)
static

Definition at line 1528 of file device.c.

1531{
1532 const struct vkd3d_vk_instance_procs *vk_procs = &device->vkd3d_instance->vk_procs;
1533 const struct vkd3d_optional_device_extensions_info *optional_extensions;
1534 VkPhysicalDevice physical_device = device->vk_physical_device;
1535 struct vkd3d_vulkan_info *vulkan_info = &device->vk_info;
1536 VkResult vr;
1537
1538 *device_extension_count = 0;
1539
1540 if ((vr = VK_CALL(vkEnumerateDeviceExtensionProperties(physical_device, NULL, vk_extension_count, NULL))) < 0)
1541 {
1542 ERR("Failed to enumerate device extensions, vr %d.\n", vr);
1543 return hresult_from_vk_result(vr);
1544 }
1545
1546 if (!(*vk_extensions = vkd3d_calloc(*vk_extension_count, sizeof(**vk_extensions))))
1547 return E_OUTOFMEMORY;
1548
1549 TRACE("Enumerating %u device extensions.\n", *vk_extension_count);
1550 if ((vr = VK_CALL(vkEnumerateDeviceExtensionProperties(physical_device, NULL, vk_extension_count, *vk_extensions))) < 0)
1551 {
1552 ERR("Failed to enumerate device extensions, vr %d.\n", vr);
1553 vkd3d_free(*vk_extensions);
1554 return hresult_from_vk_result(vr);
1555 }
1556
1557 optional_extensions = vkd3d_find_struct(create_info->next, OPTIONAL_DEVICE_EXTENSIONS_INFO);
1558 if (optional_extensions && optional_extensions->extension_count)
1559 {
1560 if (!(*user_extension_supported = vkd3d_calloc(optional_extensions->extension_count, sizeof(bool))))
1561 {
1562 vkd3d_free(*vk_extensions);
1563 return E_OUTOFMEMORY;
1564 }
1565 }
1566 else
1567 {
1568 *user_extension_supported = NULL;
1569 }
1570
1571 *device_extension_count = vkd3d_check_extensions(*vk_extensions, *vk_extension_count,
1574 create_info->device_extensions, create_info->device_extension_count,
1575 optional_extensions ? optional_extensions->extensions : NULL,
1576 optional_extensions ? optional_extensions->extension_count : 0,
1577 *user_extension_supported, vulkan_info, "device",
1578 device->vkd3d_instance->config_flags & VKD3D_CONFIG_FLAG_VULKAN_DEBUG);
1579
1580 return S_OK;
1581}
#define vkd3d_find_struct(c, t)
Definition: device.c:30
static const char *const required_device_extensions[]
Definition: device.c:73
static unsigned int vkd3d_check_extensions(const VkExtensionProperties *extensions, unsigned int count, const char *const *required_extensions, unsigned int required_extension_count, const struct vkd3d_optional_extension_info *optional_extensions, unsigned int optional_extension_count, const char *const *user_extensions, unsigned int user_extension_count, const char *const *optional_user_extensions, unsigned int optional_user_extension_count, bool *user_extension_supported, struct vkd3d_vulkan_info *vulkan_info, const char *extension_type, bool is_debug_enabled)
Definition: device.c:305
static const struct vkd3d_optional_extension_info optional_device_extensions[]
Definition: device.c:87
uint32_t device_extension_count
Definition: vkd3d.h:282
const char *const * device_extensions
Definition: vkd3d.h:280
const void * next
Definition: vkd3d.h:251
const char *const * extensions
Definition: vkd3d.h:314
@ VKD3D_CONFIG_FLAG_VULKAN_DEBUG
VkResult VKAPI_CALL vkEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, const char *pLayerName, uint32_t *pPropertyCount, VkExtensionProperties *pProperties)

Referenced by vkd3d_init_device_caps().

◆ vkd3d_check_extensions()

static unsigned int vkd3d_check_extensions ( const VkExtensionProperties *  extensions,
unsigned int  count,
const char *const *  required_extensions,
unsigned int  required_extension_count,
const struct vkd3d_optional_extension_info *  optional_extensions,
unsigned int  optional_extension_count,
const char *const *  user_extensions,
unsigned int  user_extension_count,
const char *const *  optional_user_extensions,
unsigned int  optional_user_extension_count,
bool *  user_extension_supported,
struct vkd3d_vulkan_info *  vulkan_info,
const char *  extension_type,
bool  is_debug_enabled 
)
static

Definition at line 305 of file device.c.

312{
313 unsigned int extension_count = 0;
314 unsigned int i;
315
316 for (i = 0; i < required_extension_count; ++i)
317 {
318 if (!has_extension(extensions, count, required_extensions[i]))
319 WARN("Required %s extension %s is not supported.\n",
320 extension_type, debugstr_a(required_extensions[i]));
321 ++extension_count;
322 }
323
324 for (i = 0; i < optional_extension_count; ++i)
325 {
326 const char *extension_name = optional_extensions[i].extension_name;
327 ptrdiff_t offset = optional_extensions[i].vulkan_info_offset;
328 bool *supported = (void *)((uintptr_t)vulkan_info + offset);
329
330 if (!is_debug_enabled && optional_extensions[i].is_debug_only)
331 {
332 *supported = false;
333 TRACE("Skipping debug-only extension %s.\n", debugstr_a(extension_name));
334 continue;
335 }
336
337 if ((*supported = has_extension(extensions, count, extension_name)))
338 {
339 TRACE("Found %s extension.\n", debugstr_a(extension_name));
340 ++extension_count;
341 }
342 }
343
344 for (i = 0; i < user_extension_count; ++i)
345 {
346 if (!has_extension(extensions, count, user_extensions[i]))
347 WARN("Required user %s extension %s is not supported.\n",
348 extension_type, debugstr_a(user_extensions[i]));
349 ++extension_count;
350 }
351
352 VKD3D_ASSERT(!optional_user_extension_count || user_extension_supported);
353 for (i = 0; i < optional_user_extension_count; ++i)
354 {
355 if (has_extension(extensions, count, optional_user_extensions[i]))
356 {
357 user_extension_supported[i] = true;
358 ++extension_count;
359 }
360 else
361 {
362 user_extension_supported[i] = false;
363 WARN("Optional user %s extension %s is not supported.\n",
364 extension_type, debugstr_a(optional_user_extensions[i]));
365 }
366 }
367
368 return extension_count;
369}
int ptrdiff_t
Definition: corecrt.h:194
static bool has_extension(const VkExtensionProperties *extensions, unsigned int count, const char *extension_name)
Definition: device.c:285
const char * extension_name
Definition: device.c:55
ptrdiff_t vulkan_info_offset
Definition: device.c:56

Referenced by vkd3d_check_device_extensions(), and vkd3d_init_instance_caps().

◆ vkd3d_create_instance()

HRESULT vkd3d_create_instance ( const struct vkd3d_instance_create_info *  create_info,
struct vkd3d_instance **  instance 
)

Definition at line 734 of file device.c.

736{
737 struct vkd3d_instance *object;
738 HRESULT hr;
739
740 TRACE("create_info %p, instance %p.\n", create_info, instance);
741
742 if (!create_info || !instance)
743 return E_INVALIDARG;
745 {
746 WARN("Invalid structure type %#x.\n", create_info->type);
747 return E_INVALIDARG;
748 }
749
750 if (!(object = vkd3d_malloc(sizeof(*object))))
751 return E_OUTOFMEMORY;
752
753 if (FAILED(hr = vkd3d_instance_init(object, create_info)))
754 {
755 vkd3d_free(object);
756 return hr;
757 }
758
759 TRACE("Created instance %p.\n", object);
760
761 *instance = object;
762
763 return S_OK;
764}
static HRESULT vkd3d_instance_init(struct vkd3d_instance *instance, const struct vkd3d_instance_create_info *create_info)
Definition: device.c:572
enum vkd3d_structure_type type
Definition: vkd3d.h:121
@ VKD3D_STRUCTURE_TYPE_INSTANCE_CREATE_INFO
Definition: vkd3d.h:53

Referenced by D3D12CreateDevice(), and vkd3d_create_device().

◆ vkd3d_create_thread()

HRESULT vkd3d_create_thread ( struct vkd3d_instance *  instance,
PFN_vkd3d_thread  thread_main,
void *  data,
union vkd3d_thread_handle *  thread 
)

Definition at line 5620 of file device.c.

5622{
5623 HRESULT hr = S_OK;
5624
5625 if (instance->create_thread)
5626 {
5627 if (!(thread->handle = instance->create_thread(thread_main, data)))
5628 {
5629 ERR("Failed to create thread.\n");
5630 hr = E_FAIL;
5631 }
5632 }
5633 else
5634 {
5635#ifdef _WIN32
5636 struct thread_data *thread_data;
5637
5638 if (!(thread_data = vkd3d_malloc(sizeof(*thread_data))))
5639 return E_OUTOFMEMORY;
5640
5641 thread_data->main_pfn = thread_main;
5643 if (!(thread->handle = CreateThread(NULL, 0, call_thread_main, thread_data, 0, NULL)))
5644 {
5645 ERR("Failed to create thread, error %lu.\n", GetLastError());
5647 hr = E_FAIL;
5648 }
5649#else
5650 int rc;
5651
5652 if ((rc = pthread_create(&thread->pthread, NULL, thread_main, data)))
5653 {
5654 ERR("Failed to create thread, error %d.\n", rc);
5655 hr = hresult_from_errno(rc);
5656 }
5657#endif
5658 }
5659
5660 return hr;
5661}
static HANDLE thread
Definition: service.c:33
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
static unsigned int WINAPI thread_main(void *args)
Definition: nfs41_daemon.c:84
HRESULT hresult_from_errno(int rc)
Definition: utils.c:768
void * data
Definition: main.c:1575
DWORD WINAPI GetLastError(void)
Definition: except.c:1042

Referenced by d3d12_device_init(), and vkd3d_fence_worker_start().

◆ vkd3d_create_vk_descriptor_heap_layout()

static HRESULT vkd3d_create_vk_descriptor_heap_layout ( struct d3d12_device *  device,
unsigned int  index 
)
static

Definition at line 119 of file device.c.

120{
121 const struct vkd3d_vk_device_procs *vk_procs = &device->vk_procs;
128 VkResult vr;
129
130 static const VkDescriptorType descriptor_types[] =
131 {
137 };
138
139 if (device->vk_info.EXT_mutable_descriptor_type
141 && device->vk_descriptor_heap_layouts[index].applicable_heap_type == D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV)
142 {
143 device->vk_descriptor_heap_layouts[index].vk_set_layout = VK_NULL_HANDLE;
144 return S_OK;
145 }
146
147 binding.binding = 0;
148 binding.descriptorType = (device->vk_info.EXT_mutable_descriptor_type && index == VKD3D_SET_INDEX_MUTABLE)
149 ? VK_DESCRIPTOR_TYPE_MUTABLE_EXT : device->vk_descriptor_heap_layouts[index].type;
150 binding.descriptorCount = device->vk_descriptor_heap_layouts[index].count;
151 binding.stageFlags = VK_SHADER_STAGE_ALL;
152 binding.pImmutableSamplers = NULL;
153
155 set_desc.pNext = &flags_info;
157 set_desc.bindingCount = 1;
158 set_desc.pBindings = &binding;
159
163
165 flags_info.pNext = NULL;
166 flags_info.bindingCount = 1;
167 flags_info.pBindingFlags = &set_flags;
168
169 if (binding.descriptorType == VK_DESCRIPTOR_TYPE_MUTABLE_EXT)
170 {
171 type_list.descriptorTypeCount = ARRAY_SIZE(descriptor_types);
172 type_list.pDescriptorTypes = descriptor_types;
174 mutable_info.pNext = NULL;
175 mutable_info.mutableDescriptorTypeListCount = 1;
176 mutable_info.pMutableDescriptorTypeLists = &type_list;
177 flags_info.pNext = &mutable_info;
178 }
179
180 if ((vr = VK_CALL(vkCreateDescriptorSetLayout(device->vk_device, &set_desc, NULL,
181 &device->vk_descriptor_heap_layouts[index].vk_set_layout))) < 0)
182 {
183 WARN("Failed to create Vulkan descriptor set layout, vr %d.\n", vr);
184 return hresult_from_vk_result(vr);
185 }
186
187 return S_OK;
188}
#define index(s, c)
Definition: various.h:29
GLuint index
Definition: glext.h:6031
if(dx< 0)
Definition: linetemp.h:194
static RPC_BINDING_HANDLE binding
Definition: server.c:166
DWORD set_flags
Definition: misc.c:1973
const VkDescriptorBindingFlags * pBindingFlags
Definition: vulkan.h:8314
const VkDescriptorSetLayoutBinding * pBindings
Definition: vulkan.h:8324
VkDescriptorSetLayoutCreateFlags flags
Definition: vulkan.h:8322
const VkMutableDescriptorTypeListEXT * pMutableDescriptorTypeLists
Definition: vulkan.h:16542
const VkDescriptorType * pDescriptorTypes
Definition: vulkan.h:9567
@ VKD3D_SET_INDEX_MUTABLE
@ VKD3D_SET_INDEX_UAV_COUNTER
@ VK_SHADER_STAGE_ALL
Definition: vulkan.h:4899
VkResult VKAPI_CALL vkCreateDescriptorSetLayout(VkDevice device, const VkDescriptorSetLayoutCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDescriptorSetLayout *pSetLayout)
@ VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT_EXT
Definition: vulkan.h:2429
@ VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT_EXT
Definition: vulkan.h:2427
@ VK_DESCRIPTOR_BINDING_VARIABLE_DESCRIPTOR_COUNT_BIT_EXT
Definition: vulkan.h:2430
@ VK_DESCRIPTOR_BINDING_UPDATE_UNUSED_WHILE_PENDING_BIT_EXT
Definition: vulkan.h:2428
@ VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT_EXT
Definition: vulkan.h:2457
VkDescriptorType
Definition: vulkan.h:2463
@ VK_DESCRIPTOR_TYPE_MUTABLE_EXT
Definition: vulkan.h:2478
VkDescriptorBindingFlags VkDescriptorBindingFlagsEXT
Definition: vulkan.h:993
@ VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_BINDING_FLAGS_CREATE_INFO_EXT
Definition: vulkan.h:5923
@ VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO
Definition: vulkan.h:4996
@ VK_STRUCTURE_TYPE_MUTABLE_DESCRIPTOR_TYPE_CREATE_INFO_EXT
Definition: vulkan.h:5556

Referenced by vkd3d_vk_descriptor_heap_layouts_init().

◆ vkd3d_create_vk_device()

static HRESULT vkd3d_create_vk_device ( struct d3d12_device *  device,
const struct vkd3d_device_create_info *  create_info 
)
static

Definition at line 2229 of file device.c.

2231{
2232 const struct vkd3d_vk_instance_procs *vk_procs = &device->vkd3d_instance->vk_procs;
2233 const struct vkd3d_optional_device_extensions_info *optional_extensions;
2234 struct vkd3d_physical_device_info physical_device_info;
2235 struct vkd3d_device_queue_info device_queue_info;
2236 bool *user_extension_supported = NULL;
2237 VkPhysicalDevice physical_device;
2239 unsigned int device_index;
2240 uint32_t extension_count;
2241 const char **extensions;
2242 VkDevice vk_device;
2243 VkResult vr;
2244 HRESULT hr;
2245
2246 TRACE("device %p, create_info %p.\n", device, create_info);
2247
2248 physical_device = create_info->vk_physical_device;
2249 device_index = vkd3d_env_var_as_uint("VKD3D_VULKAN_DEVICE", ~0u);
2250 if ((!physical_device || device_index != ~0u)
2251 && FAILED(hr = vkd3d_select_physical_device(device->vkd3d_instance, device_index, &physical_device)))
2252 return hr;
2253
2254 device->vk_physical_device = physical_device;
2255
2256 if (FAILED(hr = vkd3d_select_queues(device->vkd3d_instance, physical_device, &device_queue_info)))
2257 return hr;
2258
2259 TRACE("Using queue family %u for direct command queues.\n",
2260 device_queue_info.family_index[VKD3D_QUEUE_FAMILY_DIRECT]);
2261 TRACE("Using queue family %u for compute command queues.\n",
2262 device_queue_info.family_index[VKD3D_QUEUE_FAMILY_COMPUTE]);
2263 TRACE("Using queue family %u for copy command queues.\n",
2264 device_queue_info.family_index[VKD3D_QUEUE_FAMILY_TRANSFER]);
2265
2266 VK_CALL(vkGetPhysicalDeviceMemoryProperties(physical_device, &device->memory_properties));
2267
2268 if (FAILED(hr = vkd3d_init_device_caps(device, create_info, &physical_device_info,
2269 &extension_count, &user_extension_supported)))
2270 return hr;
2271
2272 if (!(extensions = vkd3d_calloc(extension_count, sizeof(*extensions))))
2273 {
2274 vkd3d_free(user_extension_supported);
2275 return E_OUTOFMEMORY;
2276 }
2277
2278 optional_extensions = vkd3d_find_struct(create_info->next, OPTIONAL_DEVICE_EXTENSIONS_INFO);
2279
2280 /* Create device */
2282 device_info.pNext = physical_device_info.features2.pNext;
2283 device_info.flags = 0;
2284 device_info.queueCreateInfoCount = device_queue_info.vk_family_count;
2285 device_info.pQueueCreateInfos = device_queue_info.vk_queue_create_info;
2286 device_info.enabledLayerCount = 0;
2287 device_info.ppEnabledLayerNames = NULL;
2288 device_info.enabledExtensionCount = vkd3d_enable_extensions(extensions,
2291 create_info->device_extensions, create_info->device_extension_count,
2292 optional_extensions ? optional_extensions->extensions : NULL,
2293 optional_extensions ? optional_extensions->extension_count : 0,
2294 user_extension_supported, &device->vk_info);
2295 device_info.ppEnabledExtensionNames = extensions;
2296 device_info.pEnabledFeatures = &physical_device_info.features2.features;
2297 vkd3d_free(user_extension_supported);
2298
2299 vr = VK_CALL(vkCreateDevice(physical_device, &device_info, NULL, &vk_device));
2300 vkd3d_free(extensions);
2301 if (vr < 0)
2302 {
2303 WARN("Failed to create Vulkan device, vr %d.\n", vr);
2304 return hresult_from_vk_result(vr);
2305 }
2306
2307 if (FAILED(hr = vkd3d_load_vk_device_procs(&device->vk_procs, vk_procs, vk_device)))
2308 {
2309 ERR("Failed to load device procs, hr %s.\n", debugstr_hresult(hr));
2310 if (device->vk_procs.vkDestroyDevice)
2311 device->vk_procs.vkDestroyDevice(vk_device, NULL);
2312 return hr;
2313 }
2314
2315 device->vk_device = vk_device;
2316
2317 if (FAILED(hr = d3d12_device_create_vkd3d_queues(device, &device_queue_info)))
2318 {
2319 ERR("Failed to create queues, hr %s.\n", debugstr_hresult(hr));
2320 device->vk_procs.vkDestroyDevice(vk_device, NULL);
2321 return hr;
2322 }
2323
2324 device->feature_options4.MSAA64KBAlignedTextureSupported = d3d12_is_64k_msaa_supported(device);
2325
2326 TRACE("Created Vulkan device %p.\n", vk_device);
2327
2328 return hr;
2329}
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
static HRESULT vkd3d_select_physical_device(struct vkd3d_instance *instance, unsigned int device_index, VkPhysicalDevice *selected_device)
Definition: device.c:1969
static bool d3d12_is_64k_msaa_supported(struct d3d12_device *device)
Definition: device.c:2207
static HRESULT vkd3d_select_queues(const struct vkd3d_instance *vkd3d_instance, VkPhysicalDevice physical_device, struct vkd3d_device_queue_info *info)
Definition: device.c:2121
static unsigned int vkd3d_enable_extensions(const char *extensions[], const char *const *required_extensions, unsigned int required_extension_count, const struct vkd3d_optional_extension_info *optional_extensions, unsigned int optional_extension_count, const char *const *user_extensions, unsigned int user_extension_count, const char *const *optional_user_extensions, unsigned int optional_user_extension_count, bool *user_extension_supported, const struct vkd3d_vulkan_info *vulkan_info)
Definition: device.c:387
static HRESULT vkd3d_init_device_caps(struct d3d12_device *device, const struct vkd3d_device_create_info *create_info, struct vkd3d_physical_device_info *physical_device_info, uint32_t *device_extension_count, bool **user_extension_supported)
Definition: device.c:1688
static HRESULT d3d12_device_create_vkd3d_queues(struct d3d12_device *device, const struct vkd3d_device_queue_info *queue_info)
Definition: device.c:2071
HRESULT vkd3d_load_vk_device_procs(struct vkd3d_vk_device_procs *procs, const struct vkd3d_vk_instance_procs *parent_procs, VkDevice device)
Definition: utils.c:857
VkPhysicalDevice vk_physical_device
Definition: vkd3d.h:274
unsigned int vkd3d_env_var_as_uint(const char *name, unsigned int default_value)
Definition: debug.c:326
void VKAPI_CALL vkGetPhysicalDeviceMemoryProperties(VkPhysicalDevice physicalDevice, VkPhysicalDeviceMemoryProperties *pMemoryProperties)
VkResult VKAPI_CALL vkCreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDevice *pDevice)
@ VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO
Definition: vulkan.h:4967

Referenced by d3d12_device_init().

◆ vkd3d_debug_report_callback()

static VkBool32 VKAPI_PTR vkd3d_debug_report_callback ( VkDebugReportFlagsEXT  flags,
VkDebugReportObjectTypeEXT  object_type,
uint64_t  object,
size_t  location,
int32_t  message_code,
const char *  layer_prefix,
const char *  message,
void *  user_data 
)
static

Definition at line 519 of file device.c.

522{
523 FIXME("%s\n", debugstr_a(message));
524 return VK_FALSE;
525}
#define VK_FALSE
Definition: vulkan.h:56

Referenced by vkd3d_init_debug_report().

◆ vkd3d_desc_object_cache_cleanup()

static void vkd3d_desc_object_cache_cleanup ( struct vkd3d_desc_object_cache *  cache)
static

Definition at line 2721 of file device.c.

2722{
2723 union d3d12_desc_object u;
2724 unsigned int i;
2725 void *next;
2726
2727 for (i = 0; i < ARRAY_SIZE(cache->heads); ++i)
2728 {
2729 for (u.object = cache->heads[i].head; u.object; u.object = next)
2730 {
2731 next = u.header->next;
2732 vkd3d_free(u.object);
2733 }
2734 }
2735}
static unsigned __int64 next
Definition: rand_nt.c:6
Definition: cache.c:41

Referenced by d3d12_device_Release().

◆ vkd3d_desc_object_cache_init()

static void vkd3d_desc_object_cache_init ( struct vkd3d_desc_object_cache *  cache,
size_t  size 
)
static

Definition at line 2715 of file device.c.

2716{
2717 memset(cache, 0, sizeof(*cache));
2718 cache->size = size;
2719}

Referenced by d3d12_device_init().

◆ vkd3d_destroy_instance()

static void vkd3d_destroy_instance ( struct vkd3d_instance *  instance)
static

Definition at line 766 of file device.c.

767{
768 const struct vkd3d_vk_instance_procs *vk_procs = &instance->vk_procs;
769 VkInstance vk_instance = instance->vk_instance;
770
771 if (instance->vk_debug_callback)
772 VK_CALL(vkDestroyDebugReportCallbackEXT(vk_instance, instance->vk_debug_callback, NULL));
773
774 VK_CALL(vkDestroyInstance(vk_instance, NULL));
775
776 if (instance->libvulkan)
777 vkd3d_dlclose(instance->libvulkan);
778
780}
static int vkd3d_dlclose(void *handle)
Definition: vkd3d_common.h:751
void VKAPI_CALL vkDestroyDebugReportCallbackEXT(VkInstance instance, VkDebugReportCallbackEXT callback, const VkAllocationCallbacks *pAllocator)
void VKAPI_CALL vkDestroyInstance(VkInstance instance, const VkAllocationCallbacks *pAllocator)

Referenced by vkd3d_instance_decref().

◆ vkd3d_device_descriptor_limits_init()

static void vkd3d_device_descriptor_limits_init ( struct vkd3d_device_descriptor_limits *  limits,
const VkPhysicalDeviceLimits *  device_limits 
)
static

Definition at line 1449 of file device.c.

1451{
1457}
uint32_t maxDescriptorSetSamplers
Definition: vulkan.h:11083
uint32_t maxDescriptorSetStorageBuffers
Definition: vulkan.h:11086
uint32_t maxDescriptorSetStorageImages
Definition: vulkan.h:11089
uint32_t maxDescriptorSetSampledImages
Definition: vulkan.h:11088
uint32_t maxDescriptorSetUniformBuffers
Definition: vulkan.h:11084
unsigned int storage_buffer_max_descriptors
#define VKD3D_MAX_DESCRIPTOR_SET_SAMPLERS
Definition: vkd3d_private.h:62

Referenced by vkd3d_init_device_caps().

◆ vkd3d_device_vk_heaps_descriptor_limits_init()

static void vkd3d_device_vk_heaps_descriptor_limits_init ( struct vkd3d_device_descriptor_limits *  limits,
const VkPhysicalDeviceDescriptorIndexingPropertiesEXT *  properties 
)
static

Definition at line 1459 of file device.c.

1461{
1462 const unsigned int root_provision = D3D12_MAX_ROOT_COST / 2;
1463 unsigned int srv_divisor = 1, uav_divisor = 1;
1464
1465 /* The total number of populated sampled image or storage image descriptors never exceeds the size of
1466 * one set (or two sets if every UAV has a counter), but the total size of bound layouts will exceed
1467 * device limits if each set size is maxDescriptorSet*, because of the D3D12 buffer + image allowance
1468 * (and UAV counters). Breaking limits for layouts seems to work with RADV and Nvidia drivers at
1469 * least, but let's try to stay within them if limits are high enough. */
1470 if (properties->maxDescriptorSetUpdateAfterBindSampledImages >= (1u << 21))
1471 {
1472 srv_divisor = 2;
1473 uav_divisor = properties->maxDescriptorSetUpdateAfterBindSampledImages >= (3u << 20) ? 3 : 2;
1474 }
1475
1477 properties->maxPerStageDescriptorUpdateAfterBindUniformBuffers - root_provision);
1479 properties->maxPerStageDescriptorUpdateAfterBindSampledImages / srv_divisor - root_provision);
1481 properties->maxPerStageDescriptorUpdateAfterBindStorageBuffers - root_provision);
1483 properties->maxPerStageDescriptorUpdateAfterBindStorageImages / uav_divisor - root_provision);
1485 properties->maxPerStageDescriptorUpdateAfterBindSamplers - root_provision);
1487}
const UINT D3D12_MAX_ROOT_COST
Definition: d3d12.idl:280

Referenced by vkd3d_init_device_caps().

◆ vkd3d_enable_extensions()

static unsigned int vkd3d_enable_extensions ( const char *  extensions[],
const char *const *  required_extensions,
unsigned int  required_extension_count,
const struct vkd3d_optional_extension_info *  optional_extensions,
unsigned int  optional_extension_count,
const char *const *  user_extensions,
unsigned int  user_extension_count,
const char *const *  optional_user_extensions,
unsigned int  optional_user_extension_count,
bool *  user_extension_supported,
const struct vkd3d_vulkan_info *  vulkan_info 
)
static

Definition at line 387 of file device.c.

393{
394 unsigned int extension_count = 0;
395 unsigned int i;
396
397 for (i = 0; i < required_extension_count; ++i)
398 {
399 extensions[extension_count++] = required_extensions[i];
400 }
401 for (i = 0; i < optional_extension_count; ++i)
402 {
403 ptrdiff_t offset = optional_extensions[i].vulkan_info_offset;
404 const bool *supported = (void *)((uintptr_t)vulkan_info + offset);
405
406 if (*supported)
407 extensions[extension_count++] = optional_extensions[i].extension_name;
408 }
409
410 for (i = 0; i < user_extension_count; ++i)
411 {
412 extension_count = vkd3d_append_extension(extensions, extension_count, user_extensions[i]);
413 }
414 VKD3D_ASSERT(!optional_user_extension_count || user_extension_supported);
415 for (i = 0; i < optional_user_extension_count; ++i)
416 {
417 if (!user_extension_supported[i])
418 continue;
419 extension_count = vkd3d_append_extension(extensions, extension_count, optional_user_extensions[i]);
420 }
421
422 return extension_count;
423}
static unsigned int vkd3d_append_extension(const char *extensions[], unsigned int extension_count, const char *extension_name)
Definition: device.c:371

Referenced by vkd3d_create_vk_device(), and vkd3d_instance_init().

◆ vkd3d_find_struct_()

static const void * vkd3d_find_struct_ ( const struct vkd3d_struct *  chain,
enum vkd3d_structure_type  type 
)
static

Definition at line 31 of file device.c.

33{
34 while (chain)
35 {
36 if (chain->type == type)
37 return chain;
38
39 chain = chain->next;
40 }
41
42 return NULL;
43}
struct sock * chain
Definition: tcpcore.h:1

◆ vkd3d_get_device_parent()

IUnknown * vkd3d_get_device_parent ( ID3D12Device *  device)

Definition at line 5694 of file device.c.

5695{
5697
5698 return d3d12_device->parent;
5699}
IUnknown * parent

Referenced by d3d12_swapchain_GetContainingOutput().

◆ vkd3d_get_vk_device()

VkDevice vkd3d_get_vk_device ( ID3D12Device *  device)

Definition at line 5701 of file device.c.

5702{
5704
5705 return d3d12_device->vk_device;
5706}
VkDevice vk_device

Referenced by d3d12_swapchain_init().

◆ vkd3d_get_vk_physical_device()

VkPhysicalDevice vkd3d_get_vk_physical_device ( ID3D12Device *  device)

Definition at line 5708 of file device.c.

5709{
5711
5713}
VkPhysicalDevice vk_physical_device

Referenced by d3d12_swapchain_init().

◆ vkd3d_get_vk_version()

static uint32_t vkd3d_get_vk_version ( void  )
static

Definition at line 45 of file device.c.

46{
47 int major, minor;
48
50 return VK_MAKE_VERSION(major, minor, 0);
51}
#define minor(rdev)
Definition: propsheet.cpp:929
#define major(rdev)
Definition: propsheet.cpp:928
static void vkd3d_parse_version(const char *version, int *major, int *minor)
Definition: vkd3d_common.h:678
#define VK_MAKE_VERSION(major, minor, patch)
Definition: vulkan.h:830

Referenced by vkd3d_instance_init().

◆ vkd3d_gpu_va_allocation_compare()

static int vkd3d_gpu_va_allocation_compare ( const void *  k,
const void *  e 
)
static

Definition at line 2472 of file device.c.

2473{
2474 const struct vkd3d_gpu_va_allocation *allocation = e;
2476
2477 if (*address < allocation->base)
2478 return -1;
2479 if (*address - allocation->base >= allocation->size)
2480 return 1;
2481 return 0;
2482}
UINT64 D3D12_GPU_VIRTUAL_ADDRESS
Definition: d3d12.idl:1443
#define e
Definition: ke_i.h:82
int k
Definition: mpi.c:3369
D3D12_GPU_VIRTUAL_ADDRESS base

Referenced by vkd3d_gpu_va_allocator_dereference_fallback(), and vkd3d_gpu_va_allocator_free_fallback().

◆ vkd3d_gpu_va_allocator_allocate()

D3D12_GPU_VIRTUAL_ADDRESS vkd3d_gpu_va_allocator_allocate ( struct vkd3d_gpu_va_allocator *  allocator,
size_t  alignment,
uint64_t  size,
void *  ptr 
)

Definition at line 2424 of file device.c.

2426{
2428
2429 if (size > ~(uint64_t)0 - (alignment - 1))
2430 return 0;
2432
2433 vkd3d_mutex_lock(&allocator->mutex);
2434
2435 if (size <= VKD3D_VA_SLAB_SIZE && allocator->free_slab)
2437 else
2439
2441
2442 return address;
2443}
_Check_return_ _Ret_maybenull_ _In_ size_t alignment
Definition: align.cpp:48
static PVOID ptr
Definition: dispmode.c:27
static D3D12_GPU_VIRTUAL_ADDRESS vkd3d_gpu_va_allocator_allocate_fallback(struct vkd3d_gpu_va_allocator *allocator, size_t alignment, uint64_t aligned_size, void *ptr)
Definition: device.c:2392
static D3D12_GPU_VIRTUAL_ADDRESS vkd3d_gpu_va_allocator_allocate_slab(struct vkd3d_gpu_va_allocator *allocator, uint64_t aligned_size, void *ptr)
Definition: device.c:2370

Referenced by d3d12_resource_init().

◆ vkd3d_gpu_va_allocator_allocate_fallback()

static D3D12_GPU_VIRTUAL_ADDRESS vkd3d_gpu_va_allocator_allocate_fallback ( struct vkd3d_gpu_va_allocator *  allocator,
size_t  alignment,
uint64_t  aligned_size,
void *  ptr 
)
static

Definition at line 2392 of file device.c.

2394{
2395 struct vkd3d_gpu_va_allocation *allocation;
2397
2398 base = allocator->fallback_floor;
2399 ceiling = ~(D3D12_GPU_VIRTUAL_ADDRESS)0;
2400 ceiling -= alignment - 1;
2401 if (aligned_size > ceiling || ceiling - aligned_size < base)
2402 return 0;
2403
2405
2406 if (!vkd3d_array_reserve((void **)&allocator->fallback_allocations, &allocator->fallback_allocations_size,
2407 allocator->fallback_allocation_count + 1, sizeof(*allocator->fallback_allocations)))
2408 return 0;
2409
2410 allocation = &allocator->fallback_allocations[allocator->fallback_allocation_count++];
2411 allocation->base = base;
2412 allocation->size = aligned_size;
2413 allocation->ptr = ptr;
2414
2415 /* This pointer is bumped and never lowered on a free. However, this will
2416 * only fail once we have exhausted 63 bits of address space. */
2417 allocator->fallback_floor = base + aligned_size;
2418
2419 TRACE("Allocated address %#"PRIx64", size %"PRIu64".\n", base, aligned_size);
2420
2421 return base;
2422}

Referenced by vkd3d_gpu_va_allocator_allocate().

◆ vkd3d_gpu_va_allocator_allocate_slab()

static D3D12_GPU_VIRTUAL_ADDRESS vkd3d_gpu_va_allocator_allocate_slab ( struct vkd3d_gpu_va_allocator *  allocator,
uint64_t  aligned_size,
void *  ptr 
)
static

Definition at line 2370 of file device.c.

2372{
2373 struct vkd3d_gpu_va_slab *slab;
2375 unsigned slab_idx;
2376
2377 slab = allocator->free_slab;
2378 allocator->free_slab = slab->ptr;
2379 slab->size = aligned_size;
2380 slab->ptr = ptr;
2381
2382 /* It is critical that the multiplication happens in 64-bit to not
2383 * overflow. */
2384 slab_idx = slab - allocator->slabs;
2386
2387 TRACE("Allocated address %#"PRIx64", slab %u, size %"PRIu64".\n", address, slab_idx, aligned_size);
2388
2389 return address;
2390}
#define VKD3D_VA_SLAB_BASE
Definition: device.c:2365
#define VKD3D_VA_SLAB_SIZE
Definition: device.c:2367

Referenced by vkd3d_gpu_va_allocator_allocate().

◆ vkd3d_gpu_va_allocator_cleanup()

static void vkd3d_gpu_va_allocator_cleanup ( struct vkd3d_gpu_va_allocator *  allocator)
static

Definition at line 2608 of file device.c.

2609{
2610 vkd3d_mutex_lock(&allocator->mutex);
2611 vkd3d_free(allocator->slabs);
2612 vkd3d_free(allocator->fallback_allocations);
2615}

Referenced by d3d12_device_Release().

◆ vkd3d_gpu_va_allocator_dereference()

void * vkd3d_gpu_va_allocator_dereference ( struct vkd3d_gpu_va_allocator *  allocator,
D3D12_GPU_VIRTUAL_ADDRESS  address 
)

Definition at line 2495 of file device.c.

2497{
2498 void *ret;
2499
2500 /* If we land in the non-fallback region, dereferencing VA is lock-less.
2501 * The base pointer is immutable, and the only way we can have a data race
2502 * is if some other thread is poking into the
2503 * slab_mem_allocation[base_index] block. This can only happen if someone
2504 * is trying to free the entry while we're dereferencing it, which would
2505 * be a serious application bug. */
2508
2509 /* Slow fallback. */
2510 vkd3d_mutex_lock(&allocator->mutex);
2511
2513
2515
2516 return ret;
2517}
static void * vkd3d_gpu_va_allocator_dereference_fallback(struct vkd3d_gpu_va_allocator *allocator, D3D12_GPU_VIRTUAL_ADDRESS address)
Definition: device.c:2484
#define VKD3D_VA_FALLBACK_BASE
Definition: device.c:2364
static void * vkd3d_gpu_va_allocator_dereference_slab(struct vkd3d_gpu_va_allocator *allocator, D3D12_GPU_VIRTUAL_ADDRESS address)
Definition: device.c:2445

Referenced by d3d12_command_list_IASetIndexBuffer(), d3d12_command_list_IASetVertexBuffers(), d3d12_command_list_set_root_cbv(), d3d12_command_list_SOSetTargets(), d3d12_command_list_WriteBufferImmediate(), d3d12_desc_create_cbv(), and vkd3d_create_raw_buffer_view().

◆ vkd3d_gpu_va_allocator_dereference_fallback()

static void * vkd3d_gpu_va_allocator_dereference_fallback ( struct vkd3d_gpu_va_allocator *  allocator,
D3D12_GPU_VIRTUAL_ADDRESS  address 
)
static

Definition at line 2484 of file device.c.

2486{
2487 struct vkd3d_gpu_va_allocation *allocation;
2488
2489 allocation = bsearch(&address, allocator->fallback_allocations, allocator->fallback_allocation_count,
2490 sizeof(*allocation), vkd3d_gpu_va_allocation_compare);
2491
2492 return allocation ? allocation->ptr : NULL;
2493}
static int vkd3d_gpu_va_allocation_compare(const void *k, const void *e)
Definition: device.c:2472
#define bsearch

Referenced by vkd3d_gpu_va_allocator_dereference().

◆ vkd3d_gpu_va_allocator_dereference_slab()

static void * vkd3d_gpu_va_allocator_dereference_slab ( struct vkd3d_gpu_va_allocator *  allocator,
D3D12_GPU_VIRTUAL_ADDRESS  address 
)
static

Definition at line 2445 of file device.c.

2447{
2448 const struct vkd3d_gpu_va_slab *slab;
2449 D3D12_GPU_VIRTUAL_ADDRESS base_offset;
2450 unsigned int slab_idx;
2451
2452 base_offset = address - VKD3D_VA_SLAB_BASE;
2453 slab_idx = base_offset >> VKD3D_VA_SLAB_SIZE_SHIFT;
2454
2455 if (slab_idx >= VKD3D_VA_SLAB_COUNT)
2456 {
2457 ERR("Invalid slab index %u for address %#"PRIx64".\n", slab_idx, address);
2458 return NULL;
2459 }
2460
2461 slab = &allocator->slabs[slab_idx];
2462 base_offset -= slab_idx * VKD3D_VA_SLAB_SIZE;
2463 if (base_offset >= slab->size)
2464 {
2465 ERR("Address %#"PRIx64" is %#"PRIx64" bytes into slab %u of size %"PRIu64".\n",
2466 address, base_offset, slab_idx, slab->size);
2467 return NULL;
2468 }
2469 return slab->ptr;
2470}
#define VKD3D_VA_SLAB_COUNT
Definition: device.c:2368
#define VKD3D_VA_SLAB_SIZE_SHIFT
Definition: device.c:2366

Referenced by vkd3d_gpu_va_allocator_dereference().

◆ vkd3d_gpu_va_allocator_free()

void vkd3d_gpu_va_allocator_free ( struct vkd3d_gpu_va_allocator *  allocator,
D3D12_GPU_VIRTUAL_ADDRESS  address 
)

Definition at line 2565 of file device.c.

2566{
2567 vkd3d_mutex_lock(&allocator->mutex);
2568
2570 {
2573 return;
2574 }
2575
2577
2579}
static void vkd3d_gpu_va_allocator_free_slab(struct vkd3d_gpu_va_allocator *allocator, D3D12_GPU_VIRTUAL_ADDRESS address)
Definition: device.c:2519
static void vkd3d_gpu_va_allocator_free_fallback(struct vkd3d_gpu_va_allocator *allocator, D3D12_GPU_VIRTUAL_ADDRESS address)
Definition: device.c:2543

Referenced by d3d12_resource_destroy().

◆ vkd3d_gpu_va_allocator_free_fallback()

static void vkd3d_gpu_va_allocator_free_fallback ( struct vkd3d_gpu_va_allocator *  allocator,
D3D12_GPU_VIRTUAL_ADDRESS  address 
)
static

Definition at line 2543 of file device.c.

2545{
2546 struct vkd3d_gpu_va_allocation *allocation;
2547 unsigned int index;
2548
2549 allocation = bsearch(&address, allocator->fallback_allocations, allocator->fallback_allocation_count,
2550 sizeof(*allocation), vkd3d_gpu_va_allocation_compare);
2551
2552 if (!allocation || allocation->base != address)
2553 {
2554 ERR("Address %#"PRIx64" does not match any allocation.\n", address);
2555 return;
2556 }
2557
2558 index = allocation - allocator->fallback_allocations;
2559 --allocator->fallback_allocation_count;
2560 if (index != allocator->fallback_allocation_count)
2561 memmove(&allocator->fallback_allocations[index], &allocator->fallback_allocations[index + 1],
2562 (allocator->fallback_allocation_count - index) * sizeof(*allocation));
2563}
#define memmove(s1, s2, n)
Definition: mkisofs.h:881

Referenced by vkd3d_gpu_va_allocator_free().

◆ vkd3d_gpu_va_allocator_free_slab()

static void vkd3d_gpu_va_allocator_free_slab ( struct vkd3d_gpu_va_allocator *  allocator,
D3D12_GPU_VIRTUAL_ADDRESS  address 
)
static

Definition at line 2519 of file device.c.

2521{
2522 D3D12_GPU_VIRTUAL_ADDRESS base_offset;
2523 struct vkd3d_gpu_va_slab *slab;
2524 unsigned int slab_idx;
2525
2526 base_offset = address - VKD3D_VA_SLAB_BASE;
2527 slab_idx = base_offset >> VKD3D_VA_SLAB_SIZE_SHIFT;
2528
2529 if (slab_idx >= VKD3D_VA_SLAB_COUNT)
2530 {
2531 ERR("Invalid slab index %u for address %#"PRIx64".\n", slab_idx, address);
2532 return;
2533 }
2534
2535 TRACE("Freeing address %#"PRIx64", slab %u.\n", address, slab_idx);
2536
2537 slab = &allocator->slabs[slab_idx];
2538 slab->size = 0;
2539 slab->ptr = allocator->free_slab;
2540 allocator->free_slab = slab;
2541}

Referenced by vkd3d_gpu_va_allocator_free().

◆ vkd3d_gpu_va_allocator_init()

static bool vkd3d_gpu_va_allocator_init ( struct vkd3d_gpu_va_allocator *  allocator)
static

Definition at line 2581 of file device.c.

2582{
2583 unsigned int i;
2584
2585 memset(allocator, 0, sizeof(*allocator));
2586 allocator->fallback_floor = VKD3D_VA_FALLBACK_BASE;
2587
2588 /* To remain lock-less, we cannot grow the slabs array after the fact. If
2589 * we commit to a maximum number of allocations here, we can dereference
2590 * without taking a lock as the base pointer never changes. We would be
2591 * able to grow more seamlessly using an array of pointers, but that would
2592 * make dereferencing slightly less efficient. */
2593 if (!(allocator->slabs = vkd3d_calloc(VKD3D_VA_SLAB_COUNT, sizeof(*allocator->slabs))))
2594 return false;
2595
2596 /* Mark all slabs as free. */
2597 allocator->free_slab = &allocator->slabs[0];
2598 for (i = 0; i < VKD3D_VA_SLAB_COUNT - 1; ++i)
2599 {
2600 allocator->slabs[i].ptr = &allocator->slabs[i + 1];
2601 }
2602
2603 vkd3d_mutex_init(&allocator->mutex);
2604
2605 return true;
2606}

Referenced by d3d12_device_init().

◆ vkd3d_init_config_flags()

static uint64_t vkd3d_init_config_flags ( void  )
static

Definition at line 555 of file device.c.

556{
557 uint64_t config_flags;
558 const char *config;
559
560 config = getenv("VKD3D_CONFIG");
562
563 if (config_flags)
564 TRACE("VKD3D_CONFIG='%s'.\n", config);
565
566 return config_flags;
567}
struct config_s config
static const struct vkd3d_debug_option vkd3d_config_options[]
Definition: device.c:549
uint64_t vkd3d_parse_debug_options(const char *string, const struct vkd3d_debug_option *options, unsigned int option_count)
Definition: debug.c:370

Referenced by vkd3d_instance_init().

◆ vkd3d_init_debug_report()

static void vkd3d_init_debug_report ( struct vkd3d_instance *  instance)
static

Definition at line 527 of file device.c.

528{
529 const struct vkd3d_vk_instance_procs *vk_procs = &instance->vk_procs;
531 VkInstance vk_instance = instance->vk_instance;
532 VkDebugReportCallbackEXT callback;
533 VkResult vr;
534
536 callback_info.pNext = NULL;
539 callback_info.pUserData = NULL;
540 if ((vr = VK_CALL(vkCreateDebugReportCallbackEXT(vk_instance, &callback_info, NULL, &callback))) < 0)
541 {
542 WARN("Failed to create debug report callback, vr %d.\n", vr);
543 return;
544 }
545
546 instance->vk_debug_callback = callback;
547}
static IPrintDialogCallback callback
Definition: printdlg.c:325
static VkBool32 VKAPI_PTR vkd3d_debug_report_callback(VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT object_type, uint64_t object, size_t location, int32_t message_code, const char *layer_prefix, const char *message, void *user_data)
Definition: device.c:519
@ VK_DEBUG_REPORT_WARNING_BIT_EXT
Definition: vulkan.h:2320
@ VK_DEBUG_REPORT_ERROR_BIT_EXT
Definition: vulkan.h:2322
VkResult VKAPI_CALL vkCreateDebugReportCallbackEXT(VkInstance instance, const VkDebugReportCallbackCreateInfoEXT *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDebugReportCallbackEXT *pCallback)
@ VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT
Definition: vulkan.h:5024

Referenced by vkd3d_instance_init().

◆ vkd3d_init_device_caps()

static HRESULT vkd3d_init_device_caps ( struct d3d12_device *  device,
const struct vkd3d_device_create_info *  create_info,
struct vkd3d_physical_device_info *  physical_device_info,
uint32_t *  device_extension_count,
bool **  user_extension_supported 
)
static

Definition at line 1688 of file device.c.

1692{
1693 const VkPhysicalDeviceSubgroupProperties *subgroup_properties = &physical_device_info->subgroup_properties;
1694 const struct vkd3d_vk_instance_procs *vk_procs = &device->vkd3d_instance->vk_procs;
1695 VkPhysicalDeviceFragmentShaderInterlockFeaturesEXT *fragment_shader_interlock;
1697 VkPhysicalDevice physical_device = device->vk_physical_device;
1698 struct vkd3d_vulkan_info *vulkan_info = &device->vk_info;
1699 VkExtensionProperties *vk_extensions = NULL;
1700 VkPhysicalDeviceFeatures *features;
1701 uint32_t vk_extension_count;
1702 HRESULT hr;
1703
1704 /* SHUFFLE is required to implement WaveReadLaneAt with dynamically uniform index before SPIR-V 1.5 / Vulkan 1.2. */
1705 static const VkSubgroupFeatureFlags required_subgroup_features = VK_SUBGROUP_FEATURE_ARITHMETIC_BIT
1711
1713
1714 if (FAILED(hr = vkd3d_check_device_extensions(device, create_info, &vk_extensions, &vk_extension_count,
1715 device_extension_count, user_extension_supported)))
1716 return hr;
1717
1718 vkd3d_physical_device_info_init(physical_device_info, device);
1719
1720 vkd3d_trace_physical_device(physical_device, physical_device_info, vk_procs);
1721 vkd3d_trace_physical_device_features(physical_device_info);
1722 vkd3d_trace_physical_device_limits(physical_device_info);
1723
1724 features = &physical_device_info->features2.features;
1725
1726 if (!features->sparseResidencyBuffer || !features->sparseResidencyImage2D)
1727 {
1728 features->sparseResidencyBuffer = VK_FALSE;
1729 features->sparseResidencyImage2D = VK_FALSE;
1730 physical_device_info->properties2.properties.sparseProperties.residencyNonResidentStrict = VK_FALSE;
1731 }
1732
1733 vulkan_info->device_limits = physical_device_info->properties2.properties.limits;
1734 vulkan_info->sparse_properties = physical_device_info->properties2.properties.sparseProperties;
1735 vulkan_info->geometry_shaders = physical_device_info->features2.features.geometryShader;
1736 vulkan_info->tessellation_shaders = physical_device_info->features2.features.tessellationShader;
1737 vulkan_info->sparse_binding = features->sparseBinding;
1738 vulkan_info->sparse_residency_3d = features->sparseResidencyImage3D;
1740 vulkan_info->transform_feedback_queries = physical_device_info->xfb_properties.transformFeedbackQueries;
1742 vulkan_info->max_vertex_attrib_divisor = max(physical_device_info->vertex_divisor_properties.maxVertexAttribDivisor, 1);
1743
1744 device->feature_options.DoublePrecisionFloatShaderOps = features->shaderFloat64;
1745 device->feature_options.OutputMergerLogicOp = features->logicOp;
1746 /* SPV_KHR_16bit_storage */
1747 device->feature_options.MinPrecisionSupport = D3D12_SHADER_MIN_PRECISION_SUPPORT_NONE;
1748
1749 if (!features->sparseBinding)
1750 device->feature_options.TiledResourcesTier = D3D12_TILED_RESOURCES_TIER_NOT_SUPPORTED;
1751 else if (!device->vk_info.sparse_properties.residencyNonResidentStrict)
1752 device->feature_options.TiledResourcesTier = D3D12_TILED_RESOURCES_TIER_1;
1753 else if (!features->sparseResidencyImage3D)
1754 device->feature_options.TiledResourcesTier = D3D12_TILED_RESOURCES_TIER_2;
1755 else
1756 device->feature_options.TiledResourcesTier = D3D12_TILED_RESOURCES_TIER_3;
1757
1758 /* FIXME: Implement tiled resources. */
1759 if (device->feature_options.TiledResourcesTier)
1760 {
1761 WARN("Tiled resources are not implemented yet.\n");
1762 device->feature_options.TiledResourcesTier = D3D12_TILED_RESOURCES_TIER_NOT_SUPPORTED;
1763 }
1764
1765 if (device->vk_info.device_limits.maxPerStageDescriptorSamplers <= 16)
1766 device->feature_options.ResourceBindingTier = D3D12_RESOURCE_BINDING_TIER_1;
1767 else if (device->vk_info.device_limits.maxPerStageDescriptorUniformBuffers <= 14)
1768 device->feature_options.ResourceBindingTier = D3D12_RESOURCE_BINDING_TIER_2;
1769 else
1770 device->feature_options.ResourceBindingTier = D3D12_RESOURCE_BINDING_TIER_3;
1771
1772 device->feature_options.TypedUAVLoadAdditionalFormats = features->shaderStorageImageReadWithoutFormat
1774 /* GL_INTEL_conservative_rasterization, no Vulkan equivalent. */
1775 device->feature_options.ConservativeRasterizationTier = D3D12_CONSERVATIVE_RASTERIZATION_TIER_NOT_SUPPORTED;
1776 device->feature_options.MaxGPUVirtualAddressBitsPerResource = 40; /* FIXME */
1777 device->feature_options.StandardSwizzle64KBSupported = FALSE;
1778 device->feature_options.CrossNodeSharingTier = D3D12_CROSS_NODE_SHARING_TIER_NOT_SUPPORTED;
1779 device->feature_options.CrossAdapterRowMajorTextureSupported = FALSE;
1780 device->feature_options.ResourceHeapTier = D3D12_RESOURCE_HEAP_TIER_2;
1781
1782 /* Shader Model 6 support. */
1783 device->feature_options1.WaveOps = subgroup_properties->subgroupSize >= 4
1784 && (subgroup_properties->supportedOperations & required_subgroup_features) == required_subgroup_features
1785 && (subgroup_properties->supportedStages & required_stages) == required_stages;
1786 device->feature_options1.WaveLaneCountMin = subgroup_properties->subgroupSize;
1787 device->feature_options1.WaveLaneCountMax = subgroup_properties->subgroupSize;
1788 device->feature_options1.TotalLaneCount = 32 * subgroup_properties->subgroupSize; /* approx. */
1789 device->feature_options1.ExpandedComputeResourceStates = TRUE;
1790 device->feature_options1.Int64ShaderOps = features->shaderInt64;
1791
1792 device->feature_options2.DepthBoundsTestSupported = features->depthBounds;
1793 /* d3d12_command_list_SetSamplePositions() is not implemented. */
1794 device->feature_options2.ProgrammableSamplePositionsTier = D3D12_PROGRAMMABLE_SAMPLE_POSITIONS_TIER_NOT_SUPPORTED;
1795
1796 device->feature_options3.CopyQueueTimestampQueriesSupported = FALSE;
1797 device->feature_options3.CastingFullyTypedFormatSupported = FALSE;
1798 device->feature_options3.WriteBufferImmediateSupportFlags = D3D12_COMMAND_LIST_SUPPORT_FLAG_NONE;
1799 device->feature_options3.ViewInstancingTier = D3D12_VIEW_INSTANCING_TIER_NOT_SUPPORTED;
1800 device->feature_options3.BarycentricsSupported = FALSE;
1801
1802 device->feature_options4.MSAA64KBAlignedTextureSupported = FALSE;
1803 device->feature_options4.SharedResourceCompatibilityTier = D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER_0;
1804 /* An SM 6.2 feature. This would require features->shaderInt16 and
1805 * VK_KHR_shader_float16_int8. */
1806 device->feature_options4.Native16BitShaderOpsSupported = FALSE;
1807
1808 device->feature_options5.SRVOnlyTiledResourceTier3 = FALSE;
1809 device->feature_options5.RenderPassesTier = D3D12_RENDER_PASS_TIER_0;
1810 device->feature_options5.RaytracingTier = D3D12_RAYTRACING_TIER_NOT_SUPPORTED;
1811
1812 fragment_shader_interlock = &physical_device_info->fragment_shader_interlock_features;
1813 if (!fragment_shader_interlock->fragmentShaderSampleInterlock
1814 || !fragment_shader_interlock->fragmentShaderPixelInterlock)
1815 vulkan_info->EXT_fragment_shader_interlock = false;
1816 device->feature_options.ROVsSupported = vulkan_info->EXT_fragment_shader_interlock;
1817
1818 if (!physical_device_info->conditional_rendering_features.conditionalRendering)
1819 vulkan_info->EXT_conditional_rendering = false;
1820 if (!physical_device_info->depth_clip_features.depthClipEnable)
1821 vulkan_info->EXT_depth_clip_enable = false;
1822 if (!physical_device_info->robustness2_features.nullDescriptor)
1823 vulkan_info->EXT_robustness2 = false;
1824 if (!physical_device_info->demote_features.shaderDemoteToHelperInvocation)
1825 vulkan_info->EXT_shader_demote_to_helper_invocation = false;
1826 if (!physical_device_info->texel_buffer_alignment_features.texelBufferAlignment)
1827 vulkan_info->EXT_texel_buffer_alignment = false;
1828 if (!physical_device_info->mutable_features.mutableDescriptorType)
1829 vulkan_info->EXT_mutable_descriptor_type = false;
1830 if (!physical_device_info->timeline_semaphore_features.timelineSemaphore)
1831 vulkan_info->KHR_timeline_semaphore = false;
1832
1833 physical_device_info->formats4444_features.formatA4B4G4R4 = VK_FALSE;
1834
1835 vulkan_info->texel_buffer_alignment_properties = physical_device_info->texel_buffer_alignment_properties;
1836
1837 if (get_spec_version(vk_extensions, vk_extension_count, VK_EXT_VERTEX_ATTRIBUTE_DIVISOR_EXTENSION_NAME) >= 3)
1838 {
1840 divisor_features = &physical_device_info->vertex_divisor_features;
1841 if (!divisor_features->vertexAttributeInstanceRateDivisor)
1842 vulkan_info->EXT_vertex_attribute_divisor = false;
1844 }
1845 else
1846 {
1847 vulkan_info->vertex_attrib_zero_divisor = false;
1848 }
1849
1850 vkd3d_free(vk_extensions);
1851
1852 device->feature_options.PSSpecifiedStencilRefSupported = vulkan_info->EXT_shader_stencil_export;
1853 device->feature_options.VPAndRTArrayIndexFromAnyShaderFeedingRasterizerSupportedWithoutGSEmulation =
1855
1856 vkd3d_init_feature_level(vulkan_info, features, &device->feature_options);
1857
1859
1860 if (vulkan_info->max_feature_level < create_info->minimum_feature_level)
1861 {
1862 WARN("Feature level %#x is not supported.\n", create_info->minimum_feature_level);
1863 vkd3d_free(*user_extension_supported);
1864 *user_extension_supported = NULL;
1865 return E_INVALIDARG;
1866 }
1867
1868 /* Shader extensions. */
1870 {
1871 vulkan_info->shader_extension_count = 1;
1873 }
1874
1875 if (vulkan_info->EXT_descriptor_indexing)
1876 vulkan_info->shader_extensions[vulkan_info->shader_extension_count++]
1878
1879 if (vulkan_info->EXT_fragment_shader_interlock)
1880 vulkan_info->shader_extensions[vulkan_info->shader_extension_count++]
1882
1883 if (vulkan_info->EXT_shader_stencil_export)
1884 vulkan_info->shader_extensions[vulkan_info->shader_extension_count++]
1886
1887 if (vulkan_info->EXT_shader_viewport_index_layer)
1888 vulkan_info->shader_extensions[vulkan_info->shader_extension_count++]
1890
1891 /* Disable unused Vulkan features. */
1893
1894 descriptor_indexing = &physical_device_info->descriptor_indexing_features;
1897
1898 /* We do not use storage buffers currently. */
1902
1903 if (vulkan_info->EXT_descriptor_indexing && descriptor_indexing
1904 && (descriptor_indexing->descriptorBindingUniformBufferUpdateAfterBind
1905 || descriptor_indexing->descriptorBindingStorageBufferUpdateAfterBind
1909 {
1910 WARN("Disabling robust buffer access for the update after bind feature.\n");
1911 features->robustBufferAccess = VK_FALSE;
1912 physical_device_info->robustness2_features.robustBufferAccess2 = VK_FALSE;
1913 }
1914
1915 /* Select descriptor heap implementation. Forcing virtual heaps may be useful if
1916 * a client allocates descriptor heaps too large for the Vulkan device, or the
1917 * root signature cost exceeds the available push constant size. Virtual heaps
1918 * use only enough descriptors for the descriptor tables of the currently bound
1919 * root signature, and don't require a 32-bit push constant for each table. */
1920 device->use_vk_heaps = vulkan_info->EXT_descriptor_indexing
1921 && !(device->vkd3d_instance->config_flags & VKD3D_CONFIG_FLAG_VIRTUAL_HEAPS)
1922 && descriptor_indexing->descriptorBindingUniformBufferUpdateAfterBind
1923 && descriptor_indexing->descriptorBindingSampledImageUpdateAfterBind
1924 && descriptor_indexing->descriptorBindingStorageImageUpdateAfterBind
1927
1928 if (device->use_vk_heaps && device->vk_info.KHR_push_descriptor)
1929 {
1930 /* VKD3D_SET_INDEX_COUNT for the Vulkan heaps, one for the push
1931 * descriptors set and one for the static samplers set. */
1932 unsigned int descriptor_set_count = VKD3D_SET_INDEX_COUNT + 2;
1933
1934 /* A mutable descriptor set can replace all those that should otherwise
1935 * back the SRV-UAV-CBV descriptor heap. */
1936 if (device->vk_info.EXT_mutable_descriptor_type)
1937 descriptor_set_count -= VKD3D_SET_INDEX_COUNT - (VKD3D_SET_INDEX_MUTABLE + 1);
1938
1939 /* For many Vulkan implementations maxBoundDescriptorSets == 8; also,
1940 * if mutable descriptors are not available the descriptor set count
1941 * will be 9; so saving a descriptor set is going to be often
1942 * significant. */
1943 if (descriptor_set_count > device->vk_info.device_limits.maxBoundDescriptorSets)
1944 {
1945 WARN("Disabling VK_KHR_push_descriptor to save a descriptor set.\n");
1946 device->vk_info.KHR_push_descriptor = VK_FALSE;
1947 }
1948 }
1949
1950 if (device->use_vk_heaps)
1952 &physical_device_info->descriptor_indexing_properties);
1953 else
1955 &physical_device_info->properties2.properties.limits);
1956
1957 TRACE("Device %p: using %s descriptor heaps, with%s descriptor indexing, "
1958 "with%s push descriptors, with%s mutable descriptors\n",
1959 device, device->use_vk_heaps ? "Vulkan" : "virtual",
1960 device->vk_info.EXT_descriptor_indexing ? "" : "out",
1961 device->vk_info.KHR_push_descriptor ? "" : "out",
1962 device->vk_info.EXT_mutable_descriptor_type ? "" : "out");
1963
1965
1966 return S_OK;
1967}
@ D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER_0
Definition: d3d12.idl:605
@ D3D12_RAYTRACING_TIER_NOT_SUPPORTED
Definition: d3d12.idl:631
@ D3D12_TILED_RESOURCES_TIER_NOT_SUPPORTED
Definition: d3d12.idl:466
@ D3D12_TILED_RESOURCES_TIER_1
Definition: d3d12.idl:467
@ D3D12_TILED_RESOURCES_TIER_2
Definition: d3d12.idl:468
@ D3D12_TILED_RESOURCES_TIER_3
Definition: d3d12.idl:469
@ D3D12_CONSERVATIVE_RASTERIZATION_TIER_NOT_SUPPORTED
Definition: d3d12.idl:481
@ D3D12_SHADER_MIN_PRECISION_SUPPORT_NONE
Definition: d3d12.idl:458
@ D3D12_PROGRAMMABLE_SAMPLE_POSITIONS_TIER_NOT_SUPPORTED
Definition: d3d12.idl:564
@ D3D12_RENDER_PASS_TIER_0
Definition: d3d12.idl:624
@ D3D12_VIEW_INSTANCING_TIER_NOT_SUPPORTED
Definition: d3d12.idl:597
@ D3D12_RESOURCE_BINDING_TIER_3
Definition: d3d12.idl:476
@ D3D12_RESOURCE_BINDING_TIER_1
Definition: d3d12.idl:474
@ D3D12_RESOURCE_BINDING_TIER_2
Definition: d3d12.idl:475
@ D3D12_CROSS_NODE_SHARING_TIER_NOT_SUPPORTED
Definition: d3d12.idl:489
@ D3D12_COMMAND_LIST_SUPPORT_FLAG_NONE
Definition: d3d12.idl:584
@ D3D12_RESOURCE_HEAP_TIER_2
Definition: d3d12.idl:499
static void vkd3d_init_feature_level(struct vkd3d_vulkan_info *vk_info, const VkPhysicalDeviceFeatures *features, const D3D12_FEATURE_DATA_D3D12_OPTIONS *d3d12_options)
Definition: device.c:1358
static HRESULT vkd3d_check_device_extensions(struct d3d12_device *device, const struct vkd3d_device_create_info *create_info, VkExtensionProperties **vk_extensions, uint32_t *vk_extension_count, uint32_t *device_extension_count, bool **user_extension_supported)
Definition: device.c:1528
static void vkd3d_chain_physical_device_info_structures(struct vkd3d_physical_device_info *info, struct d3d12_device *device)
Definition: device.c:842
static void vkd3d_override_caps(struct d3d12_device *device)
Definition: device.c:1583
static void vkd3d_trace_physical_device(VkPhysicalDevice device, const struct vkd3d_physical_device_info *info, const struct vkd3d_vk_instance_procs *vk_procs)
Definition: device.c:947
static void vkd3d_trace_physical_device_limits(const struct vkd3d_physical_device_info *info)
Definition: device.c:990
static unsigned int get_spec_version(const VkExtensionProperties *extensions, unsigned int count, const char *extension_name)
Definition: device.c:262
static void vkd3d_physical_device_info_init(struct vkd3d_physical_device_info *info, struct d3d12_device *device)
Definition: device.c:890
static bool d3d12_device_supports_typed_uav_load_additional_formats(const struct d3d12_device *device)
Definition: device.c:1489
static void vkd3d_trace_physical_device_features(const struct vkd3d_physical_device_info *info)
Definition: device.c:1204
static void vkd3d_device_descriptor_limits_init(struct vkd3d_device_descriptor_limits *limits, const VkPhysicalDeviceLimits *device_limits)
Definition: device.c:1449
static void vkd3d_device_vk_heaps_descriptor_limits_init(struct vkd3d_device_descriptor_limits *limits, const VkPhysicalDeviceDescriptorIndexingPropertiesEXT *properties)
Definition: device.c:1459
VkPhysicalDeviceFeatures features
Definition: vulkan.h:10624
VkBool32 shaderStorageBufferArrayDynamicIndexing
Definition: vulkan.h:10598
VkBool32 tessellationShader
Definition: vulkan.h:10568
VkBool32 robustBufferAccess
Definition: vulkan.h:10563
VkBool32 sparseResidencyImage2D
Definition: vulkan.h:10609
VkBool32 sparseResidencyImage3D
Definition: vulkan.h:10610
VkBool32 shaderTessellationAndGeometryPointSize
Definition: vulkan.h:10590
VkBool32 shaderStorageImageReadWithoutFormat
Definition: vulkan.h:10594
VkBool32 sparseResidencyBuffer
Definition: vulkan.h:10608
VkSubgroupFeatureFlags supportedOperations
Definition: vulkan.h:12387
VkShaderStageFlags supportedStages
Definition: vulkan.h:12386
D3D_FEATURE_LEVEL minimum_feature_level
Definition: vkd3d.h:255
VkPhysicalDeviceFeatures2 features2
Definition: device.c:839
VkPhysicalDeviceRobustness2FeaturesEXT robustness2_features
Definition: device.c:830
VkPhysicalDeviceConditionalRenderingFeaturesEXT conditional_rendering_features
Definition: device.c:826
VkPhysicalDeviceDescriptorIndexingPropertiesEXT descriptor_indexing_properties
Definition: device.c:816
VkPhysicalDeviceFragmentShaderInterlockFeaturesEXT fragment_shader_interlock_features
Definition: device.c:829
VkPhysicalDeviceTimelineSemaphoreFeaturesKHR timeline_semaphore_features
Definition: device.c:835
VkPhysicalDeviceTexelBufferAlignmentFeaturesEXT texel_buffer_alignment_features
Definition: device.c:832
VkPhysicalDeviceTexelBufferAlignmentPropertiesEXT texel_buffer_alignment_properties
Definition: device.c:818
VkPhysicalDeviceProperties2KHR properties2
Definition: device.c:823
VkPhysicalDeviceShaderDemoteToHelperInvocationFeaturesEXT demote_features
Definition: device.c:831
VkPhysicalDeviceSubgroupProperties subgroup_properties
Definition: device.c:821
VkPhysicalDeviceDescriptorIndexingFeaturesEXT descriptor_indexing_features
Definition: device.c:828
VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT vertex_divisor_properties
Definition: device.c:820
VkPhysicalDeviceDepthClipEnableFeaturesEXT depth_clip_features
Definition: device.c:827
VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT vertex_divisor_features
Definition: device.c:834
VkPhysicalDeviceTransformFeedbackPropertiesEXT xfb_properties
Definition: device.c:819
VkPhysicalDevice4444FormatsFeaturesEXT formats4444_features
Definition: device.c:837
VkPhysicalDeviceMutableDescriptorTypeFeaturesEXT mutable_features
Definition: device.c:836
bool EXT_shader_viewport_index_layer
VkPhysicalDeviceLimits device_limits
bool vertex_attrib_zero_divisor
bool EXT_shader_stencil_export
VkPhysicalDeviceSparseProperties sparse_properties
unsigned int shader_extension_count
struct vkd3d_device_descriptor_limits descriptor_limits
VkPhysicalDeviceTexelBufferAlignmentPropertiesEXT texel_buffer_alignment_properties
enum vkd3d_shader_spirv_extension shader_extensions[VKD3D_MAX_SHADER_EXTENSIONS]
bool transform_feedback_queries
unsigned int max_vertex_attrib_divisor
@ VKD3D_SET_INDEX_COUNT
@ VKD3D_CONFIG_FLAG_VIRTUAL_HEAPS
@ VKD3D_SHADER_SPIRV_EXTENSION_EXT_DEMOTE_TO_HELPER_INVOCATION
@ VKD3D_SHADER_SPIRV_EXTENSION_EXT_FRAGMENT_SHADER_INTERLOCK
@ VKD3D_SHADER_SPIRV_EXTENSION_EXT_STENCIL_EXPORT
@ VKD3D_SHADER_SPIRV_EXTENSION_EXT_VIEWPORT_INDEX_LAYER
@ VKD3D_SHADER_SPIRV_EXTENSION_EXT_DESCRIPTOR_INDEXING
@ VK_SHADER_STAGE_COMPUTE_BIT
Definition: vulkan.h:4880
@ VK_SHADER_STAGE_FRAGMENT_BIT
Definition: vulkan.h:4878
#define VK_EXT_VERTEX_ATTRIBUTE_DIVISOR_EXTENSION_NAME
Definition: vulkan.h:323
VkFlags VkSubgroupFeatureFlags
Definition: vulkan.h:1139
@ VK_SUBGROUP_FEATURE_SHUFFLE_BIT
Definition: vulkan.h:6072
@ VK_SUBGROUP_FEATURE_VOTE_BIT
Definition: vulkan.h:6069
@ VK_SUBGROUP_FEATURE_QUAD_BIT
Definition: vulkan.h:6075
@ VK_SUBGROUP_FEATURE_BASIC_BIT
Definition: vulkan.h:6068
@ VK_SUBGROUP_FEATURE_ARITHMETIC_BIT
Definition: vulkan.h:6070
@ VK_SUBGROUP_FEATURE_BALLOT_BIT
Definition: vulkan.h:6071

Referenced by vkd3d_create_vk_device().

◆ vkd3d_init_feature_level()

static void vkd3d_init_feature_level ( struct vkd3d_vulkan_info *  vk_info,
const VkPhysicalDeviceFeatures *  features,
const D3D12_FEATURE_DATA_D3D12_OPTIONS *  d3d12_options 
)
static

Definition at line 1358 of file device.c.

1361{
1362 bool have_11_0 = true;
1363
1364#define CHECK_MIN_REQUIREMENT(name, value) \
1365 if (vk_info->device_limits.name < value) \
1366 WARN(#name " does not meet feature level 11_0 requirements.\n");
1367#define CHECK_MAX_REQUIREMENT(name, value) \
1368 if (vk_info->device_limits.name > value) \
1369 WARN(#name " does not meet feature level 11_0 requirements.\n");
1370#define CHECK_FEATURE(name) \
1371 if (!features->name) \
1372 { \
1373 WARN(#name " is not supported.\n"); \
1374 have_11_0 = false; \
1375 }
1376
1378 WARN("Timestamps are not supported on all graphics and compute queues.\n");
1379
1380 CHECK_MIN_REQUIREMENT(maxPushConstantsSize, D3D12_MAX_ROOT_COST * sizeof(uint32_t));
1381 CHECK_MIN_REQUIREMENT(maxComputeSharedMemorySize, D3D12_CS_TGSM_REGISTER_COUNT * sizeof(uint32_t));
1382
1383 CHECK_MAX_REQUIREMENT(viewportBoundsRange[0], D3D12_VIEWPORT_BOUNDS_MIN);
1384 CHECK_MIN_REQUIREMENT(viewportBoundsRange[1], D3D12_VIEWPORT_BOUNDS_MAX);
1385 CHECK_MIN_REQUIREMENT(viewportSubPixelBits, 8);
1386
1387 CHECK_MIN_REQUIREMENT(maxPerStageDescriptorUniformBuffers,
1389
1390 CHECK_FEATURE(depthBiasClamp);
1391 CHECK_FEATURE(depthClamp);
1392 CHECK_FEATURE(drawIndirectFirstInstance);
1393 CHECK_FEATURE(dualSrcBlend);
1394 CHECK_FEATURE(fragmentStoresAndAtomics);
1395 CHECK_FEATURE(fullDrawIndexUint32);
1396 CHECK_FEATURE(geometryShader);
1397 CHECK_FEATURE(imageCubeArray);
1398 CHECK_FEATURE(independentBlend);
1399 CHECK_FEATURE(multiDrawIndirect);
1400 CHECK_FEATURE(multiViewport);
1401 CHECK_FEATURE(occlusionQueryPrecise);
1402 CHECK_FEATURE(pipelineStatisticsQuery);
1403 CHECK_FEATURE(samplerAnisotropy);
1404 CHECK_FEATURE(sampleRateShading);
1405 CHECK_FEATURE(shaderClipDistance);
1406 CHECK_FEATURE(shaderCullDistance);
1407 CHECK_FEATURE(shaderImageGatherExtended);
1408 CHECK_FEATURE(shaderStorageImageWriteWithoutFormat);
1409 CHECK_FEATURE(tessellationShader);
1410
1411 if (!vk_info->EXT_depth_clip_enable)
1412 WARN("Depth clip enable is not supported.\n");
1413 if (!vk_info->EXT_transform_feedback)
1414 WARN("Stream output is not supported.\n");
1415
1416 if (!vk_info->EXT_vertex_attribute_divisor)
1417 WARN("Vertex attribute instance rate divisor is not supported.\n");
1418 else if (!vk_info->vertex_attrib_zero_divisor)
1419 WARN("Vertex attribute instance rate zero divisor is not supported.\n");
1420
1421#undef CHECK_MIN_REQUIREMENT
1422#undef CHECK_MAX_REQUIREMENT
1423#undef CHECK_FEATURE
1424
1426
1427 if (have_11_0
1428 && d3d12_options->OutputMergerLogicOp
1433
1434 /* TODO: MinMaxFiltering */
1438 && d3d12_options->TypedUAVLoadAdditionalFormats)
1440
1442 && d3d12_options->ROVsSupported
1445
1446 TRACE("Max feature level: %#x.\n", vk_info->max_feature_level);
1447}
const INT D3D12_VIEWPORT_BOUNDS_MIN
Definition: d3d12.idl:436
const UINT D3D12_COMMONSHADER_CONSTANT_BUFFER_REGISTER_COUNT
Definition: d3d12.idl:40
const UINT D3D12_UAV_SLOT_COUNT
Definition: d3d12.idl:424
@ D3D12_CONSERVATIVE_RASTERIZATION_TIER_1
Definition: d3d12.idl:482
const UINT D3D12_CS_TGSM_REGISTER_COUNT
Definition: d3d12.idl:109
const UINT D3D12_VIEWPORT_BOUNDS_MAX
Definition: d3d12.idl:435
@ D3D_FEATURE_LEVEL_12_1
Definition: d3dcommon.idl:112
@ D3D_FEATURE_LEVEL_12_0
Definition: d3dcommon.idl:111
@ D3D_FEATURE_LEVEL_11_0
Definition: d3dcommon.idl:109
@ D3D_FEATURE_LEVEL_11_1
Definition: d3dcommon.idl:110
#define CHECK_FEATURE(name)
#define CHECK_MIN_REQUIREMENT(name, value)
#define CHECK_MAX_REQUIREMENT(name, value)
D3D12_RESOURCE_BINDING_TIER ResourceBindingTier
Definition: d3d12.idl:744
D3D12_TILED_RESOURCES_TIER TiledResourcesTier
Definition: d3d12.idl:743
D3D12_CONSERVATIVE_RASTERIZATION_TIER ConservativeRasterizationTier
Definition: d3d12.idl:748
VkBool32 vertexPipelineStoresAndAtomics
Definition: vulkan.h:10588
VkBool32 timestampComputeAndGraphics
Definition: vulkan.h:11153
uint32_t maxPerStageDescriptorStorageBuffers
Definition: vulkan.h:11078
uint32_t maxPerStageDescriptorStorageImages
Definition: vulkan.h:11080

Referenced by vkd3d_init_device_caps().

◆ vkd3d_init_instance_caps()

static HRESULT vkd3d_init_instance_caps ( struct vkd3d_instance *  instance,
const struct vkd3d_instance_create_info *  create_info,
uint32_t *  instance_extension_count,
bool **  user_extension_supported 
)
static

Definition at line 425 of file device.c.

428{
429 const struct vkd3d_vk_global_procs *vk_procs = &instance->vk_global_procs;
430 const struct vkd3d_optional_instance_extensions_info *optional_extensions;
431 struct vkd3d_vulkan_info *vulkan_info = &instance->vk_info;
432 VkExtensionProperties *vk_extensions;
434 VkResult vr;
435
436 memset(vulkan_info, 0, sizeof(*vulkan_info));
437 *instance_extension_count = 0;
438
439 if ((vr = vk_procs->vkEnumerateInstanceExtensionProperties(NULL, &count, NULL)) < 0)
440 {
441 ERR("Failed to enumerate instance extensions, vr %d.\n", vr);
442 return hresult_from_vk_result(vr);
443 }
444
445 if (!(vk_extensions = vkd3d_calloc(count, sizeof(*vk_extensions))))
446 return E_OUTOFMEMORY;
447
448 TRACE("Enumerating %u instance extensions.\n", count);
449 if ((vr = vk_procs->vkEnumerateInstanceExtensionProperties(NULL, &count, vk_extensions)) < 0)
450 {
451 ERR("Failed to enumerate instance extensions, vr %d.\n", vr);
452 vkd3d_free(vk_extensions);
453 return hresult_from_vk_result(vr);
454 }
455
456 optional_extensions = vkd3d_find_struct(create_info->next, OPTIONAL_INSTANCE_EXTENSIONS_INFO);
457 if (optional_extensions && optional_extensions->extension_count)
458 {
459 if (!(*user_extension_supported = vkd3d_calloc(optional_extensions->extension_count, sizeof(bool))))
460 {
461 vkd3d_free(vk_extensions);
462 return E_OUTOFMEMORY;
463 }
464 }
465 else
466 {
467 *user_extension_supported = NULL;
468 }
469
470 *instance_extension_count = vkd3d_check_extensions(vk_extensions, count, NULL, 0,
472 create_info->instance_extensions, create_info->instance_extension_count,
473 optional_extensions ? optional_extensions->extensions : NULL,
474 optional_extensions ? optional_extensions->extension_count : 0,
475 *user_extension_supported, vulkan_info, "instance",
477
478 vkd3d_free(vk_extensions);
479 return S_OK;
480}
static const struct vkd3d_optional_extension_info optional_instance_extensions[]
Definition: device.c:65
const char *const * instance_extensions
Definition: vkd3d.h:152
uint32_t instance_extension_count
Definition: vkd3d.h:154
const void * next
Definition: vkd3d.h:123
const char *const * extensions
Definition: vkd3d.h:175
PFN_vkEnumerateInstanceExtensionProperties vkEnumerateInstanceExtensionProperties
Definition: vkd3d_private.h:77

Referenced by vkd3d_instance_init().

◆ vkd3d_init_vk_global_procs()

static HRESULT vkd3d_init_vk_global_procs ( struct vkd3d_instance *  instance,
PFN_vkGetInstanceProcAddr  vkGetInstanceProcAddr 
)
static

Definition at line 482 of file device.c.

484{
485 HRESULT hr;
486
488 {
489 if (!(instance->libvulkan = vkd3d_dlopen(SONAME_LIBVULKAN)))
490 {
491 ERR("Failed to load libvulkan: %s.\n", vkd3d_dlerror());
492 return E_FAIL;
493 }
494
495 if (!(vkGetInstanceProcAddr = vkd3d_dlsym(instance->libvulkan, "vkGetInstanceProcAddr")))
496 {
497 ERR("Could not load function pointer for vkGetInstanceProcAddr().\n");
498 vkd3d_dlclose(instance->libvulkan);
499 instance->libvulkan = NULL;
500 return E_FAIL;
501 }
502 }
503 else
504 {
505 instance->libvulkan = NULL;
506 }
507
509 {
510 if (instance->libvulkan)
511 vkd3d_dlclose(instance->libvulkan);
512 instance->libvulkan = NULL;
513 return hr;
514 }
515
516 return S_OK;
517}
#define SONAME_LIBVULKAN
Definition: config.h:10
HRESULT vkd3d_load_vk_global_procs(struct vkd3d_vk_global_procs *procs, PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr)
Definition: utils.c:811
static void * vkd3d_dlsym(void *handle, const char *symbol)
Definition: vkd3d_common.h:746
static const char * vkd3d_dlerror(void)
Definition: vkd3d_common.h:756
static void * vkd3d_dlopen(const char *name)
Definition: vkd3d_common.h:741
PFN_vkVoidFunction VKAPI_CALL vkGetInstanceProcAddr(VkInstance instance, const char *pName)

Referenced by vkd3d_instance_init().

◆ vkd3d_instance_decref()

ULONG vkd3d_instance_decref ( struct vkd3d_instance *  instance)

Definition at line 791 of file device.c.

792{
793 unsigned int refcount = vkd3d_atomic_decrement_u32(&instance->refcount);
794
795 TRACE("%p decreasing refcount to %u.\n", instance, refcount);
796
797 if (!refcount)
799
800 return refcount;
801}
static void vkd3d_destroy_instance(struct vkd3d_instance *instance)
Definition: device.c:766

Referenced by d3d12_device_init(), d3d12_device_Release(), D3D12CreateDevice(), and vkd3d_create_device().

◆ vkd3d_instance_from_device()

struct vkd3d_instance * vkd3d_instance_from_device ( ID3D12Device *  device)

Definition at line 5715 of file device.c.

5716{
5718
5720}
struct vkd3d_instance * vkd3d_instance

Referenced by d3d12_swapchain_init().

◆ vkd3d_instance_get_vk_instance()

VkInstance vkd3d_instance_get_vk_instance ( struct vkd3d_instance *  instance)

Definition at line 803 of file device.c.

804{
805 return instance->vk_instance;
806}

Referenced by d3d12_get_vk_physical_device(), and d3d12_swapchain_init().

◆ vkd3d_instance_incref()

ULONG vkd3d_instance_incref ( struct vkd3d_instance *  instance)

Definition at line 782 of file device.c.

783{
784 unsigned int refcount = vkd3d_atomic_increment_u32(&instance->refcount);
785
786 TRACE("%p increasing refcount to %u.\n", instance, refcount);
787
788 return refcount;
789}

Referenced by d3d12_device_init(), and vkd3d_create_device().

◆ vkd3d_instance_init()

static HRESULT vkd3d_instance_init ( struct vkd3d_instance *  instance,
const struct vkd3d_instance_create_info *  create_info 
)
static

Definition at line 572 of file device.c.

574{
575 const struct vkd3d_vk_global_procs *vk_global_procs = &instance->vk_global_procs;
576 const struct vkd3d_optional_instance_extensions_info *optional_extensions;
578 const struct vkd3d_host_time_domain_info *time_domain_info;
580 bool *user_extension_supported = NULL;
581 VkApplicationInfo application_info;
582 VkInstanceCreateInfo instance_info;
583 char application_name[PATH_MAX];
584 uint32_t extension_count;
585 const char **extensions;
586 uint32_t vk_api_version;
587 VkInstance vk_instance;
588 VkResult vr;
589 HRESULT hr;
590
591 TRACE("Build: " PACKAGE_STRING VKD3D_VCS_ID ".\n");
592
593 if (!create_info->pfn_signal_event)
594 {
595 WARN("Invalid signal event function pointer.\n");
596 return E_INVALIDARG;
597 }
598 if (!create_info->pfn_create_thread != !create_info->pfn_join_thread)
599 {
600 WARN("Invalid create/join thread function pointers.\n");
601 return E_INVALIDARG;
602 }
603 if (create_info->wchar_size != 2 && create_info->wchar_size != 4)
604 {
605 WARN("Unexpected WCHAR size %zu.\n", create_info->wchar_size);
606 return E_INVALIDARG;
607 }
608
609 instance->signal_event = create_info->pfn_signal_event;
610 instance->create_thread = create_info->pfn_create_thread;
611 instance->join_thread = create_info->pfn_join_thread;
612 instance->wchar_size = create_info->wchar_size;
613
614 instance->config_flags = vkd3d_init_config_flags();
615
617 {
618 WARN("Failed to initialise Vulkan global procs, hr %s.\n", debugstr_hresult(hr));
619 return hr;
620 }
621
622 if (FAILED(hr = vkd3d_init_instance_caps(instance, create_info,
623 &extension_count, &user_extension_supported)))
624 {
625 if (instance->libvulkan)
626 vkd3d_dlclose(instance->libvulkan);
627 return hr;
628 }
629
630 application_info.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
631 application_info.pNext = NULL;
632 application_info.pApplicationName = NULL;
633 application_info.applicationVersion = 0;
634 application_info.pEngineName = PACKAGE_NAME;
635 application_info.engineVersion = vkd3d_get_vk_version();
636 application_info.apiVersion = VK_API_VERSION_1_0;
637 instance->api_version = VKD3D_API_VERSION_1_0;
638
639 /* vkEnumerateInstanceVersion was added in Vulkan 1.1, and its absence indicates only 1.0 is supported. */
640 vkEnumerateInstanceVersion = (void *)vk_global_procs->vkGetInstanceProcAddr(NULL, "vkEnumerateInstanceVersion");
641 if (vkEnumerateInstanceVersion && vkEnumerateInstanceVersion(&vk_api_version) >= 0
642 && vk_api_version >= VK_API_VERSION_1_1)
643 {
644 TRACE("Vulkan API version 1.1 is available; requesting it.\n");
645 application_info.apiVersion = VK_API_VERSION_1_1;
646 }
647 instance->vk_api_version = application_info.apiVersion;
648
649 if ((vkd3d_application_info = vkd3d_find_struct(create_info->next, APPLICATION_INFO)))
650 {
653 else if (vkd3d_get_program_name(application_name))
654 application_info.pApplicationName = application_name;
657 {
660 }
662 }
663 else if (vkd3d_get_program_name(application_name))
664 {
665 application_info.pApplicationName = application_name;
666 }
667
668 TRACE("Application: %s.\n", debugstr_a(application_info.pApplicationName));
669 TRACE("vkd3d API version: %u.\n", instance->api_version);
670
671 if (!(extensions = vkd3d_calloc(extension_count, sizeof(*extensions))))
672 {
673 if (instance->libvulkan)
674 vkd3d_dlclose(instance->libvulkan);
675 vkd3d_free(user_extension_supported);
676 return E_OUTOFMEMORY;
677 }
678
679 optional_extensions = vkd3d_find_struct(create_info->next, OPTIONAL_INSTANCE_EXTENSIONS_INFO);
680
682 instance_info.pNext = NULL;
683 instance_info.flags = 0;
684 instance_info.pApplicationInfo = &application_info;
685 instance_info.enabledLayerCount = 0;
686 instance_info.ppEnabledLayerNames = NULL;
687 instance_info.enabledExtensionCount = vkd3d_enable_extensions(extensions, NULL, 0,
689 create_info->instance_extensions, create_info->instance_extension_count,
690 optional_extensions ? optional_extensions->extensions : NULL,
691 optional_extensions ? optional_extensions->extension_count : 0,
692 user_extension_supported, &instance->vk_info);
693 instance_info.ppEnabledExtensionNames = extensions;
694 vkd3d_free(user_extension_supported);
695
696 vr = vk_global_procs->vkCreateInstance(&instance_info, NULL, &vk_instance);
697 vkd3d_free(extensions);
698 if (vr < 0)
699 {
700 WARN("Failed to create Vulkan instance, vr %d.\n", vr);
701 if (instance->libvulkan)
702 vkd3d_dlclose(instance->libvulkan);
703 return hresult_from_vk_result(vr);
704 }
705
706 if (FAILED(hr = vkd3d_load_vk_instance_procs(&instance->vk_procs, vk_global_procs, vk_instance)))
707 {
708 WARN("Failed to load instance procs, hr %s.\n", debugstr_hresult(hr));
709 if (instance->vk_procs.vkDestroyInstance)
710 instance->vk_procs.vkDestroyInstance(vk_instance, NULL);
711 if (instance->libvulkan)
712 vkd3d_dlclose(instance->libvulkan);
713 return hr;
714 }
715
716 if ((time_domain_info = vkd3d_find_struct(create_info->next, HOST_TIME_DOMAIN_INFO)))
717 instance->host_ticks_per_second = time_domain_info->ticks_per_second;
718 else
719 instance->host_ticks_per_second = VKD3D_DEFAULT_HOST_TICKS_PER_SECOND;
720
721 instance->vk_instance = vk_instance;
722
723 TRACE("Created Vulkan instance %p.\n", vk_instance);
724
725 instance->refcount = 1;
726
727 instance->vk_debug_callback = VK_NULL_HANDLE;
728 if (instance->vk_info.EXT_debug_report)
730
731 return S_OK;
732}
#define PATH_MAX
Definition: types.h:280
#define PACKAGE_NAME
Definition: config.h:826
#define PACKAGE_STRING
Definition: config.h:829
static uint32_t vkd3d_get_vk_version(void)
Definition: device.c:45
static HRESULT vkd3d_init_vk_global_procs(struct vkd3d_instance *instance, PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr)
Definition: device.c:482
static HRESULT vkd3d_init_instance_caps(struct vkd3d_instance *instance, const struct vkd3d_instance_create_info *create_info, uint32_t *instance_extension_count, bool **user_extension_supported)
Definition: device.c:425
static void vkd3d_init_debug_report(struct vkd3d_instance *instance)
Definition: device.c:527
static uint64_t vkd3d_init_config_flags(void)
Definition: device.c:555
#define VKD3D_DEFAULT_HOST_TICKS_PER_SECOND
Definition: device.c:570
HRESULT vkd3d_load_vk_instance_procs(struct vkd3d_vk_instance_procs *procs, const struct vkd3d_vk_global_procs *global_procs, VkInstance instance)
Definition: utils.c:834
bool vkd3d_get_program_name(char program_name[PATH_MAX])
Definition: utils.c:931
uint32_t engineVersion
Definition: vulkan.h:7346
const char * pApplicationName
Definition: vulkan.h:7343
const void * pNext
Definition: vulkan.h:7342
VkStructureType sType
Definition: vulkan.h:7341
uint32_t apiVersion
Definition: vulkan.h:7347
const char * pEngineName
Definition: vulkan.h:7345
uint32_t applicationVersion
Definition: vulkan.h:7344
const char *const * ppEnabledExtensionNames
Definition: vulkan.h:9251
VkStructureType sType
Definition: vulkan.h:9244
uint32_t enabledExtensionCount
Definition: vulkan.h:9250
const void * pNext
Definition: vulkan.h:9245
const VkApplicationInfo * pApplicationInfo
Definition: vulkan.h:9247
const char *const * ppEnabledLayerNames
Definition: vulkan.h:9249
uint32_t enabledLayerCount
Definition: vulkan.h:9248
VkInstanceCreateFlags flags
Definition: vulkan.h:9246
uint32_t engine_version
Definition: vkd3d.h:211
enum vkd3d_api_version api_version
Definition: vkd3d.h:217
const char * engine_name
Definition: vkd3d.h:206
const char * application_name
Definition: vkd3d.h:199
uint32_t application_version
Definition: vkd3d.h:201
PFN_vkd3d_signal_event pfn_signal_event
Definition: vkd3d.h:126
PFN_vkGetInstanceProcAddr pfn_vkGetInstanceProcAddr
Definition: vkd3d.h:146
PFN_vkd3d_join_thread pfn_join_thread
Definition: vkd3d.h:138
PFN_vkd3d_create_thread pfn_create_thread
Definition: vkd3d.h:132
PFN_vkCreateInstance vkCreateInstance
Definition: vkd3d_private.h:76
PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr
Definition: vkd3d_private.h:78
@ VKD3D_API_VERSION_1_0
Definition: vkd3d.h:87
#define VKD3D_VCS_ID
Definition: vkd3d_version.h:1
#define VK_API_VERSION_1_0
Definition: vulkan.h:842
VkResult(VKAPI_PTR * PFN_vkEnumerateInstanceVersion)(uint32_t *)
Definition: vulkan.h:18063
VkResult VKAPI_CALL vkEnumerateInstanceVersion(uint32_t *pApiVersion)
@ VK_STRUCTURE_TYPE_APPLICATION_INFO
Definition: vulkan.h:4964
@ VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO
Definition: vulkan.h:4965

Referenced by vkd3d_create_instance().

◆ vkd3d_join_thread()

HRESULT vkd3d_join_thread ( struct vkd3d_instance *  instance,
union vkd3d_thread_handle *  thread 
)

Definition at line 5663 of file device.c.

5664{
5665 HRESULT hr = S_OK;
5666 int rc;
5667
5668 if (instance->join_thread)
5669 {
5670 if (FAILED(hr = instance->join_thread(thread->handle)))
5671 ERR("Failed to join thread, hr %s.\n", debugstr_hresult(hr));
5672 }
5673 else
5674 {
5675#ifdef _WIN32
5676 if ((rc = WaitForSingleObject(thread->handle, INFINITE)) != WAIT_OBJECT_0)
5677 {
5678 ERR("Failed to wait for thread, ret %#x.\n", rc);
5679 hr = E_FAIL;
5680 }
5681 CloseHandle(thread->handle);
5682#else
5683 if ((rc = pthread_join(thread->pthread, NULL)))
5684 {
5685 ERR("Failed to join thread, error %d.\n", rc);
5686 hr = hresult_from_errno(rc);
5687 }
5688#endif
5689 }
5690
5691 return hr;
5692}
#define CloseHandle
Definition: compat.h:739
#define INFINITE
Definition: serial.h:102
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
#define WAIT_OBJECT_0
Definition: winbase.h:383

Referenced by device_worker_stop(), and vkd3d_fence_worker_stop().

◆ vkd3d_override_caps()

static void vkd3d_override_caps ( struct d3d12_device *  device)
static

Definition at line 1583 of file device.c.

1584{
1585 const char *caps_override, *p;
1586
1587 static const struct override_value
1588 {
1589 const char *str;
1591 }
1592 feature_level_override_values[] =
1593 {
1594 {"11.0", D3D_FEATURE_LEVEL_11_0},
1595 {"11.1", D3D_FEATURE_LEVEL_11_1},
1596 {"12.0", D3D_FEATURE_LEVEL_12_0},
1597 {"12.1", D3D_FEATURE_LEVEL_12_1},
1598 {"12.2", D3D_FEATURE_LEVEL_12_2},
1599 },
1600 resource_binding_tier_override_values[] =
1601 {
1605 };
1606 static const struct override_field
1607 {
1608 const char *name;
1609 size_t offset;
1610 const struct override_value *values;
1611 size_t value_count;
1612 }
1613 override_fields[] =
1614 {
1615 {
1616 "feature_level",
1617 offsetof(struct d3d12_device, vk_info.max_feature_level),
1618 feature_level_override_values,
1619 ARRAY_SIZE(feature_level_override_values)
1620 },
1621 {
1622 "resource_binding_tier",
1623 offsetof(struct d3d12_device, feature_options.ResourceBindingTier),
1624 resource_binding_tier_override_values,
1625 ARRAY_SIZE(resource_binding_tier_override_values)
1626 },
1627 };
1628
1629 if (!(caps_override = getenv("VKD3D_CAPS_OVERRIDE")))
1630 return;
1631
1632 p = caps_override;
1633 for (;;)
1634 {
1635 size_t i;
1636
1637 for (i = 0; i < ARRAY_SIZE(override_fields); ++i)
1638 {
1639 const struct override_field *field = &override_fields[i];
1640 size_t len = strlen(field->name);
1641
1642 if (strncmp(p, field->name, len) == 0 && p[len] == '=')
1643 {
1644 size_t j;
1645
1646 p += len + 1;
1647
1648 for (j = 0; j < field->value_count; ++j)
1649 {
1650 const struct override_value *value = &field->values[j];
1651 size_t value_len = strlen(value->str);
1652
1653 if (strncmp(p, value->str, value_len) == 0
1654 && (p[value_len] == '\0' || p[value_len] == ','))
1655 {
1656 memcpy(&((uint8_t *)device)[field->offset], (uint8_t *)&value->value, sizeof(value->value));
1657
1658 p += value_len;
1659 if (p[0] == '\0')
1660 {
1661 TRACE("Overriding caps with: %s\n", caps_override);
1662 return;
1663 }
1664 p += 1;
1665
1666 break;
1667 }
1668 }
1669
1670 if (j == field->value_count)
1671 {
1672 WARN("Cannot parse the override caps string: %s\n", caps_override);
1673 return;
1674 }
1675
1676 break;
1677 }
1678 }
1679
1680 if (i == ARRAY_SIZE(override_fields))
1681 {
1682 WARN("Cannot parse the override caps string: %s\n", caps_override);
1683 return;
1684 }
1685 }
1686}
@ D3D_FEATURE_LEVEL_12_2
Definition: d3dcommon.idl:113
unsigned char uint8_t
Definition: stdint.h:33
_ACRTIMP size_t __cdecl strlen(const char *)
Definition: string.c:1597
_ACRTIMP int __cdecl strncmp(const char *, const char *, size_t)
Definition: string.c:3335
GLfloat GLfloat p
Definition: glext.h:8902
GLenum GLsizei len
Definition: glext.h:6722
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 GLint GLint j
Definition: glfuncs.h:250
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
const WCHAR * str
#define offsetof(TYPE, MEMBER)
Definition: parser.c:44

Referenced by vkd3d_init_device_caps().

◆ vkd3d_physical_device_info_init()

static void vkd3d_physical_device_info_init ( struct vkd3d_physical_device_info *  info,
struct d3d12_device *  device 
)
static

Definition at line 890 of file device.c.

891{
892 const struct vkd3d_vk_instance_procs *vk_procs = &device->vkd3d_instance->vk_procs;
893 VkPhysicalDevice physical_device = device->vk_physical_device;
894 struct vkd3d_vulkan_info *vulkan_info = &device->vk_info;
895
896 memset(info, 0, sizeof(*info));
897
902 info->fragment_shader_interlock_features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADER_INTERLOCK_FEATURES_EXT;
911
915 info->texel_buffer_alignment_properties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXEL_BUFFER_ALIGNMENT_PROPERTIES_EXT;
919
921
923 VK_CALL(vkGetPhysicalDeviceFeatures2KHR(physical_device, &info->features2));
924 else
925 VK_CALL(vkGetPhysicalDeviceFeatures(physical_device, &info->features2.features));
926
928 VK_CALL(vkGetPhysicalDeviceProperties2KHR(physical_device, &info->properties2));
929 else
930 VK_CALL(vkGetPhysicalDeviceProperties(physical_device, &info->properties2.properties));
931}
bool KHR_get_physical_device_properties2
void VKAPI_CALL vkGetPhysicalDeviceFeatures2KHR(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures2 *pFeatures)
void VKAPI_CALL vkGetPhysicalDeviceProperties2KHR(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties2 *pProperties)
void VKAPI_CALL vkGetPhysicalDeviceFeatures(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures *pFeatures)
void VKAPI_CALL vkGetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties *pProperties)
@ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CONDITIONAL_RENDERING_FEATURES_EXT
Definition: vulkan.h:5157
@ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_FEATURES_EXT
Definition: vulkan.h:5939
@ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ROBUSTNESS_2_FEATURES_EXT
Definition: vulkan.h:5451
@ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_4444_FORMATS_FEATURES_EXT
Definition: vulkan.h:5546
@ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TRANSFORM_FEEDBACK_PROPERTIES_EXT
Definition: vulkan.h:5053
@ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MUTABLE_DESCRIPTOR_TYPE_FEATURES_EXT
Definition: vulkan.h:5555
@ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2
Definition: vulkan.h:5109
@ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TRANSFORM_FEEDBACK_FEATURES_EXT
Definition: vulkan.h:5052
@ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_PROPERTIES_EXT
Definition: vulkan.h:5311
@ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_PROPERTIES_EXT
Definition: vulkan.h:5925
@ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_FEATURES_KHR
Definition: vulkan.h:5947
@ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_3_PROPERTIES
Definition: vulkan.h:5289
@ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_FEATURES_EXT
Definition: vulkan.h:5924
@ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2
Definition: vulkan.h:5108
@ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_CLIP_ENABLE_FEATURES_EXT
Definition: vulkan.h:5170
@ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DEMOTE_TO_HELPER_INVOCATION_FEATURES_EXT
Definition: vulkan.h:5993
@ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_PROPERTIES
Definition: vulkan.h:5164
@ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXEL_BUFFER_ALIGNMENT_PROPERTIES_EXT
Definition: vulkan.h:5996
@ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADER_INTERLOCK_FEATURES_EXT
Definition: vulkan.h:5383
@ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXEL_BUFFER_ALIGNMENT_FEATURES_EXT
Definition: vulkan.h:5444

Referenced by vkd3d_init_device_caps().

◆ vkd3d_restrict_format_support_for_feature_level()

static void vkd3d_restrict_format_support_for_feature_level ( D3D12_FEATURE_DATA_FORMAT_SUPPORT *  format_support)
static

Definition at line 3272 of file device.c.

3273{
3274 static const D3D12_FEATURE_DATA_FORMAT_SUPPORT blacklisted_format_features[] =
3275 {
3280 };
3281 unsigned int i;
3282
3283 for (i = 0; i < ARRAY_SIZE(blacklisted_format_features); ++i)
3284 {
3285 if (blacklisted_format_features[i].Format == format_support->Format)
3286 {
3287 format_support->Support1 &= ~blacklisted_format_features[i].Support1;
3288 format_support->Support2 &= ~blacklisted_format_features[i].Support2;
3289 break;
3290 }
3291 }
3292}
@ DXGI_FORMAT_B8G8R8A8_UNORM
Definition: dxgiformat.idl:110
@ DXGI_FORMAT_B8G8R8A8_TYPELESS
Definition: dxgiformat.idl:113
D3D12_FORMAT_SUPPORT2 Support2
Definition: d3d12.idl:761
D3D12_FORMAT_SUPPORT1 Support1
Definition: d3d12.idl:760

Referenced by d3d12_device_CheckFeatureSupport().

◆ vkd3d_select_physical_device()

static HRESULT vkd3d_select_physical_device ( struct vkd3d_instance *  instance,
unsigned int  device_index,
VkPhysicalDevice *  selected_device 
)
static

Definition at line 1969 of file device.c.

1971{
1972 VkPhysicalDevice dgpu_device = VK_NULL_HANDLE, igpu_device = VK_NULL_HANDLE;
1973 const struct vkd3d_vk_instance_procs *vk_procs = &instance->vk_procs;
1974 VkInstance vk_instance = instance->vk_instance;
1975 VkPhysicalDeviceProperties device_properties;
1976 VkPhysicalDevice device = VK_NULL_HANDLE;
1977 VkPhysicalDevice *physical_devices;
1979 unsigned int i;
1980 VkResult vr;
1981
1982 count = 0;
1983 if ((vr = VK_CALL(vkEnumeratePhysicalDevices(vk_instance, &count, NULL))) < 0)
1984 {
1985 ERR("Failed to enumerate physical devices, vr %d.\n", vr);
1986 return hresult_from_vk_result(vr);
1987 }
1988 if (!count)
1989 {
1990 ERR("No physical device available.\n");
1991 return E_FAIL;
1992 }
1993 if (!(physical_devices = vkd3d_calloc(count, sizeof(*physical_devices))))
1994 return E_OUTOFMEMORY;
1995
1996 TRACE("Enumerating %u physical device(s).\n", count);
1997 if ((vr = VK_CALL(vkEnumeratePhysicalDevices(vk_instance, &count, physical_devices))) < 0)
1998 {
1999 ERR("Failed to enumerate physical devices, vr %d.\n", vr);
2000 vkd3d_free(physical_devices);
2001 return hresult_from_vk_result(vr);
2002 }
2003
2004 if (device_index != ~0u && device_index >= count)
2005 WARN("Device index %u is out of range.\n", device_index);
2006
2007 for (i = 0; i < count; ++i)
2008 {
2009 VK_CALL(vkGetPhysicalDeviceProperties(physical_devices[i], &device_properties));
2010 vkd3d_trace_physical_device_properties(&device_properties);
2011
2012 if (i == device_index)
2013 device = physical_devices[i];
2014
2015 if (device_properties.deviceType == VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU && !dgpu_device)
2016 dgpu_device = physical_devices[i];
2017 else if (device_properties.deviceType == VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU && !igpu_device)
2018 igpu_device = physical_devices[i];
2019 }
2020
2021 if (!device)
2022 device = dgpu_device ? dgpu_device : igpu_device;
2023 if (!device)
2024 device = physical_devices[0];
2025
2026 vkd3d_free(physical_devices);
2027
2028 VK_CALL(vkGetPhysicalDeviceProperties(device, &device_properties));
2029 TRACE("Using device: %s, %#x:%#x.\n", device_properties.deviceName,
2030 device_properties.vendorID, device_properties.deviceID);
2031
2032 *selected_device = device;
2033
2034 return S_OK;
2035}
static void vkd3d_trace_physical_device_properties(const VkPhysicalDeviceProperties *properties)
Definition: device.c:933
VkPhysicalDeviceType deviceType
Definition: vulkan.h:16574
char deviceName[VK_MAX_PHYSICAL_DEVICE_NAME_SIZE]
Definition: vulkan.h:16575
@ VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU
Definition: vulkan.h:4059
@ VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU
Definition: vulkan.h:4060
VkResult VKAPI_CALL vkEnumeratePhysicalDevices(VkInstance instance, uint32_t *pPhysicalDeviceCount, VkPhysicalDevice *pPhysicalDevices)

Referenced by vkd3d_create_vk_device().

◆ vkd3d_select_queues()

static HRESULT vkd3d_select_queues ( const struct vkd3d_instance *  vkd3d_instance,
VkPhysicalDevice  physical_device,
struct vkd3d_device_queue_info *  info 
)
static

Definition at line 2121 of file device.c.

2123{
2124 const struct vkd3d_vk_instance_procs *vk_procs = &vkd3d_instance->vk_procs;
2125 VkQueueFamilyProperties *queue_properties = NULL;
2126 VkDeviceQueueCreateInfo *queue_info = NULL;
2127 unsigned int i;
2129
2130 memset(info, 0, sizeof(*info));
2131 for (i = 0; i < ARRAY_SIZE(info->family_index); ++i)
2132 info->family_index[i] = ~0u;
2133
2135 if (!(queue_properties = vkd3d_calloc(count, sizeof(*queue_properties))))
2136 return E_OUTOFMEMORY;
2137 VK_CALL(vkGetPhysicalDeviceQueueFamilyProperties(physical_device, &count, queue_properties));
2138
2139 for (i = 0; i < count; ++i)
2140 {
2141 enum vkd3d_queue_family vkd3d_family = VKD3D_QUEUE_FAMILY_COUNT;
2142
2143 if ((queue_properties[i].queueFlags & (VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_COMPUTE_BIT))
2145 {
2146 vkd3d_family = VKD3D_QUEUE_FAMILY_DIRECT;
2147 }
2148 if ((queue_properties[i].queueFlags & (VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_COMPUTE_BIT))
2150 {
2151 vkd3d_family = VKD3D_QUEUE_FAMILY_COMPUTE;
2152 }
2153 if ((queue_properties[i].queueFlags & ~VK_QUEUE_SPARSE_BINDING_BIT) == VK_QUEUE_TRANSFER_BIT)
2154 {
2155 vkd3d_family = VKD3D_QUEUE_FAMILY_TRANSFER;
2156 }
2157
2158 if (vkd3d_family == VKD3D_QUEUE_FAMILY_COUNT)
2159 continue;
2160
2161 info->family_index[vkd3d_family] = i;
2162 info->vk_properties[vkd3d_family] = queue_properties[i];
2163 queue_info = &info->vk_queue_create_info[vkd3d_family];
2164
2166 queue_info->pNext = NULL;
2167 queue_info->flags = 0;
2168 queue_info->queueFamilyIndex = i;
2169 queue_info->queueCount = 1; /* FIXME: Use multiple queues. */
2170 queue_info->pQueuePriorities = queue_priorities;
2171 }
2172
2173 vkd3d_free(queue_properties);
2174
2175 if (info->family_index[VKD3D_QUEUE_FAMILY_DIRECT] == ~0u)
2176 {
2177 FIXME("Could not find a suitable queue family for a direct command queue.\n");
2178 return E_FAIL;
2179 }
2180
2181 /* No compute-only queue family, reuse the direct queue family with graphics and compute. */
2182 if (info->family_index[VKD3D_QUEUE_FAMILY_COMPUTE] == ~0u)
2183 {
2184 info->family_index[VKD3D_QUEUE_FAMILY_COMPUTE] = info->family_index[VKD3D_QUEUE_FAMILY_DIRECT];
2185 info->vk_properties[VKD3D_QUEUE_FAMILY_COMPUTE] = info->vk_properties[VKD3D_QUEUE_FAMILY_DIRECT];
2186 }
2187 if (info->family_index[VKD3D_QUEUE_FAMILY_TRANSFER] == ~0u)
2188 {
2189 info->family_index[VKD3D_QUEUE_FAMILY_TRANSFER] = info->family_index[VKD3D_QUEUE_FAMILY_DIRECT];
2190 info->vk_properties[VKD3D_QUEUE_FAMILY_TRANSFER] = info->vk_properties[VKD3D_QUEUE_FAMILY_DIRECT];
2191 }
2192
2193 /* Compact the array. */
2194 info->vk_family_count = 1;
2195 for (i = info->vk_family_count; i < ARRAY_SIZE(info->vk_queue_create_info); ++i)
2196 {
2197 if (info->vk_queue_create_info[i].queueCount)
2198 info->vk_queue_create_info[info->vk_family_count++] = info->vk_queue_create_info[i];
2199 }
2200
2201 return S_OK;
2202}
vkd3d_queue_family
Definition: device.c:2039
static float queue_priorities[]
Definition: device.c:2119
uint32_t queueFamilyIndex
Definition: vulkan.h:8544
VkDeviceQueueCreateFlags flags
Definition: vulkan.h:8543
const float * pQueuePriorities
Definition: vulkan.h:8546
VkStructureType sType
Definition: vulkan.h:8541
const void * pNext
Definition: vulkan.h:8542
struct vkd3d_vk_instance_procs vk_procs
void VKAPI_CALL vkGetPhysicalDeviceQueueFamilyProperties(VkPhysicalDevice physicalDevice, uint32_t *pQueueFamilyPropertyCount, VkQueueFamilyProperties *pQueueFamilyProperties)
@ VK_QUEUE_SPARSE_BINDING_BIT
Definition: vulkan.h:4534
@ VK_QUEUE_COMPUTE_BIT
Definition: vulkan.h:4532
@ VK_QUEUE_TRANSFER_BIT
Definition: vulkan.h:4533
@ VK_QUEUE_GRAPHICS_BIT
Definition: vulkan.h:4531
@ VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO
Definition: vulkan.h:4966

Referenced by vkd3d_create_vk_device().

◆ vkd3d_time_domains_init()

static void vkd3d_time_domains_init ( struct d3d12_device *  device)
static

Definition at line 2628 of file device.c.

2629{
2630 static const VkTimeDomainEXT host_time_domains[] =
2631 {
2632 /* In order of preference */
2636
2637 };
2638 const struct vkd3d_vk_instance_procs *vk_procs = &device->vkd3d_instance->vk_procs;
2639 VkTimeDomainEXT domains[8];
2640 unsigned int i;
2642 VkResult vr;
2643
2644 device->vk_host_time_domain = -1;
2645
2646 if (!device->vk_info.EXT_calibrated_timestamps)
2647 return;
2648
2649 count = ARRAY_SIZE(domains);
2651 &count, domains))) != VK_SUCCESS && vr != VK_INCOMPLETE)
2652 {
2653 WARN("Failed to get calibrated time domains, vr %d.\n", vr);
2654 return;
2655 }
2656
2657 if (vr == VK_INCOMPLETE)
2658 FIXME("Calibrated time domain list is incomplete.\n");
2659
2661 {
2662 WARN("Device time domain not found. Calibrated timestamps will not be available.\n");
2663 return;
2664 }
2665
2666 for (i = 0; i < ARRAY_SIZE(host_time_domains); ++i)
2667 {
2668 if (!have_vk_time_domain(domains, count, host_time_domains[i]))
2669 continue;
2670 device->vk_host_time_domain = host_time_domains[i];
2671 break;
2672 }
2673 if (device->vk_host_time_domain == -1)
2674 WARN("Found no acceptable host time domain. Calibrated timestamps will not be available.\n");
2675}
static bool have_vk_time_domain(VkTimeDomainEXT *domains, unsigned int count, VkTimeDomainEXT domain)
Definition: device.c:2617
VkTimeDomainKHR
Definition: vulkan.h:6178
@ VK_TIME_DOMAIN_QUERY_PERFORMANCE_COUNTER_EXT
Definition: vulkan.h:6186
@ VK_TIME_DOMAIN_DEVICE_EXT
Definition: vulkan.h:6183
@ VK_TIME_DOMAIN_CLOCK_MONOTONIC_RAW_EXT
Definition: vulkan.h:6185
@ VK_TIME_DOMAIN_CLOCK_MONOTONIC_EXT
Definition: vulkan.h:6184
VkResult VKAPI_CALL vkGetPhysicalDeviceCalibrateableTimeDomainsEXT(VkPhysicalDevice physicalDevice, uint32_t *pTimeDomainCount, VkTimeDomainKHR *pTimeDomains)
@ VK_INCOMPLETE
Definition: vulkan.h:4677
@ VK_SUCCESS
Definition: vulkan.h:4672

Referenced by d3d12_device_init().

◆ vkd3d_trace_physical_device()

static void vkd3d_trace_physical_device ( VkPhysicalDevice  device,
const struct vkd3d_physical_device_info *  info,
const struct vkd3d_vk_instance_procs *  vk_procs 
)
static

Definition at line 947 of file device.c.

950{
951 VkPhysicalDeviceMemoryProperties memory_properties;
952 VkQueueFamilyProperties *queue_properties;
953 unsigned int i, j;
955
956 vkd3d_trace_physical_device_properties(&info->properties2.properties);
957
959 TRACE("Queue families [%u]:\n", count);
960
961 if (!(queue_properties = vkd3d_calloc(count, sizeof(VkQueueFamilyProperties))))
962 return;
964
965 for (i = 0; i < count; ++i)
966 {
967 TRACE(" Queue family [%u]: flags %s, count %u, timestamp bits %u, image transfer granularity %s.\n",
968 i, debug_vk_queue_flags(queue_properties[i].queueFlags),
969 queue_properties[i].queueCount, queue_properties[i].timestampValidBits,
970 debug_vk_extent_3d(queue_properties[i].minImageTransferGranularity));
971 }
972 vkd3d_free(queue_properties);
973
975 for (i = 0; i < memory_properties.memoryHeapCount; ++i)
976 {
977 const VkMemoryHeap *heap = &memory_properties.memoryHeaps[i];
978 TRACE("Memory heap [%u]: size %#"PRIx64" (%"PRIu64" MiB), flags %s, memory types:\n",
979 i, heap->size, heap->size / 1024 / 1024, debug_vk_memory_heap_flags(heap->flags));
980 for (j = 0; j < memory_properties.memoryTypeCount; ++j)
981 {
982 const VkMemoryType *type = &memory_properties.memoryTypes[j];
983 if (type->heapIndex != i)
984 continue;
985 TRACE(" Memory type [%u]: flags %s.\n", j, debug_vk_memory_property_flags(type->propertyFlags));
986 }
987 }
988}
const char * debug_vk_memory_heap_flags(VkMemoryHeapFlags flags)
Definition: utils.c:728
const char * debug_vk_extent_3d(VkExtent3D extent)
Definition: utils.c:696
const char * debug_vk_memory_property_flags(VkMemoryPropertyFlags flags)
Definition: utils.c:745
const char * debug_vk_queue_flags(VkQueueFlags flags)
Definition: utils.c:704
VkMemoryType memoryTypes[VK_MAX_MEMORY_TYPES]
Definition: vulkan.h:11320
UINT flags
Definition: heap.c:93

Referenced by vkd3d_init_device_caps().

◆ vkd3d_trace_physical_device_features()

static void vkd3d_trace_physical_device_features ( const struct vkd3d_physical_device_info *  info)
static

Definition at line 1204 of file device.c.

1205{
1206 const VkPhysicalDeviceFragmentShaderInterlockFeaturesEXT *fragment_shader_interlock_features;
1207 const VkPhysicalDeviceConditionalRenderingFeaturesEXT *conditional_rendering_features;
1209 const VkPhysicalDeviceTexelBufferAlignmentFeaturesEXT *buffer_alignment_features;
1211 const VkPhysicalDeviceDescriptorIndexingFeaturesEXT *descriptor_indexing;
1212 const VkPhysicalDeviceDepthClipEnableFeaturesEXT *depth_clip_features;
1213 const VkPhysicalDeviceFeatures *features = &info->features2.features;
1215
1216 TRACE("Device features:\n");
1217 TRACE(" robustBufferAccess: %#x.\n", features->robustBufferAccess);
1218 TRACE(" fullDrawIndexUint32: %#x.\n", features->fullDrawIndexUint32);
1219 TRACE(" imageCubeArray: %#x.\n", features->imageCubeArray);
1220 TRACE(" independentBlend: %#x.\n", features->independentBlend);
1221 TRACE(" geometryShader: %#x.\n", features->geometryShader);
1222 TRACE(" tessellationShader: %#x.\n", features->tessellationShader);
1223 TRACE(" sampleRateShading: %#x.\n", features->sampleRateShading);
1224 TRACE(" dualSrcBlend: %#x.\n", features->dualSrcBlend);
1225 TRACE(" logicOp: %#x.\n", features->logicOp);
1226 TRACE(" multiDrawIndirect: %#x.\n", features->multiDrawIndirect);
1227 TRACE(" drawIndirectFirstInstance: %#x.\n", features->drawIndirectFirstInstance);
1228 TRACE(" depthClamp: %#x.\n", features->depthClamp);
1229 TRACE(" depthBiasClamp: %#x.\n", features->depthBiasClamp);
1230 TRACE(" fillModeNonSolid: %#x.\n", features->fillModeNonSolid);
1231 TRACE(" depthBounds: %#x.\n", features->depthBounds);
1232 TRACE(" wideLines: %#x.\n", features->wideLines);
1233 TRACE(" largePoints: %#x.\n", features->largePoints);
1234 TRACE(" alphaToOne: %#x.\n", features->alphaToOne);
1235 TRACE(" multiViewport: %#x.\n", features->multiViewport);
1236 TRACE(" samplerAnisotropy: %#x.\n", features->samplerAnisotropy);
1237 TRACE(" textureCompressionETC2: %#x.\n", features->textureCompressionETC2);
1238 TRACE(" textureCompressionASTC_LDR: %#x.\n", features->textureCompressionASTC_LDR);
1239 TRACE(" textureCompressionBC: %#x.\n", features->textureCompressionBC);
1240 TRACE(" occlusionQueryPrecise: %#x.\n", features->occlusionQueryPrecise);
1241 TRACE(" pipelineStatisticsQuery: %#x.\n", features->pipelineStatisticsQuery);
1242 TRACE(" vertexOipelineStoresAndAtomics: %#x.\n", features->vertexPipelineStoresAndAtomics);
1243 TRACE(" fragmentStoresAndAtomics: %#x.\n", features->fragmentStoresAndAtomics);
1244 TRACE(" shaderTessellationAndGeometryPointSize: %#x.\n", features->shaderTessellationAndGeometryPointSize);
1245 TRACE(" shaderImageGatherExtended: %#x.\n", features->shaderImageGatherExtended);
1246 TRACE(" shaderStorageImageExtendedFormats: %#x.\n", features->shaderStorageImageExtendedFormats);
1247 TRACE(" shaderStorageImageMultisample: %#x.\n", features->shaderStorageImageMultisample);
1248 TRACE(" shaderStorageImageReadWithoutFormat: %#x.\n", features->shaderStorageImageReadWithoutFormat);
1249 TRACE(" shaderStorageImageWriteWithoutFormat: %#x.\n", features->shaderStorageImageWriteWithoutFormat);
1250 TRACE(" shaderUniformBufferArrayDynamicIndexing: %#x.\n", features->shaderUniformBufferArrayDynamicIndexing);
1251 TRACE(" shaderSampledImageArrayDynamicIndexing: %#x.\n", features->shaderSampledImageArrayDynamicIndexing);
1252 TRACE(" shaderStorageBufferArrayDynamicIndexing: %#x.\n", features->shaderStorageBufferArrayDynamicIndexing);
1253 TRACE(" shaderStorageImageArrayDynamicIndexing: %#x.\n", features->shaderStorageImageArrayDynamicIndexing);
1254 TRACE(" shaderClipDistance: %#x.\n", features->shaderClipDistance);
1255 TRACE(" shaderCullDistance: %#x.\n", features->shaderCullDistance);
1256 TRACE(" shaderFloat64: %#x.\n", features->shaderFloat64);
1257 TRACE(" shaderInt64: %#x.\n", features->shaderInt64);
1258 TRACE(" shaderInt16: %#x.\n", features->shaderInt16);
1259 TRACE(" shaderResourceResidency: %#x.\n", features->shaderResourceResidency);
1260 TRACE(" shaderResourceMinLod: %#x.\n", features->shaderResourceMinLod);
1261 TRACE(" sparseBinding: %#x.\n", features->sparseBinding);
1262 TRACE(" sparseResidencyBuffer: %#x.\n", features->sparseResidencyBuffer);
1263 TRACE(" sparseResidencyImage2D: %#x.\n", features->sparseResidencyImage2D);
1264 TRACE(" sparseResidencyImage3D: %#x.\n", features->sparseResidencyImage3D);
1265 TRACE(" sparseResidency2Samples: %#x.\n", features->sparseResidency2Samples);
1266 TRACE(" sparseResidency4Samples: %#x.\n", features->sparseResidency4Samples);
1267 TRACE(" sparseResidency8Samples: %#x.\n", features->sparseResidency8Samples);
1268 TRACE(" sparseResidency16Samples: %#x.\n", features->sparseResidency16Samples);
1269 TRACE(" sparseResidencyAliased: %#x.\n", features->sparseResidencyAliased);
1270 TRACE(" variableMultisampleRate: %#x.\n", features->variableMultisampleRate);
1271 TRACE(" inheritedQueries: %#x.\n", features->inheritedQueries);
1272
1273 descriptor_indexing = &info->descriptor_indexing_features;
1274 TRACE(" VkPhysicalDeviceDescriptorIndexingFeaturesEXT:\n");
1275
1276 TRACE(" shaderInputAttachmentArrayDynamicIndexing: %#x.\n",
1277 descriptor_indexing->shaderInputAttachmentArrayDynamicIndexing);
1278 TRACE(" shaderUniformTexelBufferArrayDynamicIndexing: %#x.\n",
1280 TRACE(" shaderStorageTexelBufferArrayDynamicIndexing: %#x.\n",
1282
1283 TRACE(" shaderUniformBufferArrayNonUniformIndexing: %#x.\n",
1284 descriptor_indexing->shaderUniformBufferArrayNonUniformIndexing);
1285 TRACE(" shaderSampledImageArrayNonUniformIndexing: %#x.\n",
1286 descriptor_indexing->shaderSampledImageArrayNonUniformIndexing);
1287 TRACE(" shaderStorageBufferArrayNonUniformIndexing: %#x.\n",
1288 descriptor_indexing->shaderStorageBufferArrayNonUniformIndexing);
1289 TRACE(" shaderStorageImageArrayNonUniformIndexing: %#x.\n",
1290 descriptor_indexing->shaderStorageImageArrayNonUniformIndexing);
1291 TRACE(" shaderInputAttachmentArrayNonUniformIndexing: %#x.\n",
1293 TRACE(" shaderUniformTexelBufferArrayNonUniformIndexing: %#x.\n",
1295 TRACE(" shaderStorageTexelBufferArrayNonUniformIndexing: %#x.\n",
1297
1298 TRACE(" descriptorBindingUniformBufferUpdateAfterBind: %#x.\n",
1300 TRACE(" descriptorBindingSampledImageUpdateAfterBind: %#x.\n",
1302 TRACE(" descriptorBindingStorageImageUpdateAfterBind: %#x.\n",
1304 TRACE(" descriptorBindingStorageBufferUpdateAfterBind: %#x.\n",
1306 TRACE(" descriptorBindingUniformTexelBufferUpdateAfterBind: %#x.\n",
1308 TRACE(" descriptorBindingStorageTexelBufferUpdateAfterBind: %#x.\n",
1310
1311 TRACE(" descriptorBindingUpdateUnusedWhilePending: %#x.\n",
1312 descriptor_indexing->descriptorBindingUpdateUnusedWhilePending);
1313 TRACE(" descriptorBindingPartiallyBound: %#x.\n",
1314 descriptor_indexing->descriptorBindingPartiallyBound);
1315 TRACE(" descriptorBindingVariableDescriptorCount: %#x.\n",
1316 descriptor_indexing->descriptorBindingVariableDescriptorCount);
1317 TRACE(" runtimeDescriptorArray: %#x.\n",
1318 descriptor_indexing->runtimeDescriptorArray);
1319
1320 conditional_rendering_features = &info->conditional_rendering_features;
1321 TRACE(" VkPhysicalDeviceConditionalRenderingFeaturesEXT:\n");
1322 TRACE(" conditionalRendering: %#x.\n", conditional_rendering_features->conditionalRendering);
1323
1324 depth_clip_features = &info->depth_clip_features;
1325 TRACE(" VkPhysicalDeviceDepthClipEnableFeaturesEXT:\n");
1326 TRACE(" depthClipEnable: %#x.\n", depth_clip_features->depthClipEnable);
1327
1328 fragment_shader_interlock_features = &info->fragment_shader_interlock_features;
1329 TRACE(" VkPhysicalDeviceFragmentShaderInterlockFeaturesEXT:\n");
1330 TRACE(" fragmentShaderSampleInterlock: %#x.\n",
1331 fragment_shader_interlock_features->fragmentShaderSampleInterlock);
1332 TRACE(" fragmentShaderPixelInterlock: %#x.\n",
1333 fragment_shader_interlock_features->fragmentShaderPixelInterlock);
1334 TRACE(" fragmentShaderShadingRateInterlock: %#x.\n",
1335 fragment_shader_interlock_features->fragmentShaderShadingRateInterlock);
1336
1337 demote_features = &info->demote_features;
1338 TRACE(" VkPhysicalDeviceShaderDemoteToHelperInvocationFeaturesEXT:\n");
1339 TRACE(" shaderDemoteToHelperInvocation: %#x.\n", demote_features->shaderDemoteToHelperInvocation);
1340
1341 buffer_alignment_features = &info->texel_buffer_alignment_features;
1342 TRACE(" VkPhysicalDeviceTexelBufferAlignmentFeaturesEXT:\n");
1343 TRACE(" texelBufferAlignment: %#x.\n", buffer_alignment_features->texelBufferAlignment);
1344
1345 xfb = &info->xfb_features;
1346 TRACE(" VkPhysicalDeviceTransformFeedbackFeaturesEXT:\n");
1347 TRACE(" transformFeedback: %#x.\n", xfb->transformFeedback);
1348 TRACE(" geometryStreams: %#x.\n", xfb->geometryStreams);
1349
1350 divisor_features = &info->vertex_divisor_features;
1351 TRACE(" VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT:\n");
1352 TRACE(" vertexAttributeInstanceRateDivisor: %#x.\n",
1353 divisor_features->vertexAttributeInstanceRateDivisor);
1354 TRACE(" vertexAttributeInstanceRateZeroDivisor: %#x.\n",
1355 divisor_features->vertexAttributeInstanceRateZeroDivisor);
1356}
VkBool32 samplerAnisotropy
Definition: vulkan.h:10582
VkBool32 shaderCullDistance
Definition: vulkan.h:10601
VkBool32 shaderClipDistance
Definition: vulkan.h:10600
VkBool32 shaderResourceMinLod
Definition: vulkan.h:10606
VkBool32 sampleRateShading
Definition: vulkan.h:10569
VkBool32 sparseResidency2Samples
Definition: vulkan.h:10611
VkBool32 textureCompressionASTC_LDR
Definition: vulkan.h:10584
VkBool32 shaderStorageImageMultisample
Definition: vulkan.h:10593
VkBool32 variableMultisampleRate
Definition: vulkan.h:10616
VkBool32 sparseResidency16Samples
Definition: vulkan.h:10614
VkBool32 multiDrawIndirect
Definition: vulkan.h:10572
VkBool32 shaderSampledImageArrayDynamicIndexing
Definition: vulkan.h:10597
VkBool32 shaderResourceResidency
Definition: vulkan.h:10605
VkBool32 sparseResidency4Samples
Definition: vulkan.h:10612
VkBool32 shaderStorageImageWriteWithoutFormat
Definition: vulkan.h:10595
VkBool32 drawIndirectFirstInstance
Definition: vulkan.h:10573
VkBool32 shaderStorageImageArrayDynamicIndexing
Definition: vulkan.h:10599
VkBool32 fragmentStoresAndAtomics
Definition: vulkan.h:10589
VkBool32 textureCompressionBC
Definition: vulkan.h:10585
VkBool32 textureCompressionETC2
Definition: vulkan.h:10583
VkBool32 fullDrawIndexUint32
Definition: vulkan.h:10564
VkBool32 shaderStorageImageExtendedFormats
Definition: vulkan.h:10592
VkBool32 occlusionQueryPrecise
Definition: vulkan.h:10586
VkBool32 shaderUniformBufferArrayDynamicIndexing
Definition: vulkan.h:10596
VkBool32 shaderImageGatherExtended
Definition: vulkan.h:10591
VkBool32 pipelineStatisticsQuery
Definition: vulkan.h:10587
VkBool32 sparseResidencyAliased
Definition: vulkan.h:10615
VkBool32 sparseResidency8Samples
Definition: vulkan.h:10613

Referenced by vkd3d_init_device_caps().

◆ vkd3d_trace_physical_device_limits()

static void vkd3d_trace_physical_device_limits ( const struct vkd3d_physical_device_info *  info)
static

Definition at line 990 of file device.c.

991{
993 const VkPhysicalDeviceLimits *limits = &info->properties2.properties.limits;
994 const VkPhysicalDeviceDescriptorIndexingPropertiesEXT *descriptor_indexing;
996 const VkPhysicalDeviceMaintenance3Properties *maintenance3;
998
999 TRACE("Device limits:\n");
1000 TRACE(" maxImageDimension1D: %u.\n", limits->maxImageDimension1D);
1001 TRACE(" maxImageDimension2D: %u.\n", limits->maxImageDimension2D);
1002 TRACE(" maxImageDimension3D: %u.\n", limits->maxImageDimension3D);
1003 TRACE(" maxImageDimensionCube: %u.\n", limits->maxImageDimensionCube);
1004 TRACE(" maxImageArrayLayers: %u.\n", limits->maxImageArrayLayers);
1005 TRACE(" maxTexelBufferElements: %u.\n", limits->maxTexelBufferElements);
1006 TRACE(" maxUniformBufferRange: %u.\n", limits->maxUniformBufferRange);
1007 TRACE(" maxStorageBufferRange: %u.\n", limits->maxStorageBufferRange);
1008 TRACE(" maxPushConstantsSize: %u.\n", limits->maxPushConstantsSize);
1009 TRACE(" maxMemoryAllocationCount: %u.\n", limits->maxMemoryAllocationCount);
1010 TRACE(" maxSamplerAllocationCount: %u.\n", limits->maxSamplerAllocationCount);
1011 TRACE(" bufferImageGranularity: %#"PRIx64".\n", limits->bufferImageGranularity);
1012 TRACE(" sparseAddressSpaceSize: %#"PRIx64".\n", limits->sparseAddressSpaceSize);
1013 TRACE(" maxBoundDescriptorSets: %u.\n", limits->maxBoundDescriptorSets);
1014 TRACE(" maxPerStageDescriptorSamplers: %u.\n", limits->maxPerStageDescriptorSamplers);
1015 TRACE(" maxPerStageDescriptorUniformBuffers: %u.\n", limits->maxPerStageDescriptorUniformBuffers);
1016 TRACE(" maxPerStageDescriptorStorageBuffers: %u.\n", limits->maxPerStageDescriptorStorageBuffers);
1017 TRACE(" maxPerStageDescriptorSampledImages: %u.\n", limits->maxPerStageDescriptorSampledImages);
1018 TRACE(" maxPerStageDescriptorStorageImages: %u.\n", limits->maxPerStageDescriptorStorageImages);
1019 TRACE(" maxPerStageDescriptorInputAttachments: %u.\n", limits->maxPerStageDescriptorInputAttachments);
1020 TRACE(" maxPerStageResources: %u.\n", limits->maxPerStageResources);
1021 TRACE(" maxDescriptorSetSamplers: %u.\n", limits->maxDescriptorSetSamplers);
1022 TRACE(" maxDescriptorSetUniformBuffers: %u.\n", limits->maxDescriptorSetUniformBuffers);
1023 TRACE(" maxDescriptorSetUniformBuffersDynamic: %u.\n", limits->maxDescriptorSetUniformBuffersDynamic);
1024 TRACE(" maxDescriptorSetStorageBuffers: %u.\n", limits->maxDescriptorSetStorageBuffers);
1025 TRACE(" maxDescriptorSetStorageBuffersDynamic: %u.\n", limits->maxDescriptorSetStorageBuffersDynamic);
1026 TRACE(" maxDescriptorSetSampledImages: %u.\n", limits->maxDescriptorSetSampledImages);
1027 TRACE(" maxDescriptorSetStorageImages: %u.\n", limits->maxDescriptorSetStorageImages);
1028 TRACE(" maxDescriptorSetInputAttachments: %u.\n", limits->maxDescriptorSetInputAttachments);
1029 TRACE(" maxVertexInputAttributes: %u.\n", limits->maxVertexInputAttributes);
1030 TRACE(" maxVertexInputBindings: %u.\n", limits->maxVertexInputBindings);
1031 TRACE(" maxVertexInputAttributeOffset: %u.\n", limits->maxVertexInputAttributeOffset);
1032 TRACE(" maxVertexInputBindingStride: %u.\n", limits->maxVertexInputBindingStride);
1033 TRACE(" maxVertexOutputComponents: %u.\n", limits->maxVertexOutputComponents);
1034 TRACE(" maxTessellationGenerationLevel: %u.\n", limits->maxTessellationGenerationLevel);
1035 TRACE(" maxTessellationPatchSize: %u.\n", limits->maxTessellationPatchSize);
1036 TRACE(" maxTessellationControlPerVertexInputComponents: %u.\n",
1038 TRACE(" maxTessellationControlPerVertexOutputComponents: %u.\n",
1040 TRACE(" maxTessellationControlPerPatchOutputComponents: %u.\n",
1042 TRACE(" maxTessellationControlTotalOutputComponents: %u.\n",
1044 TRACE(" maxTessellationEvaluationInputComponents: %u.\n",
1046 TRACE(" maxTessellationEvaluationOutputComponents: %u.\n",
1048 TRACE(" maxGeometryShaderInvocations: %u.\n", limits->maxGeometryShaderInvocations);
1049 TRACE(" maxGeometryInputComponents: %u.\n", limits->maxGeometryInputComponents);
1050 TRACE(" maxGeometryOutputComponents: %u.\n", limits->maxGeometryOutputComponents);
1051 TRACE(" maxGeometryOutputVertices: %u.\n", limits->maxGeometryOutputVertices);
1052 TRACE(" maxGeometryTotalOutputComponents: %u.\n", limits->maxGeometryTotalOutputComponents);
1053 TRACE(" maxFragmentInputComponents: %u.\n", limits->maxFragmentInputComponents);
1054 TRACE(" maxFragmentOutputAttachments: %u.\n", limits->maxFragmentOutputAttachments);
1055 TRACE(" maxFragmentDualSrcAttachments: %u.\n", limits->maxFragmentDualSrcAttachments);
1056 TRACE(" maxFragmentCombinedOutputResources: %u.\n", limits->maxFragmentCombinedOutputResources);
1057 TRACE(" maxComputeSharedMemorySize: %u.\n", limits->maxComputeSharedMemorySize);
1058 TRACE(" maxComputeWorkGroupCount: %u, %u, %u.\n", limits->maxComputeWorkGroupCount[0],
1059 limits->maxComputeWorkGroupCount[1], limits->maxComputeWorkGroupCount[2]);
1060 TRACE(" maxComputeWorkGroupInvocations: %u.\n", limits->maxComputeWorkGroupInvocations);
1061 TRACE(" maxComputeWorkGroupSize: %u, %u, %u.\n", limits->maxComputeWorkGroupSize[0],
1062 limits->maxComputeWorkGroupSize[1], limits->maxComputeWorkGroupSize[2]);
1063 TRACE(" subPixelPrecisionBits: %u.\n", limits->subPixelPrecisionBits);
1064 TRACE(" subTexelPrecisionBits: %u.\n", limits->subTexelPrecisionBits);
1065 TRACE(" mipmapPrecisionBits: %u.\n", limits->mipmapPrecisionBits);
1066 TRACE(" maxDrawIndexedIndexValue: %u.\n", limits->maxDrawIndexedIndexValue);
1067 TRACE(" maxDrawIndirectCount: %u.\n", limits->maxDrawIndirectCount);
1068 TRACE(" maxSamplerLodBias: %f.\n", limits->maxSamplerLodBias);
1069 TRACE(" maxSamplerAnisotropy: %f.\n", limits->maxSamplerAnisotropy);
1070 TRACE(" maxViewports: %u.\n", limits->maxViewports);
1071 TRACE(" maxViewportDimensions: %u, %u.\n", limits->maxViewportDimensions[0],
1072 limits->maxViewportDimensions[1]);
1073 TRACE(" viewportBoundsRange: %f, %f.\n", limits->viewportBoundsRange[0], limits->viewportBoundsRange[1]);
1074 TRACE(" viewportSubPixelBits: %u.\n", limits->viewportSubPixelBits);
1075 TRACE(" minMemoryMapAlignment: %u.\n", (unsigned int)limits->minMemoryMapAlignment);
1076 TRACE(" minTexelBufferOffsetAlignment: %#"PRIx64".\n", limits->minTexelBufferOffsetAlignment);
1077 TRACE(" minUniformBufferOffsetAlignment: %#"PRIx64".\n", limits->minUniformBufferOffsetAlignment);
1078 TRACE(" minStorageBufferOffsetAlignment: %#"PRIx64".\n", limits->minStorageBufferOffsetAlignment);
1079 TRACE(" minTexelOffset: %d.\n", limits->minTexelOffset);
1080 TRACE(" maxTexelOffset: %u.\n", limits->maxTexelOffset);
1081 TRACE(" minTexelGatherOffset: %d.\n", limits->minTexelGatherOffset);
1082 TRACE(" maxTexelGatherOffset: %u.\n", limits->maxTexelGatherOffset);
1083 TRACE(" minInterpolationOffset: %f.\n", limits->minInterpolationOffset);
1084 TRACE(" maxInterpolationOffset: %f.\n", limits->maxInterpolationOffset);
1085 TRACE(" subPixelInterpolationOffsetBits: %u.\n", limits->subPixelInterpolationOffsetBits);
1086 TRACE(" maxFramebufferWidth: %u.\n", limits->maxFramebufferWidth);
1087 TRACE(" maxFramebufferHeight: %u.\n", limits->maxFramebufferHeight);
1088 TRACE(" maxFramebufferLayers: %u.\n", limits->maxFramebufferLayers);
1089 TRACE(" framebufferColorSampleCounts: %#x.\n", limits->framebufferColorSampleCounts);
1090 TRACE(" framebufferDepthSampleCounts: %#x.\n", limits->framebufferDepthSampleCounts);
1091 TRACE(" framebufferStencilSampleCounts: %#x.\n", limits->framebufferStencilSampleCounts);
1092 TRACE(" framebufferNoAttachmentsSampleCounts: %#x.\n", limits->framebufferNoAttachmentsSampleCounts);
1093 TRACE(" maxColorAttachments: %u.\n", limits->maxColorAttachments);
1094 TRACE(" sampledImageColorSampleCounts: %#x.\n", limits->sampledImageColorSampleCounts);
1095 TRACE(" sampledImageIntegerSampleCounts: %#x.\n", limits->sampledImageIntegerSampleCounts);
1096 TRACE(" sampledImageDepthSampleCounts: %#x.\n", limits->sampledImageDepthSampleCounts);
1097 TRACE(" sampledImageStencilSampleCounts: %#x.\n", limits->sampledImageStencilSampleCounts);
1098 TRACE(" storageImageSampleCounts: %#x.\n", limits->storageImageSampleCounts);
1099 TRACE(" maxSampleMaskWords: %u.\n", limits->maxSampleMaskWords);
1100 TRACE(" timestampComputeAndGraphics: %#x.\n", limits->timestampComputeAndGraphics);
1101 TRACE(" timestampPeriod: %f.\n", limits->timestampPeriod);
1102 TRACE(" maxClipDistances: %u.\n", limits->maxClipDistances);
1103 TRACE(" maxCullDistances: %u.\n", limits->maxCullDistances);
1104 TRACE(" maxCombinedClipAndCullDistances: %u.\n", limits->maxCombinedClipAndCullDistances);
1105 TRACE(" discreteQueuePriorities: %u.\n", limits->discreteQueuePriorities);
1106 TRACE(" pointSizeRange: %f, %f.\n", limits->pointSizeRange[0], limits->pointSizeRange[1]);
1107 TRACE(" lineWidthRange: %f, %f,\n", limits->lineWidthRange[0], limits->lineWidthRange[1]);
1108 TRACE(" pointSizeGranularity: %f.\n", limits->pointSizeGranularity);
1109 TRACE(" lineWidthGranularity: %f.\n", limits->lineWidthGranularity);
1110 TRACE(" strictLines: %#x.\n", limits->strictLines);
1111 TRACE(" standardSampleLocations: %#x.\n", limits->standardSampleLocations);
1112 TRACE(" optimalBufferCopyOffsetAlignment: %#"PRIx64".\n", limits->optimalBufferCopyOffsetAlignment);
1113 TRACE(" optimalBufferCopyRowPitchAlignment: %#"PRIx64".\n", limits->optimalBufferCopyRowPitchAlignment);
1114 TRACE(" nonCoherentAtomSize: %#"PRIx64".\n", limits->nonCoherentAtomSize);
1115
1116 descriptor_indexing = &info->descriptor_indexing_properties;
1117 TRACE(" VkPhysicalDeviceDescriptorIndexingPropertiesEXT:\n");
1118
1119 TRACE(" maxUpdateAfterBindDescriptorsInAllPools: %u.\n",
1120 descriptor_indexing->maxUpdateAfterBindDescriptorsInAllPools);
1121
1122 TRACE(" shaderUniformBufferArrayNonUniformIndexingNative: %#x.\n",
1124 TRACE(" shaderSampledImageArrayNonUniformIndexingNative: %#x.\n",
1126 TRACE(" shaderStorageBufferArrayNonUniformIndexingNative: %#x.\n",
1128 TRACE(" shaderStorageImageArrayNonUniformIndexingNative: %#x.\n",
1130 TRACE(" shaderInputAttachmentArrayNonUniformIndexingNative: %#x.\n",
1132
1133 TRACE(" robustBufferAccessUpdateAfterBind: %#x.\n",
1134 descriptor_indexing->robustBufferAccessUpdateAfterBind);
1135 TRACE(" quadDivergentImplicitLod: %#x.\n",
1136 descriptor_indexing->quadDivergentImplicitLod);
1137
1138 TRACE(" maxPerStageDescriptorUpdateAfterBindSamplers: %u.\n",
1140 TRACE(" maxPerStageDescriptorUpdateAfterBindUniformBuffers: %u.\n",
1142 TRACE(" maxPerStageDescriptorUpdateAfterBindStorageBuffers: %u.\n",
1144 TRACE(" maxPerStageDescriptorUpdateAfterBindSampledImages: %u.\n",
1146 TRACE(" maxPerStageDescriptorUpdateAfterBindStorageImages: %u.\n",
1148 TRACE(" maxPerStageDescriptorUpdateAfterBindInputAttachments: %u.\n",
1150 TRACE(" maxPerStageUpdateAfterBindResources: %u.\n",
1151 descriptor_indexing->maxPerStageUpdateAfterBindResources);
1152
1153 TRACE(" maxDescriptorSetUpdateAfterBindSamplers: %u.\n",
1154 descriptor_indexing->maxDescriptorSetUpdateAfterBindSamplers);
1155 TRACE(" maxDescriptorSetUpdateAfterBindUniformBuffers: %u.\n",
1157 TRACE(" maxDescriptorSetUpdateAfterBindUniformBuffersDynamic: %u.\n",
1159 TRACE(" maxDescriptorSetUpdateAfterBindStorageBuffers: %u.\n",
1161 TRACE(" maxDescriptorSetUpdateAfterBindStorageBuffersDynamic: %u.\n",
1163 TRACE(" maxDescriptorSetUpdateAfterBindSampledImages: %u.\n",
1165 TRACE(" maxDescriptorSetUpdateAfterBindStorageImages: %u.\n",
1167 TRACE(" maxDescriptorSetUpdateAfterBindInputAttachments: %u.\n",
1169
1170 maintenance3 = &info->maintenance3_properties;
1171 TRACE(" VkPhysicalDeviceMaintenance3Properties:\n");
1172 TRACE(" maxPerSetDescriptors: %u.\n", maintenance3->maxPerSetDescriptors);
1173 TRACE(" maxMemoryAllocationSize: %#"PRIx64".\n", maintenance3->maxMemoryAllocationSize);
1174
1175 buffer_alignment = &info->texel_buffer_alignment_properties;
1176 TRACE(" VkPhysicalDeviceTexelBufferAlignmentPropertiesEXT:\n");
1177 TRACE(" storageTexelBufferOffsetAlignmentBytes: %#"PRIx64".\n",
1178 buffer_alignment->storageTexelBufferOffsetAlignmentBytes);
1179 TRACE(" storageTexelBufferOffsetSingleTexelAlignment: %#x.\n",
1181 TRACE(" uniformTexelBufferOffsetAlignmentBytes: %#"PRIx64".\n",
1182 buffer_alignment->uniformTexelBufferOffsetAlignmentBytes);
1183 TRACE(" uniformTexelBufferOffsetSingleTexelAlignment: %#x.\n",
1185
1186 xfb = &info->xfb_properties;
1187 TRACE(" VkPhysicalDeviceTransformFeedbackPropertiesEXT:\n");
1188 TRACE(" maxTransformFeedbackStreams: %u.\n", xfb->maxTransformFeedbackStreams);
1189 TRACE(" maxTransformFeedbackBuffers: %u.\n", xfb->maxTransformFeedbackBuffers);
1190 TRACE(" maxTransformFeedbackBufferSize: %#"PRIx64".\n", xfb->maxTransformFeedbackBufferSize);
1191 TRACE(" maxTransformFeedbackStreamDataSize: %u.\n", xfb->maxTransformFeedbackStreamDataSize);
1192 TRACE(" maxTransformFeedbackBufferDataSize: %u.\n", xfb->maxTransformFeedbackBufferDataSize);
1193 TRACE(" maxTransformFeedbackBufferDataStride: %u.\n", xfb->maxTransformFeedbackBufferDataStride);
1194 TRACE(" transformFeedbackQueries: %#x.\n", xfb->transformFeedbackQueries);
1195 TRACE(" transformFeedbackStreamsLinesTriangles: %#x.\n", xfb->transformFeedbackStreamsLinesTriangles);
1196 TRACE(" transformFeedbackRasterizationStreamSelect: %#x.\n", xfb->transformFeedbackRasterizationStreamSelect);
1197 TRACE(" transformFeedbackDraw: %x.\n", xfb->transformFeedbackDraw);
1198
1199 divisor_properties = &info->vertex_divisor_properties;
1200 TRACE(" VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT:\n");
1201 TRACE(" maxVertexAttribDivisor: %u.\n", divisor_properties->maxVertexAttribDivisor);
1202}
uint32_t maxTessellationPatchSize
Definition: vulkan.h:11097
uint32_t maxFramebufferLayers
Definition: vulkan.h:11141
uint32_t maxUniformBufferRange
Definition: vulkan.h:11068
uint32_t discreteQueuePriorities
Definition: vulkan.h:11158
uint32_t maxViewportDimensions[2]
Definition: vulkan.h:11125
VkSampleCountFlags sampledImageIntegerSampleCounts
Definition: vulkan.h:11148
uint32_t viewportSubPixelBits
Definition: vulkan.h:11127
uint32_t subTexelPrecisionBits
Definition: vulkan.h:11118
uint32_t maxFramebufferHeight
Definition: vulkan.h:11140
uint32_t subPixelInterpolationOffsetBits
Definition: vulkan.h:11138
uint32_t maxFragmentCombinedOutputResources
Definition: vulkan.h:11112
int32_t minTexelGatherOffset
Definition: vulkan.h:11134
VkSampleCountFlags sampledImageColorSampleCounts
Definition: vulkan.h:11147
uint32_t maxTessellationControlPerVertexInputComponents
Definition: vulkan.h:11098
uint32_t maxCombinedClipAndCullDistances
Definition: vulkan.h:11157
uint32_t maxGeometryOutputVertices
Definition: vulkan.h:11107
uint32_t maxPushConstantsSize
Definition: vulkan.h:11070
uint32_t maxVertexOutputComponents
Definition: vulkan.h:11095
uint32_t maxDrawIndexedIndexValue
Definition: vulkan.h:11120
size_t minMemoryMapAlignment
Definition: vulkan.h:11128
uint32_t maxStorageBufferRange
Definition: vulkan.h:11069
uint32_t mipmapPrecisionBits
Definition: vulkan.h:11119
uint32_t maxImageDimension2D
Definition: vulkan.h:11063
uint32_t maxCullDistances
Definition: vulkan.h:11156
uint32_t maxVertexInputBindings
Definition: vulkan.h:11092
uint32_t maxVertexInputAttributeOffset
Definition: vulkan.h:11093
uint32_t maxClipDistances
Definition: vulkan.h:11155
uint32_t maxDescriptorSetUniformBuffersDynamic
Definition: vulkan.h:11085
uint32_t maxImageDimensionCube
Definition: vulkan.h:11065
uint32_t maxTexelOffset
Definition: vulkan.h:11133
uint32_t maxFragmentInputComponents
Definition: vulkan.h:11109
uint32_t maxImageDimension1D
Definition: vulkan.h:11062
float viewportBoundsRange[2]
Definition: vulkan.h:11126
VkBool32 standardSampleLocations
Definition: vulkan.h:11164
uint32_t maxSamplerAllocationCount
Definition: vulkan.h:11072
uint32_t maxPerStageDescriptorInputAttachments
Definition: vulkan.h:11081
uint32_t maxComputeWorkGroupSize[3]
Definition: vulkan.h:11116
uint32_t maxComputeWorkGroupInvocations
Definition: vulkan.h:11115
VkSampleCountFlags framebufferColorSampleCounts
Definition: vulkan.h:11142
uint32_t maxTexelGatherOffset
Definition: vulkan.h:11135
uint32_t maxImageDimension3D
Definition: vulkan.h:11064
uint32_t maxImageArrayLayers
Definition: vulkan.h:11066
uint32_t maxMemoryAllocationCount
Definition: vulkan.h:11071
uint32_t maxDescriptorSetStorageBuffersDynamic
Definition: vulkan.h:11087
uint32_t maxFramebufferWidth
Definition: vulkan.h:11139
uint32_t maxDescriptorSetInputAttachments
Definition: vulkan.h:11090
uint32_t maxTexelBufferElements
Definition: vulkan.h:11067
VkSampleCountFlags storageImageSampleCounts
Definition: vulkan.h:11151
uint32_t maxGeometryShaderInvocations
Definition: vulkan.h:11104
uint32_t maxBoundDescriptorSets
Definition: vulkan.h:11075
VkSampleCountFlags framebufferStencilSampleCounts
Definition: vulkan.h:11144
uint32_t maxTessellationControlPerPatchOutputComponents
Definition: vulkan.h:11100
uint32_t maxTessellationEvaluationOutputComponents
Definition: vulkan.h:11103
uint32_t maxGeometryOutputComponents
Definition: vulkan.h:11106
float maxInterpolationOffset
Definition: vulkan.h:11137
uint32_t maxPerStageDescriptorSamplers
Definition: vulkan.h:11076
uint32_t maxTessellationControlTotalOutputComponents
Definition: vulkan.h:11101
uint32_t maxTessellationControlPerVertexOutputComponents
Definition: vulkan.h:11099
uint32_t maxPerStageDescriptorUniformBuffers
Definition: vulkan.h:11077
uint32_t maxTessellationEvaluationInputComponents
Definition: vulkan.h:11102
uint32_t maxComputeWorkGroupCount[3]
Definition: vulkan.h:11114
uint32_t maxGeometryTotalOutputComponents
Definition: vulkan.h:11108
float minInterpolationOffset
Definition: vulkan.h:11136
uint32_t maxVertexInputBindingStride
Definition: vulkan.h:11094
VkSampleCountFlags sampledImageStencilSampleCounts
Definition: vulkan.h:11150
uint32_t maxDrawIndirectCount
Definition: vulkan.h:11121
uint32_t maxColorAttachments
Definition: vulkan.h:11146
uint32_t maxComputeSharedMemorySize
Definition: vulkan.h:11113
uint32_t maxFragmentOutputAttachments
Definition: vulkan.h:11110
VkSampleCountFlags sampledImageDepthSampleCounts
Definition: vulkan.h:11149
uint32_t maxPerStageDescriptorSampledImages
Definition: vulkan.h:11079
uint32_t maxGeometryInputComponents
Definition: vulkan.h:11105
float pointSizeRange[2]
Definition: vulkan.h:11159
VkSampleCountFlags framebufferNoAttachmentsSampleCounts
Definition: vulkan.h:11145
uint32_t maxPerStageResources
Definition: vulkan.h:11082
VkSampleCountFlags framebufferDepthSampleCounts
Definition: vulkan.h:11143
uint32_t subPixelPrecisionBits
Definition: vulkan.h:11117
uint32_t maxSampleMaskWords
Definition: vulkan.h:11152
uint32_t maxFragmentDualSrcAttachments
Definition: vulkan.h:11111
uint32_t maxTessellationGenerationLevel
Definition: vulkan.h:11096
uint32_t maxVertexInputAttributes
Definition: vulkan.h:11091
float lineWidthRange[2]
Definition: vulkan.h:11160

Referenced by vkd3d_init_device_caps().

◆ vkd3d_trace_physical_device_properties()

static void vkd3d_trace_physical_device_properties ( const VkPhysicalDeviceProperties *  properties)
static

Definition at line 933 of file device.c.

934{
935 const uint32_t driver_version = properties->driverVersion;
936 const uint32_t api_version = properties->apiVersion;
937
938 TRACE("Device name: %s.\n", properties->deviceName);
939 TRACE("Vendor ID: %#x, Device ID: %#x.\n", properties->vendorID, properties->deviceID);
940 TRACE("Driver version: %#x (%u.%u.%u, %u.%u.%u.%u).\n", driver_version,
941 VK_VERSION_MAJOR(driver_version), VK_VERSION_MINOR(driver_version), VK_VERSION_PATCH(driver_version),
942 driver_version >> 22, (driver_version >> 14) & 0xff, (driver_version >> 6) & 0xff, driver_version & 0x3f);
943 TRACE("API version: %u.%u.%u.\n",
945}
static API_VERSION api_version
Definition: dbghelp.c:832
#define VK_VERSION_MAJOR(version)
Definition: vulkan.h:832
#define VK_VERSION_PATCH(version)
Definition: vulkan.h:834
#define VK_VERSION_MINOR(version)
Definition: vulkan.h:833

Referenced by vkd3d_select_physical_device(), and vkd3d_trace_physical_device().

◆ vkd3d_vk_descriptor_heap_layouts_cleanup()

static void vkd3d_vk_descriptor_heap_layouts_cleanup ( struct d3d12_device *  device)
static

Definition at line 190 of file device.c.

191{
192 const struct vkd3d_vk_device_procs *vk_procs = &device->vk_procs;
194
195 for (set = 0; set < ARRAY_SIZE(device->vk_descriptor_heap_layouts); ++set)
196 VK_CALL(vkDestroyDescriptorSetLayout(device->vk_device, device->vk_descriptor_heap_layouts[set].vk_set_layout,
197 NULL));
198}
Definition: _set.h:50
vkd3d_vk_descriptor_set_index
void VKAPI_CALL vkDestroyDescriptorSetLayout(VkDevice device, VkDescriptorSetLayout descriptorSetLayout, const VkAllocationCallbacks *pAllocator)

Referenced by d3d12_device_init(), d3d12_device_Release(), and vkd3d_vk_descriptor_heap_layouts_init().

◆ vkd3d_vk_descriptor_heap_layouts_init()

static HRESULT vkd3d_vk_descriptor_heap_layouts_init ( struct d3d12_device *  device)
static

Definition at line 200 of file device.c.

201{
202 static const struct vkd3d_vk_descriptor_heap_layout vk_descriptor_heap_layouts[VKD3D_SET_INDEX_COUNT] =
203 {
218 };
219 const struct vkd3d_device_descriptor_limits *limits = &device->vk_info.descriptor_limits;
221 HRESULT hr;
222
223 for (set = 0; set < ARRAY_SIZE(device->vk_descriptor_heap_layouts); ++set)
224 device->vk_descriptor_heap_layouts[set] = vk_descriptor_heap_layouts[set];
225
226 if (!device->use_vk_heaps)
227 return S_OK;
228
229 for (set = 0; set < ARRAY_SIZE(device->vk_descriptor_heap_layouts); ++set)
230 {
231 switch (device->vk_descriptor_heap_layouts[set].type)
232 {
234 device->vk_descriptor_heap_layouts[set].count = limits->uniform_buffer_max_descriptors;
235 break;
238 device->vk_descriptor_heap_layouts[set].count = limits->sampled_image_max_descriptors;
239 break;
242 device->vk_descriptor_heap_layouts[set].count = limits->storage_image_max_descriptors;
243 break;
245 device->vk_descriptor_heap_layouts[set].count = limits->sampler_max_descriptors;
246 break;
247 default:
248 ERR("Unhandled descriptor type %#x.\n", device->vk_descriptor_heap_layouts[set].type);
249 break;
250 }
251
253 {
255 return hr;
256 }
257 }
258
259 return S_OK;
260}
static HRESULT vkd3d_create_vk_descriptor_heap_layout(struct d3d12_device *device, unsigned int index)
Definition: device.c:119
@ VKD3D_SET_INDEX_STORAGE_IMAGE
@ VKD3D_SET_INDEX_UNIFORM_TEXEL_BUFFER
@ VKD3D_SET_INDEX_SAMPLED_IMAGE
@ VKD3D_SET_INDEX_UNIFORM_BUFFER
@ VKD3D_SET_INDEX_STORAGE_TEXEL_BUFFER
@ VKD3D_SET_INDEX_SAMPLER

Referenced by d3d12_device_init().

Variable Documentation

◆ cache_list

struct list cache_list = LIST_INIT(cache_list)
static

Definition at line 2752 of file device.c.

Referenced by d3d12_cache_session_init().

◆ cache_list_mutex

struct vkd3d_mutex cache_list_mutex = VKD3D_MUTEX_INITIALIZER
static

Definition at line 2751 of file device.c.

Referenced by d3d12_cache_session_destroy(), and d3d12_cache_session_init().

◆ d3d12_cache_session_vtbl

const struct ID3D12ShaderCacheSessionVtbl d3d12_cache_session_vtbl
static
Initial value:
=
{
}
static ULONG STDMETHODCALLTYPE d3d12_cache_session_AddRef(ID3D12ShaderCacheSession *iface)
Definition: device.c:2786
static HRESULT STDMETHODCALLTYPE d3d12_cache_session_SetPrivateData(ID3D12ShaderCacheSession *iface, REFGUID guid, UINT data_size, const void *data)
Definition: device.c:2836
static HRESULT STDMETHODCALLTYPE d3d12_cache_session_FindValue(ID3D12ShaderCacheSession *iface, const void *key, UINT key_size, void *value, UINT *value_size)
Definition: device.c:2876
static HRESULT STDMETHODCALLTYPE d3d12_cache_session_GetDevice(ID3D12ShaderCacheSession *iface, REFIID iid, void **device)
Definition: device.c:2866
static D3D12_SHADER_CACHE_SESSION_DESC *STDMETHODCALLTYPE d3d12_cache_session_GetDesc(ID3D12ShaderCacheSession *iface, D3D12_SHADER_CACHE_SESSION_DESC *desc)
Definition: device.c:2923
static HRESULT STDMETHODCALLTYPE d3d12_cache_session_StoreValue(ID3D12ShaderCacheSession *iface, const void *key, UINT key_size, const void *value, UINT value_size)
Definition: device.c:2899
static HRESULT STDMETHODCALLTYPE d3d12_cache_session_QueryInterface(ID3D12ShaderCacheSession *iface, REFIID iid, void **object)
Definition: device.c:2759
static ULONG STDMETHODCALLTYPE d3d12_cache_session_Release(ID3D12ShaderCacheSession *iface)
Definition: device.c:2813
static HRESULT STDMETHODCALLTYPE d3d12_cache_session_SetName(ID3D12ShaderCacheSession *iface, const WCHAR *name)
Definition: device.c:2856
static void STDMETHODCALLTYPE d3d12_cache_session_SetDeleteOnDestroy(ID3D12ShaderCacheSession *iface)
Definition: device.c:2918
static HRESULT STDMETHODCALLTYPE d3d12_cache_session_GetPrivateData(ID3D12ShaderCacheSession *iface, REFGUID guid, UINT *data_size, void *data)
Definition: device.c:2826
static HRESULT STDMETHODCALLTYPE d3d12_cache_session_SetPrivateDataInterface(ID3D12ShaderCacheSession *iface, REFGUID guid, const IUnknown *data)
Definition: device.c:2846

Definition at line 2933 of file device.c.

Referenced by d3d12_cache_session_init().

◆ d3d12_device_vtbl

const struct ID3D12Device9Vtbl d3d12_device_vtbl
static

Definition at line 5306 of file device.c.

Referenced by d3d12_device_init(), and unsafe_impl_from_ID3D12Device9().

◆ optional_device_extensions

const struct vkd3d_optional_extension_info optional_device_extensions[]
static

Definition at line 87 of file device.c.

Referenced by vkd3d_check_device_extensions(), and vkd3d_create_vk_device().

◆ optional_instance_extensions

const struct vkd3d_optional_extension_info optional_instance_extensions[]
static
Initial value:
=
{
VK_EXTENSION(KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2, KHR_get_physical_device_properties2),
VK_DEBUG_EXTENSION(EXT_DEBUG_REPORT, EXT_debug_report),
}
#define VK_EXTENSION(name, member)
Definition: device.c:60
#define VK_DEBUG_EXTENSION(name, member)
Definition: device.c:62

Definition at line 65 of file device.c.

Referenced by D3D12CreateDevice(), vkd3d_init_instance_caps(), and vkd3d_instance_init().

◆ queue_priorities

float queue_priorities[] = {1.0f}
static

Definition at line 2119 of file device.c.

Referenced by vkd3d_select_queues().

◆ required_device_extensions

const char* const required_device_extensions[]
static
Initial value:
=
{
}
#define VK_KHR_SHADER_DRAW_PARAMETERS_EXTENSION_NAME
Definition: vulkan.h:144
#define VK_KHR_MAINTENANCE1_EXTENSION_NAME
Definition: vulkan.h:156

Definition at line 73 of file device.c.

Referenced by vkd3d_check_device_extensions(), and vkd3d_create_vk_device().

◆ vkd3d_config_options

const struct vkd3d_debug_option vkd3d_config_options[]
static
Initial value:
=
{
{"virtual_heaps", VKD3D_CONFIG_FLAG_VIRTUAL_HEAPS},
}

Definition at line 549 of file device.c.

Referenced by vkd3d_init_config_flags().