diff options
Diffstat (limited to 'source/blender/draw/engines/eevee_next/shaders/eevee_nodetree_lib.glsl')
-rw-r--r-- | source/blender/draw/engines/eevee_next/shaders/eevee_nodetree_lib.glsl | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/source/blender/draw/engines/eevee_next/shaders/eevee_nodetree_lib.glsl b/source/blender/draw/engines/eevee_next/shaders/eevee_nodetree_lib.glsl index 491e15341f9..dd047709afd 100644 --- a/source/blender/draw/engines/eevee_next/shaders/eevee_nodetree_lib.glsl +++ b/source/blender/draw/engines/eevee_next/shaders/eevee_nodetree_lib.glsl @@ -411,7 +411,7 @@ vec4 attr_load_color_post(vec4 attr) /** \} */ /* -------------------------------------------------------------------- */ -/** \name Volume Attribute post +/** \name Uniform Attributes * * TODO(@fclem): These implementation details should concern the DRWManager and not be a fix on * the engine side. But as of now, the engines are responsible for loading the attributes. @@ -420,15 +420,20 @@ vec4 attr_load_color_post(vec4 attr) vec4 attr_load_uniform(vec4 attr, const uint attr_hash) { -#if defined(OBINFO_LIB) && defined(OBATTR_LIB) - for (int i = ObjectAttributeStart; i < ObjectAttributeLen; i++) { - if (drw_attrs[i].hash_code == attr_hash) { - return vec4( - drw_attrs[i].data_x, drw_attrs[i].data_y, drw_attrs[i].data_z, drw_attrs[i].data_w); +#if defined(OBATTR_LIB) + uint index = floatBitsToUint(ObjectAttributeStart); + for (uint i = 0; i < floatBitsToUint(ObjectAttributeLen); i++, index++) { + if (drw_attrs[index].hash_code == attr_hash) { + return vec4(drw_attrs[index].data_x, + drw_attrs[index].data_y, + drw_attrs[index].data_z, + drw_attrs[index].data_w); } } -#endif + return vec4(0.0); +#else return attr; +#endif } /** \} */ |