Commit 6498a03a authored by Paul Gofman's avatar Paul Gofman Committed by Alexandre Julliard

d3dx9: Introduce d3dx_shader_get_ctab_constant() function and use it instead of…

d3dx9: Introduce d3dx_shader_get_ctab_constant() function and use it instead of ID3DXConstantTableImpl_GetConstantDesc(). Signed-off-by: 's avatarPaul Gofman <gofmanp@gmail.com> Signed-off-by: 's avatarMatteo Bruni <mbruni@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 518b2f27
......@@ -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 */
......@@ -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;
}
......
......@@ -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)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment