Skip to content

Commit 8a5136e

Browse files
committed
Adjust for for loop
1 parent fae57c5 commit 8a5136e

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

generators/generate_block_gpu_task.cpp

+7-4
Original file line numberDiff line numberDiff line change
@@ -151,16 +151,16 @@ void GenerateBlockGPUTask::prepare(GPUTaskContext &ctx) {
151151
// Note, this internally locks RenderingDeviceVulkan's class mutex. Which means it could perhaps be used outside
152152
// of the compute list (which already locks the class mutex until it ends). Thankfully, it uses a recursive
153153
// Mutex (instead of BinaryMutex)
154-
_generator_uniform_set =
155-
zylann::godot::uniform_set_create(rd, generator_uniforms, generator_shader_rid, 0);
154+
const RID generator_uniform_set = zylann::godot::uniform_set_create(rd, generator_uniforms, generator_shader_rid, 0);
155+
_generator_uniform_sets.push_back(generator_uniform_set);
156156

157157
{
158158
ZN_PROFILE_SCOPE_NAMED("compute_list_bind_compute_pipeline");
159159
rd.compute_list_bind_compute_pipeline(compute_list_id, _generator_pipeline_rid);
160160
}
161161
{
162162
ZN_PROFILE_SCOPE_NAMED("compute_list_bind_uniform_set");
163-
rd.compute_list_bind_uniform_set(compute_list_id, _generator_uniform_set, 0);
163+
rd.compute_list_bind_uniform_set(compute_list_id, generator_uniform_set, 0);
164164
}
165165

166166
const Box3i &box = boxes_to_generate[box_index];
@@ -464,7 +464,10 @@ void GenerateBlockGPUTask::collect(GPUTaskContext &ctx) {
464464
}
465465

466466
zylann::godot::free_rendering_device_rid(rd, _generator_pipeline_rid);
467-
zylann::godot::free_rendering_device_rid(rd, _generator_uniform_set);
467+
468+
for (RID rid : _generator_uniform_sets) {
469+
zylann::godot::free_rendering_device_rid(rd, rid);
470+
}
468471

469472
for (RID rid : _modifier_pipelines) {
470473
zylann::godot::free_rendering_device_rid(rd, rid);

generators/generate_block_gpu_task.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class GenerateBlockGPUTask : public IGPUTask {
8383

8484
StdVector<BoxData> _boxes_data;
8585
RID _generator_pipeline_rid;
86-
RID _generator_uniform_set;
86+
StdVector<RID> _generator_uniform_sets;
8787
StdVector<RID> _modifier_pipelines;
8888
};
8989

0 commit comments

Comments
 (0)