Skip to content

Commit 89c8fe3

Browse files
committed
Treat hlsl shader compile warning as error
1 parent a08d349 commit 89c8fe3

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

src/FlyCube/HLSLCompiler/Compiler.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ std::vector<uint8_t> Compile(const ShaderDesc& shader, ShaderBlobType blob_type)
100100
std::deque<std::wstring> dynamic_arguments;
101101
arguments.push_back(L"/Zi");
102102
arguments.push_back(L"/Qembed_debug");
103+
arguments.push_back(L"-Werror");
103104
uint32_t space = 0;
104105
if (blob_type == ShaderBlobType::kSPIRV) {
105106
arguments.emplace_back(L"-spirv");

src/Tools/ShaderCompilerCLI/main.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ void CompileShader(const std::string& shader_name,
4646
{
4747
std::string path = output_path + "/" + shader_name + GetShaderExtension(shader_type);
4848
std::vector<uint8_t> blob = Compile(desc, shader_type);
49+
if (blob.empty()) {
50+
exit(~0);
51+
}
4952
std::fstream file(path, std::ios::out | std::ios::binary);
5053
file.write(reinterpret_cast<char*>(blob.data()), blob.size());
5154
}

0 commit comments

Comments
 (0)