Skip to main content

Module hlsl_compiled

Module hlsl_compiled 

Source
Expand description

HLSL compiled shader file format support (FASTBIN0/DXBC).

This module handles .hlsl_compiled files which contain compiled DirectX shaders (DXBC format) wrapped in a FASTBIN0 container with metadata.

§File Format

HLSL compiled files use the FASTBIN0 signature and contain:

  • Serialization version
  • Shader metadata (API, source file, name, type, shader model, UUID)
  • Raw DXBC (DirectX Bytecode) shader data

§Shader Metadata

The wrapper format stores comprehensive shader compilation metadata:

  • API: Target graphics API (e.g., “dx11”)
  • Source: Source .hlsl file path
  • Shader Name: Entry point function name
  • Shader Type: Vertex, pixel, compute, etc.
  • Model: Shader model version (e.g., “vs_5_0”, “ps_5_0”)
  • UUID: Unique identifier for this shader compilation

§DXBC Data

The actual shader bytecode is stored as raw DXBC format, which can be processed by DirectX shader tools or executed by the graphics driver.

§Versioning

Currently only version 1 of the FASTBIN0 format is supported.

§Usage

use rpfm_lib::files::hlsl_compiled::HlslCompiled;
use rpfm_lib::files::Decodeable;

// Decode a compiled shader
let shader = HlslCompiled::decode(&mut data, &None)?;

// Access metadata
println!("Shader: {} ({})", shader.shader_name(), shader.shader_type());
println!("Model: {}", shader.model_long());

// Access raw DXBC data
let dxbc_bytes = shader.data();

Structs§

HlslCompiled
Represents a compiled HLSL shader with metadata.

Constants§

EXTENSION
File extension for HLSL compiled shader files.
SIGNATURE
FASTBIN0 file signature.