Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/gpu/shaders/material/gpu_shader_material_attribute.glsl')
-rw-r--r--source/blender/gpu/shaders/material/gpu_shader_material_attribute.glsl25
1 files changed, 25 insertions, 0 deletions
diff --git a/source/blender/gpu/shaders/material/gpu_shader_material_attribute.glsl b/source/blender/gpu/shaders/material/gpu_shader_material_attribute.glsl
index bacf089deb1..8d0016a2206 100644
--- a/source/blender/gpu/shaders/material/gpu_shader_material_attribute.glsl
+++ b/source/blender/gpu/shaders/material/gpu_shader_material_attribute.glsl
@@ -29,6 +29,31 @@ void node_attribute_uniform(vec4 attr, const float attr_hash, out vec4 out_attr)
out_attr = attr_load_uniform(attr, floatBitsToUint(attr_hash));
}
+vec4 attr_load_layer(const uint attr_hash)
+{
+#ifdef VLATTR_LIB
+ /* The first record of the buffer stores the length. */
+ uint left = 0, right = drw_layer_attrs[0].buffer_length;
+
+ while (left < right) {
+ uint mid = (left + right) / 2;
+ uint hash = drw_layer_attrs[mid].hash_code;
+
+ if (hash < attr_hash) {
+ left = mid + 1;
+ }
+ else if (hash > attr_hash) {
+ right = mid;
+ }
+ else {
+ return drw_layer_attrs[mid].data;
+ }
+ }
+#endif
+
+ return vec4(0.0);
+}
+
void node_attribute(
vec4 attr, out vec4 outcol, out vec3 outvec, out float outf, out float outalpha)
{