Commit 215a32d6 authored by Stefan Dösinger's avatar Stefan Dösinger Committed by Alexandre Julliard

wined3d: Make wined3d_swapchain_desc in wined3d_swapchain_create const.

parent eba2523a
......@@ -4688,7 +4688,7 @@ static void adapter_gl_destroy_bo(struct wined3d_context *context, struct wined3
}
static HRESULT adapter_gl_create_swapchain(struct wined3d_device *device,
struct wined3d_swapchain_desc *desc, struct wined3d_swapchain_state_parent *state_parent,
const struct wined3d_swapchain_desc *desc, struct wined3d_swapchain_state_parent *state_parent,
void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_swapchain **swapchain)
{
struct wined3d_swapchain_gl *swapchain_gl;
......
......@@ -1231,7 +1231,7 @@ static void adapter_vk_destroy_bo(struct wined3d_context *context, struct wined3
}
static HRESULT adapter_vk_create_swapchain(struct wined3d_device *device,
struct wined3d_swapchain_desc *desc, struct wined3d_swapchain_state_parent *state_parent,
const struct wined3d_swapchain_desc *desc, struct wined3d_swapchain_state_parent *state_parent,
void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_swapchain **swapchain)
{
struct wined3d_swapchain_vk *swapchain_vk;
......
......@@ -3019,7 +3019,7 @@ static void adapter_no3d_destroy_bo(struct wined3d_context *context, struct wine
}
static HRESULT adapter_no3d_create_swapchain(struct wined3d_device *device,
struct wined3d_swapchain_desc *desc, struct wined3d_swapchain_state_parent *state_parent,
const struct wined3d_swapchain_desc *desc, struct wined3d_swapchain_state_parent *state_parent,
void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_swapchain **swapchain)
{
struct wined3d_swapchain *swapchain_no3d;
......
......@@ -1420,6 +1420,7 @@ static HRESULT wined3d_swapchain_state_init(struct wined3d_swapchain_state *stat
GetWindowRect(window, &state->original_window_rect);
state->wined3d = wined3d;
state->device_window = window;
state->desc.device_window = window;
state->parent = parent;
if (desc->flags & WINED3D_SWAPCHAIN_REGISTER_STATE)
......@@ -1479,7 +1480,7 @@ static HRESULT swapchain_create_texture(struct wined3d_swapchain *swapchain,
}
static HRESULT wined3d_swapchain_init(struct wined3d_swapchain *swapchain, struct wined3d_device *device,
struct wined3d_swapchain_desc *desc, struct wined3d_swapchain_state_parent *state_parent,
const struct wined3d_swapchain_desc *desc, struct wined3d_swapchain_state_parent *state_parent,
void *parent, const struct wined3d_parent_ops *parent_ops,
const struct wined3d_swapchain_ops *swapchain_ops)
{
......@@ -1503,12 +1504,8 @@ static HRESULT wined3d_swapchain_init(struct wined3d_swapchain *swapchain, struc
&& desc->swap_effect != WINED3D_SWAP_EFFECT_COPY)
FIXME("Unimplemented swap effect %#x.\n", desc->swap_effect);
if (!desc->device_window)
{
TRACE("Updating device_window to %p.\n", device->create_parms.focus_window);
desc->device_window = device->create_parms.focus_window;
}
window = desc->device_window;
window = desc->device_window ? desc->device_window : device->create_parms.focus_window;
TRACE("Using target window %p.\n", window);
if (FAILED(hr = wined3d_swapchain_state_init(&swapchain->state, desc, window, device->wined3d, state_parent)))
{
......@@ -1527,24 +1524,24 @@ static HRESULT wined3d_swapchain_init(struct wined3d_swapchain *swapchain, struc
swapchain_set_max_frame_latency(swapchain, device);
GetClientRect(window, &client_rect);
if (desc->windowed)
if (swapchain->state.desc.windowed)
{
TRACE("Client rect %s.\n", wine_dbgstr_rect(&client_rect));
if (!desc->backbuffer_width)
if (!swapchain->state.desc.backbuffer_width)
{
desc->backbuffer_width = client_rect.right ? client_rect.right : 8;
TRACE("Updating width to %u.\n", desc->backbuffer_width);
swapchain->state.desc.backbuffer_width = client_rect.right ? client_rect.right : 8;
TRACE("Updating width to %u.\n", swapchain->state.desc.backbuffer_width);
}
if (!desc->backbuffer_height)
{
desc->backbuffer_height = client_rect.bottom ? client_rect.bottom : 8;
TRACE("Updating height to %u.\n", desc->backbuffer_height);
swapchain->state.desc.backbuffer_height = client_rect.bottom ? client_rect.bottom : 8;
TRACE("Updating height to %u.\n", swapchain->state.desc.backbuffer_height);
}
if (desc->backbuffer_format == WINED3DFMT_UNKNOWN)
if (swapchain->state.desc.backbuffer_format == WINED3DFMT_UNKNOWN)
{
desc->backbuffer_format = swapchain->state.original_mode.format_id;
swapchain->state.desc.backbuffer_format = swapchain->state.original_mode.format_id;
TRACE("Updating format to %s.\n", debug_d3dformat(swapchain->state.original_mode.format_id));
}
}
......@@ -1560,7 +1557,6 @@ static HRESULT wined3d_swapchain_init(struct wined3d_swapchain *swapchain, struc
output_desc.desktop_rect.left, output_desc.desktop_rect.top, desc->backbuffer_width,
desc->backbuffer_height);
}
swapchain->state.desc = *desc;
wined3d_swapchain_apply_sample_count_override(swapchain, swapchain->state.desc.backbuffer_format,
&swapchain->state.desc.multisample_type, &swapchain->state.desc.multisample_quality);
......@@ -1686,7 +1682,7 @@ err:
}
HRESULT wined3d_swapchain_no3d_init(struct wined3d_swapchain *swapchain_no3d, struct wined3d_device *device,
struct wined3d_swapchain_desc *desc, struct wined3d_swapchain_state_parent *state_parent,
const struct wined3d_swapchain_desc *desc, struct wined3d_swapchain_state_parent *state_parent,
void *parent, const struct wined3d_parent_ops *parent_ops)
{
TRACE("swapchain_no3d %p, device %p, desc %p, state_parent %p, parent %p, parent_ops %p.\n",
......@@ -1697,7 +1693,7 @@ HRESULT wined3d_swapchain_no3d_init(struct wined3d_swapchain *swapchain_no3d, st
}
HRESULT wined3d_swapchain_gl_init(struct wined3d_swapchain_gl *swapchain_gl, struct wined3d_device *device,
struct wined3d_swapchain_desc *desc, struct wined3d_swapchain_state_parent *state_parent,
const struct wined3d_swapchain_desc *desc, struct wined3d_swapchain_state_parent *state_parent,
void *parent, const struct wined3d_parent_ops *parent_ops)
{
TRACE("swapchain_gl %p, device %p, desc %p, state_parent %p, parent %p, parent_ops %p.\n",
......@@ -1708,7 +1704,7 @@ HRESULT wined3d_swapchain_gl_init(struct wined3d_swapchain_gl *swapchain_gl, str
}
HRESULT wined3d_swapchain_vk_init(struct wined3d_swapchain_vk *swapchain_vk, struct wined3d_device *device,
struct wined3d_swapchain_desc *desc, struct wined3d_swapchain_state_parent *state_parent,
const struct wined3d_swapchain_desc *desc, struct wined3d_swapchain_state_parent *state_parent,
void *parent, const struct wined3d_parent_ops *parent_ops)
{
HRESULT hr;
......@@ -1733,7 +1729,7 @@ HRESULT wined3d_swapchain_vk_init(struct wined3d_swapchain_vk *swapchain_vk, str
}
HRESULT CDECL wined3d_swapchain_create(struct wined3d_device *device,
struct wined3d_swapchain_desc *desc, struct wined3d_swapchain_state_parent *state_parent,
const struct wined3d_swapchain_desc *desc, struct wined3d_swapchain_state_parent *state_parent,
void *parent, const struct wined3d_parent_ops *parent_ops,
struct wined3d_swapchain **swapchain)
{
......
......@@ -2561,7 +2561,7 @@ struct wined3d_adapter_ops
unsigned int sub_resource_idx, struct wined3d_bo_address *addr);
void (*adapter_destroy_bo)(struct wined3d_context *context, struct wined3d_bo *bo);
HRESULT (*adapter_create_swapchain)(struct wined3d_device *device,
struct wined3d_swapchain_desc *desc,
const struct wined3d_swapchain_desc *desc,
struct wined3d_swapchain_state_parent *state_parent, void *parent,
const struct wined3d_parent_ops *parent_ops, struct wined3d_swapchain **swapchain);
void (*adapter_destroy_swapchain)(struct wined3d_swapchain *swapchain);
......@@ -4315,7 +4315,7 @@ void swapchain_set_max_frame_latency(struct wined3d_swapchain *swapchain,
const struct wined3d_device *device) DECLSPEC_HIDDEN;
HRESULT wined3d_swapchain_no3d_init(struct wined3d_swapchain *swapchain_no3d,
struct wined3d_device *device, struct wined3d_swapchain_desc *desc,
struct wined3d_device *device, const struct wined3d_swapchain_desc *desc,
struct wined3d_swapchain_state_parent *state_parent, void *parent,
const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN;
......@@ -4332,7 +4332,7 @@ static inline struct wined3d_swapchain_gl *wined3d_swapchain_gl(struct wined3d_s
void wined3d_swapchain_gl_cleanup(struct wined3d_swapchain_gl *swapchain_gl) DECLSPEC_HIDDEN;
struct wined3d_context_gl *wined3d_swapchain_gl_get_context(struct wined3d_swapchain_gl *swapchain_gl) DECLSPEC_HIDDEN;
HRESULT wined3d_swapchain_gl_init(struct wined3d_swapchain_gl *swapchain_gl,
struct wined3d_device *device, struct wined3d_swapchain_desc *desc,
struct wined3d_device *device, const struct wined3d_swapchain_desc *desc,
struct wined3d_swapchain_state_parent *state_parent, void *parent,
const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN;
......
......@@ -1035,7 +1035,7 @@ static inline struct wined3d_swapchain_vk *wined3d_swapchain_vk(struct wined3d_s
void wined3d_swapchain_vk_cleanup(struct wined3d_swapchain_vk *swapchain_vk) DECLSPEC_HIDDEN;
HRESULT wined3d_swapchain_vk_init(struct wined3d_swapchain_vk *swapchain_vk,
struct wined3d_device *device, struct wined3d_swapchain_desc *desc,
struct wined3d_device *device, const struct wined3d_swapchain_desc *desc,
struct wined3d_swapchain_state_parent *state_parent, void *parent,
const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN;
......
......@@ -2819,7 +2819,7 @@ HRESULT __cdecl wined3d_streaming_buffer_upload(struct wined3d_device *device, s
const void *data, unsigned int size, unsigned int stride, unsigned int *pos);
HRESULT __cdecl wined3d_swapchain_create(struct wined3d_device *device,
struct wined3d_swapchain_desc *desc, struct wined3d_swapchain_state_parent *state_parent,
const struct wined3d_swapchain_desc *desc, struct wined3d_swapchain_state_parent *state_parent,
void *parent, const struct wined3d_parent_ops *parent_ops,
struct wined3d_swapchain **swapchain);
ULONG __cdecl wined3d_swapchain_decref(struct wined3d_swapchain *swapchain);
......
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