You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Applications that work with d3dcompiler_47.dll, and which rely on being able to perform reflection on the contents of constant buffers (e.g., to find the offsets of sub-fields) do not work properly with dxcompiler.dll and may crash with a NULL pointer dererence (as they will likely assume that all valid ID3D12ShaderReflectionVariables will have valid types).
Minimal repro steps
Use D3DCompile() to compile a shader with at least one variable in a constant buffer
Use D3DReflect() to get an ID3D12ShaderReflection interface
Use ID3D12ShaderReflection::GetConstantBufferByName() to get refleciton info for the constant buffer
Use ID3D12ShaderReflectionConstantBuffer::GetVariableByName() to get the reflection info for the variable
Call ID3D12ShaderReflectionVariable::GetType()
Expected result
The result of ID3D12ShaderReflectionVariable::GetType() should be non-NULL if the input was a valid variable.
Actual result
The result is NULL.
Further technical details
The root cause is pretty clear, arising from the following lines in DxilContainerReflection.cpp, inside CShaderReflectionConstantBuffer::Initialize():
The basic problem is then that the feature marked as TODO hasn't been implemented.
I have an initial implementation of the feature in place, at least as far as required for my workload. I will be working toward turning it into a pull request some time this week, unless somebody else already has an implementation that is further along.
Activity
Add support for reflection on types of constant-buffer members.
Generate fxc-compatible reflection type info for buffer members (#146)
[0010] Allow casting to uint64_t (microsoft#134)