YUGA Introduction
YUGA files are files that contain multiple resources inside them such as Meshes, Textures and Shaders that we call chunks.
Meta Data and Chunk Header
Each Resource in a YUGA File has a Meta Data that comes before them in memory.
Data such as:
- Size of meta data
- Offset of header in file
- File name
- Chunk Header
- Size of the data that comes after
- Whether it's compressed or not
- Revision number.
Meta Data in our header file:
Chunk Header in our header file:
How We Write Assets
We write the assets using a FileWriter Class.
Here is an example on how we write a Shader Asset to a YUGA File:
YUGA Shaders
Shader is an AssetType in our Asset System, YUGA.
It contains
- Compiled Shader (Intermediate Language like SPIR-V) for a Shader Stage.
- Stage, Language, etc. info of the Shader (Info In The HEADER)
- Reflection Info (Blocks and Variables inside the Shader)
- Source Code of the Shader
- Defines
Shader Data
-
Blocks
All the shader blocks like uniform buffers and textures and samplers.
-
Variables
All the variables in shader buffers
-
IR
Byte-code, currently in SPIRV
-
Defines
Macro definitions that the shader is compiled with
-
Strings Data
The memory that we put all our strings in: entry_point_name, source_code, blocks names, defines name and value, variable names.
Shader Header
It is the header we put at the beginning of our asset memory.
It contains compiled shader's hash, shader stage, shader language, and data that will help us navigate through the raw data to find what we're looking for, such as offsets and sizes.
YUGA::Asset::Shader
And here is the YUGA::Asset::Shader which is fundamentally pointer arithmetics for our asset memory to get requested properties:
We will be using this class to extract reflection info and using it to update our descriptor sets and shader resources.