winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
November 2019
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
1 participants
895 discussions
Start a n
N
ew thread
Zhiyi Zhang : wined3d: Truncate stencil reference values to the stencil component size.
by Alexandre Julliard
25 Nov '19
25 Nov '19
Module: wine Branch: stable Commit: 3bdadd4ab487367245dd61f402107086d3cf6030 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=3bdadd4ab487367245dd61f4…
Author: Zhiyi Zhang <zzhang(a)codeweavers.com> Date: Wed Aug 28 21:32:28 2019 +0430 wined3d: Truncate stencil reference values to the stencil component size. As opposed to OpenGL, which clamps them. This fixes a regression introduced by commit a9e199e5ad76c0540381f25011d6051ace3e7c0a. Signed-off-by: Zhiyi Zhang <zzhang(a)codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> (cherry picked from commit 124f48d3114fe86f5feda2ce200d87b97c4009de) Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org> --- dlls/d3d9/tests/visual.c | 2 +- dlls/wined3d/cs.c | 7 +++++-- dlls/wined3d/state.c | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c index 1ba1b1c441..bbdc945dfe 100644 --- a/dlls/d3d9/tests/visual.c +++ b/dlls/d3d9/tests/visual.c @@ -11143,7 +11143,7 @@ static void stencil_cull_test(void) ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); color = getPixelColor(device, 280, 360); - todo_wine ok(color == 0x000000f0, "Got unexpected colour 0x%08x.\n", color); + ok(color == 0x000000f0, "Got unexpected colour 0x%08x.\n", color); hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL); ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c index 7471d24e7e..9e517f11ca 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -1155,9 +1155,12 @@ static void wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const device_invalidate_state(device, STATE_RENDER(WINED3D_RS_STENCILWRITEMASK)); device_invalidate_state(device, STATE_RENDER(WINED3D_RS_DEPTHBIAS)); } - else if (prev && prev->format->depth_bias_scale != op->view->format->depth_bias_scale) + else if (prev) { - device_invalidate_state(device, STATE_RENDER(WINED3D_RS_DEPTHBIAS)); + if (prev->format->depth_bias_scale != op->view->format->depth_bias_scale) + device_invalidate_state(device, STATE_RENDER(WINED3D_RS_DEPTHBIAS)); + if (prev->format->stencil_size != op->view->format->stencil_size) + device_invalidate_state(device, STATE_RENDER(WINED3D_RS_STENCILREF)); } device_invalidate_state(device, STATE_FRAMEBUFFER); diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c index 62b1b594fa..c70d5604a5 100644 --- a/dlls/wined3d/state.c +++ b/dlls/wined3d/state.c @@ -922,7 +922,7 @@ static void state_stencil(struct wined3d_context *context, const struct wined3d_ if (!(func_back = wined3d_gl_compare_func(state->render_states[WINED3D_RS_BACK_STENCILFUNC]))) func_back = GL_ALWAYS; mask = state->render_states[WINED3D_RS_STENCILMASK]; - ref = state->render_states[WINED3D_RS_STENCILREF] & mask; + ref = state->render_states[WINED3D_RS_STENCILREF] & ((1 << state->fb->depth_stencil->format->stencil_size) - 1); stencilFail = gl_stencil_op(state->render_states[WINED3D_RS_STENCILFAIL]); depthFail = gl_stencil_op(state->render_states[WINED3D_RS_STENCILZFAIL]); stencilPass = gl_stencil_op(state->render_states[WINED3D_RS_STENCILPASS]);
1
0
0
0
Zhiyi Zhang : d3d9/tests: Add a test for stencil reference value truncation.
by Alexandre Julliard
25 Nov '19
25 Nov '19
Module: wine Branch: stable Commit: ee5d3beda5eb4bfebedaec0b4c96919fd4d52370 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=ee5d3beda5eb4bfebedaec0b…
Author: Zhiyi Zhang <zzhang(a)codeweavers.com> Date: Wed Aug 28 21:32:27 2019 +0430 d3d9/tests: Add a test for stencil reference value truncation. With suggestions by Paul Gofman. Signed-off-by: Zhiyi Zhang <zzhang(a)codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> (cherry picked from commit c67a27c87f680f60c52c4d531c1adbaac417324b) Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org> --- dlls/d3d9/tests/visual.c | 136 +++++++++++++++++++++++++++++++++-------------- 1 file changed, 97 insertions(+), 39 deletions(-) diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c index bfe4551e49..1ba1b1c441 100644 --- a/dlls/d3d9/tests/visual.c +++ b/dlls/d3d9/tests/visual.c @@ -10890,33 +10890,37 @@ static void stencil_cull_test(void) D3DCAPS9 caps; HWND window; HRESULT hr; - static const float quad1[] = + static const struct { - -1.0, -1.0, 0.1, - 0.0, -1.0, 0.1, - -1.0, 0.0, 0.1, - 0.0, 0.0, 0.1, - }; - static const float quad2[] = + struct vec3 position; + } + quad1[] = { - 0.0, -1.0, 0.1, - 1.0, -1.0, 0.1, - 0.0, 0.0, 0.1, - 1.0, 0.0, 0.1, - }; - static const float quad3[] = + {{-1.0f, -1.0f, 0.1f}}, + {{ 0.0f, -1.0f, 0.1f}}, + {{-1.0f, 0.0f, 0.1f}}, + {{ 0.0f, 0.0f, 0.1f}}, + }, + quad2[] = { - 0.0, 0.0, 0.1, - 1.0, 0.0, 0.1, - 0.0, 1.0, 0.1, - 1.0, 1.0, 0.1, - }; - static const float quad4[] = + {{ 0.0f, -1.0f, 0.1f}}, + {{ 1.0f, -1.0f, 0.1f}}, + {{ 0.0f, 0.0f, 0.1f}}, + {{ 1.0f, 0.0f, 0.1f}}, + }, + quad3[] = + { + {{ 0.0f, 0.0f, 0.1f}}, + {{ 1.0f, 0.0f, 0.1f}}, + {{ 0.0f, 1.0f, 0.1f}}, + {{ 1.0f, 1.0f, 0.1f}}, + }, + quad4[] = { - -1.0, 0.0, 0.1, - 0.0, 0.0, 0.1, - -1.0, 1.0, 0.1, - 0.0, 1.0, 0.1, + {{-1.0f, 0.0f, 0.1f}}, + {{ 0.0f, 0.0f, 0.1f}}, + {{-1.0f, 1.0f, 0.1f}}, + {{ 0.0f, 1.0f, 0.1f}}, }; struct { @@ -10989,40 +10993,40 @@ static void stencil_cull_test(void) hr = IDirect3DDevice9_SetRenderState(device, D3DRS_CULLMODE, D3DCULL_CW); ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); - hr = IDirect3DDevice9_DrawIndexedPrimitiveUP(device, D3DPT_TRIANGLELIST, 0 /* MinIndex */, 4 /* NumVerts */, - 1 /* PrimCount */, indices_cw, D3DFMT_INDEX16, quad1, sizeof(float) * 3); + hr = IDirect3DDevice9_DrawIndexedPrimitiveUP(device, D3DPT_TRIANGLELIST, + 0, 4, 1, indices_cw, D3DFMT_INDEX16, quad1, sizeof(*quad1)); ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); - hr = IDirect3DDevice9_DrawIndexedPrimitiveUP(device, D3DPT_TRIANGLELIST, 0 /* MinIndex */, 4 /* NumVerts */, - 1 /* PrimCount */, indices_ccw, D3DFMT_INDEX16, quad1, sizeof(float) * 3); + hr = IDirect3DDevice9_DrawIndexedPrimitiveUP(device, D3DPT_TRIANGLELIST, + 0, 4, 1, indices_ccw, D3DFMT_INDEX16, quad1, sizeof(*quad1)); ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); hr = IDirect3DDevice9_SetRenderState(device, D3DRS_TWOSIDEDSTENCILMODE, TRUE); ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); hr = IDirect3DDevice9_SetRenderState(device, D3DRS_CULLMODE, D3DCULL_NONE); ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); - hr = IDirect3DDevice9_DrawIndexedPrimitiveUP(device, D3DPT_TRIANGLELIST, 0 /* MinIndex */, 4 /* NumVerts */, - 1 /* PrimCount */, indices_cw, D3DFMT_INDEX16, quad2, sizeof(float) * 3); + hr = IDirect3DDevice9_DrawIndexedPrimitiveUP(device, D3DPT_TRIANGLELIST, + 0, 4, 1, indices_cw, D3DFMT_INDEX16, quad2, sizeof(*quad2)); ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); - hr = IDirect3DDevice9_DrawIndexedPrimitiveUP(device, D3DPT_TRIANGLELIST, 0 /* MinIndex */, 4 /* NumVerts */, - 1 /* PrimCount */, indices_ccw, D3DFMT_INDEX16, quad2, sizeof(float) * 3); + hr = IDirect3DDevice9_DrawIndexedPrimitiveUP(device, D3DPT_TRIANGLELIST, + 0, 4, 1, indices_ccw, D3DFMT_INDEX16, quad2, sizeof(*quad2)); ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); hr = IDirect3DDevice9_SetRenderState(device, D3DRS_CULLMODE, D3DCULL_CW); ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); - hr = IDirect3DDevice9_DrawIndexedPrimitiveUP(device, D3DPT_TRIANGLELIST, 0 /* MinIndex */, 4 /* NumVerts */, - 1 /* PrimCount */, indices_cw, D3DFMT_INDEX16, quad3, sizeof(float) * 3); + hr = IDirect3DDevice9_DrawIndexedPrimitiveUP(device, D3DPT_TRIANGLELIST, + 0, 4, 1, indices_cw, D3DFMT_INDEX16, quad3, sizeof(*quad3)); ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); - hr = IDirect3DDevice9_DrawIndexedPrimitiveUP(device, D3DPT_TRIANGLELIST, 0 /* MinIndex */, 4 /* NumVerts */, - 1 /* PrimCount */, indices_ccw, D3DFMT_INDEX16, quad3, sizeof(float) * 3); + hr = IDirect3DDevice9_DrawIndexedPrimitiveUP(device, D3DPT_TRIANGLELIST, + 0, 4, 1, indices_ccw, D3DFMT_INDEX16, quad3, sizeof(*quad3)); ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); hr = IDirect3DDevice9_SetRenderState(device, D3DRS_CULLMODE, D3DCULL_CCW); ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); - hr = IDirect3DDevice9_DrawIndexedPrimitiveUP(device, D3DPT_TRIANGLELIST, 0 /* MinIndex */, 4 /* NumVerts */, - 1 /* PrimCount */, indices_cw, D3DFMT_INDEX16, quad4, sizeof(float) * 3); + hr = IDirect3DDevice9_DrawIndexedPrimitiveUP(device, D3DPT_TRIANGLELIST, + 0, 4, 1, indices_cw, D3DFMT_INDEX16, quad4, sizeof(*quad4)); ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); - hr = IDirect3DDevice9_DrawIndexedPrimitiveUP(device, D3DPT_TRIANGLELIST, 0 /* MinIndex */, 4 /* NumVerts */, - 1 /* PrimCount */, indices_ccw, D3DFMT_INDEX16, quad4, sizeof(float) * 3); + hr = IDirect3DDevice9_DrawIndexedPrimitiveUP(device, D3DPT_TRIANGLELIST, + 0, 4, 1, indices_ccw, D3DFMT_INDEX16, quad4, sizeof(*quad4)); ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); hr = IDirect3DDevice9_EndScene(device); @@ -11087,6 +11091,60 @@ static void stencil_cull_test(void) color = getPixelColor(device, 480, 60); ok(color == 0x00000080, "CW triangle, twoside TRUE, cull cw, culled, has color 0x%08x, expected 0x00000080\n", color); + /* Test for reference truncation. */ + /* 1st pass: set stencil. */ + hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_STENCIL, 0x00ff0000, 0.0f, 0); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_STENCILFAIL, D3DSTENCILOP_REPLACE); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_STENCILZFAIL, D3DSTENCILOP_REPLACE); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_STENCILPASS, D3DSTENCILOP_REPLACE); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_STENCILREF, 0x1cc); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_STENCILMASK, 0); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_STENCILFUNC, D3DCMP_ALWAYS); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_STENCILENABLE, TRUE); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_CULLMODE, D3DCULL_CW); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + + hr = IDirect3DDevice9_BeginScene(device); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + hr = IDirect3DDevice9_SetFVF(device, D3DFVF_XYZ); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + hr = IDirect3DDevice9_DrawIndexedPrimitiveUP(device, D3DPT_TRIANGLELIST, + 0, 4, 1, indices_cw, D3DFMT_INDEX16, quad1, sizeof(*quad1)); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + hr = IDirect3DDevice9_EndScene(device); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + + /* 2nd pass: draw image. */ + hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0x00ff0000, 0.0f, 0); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_STENCILREF, 0xdb); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_STENCILMASK, 0x0f); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_STENCILFUNC, D3DCMP_LESS); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + + hr = IDirect3DDevice9_BeginScene(device); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + hr = IDirect3DDevice9_SetFVF(device, D3DFVF_XYZ | D3DFVF_DIFFUSE); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, painter, sizeof(painter[0])); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + hr = IDirect3DDevice9_EndScene(device); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + + color = getPixelColor(device, 280, 360); + todo_wine ok(color == 0x000000f0, "Got unexpected colour 0x%08x.\n", color); + hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL); ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
1
0
0
0
Paul Gofman : wined3d: Apply stencil mask to stencil reference value.
by Alexandre Julliard
25 Nov '19
25 Nov '19
Module: wine Branch: stable Commit: 93caaebd39e6d4628887c64398fde35adb42cca1 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=93caaebd39e6d4628887c643…
Author: Paul Gofman <gofmanp(a)gmail.com> Date: Wed May 8 20:28:32 2019 +0300 wined3d: Apply stencil mask to stencil reference value. This is consistent with the docs and confirmed by the test. Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=28196
Signed-off-by: Paul Gofman <gofmanp(a)gmail.com> Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> (cherry picked from commit a9e199e5ad76c0540381f25011d6051ace3e7c0a) Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org> --- dlls/d3d9/tests/visual.c | 59 +++++++++++++++++++++++++----------------------- dlls/wined3d/state.c | 2 +- 2 files changed, 32 insertions(+), 29 deletions(-) diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c index fa0318edf4..bfe4551e49 100644 --- a/dlls/d3d9/tests/visual.c +++ b/dlls/d3d9/tests/visual.c @@ -10985,70 +10985,73 @@ static void stencil_cull_test(void) /* First pass: Fill the stencil buffer with some values... */ hr = IDirect3DDevice9_BeginScene(device); - ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); hr = IDirect3DDevice9_SetRenderState(device, D3DRS_CULLMODE, D3DCULL_CW); - ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); hr = IDirect3DDevice9_DrawIndexedPrimitiveUP(device, D3DPT_TRIANGLELIST, 0 /* MinIndex */, 4 /* NumVerts */, 1 /* PrimCount */, indices_cw, D3DFMT_INDEX16, quad1, sizeof(float) * 3); - ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); hr = IDirect3DDevice9_DrawIndexedPrimitiveUP(device, D3DPT_TRIANGLELIST, 0 /* MinIndex */, 4 /* NumVerts */, 1 /* PrimCount */, indices_ccw, D3DFMT_INDEX16, quad1, sizeof(float) * 3); - ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); hr = IDirect3DDevice9_SetRenderState(device, D3DRS_TWOSIDEDSTENCILMODE, TRUE); - ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); hr = IDirect3DDevice9_SetRenderState(device, D3DRS_CULLMODE, D3DCULL_NONE); - ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); hr = IDirect3DDevice9_DrawIndexedPrimitiveUP(device, D3DPT_TRIANGLELIST, 0 /* MinIndex */, 4 /* NumVerts */, 1 /* PrimCount */, indices_cw, D3DFMT_INDEX16, quad2, sizeof(float) * 3); - ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); hr = IDirect3DDevice9_DrawIndexedPrimitiveUP(device, D3DPT_TRIANGLELIST, 0 /* MinIndex */, 4 /* NumVerts */, 1 /* PrimCount */, indices_ccw, D3DFMT_INDEX16, quad2, sizeof(float) * 3); - ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); hr = IDirect3DDevice9_SetRenderState(device, D3DRS_CULLMODE, D3DCULL_CW); - ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); hr = IDirect3DDevice9_DrawIndexedPrimitiveUP(device, D3DPT_TRIANGLELIST, 0 /* MinIndex */, 4 /* NumVerts */, 1 /* PrimCount */, indices_cw, D3DFMT_INDEX16, quad3, sizeof(float) * 3); - ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); hr = IDirect3DDevice9_DrawIndexedPrimitiveUP(device, D3DPT_TRIANGLELIST, 0 /* MinIndex */, 4 /* NumVerts */, 1 /* PrimCount */, indices_ccw, D3DFMT_INDEX16, quad3, sizeof(float) * 3); - ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); hr = IDirect3DDevice9_SetRenderState(device, D3DRS_CULLMODE, D3DCULL_CCW); - ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); hr = IDirect3DDevice9_DrawIndexedPrimitiveUP(device, D3DPT_TRIANGLELIST, 0 /* MinIndex */, 4 /* NumVerts */, 1 /* PrimCount */, indices_cw, D3DFMT_INDEX16, quad4, sizeof(float) * 3); - ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); hr = IDirect3DDevice9_DrawIndexedPrimitiveUP(device, D3DPT_TRIANGLELIST, 0 /* MinIndex */, 4 /* NumVerts */, 1 /* PrimCount */, indices_ccw, D3DFMT_INDEX16, quad4, sizeof(float) * 3); - ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); hr = IDirect3DDevice9_EndScene(device); - ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); hr = IDirect3DDevice9_SetRenderState(device, D3DRS_STENCILZFAIL, D3DSTENCILOP_KEEP); - ok(hr == D3D_OK, "IDirect3DDevice9_SetRenderState returned %08x\n", hr); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); hr = IDirect3DDevice9_SetRenderState(device, D3DRS_STENCILPASS, D3DSTENCILOP_KEEP); - ok(hr == D3D_OK, "IDirect3DDevice9_SetRenderState returned %08x\n", hr); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); hr = IDirect3DDevice9_SetRenderState(device, D3DRS_STENCILFAIL, D3DSTENCILOP_KEEP); - ok(hr == D3D_OK, "IDirect3DDevice9_SetRenderState returned %08x\n", hr); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); hr = IDirect3DDevice9_SetRenderState(device, D3DRS_TWOSIDEDSTENCILMODE, FALSE); - ok(hr == D3D_OK, "IDirect3DDevice9_SetRenderState returned %08x\n", hr); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); hr = IDirect3DDevice9_SetRenderState(device, D3DRS_CULLMODE, D3DCULL_NONE); - ok(hr == D3D_OK, "IDirect3DDevice9_SetRenderState returned %08x\n", hr); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); hr = IDirect3DDevice9_SetRenderState(device, D3DRS_STENCILFUNC, D3DCMP_EQUAL); - ok(hr == D3D_OK, "IDirect3DDevice9_SetRenderState returned %08x\n", hr); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_STENCILMASK, 0x000000ff); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); /* 2nd pass: Make the stencil values visible */ hr = IDirect3DDevice9_BeginScene(device); - ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); hr = IDirect3DDevice9_SetFVF(device, D3DFVF_XYZ | D3DFVF_DIFFUSE); - ok(SUCCEEDED(hr), "Failed to set FVF, hr %#x.\n", hr); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); for (i = 0; i < 16; ++i) { - hr = IDirect3DDevice9_SetRenderState(device, D3DRS_STENCILREF, i); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_STENCILREF, 0x0000ff00 | i); ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); painter[0].diffuse = (i * 16); /* Creates shades of blue */ @@ -11056,13 +11059,13 @@ static void stencil_cull_test(void) painter[2].diffuse = (i * 16); painter[3].diffuse = (i * 16); hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, painter, sizeof(painter[0])); - ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); } hr = IDirect3DDevice9_EndScene(device); - ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); hr = IDirect3DDevice9_SetRenderState(device, D3DRS_STENCILENABLE, FALSE); - ok(hr == D3D_OK, "IDirect3DDevice9_SetRenderState returned %08x\n", hr); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); color = getPixelColor(device, 160, 420); ok(color == 0x00000030, "CCW triangle, twoside FALSE, cull cw, replace, has color 0x%08x, expected 0x00000030\n", color); @@ -11085,7 +11088,7 @@ static void stencil_cull_test(void) ok(color == 0x00000080, "CW triangle, twoside TRUE, cull cw, culled, has color 0x%08x, expected 0x00000080\n", color); hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL); - ok(hr == D3D_OK, "IDirect3DDevice9_Present failed with %08x\n", hr); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); cleanup: refcount = IDirect3DDevice9_Release(device); diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c index 320a49025a..62b1b594fa 100644 --- a/dlls/wined3d/state.c +++ b/dlls/wined3d/state.c @@ -921,8 +921,8 @@ static void state_stencil(struct wined3d_context *context, const struct wined3d_ func = GL_ALWAYS; if (!(func_back = wined3d_gl_compare_func(state->render_states[WINED3D_RS_BACK_STENCILFUNC]))) func_back = GL_ALWAYS; - ref = state->render_states[WINED3D_RS_STENCILREF]; mask = state->render_states[WINED3D_RS_STENCILMASK]; + ref = state->render_states[WINED3D_RS_STENCILREF] & mask; stencilFail = gl_stencil_op(state->render_states[WINED3D_RS_STENCILFAIL]); depthFail = gl_stencil_op(state->render_states[WINED3D_RS_STENCILZFAIL]); stencilPass = gl_stencil_op(state->render_states[WINED3D_RS_STENCILPASS]);
1
0
0
0
Michael Müller : avifil32: Correctly handle compressed frames when desired format is specified.
by Alexandre Julliard
25 Nov '19
25 Nov '19
Module: wine Branch: stable Commit: 0135e8848373eae87e87677b91a980e9c5d799a3 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=0135e8848373eae87e87677b…
Author: Michael Müller <michael(a)fds-team.de> Date: Thu May 2 02:43:03 2019 +0200 avifil32: Correctly handle compressed frames when desired format is specified. From: Michael Müller <michael(a)fds-team.de> Signed-off-by: Vijay Kiran Kamuju <infyquest(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> (cherry picked from commit da0f196c9348a80f04461d708b26db0f108dead6) Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org> --- dlls/avifil32/getframe.c | 102 +++++++++++++++++++++++------------------------ 1 file changed, 50 insertions(+), 52 deletions(-) diff --git a/dlls/avifil32/getframe.c b/dlls/avifil32/getframe.c index be4a2a9abf..2e6156806d 100644 --- a/dlls/avifil32/getframe.c +++ b/dlls/avifil32/getframe.c @@ -405,8 +405,6 @@ static HRESULT WINAPI IGetFrame_fnSetFormat(IGetFrame *iface, lpbi->biSize + lpbi->biClrUsed * sizeof(RGBQUAD)); if (lpbi->biBitCount <= 8) ICDecompressGetPalette(This->hic, This->lpInFormat, This->lpOutFormat); - - return AVIERR_OK; } else { if (bBestDisplay) { ICGetDisplayFormat(This->hic, This->lpInFormat, @@ -416,64 +414,64 @@ static HRESULT WINAPI IGetFrame_fnSetFormat(IGetFrame *iface, AVIFILE_CloseCompressor(This); return AVIERR_NOCOMPRESSOR; } + } - /* check output format */ - if (This->lpOutFormat->biClrUsed == 0 && - This->lpOutFormat->biBitCount <= 8) - This->lpOutFormat->biClrUsed = 1u << This->lpOutFormat->biBitCount; - if (This->lpOutFormat->biSizeImage == 0 && - This->lpOutFormat->biCompression == BI_RGB) { - This->lpOutFormat->biSizeImage = - DIBWIDTHBYTES(*This->lpOutFormat) * This->lpOutFormat->biHeight; - } + /* check output format */ + if (This->lpOutFormat->biClrUsed == 0 && + This->lpOutFormat->biBitCount <= 8) + This->lpOutFormat->biClrUsed = 1u << This->lpOutFormat->biBitCount; + if (This->lpOutFormat->biSizeImage == 0 && + This->lpOutFormat->biCompression == BI_RGB) { + This->lpOutFormat->biSizeImage = + DIBWIDTHBYTES(*This->lpOutFormat) * This->lpOutFormat->biHeight; + } - if (lpBits == NULL) { - DWORD size = This->lpOutFormat->biClrUsed * sizeof(RGBQUAD); + if (lpBits == NULL) { + DWORD size = This->lpOutFormat->biClrUsed * sizeof(RGBQUAD); - size += This->lpOutFormat->biSize + This->lpOutFormat->biSizeImage; - This->lpOutFormat = HeapReAlloc(GetProcessHeap(), 0, This->lpOutFormat, size); - if (This->lpOutFormat == NULL) { - AVIFILE_CloseCompressor(This); - return AVIERR_MEMORY; - } - This->lpOutBuffer = DIBPTR(This->lpOutFormat); - } else - This->lpOutBuffer = lpBits; - - /* for user size was irrelevant */ - if (dx == -1) - dx = This->lpOutFormat->biWidth; - if (dy == -1) - dy = This->lpOutFormat->biHeight; - - /* need to resize? */ - if (x != 0 || y != 0) { - if (dy == This->lpOutFormat->biHeight && - dx == This->lpOutFormat->biWidth) - This->bResize = FALSE; - else - This->bResize = TRUE; + size += This->lpOutFormat->biSize + This->lpOutFormat->biSizeImage; + This->lpOutFormat = HeapReAlloc(GetProcessHeap(), 0, This->lpOutFormat, size); + if (This->lpOutFormat == NULL) { + AVIFILE_CloseCompressor(This); + return AVIERR_MEMORY; } + This->lpOutBuffer = DIBPTR(This->lpOutFormat); + } else + This->lpOutBuffer = lpBits; + + /* for user size was irrelevant */ + if (dx == -1) + dx = This->lpOutFormat->biWidth; + if (dy == -1) + dy = This->lpOutFormat->biHeight; + + /* need to resize? */ + if (x != 0 || y != 0) { + if (dy == This->lpOutFormat->biHeight && + dx == This->lpOutFormat->biWidth) + This->bResize = FALSE; + else + This->bResize = TRUE; + } - if (This->bResize) { - This->x = x; - This->y = y; - This->dx = dx; - This->dy = dy; - - if (ICDecompressExBegin(This->hic,0,This->lpInFormat,This->lpInBuffer,0, - 0,This->lpInFormat->biWidth, - This->lpInFormat->biHeight,This->lpOutFormat, - This->lpOutBuffer, x, y, dx, dy) == ICERR_OK) - return AVIERR_OK; - } else if (ICDecompressBegin(This->hic, This->lpInFormat, - This->lpOutFormat) == ICERR_OK) + if (This->bResize) { + This->x = x; + This->y = y; + This->dx = dx; + This->dy = dy; + + if (ICDecompressExBegin(This->hic,0,This->lpInFormat,This->lpInBuffer,0, + 0,This->lpInFormat->biWidth, + This->lpInFormat->biHeight,This->lpOutFormat, + This->lpOutBuffer, x, y, dx, dy) == ICERR_OK) return AVIERR_OK; + } else if (ICDecompressBegin(This->hic, This->lpInFormat, + This->lpOutFormat) == ICERR_OK) + return AVIERR_OK; - AVIFILE_CloseCompressor(This); + AVIFILE_CloseCompressor(This); - return AVIERR_COMPRESSOR; - } + return AVIERR_COMPRESSOR; } static const struct IGetFrameVtbl igetframeVtbl = {
1
0
0
0
Zebediah Figura : setupapi: Add magic bytes to struct file_queue and validate them in SetupCloseFileQueue().
by Alexandre Julliard
25 Nov '19
25 Nov '19
Module: wine Branch: stable Commit: 91fdecbd95ad84e0165b513711bb3d446ff8f4ad URL:
https://source.winehq.org/git/wine.git/?a=commit;h=91fdecbd95ad84e0165b5137…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Thu May 2 23:10:04 2019 -0500 setupapi: Add magic bytes to struct file_queue and validate them in SetupCloseFileQueue(). Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=12332
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> (cherry picked from commit c65d98065c0038e0919f40bec4a9dc978fb2ade9) Conflicts: dlls/setupapi/tests/install.c Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org> --- dlls/setupapi/queue.c | 11 +++++++++++ dlls/setupapi/tests/install.c | 16 ++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/dlls/setupapi/queue.c b/dlls/setupapi/queue.c index cc17966770..95c77b7f44 100644 --- a/dlls/setupapi/queue.c +++ b/dlls/setupapi/queue.c @@ -70,12 +70,14 @@ struct file_op_queue struct file_queue { + DWORD magic; struct file_op_queue copy_queue; struct file_op_queue delete_queue; struct file_op_queue rename_queue; DWORD flags; }; +#define FILE_QUEUE_MAGIC 0x21514653 /* append a file operation to a queue */ static inline void queue_file_op( struct file_op_queue *queue, struct file_op *op ) @@ -413,6 +415,7 @@ HSPFILEQ WINAPI SetupOpenFileQueue(void) if (!(queue = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*queue)))) return INVALID_HANDLE_VALUE; + queue->magic = FILE_QUEUE_MAGIC; return queue; } @@ -424,6 +427,14 @@ BOOL WINAPI SetupCloseFileQueue( HSPFILEQ handle ) { struct file_queue *queue = handle; + /* Windows XP DDK installer passes the handle returned from + * SetupInitDefaultQueueCallback() to this function. */ + if (queue->magic != FILE_QUEUE_MAGIC) + { + SetLastError(ERROR_INVALID_HANDLE); + return FALSE; + } + free_file_op_queue( &queue->copy_queue ); free_file_op_queue( &queue->rename_queue ); free_file_op_queue( &queue->delete_queue ); diff --git a/dlls/setupapi/tests/install.c b/dlls/setupapi/tests/install.c index a3b562ecc8..5a915d650a 100644 --- a/dlls/setupapi/tests/install.c +++ b/dlls/setupapi/tests/install.c @@ -761,6 +761,21 @@ static void test_dirid(void) check_dirid(40, expected); } +static void test_close_queue(void) +{ + void *context; + BOOL ret; + + context = SetupInitDefaultQueueCallback(NULL); + ok(!!context, "Failed to create callback context, error %#x.\n", GetLastError()); + + ret = SetupCloseFileQueue(context); + ok(!ret, "Expected failure.\n"); + ok(GetLastError() == ERROR_INVALID_HANDLE, "Got unexpected error %u.\n", GetLastError()); + + SetupTermDefaultQueueCallback(context); +} + START_TEST(install) { char temp_path[MAX_PATH], prev_path[MAX_PATH]; @@ -785,6 +800,7 @@ START_TEST(install) test_install_svc_from(); test_driver_install(); test_dirid(); + test_close_queue(); UnhookWindowsHookEx(hhook);
1
0
0
0
Paul Gofman : d3dx9: Pass rectangle to {lock|unlock}_surface().
by Alexandre Julliard
25 Nov '19
25 Nov '19
Module: wine Branch: stable Commit: 7feef68ff1800e16a1f0a8aa8200730c74ac84be URL:
https://source.winehq.org/git/wine.git/?a=commit;h=7feef68ff1800e16a1f0a8aa…
Author: Paul Gofman <gofmanp(a)gmail.com> Date: Mon Aug 5 12:36:27 2019 +0300 d3dx9: Pass rectangle to {lock|unlock}_surface(). This fixes regressions introduced by commits 65956ae50a136fe8467a0332c7495f36617a16dc, 092c14b9d86ee1e96e465908cc524ec85988d0ff. Surface source or destination rectangles were left behind. Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=47546
Signed-off-by: Paul Gofman <gofmanp(a)gmail.com> Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> (cherry picked from commit 378204527e1f42ed1373a0cd7356770d235e319d) Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org> --- dlls/d3dx9_36/d3dx9_private.h | 4 +- dlls/d3dx9_36/surface.c | 68 +++++++++++------ dlls/d3dx9_36/tests/surface.c | 166 ++++++++++++++++++++++++++---------------- dlls/d3dx9_36/texture.c | 4 +- 4 files changed, 154 insertions(+), 88 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=7feef68ff1800e16a1f0…
1
0
0
0
Paul Gofman : d3dx9: Use {lock|unlock}_surface() in D3DXLoadSurfaceFromMemory().
by Alexandre Julliard
25 Nov '19
25 Nov '19
Module: wine Branch: stable Commit: 31487700d4e5dbacb55306a26a8cf83b482b493d URL:
https://source.winehq.org/git/wine.git/?a=commit;h=31487700d4e5dbacb55306a2…
Author: Paul Gofman <gofmanp(a)gmail.com> Date: Mon Jan 14 21:45:13 2019 +0100 d3dx9: Use {lock|unlock}_surface() in D3DXLoadSurfaceFromMemory(). Signed-off-by: Paul Gofman <gofmanp(a)gmail.com> Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> (cherry picked from commit 65956ae50a136fe8467a0332c7495f36617a16dc) Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org> --- dlls/d3dx9_36/surface.c | 48 ++++++++---------------------------------------- 1 file changed, 8 insertions(+), 40 deletions(-) diff --git a/dlls/d3dx9_36/surface.c b/dlls/d3dx9_36/surface.c index 23e8f7691f..cae80a8689 100644 --- a/dlls/d3dx9_36/surface.c +++ b/dlls/d3dx9_36/surface.c @@ -1822,8 +1822,7 @@ HRESULT WINAPI D3DXLoadSurfaceFromMemory(IDirect3DSurface9 *dst_surface, DWORD filter, D3DCOLOR color_key) { const struct pixel_format_desc *srcformatdesc, *destformatdesc; - IDirect3DSurface9 *surface = dst_surface; - IDirect3DDevice9 *device; + IDirect3DSurface9 *surface; D3DSURFACE_DESC surfdesc; D3DLOCKED_RECT lockrect; struct volume src_size, dst_size; @@ -1883,25 +1882,8 @@ HRESULT WINAPI D3DXLoadSurfaceFromMemory(IDirect3DSurface9 *dst_surface, return E_NOTIMPL; } - if (surfdesc.Pool == D3DPOOL_DEFAULT && !(surfdesc.Usage & D3DUSAGE_DYNAMIC)) - { - IDirect3DSurface9_GetDevice(dst_surface, &device); - hr = IDirect3DDevice9_CreateOffscreenPlainSurface(device, surfdesc.Width, - surfdesc.Height, surfdesc.Format, D3DPOOL_SYSTEMMEM, &surface, NULL); - IDirect3DDevice9_Release(device); - if (FAILED(hr)) - { - WARN("Failed to create staging surface, hr %#x.\n", hr); - return D3DERR_INVALIDCALL; - } - } - - if (FAILED(IDirect3DSurface9_LockRect(surface, &lockrect, dst_rect, 0))) - { - if (surface != dst_surface) - IDirect3DSurface9_Release(surface); - return D3DXERR_INVALIDDATA; - } + if (FAILED(hr = lock_surface(dst_surface, &lockrect, &surface, TRUE))) + return hr; if (src_format == surfdesc.Format && dst_size.width == src_size.width @@ -1916,8 +1898,8 @@ HRESULT WINAPI D3DXLoadSurfaceFromMemory(IDirect3DSurface9 *dst_surface, && src_size.height != surfdesc.Height)) { WARN("Source rect %s is misaligned.\n", wine_dbgstr_rect(src_rect)); - hr = D3DXERR_INVALIDDATA; - goto done; + unlock_surface(dst_surface, &lockrect, surface, FALSE); + return D3DXERR_INVALIDDATA; } copy_pixels(src_memory, src_pitch, 0, lockrect.pBits, lockrect.Pitch, 0, @@ -1929,8 +1911,8 @@ HRESULT WINAPI D3DXLoadSurfaceFromMemory(IDirect3DSurface9 *dst_surface, || !is_conversion_to_supported(destformatdesc)) { FIXME("Unsupported format conversion %#x -> %#x.\n", src_format, surfdesc.Format); - hr = E_NOTIMPL; - goto done; + unlock_surface(dst_surface, &lockrect, surface, FALSE); + return E_NOTIMPL; } if ((filter & 0xf) == D3DX_FILTER_NONE) @@ -1950,21 +1932,7 @@ HRESULT WINAPI D3DXLoadSurfaceFromMemory(IDirect3DSurface9 *dst_surface, } } - hr = D3D_OK; -done: - IDirect3DSurface9_UnlockRect(surface); - if (surface != dst_surface) - { - if (SUCCEEDED(hr)) - { - IDirect3DSurface9_GetDevice(dst_surface, &device); - hr = IDirect3DDevice9_UpdateSurface(device, surface, NULL, dst_surface, NULL); - IDirect3DDevice9_Release(device); - } - IDirect3DSurface9_Release(surface); - } - - return hr; + return unlock_surface(dst_surface, &lockrect, surface, TRUE); } /************************************************************
1
0
0
0
Paul Gofman : d3dx9: Use temporary surface in D3DXSaveSurfaceToFileInMemory() for unmappable textures.
by Alexandre Julliard
25 Nov '19
25 Nov '19
Module: wine Branch: stable Commit: cbff05e6c982d9ac6a6091cc84a0553af31341e4 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=cbff05e6c982d9ac6a6091cc…
Author: Paul Gofman <gofmanp(a)gmail.com> Date: Mon Jan 14 21:45:12 2019 +0100 d3dx9: Use temporary surface in D3DXSaveSurfaceToFileInMemory() for unmappable textures. Fixes a regression triggered by commit 949dbbd31f450178c90ea8267097a975b77c3219. Signed-off-by: Paul Gofman <gofmanp(a)gmail.com> Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> (cherry picked from commit 092c14b9d86ee1e96e465908cc524ec85988d0ff) Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org> --- dlls/d3dx9_36/surface.c | 20 +++++++++----------- dlls/d3dx9_36/tests/surface.c | 43 +++++++++++++++++++++++++++++++++++++++---- 2 files changed, 48 insertions(+), 15 deletions(-) diff --git a/dlls/d3dx9_36/surface.c b/dlls/d3dx9_36/surface.c index faac141951..23e8f7691f 100644 --- a/dlls/d3dx9_36/surface.c +++ b/dlls/d3dx9_36/surface.c @@ -530,6 +530,7 @@ static HRESULT save_dds_surface_to_memory(ID3DXBuffer **dst_buffer, IDirect3DSur BYTE *pixels; struct volume volume; const struct pixel_format_desc *pixel_format; + IDirect3DSurface9 *temp_surface; if (src_rect) { @@ -569,7 +570,7 @@ static HRESULT save_dds_surface_to_memory(ID3DXBuffer **dst_buffer, IDirect3DSur return hr; } - hr = IDirect3DSurface9_LockRect(src_surface, &locked_rect, NULL, D3DLOCK_READONLY); + hr = lock_surface(src_surface, &locked_rect, &temp_surface, FALSE); if (FAILED(hr)) { ID3DXBuffer_Release(buffer); @@ -582,7 +583,7 @@ static HRESULT save_dds_surface_to_memory(ID3DXBuffer **dst_buffer, IDirect3DSur copy_pixels(locked_rect.pBits, locked_rect.Pitch, 0, pixels, dst_pitch, 0, &volume, pixel_format); - IDirect3DSurface9_UnlockRect(src_surface); + unlock_surface(src_surface, &locked_rect, temp_surface, FALSE); *dst_buffer = buffer; return D3D_OK; @@ -2124,6 +2125,7 @@ HRESULT WINAPI D3DXSaveSurfaceToFileInMemory(ID3DXBuffer **dst_buffer, D3DXIMAGE WICPixelFormatGUID wic_pixel_format; D3DFORMAT d3d_pixel_format; D3DSURFACE_DESC src_surface_desc; + IDirect3DSurface9 *temp_surface; D3DLOCKED_RECT locked_rect; int width, height; STATSTG stream_stats; @@ -2131,7 +2133,7 @@ HRESULT WINAPI D3DXSaveSurfaceToFileInMemory(ID3DXBuffer **dst_buffer, D3DXIMAGE ID3DXBuffer *buffer; DWORD size; - TRACE("(%p, %#x, %p, %p, %s)\n", + TRACE("dst_buffer %p, file_format %#x, src_surface %p, src_palette %p, src_rect %s.\n", dst_buffer, file_format, src_surface, src_palette, wine_dbgstr_rect(src_rect)); if (!dst_buffer || !src_surface) return D3DERR_INVALIDCALL; @@ -2225,16 +2227,14 @@ HRESULT WINAPI D3DXSaveSurfaceToFileInMemory(ID3DXBuffer **dst_buffer, D3DXIMAGE if (SUCCEEDED(hr) && d3d_pixel_format != D3DFMT_UNKNOWN) { TRACE("Using pixel format %s %#x\n", debugstr_guid(&wic_pixel_format), d3d_pixel_format); - if (src_surface_desc.Format == d3d_pixel_format) /* Simple copy */ { - hr = IDirect3DSurface9_LockRect(src_surface, &locked_rect, src_rect, D3DLOCK_READONLY); - if (FAILED(hr)) + if (FAILED(hr = lock_surface(src_surface, &locked_rect, &temp_surface, FALSE))) goto cleanup; IWICBitmapFrameEncode_WritePixels(frame, height, locked_rect.Pitch, height * locked_rect.Pitch, locked_rect.pBits); - IDirect3DSurface9_UnlockRect(src_surface); + unlock_surface(src_surface, &locked_rect, temp_surface, FALSE); } else /* Pixel format conversion */ { @@ -2264,16 +2264,14 @@ HRESULT WINAPI D3DXSaveSurfaceToFileInMemory(ID3DXBuffer **dst_buffer, D3DXIMAGE hr = E_OUTOFMEMORY; goto cleanup; } - - hr = IDirect3DSurface9_LockRect(src_surface, &locked_rect, src_rect, D3DLOCK_READONLY); - if (FAILED(hr)) + if (FAILED(hr = lock_surface(src_surface, &locked_rect, &temp_surface, FALSE))) { HeapFree(GetProcessHeap(), 0, dst_data); goto cleanup; } convert_argb_pixels(locked_rect.pBits, locked_rect.Pitch, 0, &size, src_format_desc, dst_data, dst_pitch, 0, &size, dst_format_desc, 0, NULL); - IDirect3DSurface9_UnlockRect(src_surface); + unlock_surface(src_surface, &locked_rect, temp_surface, FALSE); IWICBitmapFrameEncode_WritePixels(frame, height, dst_pitch, dst_pitch * height, dst_data); HeapFree(GetProcessHeap(), 0, dst_data); diff --git a/dlls/d3dx9_36/tests/surface.c b/dlls/d3dx9_36/tests/surface.c index d3450722ef..6cb1ddb73c 100644 --- a/dlls/d3dx9_36/tests/surface.c +++ b/dlls/d3dx9_36/tests/surface.c @@ -1253,16 +1253,30 @@ static void test_D3DXLoadSurface(IDirect3DDevice9 *device) static void test_D3DXSaveSurfaceToFileInMemory(IDirect3DDevice9 *device) { - HRESULT hr; - RECT rect; - ID3DXBuffer *buffer; - IDirect3DSurface9 *surface; + static const struct + { + DWORD usage; + D3DPOOL pool; + } + test_access_types[] = + { + {0, D3DPOOL_MANAGED}, + {0, D3DPOOL_DEFAULT}, + {D3DUSAGE_RENDERTARGET, D3DPOOL_DEFAULT}, + }; + struct { DWORD magic; struct dds_header header; BYTE *data; } *dds; + IDirect3DSurface9 *surface; + IDirect3DTexture9 *texture; + ID3DXBuffer *buffer; + unsigned int i; + HRESULT hr; + RECT rect; hr = IDirect3DDevice9_CreateOffscreenPlainSurface(device, 4, 4, D3DFMT_A8R8G8B8, D3DPOOL_SCRATCH, &surface, NULL); if (FAILED(hr)) { @@ -1317,6 +1331,27 @@ static void test_D3DXSaveSurfaceToFileInMemory(IDirect3DDevice9 *device) ID3DXBuffer_Release(buffer); IDirect3DSurface9_Release(surface); + + for (i = 0; i < ARRAY_SIZE(test_access_types); ++i) + { + hr = IDirect3DDevice9_CreateTexture(device, 4, 4, 0, test_access_types[i].usage, + D3DFMT_A8R8G8B8, test_access_types[i].pool, &texture, NULL); + ok(hr == D3D_OK, "Unexpected hr %#x, i %u.\n", hr, i); + + hr = IDirect3DTexture9_GetSurfaceLevel(texture, 0, &surface); + ok(hr == D3D_OK, "Unexpected hr %#x, i %u.\n", hr, i); + + hr = D3DXSaveSurfaceToFileInMemory(&buffer, D3DXIFF_DDS, surface, NULL, NULL); + ok(hr == D3D_OK, "Unexpected hr %#x, i %u.\n", hr, i); + ID3DXBuffer_Release(buffer); + + hr = D3DXSaveSurfaceToFileInMemory(&buffer, D3DXIFF_BMP, surface, NULL, NULL); + ok(hr == D3D_OK, "Unexpected hr %#x, i %u.\n", hr, i); + ID3DXBuffer_Release(buffer); + + IDirect3DSurface9_Release(surface); + IDirect3DTexture9_Release(texture); + } } static void test_D3DXSaveSurfaceToFile(IDirect3DDevice9 *device)
1
0
0
0
Paul Gofman : d3dx9: Do not ignore surface map failure in D3DXSaveSurfaceToFileInMemory().
by Alexandre Julliard
25 Nov '19
25 Nov '19
Module: wine Branch: stable Commit: 056e17135248f62b2def61a0b2ec479defab0dba URL:
https://source.winehq.org/git/wine.git/?a=commit;h=056e17135248f62b2def61a0…
Author: Paul Gofman <gofmanp(a)gmail.com> Date: Mon Jan 14 21:45:11 2019 +0100 d3dx9: Do not ignore surface map failure in D3DXSaveSurfaceToFileInMemory(). Signed-off-by: Paul Gofman <gofmanp(a)gmail.com> Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> (cherry picked from commit ce090114340fe6ce9314f543a1389de9bdc6df14) Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org> --- dlls/d3dx9_36/surface.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/dlls/d3dx9_36/surface.c b/dlls/d3dx9_36/surface.c index a6eb5482f7..faac141951 100644 --- a/dlls/d3dx9_36/surface.c +++ b/dlls/d3dx9_36/surface.c @@ -2229,12 +2229,12 @@ HRESULT WINAPI D3DXSaveSurfaceToFileInMemory(ID3DXBuffer **dst_buffer, D3DXIMAGE if (src_surface_desc.Format == d3d_pixel_format) /* Simple copy */ { hr = IDirect3DSurface9_LockRect(src_surface, &locked_rect, src_rect, D3DLOCK_READONLY); - if (SUCCEEDED(hr)) - { - IWICBitmapFrameEncode_WritePixels(frame, height, - locked_rect.Pitch, height * locked_rect.Pitch, locked_rect.pBits); - IDirect3DSurface9_UnlockRect(src_surface); - } + if (FAILED(hr)) + goto cleanup; + + IWICBitmapFrameEncode_WritePixels(frame, height, + locked_rect.Pitch, height * locked_rect.Pitch, locked_rect.pBits); + IDirect3DSurface9_UnlockRect(src_surface); } else /* Pixel format conversion */ { @@ -2266,12 +2266,14 @@ HRESULT WINAPI D3DXSaveSurfaceToFileInMemory(ID3DXBuffer **dst_buffer, D3DXIMAGE } hr = IDirect3DSurface9_LockRect(src_surface, &locked_rect, src_rect, D3DLOCK_READONLY); - if (SUCCEEDED(hr)) + if (FAILED(hr)) { - convert_argb_pixels(locked_rect.pBits, locked_rect.Pitch, 0, &size, src_format_desc, - dst_data, dst_pitch, 0, &size, dst_format_desc, 0, NULL); - IDirect3DSurface9_UnlockRect(src_surface); + HeapFree(GetProcessHeap(), 0, dst_data); + goto cleanup; } + convert_argb_pixels(locked_rect.pBits, locked_rect.Pitch, 0, &size, src_format_desc, + dst_data, dst_pitch, 0, &size, dst_format_desc, 0, NULL); + IDirect3DSurface9_UnlockRect(src_surface); IWICBitmapFrameEncode_WritePixels(frame, height, dst_pitch, dst_pitch * height, dst_data); HeapFree(GetProcessHeap(), 0, dst_data);
1
0
0
0
Paul Gofman : d3dx9: Use temporary surface in D3DXFillTexture() for unmappable textures.
by Alexandre Julliard
25 Nov '19
25 Nov '19
Module: wine Branch: stable Commit: f0d4f1b5c7ef5ffe2224c9a217077df191927cb0 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=f0d4f1b5c7ef5ffe2224c9a2…
Author: Paul Gofman <gofmanp(a)gmail.com> Date: Mon Jan 14 21:45:09 2019 +0100 d3dx9: Use temporary surface in D3DXFillTexture() for unmappable textures. Fixes a regression triggered by commit 949dbbd31f450178c90ea8267097a975b77c3219. Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=46453
Signed-off-by: Paul Gofman <gofmanp(a)gmail.com> Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> (cherry picked from commit 4e44d74afb12b40f673e3be0a91cd523013544cd) Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org> --- dlls/d3dx9_36/d3dx9_private.h | 4 ++ dlls/d3dx9_36/surface.c | 47 +++++++++++++------ dlls/d3dx9_36/tests/texture.c | 106 ++++++++++++++++++++++++++++++------------ dlls/d3dx9_36/texture.c | 28 ++++++++--- 4 files changed, 134 insertions(+), 51 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=f0d4f1b5c7ef5ffe2224…
1
0
0
0
← Newer
1
...
29
30
31
32
33
34
35
...
90
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
Results per page:
10
25
50
100
200