You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
Add option to enable HDR rendering in 2D
This is needed to allow 2D to fully make use of 3D effects (e.g. glow), and can be used to substantially improve quality of 2D rendering at the cost of performance Additionally, the 2D rendering pipeline is done in linear space (we skip linear_to_srgb conversion in 3D tonemapping) so the entire Viewport can be kept linear. This is necessary for proper HDR screen support in the future.
This commit is contained in:
@@ -81,6 +81,7 @@ void RendererCompositorRD::blit_render_targets_to_screen(DisplayServer::WindowID
|
||||
blit.push_constant.k2 = p_render_targets[i].lens_distortion.k2;
|
||||
blit.push_constant.upscale = p_render_targets[i].lens_distortion.upscale;
|
||||
blit.push_constant.aspect_ratio = p_render_targets[i].lens_distortion.aspect_ratio;
|
||||
blit.push_constant.convert_to_srgb = texture_storage->render_target_is_using_hdr(p_render_targets[i].render_target);
|
||||
|
||||
RD::get_singleton()->draw_list_set_push_constant(draw_list, &blit.push_constant, sizeof(BlitPushConstant));
|
||||
RD::get_singleton()->draw_list_draw(draw_list, true);
|
||||
@@ -171,7 +172,7 @@ void RendererCompositorRD::set_boot_image(const Ref<Image> &p_image, const Color
|
||||
|
||||
RID texture = texture_storage->texture_allocate();
|
||||
texture_storage->texture_2d_initialize(texture, p_image);
|
||||
RID rd_texture = texture_storage->texture_get_rd_texture(texture);
|
||||
RID rd_texture = texture_storage->texture_get_rd_texture(texture, false);
|
||||
|
||||
RD::SamplerState sampler_state;
|
||||
sampler_state.min_filter = p_use_filter ? RD::SAMPLER_FILTER_LINEAR : RD::SAMPLER_FILTER_NEAREST;
|
||||
@@ -237,6 +238,7 @@ void RendererCompositorRD::set_boot_image(const Ref<Image> &p_image, const Color
|
||||
blit.push_constant.k2 = 0;
|
||||
blit.push_constant.upscale = 1.0;
|
||||
blit.push_constant.aspect_ratio = 1.0;
|
||||
blit.push_constant.convert_to_srgb = false;
|
||||
|
||||
RD::get_singleton()->draw_list_set_push_constant(draw_list, &blit.push_constant, sizeof(BlitPushConstant));
|
||||
RD::get_singleton()->draw_list_draw(draw_list, true);
|
||||
|
||||
Reference in New Issue
Block a user