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
March 2016
----- 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
2 participants
722 discussions
Start a n
N
ew thread
Henri Verbeet : wined3d: Get resource info from the texture in arbfp_blit_surface().
by Alexandre Julliard
04 Mar '16
04 Mar '16
Module: wine Branch: master Commit: b334f1d237a06b62c2143110bcb445ab1e573373 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=b334f1d237a06b62c2143110b…
Author: Henri Verbeet <hverbeet(a)codeweavers.com> Date: Fri Mar 4 00:05:19 2016 +0100 wined3d: Get resource info from the texture in arbfp_blit_surface(). Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wined3d/arb_program_shader.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c index 4cc7d3f..956986c 100644 --- a/dlls/wined3d/arb_program_shader.c +++ b/dlls/wined3d/arb_program_shader.c @@ -7863,6 +7863,8 @@ static void arbfp_blit_surface(struct wined3d_device *device, enum wined3d_blit_ struct wined3d_surface *dst_surface, const RECT *dst_rect_in, const struct wined3d_color_key *color_key) { + struct wined3d_texture *src_texture = src_surface->container; + struct wined3d_texture *dst_texture = dst_surface->container; struct wined3d_context *context; RECT src_rect = *src_rect_in; RECT dst_rect = *dst_rect_in; @@ -7875,7 +7877,7 @@ static void arbfp_blit_surface(struct wined3d_device *device, enum wined3d_blit_ if (wined3d_settings.offscreen_rendering_mode != ORM_FBO && (src_surface->locations & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_DRAWABLE)) == WINED3D_LOCATION_DRAWABLE - && !wined3d_resource_is_offscreen(&src_surface->container->resource)) + && !wined3d_resource_is_offscreen(&src_texture->resource)) { /* Without FBO blits transferring from the drawable to the texture is * expensive, because we have to flip the data in sysmem. Since we can @@ -7888,16 +7890,16 @@ static void arbfp_blit_surface(struct wined3d_device *device, enum wined3d_blit_ src_rect.bottom = src_surface->resource.height - src_rect.bottom; } else - wined3d_texture_load(src_surface->container, context, FALSE); + wined3d_texture_load(src_texture, context, FALSE); context_apply_blit_state(context, device); - if (!wined3d_resource_is_offscreen(&dst_surface->container->resource)) + if (!wined3d_resource_is_offscreen(&dst_texture->resource)) surface_translate_drawable_coords(dst_surface, context->win_handle, &dst_rect); if (op == WINED3D_BLIT_OP_COLOR_BLIT_ALPHATEST) { - const struct wined3d_format *fmt = src_surface->resource.format; + const struct wined3d_format *fmt = src_texture->resource.format; alpha_test_key.color_space_low_value = 0; alpha_test_key.color_space_high_value = ~(((1u << fmt->alpha_size) - 1) << fmt->alpha_offset); color_key = &alpha_test_key; @@ -7912,14 +7914,13 @@ static void arbfp_blit_surface(struct wined3d_device *device, enum wined3d_blit_ arbfp_blit_unset(context->gl_info); if (wined3d_settings.strict_draw_ordering - || (dst_surface->container->swapchain - && (dst_surface->container->swapchain->front_buffer == dst_surface->container))) + || (dst_texture->swapchain && (dst_texture->swapchain->front_buffer == dst_texture))) context->gl_info->gl_ops.gl.p_glFlush(); /* Flush to ensure ordering across contexts. */ context_release(context); - surface_validate_location(dst_surface, dst_surface->container->resource.draw_binding); - surface_invalidate_location(dst_surface, ~dst_surface->container->resource.draw_binding); + surface_validate_location(dst_surface, dst_texture->resource.draw_binding); + surface_invalidate_location(dst_surface, ~dst_texture->resource.draw_binding); } static HRESULT arbfp_blit_color_fill(struct wined3d_device *device, struct wined3d_rendertarget_view *view,
1
0
0
0
Henri Verbeet : wined3d: Get resource info from the texture in arbfp_blit_set().
by Alexandre Julliard
04 Mar '16
04 Mar '16
Module: wine Branch: master Commit: 5d421caef66f7a3eccd99a0af78d4e8b74e9cfaa URL:
http://source.winehq.org/git/wine.git/?a=commit;h=5d421caef66f7a3eccd99a0af…
Author: Henri Verbeet <hverbeet(a)codeweavers.com> Date: Fri Mar 4 00:05:18 2016 +0100 wined3d: Get resource info from the texture in arbfp_blit_set(). Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wined3d/arb_program_shader.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c index 6f73dd2..4cc7d3f 100644 --- a/dlls/wined3d/arb_program_shader.c +++ b/dlls/wined3d/arb_program_shader.c @@ -7658,21 +7658,21 @@ static HRESULT arbfp_blit_set(void *blit_priv, struct wined3d_context *context, { GLenum shader; float size[4] = {(float) surface->pow2Width, (float) surface->pow2Height, 1.0f, 1.0f}; + const struct wined3d_texture *texture = surface->container; struct arbfp_blit_priv *priv = blit_priv; enum complex_fixup fixup; const struct wined3d_gl_info *gl_info = context->gl_info; - GLenum gl_texture_type = surface->container->target; struct wine_rb_entry *entry; struct arbfp_blit_type type; struct arbfp_blit_desc *desc; struct wined3d_color float_color_key[2]; - if (is_complex_fixup(surface->resource.format->color_fixup)) - fixup = get_complex_fixup(surface->resource.format->color_fixup); + if (is_complex_fixup(texture->resource.format->color_fixup)) + fixup = get_complex_fixup(texture->resource.format->color_fixup); else fixup = COMPLEX_FIXUP_NONE; - switch (gl_texture_type) + switch (texture->target) { case GL_TEXTURE_1D: type.res_type = WINED3D_GL_RES_TYPE_TEX_1D; @@ -7695,7 +7695,7 @@ static HRESULT arbfp_blit_set(void *blit_priv, struct wined3d_context *context, break; default: - ERR("Unexpected GL texture type %x.\n", gl_texture_type); + ERR("Unexpected GL texture type %#x.\n", texture->target); type.res_type = WINED3D_GL_RES_TYPE_TEX_2D; } type.fixup = fixup; @@ -7713,7 +7713,7 @@ static HRESULT arbfp_blit_set(void *blit_priv, struct wined3d_context *context, switch (fixup) { case COMPLEX_FIXUP_NONE: - if (!is_identity_fixup(surface->resource.format->color_fixup)) + if (!is_identity_fixup(texture->resource.format->color_fixup)) FIXME("Implement support for sign or swizzle fixups.\n"); shader = arbfp_gen_plain_shader(priv, gl_info, &type); break; @@ -7756,7 +7756,7 @@ err_out: } if (fixup == COMPLEX_FIXUP_P8) - upload_palette(surface->container, context); + upload_palette(texture, context); gl_info->gl_ops.gl.p_glEnable(GL_FRAGMENT_PROGRAM_ARB); checkGLcall("glEnable(GL_FRAGMENT_PROGRAM_ARB)"); @@ -7766,7 +7766,7 @@ err_out: checkGLcall("glProgramLocalParameter4fvARB"); if (type.use_color_key) { - wined3d_format_get_float_color_key(surface->resource.format, color_key, float_color_key); + wined3d_format_get_float_color_key(texture->resource.format, color_key, float_color_key); GL_EXTCALL(glProgramLocalParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, ARBFP_BLIT_PARAM_COLOR_KEY_LOW, &float_color_key[0].r)); GL_EXTCALL(glProgramLocalParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB,
1
0
0
0
Michael Stefaniuc : d3dx9/tests: Use SetRectEmpty() instead of open coding it.
by Alexandre Julliard
04 Mar '16
04 Mar '16
Module: wine Branch: master Commit: bb79ca5b549516a09f645630112e94ed2d94e9fa URL:
http://source.winehq.org/git/wine.git/?a=commit;h=bb79ca5b549516a09f6456301…
Author: Michael Stefaniuc <mstefani(a)redhat.de> Date: Thu Mar 3 09:34:41 2016 +0100 d3dx9/tests: Use SetRectEmpty() instead of open coding it. Signed-off-by: Michael Stefaniuc <mstefani(a)redhat.de> Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/d3dx9_36/tests/surface.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/d3dx9_36/tests/surface.c b/dlls/d3dx9_36/tests/surface.c index dc95740..f2855e8 100644 --- a/dlls/d3dx9_36/tests/surface.c +++ b/dlls/d3dx9_36/tests/surface.c @@ -1249,7 +1249,7 @@ static void test_D3DXSaveSurfaceToFileInMemory(IDirect3DDevice9 *device) return; } - SetRect(&rect, 0, 0, 0, 0); + SetRectEmpty(&rect); hr = D3DXSaveSurfaceToFileInMemory(&buffer, D3DXIFF_BMP, surface, NULL, &rect); /* fails with the debug version of d3d9 */ ok(hr == D3D_OK || broken(hr == D3DERR_INVALIDCALL), "D3DXSaveSurfaceToFileInMemory returned %#x, expected %#x\n", hr, D3D_OK); @@ -1388,7 +1388,7 @@ next_tests: SetRect(&rect, -1, -1, 2, 2); hr = D3DXSaveSurfaceToFileA("saved_surface.bmp", D3DXIFF_BMP, surface, NULL, &rect); ok(hr == D3DERR_INVALIDCALL, "D3DXSaveSurfaceToFileA returned %#x, expected %#x\n", hr, D3DERR_INVALIDCALL); - SetRect(&rect, 0, 0, 0, 0); + SetRectEmpty(&rect); hr = D3DXSaveSurfaceToFileA("saved_surface.bmp", D3DXIFF_BMP, surface, NULL, &rect); /* fails when debug version of d3d9 is used */ ok(hr == D3D_OK || broken(hr == D3DERR_INVALIDCALL), "D3DXSaveSurfaceToFileA returned %#x, expected %#x\n", hr, D3D_OK);
1
0
0
0
Michael Stefaniuc : d3dx9/tests: Avoid using an empty rect for a test.
by Alexandre Julliard
04 Mar '16
04 Mar '16
Module: wine Branch: master Commit: 46b6f60de14afcd9b610b73c47483091c66e66b7 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=46b6f60de14afcd9b610b73c4…
Author: Michael Stefaniuc <mstefani(a)redhat.de> Date: Thu Mar 3 15:23:19 2016 +0100 d3dx9/tests: Avoid using an empty rect for a test. Signed-off-by: Michael Stefaniuc <mstefani(a)redhat.de> Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/d3dx9_36/tests/surface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/d3dx9_36/tests/surface.c b/dlls/d3dx9_36/tests/surface.c index 55e3d88..dc95740 100644 --- a/dlls/d3dx9_36/tests/surface.c +++ b/dlls/d3dx9_36/tests/surface.c @@ -808,7 +808,7 @@ static void test_D3DXLoadSurface(IDirect3DDevice9 *device) hr = D3DXLoadSurfaceFromMemory(surf, NULL, &destrect, pixdata, D3DFMT_A8R8G8B8, sizeof(pixdata), NULL, &rect, D3DX_FILTER_NONE, 0); ok(hr == D3DERR_INVALIDCALL, "D3DXLoadSurfaceFromMemory returned %#x, expected %#x\n", hr, D3DERR_INVALIDCALL); - SetRect(&destrect, 0, 0, 0, 0); /* left = right, top = bottom */ + SetRect(&destrect, 1, 2, 1, 2); /* left = right, top = bottom */ hr = D3DXLoadSurfaceFromMemory(surf, NULL, &destrect, pixdata, D3DFMT_A8R8G8B8, sizeof(pixdata), NULL, &rect, D3DX_FILTER_NONE, 0); /* fails when debug version of d3d9 is used */ ok(hr == D3D_OK || broken(hr == D3DERR_INVALIDCALL), "D3DXLoadSurfaceFromMemory returned %#x, expected %#x\n", hr, D3D_OK);
1
0
0
0
Paul Gofman : d3dx9: Implement CommitChanges in effect.
by Alexandre Julliard
04 Mar '16
04 Mar '16
Module: wine Branch: master Commit: afcb6dc891cb44049e0295207b9bdd64994a1fef URL:
http://source.winehq.org/git/wine.git/?a=commit;h=afcb6dc891cb44049e0295207…
Author: Paul Gofman <gofmanp(a)gmail.com> Date: Thu Mar 3 15:22:15 2016 +0300 d3dx9: Implement CommitChanges in effect. 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> --- dlls/d3dx9_36/effect.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/dlls/d3dx9_36/effect.c b/dlls/d3dx9_36/effect.c index ca5c46b..4be6e4b 100644 --- a/dlls/d3dx9_36/effect.c +++ b/dlls/d3dx9_36/effect.c @@ -3556,19 +3556,19 @@ static HRESULT WINAPI ID3DXEffectImpl_BeginPass(ID3DXEffect *iface, UINT pass) return D3DERR_INVALIDCALL; } -static HRESULT WINAPI ID3DXEffectImpl_CommitChanges(ID3DXEffect* iface) +static HRESULT WINAPI ID3DXEffectImpl_CommitChanges(ID3DXEffect *iface) { - struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface); + struct ID3DXEffectImpl *effect = impl_from_ID3DXEffect(iface); - FIXME("(%p)->(): stub\n", This); + TRACE("iface %p.\n", iface); - if (!This->active_pass) + if (!effect->active_pass) { WARN("Called without an active pass.\n"); return D3D_OK; } - - return E_NOTIMPL; + /* TODO: apply only changed states */ + return d3dx9_apply_pass_states(effect, effect->active_pass); } static HRESULT WINAPI ID3DXEffectImpl_EndPass(ID3DXEffect *iface)
1
0
0
0
Paul Gofman : d3dx9: Implement state save and restore in effect.
by Alexandre Julliard
04 Mar '16
04 Mar '16
Module: wine Branch: master Commit: c1487eee3ebbca16be17acf6cfd956d50aaf64e2 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=c1487eee3ebbca16be17acf6c…
Author: Paul Gofman <gofmanp(a)gmail.com> Date: Thu Mar 3 15:22:14 2016 +0300 d3dx9: Implement state save and restore in effect. 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> --- dlls/d3dx9_36/effect.c | 56 +++++++++++++++++++++++++++++++++++--------- dlls/d3dx9_36/tests/effect.c | 22 +++++++++++++---- 2 files changed, 63 insertions(+), 15 deletions(-) diff --git a/dlls/d3dx9_36/effect.c b/dlls/d3dx9_36/effect.c index 6813c79..ca5c46b 100644 --- a/dlls/d3dx9_36/effect.c +++ b/dlls/d3dx9_36/effect.c @@ -162,6 +162,8 @@ struct d3dx_technique struct d3dx_parameter *annotations; struct d3dx_pass *passes; + + struct IDirect3DStateBlock9 *saved_state; }; struct param_table @@ -642,6 +644,12 @@ static void free_technique(struct d3dx_technique *technique) if (!technique) return; + if (technique->saved_state) + { + IDirect3DStateBlock9_Release(technique->saved_state); + technique->saved_state = NULL; + } + if (technique->annotations) { for (i = 0; i < technique->annotation_count; ++i) @@ -3483,8 +3491,8 @@ static BOOL WINAPI ID3DXEffectImpl_IsParameterUsed(ID3DXEffect* iface, D3DXHANDL static HRESULT WINAPI ID3DXEffectImpl_Begin(ID3DXEffect *iface, UINT *passes, DWORD flags) { - struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface); - struct d3dx_technique *technique = This->active_technique; + struct ID3DXEffectImpl *effect = impl_from_ID3DXEffect(iface); + struct d3dx_technique *technique = effect->active_technique; TRACE("iface %p, passes %p, flags %#x.\n", iface, passes, flags); @@ -3493,18 +3501,34 @@ static HRESULT WINAPI ID3DXEffectImpl_Begin(ID3DXEffect *iface, UINT *passes, DW if (flags & ~(D3DXFX_DONOTSAVESTATE | D3DXFX_DONOTSAVESAMPLERSTATE | D3DXFX_DONOTSAVESHADERSTATE)) WARN("Invalid flags (%#x) specified.\n", flags); - if (This->manager || flags & D3DXFX_DONOTSAVESTATE) + if (effect->manager || flags & D3DXFX_DONOTSAVESTATE) { TRACE("State capturing disabled.\n"); } else { - FIXME("State capturing not supported, yet!\n"); + HRESULT hr; + unsigned int i; + + if (!technique->saved_state) + { + hr = IDirect3DDevice9_BeginStateBlock(effect->device); + if (FAILED(hr)) + ERR("BeginStateBlock failed, hr %#x.\n", hr); + for (i = 0; i < technique->pass_count; i++) + d3dx9_apply_pass_states(effect, &technique->passes[i]); + hr = IDirect3DDevice9_EndStateBlock(effect->device, &technique->saved_state); + if (FAILED(hr)) + ERR("EndStateBlock failed, hr %#x.\n", hr); + } + hr = IDirect3DStateBlock9_Capture(technique->saved_state); + if (FAILED(hr)) + ERR("StateBlock Capture failed, hr %#x.\n", hr); } *passes = technique->pass_count; - This->started = TRUE; - This->flags = flags; + effect->started = TRUE; + effect->flags = flags; return D3D_OK; } @@ -3566,23 +3590,33 @@ static HRESULT WINAPI ID3DXEffectImpl_EndPass(ID3DXEffect *iface) static HRESULT WINAPI ID3DXEffectImpl_End(ID3DXEffect *iface) { - struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface); + struct ID3DXEffectImpl *effect = impl_from_ID3DXEffect(iface); + struct d3dx_technique *technique = effect->active_technique; TRACE("iface %p.\n", iface); - if (!This->started) + if (!effect->started) return D3D_OK; - if (This->manager || This->flags & D3DXFX_DONOTSAVESTATE) + if (effect->manager || effect->flags & D3DXFX_DONOTSAVESTATE) { TRACE("State restoring disabled.\n"); } else { - FIXME("State restoring not supported, yet!\n"); + HRESULT hr; + + if (technique && technique->saved_state) + { + hr = IDirect3DStateBlock9_Apply(technique->saved_state); + if (FAILED(hr)) + ERR("State block apply failed, hr %#x.\n", hr); + } + else + ERR("No saved state.\n"); } - This->started = FALSE; + effect->started = FALSE; return D3D_OK; } diff --git a/dlls/d3dx9_36/tests/effect.c b/dlls/d3dx9_36/tests/effect.c index 916f69a..de7d1e9 100644 --- a/dlls/d3dx9_36/tests/effect.c +++ b/dlls/d3dx9_36/tests/effect.c @@ -2853,7 +2853,7 @@ static void test_effect_states(IDirect3DDevice9 *device) hr = IDirect3DDevice9_GetRenderState(device, D3DRS_BLENDOP, &value); ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr); - todo_wine ok(value == 1, "Got result %u, expected %u.\n", value, 1); + ok(value == 1, "Got result %u, expected %u.\n", value, 1); hr = IDirect3DDevice9_GetRenderState(device, D3DRS_ALPHAFUNC, &value); ok(value == 2, "Got result %u, expected %u.\n", value, 2); @@ -2865,7 +2865,7 @@ static void test_effect_states(IDirect3DDevice9 *device) ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr); hr = IDirect3DDevice9_GetLightEnable(device, 2, &bval); - todo_wine ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr); + ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr); if (hr == D3D_OK) ok(!bval, "Got result %u, expected 0.", bval); @@ -2947,15 +2947,29 @@ static void test_effect_states(IDirect3DDevice9 *device) hr = IDirect3DDevice9_GetTransform(device, D3DTS_WORLDMATRIX(1), &mat); ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr); - todo_wine ok(!memcmp(mat.m, test_mat.m, sizeof(mat)), "World matrix not restored.\n"); + ok(!memcmp(mat.m, test_mat.m, sizeof(mat)), "World matrix not restored.\n"); hr = IDirect3DDevice9_GetLightEnable(device, 2, &bval); ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr); if (hr == D3D_OK) - todo_wine ok(!bval, "Got result %u, expected 0.\n", bval); + ok(!bval, "Got result %u, expected 0.\n", bval); + + /* State is not restored if effect is released without End call */ + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_BLENDOP, 1); + ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr); + + hr = effect->lpVtbl->Begin(effect, &npasses, 0); + ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr); + + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_BLENDOP, 3); + ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr); if (effect) effect->lpVtbl->Release(effect); + + hr = IDirect3DDevice9_GetRenderState(device, D3DRS_BLENDOP, &value); + ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr); + ok(value == 3, "Got result %u, expected %u.\n", value, 1); } START_TEST(effect)
1
0
0
0
Paul Gofman : d3dx9: Implement sampler and texture effect states application.
by Alexandre Julliard
04 Mar '16
04 Mar '16
Module: wine Branch: master Commit: 3aa22f47a86901783fd9aea84e4c3d65b098f50b URL:
http://source.winehq.org/git/wine.git/?a=commit;h=3aa22f47a86901783fd9aea84…
Author: Paul Gofman <gofmanp(a)gmail.com> Date: Thu Mar 3 15:22:13 2016 +0300 d3dx9: Implement sampler and texture effect states application. 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> --- dlls/d3dx9_36/effect.c | 41 +++++++++++++++++++++++++++++++++++++++-- dlls/d3dx9_36/tests/effect.c | 2 +- 2 files changed, 40 insertions(+), 3 deletions(-) diff --git a/dlls/d3dx9_36/effect.c b/dlls/d3dx9_36/effect.c index e1f01f2..6813c79 100644 --- a/dlls/d3dx9_36/effect.c +++ b/dlls/d3dx9_36/effect.c @@ -2681,7 +2681,8 @@ HRESULT d3dx_set_shader_const_state(IDirect3DDevice9 *device, enum SHADER_CONSTA return D3D_OK; } -static HRESULT d3dx9_apply_state(struct ID3DXEffectImpl *effect, struct d3dx_pass *pass, struct d3dx_state *state) +static HRESULT d3dx9_apply_state(struct ID3DXEffectImpl *effect, struct d3dx_pass *pass, + struct d3dx_state *state, int parent_index) { IDirect3DDevice9 *device = effect->device; struct d3dx_parameter *param; @@ -2702,10 +2703,46 @@ static HRESULT d3dx9_apply_state(struct ID3DXEffectImpl *effect, struct d3dx_pas case SC_FVF: TRACE("%s, value %#x.\n", state_table[state->operation].name, *(DWORD *)param_value); return IDirect3DDevice9_SetFVF(device, *(DWORD *)param_value); + case SC_TEXTURE: + { + UINT unit; + + unit = parent_index == -1 ? state->index : parent_index; + TRACE("%s, unit %u, value %p.\n", state_table[state->operation].name, unit, + *(IDirect3DBaseTexture9 **)param_value); + return IDirect3DDevice9_SetTexture(device, unit, *(IDirect3DBaseTexture9 **)param_value); + } case SC_TEXTURESTAGE: TRACE("%s, stage %u, value %u.\n", state_table[state->operation].name, state->index, *(DWORD *)param_value); return IDirect3DDevice9_SetTextureStageState(device, state->index, state_table[state->operation].op, *(DWORD *)param_value); + case SC_SETSAMPLER: + { + struct d3dx_sampler *sampler; + HRESULT ret, hr; + unsigned int i; + + sampler = (struct d3dx_sampler *)param_value; + TRACE("%s, sampler %u, applying %u states.\n", state_table[state->operation].name, state->index, + sampler->state_count); + ret = D3D_OK; + for (i = 0; i < sampler->state_count; i++) + { + hr = d3dx9_apply_state(effect, pass, &sampler->states[i], state->index); + if (FAILED(hr)) + ret = hr; + } + return ret; + } + case SC_SAMPLERSTATE: + { + UINT sampler; + + sampler = parent_index == -1 ? state->index : parent_index; + TRACE("%s, sampler %u, value %u.\n", state_table[state->operation].name, sampler, *(DWORD *)param_value); + return IDirect3DDevice9_SetSamplerState(device, sampler, state_table[state->operation].op, + *(DWORD *)param_value); + } case SC_VERTEXSHADER: TRACE("%s, shader %p.\n", state_table[state->operation].name, *(IDirect3DVertexShader9 **)param_value); hr = IDirect3DDevice9_SetVertexShader(device, *(IDirect3DVertexShader9 **)param_value); @@ -2784,7 +2821,7 @@ static HRESULT d3dx9_apply_pass_states(struct ID3DXEffectImpl *effect, struct d3 { HRESULT hr; - hr = d3dx9_apply_state(effect, pass, &pass->states[i]); + hr = d3dx9_apply_state(effect, pass, &pass->states[i], -1); if (FAILED(hr)) { WARN("Error applying state, hr %#x.\n", hr); diff --git a/dlls/d3dx9_36/tests/effect.c b/dlls/d3dx9_36/tests/effect.c index a1be37f..916f69a 100644 --- a/dlls/d3dx9_36/tests/effect.c +++ b/dlls/d3dx9_36/tests/effect.c @@ -2936,7 +2936,7 @@ static void test_effect_states(IDirect3DDevice9 *device) hr = IDirect3DDevice9_GetSamplerState(device, 1, D3DSAMP_MIPFILTER, &value); ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr); - todo_wine ok(value == D3DTEXF_LINEAR, "Unexpected sampler 1 mipfilter %u.\n", value); + ok(value == D3DTEXF_LINEAR, "Unexpected sampler 1 mipfilter %u.\n", value); hr = IDirect3DDevice9_GetTextureStageState(device, 3, D3DTSS_ALPHAOP, &value); ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
1
0
0
0
Paul Gofman : d3dx9: Implement shader constants effect states application.
by Alexandre Julliard
04 Mar '16
04 Mar '16
Module: wine Branch: master Commit: ec6124f15d7363f8d827352c16849949b209b618 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=ec6124f15d7363f8d827352c1…
Author: Paul Gofman <gofmanp(a)gmail.com> Date: Thu Mar 3 15:22:12 2016 +0300 d3dx9: Implement shader constants effect states application. 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> --- dlls/d3dx9_36/effect.c | 61 ++++++++++++++++++++++++++++++++++++++++++++ dlls/d3dx9_36/tests/effect.c | 2 +- 2 files changed, 62 insertions(+), 1 deletion(-) diff --git a/dlls/d3dx9_36/effect.c b/dlls/d3dx9_36/effect.c index bf39ce2..e1f01f2 100644 --- a/dlls/d3dx9_36/effect.c +++ b/dlls/d3dx9_36/effect.c @@ -2625,6 +2625,62 @@ static void d3dx9_set_material_parameter(enum MATERIAL_TYPE op, D3DMATERIAL9 *ma } } +HRESULT d3dx_set_shader_const_state(IDirect3DDevice9 *device, enum SHADER_CONSTANT_TYPE op, UINT index, + struct d3dx_parameter *param, void *value_ptr) +{ + static const struct + { + D3DXPARAMETER_TYPE type; + UINT elem_size; + const char *name; + } + const_tbl[] = + { + {D3DXPT_FLOAT, sizeof(float) * 4, "SCT_VSFLOAT"}, + {D3DXPT_BOOL, sizeof(BOOL), "SCT_VSBOOL"}, + {D3DXPT_INT, sizeof(int) * 4, "SCT_VSINT"}, + {D3DXPT_FLOAT, sizeof(float) * 4, "SCT_PSFLOAT"}, + {D3DXPT_BOOL, sizeof(BOOL), "SCT_PSBOOL"}, + {D3DXPT_INT, sizeof(int) * 4, "SCT_PSINT"}, + }; + UINT nelem; + + if (op < 0 || op > SCT_PSINT) + { + FIXME("Unknown op %u.\n", op); + return D3DERR_INVALIDCALL; + } + nelem = param->bytes / const_tbl[op].elem_size; + TRACE("%s, index %u, %u elements.\n", const_tbl[op].name, index, nelem); + if (param->type != const_tbl[op].type) + { + FIXME("Unexpected param type %u.\n", param->type); + return D3DERR_INVALIDCALL; + } + if (param->bytes % const_tbl[op].elem_size != 0) + { + FIXME("Unexpected param size %u, rows %u, cols %u.\n", param->bytes, param->rows, param->columns); + return D3DERR_INVALIDCALL; + } + + switch (op) + { + case SCT_VSFLOAT: + return IDirect3DDevice9_SetVertexShaderConstantF(device, index, (const float *)value_ptr, nelem); + case SCT_VSBOOL: + return IDirect3DDevice9_SetVertexShaderConstantB(device, index, (const BOOL *)value_ptr, nelem); + case SCT_VSINT: + return IDirect3DDevice9_SetVertexShaderConstantI(device, index, (const int *)value_ptr, nelem); + case SCT_PSFLOAT: + return IDirect3DDevice9_SetPixelShaderConstantF(device, index, (const float *)value_ptr, nelem); + case SCT_PSBOOL: + return IDirect3DDevice9_SetPixelShaderConstantB(device, index, (const BOOL *)value_ptr, nelem); + case SCT_PSINT: + return IDirect3DDevice9_SetPixelShaderConstantI(device, index, (const int *)value_ptr, nelem); + } + return D3D_OK; +} + static HRESULT d3dx9_apply_state(struct ID3DXEffectImpl *effect, struct d3dx_pass *pass, struct d3dx_state *state) { IDirect3DDevice9 *device = effect->device; @@ -2704,6 +2760,11 @@ static HRESULT d3dx9_apply_state(struct ID3DXEffectImpl *effect, struct d3dx_pas case SC_NPATCHMODE: TRACE("%s, nsegments %f.\n", state_table[state->operation].name, *(float *)param_value); return IDirect3DDevice9_SetNPatchMode(device, *(float *)param_value); + case SC_SHADERCONST: + TRACE("%s, index %u, op %u.\n", state_table[state->operation].name, state->index, + state_table[state->operation].op); + return d3dx_set_shader_const_state(device, state_table[state->operation].op, state->index, + param, param_value); default: FIXME("%s not handled.\n", state_table[state->operation].name); break; diff --git a/dlls/d3dx9_36/tests/effect.c b/dlls/d3dx9_36/tests/effect.c index 3bcba72..a1be37f 100644 --- a/dlls/d3dx9_36/tests/effect.c +++ b/dlls/d3dx9_36/tests/effect.c @@ -2920,7 +2920,7 @@ static void test_effect_states(IDirect3DDevice9 *device) "Got unexpected light position (%f, %f, %f).\n", light.Position.x, light.Position.y, light.Position.z); hr = IDirect3DDevice9_GetVertexShaderConstantF(device, 3, float_data, 1); ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr); - todo_wine ok(float_data[0] == 2.0f && float_data[1] == 2.0f && float_data[2] == 2.0f && float_data[3] == 2.0f, + ok(float_data[0] == 2.0f && float_data[1] == 2.0f && float_data[2] == 2.0f && float_data[3] == 2.0f, "Got unexpected vertex shader floats: (%f %f %f %f).\n", float_data[0], float_data[1], float_data[2], float_data[3]);
1
0
0
0
Paul Gofman : d3dx9: Implement light and material effect states application.
by Alexandre Julliard
04 Mar '16
04 Mar '16
Module: wine Branch: master Commit: 6df87a66472a0f86c5e61455a584b734d5f368ed URL:
http://source.winehq.org/git/wine.git/?a=commit;h=6df87a66472a0f86c5e61455a…
Author: Paul Gofman <gofmanp(a)gmail.com> Date: Thu Mar 3 15:22:11 2016 +0300 d3dx9: Implement light and material effect states application. 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> --- dlls/d3dx9_36/effect.c | 143 +++++++++++++++++++++++++++++++++++++++++++ dlls/d3dx9_36/tests/effect.c | 8 +-- 2 files changed, 147 insertions(+), 4 deletions(-) diff --git a/dlls/d3dx9_36/effect.c b/dlls/d3dx9_36/effect.c index b14c8bb..bf39ce2 100644 --- a/dlls/d3dx9_36/effect.c +++ b/dlls/d3dx9_36/effect.c @@ -2515,6 +2515,116 @@ static HRESULT d3dx9_get_param_value_ptr(struct ID3DXEffectImpl *effect, struct return E_NOTIMPL; } +static void d3dx9_set_light_parameter(enum LIGHT_TYPE op, D3DLIGHT9 *light, void *value) +{ + static const struct + { + unsigned int offset; + const char *name; + } + light_tbl[] = + { + {FIELD_OFFSET(D3DLIGHT9, Type), "LC_TYPE"}, + {FIELD_OFFSET(D3DLIGHT9, Diffuse), "LT_DIFFUSE"}, + {FIELD_OFFSET(D3DLIGHT9, Specular), "LT_SPECULAR"}, + {FIELD_OFFSET(D3DLIGHT9, Ambient), "LT_AMBIENT"}, + {FIELD_OFFSET(D3DLIGHT9, Position), "LT_POSITION"}, + {FIELD_OFFSET(D3DLIGHT9, Direction), "LT_DIRECTION"}, + {FIELD_OFFSET(D3DLIGHT9, Range), "LT_RANGE"}, + {FIELD_OFFSET(D3DLIGHT9, Falloff), "LT_FALLOFF"}, + {FIELD_OFFSET(D3DLIGHT9, Attenuation0), "LT_ATTENUATION0"}, + {FIELD_OFFSET(D3DLIGHT9, Attenuation1), "LT_ATTENUATION1"}, + {FIELD_OFFSET(D3DLIGHT9, Attenuation2), "LT_ATTENUATION2"}, + {FIELD_OFFSET(D3DLIGHT9, Theta), "LT_THETA"}, + {FIELD_OFFSET(D3DLIGHT9, Phi), "LT_PHI"} + }; + switch (op) + { + case LT_TYPE: + TRACE("LT_TYPE %u.\n", *(D3DLIGHTTYPE *)value); + light->Type = *(D3DLIGHTTYPE *)value; + break; + case LT_DIFFUSE: + case LT_SPECULAR: + case LT_AMBIENT: + { + D3DCOLORVALUE c = *(D3DCOLORVALUE *)value; + + TRACE("%s (%f %f %f %f).\n", light_tbl[op].name, c.r, c.g, c.b, c.a); + *(D3DCOLORVALUE *)((char *)light + light_tbl[op].offset) = c; + break; + } + case LT_POSITION: + case LT_DIRECTION: + { + D3DVECTOR v = *(D3DVECTOR *)value; + + TRACE("%s (%f %f %f).\n", light_tbl[op].name, v.x, v.y, v.z); + *(D3DVECTOR *)((char *)light + light_tbl[op].offset) = v; + break; + } + case LT_RANGE: + case LT_FALLOFF: + case LT_ATTENUATION0: + case LT_ATTENUATION1: + case LT_ATTENUATION2: + case LT_THETA: + case LT_PHI: + { + float v = *(float *)value; + TRACE("%s %f.\n", light_tbl[op].name, v); + *(float *)((char *)light + light_tbl[op].offset) = v; + break; + } + default: + WARN("Unknown light parameter %u.\n", op); + break; + } +} + +static void d3dx9_set_material_parameter(enum MATERIAL_TYPE op, D3DMATERIAL9 *material, void *value) +{ + static const struct + { + unsigned int offset; + const char *name; + } + material_tbl[] = + { + {FIELD_OFFSET(D3DMATERIAL9, Diffuse), "MT_DIFFUSE"}, + {FIELD_OFFSET(D3DMATERIAL9, Ambient), "MT_AMBIENT"}, + {FIELD_OFFSET(D3DMATERIAL9, Specular), "MT_SPECULAR"}, + {FIELD_OFFSET(D3DMATERIAL9, Emissive), "MT_EMISSIVE"}, + {FIELD_OFFSET(D3DMATERIAL9, Power), "MT_POWER"} + }; + + switch (op) + { + case MT_POWER: + { + float v = *(float *)value; + + TRACE("%s %f.\n", material_tbl[op].name, v); + material->Power = v; + break; + } + case MT_DIFFUSE: + case MT_AMBIENT: + case MT_SPECULAR: + case MT_EMISSIVE: + { + D3DCOLORVALUE c = *(D3DCOLORVALUE *)value; + + TRACE("%s, value (%f %f %f %f).\n", material_tbl[op].name, c.r, c.g, c.b, c.a); + *(D3DCOLORVALUE *)((char *)material + material_tbl[op].offset) = c; + break; + } + default: + WARN("Unknown material parameter %u.\n", op); + break; + } +} + static HRESULT d3dx9_apply_state(struct ID3DXEffectImpl *effect, struct d3dx_pass *pass, struct d3dx_state *state) { IDirect3DDevice9 *device = effect->device; @@ -2558,6 +2668,39 @@ static HRESULT d3dx9_apply_state(struct ID3DXEffectImpl *effect, struct d3dx_pas TRACE("%s, state %u.\n", state_table[state->operation].name, state->index); return IDirect3DDevice9_SetTransform(device, state_table[state->operation].op + state->index, (D3DMATRIX *)param_value); + case SC_LIGHTENABLE: + TRACE("%s, index %u, value %u.\n", state_table[state->operation].name, state->index, *(BOOL *)param_value); + return IDirect3DDevice9_LightEnable(device, state->index, *(BOOL *)param_value); + case SC_LIGHT: + { + D3DLIGHT9 light; + + TRACE("%s, index %u, op %u.\n", state_table[state->operation].name, state->index, + state_table[state->operation].op); + hr = IDirect3DDevice9_GetLight(device, state->index, &light); + if (FAILED(hr)) + { + WARN("Could not get light, hr %#x.\n", hr); + memset(&light, 0, sizeof(light)); + } + d3dx9_set_light_parameter(state_table[state->operation].op, &light, param_value); + return IDirect3DDevice9_SetLight(device, state->index, &light); + } + case SC_MATERIAL: + { + D3DMATERIAL9 material; + + TRACE("%s, index %u, op %u.\n", state_table[state->operation].name, state->index, + state_table[state->operation].op); + hr = IDirect3DDevice9_GetMaterial(device, &material); + if (FAILED(hr)) + { + WARN("Could not get material, hr %#x.\n", hr); + memset(&material, 0, sizeof(material)); + } + d3dx9_set_material_parameter(state_table[state->operation].op, &material, param_value); + return IDirect3DDevice9_SetMaterial(device, &material); + } case SC_NPATCHMODE: TRACE("%s, nsegments %f.\n", state_table[state->operation].name, *(float *)param_value); return IDirect3DDevice9_SetNPatchMode(device, *(float *)param_value); diff --git a/dlls/d3dx9_36/tests/effect.c b/dlls/d3dx9_36/tests/effect.c index 81a7d12..3bcba72 100644 --- a/dlls/d3dx9_36/tests/effect.c +++ b/dlls/d3dx9_36/tests/effect.c @@ -2910,11 +2910,11 @@ static void test_effect_states(IDirect3DDevice9 *device) } hr = IDirect3DDevice9_GetLightEnable(device, 2, &bval); - todo_wine ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr); + ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr); if (hr == D3D_OK) ok(bval, "Got result %u, expected TRUE.\n", bval); hr = IDirect3DDevice9_GetLight(device, 2, &light); - todo_wine ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr); + ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr); if (hr == D3D_OK) ok(light.Position.x == 4.0f && light.Position.y == 5.0f && light.Position.z == 6.0f, "Got unexpected light position (%f, %f, %f).\n", light.Position.x, light.Position.y, light.Position.z); @@ -2950,9 +2950,9 @@ static void test_effect_states(IDirect3DDevice9 *device) todo_wine ok(!memcmp(mat.m, test_mat.m, sizeof(mat)), "World matrix not restored.\n"); hr = IDirect3DDevice9_GetLightEnable(device, 2, &bval); - todo_wine ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr); + ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr); if (hr == D3D_OK) - ok(!bval, "Got result %u, expected 0.\n", bval); + todo_wine ok(!bval, "Got result %u, expected 0.\n", bval); if (effect) effect->lpVtbl->Release(effect);
1
0
0
0
Paul Gofman : d3dx9: Implement simple effect states application.
by Alexandre Julliard
04 Mar '16
04 Mar '16
Module: wine Branch: master Commit: 91c5f11537faa6e784635ac9f84dbbda1ea97e04 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=91c5f11537faa6e784635ac9f…
Author: Paul Gofman <gofmanp(a)gmail.com> Date: Thu Mar 3 15:22:10 2016 +0300 d3dx9: Implement simple effect states application. 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> --- dlls/d3dx9_36/effect.c | 115 +++++++++++++++++++++++++++++++++++++++---- dlls/d3dx9_36/tests/effect.c | 16 +++--- 2 files changed, 114 insertions(+), 17 deletions(-) diff --git a/dlls/d3dx9_36/effect.c b/dlls/d3dx9_36/effect.c index f0bbd0b..b14c8bb 100644 --- a/dlls/d3dx9_36/effect.c +++ b/dlls/d3dx9_36/effect.c @@ -2490,6 +2490,106 @@ static HRESULT d3dx9_base_effect_set_array_range(struct d3dx9_base_effect *base, return E_NOTIMPL; } +static HRESULT d3dx9_get_param_value_ptr(struct ID3DXEffectImpl *effect, struct d3dx_pass *pass, + struct d3dx_state *state, void **param_value, struct d3dx_parameter **out_param) +{ + struct d3dx_parameter *param; + param = state->parameter.referenced_param ? state->parameter.referenced_param : &state->parameter; + + switch (state->type) + { + case ST_CONSTANT: + case ST_PARAMETER: + *param_value = param->data; + *out_param = param; + return D3D_OK; + case ST_ARRAY_SELECTOR: + FIXME("Array selector.\n"); + break; + case ST_FXLC: + FIXME("FXLC not supported yet.\n"); + break; + } + *param_value = NULL; + *out_param = NULL; + return E_NOTIMPL; +} + +static HRESULT d3dx9_apply_state(struct ID3DXEffectImpl *effect, struct d3dx_pass *pass, struct d3dx_state *state) +{ + IDirect3DDevice9 *device = effect->device; + struct d3dx_parameter *param; + void *param_value; + HRESULT hr; + + TRACE("operation %u, index %u, type %u.\n", state->operation, state->index, state->type); + hr = d3dx9_get_param_value_ptr(effect, pass, state, ¶m_value, ¶m); + if (FAILED(hr)) + return hr; + + switch (state_table[state->operation].class) + { + case SC_RENDERSTATE: + TRACE("%s, operation %u, value %u.\n", state_table[state->operation].name, + state_table[state->operation].op, *(DWORD *)param_value); + return IDirect3DDevice9_SetRenderState(device, state_table[state->operation].op, *(DWORD *)param_value); + case SC_FVF: + TRACE("%s, value %#x.\n", state_table[state->operation].name, *(DWORD *)param_value); + return IDirect3DDevice9_SetFVF(device, *(DWORD *)param_value); + case SC_TEXTURESTAGE: + TRACE("%s, stage %u, value %u.\n", state_table[state->operation].name, state->index, *(DWORD *)param_value); + return IDirect3DDevice9_SetTextureStageState(device, state->index, + state_table[state->operation].op, *(DWORD *)param_value); + case SC_VERTEXSHADER: + TRACE("%s, shader %p.\n", state_table[state->operation].name, *(IDirect3DVertexShader9 **)param_value); + hr = IDirect3DDevice9_SetVertexShader(device, *(IDirect3DVertexShader9 **)param_value); + if (FAILED(hr)) + ERR("Could not set vertex shader, hr %#x.\n", hr); + FIXME("Not executing preshader and not setting constants.\n"); + return hr; + case SC_PIXELSHADER: + TRACE("%s, shader %p.\n", state_table[state->operation].name, *(IDirect3DPixelShader9 **)param_value); + hr = IDirect3DDevice9_SetPixelShader(device, *(IDirect3DPixelShader9 **)param_value); + if (FAILED(hr)) + ERR("Could not set pixel shader, hr %#x.\n", hr); + FIXME("Not executing preshader and not setting constants.\n"); + return hr; + case SC_TRANSFORM: + TRACE("%s, state %u.\n", state_table[state->operation].name, state->index); + return IDirect3DDevice9_SetTransform(device, state_table[state->operation].op + state->index, + (D3DMATRIX *)param_value); + case SC_NPATCHMODE: + TRACE("%s, nsegments %f.\n", state_table[state->operation].name, *(float *)param_value); + return IDirect3DDevice9_SetNPatchMode(device, *(float *)param_value); + default: + FIXME("%s not handled.\n", state_table[state->operation].name); + break; + } + return D3D_OK; +} + +static HRESULT d3dx9_apply_pass_states(struct ID3DXEffectImpl *effect, struct d3dx_pass *pass) +{ + unsigned int i; + HRESULT ret; + + TRACE("effect %p, pass %p, state_count %u.\n", effect, pass, pass->state_count); + + ret = D3D_OK; + for (i = 0; i < pass->state_count; i++) + { + HRESULT hr; + + hr = d3dx9_apply_state(effect, pass, &pass->states[i]); + if (FAILED(hr)) + { + WARN("Error applying state, hr %#x.\n", hr); + ret = hr; + } + } + return ret; +} + static inline struct ID3DXEffectImpl *impl_from_ID3DXEffect(ID3DXEffect *iface) { return CONTAINING_RECORD(iface, struct ID3DXEffectImpl, ID3DXEffect_iface); @@ -3175,18 +3275,15 @@ static HRESULT WINAPI ID3DXEffectImpl_Begin(ID3DXEffect *iface, UINT *passes, DW static HRESULT WINAPI ID3DXEffectImpl_BeginPass(ID3DXEffect *iface, UINT pass) { - struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface); - struct d3dx_technique *technique = This->active_technique; + struct ID3DXEffectImpl *effect = impl_from_ID3DXEffect(iface); + struct d3dx_technique *technique = effect->active_technique; - TRACE("iface %p, pass %u\n", This, pass); + TRACE("iface %p, pass %u\n", effect, pass); - if (technique && pass < technique->pass_count && !This->active_pass) + if (technique && pass < technique->pass_count && !effect->active_pass) { - This->active_pass = &technique->passes[pass]; - - FIXME("No states applied, yet!\n"); - - return D3D_OK; + effect->active_pass = &technique->passes[pass]; + return d3dx9_apply_pass_states(effect, effect->active_pass); } WARN("Invalid argument supplied.\n"); diff --git a/dlls/d3dx9_36/tests/effect.c b/dlls/d3dx9_36/tests/effect.c index 0cbcb5f..81a7d12 100644 --- a/dlls/d3dx9_36/tests/effect.c +++ b/dlls/d3dx9_36/tests/effect.c @@ -2878,11 +2878,11 @@ static void test_effect_states(IDirect3DDevice9 *device) ok(!memcmp(mat.m, test_mat.m, sizeof(mat)), "World matrix does not match.\n"); hr = effect->lpVtbl->BeginPass(effect, 0); - ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr); + todo_wine ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr); hr = IDirect3DDevice9_GetTransform(device, D3DTS_WORLDMATRIX(1), &mat); ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr); - todo_wine ok(!memcmp(mat.m, test_mat_world1.m, sizeof(mat)), "World matrix does not match.\n"); + ok(!memcmp(mat.m, test_mat_world1.m, sizeof(mat)), "World matrix does not match.\n"); hr = IDirect3DDevice9_GetTransform(device, D3DTS_VIEW, &mat); ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr); @@ -2890,11 +2890,11 @@ static void test_effect_states(IDirect3DDevice9 *device) hr = IDirect3DDevice9_GetRenderState(device, D3DRS_BLENDOP, &value); ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr); - todo_wine ok(value == 2, "Got result %u, expected %u\n", value, 2); + ok(value == 2, "Got result %u, expected %u\n", value, 2); hr = IDirect3DDevice9_GetVertexShader(device, &vshader); ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr); - todo_wine ok(vshader != NULL, "Got NULL vshader.\n"); + ok(vshader != NULL, "Got NULL vshader.\n"); if (vshader) { hr = IDirect3DVertexShader9_GetFunction(vshader, NULL, &byte_code_size); @@ -2928,11 +2928,11 @@ static void test_effect_states(IDirect3DDevice9 *device) ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr); hr = IDirect3DDevice9_GetRenderState(device, D3DRS_BLENDOP, &value); ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr); - todo_wine ok(value == 2, "Got result %u, expected %u\n", value, 2); + ok(value == 2, "Got result %u, expected %u\n", value, 2); hr = IDirect3DDevice9_GetRenderState(device, D3DRS_ZENABLE, &value); ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr); - todo_wine ok(value, "Got result %u, expected TRUE.\n", value); + ok(value, "Got result %u, expected TRUE.\n", value); hr = IDirect3DDevice9_GetSamplerState(device, 1, D3DSAMP_MIPFILTER, &value); ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr); @@ -2940,14 +2940,14 @@ static void test_effect_states(IDirect3DDevice9 *device) hr = IDirect3DDevice9_GetTextureStageState(device, 3, D3DTSS_ALPHAOP, &value); ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr); - todo_wine ok(value == 4, "Unexpected texture stage 3 AlphaOp %u.\n", value); + ok(value == 4, "Unexpected texture stage 3 AlphaOp %u.\n", value); hr = effect->lpVtbl->End(effect); ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr); hr = IDirect3DDevice9_GetTransform(device, D3DTS_WORLDMATRIX(1), &mat); ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr); - ok(!memcmp(mat.m, test_mat.m, sizeof(mat)), "World matrix not restored.\n"); + todo_wine ok(!memcmp(mat.m, test_mat.m, sizeof(mat)), "World matrix not restored.\n"); hr = IDirect3DDevice9_GetLightEnable(device, 2, &bval); todo_wine ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
1
0
0
0
← Newer
1
...
58
59
60
61
62
63
64
...
73
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
Results per page:
10
25
50
100
200