Commit 91f0b001 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

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

parent 03ee99b4
...@@ -814,6 +814,28 @@ static void swapchain_update_render_to_fbo(struct wined3d_swapchain *swapchain) ...@@ -814,6 +814,28 @@ static void swapchain_update_render_to_fbo(struct wined3d_swapchain *swapchain)
swapchain->render_to_fbo = TRUE; 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, 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) 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 ...@@ -878,6 +900,8 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, struct wined3
} }
} }
swapchain->desc = *desc; 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); swapchain_update_render_to_fbo(swapchain);
TRACE("Creating front buffer.\n"); TRACE("Creating front buffer.\n");
...@@ -1277,6 +1301,8 @@ HRESULT CDECL wined3d_swapchain_resize_buffers(struct wined3d_swapchain *swapcha ...@@ -1277,6 +1301,8 @@ HRESULT CDECL wined3d_swapchain_resize_buffers(struct wined3d_swapchain *swapcha
swapchain, buffer_count, width, height, debug_d3dformat(format_id), swapchain, buffer_count, width, height, debug_d3dformat(format_id),
multisample_type, multisample_quality); 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) if (buffer_count && buffer_count != swapchain->desc.backbuffer_count)
FIXME("Cannot change the back buffer count yet.\n"); FIXME("Cannot change the back buffer count yet.\n");
......
...@@ -80,6 +80,7 @@ struct wined3d_settings wined3d_settings = ...@@ -80,6 +80,7 @@ struct wined3d_settings wined3d_settings =
0, /* The default of memory is set in init_driver_info */ 0, /* The default of memory is set in init_driver_info */
NULL, /* No wine logo by default */ NULL, /* No wine logo by default */
TRUE, /* Multisampling enabled by default. */ TRUE, /* Multisampling enabled by default. */
~0u, /* Don't force a specific sample count by default. */
FALSE, /* No strict draw ordering. */ FALSE, /* No strict draw ordering. */
TRUE, /* Don't try to render onscreen by default. */ TRUE, /* Don't try to render onscreen by default. */
FALSE, /* Don't range check relative addressing indices in float constants. */ FALSE, /* Don't range check relative addressing indices in float constants. */
...@@ -291,6 +292,9 @@ static BOOL wined3d_dll_init(HINSTANCE hInstDLL) ...@@ -291,6 +292,9 @@ static BOOL wined3d_dll_init(HINSTANCE hInstDLL)
wined3d_settings.allow_multisampling = FALSE; 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) if (!get_config_key(hkey, appkey, "StrictDrawOrdering", buffer, size)
&& !strcmp(buffer,"enabled")) && !strcmp(buffer,"enabled"))
{ {
......
...@@ -288,6 +288,7 @@ struct wined3d_settings ...@@ -288,6 +288,7 @@ struct wined3d_settings
UINT64 emulated_textureram; UINT64 emulated_textureram;
char *logo; char *logo;
int allow_multisampling; int allow_multisampling;
unsigned int sample_count;
BOOL strict_draw_ordering; BOOL strict_draw_ordering;
BOOL always_offscreen; BOOL always_offscreen;
BOOL check_float_constants; BOOL check_float_constants;
......
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