Functions
-
bool WriteSpirvToDisk (const std::vector<uint32_t> & spirv, const ShaderVariantArgs & args, const std::string & base_path, const std::string & shader_name)Writes the given spirv to a file on disk, whose name is generated based on the original shader
name plus a hash value based on the provided ShaderVariantArgs.
Defined at line 26 of file ../../src/ui/lib/escher/shaders/util/spirv_file_util.cc
-
bool ReadSpirvFromDisk (const ShaderVariantArgs & args, const std::string & base_path, const std::string & shader_name, std::vector<uint32_t> * out_spirv)Reads the spirv for a shader given the original file name and a list of args. Generates the
spirv file name based on the hash it calculates and sees if there is anything on disk to read.
If so, the function returns true and the code is stored in the out_spirv parameter.
Defined at line 42 of file ../../src/ui/lib/escher/shaders/util/spirv_file_util.cc
-
bool SpirvExistsOnDisk (const ShaderVariantArgs & argsconst std::string & abs_rootconst std::string & shader_nameconst std::vector<uint32_t> & spirv)Checks to see if there already exists a spirv file on disk and if the newly compiled spirv
is different from it. If a file already exists and the contents are the same, then the shader
source code has not been updated and there is no need to update the spirv file on disk.
It would also be possible to simply check the time stamp of the spirv file on disk against
the file for the source code to see if the latter is newer than the former and rebuild off
of that. However, doing it this way would cause the spirv to be regenerated even if the
changes to the source code did not result in spirv changes (for example - someone could have
simply modified a comment or fixed some spacing/styling issues, which would not result in
a spirv change). So to avoid superfluous changes, we compare the old and new spirv directly.
Defined at line 80 of file ../../src/ui/lib/escher/shaders/util/spirv_file_util.cc