Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Format:DXIL

From ReverseEngineering.wiki
Format
Vendor Microsoft
Magic DXIL (inside a DXBC part)
Extensions .dxil, .cso
On this wiki Facts · Code · Notes · Topics

The Shader Model 6 shader program of Direct3D 12: LLVM 3.7-based bitcode carried in the DXIL part of a DXBC container, preceded by a small program header (version with shader kind, size, the fourCC 'DXIL', DXIL version, bitcode offset and size).

Overview

A shader built by DXC (dxcompiler, or fxc replacement for SM 6.0+) is a Format:DXBC container whose DXIL part holds the program. The container is signed by dxil.dll's validator: the HASH / container hash is checked by the driver, so patched DXIL must be re-signed. Unverified: the signing requirement is from memory.

Program header (part 'DXIL')

From DxilContainer.h (DxilProgramHeader):

  • u32 ProgramVersion: shader kind in the high 16 bits, major in bits 4-7, minor in bits 0-3 (EncodeVersion = kind << 16 | major << 4 | minor)
  • u32 SizeInUint32: size of the part in 32-bit words, including this header
  • u32 'DXIL' (0x4C495844)
  • u32 DXIL version
  • u32 BitcodeOffset: from the start of the DxilBitcodeHeader (which begins at the 'DXIL' word); normally 16
  • u32 BitcodeSize

The LLVM bitcode follows. It normally starts with the raw bitcode magic 'BC' 0xC0DE; the other LLVM form is a wrapper with magic 0x0B17C0DE, version 0, offset and size words. Unverified: DXC emits the raw form; I read only the wrapper description in LLVM.

Shader kinds

DXIL::ShaderKind: 0 Pixel, 1 Vertex, 2 Geometry, 3 Hull, 4 Domain, 5 Compute, 6 Library, 7 RayGeneration, 8 Intersection, 9 AnyHit, 10 ClosestHit, 11 Miss, 12 Callable, 13 Mesh, 14 Amplification, 15 Node.

Reversing

The bitcode can be read by the DXC fork of LLVM (llvm-dis in the DirectXShaderCompiler build) to get textual IR where operations appear as calls to dx.op.* functions; metadata (dx.entryPoints, dx.resources) lists bindings. Unverified: dx.op naming from memory.

See Technique:Compiled GPU shader formats.

Code & repositories

  • https://github.com/microsoft/DirectXShaderCompiler @ 194bb75bea2becb42810d72a16195089c1908e10 · license: NCSA (declared by the contributor; GitHub's detector did not recognize LICENSE.TXT)
    DXC; include/dxc/DxilContainer/DxilContainer.h defines the container, parts and the DXIL program header.
    Tested on: source read, not run: read only · checked 2026-10-19; last activity 2026-10-16; Note: the latest release ships binaries; the wiki links only the source, never the binaries
  • https://github.com/llvm/llvm-project @ 63ad0005f5eaac3e58289c05111ce5e5a20592b8 · license: Apache-2.0 WITH LLVM-exception (declared by the contributor; GitHub's detector did not recognize LICENSE.TXT)
    LLVM; AMDGPUUsage.rst documents the AMDGPU ELF code object, ELF.h lists EM_CUDA/EM_AMDGPU and OS ABIs, clang CGCUDANV.cpp shows the CUDA fatbin wrapper.
    Tested on: source read, not run: read only · checked 2026-10-19; last activity 2026-10-19; Note: the latest release ships binaries; the wiki links only the source, never the binaries