Sort render list correctly in RD renderers

(cherry picked from commit 5021b3e6e5)
This commit is contained in:
Kaleb Reid
2025-09-29 17:02:31 -07:00
committed by Thaddeus Crews
parent eed94508f0
commit 899ef8df88
4 changed files with 10 additions and 10 deletions

View File

@ -846,7 +846,7 @@ void RenderForwardClustered::_fill_instance_data(RenderListType p_render_list, i
RenderElementInfo &element_info = rl->element_info[p_offset + i];
element_info.value = uint32_t(surface->sort.sort_key1 & 0xFFF);
element_info.value = uint32_t(surface->sort.sort_key2 & 0x0FFF00000000);
if (cant_repeat) {
prev_surface = nullptr;

View File

@ -495,6 +495,10 @@ private:
uint64_t sort_key2;
};
struct {
uint64_t geometry_id : 32;
uint64_t material_id : 32;
uint64_t shader_id : 32;
uint64_t lod_index : 8;
uint64_t uses_softshadow : 1;
uint64_t uses_projector : 1;
@ -503,10 +507,6 @@ private:
uint64_t depth_layer : 4;
uint64_t surface_index : 8;
uint64_t priority : 8;
uint64_t geometry_id : 32;
uint64_t material_id : 32;
uint64_t shader_id : 32;
};
} sort;

View File

@ -1975,7 +1975,7 @@ void RenderForwardMobile::_fill_instance_data(RenderListType p_render_list, uint
RenderElementInfo &element_info = rl->element_info[p_offset + i];
// Sets lod_index and uses_lightmap at once.
element_info.value = uint32_t(surface->sort.sort_key1 & 0x1FF);
element_info.value = uint32_t(surface->sort.sort_key2 & 0x01FF00000000);
}
if (p_update_buffer) {

View File

@ -474,16 +474,16 @@ protected:
uint64_t sort_key2;
};
struct {
uint64_t geometry_id : 32;
uint64_t material_id : 32;
uint64_t shader_id : 32;
uint64_t lod_index : 8;
uint64_t uses_lightmap : 1;
uint64_t pad : 3;
uint64_t depth_layer : 4;
uint64_t surface_index : 8;
uint64_t priority : 8;
uint64_t geometry_id : 32;
uint64_t material_id : 32;
uint64_t shader_id : 32;
};
} sort;