[PATCH v2 2/4] wined3d: Default to multisample antialiasing disabled.
Chip Davis
cdavis at codeweavers.com
Wed Apr 15 09:48:52 CDT 2020
Have d3d8 and d3d9 enable it on startup.
Signed-off-by: Chip Davis <cdavis at codeweavers.com>
---
v2: Fix build.
---
dlls/d3d8/device.c | 2 ++
dlls/d3d9/device.c | 2 ++
dlls/wined3d/stateblock.c | 2 +-
dlls/wined3d/surface.c | 28 ++++++++++++++++++++++++++++
4 files changed, 33 insertions(+), 1 deletion(-)
diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c
index 07f6dccbcbf..2005e1ee2b8 100644
--- a/dlls/d3d8/device.c
+++ b/dlls/d3d8/device.c
@@ -984,6 +984,7 @@ static HRESULT WINAPI d3d8_device_Reset(IDirect3DDevice8 *iface,
wined3d_stateblock_set_render_state(device->state, WINED3D_RS_POINTSIZE_MIN, 0);
wined3d_stateblock_set_render_state(device->state, WINED3D_RS_ZENABLE,
!!swapchain_desc.enable_auto_depth_stencil);
+ wined3d_stateblock_set_render_state(device->state, WINED3D_RS_MULTISAMPLEANTIALIAS, TRUE);
device_reset_viewport_state(device);
device->device_state = D3D8_DEVICE_STATE_OK;
}
@@ -3819,6 +3820,7 @@ HRESULT device_init(struct d3d8_device *device, struct d3d8 *parent, struct wine
wined3d_stateblock_set_render_state(device->state, WINED3D_RS_ZENABLE,
!!swapchain_desc.enable_auto_depth_stencil);
wined3d_stateblock_set_render_state(device->state, WINED3D_RS_POINTSIZE_MIN, 0);
+ wined3d_stateblock_set_render_state(device->state, WINED3D_RS_MULTISAMPLEANTIALIAS, TRUE);
device_reset_viewport_state(device);
wined3d_mutex_unlock();
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c
index 61aee971a1d..5c5e45e6ff9 100644
--- a/dlls/d3d9/device.c
+++ b/dlls/d3d9/device.c
@@ -1099,6 +1099,7 @@ static HRESULT d3d9_device_reset(struct d3d9_device *device,
device->auto_mipmaps = 0;
wined3d_stateblock_set_render_state(device->state, WINED3D_RS_ZENABLE,
!!swapchain_desc.enable_auto_depth_stencil);
+ wined3d_stateblock_set_render_state(device->state, WINED3D_RS_MULTISAMPLEANTIALIAS, TRUE);
device_reset_viewport_state(device);
}
@@ -4791,6 +4792,7 @@ HRESULT device_init(struct d3d9_device *device, struct d3d9 *parent, struct wine
wined3d_stateblock_set_render_state(device->state, WINED3D_RS_ZENABLE,
!!swapchain_desc->enable_auto_depth_stencil);
+ wined3d_stateblock_set_render_state(device->state, WINED3D_RS_MULTISAMPLEANTIALIAS, TRUE);
device_reset_viewport_state(device);
if (FAILED(hr = d3d9_device_get_swapchains(device)))
diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c
index 7e97c84c19e..001a9b6debd 100644
--- a/dlls/wined3d/stateblock.c
+++ b/dlls/wined3d/stateblock.c
@@ -1709,7 +1709,7 @@ static void init_default_render_states(DWORD rs[WINEHIGHEST_RENDER_STATE + 1], c
rs[WINED3D_RS_POINTSCALE_B] = tmpfloat.d;
tmpfloat.f = 0.0f;
rs[WINED3D_RS_POINTSCALE_C] = tmpfloat.d;
- rs[WINED3D_RS_MULTISAMPLEANTIALIAS] = TRUE;
+ rs[WINED3D_RS_MULTISAMPLEANTIALIAS] = FALSE;
rs[WINED3D_RS_MULTISAMPLEMASK] = 0xffffffff;
rs[WINED3D_RS_PATCHEDGESTYLE] = WINED3D_PATCH_EDGE_DISCRETE;
tmpfloat.f = 1.0f;
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index e965203950e..46a96243f04 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -130,6 +130,11 @@ static void texture2d_depth_blt_fbo(const struct wined3d_device *device, struct
context_invalidate_state(context, STATE_RENDER(WINED3D_RS_STENCILWRITEMASK));
}
+ if (gl_info->supported[ARB_MULTISAMPLE])
+ {
+ gl_info->gl_ops.gl.p_glEnable(GL_MULTISAMPLE);
+ context_invalidate_state(context, STATE_RENDER(WINED3D_RS_MULTISAMPLEANTIALIAS));
+ }
gl_info->gl_ops.gl.p_glDisable(GL_SCISSOR_TEST);
context_invalidate_state(context, STATE_RASTERIZER);
@@ -251,6 +256,11 @@ void texture2d_blt_fbo(struct wined3d_device *device, struct wined3d_context *co
gl_info->gl_ops.gl.p_glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
context_invalidate_state(context, STATE_BLEND);
+ if (gl_info->supported[ARB_MULTISAMPLE])
+ {
+ gl_info->gl_ops.gl.p_glEnable(GL_MULTISAMPLE);
+ context_invalidate_state(context, STATE_RENDER(WINED3D_RS_MULTISAMPLEANTIALIAS));
+ }
gl_info->gl_ops.gl.p_glDisable(GL_SCISSOR_TEST);
context_invalidate_state(context, STATE_RASTERIZER);
@@ -754,6 +764,12 @@ void texture2d_read_from_framebuffer(struct wined3d_texture *texture, unsigned i
gl_info->gl_ops.gl.p_glPixelStorei(GL_PACK_ROW_LENGTH, row_pitch / format_gl->f.byte_count);
checkGLcall("glPixelStorei");
+ if (gl_info->supported[ARB_MULTISAMPLE])
+ {
+ gl_info->gl_ops.gl.p_glEnable(GL_MULTISAMPLE);
+ context_invalidate_state(context, STATE_RENDER(WINED3D_RS_MULTISAMPLEANTIALIAS));
+ }
+
width = wined3d_texture_get_level_width(texture, level);
height = wined3d_texture_get_level_height(texture, level);
gl_info->gl_ops.gl.p_glReadPixels(0, 0, width, height,
@@ -848,6 +864,12 @@ void texture2d_load_fb_texture(struct wined3d_texture_gl *texture_gl,
gl_info->gl_ops.gl.p_glReadBuffer(wined3d_texture_get_gl_buffer(&texture_gl->t));
checkGLcall("glReadBuffer");
+ if (gl_info->supported[ARB_MULTISAMPLE])
+ {
+ gl_info->gl_ops.gl.p_glEnable(GL_MULTISAMPLE);
+ context_invalidate_state(context, STATE_RENDER(WINED3D_RS_MULTISAMPLEANTIALIAS));
+ }
+
level = sub_resource_idx % texture_gl->t.level_count;
target = wined3d_texture_gl_get_sub_resource_target(texture_gl, sub_resource_idx);
gl_info->gl_ops.gl.p_glCopyTexSubImage2D(target, level, 0, 0, 0, 0,
@@ -1421,6 +1443,12 @@ static DWORD ffp_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_blit
gl_info->gl_ops.gl.p_glEnable(src_texture_gl->target);
checkGLcall("glEnable(target)");
+ if (gl_info->supported[ARB_MULTISAMPLE])
+ {
+ gl_info->gl_ops.gl.p_glEnable(GL_MULTISAMPLE);
+ context_invalidate_state(context, STATE_RENDER(WINED3D_RS_MULTISAMPLEANTIALIAS));
+ }
+
if (op == WINED3D_BLIT_OP_COLOR_BLIT_ALPHATEST || color_key)
{
gl_info->gl_ops.gl.p_glEnable(GL_ALPHA_TEST);
--
2.24.0
More information about the wine-devel
mailing list