You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2026-01-05 19:31:35 +00:00
Shadow map rendering optimization
-All shadow rendering is done with raster now (no compute) -All shadow rendering is done by rendering directly to the shadow atlas -Improved how buffer clearing is done to optimize the above. -Ability to set shadows as 16 bits.
This commit is contained in:
@@ -3104,6 +3104,7 @@ VkRenderPass RenderingDeviceVulkan::_render_pass_create(const Vector<AttachmentF
|
||||
// the read. If this is a performance issue, one could track the actual last accessor of each resource, adding only that
|
||||
// stage
|
||||
switch (is_depth_stencil ? p_initial_depth_action : p_initial_color_action) {
|
||||
case INITIAL_ACTION_CLEAR_REGION:
|
||||
case INITIAL_ACTION_CLEAR: {
|
||||
description.loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
|
||||
description.stencilLoadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
|
||||
@@ -3116,9 +3117,9 @@ VkRenderPass RenderingDeviceVulkan::_render_pass_create(const Vector<AttachmentF
|
||||
description.initialLayout = is_sampled ? VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL : (is_storage ? VK_IMAGE_LAYOUT_GENERAL : VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL);
|
||||
description.stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
|
||||
} else if (p_format[i].usage_flags & TEXTURE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT) {
|
||||
description.loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
|
||||
description.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED; //don't care what is there
|
||||
description.stencilLoadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
|
||||
description.loadOp = VK_ATTACHMENT_LOAD_OP_LOAD;
|
||||
description.initialLayout = is_sampled ? VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL : (is_storage ? VK_IMAGE_LAYOUT_GENERAL : VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL);
|
||||
description.stencilLoadOp = VK_ATTACHMENT_LOAD_OP_LOAD;
|
||||
dependency_from_external.srcStageMask |= reading_stages;
|
||||
} else {
|
||||
description.loadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
|
||||
@@ -5726,11 +5727,18 @@ Error RenderingDeviceVulkan::_draw_list_render_pass_begin(Framebuffer *framebuff
|
||||
render_pass_begin.pNext = nullptr;
|
||||
render_pass_begin.renderPass = render_pass;
|
||||
render_pass_begin.framebuffer = vkframebuffer;
|
||||
|
||||
/*
|
||||
* Given how API works, it makes sense to always fully operate on the whole framebuffer.
|
||||
* This allows better continue operations for operations like shadowmapping.
|
||||
render_pass_begin.renderArea.extent.width = viewport_size.width;
|
||||
render_pass_begin.renderArea.extent.height = viewport_size.height;
|
||||
render_pass_begin.renderArea.offset.x = viewport_offset.x;
|
||||
render_pass_begin.renderArea.offset.y = viewport_offset.y;
|
||||
*/
|
||||
render_pass_begin.renderArea.extent.width = framebuffer->size.width;
|
||||
render_pass_begin.renderArea.extent.height = framebuffer->size.height;
|
||||
render_pass_begin.renderArea.offset.x = 0;
|
||||
render_pass_begin.renderArea.offset.y = 0;
|
||||
|
||||
Vector<VkClearValue> clear_values;
|
||||
clear_values.resize(framebuffer->texture_ids.size());
|
||||
@@ -5879,11 +5887,11 @@ RenderingDevice::DrawListID RenderingDeviceVulkan::draw_list_begin(RID p_framebu
|
||||
viewport_offset = regioni.position;
|
||||
viewport_size = regioni.size;
|
||||
|
||||
if (p_initial_color_action == INITIAL_ACTION_CLEAR) {
|
||||
if (p_initial_color_action == INITIAL_ACTION_CLEAR_REGION) {
|
||||
needs_clear_color = true;
|
||||
p_initial_color_action = INITIAL_ACTION_KEEP;
|
||||
}
|
||||
if (p_initial_depth_action == INITIAL_ACTION_CLEAR) {
|
||||
if (p_initial_depth_action == INITIAL_ACTION_CLEAR_REGION) {
|
||||
needs_clear_depth = true;
|
||||
p_initial_depth_action = INITIAL_ACTION_KEEP;
|
||||
}
|
||||
@@ -5969,11 +5977,11 @@ Error RenderingDeviceVulkan::draw_list_begin_split(RID p_framebuffer, uint32_t p
|
||||
viewport_offset = regioni.position;
|
||||
viewport_size = regioni.size;
|
||||
|
||||
if (p_initial_color_action == INITIAL_ACTION_CLEAR) {
|
||||
if (p_initial_color_action == INITIAL_ACTION_CLEAR_REGION) {
|
||||
needs_clear_color = true;
|
||||
p_initial_color_action = INITIAL_ACTION_KEEP;
|
||||
}
|
||||
if (p_initial_depth_action == INITIAL_ACTION_CLEAR) {
|
||||
if (p_initial_depth_action == INITIAL_ACTION_CLEAR_REGION) {
|
||||
needs_clear_depth = true;
|
||||
p_initial_depth_action = INITIAL_ACTION_KEEP;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user