From: Travis Athougies Subject: [PATCH 1/2] d3dx9_36: Implemented support for samplers in ID3DXConstantTable Message-Id: <1300305844-5112-1-git-send-email-iammisc@gmail.com> Date: Wed, 16 Mar 2011 13:04:03 -0700 Fixes bug 26079 (http://bugs.winehq.org/show_bug.cgi?id=26079) --- dlls/d3dx9_36/shader.c | 24 ++++++++++++++++++------ 1 files changed, 18 insertions(+), 6 deletions(-) diff --git a/dlls/d3dx9_36/shader.c b/dlls/d3dx9_36/shader.c index b8a6909..d08531e 100644 --- a/dlls/d3dx9_36/shader.c +++ b/dlls/d3dx9_36/shader.c @@ -744,11 +744,18 @@ static HRESULT WINAPI ID3DXConstantTableImpl_GetConstantDesc(ID3DXConstantTable* static UINT WINAPI ID3DXConstantTableImpl_GetSamplerIndex(LPD3DXCONSTANTTABLE iface, D3DXHANDLE constant) { - ID3DXConstantTableImpl *This = impl_from_ID3DXConstantTable(iface); + D3DXCONSTANT_DESC desc; + UINT count = 1; + HRESULT res; + + res = ID3DXConstantTable_GetConstantDesc(iface, constant, &desc, &count); + if (res != D3D_OK) + return (UINT)-1; - FIXME("(%p)->(%p): stub\n", This, constant); + if (desc.RegisterSet != D3DXRS_SAMPLER) + return (UINT)-1; - return (UINT)-1; + return desc.RegisterIndex; } static D3DXHANDLE WINAPI ID3DXConstantTableImpl_GetConstant(ID3DXConstantTable* iface, D3DXHANDLE constant, UINT index) @@ -1109,10 +1116,15 @@ HRESULT WINAPI D3DXGetShaderConstantTableEx(CONST DWORD* byte_code, if (hr != D3D_OK) goto error; - if (constant_info[i].RegisterSet != D3DXRS_FLOAT4) - FIXME("Don't know how to calculate Bytes for non D3DXRS_FLOAT4 constants\n"); + if (constant_info[i].RegisterSet != D3DXRS_FLOAT4 && + constant_info[i].RegisterSet != D3DXRS_SAMPLER) + FIXME("Don't know how to calculate Bytes for constants of type %d\n", + constant_info[i].RegisterSet); - /* D3DXRS_FLOAT4 has a base size of 4 (not taking into account dimensions and element count) */ + /* + * D3DXRS_FLOAT4 and D3DXRS_SAMPLER have a base size of 4 + * (not taking into account dimensions and element count) + */ object->constants[i].desc.Bytes = 4; /* Take into account dimensions and elements */ -- 1.7.0.4