Modify D3D10ReflectShader to now use the shader init function within d3dcompiler, and also take vtbl assignment outside of d3dcompiler_shader_reflection_init so that it can be used by both D3DReflect and D3D10ReflectShader.
Signed-off-by: Connor McAdams conmanx360@gmail.com --- dlls/d3dcompiler_43/reflection.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/dlls/d3dcompiler_43/reflection.c b/dlls/d3dcompiler_43/reflection.c index 192dcfcb72..43a2ca7f64 100644 --- a/dlls/d3dcompiler_43/reflection.c +++ b/dlls/d3dcompiler_43/reflection.c @@ -1812,8 +1812,6 @@ static HRESULT d3dcompiler_shader_reflection_init(struct d3dcompiler_shader_refl HRESULT hr; unsigned int i;
- reflection->ID3D11ShaderReflection_iface.lpVtbl = &d3dcompiler_shader_reflection_vtbl; - reflection->refcount = 1;
wine_rb_init(&reflection->types, d3dcompiler_shader_reflection_type_compare);
@@ -1930,8 +1928,9 @@ err_out: HRESULT WINAPI D3D10ReflectShader(const void *data, SIZE_T data_size, ID3D10ShaderReflection **reflector) { struct d3dcompiler_shader_reflection *object; + HRESULT hr;
- FIXME("data %p, data_size %lu, reflector %p stub!\n", data, data_size, reflector); + TRACE("data %p, data_size %lu, reflector %p\n", data, data_size, reflector);
if (!(object = heap_alloc_zero(sizeof(*object)))) { @@ -1942,6 +1941,14 @@ HRESULT WINAPI D3D10ReflectShader(const void *data, SIZE_T data_size, ID3D10Shad object->ID3D10ShaderReflection_iface.lpVtbl = &d3d10_shader_reflection_vtbl; object->refcount = 1;
+ hr = d3dcompiler_shader_reflection_init(object, data, data_size); + if (FAILED(hr)) + { + WARN("Failed to initialize shader reflection\n"); + HeapFree(GetProcessHeap(), 0, object); + return hr; + } + *reflector = &object->ID3D10ShaderReflection_iface;
TRACE("Created ID3D10ShaderReflection %p\n", object); @@ -1979,6 +1986,9 @@ HRESULT WINAPI D3DReflect(const void *data, SIZE_T data_size, REFIID riid, void if (!object) return E_OUTOFMEMORY;
+ object->ID3D11ShaderReflection_iface.lpVtbl = &d3dcompiler_shader_reflection_vtbl; + object->refcount = 1; + hr = d3dcompiler_shader_reflection_init(object, data, data_size); if (FAILED(hr)) {