2010/11/8 Rico Schüller kgbricola@web.de:
- object->vtbl = &d3dcompiler_shader_reflection_vtbl;
- object->refcount = 1;
- hr = d3dcompiler_shader_reflection_init(object, data, data_size, riid);
- if (FAILED(hr))
- {
WARN("Failed to initialize shader reflection\n");
IUnknown_Release((IUnknown *)object);
return hr;
- }
You can't do that. Since d3dcompiler_shader_reflection_init() is responsible for setting the vtbl, you can't assume it's set if d3dcompiler_shader_reflection_init() fails. You'll have to use HeapFree() here.
- if (!IsEqualGUID(riid, &IID_ID3D11ShaderReflection))
- {
WARN("Wrong rrid %s, accept only %s!\n", debugstr_guid(riid), debugstr_guid(&IID_ID3D11ShaderReflection));
return E_FAIL;
- }
This can be done in D3DReflect() before even allocating the reflection object. (Also, "rrid" is a typo.)