shader fix
This commit is contained in:
parent
061b20d8c4
commit
35f943af53
1 changed files with 61 additions and 62 deletions
|
|
@ -37,8 +37,6 @@ Shader::Shader(fs::path path, std::string entrypoint, EShLanguage type): path(pa
|
||||||
|
|
||||||
void Shader::Compile(fs::path outputDir) {
|
void Shader::Compile(fs::path outputDir) {
|
||||||
if(!fs::exists((outputDir/path.filename()).replace_extension("spirv")) || fs::last_write_time(path) > fs::last_write_time((outputDir/path.filename()).replace_extension("spirv"))) {
|
if(!fs::exists((outputDir/path.filename()).replace_extension("spirv")) || fs::last_write_time(path) > fs::last_write_time((outputDir/path.filename()).replace_extension("spirv"))) {
|
||||||
return;
|
|
||||||
}
|
|
||||||
glslang::InitializeProcess();
|
glslang::InitializeProcess();
|
||||||
EShMessages messages = static_cast<EShMessages>(EShMsgDefault | EShMsgVulkanRules | EShMsgSpvRules);
|
EShMessages messages = static_cast<EShMessages>(EShMsgDefault | EShMsgVulkanRules | EShMsgSpvRules);
|
||||||
std::ifstream fileStream(path, std::ios::in | std::ios::binary);
|
std::ifstream fileStream(path, std::ios::in | std::ios::binary);
|
||||||
|
|
@ -101,3 +99,4 @@ void Shader::Compile(fs::path outputDir) {
|
||||||
std::ofstream file(outputDir/filename, std::ios::binary);
|
std::ofstream file(outputDir/filename, std::ios::binary);
|
||||||
file.write(reinterpret_cast<const char*>(spirv.data()), spirv.size() * sizeof(std::uint32_t));
|
file.write(reinterpret_cast<const char*>(spirv.data()), spirv.size() * sizeof(std::uint32_t));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue