mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-09-13 09:16:14 -07:00
libs/vkd3d: Add structure type fields to public API structures.
Adds flexibility for future API extensions. Signed-off-by: Józef Kucia <jkucia@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
c7d7c58451
commit
f5b532921a
@ -446,6 +446,8 @@ static inline struct demo_swapchain *demo_swapchain_create(ID3D12CommandQueue *c
|
||||
vkWaitForFences(vk_device, 1, &vk_fence, VK_TRUE, UINT64_MAX);
|
||||
vkResetFences(vk_device, 1, &vk_fence);
|
||||
|
||||
resource_create_info.type = VKD3D_STRUCTURE_TYPE_IMAGE_RESOURCE_CREATE_INFO;
|
||||
resource_create_info.next = NULL;
|
||||
resource_create_info.desc.Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE2D;
|
||||
resource_create_info.desc.Alignment = 0;
|
||||
resource_create_info.desc.Width = desc->width;
|
||||
|
@ -34,6 +34,17 @@
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define VKD3D_FORCE_32_BIT_ENUM(name) name##_FORCE_32BIT = 0x7fffffff
|
||||
|
||||
enum vkd3d_structure_type
|
||||
{
|
||||
VKD3D_STRUCTURE_TYPE_INSTANCE_CREATE_INFO,
|
||||
VKD3D_STRUCTURE_TYPE_DEVICE_CREATE_INFO,
|
||||
VKD3D_STRUCTURE_TYPE_IMAGE_RESOURCE_CREATE_INFO,
|
||||
|
||||
VKD3D_FORCE_32_BIT_ENUM(VKD3D_STRUCTURE_TYPE),
|
||||
};
|
||||
|
||||
typedef bool (*PFN_vkd3d_signal_event)(HANDLE event);
|
||||
|
||||
typedef void * (*PFN_vkd3d_thread)(void *data);
|
||||
@ -45,6 +56,9 @@ struct vkd3d_instance;
|
||||
|
||||
struct vkd3d_instance_create_info
|
||||
{
|
||||
enum vkd3d_structure_type type;
|
||||
const void *next;
|
||||
|
||||
PFN_vkd3d_signal_event pfn_signal_event;
|
||||
PFN_vkd3d_create_thread pfn_create_thread;
|
||||
PFN_vkd3d_join_thread pfn_join_thread;
|
||||
@ -59,6 +73,9 @@ struct vkd3d_instance_create_info
|
||||
|
||||
struct vkd3d_device_create_info
|
||||
{
|
||||
enum vkd3d_structure_type type;
|
||||
const void *next;
|
||||
|
||||
D3D_FEATURE_LEVEL minimum_feature_level;
|
||||
|
||||
struct vkd3d_instance *instance;
|
||||
@ -79,6 +96,9 @@ struct vkd3d_device_create_info
|
||||
|
||||
struct vkd3d_image_resource_create_info
|
||||
{
|
||||
enum vkd3d_structure_type type;
|
||||
const void *next;
|
||||
|
||||
VkImage vk_image;
|
||||
D3D12_RESOURCE_DESC desc;
|
||||
unsigned int flags;
|
||||
|
@ -48,12 +48,16 @@ HRESULT WINAPI D3D12CreateDevice(IUnknown *adapter,
|
||||
FIXME("Ignoring adapter %p.\n", adapter);
|
||||
|
||||
memset(&instance_create_info, 0, sizeof(instance_create_info));
|
||||
instance_create_info.type = VKD3D_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
|
||||
instance_create_info.next = NULL;
|
||||
instance_create_info.pfn_signal_event = vkd3d_signal_event;
|
||||
instance_create_info.wchar_size = sizeof(WCHAR);
|
||||
instance_create_info.instance_extensions = instance_extensions;
|
||||
instance_create_info.instance_extension_count = ARRAY_SIZE(instance_extensions);
|
||||
|
||||
memset(&device_create_info, 0, sizeof(device_create_info));
|
||||
device_create_info.type = VKD3D_STRUCTURE_TYPE_DEVICE_CREATE_INFO;
|
||||
device_create_info.next = NULL;
|
||||
device_create_info.minimum_feature_level = minimum_feature_level;
|
||||
device_create_info.instance_create_info = &instance_create_info;
|
||||
device_create_info.device_extensions = device_extensions;
|
||||
|
@ -342,7 +342,17 @@ HRESULT vkd3d_create_instance(const struct vkd3d_instance_create_info *create_in
|
||||
struct vkd3d_instance *object;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("create_info %p.\n", create_info);
|
||||
TRACE("create_info %p, instance %p.\n", create_info, instance);
|
||||
|
||||
if (!create_info || !instance)
|
||||
return E_INVALIDARG;
|
||||
if (create_info->type != VKD3D_STRUCTURE_TYPE_INSTANCE_CREATE_INFO)
|
||||
{
|
||||
WARN("Invalid structure type %#x.\n", create_info->type);
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
if (create_info->next)
|
||||
WARN("Unhandled next %p.\n", create_info->next);
|
||||
|
||||
if (!(object = vkd3d_malloc(sizeof(*object))))
|
||||
return E_OUTOFMEMORY;
|
||||
|
@ -805,6 +805,16 @@ HRESULT vkd3d_create_image_resource(ID3D12Device *device,
|
||||
|
||||
TRACE("device %p, create_info %p, resource %p.\n", device, create_info, resource);
|
||||
|
||||
if (!create_info || !resource)
|
||||
return E_INVALIDARG;
|
||||
if (create_info->type != VKD3D_STRUCTURE_TYPE_IMAGE_RESOURCE_CREATE_INFO)
|
||||
{
|
||||
WARN("Invalid structure type %#x.\n", create_info->type);
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
if (create_info->next)
|
||||
WARN("Unhandled next %p.\n", create_info->next);
|
||||
|
||||
if (!(object = vkd3d_malloc(sizeof(*object))))
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
|
@ -30,6 +30,13 @@ HRESULT vkd3d_create_device(const struct vkd3d_device_create_info *create_info,
|
||||
|
||||
if (!create_info || !device)
|
||||
return E_INVALIDARG;
|
||||
if (create_info->type != VKD3D_STRUCTURE_TYPE_DEVICE_CREATE_INFO)
|
||||
{
|
||||
WARN("Invalid structure type %#x.\n", create_info->type);
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
if (create_info->next)
|
||||
WARN("Unhandled next %p.\n", create_info->next);
|
||||
if (!create_info->instance && !create_info->instance_create_info)
|
||||
{
|
||||
ERR("Instance or instance create info is required.\n");
|
||||
|
@ -62,12 +62,14 @@ static bool signal_event(HANDLE event)
|
||||
|
||||
static const struct vkd3d_instance_create_info instance_default_create_info =
|
||||
{
|
||||
.type = VKD3D_STRUCTURE_TYPE_INSTANCE_CREATE_INFO,
|
||||
.wchar_size = sizeof(WCHAR),
|
||||
.pfn_signal_event = signal_event,
|
||||
};
|
||||
|
||||
static const struct vkd3d_device_create_info device_default_create_info =
|
||||
{
|
||||
.type = VKD3D_STRUCTURE_TYPE_DEVICE_CREATE_INFO,
|
||||
.minimum_feature_level = D3D_FEATURE_LEVEL_11_0,
|
||||
.instance_create_info = &instance_default_create_info,
|
||||
};
|
||||
@ -849,6 +851,8 @@ static void test_vulkan_resource_present_state(void)
|
||||
vk_memory = allocate_vulkan_image_memory(device,
|
||||
VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, vk_image);
|
||||
|
||||
resource_create_info.type = VKD3D_STRUCTURE_TYPE_IMAGE_RESOURCE_CREATE_INFO;
|
||||
resource_create_info.next = NULL;
|
||||
resource_create_info.vk_image = vk_image;
|
||||
resource_create_info.desc.Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE2D;
|
||||
resource_create_info.desc.Alignment = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user