[PATCH resend 2/2] wined3d: Do not enable blending for edge/line antialiasing.
Józef Kucia
jkucia at codeweavers.com
Wed Aug 10 04:38:42 CDT 2016
Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
---
Fixes https://bugs.winehq.org/show_bug.cgi?id=32774
---
dlls/d3d10core/tests/device.c | 4 +--
dlls/d3d11/tests/d3d11.c | 4 +--
dlls/d3d8/tests/visual.c | 4 +--
dlls/d3d9/tests/visual.c | 4 +--
dlls/ddraw/tests/ddraw2.c | 4 +--
dlls/ddraw/tests/ddraw4.c | 4 +--
dlls/ddraw/tests/ddraw7.c | 4 +--
dlls/wined3d/state.c | 67 +++++++++++++++++++++----------------------
8 files changed, 46 insertions(+), 49 deletions(-)
diff --git a/dlls/d3d10core/tests/device.c b/dlls/d3d10core/tests/device.c
index deed580..ef7ad82 100644
--- a/dlls/d3d10core/tests/device.c
+++ b/dlls/d3d10core/tests/device.c
@@ -9325,11 +9325,11 @@ static void test_line_antialiasing_blending(void)
ID3D10Device_ClearRenderTargetView(device, test_context.backbuffer_rtv, &red.x);
draw_color_quad(&test_context, &green);
- todo_wine check_texture_color(test_context.backbuffer, 0x7f00ff00, 1);
+ check_texture_color(test_context.backbuffer, 0x7f00ff00, 1);
ID3D10Device_ClearRenderTargetView(device, test_context.backbuffer_rtv, &green.x);
draw_color_quad(&test_context, &red);
- todo_wine check_texture_color(test_context.backbuffer, 0xcc0000ff, 1);
+ check_texture_color(test_context.backbuffer, 0xcc0000ff, 1);
ID3D10RasterizerState_Release(rasterizer_state);
release_test_context(&test_context);
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
index 34baea7..0760917 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -10237,11 +10237,11 @@ static void test_line_antialiasing_blending(void)
ID3D11DeviceContext_ClearRenderTargetView(context, test_context.backbuffer_rtv, &red.x);
draw_color_quad(&test_context, &green);
- todo_wine check_texture_color(test_context.backbuffer, 0x7f00ff00, 1);
+ check_texture_color(test_context.backbuffer, 0x7f00ff00, 1);
ID3D11DeviceContext_ClearRenderTargetView(context, test_context.backbuffer_rtv, &green.x);
draw_color_quad(&test_context, &red);
- todo_wine check_texture_color(test_context.backbuffer, 0xcc0000ff, 1);
+ check_texture_color(test_context.backbuffer, 0xcc0000ff, 1);
ID3D11RasterizerState_Release(rasterizer_state);
release_test_context(&test_context);
diff --git a/dlls/d3d8/tests/visual.c b/dlls/d3d8/tests/visual.c
index 5075b01..34d34b1 100644
--- a/dlls/d3d8/tests/visual.c
+++ b/dlls/d3d8/tests/visual.c
@@ -9509,7 +9509,7 @@ static void test_edge_antialiasing_blending(void)
hr = IDirect3DDevice8_EndScene(device);
ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr);
color = getPixelColor(device, 320, 240);
- todo_wine ok(color_match(color, 0x0000ff00, 1), "Got unexpected color 0x%08x.\n", color);
+ ok(color_match(color, 0x0000ff00, 1), "Got unexpected color 0x%08x.\n", color);
hr = IDirect3DDevice8_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0x7f00ff00, 0.0f, 0);
ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr);
@@ -9520,7 +9520,7 @@ static void test_edge_antialiasing_blending(void)
hr = IDirect3DDevice8_EndScene(device);
ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr);
color = getPixelColor(device, 320, 240);
- todo_wine ok(color_match(color, 0x00ff0000, 1), "Got unexpected color 0x%08x.\n", color);
+ ok(color_match(color, 0x00ff0000, 1), "Got unexpected color 0x%08x.\n", color);
refcount = IDirect3DDevice8_Release(device);
ok(!refcount, "Device has %u references left.\n", refcount);
diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c
index 631f472..b55c1f2 100644
--- a/dlls/d3d9/tests/visual.c
+++ b/dlls/d3d9/tests/visual.c
@@ -21882,7 +21882,7 @@ static void test_line_antialiasing_blending(void)
hr = IDirect3DDevice9_EndScene(device);
ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr);
color = getPixelColor(device, 320, 240);
- todo_wine ok(color_match(color, 0x0000ff00, 1), "Got unexpected color 0x%08x.\n", color);
+ ok(color_match(color, 0x0000ff00, 1), "Got unexpected color 0x%08x.\n", color);
hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0x7f00ff00, 0.0f, 0);
ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr);
@@ -21893,7 +21893,7 @@ static void test_line_antialiasing_blending(void)
hr = IDirect3DDevice9_EndScene(device);
ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr);
color = getPixelColor(device, 320, 240);
- todo_wine ok(color_match(color, 0x00ff0000, 1), "Got unexpected color 0x%08x.\n", color);
+ ok(color_match(color, 0x00ff0000, 1), "Got unexpected color 0x%08x.\n", color);
refcount = IDirect3DDevice9_Release(device);
ok(!refcount, "Device has %u references left.\n", refcount);
diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c
index 43be6e8..171f669 100644
--- a/dlls/ddraw/tests/ddraw2.c
+++ b/dlls/ddraw/tests/ddraw2.c
@@ -10429,7 +10429,7 @@ static void test_edge_antialiasing_blending(void)
hr = IDirect3DDevice2_EndScene(device);
ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr);
color = get_surface_color(offscreen, 320, 240);
- todo_wine ok(compare_color(color, 0x0000ff00, 1), "Got unexpected color 0x%08x.\n", color);
+ ok(compare_color(color, 0x0000ff00, 1), "Got unexpected color 0x%08x.\n", color);
viewport_set_background(device, viewport, green_background);
hr = IDirect3DViewport2_Clear(viewport, 1, &clear_rect, D3DCLEAR_TARGET);
@@ -10441,7 +10441,7 @@ static void test_edge_antialiasing_blending(void)
hr = IDirect3DDevice2_EndScene(device);
ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr);
color = get_surface_color(offscreen, 320, 240);
- todo_wine ok(compare_color(color, 0x00ff0000, 1), "Got unexpected color 0x%08x.\n", color);
+ ok(compare_color(color, 0x00ff0000, 1), "Got unexpected color 0x%08x.\n", color);
IDirectDrawSurface_Release(offscreen);
destroy_viewport(device, viewport);
diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c
index 3c466ce..988a82f 100644
--- a/dlls/ddraw/tests/ddraw4.c
+++ b/dlls/ddraw/tests/ddraw4.c
@@ -11763,7 +11763,7 @@ static void test_edge_antialiasing_blending(void)
hr = IDirect3DDevice3_EndScene(device);
ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr);
color = get_surface_color(offscreen, 320, 240);
- todo_wine ok(compare_color(color, 0x0000ff00, 1), "Got unexpected color 0x%08x.\n", color);
+ ok(compare_color(color, 0x0000ff00, 1), "Got unexpected color 0x%08x.\n", color);
hr = IDirect3DViewport3_Clear2(viewport, 1, &clear_rect, D3DCLEAR_TARGET, 0x7f00ff00, 0.0f, 0);
ok(SUCCEEDED(hr), "Failed to clear viewport, hr %#x.\n", hr);
@@ -11775,7 +11775,7 @@ static void test_edge_antialiasing_blending(void)
hr = IDirect3DDevice3_EndScene(device);
ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr);
color = get_surface_color(offscreen, 320, 240);
- todo_wine ok(compare_color(color, 0x00ff0000, 1), "Got unexpected color 0x%08x.\n", color);
+ ok(compare_color(color, 0x00ff0000, 1), "Got unexpected color 0x%08x.\n", color);
IDirectDrawSurface4_Release(offscreen);
IDirectDraw3_Release(ddraw);
diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c
index 213d616..48134c5 100644
--- a/dlls/ddraw/tests/ddraw7.c
+++ b/dlls/ddraw/tests/ddraw7.c
@@ -12065,7 +12065,7 @@ static void test_edge_antialiasing_blending(void)
hr = IDirect3DDevice7_EndScene(device);
ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr);
color = get_surface_color(offscreen, 320, 240);
- todo_wine ok(compare_color(color, 0x0000ff00, 1), "Got unexpected color 0x%08x.\n", color);
+ ok(compare_color(color, 0x0000ff00, 1), "Got unexpected color 0x%08x.\n", color);
hr = IDirect3DDevice7_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0x7f00ff00, 0.0f, 0);
ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr);
@@ -12077,7 +12077,7 @@ static void test_edge_antialiasing_blending(void)
hr = IDirect3DDevice7_EndScene(device);
ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr);
color = get_surface_color(offscreen, 320, 240);
- todo_wine ok(compare_color(color, 0x00ff0000, 1), "Got unexpected color 0x%08x.\n", color);
+ ok(compare_color(color, 0x00ff0000, 1), "Got unexpected color 0x%08x.\n", color);
IDirectDrawSurface7_Release(offscreen);
IDirectDraw7_Release(ddraw);
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index 630a745..9bdc773 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -440,65 +440,62 @@ static void state_blend(struct wined3d_context *context, const struct wined3d_st
{
const struct wined3d_gl_info *gl_info = context->gl_info;
const struct wined3d_format *rt_format;
+ BOOL enable_blend, enable_line_smooth;
GLenum src_blend, dst_blend;
unsigned int rt_fmt_flags;
- if (!state->fb->render_targets[0])
+ enable_line_smooth = state->render_states[WINED3D_RS_EDGEANTIALIAS]
+ || state->render_states[WINED3D_RS_ANTIALIASEDLINEENABLE];
+ if (enable_line_smooth)
{
- gl_info->gl_ops.gl.p_glDisable(GL_BLEND);
- return;
+ gl_info->gl_ops.gl.p_glEnable(GL_LINE_SMOOTH);
+ checkGLcall("glEnable(GL_LINE_SMOOTH)");
+ }
+ else
+ {
+ gl_info->gl_ops.gl.p_glDisable(GL_LINE_SMOOTH);
+ checkGLcall("glDisable(GL_LINE_SMOOTH)");
}
- rt_format = state->fb->render_targets[0]->format;
- rt_fmt_flags = state->fb->render_targets[0]->format_flags;
-
- /* According to the red book, GL_LINE_SMOOTH needs GL_BLEND with specific
- * blending parameters to work. */
- if (state->render_states[WINED3D_RS_ALPHABLENDENABLE]
- || state->render_states[WINED3D_RS_EDGEANTIALIAS]
- || state->render_states[WINED3D_RS_ANTIALIASEDLINEENABLE])
+ enable_blend = state->fb->render_targets[0] && state->render_states[WINED3D_RS_ALPHABLENDENABLE];
+ if (enable_blend)
{
+ rt_format = state->fb->render_targets[0]->format;
+ rt_fmt_flags = state->fb->render_targets[0]->format_flags;
+
/* Disable blending in all cases even without pixelshaders.
* With blending on we could face a big performance penalty.
* The d3d9 visual test confirms the behavior. */
if (context->render_offscreen && !(rt_fmt_flags & WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING))
- {
- gl_info->gl_ops.gl.p_glDisable(GL_BLEND);
- checkGLcall("glDisable GL_BLEND");
- return;
- }
- else
- {
- gl_info->gl_ops.gl.p_glEnable(GL_BLEND);
- checkGLcall("glEnable GL_BLEND");
- }
+ enable_blend = FALSE;
+ }
+
+ if (enable_blend)
+ {
+ gl_info->gl_ops.gl.p_glEnable(GL_BLEND);
+ checkGLcall("glEnable(GL_BLEND)");
}
else
{
gl_info->gl_ops.gl.p_glDisable(GL_BLEND);
- checkGLcall("glDisable GL_BLEND");
- /* Nothing more to do - get out */
+ checkGLcall("glDisable(GL_BLEND)");
+ if (enable_line_smooth)
+ WARN("LINE/EDGEANTIALIAS enabled with disabled blending.\n");
return;
- };
+ }
gl_blend_from_d3d(&src_blend, &dst_blend,
state->render_states[WINED3D_RS_SRCBLEND],
state->render_states[WINED3D_RS_DESTBLEND], rt_format);
- if (state->render_states[WINED3D_RS_EDGEANTIALIAS]
- || state->render_states[WINED3D_RS_ANTIALIASEDLINEENABLE])
+ /* According to the red book, GL_LINE_SMOOTH needs GL_BLEND with specific
+ * blending parameters to work. */
+ if (enable_line_smooth)
{
- gl_info->gl_ops.gl.p_glEnable(GL_LINE_SMOOTH);
- checkGLcall("glEnable(GL_LINE_SMOOTH)");
if (src_blend != GL_SRC_ALPHA)
- WARN("WINED3D_RS_EDGEANTIALIAS enabled, but unexpected src blending param.\n");
+ WARN("LINE/EDGEANTIALIAS enabled, but unexpected src blending param.\n");
if (dst_blend != GL_ONE_MINUS_SRC_ALPHA && dst_blend != GL_ONE)
- WARN("WINED3D_RS_EDGEANTIALIAS enabled, but unexpected dst blending param.\n");
- }
- else
- {
- gl_info->gl_ops.gl.p_glDisable(GL_LINE_SMOOTH);
- checkGLcall("glDisable(GL_LINE_SMOOTH)");
+ WARN("LINE/EDGEANTIALIAS enabled, but unexpected dst blending param.\n");
}
/* Re-apply BLENDOP(ALPHA) because of a possible SEPARATEALPHABLENDENABLE change */
--
2.7.3
More information about the wine-patches
mailing list