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>
This commit is contained in:
Paul Gofman 2017-07-11 14:26:58 +03:00 committed by Alexandre Julliard
parent 518b2f27cf
commit 6498a03a8e
3 changed files with 22 additions and 20 deletions

View File

@ -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 */

View File

@ -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)))
if (!constant)
{
FIXME("Could not get constant desc, hr %#x.\n", hr);
return hr;
}
else if (count != 1)
{
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;
}

View File

@ -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)
{