Add named resources and debug labels in RenderDoc
This commit is contained in:
parent
ad0f1c6670
commit
7323cbab4b
9 changed files with 194 additions and 12 deletions
|
@ -7040,6 +7040,72 @@ void RenderingDeviceVulkan::free(RID p_id) {
|
||||||
_free_internal(p_id);
|
_free_internal(p_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The full list of resources that can be named is in the VkObjectType enum
|
||||||
|
// We just expose the resources that are owned and can be accessed easily.
|
||||||
|
void RenderingDeviceVulkan::set_resource_name(RID p_id, const String p_name) {
|
||||||
|
if (texture_owner.owns(p_id)) {
|
||||||
|
Texture *texture = texture_owner.getornull(p_id);
|
||||||
|
if (texture->owner.is_null()) {
|
||||||
|
// Don't set the source texture's name when calling on a texture view
|
||||||
|
context->set_object_name(VK_OBJECT_TYPE_IMAGE, uint64_t(texture->image), p_name);
|
||||||
|
}
|
||||||
|
context->set_object_name(VK_OBJECT_TYPE_IMAGE_VIEW, uint64_t(texture->view), p_name + " View");
|
||||||
|
} else if (framebuffer_owner.owns(p_id)) {
|
||||||
|
//Framebuffer *framebuffer = framebuffer_owner.getornull(p_id);
|
||||||
|
// Not implemented for now as the relationship between Framebuffer and RenderPass is very complex
|
||||||
|
} else if (sampler_owner.owns(p_id)) {
|
||||||
|
VkSampler *sampler = sampler_owner.getornull(p_id);
|
||||||
|
context->set_object_name(VK_OBJECT_TYPE_SAMPLER, uint64_t(*sampler), p_name);
|
||||||
|
} else if (vertex_buffer_owner.owns(p_id)) {
|
||||||
|
Buffer *vertex_buffer = vertex_buffer_owner.getornull(p_id);
|
||||||
|
context->set_object_name(VK_OBJECT_TYPE_BUFFER, uint64_t(vertex_buffer->buffer), p_name);
|
||||||
|
} else if (index_buffer_owner.owns(p_id)) {
|
||||||
|
IndexBuffer *index_buffer = index_buffer_owner.getornull(p_id);
|
||||||
|
context->set_object_name(VK_OBJECT_TYPE_BUFFER, uint64_t(index_buffer->buffer), p_name);
|
||||||
|
} else if (shader_owner.owns(p_id)) {
|
||||||
|
Shader *shader = shader_owner.getornull(p_id);
|
||||||
|
context->set_object_name(VK_OBJECT_TYPE_PIPELINE_LAYOUT, uint64_t(shader->pipeline_layout), p_name + " Pipeline Layout");
|
||||||
|
for (int i = 0; i < shader->sets.size(); i++) {
|
||||||
|
context->set_object_name(VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT, uint64_t(shader->sets[i].descriptor_set_layout), p_name);
|
||||||
|
}
|
||||||
|
} else if (uniform_buffer_owner.owns(p_id)) {
|
||||||
|
Buffer *uniform_buffer = uniform_buffer_owner.getornull(p_id);
|
||||||
|
context->set_object_name(VK_OBJECT_TYPE_BUFFER, uint64_t(uniform_buffer->buffer), p_name);
|
||||||
|
} else if (texture_buffer_owner.owns(p_id)) {
|
||||||
|
TextureBuffer *texture_buffer = texture_buffer_owner.getornull(p_id);
|
||||||
|
context->set_object_name(VK_OBJECT_TYPE_BUFFER, uint64_t(texture_buffer->buffer.buffer), p_name);
|
||||||
|
context->set_object_name(VK_OBJECT_TYPE_BUFFER_VIEW, uint64_t(texture_buffer->view), p_name + " View");
|
||||||
|
} else if (storage_buffer_owner.owns(p_id)) {
|
||||||
|
Buffer *storage_buffer = storage_buffer_owner.getornull(p_id);
|
||||||
|
context->set_object_name(VK_OBJECT_TYPE_BUFFER, uint64_t(storage_buffer->buffer), p_name);
|
||||||
|
} else if (uniform_set_owner.owns(p_id)) {
|
||||||
|
UniformSet *uniform_set = uniform_set_owner.getornull(p_id);
|
||||||
|
context->set_object_name(VK_OBJECT_TYPE_DESCRIPTOR_SET, uint64_t(uniform_set->descriptor_set), p_name);
|
||||||
|
} else if (render_pipeline_owner.owns(p_id)) {
|
||||||
|
RenderPipeline *pipeline = render_pipeline_owner.getornull(p_id);
|
||||||
|
context->set_object_name(VK_OBJECT_TYPE_PIPELINE, uint64_t(pipeline->pipeline), p_name);
|
||||||
|
context->set_object_name(VK_OBJECT_TYPE_PIPELINE_LAYOUT, uint64_t(pipeline->pipeline_layout), p_name + " Layout");
|
||||||
|
} else if (compute_pipeline_owner.owns(p_id)) {
|
||||||
|
ComputePipeline *pipeline = compute_pipeline_owner.getornull(p_id);
|
||||||
|
context->set_object_name(VK_OBJECT_TYPE_PIPELINE, uint64_t(pipeline->pipeline), p_name);
|
||||||
|
context->set_object_name(VK_OBJECT_TYPE_PIPELINE_LAYOUT, uint64_t(pipeline->pipeline_layout), p_name + " Layout");
|
||||||
|
} else {
|
||||||
|
ERR_PRINT("Attempted to name invalid ID: " + itos(p_id.get_id()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void RenderingDeviceVulkan::draw_command_begin_label(String p_label_name, const Color p_color) {
|
||||||
|
context->command_begin_label(frames[frame].draw_command_buffer, p_label_name, p_color);
|
||||||
|
}
|
||||||
|
|
||||||
|
void RenderingDeviceVulkan::draw_command_insert_label(String p_label_name, const Color p_color) {
|
||||||
|
context->command_insert_label(frames[frame].draw_command_buffer, p_label_name, p_color);
|
||||||
|
}
|
||||||
|
|
||||||
|
void RenderingDeviceVulkan::draw_command_end_label() {
|
||||||
|
context->command_end_label(frames[frame].draw_command_buffer);
|
||||||
|
}
|
||||||
|
|
||||||
void RenderingDeviceVulkan::_finalize_command_bufers() {
|
void RenderingDeviceVulkan::_finalize_command_bufers() {
|
||||||
if (draw_list) {
|
if (draw_list) {
|
||||||
ERR_PRINT("Found open draw list at the end of the frame, this should never happen (further drawing will likely not work).");
|
ERR_PRINT("Found open draw list at the end of the frame, this should never happen (further drawing will likely not work).");
|
||||||
|
|
|
@ -1078,6 +1078,12 @@ public:
|
||||||
|
|
||||||
virtual uint64_t get_memory_usage() const;
|
virtual uint64_t get_memory_usage() const;
|
||||||
|
|
||||||
|
virtual void set_resource_name(RID p_id, const String p_name);
|
||||||
|
|
||||||
|
virtual void draw_command_begin_label(String p_label_name, const Color p_color = Color(1, 1, 1, 1));
|
||||||
|
virtual void draw_command_insert_label(String p_label_name, const Color p_color = Color(1, 1, 1, 1));
|
||||||
|
virtual void draw_command_end_label();
|
||||||
|
|
||||||
RenderingDeviceVulkan();
|
RenderingDeviceVulkan();
|
||||||
~RenderingDeviceVulkan();
|
~RenderingDeviceVulkan();
|
||||||
};
|
};
|
||||||
|
|
|
@ -220,6 +220,7 @@ Error VulkanContext::_initialize_extensions() {
|
||||||
|
|
||||||
enabled_extension_count = 0;
|
enabled_extension_count = 0;
|
||||||
enabled_layer_count = 0;
|
enabled_layer_count = 0;
|
||||||
|
enabled_debug_utils = false;
|
||||||
/* Look for instance extensions */
|
/* Look for instance extensions */
|
||||||
VkBool32 surfaceExtFound = 0;
|
VkBool32 surfaceExtFound = 0;
|
||||||
VkBool32 platformSurfaceExtFound = 0;
|
VkBool32 platformSurfaceExtFound = 0;
|
||||||
|
@ -251,9 +252,8 @@ Error VulkanContext::_initialize_extensions() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!strcmp(VK_EXT_DEBUG_UTILS_EXTENSION_NAME, instance_extensions[i].extensionName)) {
|
if (!strcmp(VK_EXT_DEBUG_UTILS_EXTENSION_NAME, instance_extensions[i].extensionName)) {
|
||||||
if (use_validation_layers) {
|
|
||||||
extension_names[enabled_extension_count++] = VK_EXT_DEBUG_UTILS_EXTENSION_NAME;
|
extension_names[enabled_extension_count++] = VK_EXT_DEBUG_UTILS_EXTENSION_NAME;
|
||||||
}
|
enabled_debug_utils = true;
|
||||||
}
|
}
|
||||||
if (enabled_extension_count >= MAX_EXTENSIONS) {
|
if (enabled_extension_count >= MAX_EXTENSIONS) {
|
||||||
free(instance_extensions);
|
free(instance_extensions);
|
||||||
|
@ -436,7 +436,7 @@ Error VulkanContext::_create_physical_device() {
|
||||||
" extension.\n\nDo you have a compatible Vulkan installable client driver (ICD) installed?\n"
|
" extension.\n\nDo you have a compatible Vulkan installable client driver (ICD) installed?\n"
|
||||||
"vkCreateInstance Failure");
|
"vkCreateInstance Failure");
|
||||||
|
|
||||||
if (use_validation_layers) {
|
if (enabled_debug_utils) {
|
||||||
// Setup VK_EXT_debug_utils function pointers always (we use them for
|
// Setup VK_EXT_debug_utils function pointers always (we use them for
|
||||||
// debug labels and names).
|
// debug labels and names).
|
||||||
CreateDebugUtilsMessengerEXT =
|
CreateDebugUtilsMessengerEXT =
|
||||||
|
@ -1567,6 +1567,56 @@ void VulkanContext::local_device_free(RID p_local_device) {
|
||||||
local_device_owner.free(p_local_device);
|
local_device_owner.free(p_local_device);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VulkanContext::command_begin_label(VkCommandBuffer p_command_buffer, String p_label_name, const Color p_color) {
|
||||||
|
if (!enabled_debug_utils) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
VkDebugUtilsLabelEXT label;
|
||||||
|
label.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT;
|
||||||
|
label.pNext = nullptr;
|
||||||
|
label.pLabelName = p_label_name.utf8().get_data();
|
||||||
|
label.color[0] = p_color[0];
|
||||||
|
label.color[1] = p_color[1];
|
||||||
|
label.color[2] = p_color[2];
|
||||||
|
label.color[3] = p_color[3];
|
||||||
|
CmdBeginDebugUtilsLabelEXT(p_command_buffer, &label);
|
||||||
|
}
|
||||||
|
|
||||||
|
void VulkanContext::command_insert_label(VkCommandBuffer p_command_buffer, String p_label_name, const Color p_color) {
|
||||||
|
if (!enabled_debug_utils) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
VkDebugUtilsLabelEXT label;
|
||||||
|
label.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT;
|
||||||
|
label.pNext = nullptr;
|
||||||
|
label.pLabelName = p_label_name.utf8().get_data();
|
||||||
|
label.color[0] = p_color[0];
|
||||||
|
label.color[1] = p_color[1];
|
||||||
|
label.color[2] = p_color[2];
|
||||||
|
label.color[3] = p_color[3];
|
||||||
|
CmdInsertDebugUtilsLabelEXT(p_command_buffer, &label);
|
||||||
|
}
|
||||||
|
|
||||||
|
void VulkanContext::command_end_label(VkCommandBuffer p_command_buffer) {
|
||||||
|
if (!enabled_debug_utils) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
CmdEndDebugUtilsLabelEXT(p_command_buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
void VulkanContext::set_object_name(VkObjectType p_object_type, uint64_t p_object_handle, String p_object_name) {
|
||||||
|
if (!enabled_debug_utils) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
VkDebugUtilsObjectNameInfoEXT name_info;
|
||||||
|
name_info.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT;
|
||||||
|
name_info.pNext = nullptr;
|
||||||
|
name_info.objectType = p_object_type;
|
||||||
|
name_info.objectHandle = p_object_handle;
|
||||||
|
name_info.pObjectName = p_object_name.utf8().get_data();
|
||||||
|
SetDebugUtilsObjectNameEXT(device, &name_info);
|
||||||
|
}
|
||||||
|
|
||||||
VulkanContext::VulkanContext() {
|
VulkanContext::VulkanContext() {
|
||||||
use_validation_layers = Engine::get_singleton()->is_validation_layers_enabled();
|
use_validation_layers = Engine::get_singleton()->is_validation_layers_enabled();
|
||||||
|
|
||||||
|
|
|
@ -119,6 +119,7 @@ class VulkanContext {
|
||||||
bool VK_GOOGLE_display_timing_enabled = true;
|
bool VK_GOOGLE_display_timing_enabled = true;
|
||||||
uint32_t enabled_extension_count = 0;
|
uint32_t enabled_extension_count = 0;
|
||||||
const char *extension_names[MAX_EXTENSIONS];
|
const char *extension_names[MAX_EXTENSIONS];
|
||||||
|
bool enabled_debug_utils = false;
|
||||||
|
|
||||||
uint32_t enabled_layer_count = 0;
|
uint32_t enabled_layer_count = 0;
|
||||||
const char *enabled_layers[MAX_LAYERS];
|
const char *enabled_layers[MAX_LAYERS];
|
||||||
|
@ -209,6 +210,11 @@ public:
|
||||||
Error swap_buffers();
|
Error swap_buffers();
|
||||||
Error initialize();
|
Error initialize();
|
||||||
|
|
||||||
|
void command_begin_label(VkCommandBuffer p_command_buffer, String p_label_name, const Color p_color);
|
||||||
|
void command_insert_label(VkCommandBuffer p_command_buffer, String p_label_name, const Color p_color);
|
||||||
|
void command_end_label(VkCommandBuffer p_command_buffer);
|
||||||
|
void set_object_name(VkObjectType p_object_type, uint64_t p_object_handle, String p_object_name);
|
||||||
|
|
||||||
VulkanContext();
|
VulkanContext();
|
||||||
virtual ~VulkanContext();
|
virtual ~VulkanContext();
|
||||||
};
|
};
|
||||||
|
|
|
@ -1005,10 +1005,11 @@ void EffectsRD::gather_ssao(RD::ComputeListID p_compute_list, const Vector<RID>
|
||||||
|
|
||||||
void EffectsRD::generate_ssao(RID p_depth_buffer, RID p_normal_buffer, RID p_depth_mipmaps_texture, const Vector<RID> &p_depth_mipmaps, RID p_ao, const Vector<RID> p_ao_slices, RID p_ao_pong, const Vector<RID> p_ao_pong_slices, RID p_upscale_buffer, RID p_importance_map, RID p_importance_map_pong, const CameraMatrix &p_projection, const SSAOSettings &p_settings, bool p_invalidate_uniform_sets) {
|
void EffectsRD::generate_ssao(RID p_depth_buffer, RID p_normal_buffer, RID p_depth_mipmaps_texture, const Vector<RID> &p_depth_mipmaps, RID p_ao, const Vector<RID> p_ao_slices, RID p_ao_pong, const Vector<RID> p_ao_pong_slices, RID p_upscale_buffer, RID p_importance_map, RID p_importance_map_pong, const CameraMatrix &p_projection, const SSAOSettings &p_settings, bool p_invalidate_uniform_sets) {
|
||||||
RD::ComputeListID compute_list = RD::get_singleton()->compute_list_begin();
|
RD::ComputeListID compute_list = RD::get_singleton()->compute_list_begin();
|
||||||
|
RD::get_singleton()->draw_command_begin_label("SSAO");
|
||||||
/* FIRST PASS */
|
/* FIRST PASS */
|
||||||
// Downsample and deinterleave the depth buffer.
|
// Downsample and deinterleave the depth buffer.
|
||||||
{
|
{
|
||||||
|
RD::get_singleton()->draw_command_begin_label("Downsample Depth");
|
||||||
if (p_invalidate_uniform_sets) {
|
if (p_invalidate_uniform_sets) {
|
||||||
Vector<RD::Uniform> uniforms;
|
Vector<RD::Uniform> uniforms;
|
||||||
{
|
{
|
||||||
|
@ -1076,11 +1077,13 @@ void EffectsRD::generate_ssao(RID p_depth_buffer, RID p_normal_buffer, RID p_dep
|
||||||
|
|
||||||
RD::get_singleton()->compute_list_dispatch(compute_list, x_groups, y_groups, 1);
|
RD::get_singleton()->compute_list_dispatch(compute_list, x_groups, y_groups, 1);
|
||||||
RD::get_singleton()->compute_list_add_barrier(compute_list);
|
RD::get_singleton()->compute_list_add_barrier(compute_list);
|
||||||
|
RD::get_singleton()->draw_command_end_label(); // Downsample SSAO
|
||||||
}
|
}
|
||||||
|
|
||||||
/* SECOND PASS */
|
/* SECOND PASS */
|
||||||
// Sample SSAO
|
// Sample SSAO
|
||||||
{
|
{
|
||||||
|
RD::get_singleton()->draw_command_begin_label("Gather Samples");
|
||||||
ssao.gather_push_constant.screen_size[0] = p_settings.full_screen_size.x;
|
ssao.gather_push_constant.screen_size[0] = p_settings.full_screen_size.x;
|
||||||
ssao.gather_push_constant.screen_size[1] = p_settings.full_screen_size.y;
|
ssao.gather_push_constant.screen_size[1] = p_settings.full_screen_size.y;
|
||||||
|
|
||||||
|
@ -1181,6 +1184,7 @@ void EffectsRD::generate_ssao(RID p_depth_buffer, RID p_normal_buffer, RID p_dep
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p_settings.quality == RS::ENV_SSAO_QUALITY_ULTRA) {
|
if (p_settings.quality == RS::ENV_SSAO_QUALITY_ULTRA) {
|
||||||
|
RD::get_singleton()->draw_command_begin_label("Generate Importance Map");
|
||||||
ssao.importance_map_push_constant.half_screen_pixel_size[0] = 1.0 / p_settings.half_screen_size.x;
|
ssao.importance_map_push_constant.half_screen_pixel_size[0] = 1.0 / p_settings.half_screen_size.x;
|
||||||
ssao.importance_map_push_constant.half_screen_pixel_size[1] = 1.0 / p_settings.half_screen_size.y;
|
ssao.importance_map_push_constant.half_screen_pixel_size[1] = 1.0 / p_settings.half_screen_size.y;
|
||||||
ssao.importance_map_push_constant.intensity = p_settings.intensity;
|
ssao.importance_map_push_constant.intensity = p_settings.intensity;
|
||||||
|
@ -1215,17 +1219,20 @@ void EffectsRD::generate_ssao(RID p_depth_buffer, RID p_normal_buffer, RID p_dep
|
||||||
RD::get_singleton()->compute_list_add_barrier(compute_list);
|
RD::get_singleton()->compute_list_add_barrier(compute_list);
|
||||||
|
|
||||||
RD::get_singleton()->compute_list_bind_compute_pipeline(compute_list, ssao.pipelines[SSAO_GATHER_ADAPTIVE]);
|
RD::get_singleton()->compute_list_bind_compute_pipeline(compute_list, ssao.pipelines[SSAO_GATHER_ADAPTIVE]);
|
||||||
|
RD::get_singleton()->draw_command_end_label(); // Importance Map
|
||||||
} else {
|
} else {
|
||||||
RD::get_singleton()->compute_list_bind_compute_pipeline(compute_list, ssao.pipelines[SSAO_GATHER]);
|
RD::get_singleton()->compute_list_bind_compute_pipeline(compute_list, ssao.pipelines[SSAO_GATHER]);
|
||||||
}
|
}
|
||||||
|
|
||||||
gather_ssao(compute_list, p_ao_slices, p_settings, false);
|
gather_ssao(compute_list, p_ao_slices, p_settings, false);
|
||||||
|
RD::get_singleton()->draw_command_end_label(); // Gather SSAO
|
||||||
}
|
}
|
||||||
|
|
||||||
// /* THIRD PASS */
|
// /* THIRD PASS */
|
||||||
// // Blur
|
// // Blur
|
||||||
//
|
//
|
||||||
{
|
{
|
||||||
|
RD::get_singleton()->draw_command_begin_label("Edge Aware Blur");
|
||||||
ssao.blur_push_constant.edge_sharpness = 1.0 - p_settings.sharpness;
|
ssao.blur_push_constant.edge_sharpness = 1.0 - p_settings.sharpness;
|
||||||
ssao.blur_push_constant.half_screen_pixel_size[0] = 1.0 / p_settings.half_screen_size.x;
|
ssao.blur_push_constant.half_screen_pixel_size[0] = 1.0 / p_settings.half_screen_size.x;
|
||||||
ssao.blur_push_constant.half_screen_pixel_size[1] = 1.0 / p_settings.half_screen_size.y;
|
ssao.blur_push_constant.half_screen_pixel_size[1] = 1.0 / p_settings.half_screen_size.y;
|
||||||
|
@ -1275,12 +1282,14 @@ void EffectsRD::generate_ssao(RID p_depth_buffer, RID p_normal_buffer, RID p_dep
|
||||||
RD::get_singleton()->compute_list_add_barrier(compute_list);
|
RD::get_singleton()->compute_list_add_barrier(compute_list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
RD::get_singleton()->draw_command_end_label(); // Blur
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FOURTH PASS */
|
/* FOURTH PASS */
|
||||||
// Interleave buffers
|
// Interleave buffers
|
||||||
// back to full size
|
// back to full size
|
||||||
{
|
{
|
||||||
|
RD::get_singleton()->draw_command_begin_label("Interleave Buffers");
|
||||||
ssao.interleave_push_constant.inv_sharpness = 1.0 - p_settings.sharpness;
|
ssao.interleave_push_constant.inv_sharpness = 1.0 - p_settings.sharpness;
|
||||||
ssao.interleave_push_constant.pixel_size[0] = 1.0 / p_settings.full_screen_size.x;
|
ssao.interleave_push_constant.pixel_size[0] = 1.0 / p_settings.full_screen_size.x;
|
||||||
ssao.interleave_push_constant.pixel_size[1] = 1.0 / p_settings.full_screen_size.y;
|
ssao.interleave_push_constant.pixel_size[1] = 1.0 / p_settings.full_screen_size.y;
|
||||||
|
@ -1309,8 +1318,9 @@ void EffectsRD::generate_ssao(RID p_depth_buffer, RID p_normal_buffer, RID p_dep
|
||||||
|
|
||||||
RD::get_singleton()->compute_list_dispatch(compute_list, x_groups, y_groups, 1);
|
RD::get_singleton()->compute_list_dispatch(compute_list, x_groups, y_groups, 1);
|
||||||
RD::get_singleton()->compute_list_add_barrier(compute_list);
|
RD::get_singleton()->compute_list_add_barrier(compute_list);
|
||||||
|
RD::get_singleton()->draw_command_end_label(); // Interleave
|
||||||
}
|
}
|
||||||
|
RD::get_singleton()->draw_command_end_label(); //SSAO
|
||||||
RD::get_singleton()->compute_list_end();
|
RD::get_singleton()->compute_list_end();
|
||||||
|
|
||||||
int zero[1] = { 0 };
|
int zero[1] = { 0 };
|
||||||
|
@ -1797,6 +1807,7 @@ EffectsRD::EffectsRD() {
|
||||||
ssao.importance_map_load_counter = RD::get_singleton()->storage_buffer_create(sizeof(uint32_t));
|
ssao.importance_map_load_counter = RD::get_singleton()->storage_buffer_create(sizeof(uint32_t));
|
||||||
int zero[1] = { 0 };
|
int zero[1] = { 0 };
|
||||||
RD::get_singleton()->buffer_update(ssao.importance_map_load_counter, 0, sizeof(uint32_t), &zero, false);
|
RD::get_singleton()->buffer_update(ssao.importance_map_load_counter, 0, sizeof(uint32_t), &zero, false);
|
||||||
|
RD::get_singleton()->set_resource_name(ssao.importance_map_load_counter, "Importance Map Load Counter");
|
||||||
|
|
||||||
Vector<RD::Uniform> uniforms;
|
Vector<RD::Uniform> uniforms;
|
||||||
{
|
{
|
||||||
|
@ -1807,6 +1818,7 @@ EffectsRD::EffectsRD() {
|
||||||
uniforms.push_back(u);
|
uniforms.push_back(u);
|
||||||
}
|
}
|
||||||
ssao.counter_uniform_set = RD::get_singleton()->uniform_set_create(uniforms, ssao.importance_map_shader.version_get_shader(ssao.importance_map_shader_version, 2), 2);
|
ssao.counter_uniform_set = RD::get_singleton()->uniform_set_create(uniforms, ssao.importance_map_shader.version_get_shader(ssao.importance_map_shader_version, 2), 2);
|
||||||
|
RD::get_singleton()->set_resource_name(ssao.counter_uniform_set, "Load Counter Uniform Set");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
Vector<String> ssao_modes;
|
Vector<String> ssao_modes;
|
||||||
|
@ -1835,7 +1847,7 @@ EffectsRD::EffectsRD() {
|
||||||
ssao.interleave_shader_version = ssao.interleave_shader.version_create();
|
ssao.interleave_shader_version = ssao.interleave_shader.version_create();
|
||||||
for (int i = SSAO_INTERLEAVE; i <= SSAO_INTERLEAVE_HALF; i++) {
|
for (int i = SSAO_INTERLEAVE; i <= SSAO_INTERLEAVE_HALF; i++) {
|
||||||
ssao.pipelines[pipeline] = RD::get_singleton()->compute_pipeline_create(ssao.interleave_shader.version_get_shader(ssao.interleave_shader_version, i - SSAO_INTERLEAVE));
|
ssao.pipelines[pipeline] = RD::get_singleton()->compute_pipeline_create(ssao.interleave_shader.version_get_shader(ssao.interleave_shader_version, i - SSAO_INTERLEAVE));
|
||||||
|
RD::get_singleton()->set_resource_name(ssao.pipelines[pipeline], "Interleave Pipeline " + itos(i));
|
||||||
pipeline++;
|
pipeline++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2040,12 +2052,14 @@ EffectsRD::EffectsRD() {
|
||||||
sampler.max_lod = 0;
|
sampler.max_lod = 0;
|
||||||
|
|
||||||
default_sampler = RD::get_singleton()->sampler_create(sampler);
|
default_sampler = RD::get_singleton()->sampler_create(sampler);
|
||||||
|
RD::get_singleton()->set_resource_name(default_sampler, "Default Linear Sampler");
|
||||||
|
|
||||||
sampler.min_filter = RD::SAMPLER_FILTER_LINEAR;
|
sampler.min_filter = RD::SAMPLER_FILTER_LINEAR;
|
||||||
sampler.mip_filter = RD::SAMPLER_FILTER_LINEAR;
|
sampler.mip_filter = RD::SAMPLER_FILTER_LINEAR;
|
||||||
sampler.max_lod = 1e20;
|
sampler.max_lod = 1e20;
|
||||||
|
|
||||||
default_mipmap_sampler = RD::get_singleton()->sampler_create(sampler);
|
default_mipmap_sampler = RD::get_singleton()->sampler_create(sampler);
|
||||||
|
RD::get_singleton()->set_resource_name(default_mipmap_sampler, "Default MipMap Sampler");
|
||||||
|
|
||||||
{ //create index array for copy shaders
|
{ //create index array for copy shaders
|
||||||
Vector<uint8_t> pv;
|
Vector<uint8_t> pv;
|
||||||
|
|
|
@ -1658,6 +1658,7 @@ void RendererSceneRenderForward::_render_scene(RID p_render_buffer, const Transf
|
||||||
// setup sky if used for ambient, reflections, or background
|
// setup sky if used for ambient, reflections, or background
|
||||||
if (draw_sky || draw_sky_fog_only || environment_get_reflection_source(p_environment) == RS::ENV_REFLECTION_SOURCE_SKY || environment_get_ambient_source(p_environment) == RS::ENV_AMBIENT_SOURCE_SKY) {
|
if (draw_sky || draw_sky_fog_only || environment_get_reflection_source(p_environment) == RS::ENV_REFLECTION_SOURCE_SKY || environment_get_ambient_source(p_environment) == RS::ENV_AMBIENT_SOURCE_SKY) {
|
||||||
RENDER_TIMESTAMP("Setup Sky");
|
RENDER_TIMESTAMP("Setup Sky");
|
||||||
|
RD::get_singleton()->draw_command_begin_label("Setup Sky");
|
||||||
CameraMatrix projection = p_cam_projection;
|
CameraMatrix projection = p_cam_projection;
|
||||||
if (p_reflection_probe.is_valid()) {
|
if (p_reflection_probe.is_valid()) {
|
||||||
CameraMatrix correction;
|
CameraMatrix correction;
|
||||||
|
@ -1675,6 +1676,7 @@ void RendererSceneRenderForward::_render_scene(RID p_render_buffer, const Transf
|
||||||
// do not try to draw sky if invalid
|
// do not try to draw sky if invalid
|
||||||
draw_sky = false;
|
draw_sky = false;
|
||||||
}
|
}
|
||||||
|
RD::get_singleton()->draw_command_end_label();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
clear_color = p_default_bg_color;
|
clear_color = p_default_bg_color;
|
||||||
|
@ -1695,10 +1697,12 @@ void RendererSceneRenderForward::_render_scene(RID p_render_buffer, const Transf
|
||||||
|
|
||||||
bool finish_depth = using_ssao || using_sdfgi || using_giprobe;
|
bool finish_depth = using_ssao || using_sdfgi || using_giprobe;
|
||||||
RenderListParameters render_list_params(render_list.elements, render_list.element_count, false, depth_pass_mode, render_buffer == nullptr, rp_uniform_set, get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_WIREFRAME, Vector2(), lod_camera_plane, lod_distance_multiplier, p_screen_lod_threshold);
|
RenderListParameters render_list_params(render_list.elements, render_list.element_count, false, depth_pass_mode, render_buffer == nullptr, rp_uniform_set, get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_WIREFRAME, Vector2(), lod_camera_plane, lod_distance_multiplier, p_screen_lod_threshold);
|
||||||
|
RD::get_singleton()->draw_command_begin_label("Render Depth Pre-Pass");
|
||||||
_render_list_with_threads(&render_list_params, depth_framebuffer, RD::INITIAL_ACTION_CLEAR, RD::FINAL_ACTION_READ, RD::INITIAL_ACTION_CLEAR, finish_depth ? RD::FINAL_ACTION_READ : RD::FINAL_ACTION_CONTINUE, depth_pass_clear);
|
_render_list_with_threads(&render_list_params, depth_framebuffer, RD::INITIAL_ACTION_CLEAR, RD::FINAL_ACTION_READ, RD::INITIAL_ACTION_CLEAR, finish_depth ? RD::FINAL_ACTION_READ : RD::FINAL_ACTION_CONTINUE, depth_pass_clear);
|
||||||
|
RD::get_singleton()->draw_command_end_label();
|
||||||
if (render_buffer && render_buffer->msaa != RS::VIEWPORT_MSAA_DISABLED) {
|
if (render_buffer && render_buffer->msaa != RS::VIEWPORT_MSAA_DISABLED) {
|
||||||
RENDER_TIMESTAMP("Resolve Depth Pre-Pass");
|
RENDER_TIMESTAMP("Resolve Depth Pre-Pass");
|
||||||
|
RD::get_singleton()->draw_command_insert_label("Resolve Depth Pre-Pass");
|
||||||
if (depth_pass_mode == PASS_MODE_DEPTH_NORMAL_ROUGHNESS || depth_pass_mode == PASS_MODE_DEPTH_NORMAL_ROUGHNESS_GIPROBE) {
|
if (depth_pass_mode == PASS_MODE_DEPTH_NORMAL_ROUGHNESS || depth_pass_mode == PASS_MODE_DEPTH_NORMAL_ROUGHNESS_GIPROBE) {
|
||||||
static int texture_samples[RS::VIEWPORT_MSAA_MAX] = { 1, 2, 4, 8, 16 };
|
static int texture_samples[RS::VIEWPORT_MSAA_MAX] = { 1, 2, 4, 8, 16 };
|
||||||
storage->get_effects()->resolve_gi(render_buffer->depth_msaa, render_buffer->normal_roughness_buffer_msaa, using_giprobe ? render_buffer->giprobe_buffer_msaa : RID(), render_buffer->depth, render_buffer->normal_roughness_buffer, using_giprobe ? render_buffer->giprobe_buffer : RID(), Vector2i(render_buffer->width, render_buffer->height), texture_samples[render_buffer->msaa]);
|
storage->get_effects()->resolve_gi(render_buffer->depth_msaa, render_buffer->normal_roughness_buffer_msaa, using_giprobe ? render_buffer->giprobe_buffer_msaa : RID(), render_buffer->depth, render_buffer->normal_roughness_buffer, using_giprobe ? render_buffer->giprobe_buffer : RID(), Vector2i(render_buffer->width, render_buffer->height), texture_samples[render_buffer->msaa]);
|
||||||
|
@ -1744,9 +1748,9 @@ void RendererSceneRenderForward::_render_scene(RID p_render_buffer, const Transf
|
||||||
|
|
||||||
RID framebuffer = using_separate_specular ? opaque_specular_framebuffer : opaque_framebuffer;
|
RID framebuffer = using_separate_specular ? opaque_specular_framebuffer : opaque_framebuffer;
|
||||||
RenderListParameters render_list_params(render_list.elements, render_list.element_count, false, using_separate_specular ? PASS_MODE_COLOR_SPECULAR : PASS_MODE_COLOR, render_buffer == nullptr, rp_uniform_set, get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_WIREFRAME, Vector2(), lod_camera_plane, lod_distance_multiplier, p_screen_lod_threshold);
|
RenderListParameters render_list_params(render_list.elements, render_list.element_count, false, using_separate_specular ? PASS_MODE_COLOR_SPECULAR : PASS_MODE_COLOR, render_buffer == nullptr, rp_uniform_set, get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_WIREFRAME, Vector2(), lod_camera_plane, lod_distance_multiplier, p_screen_lod_threshold);
|
||||||
|
RD::get_singleton()->draw_command_begin_label("Render Opaque Pass");
|
||||||
_render_list_with_threads(&render_list_params, framebuffer, keep_color ? RD::INITIAL_ACTION_KEEP : RD::INITIAL_ACTION_CLEAR, will_continue_color ? RD::FINAL_ACTION_CONTINUE : RD::FINAL_ACTION_READ, depth_pre_pass ? (continue_depth ? RD::INITIAL_ACTION_KEEP : RD::INITIAL_ACTION_CONTINUE) : RD::INITIAL_ACTION_CLEAR, will_continue_depth ? RD::FINAL_ACTION_CONTINUE : RD::FINAL_ACTION_READ, c, 1.0, 0);
|
_render_list_with_threads(&render_list_params, framebuffer, keep_color ? RD::INITIAL_ACTION_KEEP : RD::INITIAL_ACTION_CLEAR, will_continue_color ? RD::FINAL_ACTION_CONTINUE : RD::FINAL_ACTION_READ, depth_pre_pass ? (continue_depth ? RD::INITIAL_ACTION_KEEP : RD::INITIAL_ACTION_CONTINUE) : RD::INITIAL_ACTION_CLEAR, will_continue_depth ? RD::FINAL_ACTION_CONTINUE : RD::FINAL_ACTION_READ, c, 1.0, 0);
|
||||||
|
RD::get_singleton()->draw_command_end_label();
|
||||||
if (will_continue_color && using_separate_specular) {
|
if (will_continue_color && using_separate_specular) {
|
||||||
// close the specular framebuffer, as it's no longer used
|
// close the specular framebuffer, as it's no longer used
|
||||||
RD::get_singleton()->draw_list_begin(render_buffer->specular_only_fb, RD::INITIAL_ACTION_CONTINUE, RD::FINAL_ACTION_READ, RD::INITIAL_ACTION_CONTINUE, RD::FINAL_ACTION_CONTINUE);
|
RD::get_singleton()->draw_list_begin(render_buffer->specular_only_fb, RD::INITIAL_ACTION_CONTINUE, RD::FINAL_ACTION_READ, RD::INITIAL_ACTION_CONTINUE, RD::FINAL_ACTION_CONTINUE);
|
||||||
|
@ -1763,9 +1767,11 @@ void RendererSceneRenderForward::_render_scene(RID p_render_buffer, const Transf
|
||||||
dc.set_depth_correction(true);
|
dc.set_depth_correction(true);
|
||||||
CameraMatrix cm = (dc * p_cam_projection) * CameraMatrix(p_cam_transform.affine_inverse());
|
CameraMatrix cm = (dc * p_cam_projection) * CameraMatrix(p_cam_transform.affine_inverse());
|
||||||
RD::DrawListID draw_list = RD::get_singleton()->draw_list_begin(opaque_framebuffer, RD::INITIAL_ACTION_CONTINUE, will_continue_color ? RD::FINAL_ACTION_CONTINUE : RD::FINAL_ACTION_READ, RD::INITIAL_ACTION_CONTINUE, will_continue_depth ? RD::FINAL_ACTION_CONTINUE : RD::FINAL_ACTION_READ);
|
RD::DrawListID draw_list = RD::get_singleton()->draw_list_begin(opaque_framebuffer, RD::INITIAL_ACTION_CONTINUE, will_continue_color ? RD::FINAL_ACTION_CONTINUE : RD::FINAL_ACTION_READ, RD::INITIAL_ACTION_CONTINUE, will_continue_depth ? RD::FINAL_ACTION_CONTINUE : RD::FINAL_ACTION_READ);
|
||||||
|
RD::get_singleton()->draw_command_begin_label("Debug GIProbes");
|
||||||
for (int i = 0; i < (int)p_gi_probes.size(); i++) {
|
for (int i = 0; i < (int)p_gi_probes.size(); i++) {
|
||||||
_debug_giprobe(p_gi_probes[i], draw_list, opaque_framebuffer, cm, get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_GI_PROBE_LIGHTING, get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_GI_PROBE_EMISSION, 1.0);
|
_debug_giprobe(p_gi_probes[i], draw_list, opaque_framebuffer, cm, get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_GI_PROBE_LIGHTING, get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_GI_PROBE_EMISSION, 1.0);
|
||||||
}
|
}
|
||||||
|
RD::get_singleton()->draw_command_end_label();
|
||||||
RD::get_singleton()->draw_list_end();
|
RD::get_singleton()->draw_list_end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1778,7 +1784,9 @@ void RendererSceneRenderForward::_render_scene(RID p_render_buffer, const Transf
|
||||||
dc.set_depth_correction(true);
|
dc.set_depth_correction(true);
|
||||||
CameraMatrix cm = (dc * p_cam_projection) * CameraMatrix(p_cam_transform.affine_inverse());
|
CameraMatrix cm = (dc * p_cam_projection) * CameraMatrix(p_cam_transform.affine_inverse());
|
||||||
RD::DrawListID draw_list = RD::get_singleton()->draw_list_begin(opaque_framebuffer, RD::INITIAL_ACTION_CONTINUE, will_continue_color ? RD::FINAL_ACTION_CONTINUE : RD::FINAL_ACTION_READ, RD::INITIAL_ACTION_CONTINUE, will_continue_depth ? RD::FINAL_ACTION_CONTINUE : RD::FINAL_ACTION_READ);
|
RD::DrawListID draw_list = RD::get_singleton()->draw_list_begin(opaque_framebuffer, RD::INITIAL_ACTION_CONTINUE, will_continue_color ? RD::FINAL_ACTION_CONTINUE : RD::FINAL_ACTION_READ, RD::INITIAL_ACTION_CONTINUE, will_continue_depth ? RD::FINAL_ACTION_CONTINUE : RD::FINAL_ACTION_READ);
|
||||||
|
RD::get_singleton()->draw_command_begin_label("Debug SDFGI");
|
||||||
_debug_sdfgi_probes(p_render_buffer, draw_list, opaque_framebuffer, cm);
|
_debug_sdfgi_probes(p_render_buffer, draw_list, opaque_framebuffer, cm);
|
||||||
|
RD::get_singleton()->draw_command_end_label();
|
||||||
RD::get_singleton()->draw_list_end();
|
RD::get_singleton()->draw_list_end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1791,8 +1799,9 @@ void RendererSceneRenderForward::_render_scene(RID p_render_buffer, const Transf
|
||||||
correction.set_depth_correction(true);
|
correction.set_depth_correction(true);
|
||||||
projection = correction * p_cam_projection;
|
projection = correction * p_cam_projection;
|
||||||
}
|
}
|
||||||
|
RD::get_singleton()->draw_command_begin_label("Draw Sky");
|
||||||
_draw_sky(can_continue_color, can_continue_depth, opaque_framebuffer, p_environment, projection, p_cam_transform);
|
_draw_sky(can_continue_color, can_continue_depth, opaque_framebuffer, p_environment, projection, p_cam_transform);
|
||||||
|
RD::get_singleton()->draw_command_end_label();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (render_buffer && !can_continue_color && render_buffer->msaa != RS::VIEWPORT_MSAA_DISABLED) {
|
if (render_buffer && !can_continue_color && render_buffer->msaa != RS::VIEWPORT_MSAA_DISABLED) {
|
||||||
|
@ -1809,12 +1818,16 @@ void RendererSceneRenderForward::_render_scene(RID p_render_buffer, const Transf
|
||||||
if (using_separate_specular) {
|
if (using_separate_specular) {
|
||||||
if (using_sss) {
|
if (using_sss) {
|
||||||
RENDER_TIMESTAMP("Sub Surface Scattering");
|
RENDER_TIMESTAMP("Sub Surface Scattering");
|
||||||
|
RD::get_singleton()->draw_command_begin_label("Process Sub Surface Scattering");
|
||||||
_process_sss(p_render_buffer, p_cam_projection);
|
_process_sss(p_render_buffer, p_cam_projection);
|
||||||
|
RD::get_singleton()->draw_command_end_label();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (using_ssr) {
|
if (using_ssr) {
|
||||||
RENDER_TIMESTAMP("Screen Space Reflection");
|
RENDER_TIMESTAMP("Screen Space Reflection");
|
||||||
|
RD::get_singleton()->draw_command_begin_label("Process Screen Space Reflections");
|
||||||
_process_ssr(p_render_buffer, render_buffer->color_fb, render_buffer->normal_roughness_buffer, render_buffer->specular, render_buffer->specular, Color(0, 0, 0, 1), p_environment, p_cam_projection, render_buffer->msaa == RS::VIEWPORT_MSAA_DISABLED);
|
_process_ssr(p_render_buffer, render_buffer->color_fb, render_buffer->normal_roughness_buffer, render_buffer->specular, render_buffer->specular, Color(0, 0, 0, 1), p_environment, p_cam_projection, render_buffer->msaa == RS::VIEWPORT_MSAA_DISABLED);
|
||||||
|
RD::get_singleton()->draw_command_end_label();
|
||||||
} else {
|
} else {
|
||||||
//just mix specular back
|
//just mix specular back
|
||||||
RENDER_TIMESTAMP("Merge Specular");
|
RENDER_TIMESTAMP("Merge Specular");
|
||||||
|
@ -1829,8 +1842,10 @@ void RendererSceneRenderForward::_render_scene(RID p_render_buffer, const Transf
|
||||||
render_list.sort_by_reverse_depth_and_priority(true);
|
render_list.sort_by_reverse_depth_and_priority(true);
|
||||||
|
|
||||||
{
|
{
|
||||||
|
RD::get_singleton()->draw_command_begin_label("Render Transparent Pass");
|
||||||
RenderListParameters render_list_params(&render_list.elements[render_list.max_elements - render_list.alpha_element_count], render_list.alpha_element_count, false, PASS_MODE_COLOR, render_buffer == nullptr, rp_uniform_set, get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_WIREFRAME, Vector2(), lod_camera_plane, lod_distance_multiplier, p_screen_lod_threshold);
|
RenderListParameters render_list_params(&render_list.elements[render_list.max_elements - render_list.alpha_element_count], render_list.alpha_element_count, false, PASS_MODE_COLOR, render_buffer == nullptr, rp_uniform_set, get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_WIREFRAME, Vector2(), lod_camera_plane, lod_distance_multiplier, p_screen_lod_threshold);
|
||||||
_render_list_with_threads(&render_list_params, alpha_framebuffer, can_continue_color ? RD::INITIAL_ACTION_CONTINUE : RD::INITIAL_ACTION_KEEP, RD::FINAL_ACTION_READ, can_continue_depth ? RD::INITIAL_ACTION_CONTINUE : RD::INITIAL_ACTION_KEEP, RD::FINAL_ACTION_READ);
|
_render_list_with_threads(&render_list_params, alpha_framebuffer, can_continue_color ? RD::INITIAL_ACTION_CONTINUE : RD::INITIAL_ACTION_KEEP, RD::FINAL_ACTION_READ, can_continue_depth ? RD::INITIAL_ACTION_CONTINUE : RD::INITIAL_ACTION_KEEP, RD::FINAL_ACTION_READ);
|
||||||
|
RD::get_singleton()->draw_command_end_label();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (render_buffer && render_buffer->msaa != RS::VIEWPORT_MSAA_DISABLED) {
|
if (render_buffer && render_buffer->msaa != RS::VIEWPORT_MSAA_DISABLED) {
|
||||||
|
@ -1869,8 +1884,10 @@ void RendererSceneRenderForward::_render_shadow(RID p_framebuffer, const PagedAr
|
||||||
if (p_flip_y) {
|
if (p_flip_y) {
|
||||||
flip_cull = !flip_cull;
|
flip_cull = !flip_cull;
|
||||||
}
|
}
|
||||||
|
RD::get_singleton()->draw_command_begin_label("Render Shadow");
|
||||||
RenderListParameters render_list_params(render_list.elements, render_list.element_count, flip_cull, pass_mode, true, rp_uniform_set, false, Vector2(), p_camera_plane, p_lod_distance_multiplier, p_screen_lod_threshold);
|
RenderListParameters render_list_params(render_list.elements, render_list.element_count, flip_cull, pass_mode, true, rp_uniform_set, false, Vector2(), p_camera_plane, p_lod_distance_multiplier, p_screen_lod_threshold);
|
||||||
_render_list_with_threads(&render_list_params, p_framebuffer, RD::INITIAL_ACTION_DROP, RD::FINAL_ACTION_DISCARD, p_begin ? (p_clear_region ? RD::INITIAL_ACTION_CLEAR_REGION : RD::INITIAL_ACTION_CLEAR) : RD::INITIAL_ACTION_CONTINUE, p_end ? RD::FINAL_ACTION_READ : RD::FINAL_ACTION_CONTINUE, Vector<Color>(), 1.0, 0, p_rect);
|
_render_list_with_threads(&render_list_params, p_framebuffer, RD::INITIAL_ACTION_DROP, RD::FINAL_ACTION_DISCARD, p_begin ? (p_clear_region ? RD::INITIAL_ACTION_CLEAR_REGION : RD::INITIAL_ACTION_CLEAR) : RD::INITIAL_ACTION_CONTINUE, p_end ? RD::FINAL_ACTION_READ : RD::FINAL_ACTION_CONTINUE, Vector<Color>(), 1.0, 0, p_rect);
|
||||||
|
RD::get_singleton()->draw_command_end_label();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1891,14 +1908,16 @@ void RendererSceneRenderForward::_render_particle_collider_heightfield(RID p_fb,
|
||||||
|
|
||||||
RID rp_uniform_set = _setup_render_pass_uniform_set(RID(), RID(), RID(), RID(), RID(), PagedArray<RID>(), PagedArray<RID>());
|
RID rp_uniform_set = _setup_render_pass_uniform_set(RID(), RID(), RID(), RID(), RID(), PagedArray<RID>(), PagedArray<RID>());
|
||||||
|
|
||||||
RENDER_TIMESTAMP("Render Collider Heightield");
|
RENDER_TIMESTAMP("Render Collider Heightfield");
|
||||||
|
|
||||||
render_list.sort_by_key(false);
|
render_list.sort_by_key(false);
|
||||||
|
|
||||||
{
|
{
|
||||||
//regular forward for now
|
//regular forward for now
|
||||||
|
RD::get_singleton()->draw_command_begin_label("Render Collider Heightfield");
|
||||||
RenderListParameters render_list_params(render_list.elements, render_list.element_count, false, pass_mode, true, rp_uniform_set);
|
RenderListParameters render_list_params(render_list.elements, render_list.element_count, false, pass_mode, true, rp_uniform_set);
|
||||||
_render_list_with_threads(&render_list_params, p_fb, RD::INITIAL_ACTION_CLEAR, RD::FINAL_ACTION_READ, RD::INITIAL_ACTION_CLEAR, RD::FINAL_ACTION_READ);
|
_render_list_with_threads(&render_list_params, p_fb, RD::INITIAL_ACTION_CLEAR, RD::FINAL_ACTION_READ, RD::INITIAL_ACTION_CLEAR, RD::FINAL_ACTION_READ);
|
||||||
|
RD::get_singleton()->draw_command_end_label();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5332,9 +5332,11 @@ void RendererSceneRenderRD::_process_ssao(RID p_render_buffers, RID p_environmen
|
||||||
tf.array_layers = 4;
|
tf.array_layers = 4;
|
||||||
tf.usage_bits = RD::TEXTURE_USAGE_SAMPLING_BIT | RD::TEXTURE_USAGE_STORAGE_BIT;
|
tf.usage_bits = RD::TEXTURE_USAGE_SAMPLING_BIT | RD::TEXTURE_USAGE_STORAGE_BIT;
|
||||||
rb->ssao.depth = RD::get_singleton()->texture_create(tf, RD::TextureView());
|
rb->ssao.depth = RD::get_singleton()->texture_create(tf, RD::TextureView());
|
||||||
|
RD::get_singleton()->set_resource_name(rb->ssao.depth, "SSAO Depth");
|
||||||
for (uint32_t i = 0; i < tf.mipmaps; i++) {
|
for (uint32_t i = 0; i < tf.mipmaps; i++) {
|
||||||
RID slice = RD::get_singleton()->texture_create_shared_from_slice(RD::TextureView(), rb->ssao.depth, 0, i, RD::TEXTURE_SLICE_2D_ARRAY);
|
RID slice = RD::get_singleton()->texture_create_shared_from_slice(RD::TextureView(), rb->ssao.depth, 0, i, RD::TEXTURE_SLICE_2D_ARRAY);
|
||||||
rb->ssao.depth_slices.push_back(slice);
|
rb->ssao.depth_slices.push_back(slice);
|
||||||
|
RD::get_singleton()->set_resource_name(rb->ssao.depth_slices[i], "SSAO Depth Mip " + itos(i) + " ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5347,9 +5349,11 @@ void RendererSceneRenderRD::_process_ssao(RID p_render_buffers, RID p_environmen
|
||||||
tf.array_layers = 4;
|
tf.array_layers = 4;
|
||||||
tf.usage_bits = RD::TEXTURE_USAGE_SAMPLING_BIT | RD::TEXTURE_USAGE_STORAGE_BIT;
|
tf.usage_bits = RD::TEXTURE_USAGE_SAMPLING_BIT | RD::TEXTURE_USAGE_STORAGE_BIT;
|
||||||
rb->ssao.ao_deinterleaved = RD::get_singleton()->texture_create(tf, RD::TextureView());
|
rb->ssao.ao_deinterleaved = RD::get_singleton()->texture_create(tf, RD::TextureView());
|
||||||
|
RD::get_singleton()->set_resource_name(rb->ssao.ao_deinterleaved, "SSAO De-interleaved Array");
|
||||||
for (uint32_t i = 0; i < 4; i++) {
|
for (uint32_t i = 0; i < 4; i++) {
|
||||||
RID slice = RD::get_singleton()->texture_create_shared_from_slice(RD::TextureView(), rb->ssao.ao_deinterleaved, i, 0);
|
RID slice = RD::get_singleton()->texture_create_shared_from_slice(RD::TextureView(), rb->ssao.ao_deinterleaved, i, 0);
|
||||||
rb->ssao.ao_deinterleaved_slices.push_back(slice);
|
rb->ssao.ao_deinterleaved_slices.push_back(slice);
|
||||||
|
RD::get_singleton()->set_resource_name(rb->ssao.ao_deinterleaved_slices[i], "SSAO De-interleaved Array Layer " + itos(i) + " ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5362,9 +5366,11 @@ void RendererSceneRenderRD::_process_ssao(RID p_render_buffers, RID p_environmen
|
||||||
tf.array_layers = 4;
|
tf.array_layers = 4;
|
||||||
tf.usage_bits = RD::TEXTURE_USAGE_SAMPLING_BIT | RD::TEXTURE_USAGE_STORAGE_BIT;
|
tf.usage_bits = RD::TEXTURE_USAGE_SAMPLING_BIT | RD::TEXTURE_USAGE_STORAGE_BIT;
|
||||||
rb->ssao.ao_pong = RD::get_singleton()->texture_create(tf, RD::TextureView());
|
rb->ssao.ao_pong = RD::get_singleton()->texture_create(tf, RD::TextureView());
|
||||||
|
RD::get_singleton()->set_resource_name(rb->ssao.ao_pong, "SSAO De-interleaved Array Pong");
|
||||||
for (uint32_t i = 0; i < 4; i++) {
|
for (uint32_t i = 0; i < 4; i++) {
|
||||||
RID slice = RD::get_singleton()->texture_create_shared_from_slice(RD::TextureView(), rb->ssao.ao_pong, i, 0);
|
RID slice = RD::get_singleton()->texture_create_shared_from_slice(RD::TextureView(), rb->ssao.ao_pong, i, 0);
|
||||||
rb->ssao.ao_pong_slices.push_back(slice);
|
rb->ssao.ao_pong_slices.push_back(slice);
|
||||||
|
RD::get_singleton()->set_resource_name(rb->ssao.ao_deinterleaved_slices[i], "SSAO De-interleaved Array Layer " + itos(i) + " Pong");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5375,7 +5381,9 @@ void RendererSceneRenderRD::_process_ssao(RID p_render_buffers, RID p_environmen
|
||||||
tf.height = half_height;
|
tf.height = half_height;
|
||||||
tf.usage_bits = RD::TEXTURE_USAGE_SAMPLING_BIT | RD::TEXTURE_USAGE_STORAGE_BIT;
|
tf.usage_bits = RD::TEXTURE_USAGE_SAMPLING_BIT | RD::TEXTURE_USAGE_STORAGE_BIT;
|
||||||
rb->ssao.importance_map[0] = RD::get_singleton()->texture_create(tf, RD::TextureView());
|
rb->ssao.importance_map[0] = RD::get_singleton()->texture_create(tf, RD::TextureView());
|
||||||
|
RD::get_singleton()->set_resource_name(rb->ssao.importance_map[0], "SSAO Importance Map");
|
||||||
rb->ssao.importance_map[1] = RD::get_singleton()->texture_create(tf, RD::TextureView());
|
rb->ssao.importance_map[1] = RD::get_singleton()->texture_create(tf, RD::TextureView());
|
||||||
|
RD::get_singleton()->set_resource_name(rb->ssao.importance_map[1], "SSAO Importance Map Pong");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
RD::TextureFormat tf;
|
RD::TextureFormat tf;
|
||||||
|
@ -5384,6 +5392,7 @@ void RendererSceneRenderRD::_process_ssao(RID p_render_buffers, RID p_environmen
|
||||||
tf.height = rb->height;
|
tf.height = rb->height;
|
||||||
tf.usage_bits = RD::TEXTURE_USAGE_SAMPLING_BIT | RD::TEXTURE_USAGE_STORAGE_BIT;
|
tf.usage_bits = RD::TEXTURE_USAGE_SAMPLING_BIT | RD::TEXTURE_USAGE_STORAGE_BIT;
|
||||||
rb->ssao.ao_final = RD::get_singleton()->texture_create(tf, RD::TextureView());
|
rb->ssao.ao_final = RD::get_singleton()->texture_create(tf, RD::TextureView());
|
||||||
|
RD::get_singleton()->set_resource_name(rb->ssao.ao_final, "SSAO Final");
|
||||||
_render_buffers_uniform_set_changed(p_render_buffers);
|
_render_buffers_uniform_set_changed(p_render_buffers);
|
||||||
}
|
}
|
||||||
ssao_using_half_size = ssao_half_size;
|
ssao_using_half_size = ssao_half_size;
|
||||||
|
|
|
@ -343,6 +343,12 @@ void RenderingDevice::_bind_methods() {
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("create_local_device"), &RenderingDevice::create_local_device);
|
ClassDB::bind_method(D_METHOD("create_local_device"), &RenderingDevice::create_local_device);
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("set_resource_name"), &RenderingDevice::set_resource_name);
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("draw_command_begin_label", "name", "color"), &RenderingDevice::draw_command_begin_label);
|
||||||
|
ClassDB::bind_method(D_METHOD("draw_command_insert_label", "name", "color"), &RenderingDevice::draw_command_insert_label);
|
||||||
|
ClassDB::bind_method(D_METHOD("draw_command_end_label"), &RenderingDevice::draw_command_end_label);
|
||||||
|
|
||||||
BIND_ENUM_CONSTANT(DATA_FORMAT_R4G4_UNORM_PACK8);
|
BIND_ENUM_CONSTANT(DATA_FORMAT_R4G4_UNORM_PACK8);
|
||||||
BIND_ENUM_CONSTANT(DATA_FORMAT_R4G4B4A4_UNORM_PACK16);
|
BIND_ENUM_CONSTANT(DATA_FORMAT_R4G4B4A4_UNORM_PACK16);
|
||||||
BIND_ENUM_CONSTANT(DATA_FORMAT_B4G4R4A4_UNORM_PACK16);
|
BIND_ENUM_CONSTANT(DATA_FORMAT_B4G4R4A4_UNORM_PACK16);
|
||||||
|
|
|
@ -1060,6 +1060,12 @@ public:
|
||||||
|
|
||||||
virtual RenderingDevice *create_local_device() = 0;
|
virtual RenderingDevice *create_local_device() = 0;
|
||||||
|
|
||||||
|
virtual void set_resource_name(RID p_id, const String p_name) = 0;
|
||||||
|
|
||||||
|
virtual void draw_command_begin_label(String p_label_name, const Color p_color = Color(1, 1, 1, 1)) = 0;
|
||||||
|
virtual void draw_command_insert_label(String p_label_name, const Color p_color = Color(1, 1, 1, 1)) = 0;
|
||||||
|
virtual void draw_command_end_label() = 0;
|
||||||
|
|
||||||
static RenderingDevice *get_singleton();
|
static RenderingDevice *get_singleton();
|
||||||
RenderingDevice();
|
RenderingDevice();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue