I want to extract shader program type informantion from shader byte code. I tried D3D11Reflect
first, and I found the _D3D11_SHADER_DESC
structure. But I couldn't identify which field stores program type information...
If you look in the d3d11shader.h
header, you'll see it's encoded into the Version field in the 16-bit upper word:
typedef enum D3D11_SHADER_VERSION_TYPE
{
D3D11_SHVER_PIXEL_SHADER = 0,
D3D11_SHVER_VERTEX_SHADER = 1,
D3D11_SHVER_GEOMETRY_SHADER = 2,
// D3D11 Shaders
D3D11_SHVER_HULL_SHADER = 3,
D3D11_SHVER_DOMAIN_SHADER = 4,
D3D11_SHVER_COMPUTE_SHADER = 5,
D3D11_SHVER_RESERVED0 = 0xFFF0,
} D3D11_SHADER_VERSION_TYPE;
#define D3D11_SHVER_GET_TYPE(_Version) \
(((_Version) >> 16) & 0xffff)
#define D3D11_SHVER_GET_MAJOR(_Version) \
(((_Version) >> 4) & 0xf)
#define D3D11_SHVER_GET_MINOR(_Version) \
(((_Version) >> 0) & 0xf)
typedef struct _D3D11_SHADER_DESC
{
UINT Version; // Shader version
...
} D3D11_SIGNATURE_PARAMETER_DESC;