From 52c2092fa92cd06ea2c1074072be4cadd872f083 Mon Sep 17 00:00:00 2001 From: Michael Stefaniuc Date: Tue, 5 Mar 2019 22:34:23 +0100 Subject: [PATCH] d3dx9: Merge the d3dx_effect_GetPassDesc() helper. Signed-off-by: Michael Stefaniuc Signed-off-by: Matteo Bruni Signed-off-by: Alexandre Julliard --- dlls/d3dx9_36/effect.c | 95 +++++++++++++++++++----------------------- 1 file changed, 44 insertions(+), 51 deletions(-) diff --git a/dlls/d3dx9_36/effect.c b/dlls/d3dx9_36/effect.c index acc0eb786fb..2a201446b4d 100644 --- a/dlls/d3dx9_36/effect.c +++ b/dlls/d3dx9_36/effect.c @@ -1110,55 +1110,6 @@ static HRESULT d3dx9_get_param_value_ptr(struct d3dx_pass *pass, struct d3dx_sta return E_NOTIMPL; } -static HRESULT d3dx9_base_effect_get_pass_desc(struct d3dx9_base_effect *base, - D3DXHANDLE pass_handle, D3DXPASS_DESC *desc) -{ - struct d3dx_pass *pass = get_valid_pass(base, pass_handle); - unsigned int i; - - if (!desc || !pass) - { - WARN("Invalid argument specified.\n"); - return D3DERR_INVALIDCALL; - } - - desc->Name = pass->name; - desc->Annotations = pass->annotation_count; - - desc->pVertexShaderFunction = NULL; - desc->pPixelShaderFunction = NULL; - - if (base->flags & D3DXFX_NOT_CLONEABLE) - return D3D_OK; - - for (i = 0; i < pass->state_count; ++i) - { - struct d3dx_state *state = &pass->states[i]; - - if (state_table[state->operation].class == SC_VERTEXSHADER - || state_table[state->operation].class == SC_PIXELSHADER) - { - struct d3dx_parameter *param; - void *param_value; - BOOL param_dirty; - HRESULT hr; - void *data; - - if (FAILED(hr = d3dx9_get_param_value_ptr(pass, &pass->states[i], ¶m_value, ¶m, - FALSE, ¶m_dirty))) - return hr; - - data = param->object_id ? base->objects[param->object_id].data : NULL; - if (state_table[state->operation].class == SC_VERTEXSHADER) - desc->pVertexShaderFunction = data; - else - desc->pPixelShaderFunction = data; - } - } - - return D3D_OK; -} - static unsigned int get_annotation_from_object(struct d3dx_effect *effect, D3DXHANDLE object, struct d3dx_parameter **annotations) { @@ -3180,13 +3131,55 @@ static HRESULT WINAPI d3dx_effect_GetTechniqueDesc(ID3DXEffect *iface, D3DXHANDL return D3D_OK; } -static HRESULT WINAPI d3dx_effect_GetPassDesc(ID3DXEffect *iface, D3DXHANDLE pass, D3DXPASS_DESC *desc) +static HRESULT WINAPI d3dx_effect_GetPassDesc(ID3DXEffect *iface, D3DXHANDLE pass_handle, D3DXPASS_DESC *desc) { struct d3dx_effect *effect = impl_from_ID3DXEffect(iface); + struct d3dx_pass *pass = get_valid_pass(&effect->base_effect, pass_handle); + unsigned int i; TRACE("iface %p, pass %p, desc %p.\n", iface, pass, desc); - return d3dx9_base_effect_get_pass_desc(&effect->base_effect, pass, desc); + if (!desc || !pass) + { + WARN("Invalid argument specified.\n"); + return D3DERR_INVALIDCALL; + } + + desc->Name = pass->name; + desc->Annotations = pass->annotation_count; + + desc->pVertexShaderFunction = NULL; + desc->pPixelShaderFunction = NULL; + + if (effect->base_effect.flags & D3DXFX_NOT_CLONEABLE) + return D3D_OK; + + for (i = 0; i < pass->state_count; ++i) + { + struct d3dx_state *state = &pass->states[i]; + + if (state_table[state->operation].class == SC_VERTEXSHADER + || state_table[state->operation].class == SC_PIXELSHADER) + { + struct d3dx_parameter *param; + void *param_value; + BOOL param_dirty; + HRESULT hr; + void *data; + + if (FAILED(hr = d3dx9_get_param_value_ptr(pass, &pass->states[i], ¶m_value, ¶m, + FALSE, ¶m_dirty))) + return hr; + + data = param->object_id ? effect->base_effect.objects[param->object_id].data : NULL; + if (state_table[state->operation].class == SC_VERTEXSHADER) + desc->pVertexShaderFunction = data; + else + desc->pPixelShaderFunction = data; + } + } + + return D3D_OK; } static HRESULT WINAPI d3dx_effect_GetFunctionDesc(ID3DXEffect *iface, D3DXHANDLE shader,