File Formats
  • Audio
  • Video
  • Images
  • 3D & CAD
  • Documents
  • Data
  • Code
  • System
Code
  • Source code
  • Bytecode
  • Programs & libraries
  • Object files
  • Debug info
  • Firmware & ROMs
  • Notebooks
  • Shaders
  • Build files
  • Packages & installers
  1. Home
  2. Code
  3. Shaders
  4. SPV
.SPV
  • Overview

.SPV

SPIR-V shader module

Introduction

SPIR-V is the Khronos Group’s binary language for shaders and compute kernels. Vulkan requires it, OpenGL 4.6 and OpenCL accept it, and compilers produce it from GLSL, HLSL and other shading languages. A .spv file holds one compiled module, which the graphics driver turns into code for the particular GPU.

Software

  • glslang, which compiles GLSL and HLSL to SPIR-V (Windows, macOS, Linux)
  • SPIRV-Tools, with the spirv-dis disassembler and spirv-val validator (Windows, macOS, Linux)
  • SPIRV-Cross, which turns SPIR-V back into GLSL, HLSL or Metal (Windows, macOS, Linux)
  • Vulkan SDK, which bundles these tools (Windows, macOS, Linux)
  • RenderDoc (Windows, Linux)

Structure

A SPIR-V module is a sequence of 32-bit words. It starts with a five-word header: the magic number 0x07230203, the version (for example 0x00010600 for 1.6), a number identifying the tool that generated it, the bound (every ID in the module is less than it), and a reserved word that is 0. Reading the magic number also tells a reader the byte order; files are normally little-endian, so they start with the bytes 03 02 23 07.

Instructions follow. The first word of each holds the instruction’s length in words in its upper 16 bits and its opcode in the lower 16, so a reader can step over any instruction it does not know. The instructions come in a fixed order of sections: capabilities, extensions, imports, the memory model, entry points, debug names, decorations, types and constants, and then the functions.

  1. 0magic 0x072302031 word
  2. 4version, generator, bound, reserved4 words
  3. 20instructions, one after anothervaries
    1. +0word count (upper 16 bits) and opcode (lower 16 bits)1 word
    2. +4operands: result type, result ID and argumentsword count − 1 words
A SPIR-V module: a five-word header, then instructions.
© 2026 fileformats.org About Contact Made by Lewpen