Commit f654f983 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Introduce a structure for Vulkan context information.

parent 7170f674
......@@ -24,23 +24,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(d3d);
struct wined3d_device_vk
{
struct wined3d_device d;
struct wined3d_context context_vk;
VkDevice vk_device;
VkQueue vk_queue;
struct wined3d_vk_info vk_info;
};
static inline struct wined3d_device_vk *wined3d_device_vk(struct wined3d_device *device)
{
return CONTAINING_RECORD(device, struct wined3d_device_vk, d);
}
static inline const struct wined3d_adapter_vk *wined3d_adapter_vk_const(const struct wined3d_adapter *adapter)
{
return CONTAINING_RECORD(adapter, struct wined3d_adapter_vk, a);
......@@ -300,7 +283,7 @@ struct wined3d_context *adapter_vk_acquire_context(struct wined3d_device *device
if (!device->context_count)
return NULL;
return &wined3d_device_vk(device)->context_vk;
return &wined3d_device_vk(device)->context_vk.c;
}
void adapter_vk_release_context(struct wined3d_context *context)
......@@ -416,8 +399,8 @@ static BOOL adapter_vk_check_format(const struct wined3d_adapter *adapter,
static HRESULT adapter_vk_init_3d(struct wined3d_device *device)
{
struct wined3d_context_vk *context_vk;
struct wined3d_device_vk *device_vk;
struct wined3d_context *context_vk;
HRESULT hr;
TRACE("device %p.\n", device);
......@@ -430,10 +413,10 @@ static HRESULT adapter_vk_init_3d(struct wined3d_device *device)
return hr;
}
if (!device_context_add(device, context_vk))
if (!device_context_add(device, &context_vk->c))
{
ERR("Failed to add the newly created context to the context list.\n");
wined3d_context_cleanup(context_vk);
wined3d_context_vk_cleanup(context_vk);
return E_FAIL;
}
......@@ -442,8 +425,8 @@ static HRESULT adapter_vk_init_3d(struct wined3d_device *device)
if (!(device_vk->d.blitter = wined3d_cpu_blitter_create()))
{
ERR("Failed to create CPU blitter.\n");
device_context_remove(device, context_vk);
wined3d_context_cleanup(context_vk);
device_context_remove(device, &context_vk->c);
wined3d_context_vk_cleanup(context_vk);
return E_FAIL;
}
......@@ -452,15 +435,15 @@ static HRESULT adapter_vk_init_3d(struct wined3d_device *device)
static void adapter_vk_uninit_3d(struct wined3d_device *device)
{
struct wined3d_context *context_vk;
struct wined3d_context_vk *context_vk;
TRACE("device %p.\n", device);
device->blitter->ops->blitter_destroy(device->blitter, NULL);
context_vk = &wined3d_device_vk(device)->context_vk;
device_context_remove(device, context_vk);
wined3d_context_cleanup(context_vk);
device_context_remove(device, &context_vk->c);
wined3d_context_vk_cleanup(context_vk);
}
static HRESULT adapter_vk_create_swapchain(struct wined3d_device *device, struct wined3d_swapchain_desc *desc,
......
......@@ -1493,6 +1493,11 @@ static void wined3d_context_gl_cleanup(struct wined3d_context_gl *context_gl)
wined3d_context_cleanup(&context_gl->c);
}
void wined3d_context_vk_cleanup(struct wined3d_context_vk *context_vk)
{
wined3d_context_cleanup(&context_vk->c);
}
DWORD context_get_tls_idx(void)
{
return wined3d_context_tls_idx;
......@@ -2295,11 +2300,11 @@ fail:
return E_FAIL;
}
HRESULT wined3d_context_vk_init(struct wined3d_context *context_vk, struct wined3d_swapchain *swapchain)
HRESULT wined3d_context_vk_init(struct wined3d_context_vk *context_vk, struct wined3d_swapchain *swapchain)
{
TRACE("context_vk %p, swapchain %p.\n", context_vk, swapchain);
wined3d_context_init(context_vk, swapchain);
wined3d_context_init(&context_vk->c, swapchain);
return WINED3D_OK;
}
......
......@@ -2127,7 +2127,13 @@ void wined3d_context_gl_unmap_bo_address(struct wined3d_context_gl *context_gl,
void wined3d_context_gl_update_stream_sources(struct wined3d_context_gl *context_gl,
const struct wined3d_state *state) DECLSPEC_HIDDEN;
HRESULT wined3d_context_vk_init(struct wined3d_context *context_vk,
struct wined3d_context_vk
{
struct wined3d_context c;
};
void wined3d_context_vk_cleanup(struct wined3d_context_vk *context_vk) DECLSPEC_HIDDEN;
HRESULT wined3d_context_vk_init(struct wined3d_context_vk *context_vk,
struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;
typedef void (*APPLYSTATEFUNC)(struct wined3d_context *ctx, const struct wined3d_state *state, DWORD state_id);
......@@ -3287,6 +3293,23 @@ static inline struct wined3d_device_gl *wined3d_device_gl(struct wined3d_device
return CONTAINING_RECORD(device, struct wined3d_device_gl, d);
}
struct wined3d_device_vk
{
struct wined3d_device d;
struct wined3d_context_vk context_vk;
VkDevice vk_device;
VkQueue vk_queue;
struct wined3d_vk_info vk_info;
};
static inline struct wined3d_device_vk *wined3d_device_vk(struct wined3d_device *device)
{
return CONTAINING_RECORD(device, struct wined3d_device_vk, d);
}
static inline BOOL isStateDirty(const struct wined3d_context *context, unsigned int state_id)
{
unsigned int idx = state_id / (sizeof(*context->dirty_graphics_states) * CHAR_BIT);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment