Sort loop variables to make sure Travis CI runs are reproducable.

This commit is contained in:
Hans-Kristian Arntzen 2016-12-16 14:01:09 +01:00
parent 45c797d54c
commit 44b3216611
2 changed files with 4 additions and 1 deletions

View File

@ -11,7 +11,7 @@ void main()
{
FragColor += 10;
}
for (mediump int j = 4, i_1 = 1; i_1 < 30; i_1++, j += 4)
for (mediump int i_1 = 1, j = 4; i_1 < 30; i_1++, j += 4)
{
FragColor += 11;
}

View File

@ -3025,6 +3025,9 @@ void Compiler::analyze_variable_scope(SPIRFunction &entry)
// We have a loop variable.
header_block.loop_variables.push_back(loop_variable.first);
// Need to sort here as variables come from an unordered container, and pushing stuff in wrong order
// will break reproducability in regression runs.
sort(begin(header_block.loop_variables), end(header_block.loop_variables));
get<SPIRVariable>(loop_variable.first).loop_variable = true;
}
}