The shader id generated by the manager contains some special flags in high bits, leading to out-of-range index if used directly. This must use the SHADER_MASK to get actual array index.

This commit is contained in:
Lukas Toenne 2012-09-03 18:50:59 +00:00
parent 192935eb04
commit 9b30e8d83a

@ -102,7 +102,7 @@ void OSLShaderManager::device_update(Device *device, DeviceScene *dscene, Scene
/* setup shader engine */
og->ss = ss;
int background_id = scene->shader_manager->get_shader_id(scene->default_background);
og->background_state = og->surface_state[background_id];
og->background_state = og->surface_state[background_id & SHADER_MASK];
og->use = true;
tls_create(OSLGlobals::ThreadData, og->thread_data);