OpenSubdiv
OpenSubdiv copied to clipboard
D3DReflect returns E_NOINTERFACE
The following sanity check can be problematic: https://github.com/PixarAnimationStudios/OpenSubdiv/blob/master/opensubdiv/osd/d3d11ComputeEvaluator.cpp#L258
If a client app links against another version of the DX SDK than OSD was linked with (ex. June 2010 and Windows Kit
Suggest modifying to something like this:
ID3D11ShaderReflection *reflector;
hr = D3DReflect(computeShaderBuffer->GetBufferPointer(),
computeShaderBuffer->GetBufferSize(),
IID_ID3D11ShaderReflection, (void**) &reflector);
if (SUCCEEDED(hr)) {
assert(reflector);
if (reflector->GetNumInterfaceSlots() != 1) {
return false;
}
reflector->Release();
} else {
// warn error
}
A dirty workaround iif this issue is blocking (not the final solution) may be trying get the winSDK interface by specifying it directly?
// declare this out of a function
EXTERN_C CONST DECLSPEC_SELECTANY GUID IID_ID3D11ShaderReflection_WINSDK =
{ 0x8d536ca1, 0x0cca, 0x4956, 0xa8, 0x37, 0x78, 0x69, 0x63, 0x75, 0x55, 0x84 }
hr = D3DReflect(computeShaderBuffer->GetBufferPointer(), computeShaderBuffer->GetBufferSize(), IID_ID3D11ShaderReflection, (void**) &reflector);
// insert this
if (hr==E_NOINTERFACE || hr==E_INVALIDARG)
{
// IID changes from version to version. Tries the winsdk hardcoded one.
hr = D3DReflect(computeShaderBuffer->GetBufferPointer(), computeShaderBuffer->GetBufferSize(),
IID_ID3D11ShaderReflection_WINSDK, (void**) &reflector);
}
// original code
Filed as internal issue #151667.