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:DXBC

From ReverseEngineering.wiki
Format
Vendor Microsoft
Magic DXBC
Extensions .cso, .fxo, .dxbc, .dxil
Endianness little
On this wiki Facts · Code · Notes · Topics

Direct3D shader container used by Direct3D 10/11 shaders (and, with a DXIL part, by Direct3D 12 shaders): the four bytes DXBC, a 16-byte checksum, version, total size, and a table of offsets to chunks identified by fourCC (RDEF, ISGN, OSGN, SHDR/SHEX, STAT and others).

Overview

Shaders compiled by fxc / D3DCompile (d3dcompiler_NN.dll) are DXBC containers, found in .cso files, inside game archives, or as byte arrays in executables. Library:Direct3D 11 consumes them directly. Shader Model 6 shaders compiled by DXC keep the same container but carry DXIL (see Format:DXIL).

Header

Fixed 32 bytes (Wine: DXBC_HEADER_SIZE = 8 * sizeof(uint32_t)):

  • 0x00 fourCC 'DXBC'
  • 0x04 16-byte hash (checksum) over the container; DXC's header calls it the container hash, with a 'preview bypass' value of sixteen 0x02 bytes
  • 0x14 u16 major, u16 minor (1.0)
  • 0x18 u32 total container size in bytes
  • 0x1C u32 part count
  • 0x20 u32 offsets[part count], each pointing at a part header

Each part: u32 fourCC, u32 size, then size bytes.

Parts

From the DXC header (DxilContainer.h): RDEF resource definitions (constant buffers, bindings), ISG1 / OSG1 / PSG1 input, output and patch-constant signatures, STAT statistics, SFI0 feature info, PRIV private data, RTS0 root signature, DXIL the DXIL program, PSV0 pipeline state validation, RDAT runtime data, HASH shader hash, ILDB / ILDN debug info and debug name, SRCI source info, PDBI, VERS compiler version. Wine's d3dcompiler tags also list the older ISGN, OSGN, OSG5, PCSG (patch constant), SDBG, XNAP, XNAS and Aon9 (level 9 bytecode). The legacy shader-model 4/5 code chunks are SHDR (SM4) and SHEX (SM5). Unverified: SHDR/SHEX and the checksum algorithm (a modified MD5) are from memory; they are not in the files I read.

Reversing notes

  • A hash that does not match makes the D3D runtime reject a hand-edited shader: re-compute it after patching. Unverified: exact algorithm.
  • The SHDR/SHEX chunk starts with a version token (shader type in the high half, major/minor below) and a length in words, followed by the token stream (a tokenised assembly, not LLVM). Unverified.
  • For disassembly use fxc /dumpbin or a library such as the vkd3d-shader or Wine d3dcompiler code; both are LGPL.

See also Technique:Compiled GPU shader formats, Format:D3D9 shader bytecode.

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/wine-mirror/wine @ 7298a818b79446bae153b8d5aa27235ab3703bf9 · license: LGPL-2.1-or-later (declared by the contributor; GitHub's detector did not recognize COPYING.LIB)
    Wine mirror; dlls/d3dcompiler_43 implements DXBC blob handling and D3D9 shader assembly, include/d3d9types.h has the token macros.
    Tested on: source read, not run: read only · checked 2026-10-19; last activity 2026-10-16