top of page

Pre-compiled binary shaders and loading Asset list from a file.

  • itzvnodm
  • Oct 21, 2014
  • 2 min read

Purpose:

The assignment was to

  • Load the asset list from a Lua file.

  • Compile the shaders in the build step.

  • Load the pre-compiled shaders in the program.

Currently all the asset files (Shaders and Materials) are specified as a list of command arguments to AssetBuilder.exe. Each of these names are passed to BuildAssets.lua, where it calls the GenericBuilder.exe. This generic builder copies the assets to the data folder where the game loads them at runtime. In this assignment I created two additional builders, FragmentShaderBuilder and VertexShaderBuilder that compiles the .hlsl files into data folder. Game then loads the pre-compiled shader files into DirectX.

How are asset names given to the builder pipeline?

Assetstobuild.lua.png

The above AssetsToBuild.lua file contains the new method of specifying the asset list to the builder. The classified names of shaders, material files with source and target extensions are as above. BuildAssets.lua now parses this file and loads the source asset file to their respective builder program. In other words, for fragment shader programs, the relative path of source asset (“fragmentShader.hlsl” ) and target asset(“fragmentShader.shd”) are given as input to “FragmentShaderBuilder.exe”. This ShaderBuilder now compiles the source and stores it as target with respective extensions.

I chose the above because I think this is understandable enough where every type of asset that needs to be built has their own place. The names can be specified by comma seperated values. Also source and target extensions can be specified for each type. Moveroer, the builder name for each type of asset should also be specified at the start.

Logic to do the above:

BuildAsset.lua.png

Time Spent:

Reading: 2hr

Setting up Asset to Load: 1hr

Creating Shader Builder and Loading Pre-Compiled: 2hr

Write-up: 1hr

Total: 6hr


 
 
 

Comentarios


Recent Posts
Archive
Search By Tags
bottom of page