Skip to content

Commit

Permalink
Added fragment shader input check
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardodoria committed Jan 22, 2024
1 parent 9ae953c commit 985f24a
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/spirvcross.cc
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,22 @@ bool validate_inputs_and_outputs(std::vector<spirvcross_t>& spirvcrossvec, const
}
}

for (int i = 0; i < spirvcrossvec[fsIndex].inputs.size(); i++){
bool found = false;
supershader::s_attr_t input = spirvcrossvec[fsIndex].inputs[i];
for (int o = 0; o < spirvcrossvec[vsIndex].outputs.size(); o++){
supershader::s_attr_t output = spirvcrossvec[vsIndex].outputs[o];
if (output.name == input.name && output.type == input.type){
found = true;
}
}

if (!found){
fprintf(stderr, "%s, %s: fragment shader input '%s' does not exist in vertex shader outputs\n", inputs[vsIndex].filename.c_str(), inputs[fsIndex].filename.c_str(), input.name.c_str());
return false;
}
}

return true;
}

Expand Down

0 comments on commit 985f24a

Please sign in to comment.