mirror of
https://github.com/godotengine/godot.git
synced 2025-01-18 20:40:57 +08:00
Fix DirectionalLight2D and PointLight2D shadows not rendering correctly
This commit is contained in:
parent
9904a9db5a
commit
16a8967757
@ -7041,7 +7041,6 @@ Error RenderingDeviceVulkan::_draw_list_render_pass_begin(Framebuffer *framebuff
|
||||
}
|
||||
|
||||
void RenderingDeviceVulkan::_draw_list_insert_clear_region(DrawList *draw_list, Framebuffer *framebuffer, Point2i viewport_offset, Point2i viewport_size, bool p_clear_color, const Vector<Color> &p_clear_colors, bool p_clear_depth, float p_depth, uint32_t p_stencil) {
|
||||
ERR_FAIL_COND_MSG(p_clear_color && p_clear_colors.size() != framebuffer->texture_ids.size(), "Clear color values supplied (" + itos(p_clear_colors.size()) + ") differ from the amount required for framebuffer color attachments (" + itos(framebuffer->texture_ids.size()) + ").");
|
||||
Vector<VkClearAttachment> clear_attachments;
|
||||
int color_index = 0;
|
||||
int texture_index = 0;
|
||||
@ -7130,7 +7129,7 @@ RenderingDevice::DrawListID RenderingDeviceVulkan::draw_list_begin(RID p_framebu
|
||||
}
|
||||
}
|
||||
|
||||
if (p_initial_color_action == INITIAL_ACTION_CLEAR) { //check clear values
|
||||
if (p_initial_color_action == INITIAL_ACTION_CLEAR || needs_clear_color) { //check clear values
|
||||
int color_count = 0;
|
||||
for (int i = 0; i < framebuffer->texture_ids.size(); i++) {
|
||||
Texture *texture = texture_owner.get_or_null(framebuffer->texture_ids[i]);
|
||||
@ -7227,7 +7226,7 @@ Error RenderingDeviceVulkan::draw_list_begin_split(RID p_framebuffer, uint32_t p
|
||||
}
|
||||
}
|
||||
|
||||
if (p_initial_color_action == INITIAL_ACTION_CLEAR) { //check clear values
|
||||
if (p_initial_color_action == INITIAL_ACTION_CLEAR || needs_clear_color) { //check clear values
|
||||
|
||||
int color_count = 0;
|
||||
for (int i = 0; i < framebuffer->texture_ids.size(); i++) {
|
||||
|
@ -1581,7 +1581,8 @@ void RendererCanvasRenderRD::light_update_shadow(RID p_rid, int p_shadow_index,
|
||||
//light.basis.scale(Vector3(to_light.elements[0].length(),to_light.elements[1].length(),1));
|
||||
|
||||
Rect2i rect((state.shadow_texture_size / 4) * i, p_shadow_index * 2, (state.shadow_texture_size / 4), 2);
|
||||
RD::DrawListID draw_list = RD::get_singleton()->draw_list_begin(state.shadow_fb, RD::INITIAL_ACTION_CLEAR, RD::FINAL_ACTION_READ, RD::INITIAL_ACTION_CLEAR, RD::FINAL_ACTION_DISCARD, cc, 1.0, 0, rect);
|
||||
RD::InitialAction initial_action = i == 0 ? RD::INITIAL_ACTION_CLEAR_REGION : RD::INITIAL_ACTION_CLEAR_REGION_CONTINUE;
|
||||
RD::DrawListID draw_list = RD::get_singleton()->draw_list_begin(state.shadow_fb, initial_action, i != 3 ? RD::FINAL_ACTION_CONTINUE : RD::FINAL_ACTION_READ, initial_action, RD::FINAL_ACTION_DISCARD, cc, 1.0, 0, rect);
|
||||
|
||||
CameraMatrix projection;
|
||||
{
|
||||
@ -1670,7 +1671,7 @@ void RendererCanvasRenderRD::light_update_directional_shadow(RID p_rid, int p_sh
|
||||
cc.push_back(Color(1, 1, 1, 1));
|
||||
|
||||
Rect2i rect(0, p_shadow_index * 2, state.shadow_texture_size, 2);
|
||||
RD::DrawListID draw_list = RD::get_singleton()->draw_list_begin(state.shadow_fb, RD::INITIAL_ACTION_CLEAR, RD::FINAL_ACTION_READ, RD::INITIAL_ACTION_CLEAR, RD::FINAL_ACTION_DISCARD, cc, 1.0, 0, rect);
|
||||
RD::DrawListID draw_list = RD::get_singleton()->draw_list_begin(state.shadow_fb, RD::INITIAL_ACTION_CLEAR_REGION, RD::FINAL_ACTION_READ, RD::INITIAL_ACTION_CLEAR_REGION, RD::FINAL_ACTION_DISCARD, cc, 1.0, 0, rect);
|
||||
|
||||
CameraMatrix projection;
|
||||
projection.set_orthogonal(-half_size, half_size, -0.5, 0.5, 0.0, distance);
|
||||
|
Loading…
Reference in New Issue
Block a user