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
February 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
672 discussions
Start a n
N
ew thread
Zebediah Figura : wined3d: Factor out init_default_sampler_states().
by Alexandre Julliard
05 Feb '19
05 Feb '19
Module: wine Branch: master Commit: ac021bd39fe22ed762048eec8db10ce1b17a1471 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=ac021bd39fe22ed762048eec…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Tue Feb 5 11:08:55 2019 -0600 wined3d: Factor out init_default_sampler_states(). Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wined3d/stateblock.c | 45 ++++++++++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index 121fcf9..458e8b3 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -1340,6 +1340,31 @@ static void init_default_texture_state(unsigned int i, DWORD stage[WINED3D_HIGHE stage[WINED3D_TSS_RESULT_ARG] = WINED3DTA_CURRENT; } +static void init_default_sampler_states(DWORD states[MAX_COMBINED_SAMPLERS][WINED3D_HIGHEST_SAMPLER_STATE + 1]) +{ + unsigned int i; + + for (i = 0 ; i < MAX_COMBINED_SAMPLERS; ++i) + { + TRACE("Setting up default samplers states for sampler %u.\n", i); + states[i][WINED3D_SAMP_ADDRESS_U] = WINED3D_TADDRESS_WRAP; + states[i][WINED3D_SAMP_ADDRESS_V] = WINED3D_TADDRESS_WRAP; + states[i][WINED3D_SAMP_ADDRESS_W] = WINED3D_TADDRESS_WRAP; + states[i][WINED3D_SAMP_BORDER_COLOR] = 0; + states[i][WINED3D_SAMP_MAG_FILTER] = WINED3D_TEXF_POINT; + states[i][WINED3D_SAMP_MIN_FILTER] = WINED3D_TEXF_POINT; + states[i][WINED3D_SAMP_MIP_FILTER] = WINED3D_TEXF_NONE; + states[i][WINED3D_SAMP_MIPMAP_LOD_BIAS] = 0; + states[i][WINED3D_SAMP_MAX_MIP_LEVEL] = 0; + states[i][WINED3D_SAMP_MAX_ANISOTROPY] = 1; + states[i][WINED3D_SAMP_SRGB_TEXTURE] = 0; + /* TODO: Indicates which element of a multielement texture to use. */ + states[i][WINED3D_SAMP_ELEMENT_INDEX] = 0; + /* TODO: Vertex offset in the presampled displacement map. */ + states[i][WINED3D_SAMP_DMAP_OFFSET] = 0; + } +} + static void state_init_default(struct wined3d_state *state, const struct wined3d_d3d_info *d3d_info) { unsigned int i; @@ -1369,25 +1394,7 @@ static void state_init_default(struct wined3d_state *state, const struct wined3d init_default_texture_state(i, state->texture_states[i]); } - for (i = 0 ; i < MAX_COMBINED_SAMPLERS; ++i) - { - TRACE("Setting up default samplers states for sampler %u.\n", i); - state->sampler_states[i][WINED3D_SAMP_ADDRESS_U] = WINED3D_TADDRESS_WRAP; - state->sampler_states[i][WINED3D_SAMP_ADDRESS_V] = WINED3D_TADDRESS_WRAP; - state->sampler_states[i][WINED3D_SAMP_ADDRESS_W] = WINED3D_TADDRESS_WRAP; - state->sampler_states[i][WINED3D_SAMP_BORDER_COLOR] = 0; - state->sampler_states[i][WINED3D_SAMP_MAG_FILTER] = WINED3D_TEXF_POINT; - state->sampler_states[i][WINED3D_SAMP_MIN_FILTER] = WINED3D_TEXF_POINT; - state->sampler_states[i][WINED3D_SAMP_MIP_FILTER] = WINED3D_TEXF_NONE; - state->sampler_states[i][WINED3D_SAMP_MIPMAP_LOD_BIAS] = 0; - state->sampler_states[i][WINED3D_SAMP_MAX_MIP_LEVEL] = 0; - state->sampler_states[i][WINED3D_SAMP_MAX_ANISOTROPY] = 1; - state->sampler_states[i][WINED3D_SAMP_SRGB_TEXTURE] = 0; - /* TODO: Indicates which element of a multielement texture to use. */ - state->sampler_states[i][WINED3D_SAMP_ELEMENT_INDEX] = 0; - /* TODO: Vertex offset in the presampled displacement map. */ - state->sampler_states[i][WINED3D_SAMP_DMAP_OFFSET] = 0; - } + init_default_sampler_states(state->sampler_states); state->blend_factor.r = 1.0f; state->blend_factor.g = 1.0f;
1
0
0
0
Zebediah Figura : wined3d: Store textures in the wined3d_stateblock_state structure.
by Alexandre Julliard
05 Feb '19
05 Feb '19
Module: wine Branch: master Commit: 63fab710f21c29156c64eb9407f2df25ac6fe581 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=63fab710f21c29156c64eb94…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Tue Feb 5 11:08:54 2019 -0600 wined3d: Store textures in the wined3d_stateblock_state structure. Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wined3d/device.c | 20 ++++++++++++++------ dlls/wined3d/stateblock.c | 30 +++++++++++++++++++++++------- dlls/wined3d/wined3d_private.h | 1 + 3 files changed, 38 insertions(+), 13 deletions(-) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index b7929bd..add8854 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -3500,10 +3500,19 @@ HRESULT CDECL wined3d_device_set_texture(struct wined3d_device *device, return WINED3D_OK; } + if (texture) + wined3d_texture_incref(texture); + if (device->update_stateblock_state->textures[stage]) + wined3d_texture_decref(device->update_stateblock_state->textures[stage]); + device->update_stateblock_state->textures[stage] = texture; + if (device->recording) + { device->recording->changed.textures |= 1u << stage; + return WINED3D_OK; + } - prev = device->update_state->textures[stage]; + prev = device->state.textures[stage]; TRACE("Previous texture %p.\n", prev); if (texture == prev) @@ -3513,12 +3522,11 @@ HRESULT CDECL wined3d_device_set_texture(struct wined3d_device *device, } TRACE("Setting new texture to %p.\n", texture); - device->update_state->textures[stage] = texture; + device->state.textures[stage] = texture; if (texture) wined3d_texture_incref(texture); - if (!device->recording) - wined3d_cs_emit_set_texture(device->cs, stage, texture); + wined3d_cs_emit_set_texture(device->cs, stage, texture); if (prev) wined3d_texture_decref(prev); @@ -5182,11 +5190,11 @@ void device_resource_released(struct wined3d_device *device, struct wined3d_reso device->state.textures[i] = NULL; } - if (device->recording && &device->update_state->textures[i]->resource == resource) + if (device->recording && &device->update_stateblock_state->textures[i]->resource == resource) { ERR("Texture resource %p is still in use by recording stateblock %p, stage %u.\n", resource, device->recording, i); - device->update_state->textures[i] = NULL; + device->update_stateblock_state->textures[i] = NULL; } } break; diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index 61de764..121fcf9 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -523,7 +523,9 @@ void state_unbind_resources(struct wined3d_state *state) void wined3d_stateblock_state_cleanup(struct wined3d_stateblock_state *state) { + struct wined3d_texture *texture; struct wined3d_shader *shader; + unsigned int i; if ((shader = state->vs)) { @@ -536,6 +538,15 @@ void wined3d_stateblock_state_cleanup(struct wined3d_stateblock_state *state) state->ps = NULL; wined3d_shader_decref(shader); } + + for (i = 0; i < MAX_COMBINED_SAMPLERS; ++i) + { + if ((texture = state->textures[i])) + { + state->textures[i] = NULL; + wined3d_texture_decref(texture); + } + } } void state_cleanup(struct wined3d_state *state) @@ -941,13 +952,13 @@ void CDECL wined3d_stateblock_capture(struct wined3d_stateblock *stateblock) if (!(map & 1)) continue; TRACE("Updating texture %u to %p (was %p).\n", - i, src_state->textures[i], stateblock->state.textures[i]); + i, state->textures[i], stateblock->stateblock_state.textures[i]); - if (src_state->textures[i]) - wined3d_texture_incref(src_state->textures[i]); - if (stateblock->state.textures[i]) - wined3d_texture_decref(stateblock->state.textures[i]); - stateblock->state.textures[i] = src_state->textures[i]; + if (state->textures[i]) + wined3d_texture_incref(state->textures[i]); + if (stateblock->stateblock_state.textures[i]) + wined3d_texture_decref(stateblock->stateblock_state.textures[i]); + stateblock->stateblock_state.textures[i] = state->textures[i]; } for (i = 0; i < stateblock->num_contained_sampler_states; ++i) @@ -1149,7 +1160,12 @@ void CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblock) if (!(map & 1)) continue; stage = i < MAX_FRAGMENT_SAMPLERS ? i : WINED3DVERTEXTEXTURESAMPLER0 + i - MAX_FRAGMENT_SAMPLERS; - wined3d_device_set_texture(device, stage, stateblock->state.textures[i]); + if (stateblock->stateblock_state.textures[i]) + wined3d_texture_incref(stateblock->stateblock_state.textures[i]); + if (state->textures[i]) + wined3d_texture_decref(state->textures[i]); + state->textures[i] = stateblock->stateblock_state.textures[i]; + wined3d_device_set_texture(device, stage, stateblock->stateblock_state.textures[i]); } map = stateblock->changed.clipplane; diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 8d89087..84918393 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2982,6 +2982,7 @@ struct wined3d_stateblock_state DWORD rs[WINEHIGHEST_RENDER_STATE + 1]; + struct wined3d_texture *textures[MAX_COMBINED_SAMPLERS]; DWORD texture_states[MAX_TEXTURES][WINED3D_HIGHEST_TEXTURE_STATE + 1]; };
1
0
0
0
Zebediah Figura : wined3d: Store texture states in the wined3d_stateblock_state structure.
by Alexandre Julliard
05 Feb '19
05 Feb '19
Module: wine Branch: master Commit: dfc7807cfecfbec35e15ea49851ee9ccae46b950 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=dfc7807cfecfbec35e15ea49…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Tue Feb 5 11:08:53 2019 -0600 wined3d: Store texture states in the wined3d_stateblock_state structure. Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wined3d/device.c | 9 ++++----- dlls/wined3d/stateblock.c | 22 ++++++++++++++++------ dlls/wined3d/wined3d_private.h | 2 ++ 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 2b0b38d..b7929bd 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -3431,7 +3431,6 @@ void CDECL wined3d_device_set_texture_stage_state(struct wined3d_device *device, UINT stage, enum wined3d_texture_stage_state state, DWORD value) { const struct wined3d_d3d_info *d3d_info = &device->adapter->d3d_info; - DWORD old_value; TRACE("device %p, stage %u, state %s, value %#x.\n", device, stage, debug_d3dtexturestate(state), value); @@ -3449,8 +3448,7 @@ void CDECL wined3d_device_set_texture_stage_state(struct wined3d_device *device, return; } - old_value = device->update_state->texture_states[stage][state]; - device->update_state->texture_states[stage][state] = value; + device->update_stateblock_state->texture_states[stage][state] = value; if (device->recording) { @@ -3459,13 +3457,14 @@ void CDECL wined3d_device_set_texture_stage_state(struct wined3d_device *device, return; } - /* Checked after the assignments to allow proper stateblock recording. */ - if (old_value == value) + if (value == device->state.texture_states[stage][state]) { TRACE("Application is setting the old value over, nothing to do.\n"); return; } + device->state.texture_states[stage][state] = value; + wined3d_cs_emit_set_texture_state(device->cs, stage, state, value); } diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index 8117652..61de764 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -925,12 +925,13 @@ void CDECL wined3d_stateblock_capture(struct wined3d_stateblock *stateblock) for (i = 0; i < stateblock->num_contained_tss_states; ++i) { DWORD stage = stateblock->contained_tss_states[i].stage; - DWORD state = stateblock->contained_tss_states[i].state; + DWORD texture_state = stateblock->contained_tss_states[i].state; - TRACE("Updating texturestage state %u, %u to %#x (was %#x).\n", stage, state, - src_state->texture_states[stage][state], stateblock->state.texture_states[stage][state]); + TRACE("Updating texturestage state %u, %u to %#x (was %#x).\n", stage, texture_state, + state->texture_states[stage][texture_state], + stateblock->stateblock_state.texture_states[stage][texture_state]); - stateblock->state.texture_states[stage][state] = src_state->texture_states[stage][state]; + stateblock->stateblock_state.texture_states[stage][texture_state] = state->texture_states[stage][texture_state]; } /* Samplers */ @@ -1075,9 +1076,11 @@ void CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblock) for (i = 0; i < stateblock->num_contained_tss_states; ++i) { DWORD stage = stateblock->contained_tss_states[i].stage; - DWORD state = stateblock->contained_tss_states[i].state; + DWORD texture_state = stateblock->contained_tss_states[i].state; - wined3d_device_set_texture_stage_state(device, stage, state, stateblock->state.texture_states[stage][state]); + state->texture_states[stage][texture_state] = stateblock->stateblock_state.texture_states[stage][texture_state]; + wined3d_device_set_texture_stage_state(device, stage, texture_state, + stateblock->stateblock_state.texture_states[stage][texture_state]); } /* Sampler states. */ @@ -1396,7 +1399,14 @@ void state_init(struct wined3d_state *state, struct wined3d_fb_state *fb, static void stateblock_state_init_default(struct wined3d_stateblock_state *state, const struct wined3d_d3d_info *d3d_info) { + unsigned int i; + init_default_render_states(state->rs, d3d_info); + + for (i = 0; i < MAX_TEXTURES; ++i) + { + init_default_texture_state(i, state->texture_states[i]); + } } void wined3d_stateblock_state_init(struct wined3d_stateblock_state *state, diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index e34d80f..8d89087 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2981,6 +2981,8 @@ struct wined3d_stateblock_state BOOL ps_consts_b[WINED3D_MAX_CONSTS_B]; DWORD rs[WINEHIGHEST_RENDER_STATE + 1]; + + DWORD texture_states[MAX_TEXTURES][WINED3D_HIGHEST_TEXTURE_STATE + 1]; }; struct wined3d_device
1
0
0
0
Paul Gofman : d3d9/tests: Add test for bigger alpha reference values.
by Alexandre Julliard
05 Feb '19
05 Feb '19
Module: wine Branch: master Commit: ba4dfabed0ae7171b2d92568641bf1beeb6b26cf URL:
https://source.winehq.org/git/wine.git/?a=commit;h=ba4dfabed0ae7171b2d92568…
Author: Paul Gofman <gofmanp(a)gmail.com> Date: Tue Feb 5 18:57:26 2019 +0300 d3d9/tests: Add test for bigger alpha reference values. 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> --- dlls/d3d9/tests/visual.c | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c index c06acb7..2efd08f 100644 --- a/dlls/d3d9/tests/visual.c +++ b/dlls/d3d9/tests/visual.c @@ -13607,6 +13607,7 @@ static void alphatest_test(void) D3DCOLOR color; ULONG refcount; D3DCAPS9 caps; + DWORD value; HWND window; HRESULT hr; @@ -13738,10 +13739,32 @@ static void alphatest_test(void) hr = IDirect3DDevice9_EndScene(device); ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr); color = getPixelColor(device, 320, 240); - ok(color_match(color, testdata[i].color_greater, 1), "Alphatest failed. Got color 0x%08x, expected 0x%08x. alpha > ref, func %u\n", - color, testdata[i].color_greater, testdata[i].func); + ok(color_match(color, testdata[i].color_greater, 1), + "Alphatest failed, color 0x%08x, expected 0x%08x, alpha > ref, func %u.\n", + color, testdata[i].color_greater, testdata[i].func); hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL); - ok(SUCCEEDED(hr), "IDirect3DDevice9_Present failed with 0x%08x\n", hr); + ok(hr == D3D_OK, "IDirect3DDevice9_Present failed, hr %#x.\n", hr); + + hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, ALPHATEST_FAILED, 0.0f, 0); + ok(hr == D3D_OK, "IDirect3DDevice9_Clear failed, hr %#x.\n", hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_ALPHAREF, 0xff70); + ok(hr == D3D_OK, "IDirect3DDevice9_SetRenderState failed, hr %#x.\n", hr); + hr = IDirect3DDevice9_GetRenderState(device, D3DRS_ALPHAREF, &value); + ok(hr == D3D_OK, "IDirect3DDevice9_GetRenderState failed, hr %#x.\n", hr); + ok(value == 0xff70, "Unexpected D3DRS_ALPHAREF value %#x.\n", value); + hr = IDirect3DDevice9_BeginScene(device); + ok(hr == D3D_OK, "IDirect3DDevice9_BeginScene failed, hr %#x.\n", hr); + hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, quad, sizeof(*quad)); + ok(hr == D3D_OK, "IDirect3DDevice9_DrawPrimitiveUP failed, hr %#x.\n", hr); + hr = IDirect3DDevice9_EndScene(device); + ok(hr == D3D_OK, "IDirect3DDevice9_EndScene failed, hr %#x.\n", hr); + color = getPixelColor(device, 320, 240); + ok(color_match(color, testdata[i].color_greater, 1), + "Alphatest failed, color 0x%08x, expected 0x%08x, alpha > ref, func %u.\n", + color, testdata[i].color_greater, testdata[i].func); + hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL); + ok(hr == D3D_OK, "IDirect3DDevice9_Present failed, hr %#x.\n", hr); + } }
1
0
0
0
Paul Gofman : wined3d: Use lower 8 bits only from _ALPHAREF state.
by Alexandre Julliard
05 Feb '19
05 Feb '19
Module: wine Branch: master Commit: 6963fd0bef5f0a1112c6a11a03d1d046972b2cdb URL:
https://source.winehq.org/git/wine.git/?a=commit;h=6963fd0bef5f0a1112c6a11a…
Author: Paul Gofman <gofmanp(a)gmail.com> Date: Tue Feb 5 18:57:25 2019 +0300 wined3d: Use lower 8 bits only from _ALPHAREF state. Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=38138
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> --- dlls/wined3d/arb_program_shader.c | 2 +- dlls/wined3d/glsl_shader.c | 4 ++-- dlls/wined3d/state.c | 2 +- dlls/wined3d/wined3d_private.h | 5 +++++ 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c index 4dafb34..37ec7e9 100644 --- a/dlls/wined3d/arb_program_shader.c +++ b/dlls/wined3d/arb_program_shader.c @@ -5945,7 +5945,7 @@ static void alpha_test_arbfp(struct wined3d_context *context, const struct wined return; } - ref = ((float)state->render_states[WINED3D_RS_ALPHAREF]) / 255.0f; + ref = wined3d_alpha_ref(state); glParm = wined3d_gl_compare_func(state->render_states[WINED3D_RS_ALPHAFUNC]); if (glParm) diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index 3298a60..db6760e 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -2032,7 +2032,7 @@ static void shader_glsl_load_constants(void *shader_priv, struct wined3d_context if (update_mask & WINED3D_SHADER_CONST_PS_ALPHA_TEST) { - float ref = state->render_states[WINED3D_RS_ALPHAREF] / 255.0f; + float ref = wined3d_alpha_ref(state); GL_EXTCALL(glUniform1f(prog->ps.alpha_test_ref_location, ref)); checkGLcall("alpha test emulation uniform"); @@ -12308,7 +12308,7 @@ static void glsl_fragment_pipe_alpha_test_func(struct wined3d_context *context, { const struct wined3d_gl_info *gl_info = context->gl_info; GLint func = wined3d_gl_compare_func(state->render_states[WINED3D_RS_ALPHAFUNC]); - float ref = state->render_states[WINED3D_RS_ALPHAREF] / 255.0f; + float ref = wined3d_alpha_ref(state); if (func) { diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c index 8708aa09..1b5eacd 100644 --- a/dlls/wined3d/state.c +++ b/dlls/wined3d/state.c @@ -681,7 +681,7 @@ void state_alpha_test(struct wined3d_context *context, const struct wined3d_stat } else { - ref = ((float)state->render_states[WINED3D_RS_ALPHAREF]) / 255.0f; + ref = wined3d_alpha_ref(state); glParm = wined3d_gl_compare_func(state->render_states[WINED3D_RS_ALPHAFUNC]); } if (glParm) diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 1e3ec28..e34d80f 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -3100,6 +3100,11 @@ static inline BOOL isStateDirty(const struct wined3d_context *context, DWORD sta return context->isStateDirty[idx] & (1u << shift); } +static inline float wined3d_alpha_ref(const struct wined3d_state *state) +{ + return (state->render_states[WINED3D_RS_ALPHAREF] & 0xff) / 255.0f; +} + const char *wined3d_debug_resource_access(DWORD access) DECLSPEC_HIDDEN; const char *wined3d_debug_bind_flags(DWORD bind_flags) DECLSPEC_HIDDEN; const char *wined3d_debug_view_desc(const struct wined3d_view_desc *d,
1
0
0
0
Zebediah Figura : wined3d: Set the correct matrix in wined3d_device_multiply_transform().
by Alexandre Julliard
05 Feb '19
05 Feb '19
Module: wine Branch: master Commit: f2578fc1b1d54b26185813cd1fe94f5b2804c5d3 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=f2578fc1b1d54b26185813cd…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Sat Feb 2 10:28:40 2019 -0600 wined3d: Set the correct matrix in wined3d_device_multiply_transform(). Fixes a regression introduced by 7163fbba85b0f27f5bedb22291a6f53d2b507cdd. Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=46565
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wined3d/device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index dee99dc..2b0b38d 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -1544,7 +1544,7 @@ void CDECL wined3d_device_multiply_transform(struct wined3d_device *device, * into the primary stateblock. */ mat = &device->state.transforms[state]; multiply_matrix(mat, mat, matrix); - wined3d_cs_emit_set_transform(device->cs, state, matrix); + wined3d_cs_emit_set_transform(device->cs, state, mat); } /* Note lights are real special cases. Although the device caps state only
1
0
0
0
Matteo Bruni : ddraw: Refuse to create non-managed DDSCAPS_WRITEONLY surfaces.
by Alexandre Julliard
05 Feb '19
05 Feb '19
Module: wine Branch: master Commit: 019ec46602c42c21e45309c10b3dc6c737e14763 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=019ec46602c42c21e45309c1…
Author: Matteo Bruni <mbruni(a)codeweavers.com> Date: Fri Feb 1 12:59:30 2019 +0100 ddraw: Refuse to create non-managed DDSCAPS_WRITEONLY surfaces. Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ddraw/surface.c | 10 +++++++++- dlls/ddraw/tests/ddraw4.c | 22 +++++++++++++++++----- dlls/ddraw/tests/ddraw7.c | 24 +++++++++++++++++++----- 3 files changed, 45 insertions(+), 11 deletions(-) diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c index 14aa5ab..2b788bd 100644 --- a/dlls/ddraw/surface.c +++ b/dlls/ddraw/surface.c @@ -5983,13 +5983,21 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_ } if (desc->ddsCaps.dwCaps & (DDSCAPS_VIDEOMEMORY | DDSCAPS_SYSTEMMEMORY)) { - WARN("DDSCAPS2_TEXTUREMANAGE used width DDSCAPS_VIDEOMEMORY " + WARN("DDSCAPS2_TEXTUREMANAGE used with DDSCAPS_VIDEOMEMORY " "or DDSCAPS_SYSTEMMEMORY, returning DDERR_INVALIDCAPS.\n"); heap_free(texture); return DDERR_INVALIDCAPS; } } + if (desc->ddsCaps.dwCaps & DDSCAPS_WRITEONLY + && !(desc->ddsCaps.dwCaps2 & (DDSCAPS2_TEXTUREMANAGE | DDSCAPS2_D3DTEXTUREMANAGE))) + { + WARN("DDSCAPS_WRITEONLY used without DDSCAPS2_TEXTUREMANAGE, returning DDERR_INVALIDCAPS.\n"); + heap_free(texture); + return DDERR_INVALIDCAPS; + } + if (FAILED(hr = wined3d_get_adapter_display_mode(ddraw->wined3d, WINED3DADAPTER_DEFAULT, &mode, NULL))) { ERR("Failed to get display mode, hr %#x.\n", hr); diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index ad40214..bb4d63a 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -11154,15 +11154,22 @@ static void test_lockrect_invalid(void) { DWORD caps, caps2; const char *name; + BOOL allowed; HRESULT hr; } resources[] = { - {DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY, 0, "sysmem offscreenplain", DDERR_INVALIDPARAMS}, - {DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY, 0, "vidmem offscreenplain", DDERR_INVALIDPARAMS}, - {DDSCAPS_TEXTURE | DDSCAPS_SYSTEMMEMORY, 0, "sysmem texture", DDERR_INVALIDPARAMS}, - {DDSCAPS_TEXTURE | DDSCAPS_VIDEOMEMORY, 0, "vidmem texture", DDERR_INVALIDPARAMS}, - {DDSCAPS_TEXTURE, DDSCAPS2_TEXTUREMANAGE, "managed texture", DDERR_INVALIDPARAMS}, + {DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY, 0, "sysmem offscreenplain", TRUE, DDERR_INVALIDPARAMS}, + {DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY, 0, "vidmem offscreenplain", TRUE, DDERR_INVALIDPARAMS}, + {DDSCAPS_TEXTURE | DDSCAPS_SYSTEMMEMORY, 0, "sysmem texture", TRUE, DDERR_INVALIDPARAMS}, + {DDSCAPS_TEXTURE | DDSCAPS_VIDEOMEMORY, 0, "vidmem texture", TRUE, DDERR_INVALIDPARAMS}, + {DDSCAPS_TEXTURE, DDSCAPS2_TEXTUREMANAGE, "managed texture", TRUE, DDERR_INVALIDPARAMS}, + + {DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY | DDSCAPS_WRITEONLY, 0, "sysmem offscreenplain writeonly", FALSE, DDERR_INVALIDPARAMS}, + {DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_WRITEONLY, 0, "vidmem offscreenplain writeonly", FALSE, DDERR_INVALIDPARAMS}, + {DDSCAPS_TEXTURE | DDSCAPS_SYSTEMMEMORY | DDSCAPS_WRITEONLY, 0, "sysmem texture writeonly", FALSE, DDERR_INVALIDPARAMS}, + {DDSCAPS_TEXTURE | DDSCAPS_VIDEOMEMORY | DDSCAPS_WRITEONLY, 0, "vidmem texture writeonly", FALSE, DDERR_INVALIDPARAMS}, + {DDSCAPS_TEXTURE | DDSCAPS_WRITEONLY, DDSCAPS2_TEXTUREMANAGE, "managed texture writeonly", TRUE, DDERR_INVALIDPARAMS}, }; window = create_window(); @@ -11199,6 +11206,11 @@ static void test_lockrect_invalid(void) U4(U4(surface_desc).ddpfPixelFormat).dwBBitMask = 0x0000ff; hr = IDirectDraw4_CreateSurface(ddraw, &surface_desc, &surface, NULL); + if (!resources[r].allowed) + { + ok(hr == DDERR_INVALIDCAPS, "Got unexpected hr %#x, type %s.\n", hr, resources[r].name); + continue; + } ok(SUCCEEDED(hr), "Failed to create surface, hr %#x, type %s.\n", hr, resources[r].name); hr = IDirectDrawSurface4_Lock(surface, NULL, NULL, DDLOCK_WAIT, NULL); diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index d13e238..a063791 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -11054,15 +11054,24 @@ static void test_lockrect_invalid(void) { DWORD caps, caps2; const char *name; + BOOL allowed; HRESULT hr; } resources[] = { - {DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY, 0, "sysmem offscreenplain", DDERR_INVALIDPARAMS}, - {DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY, 0, "vidmem offscreenplain", DDERR_INVALIDPARAMS}, - {DDSCAPS_TEXTURE | DDSCAPS_SYSTEMMEMORY, 0, "sysmem texture", DD_OK}, - {DDSCAPS_TEXTURE | DDSCAPS_VIDEOMEMORY, 0, "vidmem texture", DDERR_INVALIDPARAMS}, - {DDSCAPS_TEXTURE, DDSCAPS2_TEXTUREMANAGE, "managed texture", DD_OK}, + {DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY, 0, "sysmem offscreenplain", TRUE, DDERR_INVALIDPARAMS}, + {DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY, 0, "vidmem offscreenplain", TRUE, DDERR_INVALIDPARAMS}, + {DDSCAPS_TEXTURE | DDSCAPS_SYSTEMMEMORY, 0, "sysmem texture", TRUE, DD_OK}, + {DDSCAPS_TEXTURE | DDSCAPS_VIDEOMEMORY, 0, "vidmem texture", TRUE, DDERR_INVALIDPARAMS}, + {DDSCAPS_TEXTURE, DDSCAPS2_TEXTUREMANAGE, "managed texture", TRUE, DD_OK}, + + /* FWIW the SDK header mentions DDSCAPS_WRITEONLY as being a "READ + * ONLY" flag. */ + {DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY | DDSCAPS_WRITEONLY, 0, "sysmem offscreenplain writeonly", FALSE, DDERR_INVALIDPARAMS}, + {DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_WRITEONLY, 0, "vidmem offscreenplain writeonly", FALSE, DDERR_INVALIDPARAMS}, + {DDSCAPS_TEXTURE | DDSCAPS_SYSTEMMEMORY | DDSCAPS_WRITEONLY, 0, "sysmem texture writeonly", FALSE, DD_OK}, + {DDSCAPS_TEXTURE | DDSCAPS_VIDEOMEMORY | DDSCAPS_WRITEONLY, 0, "vidmem texture writeonly", FALSE, DDERR_INVALIDPARAMS}, + {DDSCAPS_TEXTURE | DDSCAPS_WRITEONLY, DDSCAPS2_TEXTUREMANAGE, "managed texture writeonly", TRUE, DD_OK}, }; window = create_window(); @@ -11099,6 +11108,11 @@ static void test_lockrect_invalid(void) U4(U4(surface_desc).ddpfPixelFormat).dwBBitMask = 0x0000ff; hr = IDirectDraw7_CreateSurface(ddraw, &surface_desc, &surface, NULL); + if (!resources[r].allowed) + { + ok(hr == DDERR_INVALIDCAPS, "Got unexpected hr %#x, type %s.\n", hr, resources[r].name); + continue; + } if (is_ddraw64 && (resources[r].caps & DDSCAPS_TEXTURE)) { todo_wine ok(hr == E_NOINTERFACE, "Got unexpected hr %#x, type %s.\n", hr, resources[r].name);
1
0
0
0
Matteo Bruni : d3d8: Refuse to create D3DUSAGE_WRITEONLY textures.
by Alexandre Julliard
05 Feb '19
05 Feb '19
Module: wine Branch: master Commit: 4e3ce8c1f0cfb18b2c9e09d4f22c32ec7de9314b URL:
https://source.winehq.org/git/wine.git/?a=commit;h=4e3ce8c1f0cfb18b2c9e09d4…
Author: Matteo Bruni <mbruni(a)codeweavers.com> Date: Fri Feb 1 12:59:29 2019 +0100 d3d8: Refuse to create D3DUSAGE_WRITEONLY textures. Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/d3d8/tests/device.c | 15 +++++++++++++++ dlls/d3d8/texture.c | 18 ++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c index 884cdb1..ac04a6a 100644 --- a/dlls/d3d8/tests/device.c +++ b/dlls/d3d8/tests/device.c @@ -5163,6 +5163,11 @@ static void test_lockrect_invalid(void) ok(SUCCEEDED(hr), "Failed to unlock texture, hr %#x, type %s.\n", hr, resources[r].name); IDirect3DTexture8_Release(texture); + + hr = IDirect3DDevice8_CreateTexture(device, 128, 128, 1, D3DUSAGE_WRITEONLY, + D3DFMT_A8R8G8B8, resources[r].pool, &texture); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x for type %s.\n", + hr, resources[r].name); } if (cube_texture) @@ -5203,6 +5208,11 @@ static void test_lockrect_invalid(void) ok(SUCCEEDED(hr), "Failed to unlock texture, hr %#x, type %s.\n", hr, resources[r].name); IDirect3DTexture8_Release(cube_texture); + + hr = IDirect3DDevice8_CreateCubeTexture(device, 128, 1, D3DUSAGE_WRITEONLY, D3DFMT_A8R8G8B8, + resources[r].pool, &cube_texture); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x for type %s.\n", + hr, resources[r].name); } } @@ -6949,6 +6959,11 @@ static void test_lockbox_invalid(void) ok(SUCCEEDED(hr), "Failed to unlock volume texture, hr %#x.\n", hr); IDirect3DVolumeTexture8_Release(texture); + + hr = IDirect3DDevice8_CreateVolumeTexture(device, 4, 4, 2, 1, D3DUSAGE_WRITEONLY, + D3DFMT_A8R8G8B8, D3DPOOL_SCRATCH, &texture); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr); + refcount = IDirect3DDevice8_Release(device); ok(!refcount, "Device has %u references left.\n", refcount); IDirect3D8_Release(d3d); diff --git a/dlls/d3d8/texture.c b/dlls/d3d8/texture.c index 6f17e9d..5ca6921 100644 --- a/dlls/d3d8/texture.c +++ b/dlls/d3d8/texture.c @@ -1117,6 +1117,12 @@ HRESULT texture_init(struct d3d8_texture *texture, struct d3d8_device *device, desc.depth = 1; desc.size = 0; + if (usage & D3DUSAGE_WRITEONLY) + { + WARN("Texture can't be created with the D3DUSAGE_WRITEONLY flag, returning D3DERR_INVALIDCALL.\n"); + return D3DERR_INVALIDCALL; + } + if (!levels) levels = wined3d_log2i(max(width, height)) + 1; @@ -1162,6 +1168,12 @@ HRESULT cubetexture_init(struct d3d8_texture *texture, struct d3d8_device *devic desc.depth = 1; desc.size = 0; + if (usage & D3DUSAGE_WRITEONLY) + { + WARN("Texture can't be created with the D3DUSAGE_WRITEONLY flag, returning D3DERR_INVALIDCALL.\n"); + return D3DERR_INVALIDCALL; + } + if (!levels) levels = wined3d_log2i(edge_length) + 1; @@ -1209,6 +1221,12 @@ HRESULT volumetexture_init(struct d3d8_texture *texture, struct d3d8_device *dev desc.depth = depth; desc.size = 0; + if (usage & D3DUSAGE_WRITEONLY) + { + WARN("Texture can't be created with the D3DUSAGE_WRITEONLY flags, returning D3DERR_INVALIDCALL.\n"); + return D3DERR_INVALIDCALL; + } + if (!levels) levels = wined3d_log2i(max(max(width, height), depth)) + 1;
1
0
0
0
Matteo Bruni : d3d9: Refuse to create D3DUSAGE_WRITEONLY textures.
by Alexandre Julliard
05 Feb '19
05 Feb '19
Module: wine Branch: master Commit: 665fe4f1a41b55cc2ce329a70670dacb45f6c896 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=665fe4f1a41b55cc2ce329a7…
Author: Matteo Bruni <mbruni(a)codeweavers.com> Date: Fri Feb 1 12:59:28 2019 +0100 d3d9: Refuse to create D3DUSAGE_WRITEONLY textures. Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/d3d9/tests/device.c | 15 +++++++++++++++ dlls/d3d9/texture.c | 15 +++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c index 859ca47..9064a67 100644 --- a/dlls/d3d9/tests/device.c +++ b/dlls/d3d9/tests/device.c @@ -8051,6 +8051,11 @@ static void test_lockrect_invalid(void) ok(SUCCEEDED(hr), "Failed to unlock texture, hr %#x, type %s.\n", hr, resources[r].name); IDirect3DTexture9_Release(texture); + + hr = IDirect3DDevice9_CreateTexture(device, 128, 128, 1, D3DUSAGE_WRITEONLY, + D3DFMT_A8R8G8B8, resources[r].pool, &texture, NULL); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x for type %s.\n", + hr, resources[r].name); } if (cube_texture) { @@ -8090,6 +8095,11 @@ static void test_lockrect_invalid(void) ok(SUCCEEDED(hr), "Failed to unlock texture, hr %#x, type %s.\n", hr, resources[r].name); IDirect3DCubeTexture9_Release(cube_texture); + + hr = IDirect3DDevice9_CreateCubeTexture(device, 128, 1, D3DUSAGE_WRITEONLY, D3DFMT_A8R8G8B8, + resources[r].pool, &cube_texture, NULL); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x for type %s.\n", + hr, resources[r].name); } } @@ -10269,6 +10279,11 @@ static void test_lockbox_invalid(void) ok(SUCCEEDED(hr), "Failed to unlock volume texture, hr %#x.\n", hr); IDirect3DVolumeTexture9_Release(texture); + + hr = IDirect3DDevice9_CreateVolumeTexture(device, 4, 4, 2, 1, D3DUSAGE_WRITEONLY, + D3DFMT_A8R8G8B8, D3DPOOL_SCRATCH, &texture, NULL); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr); + refcount = IDirect3DDevice9_Release(device); ok(!refcount, "Device has %u references left.\n", refcount); IDirect3D9_Release(d3d); diff --git a/dlls/d3d9/texture.c b/dlls/d3d9/texture.c index 8dc1cee..9f36709 100644 --- a/dlls/d3d9/texture.c +++ b/dlls/d3d9/texture.c @@ -1330,6 +1330,11 @@ HRESULT texture_init(struct d3d9_texture *texture, struct d3d9_device *device, if (is_gdi_compat_wined3dformat(desc.format)) flags |= WINED3D_TEXTURE_CREATE_GET_DC; + if (usage & D3DUSAGE_WRITEONLY) + { + WARN("Texture can't be created with the D3DUSAGE_WRITEONLY flags, returning D3DERR_INVALIDCALL.\n"); + return D3DERR_INVALIDCALL; + } if (usage & D3DUSAGE_AUTOGENMIPMAP) { if (pool == D3DPOOL_SYSTEMMEM) @@ -1419,6 +1424,11 @@ HRESULT cubetexture_init(struct d3d9_texture *texture, struct d3d9_device *devic if (is_gdi_compat_wined3dformat(desc.format)) flags |= WINED3D_TEXTURE_CREATE_GET_DC; + if (usage & D3DUSAGE_WRITEONLY) + { + WARN("Texture can't be created with the D3DUSAGE_WRITEONLY flags, returning D3DERR_INVALIDCALL.\n"); + return D3DERR_INVALIDCALL; + } if (usage & D3DUSAGE_AUTOGENMIPMAP) { if (pool == D3DPOOL_SYSTEMMEM) @@ -1493,6 +1503,11 @@ HRESULT volumetexture_init(struct d3d9_texture *texture, struct d3d9_device *dev desc.depth = depth; desc.size = 0; + if (usage & D3DUSAGE_WRITEONLY) + { + WARN("Texture can't be created with the D3DUSAGE_WRITEONLY flags, returning D3DERR_INVALIDCALL.\n"); + return D3DERR_INVALIDCALL; + } if (usage & D3DUSAGE_AUTOGENMIPMAP) { WARN("D3DUSAGE_AUTOGENMIPMAP volume texture is not supported, returning D3DERR_INVALIDCALL.\n");
1
0
0
0
Dmitry Timoshkov : windowscodecs/tests: Add some tests for converting 24bppBGR to 8bppIndexed format.
by Alexandre Julliard
05 Feb '19
05 Feb '19
Module: wine Branch: master Commit: 6e7a2bd3492aeaf4cb13262cce7ac677d768e924 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=6e7a2bd3492aeaf4cb13262c…
Author: Dmitry Timoshkov <dmitry(a)baikal.ru> Date: Tue Feb 5 11:24:21 2019 +0800 windowscodecs/tests: Add some tests for converting 24bppBGR to 8bppIndexed format. Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru> Signed-off-by: Vincent Povirk <vincent(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/windowscodecs/tests/converter.c | 158 +++++++++++++++++++++++++++++++++++ 1 file changed, 158 insertions(+) diff --git a/dlls/windowscodecs/tests/converter.c b/dlls/windowscodecs/tests/converter.c index 481e563..1cfa29b 100644 --- a/dlls/windowscodecs/tests/converter.c +++ b/dlls/windowscodecs/tests/converter.c @@ -1571,6 +1571,163 @@ static const struct setting png_interlace_settings[] = { {NULL} }; +static void test_converter_8bppIndexed(void) +{ + HRESULT hr; + BitmapTestSrc *src_obj; + IWICFormatConverter *converter; + IWICPalette *palette; + UINT count, i; + BYTE buf[32 * 2 * 3]; /* enough to hold 32x2 24bppBGR data */ + + CreateTestBitmap(&testdata_24bppBGR, &src_obj); + + hr = IWICImagingFactory_CreatePalette(factory, &palette); + ok(hr == S_OK, "CreatePalette error %#x\n", hr); + count = 0xdeadbeef; + hr = IWICPalette_GetColorCount(palette, &count); + ok(hr == S_OK, "GetColorCount error %#x\n", hr); + ok(count == 0, "expected 0, got %u\n", count); + + /* NULL palette + Custom type */ + hr = IWICImagingFactory_CreateFormatConverter(factory, &converter); + ok(hr == S_OK, "CreateFormatConverter error %#x\n", hr); + hr = IWICFormatConverter_Initialize(converter, &src_obj->IWICBitmapSource_iface, + &GUID_WICPixelFormat24bppBGR, WICBitmapDitherTypeNone, + NULL, 0.0, WICBitmapPaletteTypeCustom); + ok(hr == S_OK, "Initialize error %#x\n", hr); + hr = IWICFormatConverter_CopyPalette(converter, palette); + ok(hr == 0xdeadbeef, "unexpected error %#x\n", hr); + hr = IWICFormatConverter_CopyPixels(converter, NULL, 32 * 3, sizeof(buf), buf); + ok(hr == S_OK, "CopyPixels error %#x\n", hr); + IWICFormatConverter_Release(converter); + + /* NULL palette + Custom type */ + hr = IWICImagingFactory_CreateFormatConverter(factory, &converter); + ok(hr == S_OK, "CreateFormatConverter error %#x\n", hr); + hr = IWICFormatConverter_Initialize(converter, &src_obj->IWICBitmapSource_iface, + &GUID_WICPixelFormat8bppIndexed, WICBitmapDitherTypeNone, + NULL, 0.0, WICBitmapPaletteTypeCustom); + ok(hr == E_INVALIDARG, "unexpected error %#x\n", hr); + hr = IWICFormatConverter_CopyPalette(converter, palette); + ok(hr == WINCODEC_ERR_WRONGSTATE, "unexpected error %#x\n", hr); + hr = IWICFormatConverter_CopyPixels(converter, NULL, 32, sizeof(buf), buf); + ok(hr == WINCODEC_ERR_WRONGSTATE, "unexpected error %#x\n", hr); + IWICFormatConverter_Release(converter); + + /* empty palette + Custom type */ + hr = IWICImagingFactory_CreateFormatConverter(factory, &converter); + ok(hr == S_OK, "CreateFormatConverter error %#x\n", hr); + hr = IWICFormatConverter_Initialize(converter, &src_obj->IWICBitmapSource_iface, + &GUID_WICPixelFormat8bppIndexed, WICBitmapDitherTypeNone, + palette, 0.0, WICBitmapPaletteTypeCustom); + ok(hr == S_OK, "Initialize error %#x\n", hr); + hr = IWICFormatConverter_CopyPalette(converter, palette); + ok(hr == S_OK, "CopyPalette error %#x\n", hr); + count = 0xdeadbeef; + hr = IWICPalette_GetColorCount(palette, &count); + ok(hr == S_OK, "GetColorCount error %#x\n", hr); + ok(count == 0, "expected 0, got %u\n", count); + memset(buf, 0xaa, sizeof(buf)); + hr = IWICFormatConverter_CopyPixels(converter, NULL, 32, sizeof(buf), buf); + ok(hr == S_OK, "CopyPixels error %#x\n", hr); + count = 0; + for (i = 0; i < 32 * 2; i++) + if (buf[i] != 0) count++; + ok(count == 0, "expected 0\n"); + IWICFormatConverter_Release(converter); + + /* NULL palette + Predefined type */ + hr = IWICImagingFactory_CreateFormatConverter(factory, &converter); + ok(hr == S_OK, "CreateFormatConverter error %#x\n", hr); + hr = IWICFormatConverter_Initialize(converter, &src_obj->IWICBitmapSource_iface, + &GUID_WICPixelFormat8bppIndexed, WICBitmapDitherTypeNone, + NULL, 0.0, WICBitmapPaletteTypeFixedGray16); + ok(hr == S_OK, "Initialize error %#x\n", hr); + hr = IWICFormatConverter_CopyPalette(converter, palette); + ok(hr == S_OK, "CopyPalette error %#x\n", hr); + count = 0xdeadbeef; + hr = IWICPalette_GetColorCount(palette, &count); + ok(hr == S_OK, "GetColorCount error %#x\n", hr); + ok(count == 16, "expected 16, got %u\n", count); + hr = IWICFormatConverter_CopyPixels(converter, NULL, 32, sizeof(buf), buf); + ok(hr == S_OK, "CopyPixels error %#x\n", hr); + count = 0; + for (i = 0; i < 32 * 2; i++) + if (buf[i] != 0) count++; + ok(count != 0, "expected != 0\n"); + IWICFormatConverter_Release(converter); + + /* not empty palette + Predefined type */ + hr = IWICImagingFactory_CreateFormatConverter(factory, &converter); + ok(hr == S_OK, "CreateFormatConverter error %#x\n", hr); + hr = IWICFormatConverter_Initialize(converter, &src_obj->IWICBitmapSource_iface, + &GUID_WICPixelFormat8bppIndexed, WICBitmapDitherTypeNone, + palette, 0.0, WICBitmapPaletteTypeFixedHalftone64); + ok(hr == S_OK, "Initialize error %#x\n", hr); + hr = IWICFormatConverter_CopyPalette(converter, palette); + ok(hr == S_OK, "CopyPalette error %#x\n", hr); + count = 0xdeadbeef; + hr = IWICPalette_GetColorCount(palette, &count); + ok(hr == S_OK, "GetColorCount error %#x\n", hr); + ok(count == 16, "expected 16, got %u\n", count); + hr = IWICFormatConverter_CopyPixels(converter, NULL, 32, sizeof(buf), buf); + ok(hr == S_OK, "CopyPixels error %#x\n", hr); + count = 0; + for (i = 0; i < 32 * 2; i++) + if (buf[i] != 0) count++; + ok(count != 0, "expected != 0\n"); + IWICFormatConverter_Release(converter); + + /* not empty palette + MedianCut type */ + hr = IWICImagingFactory_CreateFormatConverter(factory, &converter); + ok(hr == S_OK, "CreateFormatConverter error %#x\n", hr); + hr = IWICFormatConverter_Initialize(converter, &src_obj->IWICBitmapSource_iface, + &GUID_WICPixelFormat8bppIndexed, WICBitmapDitherTypeNone, + palette, 0.0, WICBitmapPaletteTypeMedianCut); + ok(hr == S_OK, "Initialize error %#x\n", hr); + hr = IWICFormatConverter_CopyPalette(converter, palette); + ok(hr == S_OK, "CopyPalette error %#x\n", hr); + count = 0xdeadbeef; + hr = IWICPalette_GetColorCount(palette, &count); + ok(hr == S_OK, "GetColorCount error %#x\n", hr); + ok(count == 16, "expected 16, got %u\n", count); + hr = IWICFormatConverter_CopyPixels(converter, NULL, 32, sizeof(buf), buf); + ok(hr == S_OK, "CopyPixels error %#x\n", hr); + count = 0; + for (i = 0; i < 32 * 2; i++) + if (buf[i] != 0) count++; + ok(count != 0, "expected != 0\n"); + IWICFormatConverter_Release(converter); + + /* NULL palette + MedianCut type */ + hr = IWICImagingFactory_CreateFormatConverter(factory, &converter); + ok(hr == S_OK, "CreateFormatConverter error %#x\n", hr); + hr = IWICFormatConverter_Initialize(converter, &src_obj->IWICBitmapSource_iface, + &GUID_WICPixelFormat8bppIndexed, WICBitmapDitherTypeNone, + NULL, 0.0, WICBitmapPaletteTypeMedianCut); + ok(hr == S_OK || broken(hr == E_INVALIDARG) /* XP */, "Initialize error %#x\n", hr); + if (hr == S_OK) + { + hr = IWICFormatConverter_CopyPalette(converter, palette); + ok(hr == S_OK, "CopyPalette error %#x\n", hr); + count = 0xdeadbeef; + hr = IWICPalette_GetColorCount(palette, &count); + ok(hr == S_OK, "GetColorCount error %#x\n", hr); + ok(count == 8, "expected 8, got %u\n", count); + hr = IWICFormatConverter_CopyPixels(converter, NULL, 32, sizeof(buf), buf); + ok(hr == S_OK, "CopyPixels error %#x\n", hr); + count = 0; + for (i = 0; i < 32 * 2; i++) + if (buf[i] != 0) count++; + ok(count != 0, "expected != 0\n"); + } + IWICFormatConverter_Release(converter); + + IWICPalette_Release(palette); + DeleteTestBitmap(src_obj); +} + START_TEST(converter) { HRESULT hr; @@ -1615,6 +1772,7 @@ START_TEST(converter) test_invalid_conversion(); test_default_converter(); + test_converter_8bppIndexed(); test_encoder(&testdata_BlackWhite, &CLSID_WICPngEncoder, &testdata_BlackWhite, &CLSID_WICPngDecoder, "PNG encoder BlackWhite");
1
0
0
0
← Newer
1
...
59
60
61
62
63
64
65
...
68
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
Results per page:
10
25
50
100
200