Fix T47668: Cycles OpenCL glass not rendering correctly on AMD.

Work around what appears to be a compiler bug.
This commit is contained in:
Brecht Van Lommel 2016-03-26 23:44:30 +01:00
parent 9317f9c055
commit 273740006e
Notes: blender-bot 2023-02-14 09:24:53 +01:00
Referenced by issue #47668, Regression - OpenCL - some shaders don't render correctly
1 changed files with 5 additions and 3 deletions

View File

@ -259,6 +259,8 @@ ccl_device void svm_node_closure_bsdf(KernelGlobals *kg, ShaderData *sd, float *
break;
}
#endif
int num_closure = ccl_fetch(sd, num_closure);
/* index of refraction */
float eta = fmaxf(param2, 1e-5f);
eta = (ccl_fetch(sd, flag) & SD_BACKFACING)? 1.0f/eta: eta;
@ -269,7 +271,7 @@ ccl_device void svm_node_closure_bsdf(KernelGlobals *kg, ShaderData *sd, float *
float roughness = param1;
/* reflection */
ShaderClosure *sc = ccl_fetch_array(sd, closure, ccl_fetch(sd, num_closure));
ShaderClosure *sc = ccl_fetch_array(sd, closure, num_closure);
float3 weight = sc->weight;
float sample_weight = sc->sample_weight;
@ -290,8 +292,8 @@ ccl_device void svm_node_closure_bsdf(KernelGlobals *kg, ShaderData *sd, float *
#endif
/* refraction */
if(ccl_fetch(sd, num_closure) < MAX_CLOSURE) {
sc = ccl_fetch_array(sd, closure, ccl_fetch(sd, num_closure));
if(num_closure + 1 < MAX_CLOSURE) {
sc = ccl_fetch_array(sd, closure, num_closure + 1);
sc->weight = weight;
sc->sample_weight = sample_weight;