@@ -96,7 +96,7 @@ CopyEffects::CopyEffects(bool p_prefer_raster_effects) {
9696
9797 for (int i = 0 ; i < COPY_MODE_MAX; i++) {
9898 if (copy.shader .is_variant_enabled (i)) {
99- copy.pipelines [i] = RD::get_singleton ()-> compute_pipeline_create (copy.shader .version_get_shader (copy.shader_version , i));
99+ copy.pipelines [i]. create_compute_pipeline (copy.shader .version_get_shader (copy.shader_version , i));
100100 }
101101 }
102102 }
@@ -162,7 +162,7 @@ CopyEffects::CopyEffects(bool p_prefer_raster_effects) {
162162
163163 cubemap_downsampler.shader_version = cubemap_downsampler.compute_shader .version_create ();
164164
165- cubemap_downsampler.compute_pipeline = RD::get_singleton ()-> compute_pipeline_create (cubemap_downsampler.compute_shader .version_get_shader (cubemap_downsampler.shader_version , 0 ));
165+ cubemap_downsampler.compute_pipeline . create_compute_pipeline (cubemap_downsampler.compute_shader .version_get_shader (cubemap_downsampler.shader_version , 0 ));
166166 cubemap_downsampler.raster_pipeline .clear ();
167167 }
168168 }
@@ -216,7 +216,7 @@ CopyEffects::CopyEffects(bool p_prefer_raster_effects) {
216216 filter.shader_version = filter.compute_shader .version_create ();
217217
218218 for (int i = 0 ; i < FILTER_MODE_MAX; i++) {
219- filter.compute_pipelines [i] = RD::get_singleton ()-> compute_pipeline_create (filter.compute_shader .version_get_shader (filter.shader_version , i));
219+ filter.compute_pipelines [i]. create_compute_pipeline (filter.compute_shader .version_get_shader (filter.shader_version , i));
220220 filter.raster_pipelines [i].clear ();
221221 }
222222
@@ -249,7 +249,7 @@ CopyEffects::CopyEffects(bool p_prefer_raster_effects) {
249249
250250 roughness.shader_version = roughness.compute_shader .version_create ();
251251
252- roughness.compute_pipeline = RD::get_singleton ()-> compute_pipeline_create (roughness.compute_shader .version_get_shader (roughness.shader_version , 0 ));
252+ roughness.compute_pipeline . create_compute_pipeline (roughness.compute_shader .version_get_shader (roughness.shader_version , 0 ));
253253 roughness.raster_pipeline .clear ();
254254 }
255255 }
@@ -306,6 +306,17 @@ CopyEffects::CopyEffects(bool p_prefer_raster_effects) {
306306}
307307
308308CopyEffects::~CopyEffects () {
309+ for (int i = 0 ; i < COPY_MODE_MAX; i++) {
310+ copy.pipelines [i].free ();
311+ }
312+
313+ for (int i = 0 ; i < FILTER_MODE_MAX; i++) {
314+ filter.compute_pipelines [i].free ();
315+ }
316+
317+ cubemap_downsampler.compute_pipeline .free ();
318+ roughness.compute_pipeline .free ();
319+
309320 if (prefer_raster_effects) {
310321 blur_raster.shader .version_free (blur_raster.shader_version );
311322 cubemap_downsampler.raster_shader .version_free (cubemap_downsampler.shader_version );
@@ -377,7 +388,7 @@ void CopyEffects::copy_to_rect(RID p_source_rd_texture, RID p_dest_texture, cons
377388 ERR_FAIL_COND (shader.is_null ());
378389
379390 RD::ComputeListID compute_list = RD::get_singleton ()->compute_list_begin ();
380- RD::get_singleton ()->compute_list_bind_compute_pipeline (compute_list, copy.pipelines [mode]);
391+ RD::get_singleton ()->compute_list_bind_compute_pipeline (compute_list, copy.pipelines [mode]. get_rid () );
381392 RD::get_singleton ()->compute_list_bind_uniform_set (compute_list, uniform_set_cache->get_cache (shader, 0 , u_source_rd_texture), 0 );
382393 RD::get_singleton ()->compute_list_bind_uniform_set (compute_list, uniform_set_cache->get_cache (shader, 3 , u_dest_texture), 3 );
383394 RD::get_singleton ()->compute_list_set_push_constant (compute_list, ©.push_constant , sizeof (CopyPushConstant));
@@ -412,7 +423,7 @@ void CopyEffects::copy_cubemap_to_panorama(RID p_source_cube, RID p_dest_panoram
412423 ERR_FAIL_COND (shader.is_null ());
413424
414425 RD::ComputeListID compute_list = RD::get_singleton ()->compute_list_begin ();
415- RD::get_singleton ()->compute_list_bind_compute_pipeline (compute_list, copy.pipelines [mode]);
426+ RD::get_singleton ()->compute_list_bind_compute_pipeline (compute_list, copy.pipelines [mode]. get_rid () );
416427 RD::get_singleton ()->compute_list_bind_uniform_set (compute_list, uniform_set_cache->get_cache (shader, 0 , u_source_cube), 0 );
417428 RD::get_singleton ()->compute_list_bind_uniform_set (compute_list, uniform_set_cache->get_cache (shader, 3 , u_dest_panorama), 3 );
418429 RD::get_singleton ()->compute_list_set_push_constant (compute_list, ©.push_constant , sizeof (CopyPushConstant));
@@ -449,7 +460,7 @@ void CopyEffects::copy_depth_to_rect(RID p_source_rd_texture, RID p_dest_texture
449460 ERR_FAIL_COND (shader.is_null ());
450461
451462 RD::ComputeListID compute_list = RD::get_singleton ()->compute_list_begin ();
452- RD::get_singleton ()->compute_list_bind_compute_pipeline (compute_list, copy.pipelines [mode]);
463+ RD::get_singleton ()->compute_list_bind_compute_pipeline (compute_list, copy.pipelines [mode]. get_rid () );
453464 RD::get_singleton ()->compute_list_bind_uniform_set (compute_list, uniform_set_cache->get_cache (shader, 0 , u_source_rd_texture), 0 );
454465 RD::get_singleton ()->compute_list_bind_uniform_set (compute_list, uniform_set_cache->get_cache (shader, 3 , u_dest_texture), 3 );
455466 RD::get_singleton ()->compute_list_set_push_constant (compute_list, ©.push_constant , sizeof (CopyPushConstant));
@@ -488,7 +499,7 @@ void CopyEffects::copy_depth_to_rect_and_linearize(RID p_source_rd_texture, RID
488499 ERR_FAIL_COND (shader.is_null ());
489500
490501 RD::ComputeListID compute_list = RD::get_singleton ()->compute_list_begin ();
491- RD::get_singleton ()->compute_list_bind_compute_pipeline (compute_list, copy.pipelines [mode]);
502+ RD::get_singleton ()->compute_list_bind_compute_pipeline (compute_list, copy.pipelines [mode]. get_rid () );
492503 RD::get_singleton ()->compute_list_bind_uniform_set (compute_list, uniform_set_cache->get_cache (shader, 0 , u_source_rd_texture), 0 );
493504 RD::get_singleton ()->compute_list_bind_uniform_set (compute_list, uniform_set_cache->get_cache (shader, 3 , u_dest_texture), 3 );
494505 RD::get_singleton ()->compute_list_set_push_constant (compute_list, ©.push_constant , sizeof (CopyPushConstant));
@@ -695,7 +706,7 @@ void CopyEffects::gaussian_blur(RID p_source_rd_texture, RID p_texture, const Re
695706 ERR_FAIL_COND (shader.is_null ());
696707
697708 RD::DrawListID compute_list = RD::get_singleton ()->compute_list_begin ();
698- RD::get_singleton ()->compute_list_bind_compute_pipeline (compute_list, copy.pipelines [mode]);
709+ RD::get_singleton ()->compute_list_bind_compute_pipeline (compute_list, copy.pipelines [mode]. get_rid () );
699710 RD::get_singleton ()->compute_list_bind_uniform_set (compute_list, uniform_set_cache->get_cache (shader, 0 , u_source_rd_texture), 0 );
700711 RD::get_singleton ()->compute_list_bind_uniform_set (compute_list, uniform_set_cache->get_cache (shader, 3 , u_texture), 3 );
701712
@@ -777,7 +788,7 @@ void CopyEffects::gaussian_glow(RID p_source_rd_texture, RID p_back_texture, con
777788 ERR_FAIL_COND (shader.is_null ());
778789
779790 RD::ComputeListID compute_list = RD::get_singleton ()->compute_list_begin ();
780- RD::get_singleton ()->compute_list_bind_compute_pipeline (compute_list, copy.pipelines [copy_mode]);
791+ RD::get_singleton ()->compute_list_bind_compute_pipeline (compute_list, copy.pipelines [copy_mode]. get_rid () );
781792 RD::get_singleton ()->compute_list_bind_uniform_set (compute_list, uniform_set_cache->get_cache (shader, 0 , u_source_rd_texture), 0 );
782793 RD::get_singleton ()->compute_list_bind_uniform_set (compute_list, uniform_set_cache->get_cache (shader, 3 , u_back_texture), 3 );
783794 if (p_auto_exposure.is_valid () && p_first_pass) {
@@ -890,7 +901,7 @@ void CopyEffects::make_mipmap(RID p_source_rd_texture, RID p_dest_texture, const
890901 ERR_FAIL_COND (shader.is_null ());
891902
892903 RD::ComputeListID compute_list = RD::get_singleton ()->compute_list_begin ();
893- RD::get_singleton ()->compute_list_bind_compute_pipeline (compute_list, copy.pipelines [mode]);
904+ RD::get_singleton ()->compute_list_bind_compute_pipeline (compute_list, copy.pipelines [mode]. get_rid () );
894905 RD::get_singleton ()->compute_list_bind_uniform_set (compute_list, uniform_set_cache->get_cache (shader, 0 , u_source_rd_texture), 0 );
895906 RD::get_singleton ()->compute_list_bind_uniform_set (compute_list, uniform_set_cache->get_cache (shader, 3 , u_dest_texture), 3 );
896907 RD::get_singleton ()->compute_list_set_push_constant (compute_list, ©.push_constant , sizeof (CopyPushConstant));
@@ -959,7 +970,7 @@ void CopyEffects::set_color(RID p_dest_texture, const Color &p_color, const Rect
959970 ERR_FAIL_COND (shader.is_null ());
960971
961972 RD::ComputeListID compute_list = RD::get_singleton ()->compute_list_begin ();
962- RD::get_singleton ()->compute_list_bind_compute_pipeline (compute_list, copy.pipelines [mode]);
973+ RD::get_singleton ()->compute_list_bind_compute_pipeline (compute_list, copy.pipelines [mode]. get_rid () );
963974 RD::get_singleton ()->compute_list_bind_uniform_set (compute_list, uniform_set_cache->get_cache (shader, 3 , u_dest_texture), 3 );
964975 RD::get_singleton ()->compute_list_set_push_constant (compute_list, ©.push_constant , sizeof (CopyPushConstant));
965976 RD::get_singleton ()->compute_list_dispatch_threads (compute_list, p_region.size .width , p_region.size .height , 1 );
@@ -1056,7 +1067,7 @@ void CopyEffects::cubemap_downsample(RID p_source_cubemap, RID p_dest_cubemap, c
10561067 ERR_FAIL_COND (shader.is_null ());
10571068
10581069 RD::ComputeListID compute_list = RD::get_singleton ()->compute_list_begin ();
1059- RD::get_singleton ()->compute_list_bind_compute_pipeline (compute_list, cubemap_downsampler.compute_pipeline );
1070+ RD::get_singleton ()->compute_list_bind_compute_pipeline (compute_list, cubemap_downsampler.compute_pipeline . get_rid () );
10601071 RD::get_singleton ()->compute_list_bind_uniform_set (compute_list, uniform_set_cache->get_cache (shader, 0 , u_source_cubemap), 0 );
10611072 RD::get_singleton ()->compute_list_bind_uniform_set (compute_list, uniform_set_cache->get_cache (shader, 1 , u_dest_cubemap), 1 );
10621073
@@ -1133,7 +1144,7 @@ void CopyEffects::cubemap_filter(RID p_source_cubemap, Vector<RID> p_dest_cubema
11331144 ERR_FAIL_COND (shader.is_null ());
11341145
11351146 RD::ComputeListID compute_list = RD::get_singleton ()->compute_list_begin ();
1136- RD::get_singleton ()->compute_list_bind_compute_pipeline (compute_list, filter.compute_pipelines [mode]);
1147+ RD::get_singleton ()->compute_list_bind_compute_pipeline (compute_list, filter.compute_pipelines [mode]. get_rid () );
11371148 RD::get_singleton ()->compute_list_bind_uniform_set (compute_list, uniform_set_cache->get_cache (shader, 0 , u_source_cubemap), 0 );
11381149 RD::get_singleton ()->compute_list_bind_uniform_set (compute_list, filter.uniform_set , 1 );
11391150 RD::get_singleton ()->compute_list_bind_uniform_set (compute_list, filter.image_uniform_set , 2 );
@@ -1207,7 +1218,7 @@ void CopyEffects::cubemap_roughness(RID p_source_rd_texture, RID p_dest_texture,
12071218 ERR_FAIL_COND (shader.is_null ());
12081219
12091220 RD::ComputeListID compute_list = RD::get_singleton ()->compute_list_begin ();
1210- RD::get_singleton ()->compute_list_bind_compute_pipeline (compute_list, roughness.compute_pipeline );
1221+ RD::get_singleton ()->compute_list_bind_compute_pipeline (compute_list, roughness.compute_pipeline . get_rid () );
12111222
12121223 RD::get_singleton ()->compute_list_bind_uniform_set (compute_list, uniform_set_cache->get_cache (shader, 0 , u_source_rd_texture), 0 );
12131224 RD::get_singleton ()->compute_list_bind_uniform_set (compute_list, uniform_set_cache->get_cache (shader, 1 , u_dest_texture), 1 );
0 commit comments