yariv.h is a single C/C++ header to encode and decode SPIR-V shaders into a more compressed form I've called YARI-V.

Related tags

Miscellaneous yari-v
Overview

YARI-V

Build status

Build status

yariv.h is a single C/C++ header to encode and decode SPIR-V shaders into a more compressed form I've called YARI-V.

YARI-V is an alternative encoding of the SPIR-V standard that seeks to reduce the bytes required to encode shaders/kernels. In its default mode, it will losslessly convert a SPIR-V shader module into a corresponding YARI-V encoding with an average compression ratio of 34.42%.

Usage

Simply include the yariv.h header in your code, and then to encode, first call:

size_t yariv_encode_size(
  uint32_t encode_flags,
  const void *spirv,
  size_t spirv_size);

To get the size (in bytes) of memory required to hold the encoded YARI-V shader module.

Then call:

int yariv_encode(
  uint32_t encode_flags,
  void *out_yariv,
  size_t yariv_size,
  const void *spirv,
  size_t spirv_size);

Which will return 0 on success, and out_yariv will contain the YARI-V shader module.

Then, to decode, first call:

size_t yariv_decode_size(
  const void *yariv,
  size_t yariv_size);

To get the size (in bytes) of memory required to hold the decoded SPIR-V shader module.

Then call:

int yariv_decode(
  void *out_spirv,
  size_t spirv_size,
  const void *yariv,
  size_t yariv_size);

Which will return 0 on success, and out_spirv will contain the SPIR-V shader module.

Results

Approach Size (kilobytes) Compression (%)
SPIR-V 4868.468750 100.000000%
SPIR-V + zstd20 590.573242 12.130575%
SMOL-V 1837.881836 37.750717%
SMOL-V + zstd20 386.879883 7.946644%
YARI-V 1675.956055 34.424706%
YARI-V + zstd20 390.577148 8.022587%
SMOL-V(stripped) 1629.115234 33.462580%
SMOL-V(stripped) + zstd20 348.073242 7.149542%
YARI-V(stripped) 1498.666016 30.783108%
YARI-V(stripped) + zstd20 364.057617 7.477867%

License

This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.

In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

For more information, please refer to http://unlicense.org/

Exceptions

The following folders are held under their own licenses (used for testing purposes only):

  • test/external/dota2 - Copyright (c) Valve Corporation, all rights reserved.
  • test/external/shadertoy - several most popular shaders from Shadertoy, converted to Vulkan SPIR-V via glslang. Copyrights by their individual authors (filename matches last component of shadertoy URL).
  • test/external/talos - Copyright (c) 2002-2016 Croteam, all rights reserved. tests/external/unity - various Unity shaders, produced through a HLSL -> DX11 bytecode -> HLSLcc -> glslang toolchain.
Owner
Neil Henning
Compiler Warlock on Burst @ Unity
Neil Henning
「⚙️」Simple header for C language to encode and decode hex

「 ⚙️ 」Simple header for C language to encode and decode hex Example: Encode: #include <stdio.h> #include <string.h> #include <stdlib.h> #include "hex.

null 2 Dec 30, 2021
A lib to encode/decode Joycon Bluetooth packet.

libjoycon A Joycon packet encoding and decoding lib Build The library itself only links to the libm (math lib): mkdir build && cd build cmake .. make

Inoki 81 May 31, 2022
The SPIR-V Tools project provides an API and commands for processing SPIR-V modules.

SPIR-V Tools Overview The SPIR-V Tools project provides an API and commands for processing SPIR-V modules. The project includes an assembler, binary m

The Khronos Group 756 Jun 28, 2022
LLVM IR and optimizer for shaders, including front-end adapters for GLSL and SPIR-V and back-end adapter for GLSL

Licensing LunarGLASS is available via a three clause BSD-style open source license. Goals The primary goals of the LunarGLASS project are: Reduce the

LunarG, Inc. 151 Jun 18, 2022
Calculator to determine unrealized gains or losses in % and $ form.

