Fix #131474: Incorrect framebuffer configuration image engine overlays
When the overlay engine is used to draw over the image engine it uses incorrect framebuffer configurations. It can attach and sample both the depth buffer at the same time. This PR fixes this by separating the output framebuffer into two. One with and one without a depth buffer. And bind the correct one when needed. Pull Request: https://projects.blender.org/blender/blender/pulls/131489
This commit is contained in:
@@ -428,7 +428,7 @@ void Instance::draw_node(Manager &manager, View &view)
|
||||
{
|
||||
/* Don't clear background for the node editor. The node editor draws the background and we
|
||||
* need to mask out the image from the already drawn overlay color buffer. */
|
||||
background.draw_output(resources.overlay_output_fb, manager, view);
|
||||
background.draw_output(resources.overlay_output_color_only_fb, manager, view);
|
||||
}
|
||||
|
||||
void Instance::draw_v2d(Manager &manager, View &view)
|
||||
@@ -436,10 +436,10 @@ void Instance::draw_v2d(Manager &manager, View &view)
|
||||
image_prepass.draw_on_render(resources.render_fb, manager, view);
|
||||
regular.mesh_uvs.draw_on_render(resources.render_fb, manager, view);
|
||||
|
||||
GPU_framebuffer_bind(resources.overlay_output_fb);
|
||||
GPU_framebuffer_clear_color(resources.overlay_output_fb, float4(0.0));
|
||||
GPU_framebuffer_bind(resources.overlay_output_color_only_fb);
|
||||
GPU_framebuffer_clear_color(resources.overlay_output_color_only_fb, float4(0.0));
|
||||
|
||||
background.draw_output(resources.overlay_output_fb, manager, view);
|
||||
background.draw_output(resources.overlay_output_color_only_fb, manager, view);
|
||||
grid.draw_color_only(resources.overlay_color_only_fb, manager, view);
|
||||
regular.mesh_uvs.draw(resources.overlay_output_fb, manager, view);
|
||||
}
|
||||
@@ -569,16 +569,16 @@ void Instance::draw_v3d(Manager &manager, View &view)
|
||||
|
||||
if (state.is_depth_only_drawing == false) {
|
||||
/* Output pass. */
|
||||
GPU_framebuffer_bind(resources.overlay_output_fb);
|
||||
GPU_framebuffer_clear_color(resources.overlay_output_fb, clear_color);
|
||||
GPU_framebuffer_bind(resources.overlay_output_color_only_fb);
|
||||
GPU_framebuffer_clear_color(resources.overlay_output_color_only_fb, clear_color);
|
||||
|
||||
/* TODO(fclem): Split overlay and rename draw functions. */
|
||||
regular.cameras.draw_background_images(resources.overlay_output_fb, manager, view);
|
||||
infront.cameras.draw_background_images(resources.overlay_output_fb, manager, view);
|
||||
regular.empties.draw_background_images(resources.overlay_output_fb, manager, view);
|
||||
regular.cameras.draw_background_images(resources.overlay_output_color_only_fb, manager, view);
|
||||
infront.cameras.draw_background_images(resources.overlay_output_color_only_fb, manager, view);
|
||||
regular.empties.draw_background_images(resources.overlay_output_color_only_fb, manager, view);
|
||||
|
||||
background.draw_output(resources.overlay_output_fb, manager, view);
|
||||
anti_aliasing.draw_output(resources.overlay_output_fb, manager, view);
|
||||
background.draw_output(resources.overlay_output_color_only_fb, manager, view);
|
||||
anti_aliasing.draw_output(resources.overlay_output_color_only_fb, manager, view);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -500,6 +500,8 @@ struct Resources : public select::SelectMap {
|
||||
Framebuffer overlay_line_in_front_fb = {"overlay_line_in_front_fb"};
|
||||
|
||||
/* Output Color. */
|
||||
Framebuffer overlay_output_color_only_fb = {"overlay_output_color_only_fb"};
|
||||
/* Depth, Output Color. */
|
||||
Framebuffer overlay_output_fb = {"overlay_output_fb"};
|
||||
|
||||
/* Render Frame-buffers. Only used for multiplicative blending on top of the render. */
|
||||
@@ -649,10 +651,10 @@ struct Resources : public select::SelectMap {
|
||||
GPU_ATTACHMENT_TEXTURE(this->line_tx));
|
||||
this->overlay_color_only_fb.ensure(GPU_ATTACHMENT_NONE,
|
||||
GPU_ATTACHMENT_TEXTURE(this->overlay_tx));
|
||||
/* The v2d path writes to the overlay output directly, but it needs a depth attachment. */
|
||||
this->overlay_output_fb.ensure(state.is_space_image() ?
|
||||
GPUAttachment GPU_ATTACHMENT_TEXTURE(this->depth_tx) :
|
||||
GPUAttachment GPU_ATTACHMENT_NONE,
|
||||
|
||||
this->overlay_output_color_only_fb.ensure(GPU_ATTACHMENT_NONE,
|
||||
GPU_ATTACHMENT_TEXTURE(this->color_overlay_tx));
|
||||
this->overlay_output_fb.ensure(GPU_ATTACHMENT_TEXTURE(this->depth_tx),
|
||||
GPU_ATTACHMENT_TEXTURE(this->color_overlay_tx));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user