Use MSAA 2D texture in multipass tonemapper
This commit is contained in:
parent
2f34a35722
commit
903aa0e385
3 changed files with 17 additions and 3 deletions
|
@ -271,7 +271,12 @@ RID RenderForwardMobile::RenderBufferDataForwardMobile::get_color_fbs(Framebuffe
|
|||
// - add blit to 2D pass
|
||||
RID render_target = render_buffers->get_render_target();
|
||||
ERR_FAIL_COND_V(render_target.is_null(), RID());
|
||||
RID target_buffer = texture_storage->render_target_get_rd_texture(render_target);
|
||||
RID target_buffer;
|
||||
if (texture_storage->render_target_get_msaa(render_target) == RS::VIEWPORT_MSAA_DISABLED) {
|
||||
target_buffer = texture_storage->render_target_get_rd_texture(render_target);
|
||||
} else {
|
||||
target_buffer = texture_storage->render_target_get_rd_texture_msaa(render_target);
|
||||
}
|
||||
ERR_FAIL_COND_V(target_buffer.is_null(), RID());
|
||||
|
||||
int target_buffer_id = textures.size();
|
||||
|
@ -742,14 +747,15 @@ void RenderForwardMobile::_render_scene(RenderDataRD *p_render_data, const Color
|
|||
}
|
||||
|
||||
// We do this last because our get_color_fbs creates and caches the framebuffer if we need it.
|
||||
if (using_subpass_post_process && rb_data->get_color_fbs(RenderBufferDataForwardMobile::FB_CONFIG_FOUR_SUBPASSES).is_null()) {
|
||||
RID four_subpasses = rb_data->get_color_fbs(RenderBufferDataForwardMobile::FB_CONFIG_FOUR_SUBPASSES);
|
||||
if (using_subpass_post_process && four_subpasses.is_null()) {
|
||||
// can't do blit subpass because we don't have all subpasses
|
||||
using_subpass_post_process = false;
|
||||
}
|
||||
|
||||
if (using_subpass_post_process) {
|
||||
// all as subpasses
|
||||
framebuffer = rb_data->get_color_fbs(RenderBufferDataForwardMobile::FB_CONFIG_FOUR_SUBPASSES);
|
||||
framebuffer = four_subpasses;
|
||||
} else if (using_subpass_transparent) {
|
||||
// our tonemap pass is separate
|
||||
framebuffer = rb_data->get_color_fbs(RenderBufferDataForwardMobile::FB_CONFIG_THREE_SUBPASSES);
|
||||
|
|
|
@ -2907,6 +2907,13 @@ RID TextureStorage::render_target_get_rd_texture_slice(RID p_render_target, uint
|
|||
}
|
||||
}
|
||||
|
||||
RID TextureStorage::render_target_get_rd_texture_msaa(RID p_render_target) {
|
||||
RenderTarget *rt = render_target_owner.get_or_null(p_render_target);
|
||||
ERR_FAIL_COND_V(!rt, RID());
|
||||
|
||||
return rt->color_multisample;
|
||||
}
|
||||
|
||||
RID TextureStorage::render_target_get_rd_backbuffer(RID p_render_target) {
|
||||
RenderTarget *rt = render_target_owner.get_or_null(p_render_target);
|
||||
ERR_FAIL_COND_V(!rt, RID());
|
||||
|
|
|
@ -741,6 +741,7 @@ public:
|
|||
RID render_target_get_rd_framebuffer(RID p_render_target);
|
||||
RID render_target_get_rd_texture(RID p_render_target);
|
||||
RID render_target_get_rd_texture_slice(RID p_render_target, uint32_t p_layer);
|
||||
RID render_target_get_rd_texture_msaa(RID p_render_target);
|
||||
RID render_target_get_rd_backbuffer(RID p_render_target);
|
||||
RID render_target_get_rd_backbuffer_framebuffer(RID p_render_target);
|
||||
|
||||
|
|
Loading…
Reference in a new issue