You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-12-31 18:41:20 +00:00
Free octmap pipelines before freeing shaders and check pipeline validity before freeing pipelines in PipelineDeferredRD
This commit is contained in:
@@ -324,10 +324,6 @@ CopyEffects::~CopyEffects() {
|
||||
copy.pipelines[i].free();
|
||||
}
|
||||
|
||||
for (int i = 0; i < FILTER_MODE_MAX; i++) {
|
||||
filter.compute_pipelines[i].free();
|
||||
}
|
||||
|
||||
if (raster_effects.has_flag(RASTER_EFFECT_GAUSSIAN_BLUR)) {
|
||||
blur_raster.shader.version_free(blur_raster.shader_version);
|
||||
RD::get_singleton()->free_rid(blur_raster.glow_sampler);
|
||||
@@ -338,8 +334,19 @@ CopyEffects::~CopyEffects() {
|
||||
filter.raster_shader.version_free(filter.shader_version);
|
||||
roughness.raster_shader.version_free(roughness.shader_version);
|
||||
} else {
|
||||
// PipelineDeferredRD always needs to be freed before its corresponding shader since the pipeline may not have finished compiling before the shader is freed. This
|
||||
// ensures that we wait on the pipeline compilation before we free it.
|
||||
for (int i = 0; i < DOWNSAMPLER_MODE_MAX; i++) {
|
||||
octmap_downsampler.compute_pipelines[i].free();
|
||||
}
|
||||
octmap_downsampler.compute_shader.version_free(octmap_downsampler.shader_version);
|
||||
|
||||
for (int i = 0; i < FILTER_MODE_MAX; i++) {
|
||||
filter.compute_pipelines[i].free();
|
||||
}
|
||||
filter.compute_shader.version_free(filter.shader_version);
|
||||
|
||||
roughness.compute_pipeline.free();
|
||||
roughness.compute_shader.version_free(roughness.shader_version);
|
||||
}
|
||||
|
||||
|
||||
@@ -82,7 +82,9 @@ public:
|
||||
}
|
||||
|
||||
~PipelineDeferredRD() {
|
||||
free();
|
||||
#ifdef DEV_ENABLED
|
||||
ERR_FAIL_COND_MSG(pipeline.is_valid(), "'free()' must be called manually before deconstruction and before the corresponding shader is freed.");
|
||||
#endif
|
||||
}
|
||||
|
||||
void create_render_pipeline(RID p_shader, RD::FramebufferFormatID p_framebuffer_format, RD::VertexFormatID p_vertex_format, RD::RenderPrimitive p_render_primitive, const RD::PipelineRasterizationState &p_rasterization_state, const RD::PipelineMultisampleState &p_multisample_state, const RD::PipelineDepthStencilState &p_depth_stencil_state, const RD::PipelineColorBlendState &p_blend_state, BitField<RD::PipelineDynamicStateFlags> p_dynamic_state_flags = 0, uint32_t p_for_render_pass = 0, const Vector<RD::PipelineSpecializationConstant> &p_specialization_constants = Vector<RD::PipelineSpecializationConstant>()) {
|
||||
@@ -119,6 +121,9 @@ public:
|
||||
_wait();
|
||||
|
||||
if (pipeline.is_valid()) {
|
||||
#ifdef DEV_ENABLED
|
||||
ERR_FAIL_COND_MSG(!(RD::get_singleton()->render_pipeline_is_valid(pipeline) || RD::get_singleton()->compute_pipeline_is_valid(pipeline)), "`free()` must be called manually before the dependent shader is freed.");
|
||||
#endif
|
||||
RD::get_singleton()->free_rid(pipeline);
|
||||
pipeline = RID();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user