From: Michael Stefaniuc mstefani@winehq.org
Signed-off-by: Michael Stefaniuc mstefani@winehq.org Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- dlls/d3dx9_36/effect.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/dlls/d3dx9_36/effect.c b/dlls/d3dx9_36/effect.c index 7635caa8786..874b81b8a3d 100644 --- a/dlls/d3dx9_36/effect.c +++ b/dlls/d3dx9_36/effect.c @@ -3523,9 +3523,9 @@ static HRESULT WINAPI d3dx_effect_SetArrayRange(ID3DXEffect *iface, D3DXHANDLE p /*** ID3DXEffect methods ***/ static HRESULT WINAPI d3dx_effect_GetPool(ID3DXEffect *iface, ID3DXEffectPool **pool) { - struct d3dx_effect *This = impl_from_ID3DXEffect(iface); + struct d3dx_effect *effect = impl_from_ID3DXEffect(iface);
- TRACE("iface %p, pool %p\n", This, pool); + TRACE("iface %p, pool %p.\n", effect, pool);
if (!pool) { @@ -3533,14 +3533,14 @@ static HRESULT WINAPI d3dx_effect_GetPool(ID3DXEffect *iface, ID3DXEffectPool ** return D3DERR_INVALIDCALL; }
- if (This->pool) + *pool = NULL; + if (effect->pool) { - This->pool->lpVtbl->AddRef(This->pool); + *pool = effect->pool; + (*pool)->lpVtbl->AddRef(*pool); }
- *pool = This->pool; - - TRACE("Returning pool %p\n", *pool); + TRACE("Returning pool %p.\n", *pool);
return S_OK; }
From: Michael Stefaniuc mstefani@winehq.org
Signed-off-by: Michael Stefaniuc mstefani@winehq.org Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- dlls/d3dx9_36/effect.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-)
diff --git a/dlls/d3dx9_36/effect.c b/dlls/d3dx9_36/effect.c index 874b81b8a3d..43cc32d6a0b 100644 --- a/dlls/d3dx9_36/effect.c +++ b/dlls/d3dx9_36/effect.c @@ -152,7 +152,6 @@ struct d3dx9_base_effect { struct d3dx_effect *effect;
- struct d3dx_effect_pool *pool; DWORD flags;
ULONG64 version_counter; @@ -176,7 +175,7 @@ struct d3dx_effect
struct ID3DXEffectStateManager *manager; struct IDirect3DDevice9 *device; - struct ID3DXEffectPool *pool; + struct d3dx_effect_pool *pool; struct d3dx_technique *active_technique; struct d3dx_pass *active_pass; BOOL started; @@ -679,6 +678,7 @@ static void free_technique(struct d3dx_technique *technique)
static void d3dx_effect_cleanup(struct d3dx_effect *effect) { + ID3DXEffectPool *pool; unsigned int i;
TRACE("effect %p.\n", effect); @@ -707,7 +707,10 @@ static void d3dx_effect_cleanup(struct d3dx_effect *effect) }
if (effect->pool) - effect->pool->lpVtbl->Release(effect->pool); + { + pool = &effect->pool->ID3DXEffectPool_iface; + pool->lpVtbl->Release(pool); + }
if (effect->manager) IUnknown_Release(effect->manager); @@ -1124,7 +1127,7 @@ static BOOL walk_parameter_tree(struct d3dx_parameter *param, walk_parameter_dep
static ULONG64 *get_version_counter_ptr(struct d3dx_effect *effect) { - return effect->base_effect.pool ? &effect->base_effect.pool->version_counter : &effect->base_effect.version_counter; + return effect->pool ? &effect->pool->version_counter : &effect->base_effect.version_counter; }
static ULONG64 next_effect_update_version(struct d3dx_effect *effect) @@ -3536,7 +3539,7 @@ static HRESULT WINAPI d3dx_effect_GetPool(ID3DXEffect *iface, ID3DXEffectPool ** *pool = NULL; if (effect->pool) { - *pool = effect->pool; + *pool = &effect->pool->ID3DXEffectPool_iface; (*pool)->lpVtbl->AddRef(*pool); }
@@ -5937,7 +5940,6 @@ static BOOL param_set_top_level_param(void *top_level_param, struct d3dx_paramet static HRESULT d3dx_parse_effect(struct d3dx_effect *effect, const char *data, UINT data_size, DWORD start, const char **skip_constants, unsigned int skip_constants_count) { - struct d3dx9_base_effect *base = &effect->base_effect; const char *ptr = data + start; UINT stringcount, resourcecount; HRESULT hr; @@ -6047,7 +6049,7 @@ static HRESULT d3dx_parse_effect(struct d3dx_effect *effect, const char *data, U
for (i = 0; i < effect->parameter_count; ++i) { - if (FAILED(hr = d3dx_pool_sync_shared_parameter(base->pool, &effect->parameters[i]))) + if (FAILED(hr = d3dx_pool_sync_shared_parameter(effect->pool, &effect->parameters[i]))) goto err_out; effect->parameters[i].version_counter = get_version_counter_ptr(effect); set_dirty(&effect->parameters[i].param); @@ -6153,7 +6155,6 @@ static HRESULT d3dx9_effect_init(struct d3dx_effect *effect, struct IDirect3DDev #endif struct d3dx9_base_effect *base = &effect->base_effect; ID3DBlob *bytecode = NULL, *temp_errors = NULL; - struct d3dx_effect_pool *pool_impl = NULL; unsigned int skip_constants_count = 0; char *skip_constants_buffer = NULL; const char **skip_constants = NULL; @@ -6173,15 +6174,13 @@ static HRESULT d3dx9_effect_init(struct d3dx_effect *effect, struct IDirect3DDev if (pool) { pool->lpVtbl->AddRef(pool); - pool_impl = impl_from_ID3DXEffectPool(pool); + effect->pool = impl_from_ID3DXEffectPool(pool); } - effect->pool = pool;
IDirect3DDevice9_AddRef(device); effect->device = device;
base->effect = effect; - base->pool = pool_impl; base->flags = eflags;
read_dword(&ptr, &tag);
From: Michael Stefaniuc mstefani@winehq.org
Signed-off-by: Michael Stefaniuc mstefani@winehq.org Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- 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 43cc32d6a0b..b98cab28832 100644 --- a/dlls/d3dx9_36/effect.c +++ b/dlls/d3dx9_36/effect.c @@ -4087,17 +4087,17 @@ static HRESULT WINAPI d3dx_effect_DeleteParameterBlock(ID3DXEffect *iface, D3DXH } #endif
-static HRESULT WINAPI d3dx_effect_CloneEffect(ID3DXEffect *iface, struct IDirect3DDevice9 *device, - struct ID3DXEffect **effect) +static HRESULT WINAPI d3dx_effect_CloneEffect(ID3DXEffect *iface, IDirect3DDevice9 *device, + ID3DXEffect **new_effect) { - struct d3dx_effect *This = impl_from_ID3DXEffect(iface); + struct d3dx_effect *effect = impl_from_ID3DXEffect(iface);
- FIXME("(%p)->(%p, %p): stub\n", This, device, effect); + FIXME("iface %p, device %p, new_effect %p stub.\n", effect, device, new_effect);
- if (!effect) + if (!new_effect) return D3DERR_INVALIDCALL;
- if (This->base_effect.flags & D3DXFX_NOT_CLONEABLE) + if (effect->base_effect.flags & D3DXFX_NOT_CLONEABLE) return E_FAIL;
if (!device)
From: Michael Stefaniuc mstefani@winehq.org
Signed-off-by: Michael Stefaniuc mstefani@winehq.org Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- dlls/d3dx9_36/effect.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/dlls/d3dx9_36/effect.c b/dlls/d3dx9_36/effect.c index b98cab28832..0e91f2870cb 100644 --- a/dlls/d3dx9_36/effect.c +++ b/dlls/d3dx9_36/effect.c @@ -152,7 +152,6 @@ struct d3dx9_base_effect { struct d3dx_effect *effect;
- DWORD flags;
ULONG64 version_counter; }; @@ -169,6 +168,7 @@ struct d3dx_effect struct d3dx_top_level_parameter *parameters; struct d3dx_technique *techniques; struct d3dx_object *objects; + DWORD flags; struct wine_rb_tree param_tree; char *full_name_tmp; unsigned int full_name_tmp_size; @@ -503,8 +503,7 @@ static struct d3dx_parameter *get_valid_parameter(struct d3dx_effect *effect, D3 sizeof(parameter_magic_string))) return handle_param;
- return effect->base_effect.flags & D3DXFX_LARGEADDRESSAWARE - ? NULL : get_parameter_by_name(effect, NULL, parameter); + return effect->flags & D3DXFX_LARGEADDRESSAWARE ? NULL : get_parameter_by_name(effect, NULL, parameter); }
static void free_state(struct d3dx_state *state) @@ -1914,7 +1913,7 @@ static HRESULT WINAPI d3dx_effect_GetPassDesc(ID3DXEffect *iface, D3DXHANDLE pas desc->pVertexShaderFunction = NULL; desc->pPixelShaderFunction = NULL;
- if (effect->base_effect.flags & D3DXFX_NOT_CLONEABLE) + if (effect->flags & D3DXFX_NOT_CLONEABLE) return D3D_OK;
for (i = 0; i < pass->state_count; ++i) @@ -4097,7 +4096,7 @@ static HRESULT WINAPI d3dx_effect_CloneEffect(ID3DXEffect *iface, IDirect3DDevic if (!new_effect) return D3DERR_INVALIDCALL;
- if (effect->base_effect.flags & D3DXFX_NOT_CLONEABLE) + if (effect->flags & D3DXFX_NOT_CLONEABLE) return E_FAIL;
if (!device) @@ -6181,7 +6180,7 @@ static HRESULT d3dx9_effect_init(struct d3dx_effect *effect, struct IDirect3DDev effect->device = device;
base->effect = effect; - base->flags = eflags; + effect->flags = eflags;
read_dword(&ptr, &tag); TRACE("Tag: %x\n", tag);
From: Michael Stefaniuc mstefani@winehq.org
Signed-off-by: Michael Stefaniuc mstefani@winehq.org Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- dlls/d3dx9_36/effect.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-)
diff --git a/dlls/d3dx9_36/effect.c b/dlls/d3dx9_36/effect.c index 0e91f2870cb..433ec3bb8f3 100644 --- a/dlls/d3dx9_36/effect.c +++ b/dlls/d3dx9_36/effect.c @@ -148,20 +148,11 @@ struct d3dx_technique struct IDirect3DStateBlock9 *saved_state; };
-struct d3dx9_base_effect -{ - struct d3dx_effect *effect; - - - ULONG64 version_counter; -}; - struct d3dx_effect { ID3DXEffect ID3DXEffect_iface; LONG ref;
- struct d3dx9_base_effect base_effect; unsigned int parameter_count; unsigned int technique_count; unsigned int object_count; @@ -169,6 +160,7 @@ struct d3dx_effect struct d3dx_technique *techniques; struct d3dx_object *objects; DWORD flags; + struct wine_rb_tree param_tree; char *full_name_tmp; unsigned int full_name_tmp_size; @@ -180,6 +172,7 @@ struct d3dx_effect struct d3dx_pass *active_pass; BOOL started; DWORD begin_flags; + ULONG64 version_counter;
D3DLIGHT9 current_light[8]; unsigned int light_updated; @@ -1126,7 +1119,7 @@ static BOOL walk_parameter_tree(struct d3dx_parameter *param, walk_parameter_dep
static ULONG64 *get_version_counter_ptr(struct d3dx_effect *effect) { - return effect->pool ? &effect->pool->version_counter : &effect->base_effect.version_counter; + return effect->pool ? &effect->pool->version_counter : &effect->version_counter; }
static ULONG64 next_effect_update_version(struct d3dx_effect *effect) @@ -6152,7 +6145,6 @@ static HRESULT d3dx9_effect_init(struct d3dx_effect *effect, struct IDirect3DDev #else UINT compile_flags = 0; #endif - struct d3dx9_base_effect *base = &effect->base_effect; ID3DBlob *bytecode = NULL, *temp_errors = NULL; unsigned int skip_constants_count = 0; char *skip_constants_buffer = NULL; @@ -6179,7 +6171,6 @@ static HRESULT d3dx9_effect_init(struct d3dx_effect *effect, struct IDirect3DDev IDirect3DDevice9_AddRef(device); effect->device = device;
- base->effect = effect; effect->flags = eflags;
read_dword(&ptr, &tag);
From: Michael Stefaniuc mstefani@winehq.org
Signed-off-by: Michael Stefaniuc mstefani@winehq.org Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- dlls/d3dx9_36/effect.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/dlls/d3dx9_36/effect.c b/dlls/d3dx9_36/effect.c index 433ec3bb8f3..269f75e6d04 100644 --- a/dlls/d3dx9_36/effect.c +++ b/dlls/d3dx9_36/effect.c @@ -1768,6 +1768,8 @@ static inline struct d3dx_effect_pool *impl_from_ID3DXEffectPool(ID3DXEffectPool return CONTAINING_RECORD(iface, struct d3dx_effect_pool, ID3DXEffectPool_iface); }
+static inline struct d3dx_effect_pool *unsafe_impl_from_ID3DXEffectPool(ID3DXEffectPool *iface); + static inline struct d3dx_effect *impl_from_ID3DXEffect(ID3DXEffect *iface) { return CONTAINING_RECORD(iface, struct d3dx_effect, ID3DXEffect_iface); @@ -6164,8 +6166,8 @@ static HRESULT d3dx9_effect_init(struct d3dx_effect *effect, struct IDirect3DDev
if (pool) { + effect->pool = unsafe_impl_from_ID3DXEffectPool(pool); pool->lpVtbl->AddRef(pool); - effect->pool = impl_from_ID3DXEffectPool(pool); }
IDirect3DDevice9_AddRef(device); @@ -6477,6 +6479,15 @@ static const struct ID3DXEffectPoolVtbl ID3DXEffectPool_Vtbl = d3dx_effect_pool_Release };
+static inline struct d3dx_effect_pool *unsafe_impl_from_ID3DXEffectPool(ID3DXEffectPool *iface) +{ + if (!iface) + return NULL; + + assert(iface->lpVtbl == &ID3DXEffectPool_Vtbl); + return impl_from_ID3DXEffectPool(iface); +} + HRESULT WINAPI D3DXCreateEffectPool(ID3DXEffectPool **pool) { struct d3dx_effect_pool *object;