workaround for T50176

This works around a long outstanding issue T50176 with cycles on msvc2015/x86 . root cause is still unknown though,feels like a game of whack'a'mole

Reviewers: sergey, dingto

Subscribers: Blendify

Tags: #cycles

Differential Revision: https://developer.blender.org/D2573
This commit is contained in:
Ray molenkamp 2017-04-25 14:17:41 -06:00
parent e91dc3a97c
commit 0f2d0ff124
Notes: blender-bot 2023-02-14 07:00:19 +01:00
Referenced by issue #51406, Ik + Stretch + High Unit Scale + Apply Scale =  incorrect results
1 changed files with 13 additions and 1 deletions

View File

@ -49,6 +49,16 @@ static float beckmann_table_slope_max()
return 6.0;
}
/* MSVC 2015 needs this ugly hack to prevent a codegen bug on x86
* see T50176 for details
*/
#if _MSC_VER==1900
# define MSVC_VOLATILE volatile
#else
# define MSVC_VOLATILE
#endif
/* Paper used: Importance Sampling Microfacet-Based BSDFs with the
* Distribution of Visible Normals. Supplemental Material 2/2.
*
@ -72,7 +82,7 @@ static void beckmann_table_rows(float *table, int row_from, int row_to)
slope_x[0] = (double)-beckmann_table_slope_max();
CDF_P22_omega_i[0] = 0;
for(int index_slope_x = 1; index_slope_x < DATA_TMP_SIZE; ++index_slope_x) {
for(MSVC_VOLATILE int index_slope_x = 1; index_slope_x < DATA_TMP_SIZE; ++index_slope_x) {
/* slope_x */
slope_x[index_slope_x] = (double)(-beckmann_table_slope_max() + 2.0f * beckmann_table_slope_max() * index_slope_x/(DATA_TMP_SIZE - 1.0f));
@ -116,6 +126,8 @@ static void beckmann_table_rows(float *table, int row_from, int row_to)
}
}
#undef MSVC_VOLATILE
static void beckmann_table_build(vector<float>& table)
{
table.resize(BECKMANN_TABLE_SIZE*BECKMANN_TABLE_SIZE);