Personal-Project-G-L-Calculator in C++ Ryan Ramirez - [email protected] - UNLV Student Calculator to calculate unrealized gains or losses in % a

Ryan Ramirez 1 Oct 19, 2021
This is for interfacing rasberry-pi's (2 cards) with an arduino for sending raw data to form the close loop system to avoid motor heating by acting on a given temperature.

This is for interfacing rasberry-pi's (2 cards) with an arduino for sending raw data to form the close loop system to avoid motor heating by acting on a given temperature. Interface is explained through a master slave approach and client server approach. another camera is used with OPEN-CV platform to interface and collect data aswell.

Younes HAMZA 2 Oct 25, 2021
very simple matrix library, int addition to a recreation of DCM attitude estimation in the form of matrix of C.

matrix very simple matrix library, int addition to a recreation of DCM attitude estimation in the form of matrix of C. the lib include matrix inversio

null 4 Mar 21, 2022
gozer the gozerian - choose the form of the destructor

gozer - choose the form of the destructor gozer allows you to attach a ‘destructor’ artefact (a function to call or string to print) to an R object. A

mikefc 4 Sep 29, 2021
Embed read-only filesystems into any C++11 program w. a single header, zero dependencies and zero modifications to your code

c-embed Embed read-only filesystems into any C++11 program w. a single header, zero dependencies and zero modifications to your code. Usage c-embed al

Nick McDonald 5 Jun 24, 2022
gr-nrf24-sniffer is a tool to receive and decode wireless traffic from nRF24L01(+) modules

gr-nrf24-sniffer What is this? gr-nrf24-sniffer is a tool to receive and decode wireless traffic from nRF24L01(+) modules (or older nRF24xxx) using GN

null 5 Jun 22, 2022
SPIRV-Cross is a tool designed for parsing and converting SPIR-V to other shader languages.

SPIRV-Cross SPIRV-Cross is a tool designed for parsing and converting SPIR-V to other shader languages. Features Convert SPIR-V to readable, usable an

The Khronos Group 1.5k Jun 22, 2022
Khronos-reference front end for GLSL/ESSL, partial front end for HLSL, and a SPIR-V generator.

News Visual Studio 2013 is no longer supported As scheduled, Microsoft Visual Studio 2013 is no longer officially supported. Please upgrade to at leas

The Khronos Group 2.2k Jun 25, 2022
Phan Sang 4 Jun 21, 2022
3D scanning is becoming more and more ubiquitous.

Welcome to the MeshLib! 3D scanning is becoming more and more ubiquitous. Robotic automation, self-driving cars and multitude of other industrial, med

null 29 Jun 20, 2022
An easy to decode base64 modification.

crzy64 An easy to decode base64 modification. This is a base64 modification designed to simplify the decoding step. For the four encoded bytes, it onl

Ilya Kurdyukov 36 Jun 20, 2022
This repository contains machine-readable files for the SPIR-V Registry

SPIR-V Headers This repository contains machine-readable files for the SPIR-V Registry. This includes: Header files for various languages. JSON files

The Khronos Group 184 Jun 24, 2022
SMOL-V: like Vulkan/Khronos SPIR-V, but smaller.

SMOL-V: like Vulkan/Khronos SPIR-V, but smaller. Overview SMOL-V encodes Vulkan/Khronos SPIR-V format programs into a form that is smoller, and is mor

Aras Pranckevičius 266 Jun 20, 2022
A single file, single function, header to make notifications on the PS4 easier

Notifi Synopsis Adds a single function notifi(). It functions like printf however the first arg is the image to use (NULL and any invalid input should

Al Azif 7 Mar 24, 2022
Freeze OS is a cross-platform operating system emulator that runs on top of an interpreter called the Freeze interpreter.

Freeze OS is a cross-platform operating system emulator that runs on top of an interpreter called the Freeze interpreter. The operating system code is basically written in the Freeze programming language that is passed to the Freeze interpreter. The idea is to skip instances where the operating system needs to handle low level operators and focus on higher level stuff, like malware analysis, AI, and others.

null 24 May 2, 2022