wined3d: Allow swapchain sample counts to be overridden with a registry key.

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2016-03-15 16:55:08 +01:00 committed by Alexandre Julliard
parent 03ee99b43c
commit 91f0b00103
3 changed files with 31 additions and 0 deletions

View File

@ -814,6 +814,28 @@ static void swapchain_update_render_to_fbo(struct wined3d_swapchain *swapchain)
swapchain->render_to_fbo = TRUE;
}
static void wined3d_swapchain_apply_sample_count_override(const struct wined3d_swapchain *swapchain,
enum wined3d_format_id format_id, enum wined3d_multisample_type *type, DWORD *quality)
{
const struct wined3d_gl_info *gl_info;
const struct wined3d_format *format;
enum wined3d_multisample_type t;
if (wined3d_settings.sample_count == ~0u)
return;
gl_info = &swapchain->device->adapter->gl_info;
if (!(format = wined3d_get_format(gl_info, format_id)))
return;
if ((t = min(wined3d_settings.sample_count, gl_info->limits.samples)))
while (!(format->multisample_types & 1u << (t - 1)))
++t;
TRACE("Using sample count %u.\n", t);
*type = t;
*quality = 0;
}
static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, struct wined3d_device *device,
struct wined3d_swapchain_desc *desc, void *parent, const struct wined3d_parent_ops *parent_ops)
{
@ -878,6 +900,8 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, struct wined3
}
}
swapchain->desc = *desc;
wined3d_swapchain_apply_sample_count_override(swapchain, swapchain->desc.backbuffer_format,
&swapchain->desc.multisample_type, &swapchain->desc.multisample_quality);
swapchain_update_render_to_fbo(swapchain);
TRACE("Creating front buffer.\n");
@ -1277,6 +1301,8 @@ HRESULT CDECL wined3d_swapchain_resize_buffers(struct wined3d_swapchain *swapcha
swapchain, buffer_count, width, height, debug_d3dformat(format_id),
multisample_type, multisample_quality);
wined3d_swapchain_apply_sample_count_override(swapchain, format_id, &multisample_type, &multisample_quality);
if (buffer_count && buffer_count != swapchain->desc.backbuffer_count)
FIXME("Cannot change the back buffer count yet.\n");

View File

@ -80,6 +80,7 @@ struct wined3d_settings wined3d_settings =
0, /* The default of memory is set in init_driver_info */
NULL, /* No wine logo by default */
TRUE, /* Multisampling enabled by default. */
~0u, /* Don't force a specific sample count by default. */
FALSE, /* No strict draw ordering. */
TRUE, /* Don't try to render onscreen by default. */
FALSE, /* Don't range check relative addressing indices in float constants. */
@ -291,6 +292,9 @@ static BOOL wined3d_dll_init(HINSTANCE hInstDLL)
wined3d_settings.allow_multisampling = FALSE;
}
}
if (!get_config_key_dword(hkey, appkey, "SampleCount", &wined3d_settings.sample_count))
ERR_(winediag)("Forcing sample count to %u. This may not be compatible with all applications.\n",
wined3d_settings.sample_count);
if (!get_config_key(hkey, appkey, "StrictDrawOrdering", buffer, size)
&& !strcmp(buffer,"enabled"))
{

View File

@ -288,6 +288,7 @@ struct wined3d_settings
UINT64 emulated_textureram;
char *logo;
int allow_multisampling;
unsigned int sample_count;
BOOL strict_draw_ordering;
BOOL always_offscreen;
BOOL check_float_constants;