From 4f73d3beb44ff63e7dff9ff272ecc548a7185bc1 Mon Sep 17 00:00:00 2001 From: reduz Date: Mon, 14 Feb 2022 13:27:10 +0100 Subject: Add Particle Shader Userdata * Adds optional vec4 USERDATA1 .. USERDATA6 to particles, allowing to store custom data. * This data is allocated on demand, so shaders that do not use it do not cost more. --- servers/rendering/renderer_scene_cull.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'servers/rendering/renderer_scene_cull.cpp') diff --git a/servers/rendering/renderer_scene_cull.cpp b/servers/rendering/renderer_scene_cull.cpp index 5b2be8e174..5bdc7ce600 100644 --- a/servers/rendering/renderer_scene_cull.cpp +++ b/servers/rendering/renderer_scene_cull.cpp @@ -3683,6 +3683,15 @@ void RendererSceneCull::_update_dirty_instance(Instance *p_instance) { _instance_update_mesh_instance(p_instance); } + if (p_instance->base_type == RS::INSTANCE_PARTICLES) { + // update the process material dependency + + RID particle_material = RSG::storage->particles_get_process_material(p_instance->base); + if (particle_material.is_valid()) { + RSG::storage->material_update_dependency(particle_material, &p_instance->dependency_tracker); + } + } + if ((1 << p_instance->base_type) & RS::INSTANCE_GEOMETRY_MASK) { InstanceGeometryData *geom = static_cast(p_instance->base_data); -- cgit v1.2.3