You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-12-02 16:48:55 +00:00
Fix clear color being incorrect in Environment background with HDR 2D.
This commit is contained in:
@@ -2276,6 +2276,9 @@ void RendererCanvasRenderRD::_render_batch_items(RenderTarget p_to_render_target
|
||||
if (texture_storage->render_target_is_clear_requested(p_to_render_target.render_target)) {
|
||||
clear = true;
|
||||
clear_color = texture_storage->render_target_get_clear_request_color(p_to_render_target.render_target);
|
||||
if (texture_storage->render_target_is_using_hdr(p_to_render_target.render_target)) {
|
||||
clear_color = clear_color.srgb_to_linear();
|
||||
}
|
||||
texture_storage->render_target_disable_clear_request(p_to_render_target.render_target);
|
||||
}
|
||||
// TODO: Obtain from framebuffer format eventually when this is implemented.
|
||||
|
||||
@@ -219,6 +219,8 @@ void RendererCompositorRD::set_boot_image_with_stretch(const Ref<Image> &p_image
|
||||
screenrect.position /= window_size;
|
||||
screenrect.size /= window_size;
|
||||
|
||||
// p_color never needs to be converted to linear encoding because HDR 2D is always disabled for the boot image.
|
||||
// If HDR 2D can ever be enabled during the boot image, p_color must be converted to linear encoding for this case.
|
||||
RD::DrawListID draw_list = RD::get_singleton()->draw_list_begin_for_screen(DisplayServer::MAIN_WINDOW_ID, p_color);
|
||||
|
||||
RD::get_singleton()->draw_list_bind_render_pipeline(draw_list, blit.pipelines[BLIT_MODE_NORMAL_ALPHA]);
|
||||
|
||||
@@ -4029,7 +4029,7 @@ bool TextureStorage::render_target_is_clear_requested(RID p_render_target) {
|
||||
Color TextureStorage::render_target_get_clear_request_color(RID p_render_target) {
|
||||
RenderTarget *rt = render_target_owner.get_or_null(p_render_target);
|
||||
ERR_FAIL_NULL_V(rt, Color());
|
||||
return rt->use_hdr ? rt->clear_color.srgb_to_linear() : rt->clear_color;
|
||||
return rt->clear_color;
|
||||
}
|
||||
|
||||
void TextureStorage::render_target_disable_clear_request(RID p_render_target) {
|
||||
|
||||
@@ -1366,7 +1366,13 @@ public:
|
||||
DRAW_IGNORE_ALL = DRAW_IGNORE_COLOR_ALL | DRAW_IGNORE_DEPTH | DRAW_IGNORE_STENCIL
|
||||
};
|
||||
|
||||
/**
|
||||
* @param p_clear_color Must use linear encoding when HDR 2D is active.
|
||||
*/
|
||||
DrawListID draw_list_begin_for_screen(DisplayServer::WindowID p_screen = 0, const Color &p_clear_color = Color());
|
||||
/**
|
||||
* @param p_clear_color_values Color values must use linear encoding when HDR 2D is active.
|
||||
*/
|
||||
DrawListID draw_list_begin(RID p_framebuffer, BitField<DrawFlags> p_draw_flags = DRAW_DEFAULT_ALL, VectorView<Color> p_clear_color_values = VectorView<Color>(), float p_clear_depth_value = 1.0f, uint32_t p_clear_stencil_value = 0, const Rect2 &p_region = Rect2(), uint32_t p_breadcrumb = 0);
|
||||
DrawListID _draw_list_begin_bind(RID p_framebuffer, BitField<DrawFlags> p_draw_flags = DRAW_DEFAULT_ALL, const Vector<Color> &p_clear_color_values = Vector<Color>(), float p_clear_depth_value = 1.0f, uint32_t p_clear_stencil_value = 0, const Rect2 &p_region = Rect2(), uint32_t p_breadcrumb = 0);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user