* WARNING: POSSIBLE MALWARE * Last merged in 2022, since then the master branch has been deleted. An unverifable amount (~250k, vs incomplete code of a few tens of thousand) lines of bullshit is in there, alongside executable python, gn, cmake, bashscripts, and other dogshit we'll never be able to verify. I don't trust these committee conkies and activists with rolling mirrors. Safe version: https://gitea.reece.sx/AuroraMiddleware/SPIRV-Cross
Go to file
Hans-Kristian Arntzen 0ae2bcc3d0 Ensure that floating point literals are float.
Fixes regression from earlier workaround of std::to_string.
Update reference output.
2016-03-12 14:22:39 +01:00
include/spir2cross Initial commit. 2016-03-11 16:30:27 +01:00
jni Initial commit. 2016-03-11 16:30:27 +01:00
msvc Initial commit. 2016-03-11 16:30:27 +01:00
reference/shaders Ensure that floating point literals are float. 2016-03-12 14:22:39 +01:00
shaders Initial commit. 2016-03-11 16:30:27 +01:00
.gitignore Initial commit. 2016-03-11 16:30:27 +01:00
GLSL.std.450.h Initial commit. 2016-03-11 16:30:27 +01:00
LICENSE Initial commit. 2016-03-11 16:30:27 +01:00
main.cpp Initial commit. 2016-03-11 16:30:27 +01:00
Makefile Initial commit. 2016-03-11 16:30:27 +01:00
README.md Initial commit. 2016-03-11 16:30:27 +01:00
spir2common.hpp Ensure that floating point literals are float. 2016-03-12 14:22:39 +01:00
spir2cpp.cpp Initial commit. 2016-03-11 16:30:27 +01:00
spir2cpp.hpp Initial commit. 2016-03-11 16:30:27 +01:00
spir2cross.cpp Initial commit. 2016-03-11 16:30:27 +01:00
spir2cross.hpp Initial commit. 2016-03-11 16:30:27 +01:00
spir2glsl.cpp Initial commit. 2016-03-11 16:30:27 +01:00
spir2glsl.hpp Initial commit. 2016-03-11 16:30:27 +01:00
spirv.hpp Initial commit. 2016-03-11 16:30:27 +01:00
test_shaders.py Initial commit. 2016-03-11 16:30:27 +01:00

SPIR2CROSS

SPIR2CROSS is a tool designed for parsing and converting SPIR-V to other shader languages.

Features

  • Convert SPIR-V to readable, usable and efficient GLSL
  • Convert SPIR-V to debuggable C++ [EXPERIMENTAL]
  • Reflection API to simplify the creation of Vulkan pipeline layouts
  • Reflection API to modify and tweak OpDecorations
  • Supports "all" of vertex, fragment, tessellation, geometry and compute shaders.

SPIR2CROSS tries hard to emit readable and clean output from the SPIR-V. The goal is to emit GLSL that looks like it was written by a human and not awkward IR/assembly-like code.

NOTE: Individual features are expected to be mostly complete, but it is possible that certain obscure GLSL features are not yet supported. However, most missing features are expected to be "trivial" improvements at this stage.

Occasionally, missing features is due to glslangValidator's lack of proper support for that feature making testing hard.

Building

SPIR2CROSS has been tested on Linux, OSX and Windows.

Linux and OSX

Just run make on the command line. A recent GCC (4.8+) or Clang (3.x+) compiler is required as SPIR2CROSS uses C++11 extensively.

Windows

MinGW-w64 based compilation works with make, and an MSVC 2013 solution is also included.

Usage

Creating a SPIR-V file from GLSL with glslang

glslangValidator -H -V -o test.spv test.frag

Converting a SPIR-V file to GLSL ES

glslangValidator -H -V -o test.spv shaders/comp/basic.comp
./spir2cross --version 310 --es test.spv

Converting to desktop GLSL

glslangValidator -H -V -o test.spv shaders/comp/basic.comp
./spir2cross --version 330 test.spv --output test.comp

Disable prettifying optimizations

glslangValidator -H -V -o test.spv shaders/comp/basic.comp
./spir2cross --version 310 --es test.spv --output test.comp --force-temporary

ABI concerns

SPIR-V headers

The current repository uses the latest SPIR-V and GLSL.std.450 headers. SPIR-V files created from older headers could have ABI issues.

Regression testing

In shaders/ a collection of shaders are maintained for purposes of regression testing. The current reference output is contained in reference/. ./test_shaders.py shaders can be run to perform regression testing. Currently, the Mali Offline Compiler malisc is used to verify the outputs from SPIR2CROSS.