Module: wine Branch: master Commit: 6498a03a8ef0f0d157f05c8cac9c47aa88538a3f URL: http://source.winehq.org/git/wine.git/?a=commit;h=6498a03a8ef0f0d157f05c8cac...
Author: Paul Gofman gofmanp@gmail.com Date: Tue Jul 11 14:26:58 2017 +0300
d3dx9: Introduce d3dx_shader_get_ctab_constant() function and use it instead of ID3DXConstantTableImpl_GetConstantDesc().
Signed-off-by: Paul Gofman gofmanp@gmail.com Signed-off-by: Matteo Bruni mbruni@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/d3dx9_36/d3dx9_private.h | 8 ++++++++ dlls/d3dx9_36/preshader.c | 16 ++++------------ dlls/d3dx9_36/shader.c | 18 ++++++++++-------- 3 files changed, 22 insertions(+), 20 deletions(-)
diff --git a/dlls/d3dx9_36/d3dx9_private.h b/dlls/d3dx9_36/d3dx9_private.h index db80490..f84266d 100644 --- a/dlls/d3dx9_36/d3dx9_private.h +++ b/dlls/d3dx9_36/d3dx9_private.h @@ -355,4 +355,12 @@ HRESULT d3dx_param_eval_set_shader_constants(ID3DXEffectStateManager *manager, s struct d3dx_param_eval *peval, BOOL update_all) DECLSPEC_HIDDEN; BOOL is_param_eval_input_dirty(struct d3dx_param_eval *peval, ULONG64 update_version) DECLSPEC_HIDDEN;
+struct ctab_constant { + D3DXCONSTANT_DESC desc; + struct ctab_constant *constants; +}; + +const struct ctab_constant *d3dx_shader_get_ctab_constant(ID3DXConstantTable *iface, + D3DXHANDLE constant) DECLSPEC_HIDDEN; + #endif /* __WINE_D3DX9_PRIVATE_H */ diff --git a/dlls/d3dx9_36/preshader.c b/dlls/d3dx9_36/preshader.c index 34fed07..7740bd6 100644 --- a/dlls/d3dx9_36/preshader.c +++ b/dlls/d3dx9_36/preshader.c @@ -590,22 +590,14 @@ static unsigned int *parse_pres_ins(unsigned int *ptr, unsigned int count, struc
static HRESULT get_ctab_constant_desc(ID3DXConstantTable *ctab, D3DXHANDLE hc, D3DXCONSTANT_DESC *desc) { - D3DXCONSTANT_DESC buffer[2]; - HRESULT hr; - unsigned int count; + const struct ctab_constant *constant = d3dx_shader_get_ctab_constant(ctab, hc);
- count = ARRAY_SIZE(buffer); - if (FAILED(hr = ID3DXConstantTable_GetConstantDesc(ctab, hc, buffer, &count))) - { - FIXME("Could not get constant desc, hr %#x.\n", hr); - return hr; - } - else if (count != 1) + if (!constant) { - FIXME("Unexpected constant descriptors count %u.\n", count); + FIXME("Could not get constant desc.\n"); return D3DERR_INVALIDCALL; } - *desc = buffer[0]; + *desc = constant->desc; return D3D_OK; }
diff --git a/dlls/d3dx9_36/shader.c b/dlls/d3dx9_36/shader.c index 4dbecb1..b86bb65 100644 --- a/dlls/d3dx9_36/shader.c +++ b/dlls/d3dx9_36/shader.c @@ -681,11 +681,6 @@ HRESULT WINAPI D3DXPreprocessShaderFromResourceW(HMODULE module, const WCHAR *re
}
-struct ctab_constant { - D3DXCONSTANT_DESC desc; - struct ctab_constant *constants; -}; - struct ID3DXConstantTableImpl { ID3DXConstantTable ID3DXConstantTable_iface; LONG ref; @@ -946,13 +941,20 @@ static HRESULT WINAPI ID3DXConstantTableImpl_GetDesc(ID3DXConstantTable *iface, return D3D_OK; }
+const struct ctab_constant *d3dx_shader_get_ctab_constant(ID3DXConstantTable *iface, D3DXHANDLE constant) +{ + struct ID3DXConstantTableImpl *ctab = impl_from_ID3DXConstantTable(iface); + + return get_valid_constant(ctab, constant); +} + static HRESULT WINAPI ID3DXConstantTableImpl_GetConstantDesc(ID3DXConstantTable *iface, D3DXHANDLE constant, D3DXCONSTANT_DESC *desc, UINT *count) { - struct ID3DXConstantTableImpl *This = impl_from_ID3DXConstantTable(iface); - struct ctab_constant *c = get_valid_constant(This, constant); + struct ID3DXConstantTableImpl *ctab = impl_from_ID3DXConstantTable(iface); + struct ctab_constant *c = get_valid_constant(ctab, constant);
- TRACE("(%p)->(%p, %p, %p)\n", This, constant, desc, count); + TRACE("(%p)->(%p, %p, %p)\n", ctab, constant, desc, count);
if (!c) {