mirror of
https://github.com/godotengine/godot.git
synced 2025-12-08 06:09:55 +00:00
Validate triviality of the InstanceData and RenderElementInfo structs in Mobile and Forward+ renderers.
This is needed to avoid overhead that results from calling the constructor during calls to LocalVector.resize()
This commit is contained in:
parent
9f68a81659
commit
1bdb3bc88a
2 changed files with 13 additions and 1 deletions
|
|
@ -328,6 +328,9 @@ private:
|
||||||
float uv_scale[4];
|
float uv_scale[4];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static_assert(std::is_trivially_destructible_v<InstanceData>);
|
||||||
|
static_assert(std::is_trivially_constructible_v<InstanceData>);
|
||||||
|
|
||||||
UBO ubo;
|
UBO ubo;
|
||||||
|
|
||||||
LocalVector<RID> uniform_buffers;
|
LocalVector<RID> uniform_buffers;
|
||||||
|
|
@ -392,6 +395,9 @@ private:
|
||||||
uint32_t lod_index : 8;
|
uint32_t lod_index : 8;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static_assert(std::is_trivially_destructible_v<RenderElementInfo>);
|
||||||
|
static_assert(std::is_trivially_constructible_v<RenderElementInfo>);
|
||||||
|
|
||||||
template <PassMode p_pass_mode, uint32_t p_color_pass_flags = 0>
|
template <PassMode p_pass_mode, uint32_t p_color_pass_flags = 0>
|
||||||
_FORCE_INLINE_ void _render_list_template(RenderingDevice::DrawListID p_draw_list, RenderingDevice::FramebufferFormatID p_framebuffer_Format, RenderListParameters *p_params, uint32_t p_from_element, uint32_t p_to_element);
|
_FORCE_INLINE_ void _render_list_template(RenderingDevice::DrawListID p_draw_list, RenderingDevice::FramebufferFormatID p_framebuffer_Format, RenderListParameters *p_params, uint32_t p_from_element, uint32_t p_to_element);
|
||||||
void _render_list(RenderingDevice::DrawListID p_draw_list, RenderingDevice::FramebufferFormatID p_framebuffer_Format, RenderListParameters *p_params, uint32_t p_from_element, uint32_t p_to_element);
|
void _render_list(RenderingDevice::DrawListID p_draw_list, RenderingDevice::FramebufferFormatID p_framebuffer_Format, RenderListParameters *p_params, uint32_t p_from_element, uint32_t p_to_element);
|
||||||
|
|
|
||||||
|
|
@ -211,7 +211,7 @@ private:
|
||||||
uint32_t flags;
|
uint32_t flags;
|
||||||
uint32_t instance_uniforms_ofs; // Base offset in global buffer for instance variables.
|
uint32_t instance_uniforms_ofs; // Base offset in global buffer for instance variables.
|
||||||
uint32_t gi_offset; // GI information when using lightmapping (VCT or lightmap index).
|
uint32_t gi_offset; // GI information when using lightmapping (VCT or lightmap index).
|
||||||
uint32_t layer_mask = 1;
|
uint32_t layer_mask;
|
||||||
float lightmap_uv_scale[4]; // Doubles as uv_offset when needed.
|
float lightmap_uv_scale[4]; // Doubles as uv_offset when needed.
|
||||||
uint32_t reflection_probes[2]; // Packed reflection probes.
|
uint32_t reflection_probes[2]; // Packed reflection probes.
|
||||||
uint32_t omni_lights[2]; // Packed omni lights.
|
uint32_t omni_lights[2]; // Packed omni lights.
|
||||||
|
|
@ -222,6 +222,9 @@ private:
|
||||||
float uv_scale[4];
|
float uv_scale[4];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static_assert(std::is_trivially_destructible_v<InstanceData>);
|
||||||
|
static_assert(std::is_trivially_constructible_v<InstanceData>);
|
||||||
|
|
||||||
RID instance_buffer[RENDER_LIST_MAX];
|
RID instance_buffer[RENDER_LIST_MAX];
|
||||||
uint32_t instance_buffer_size[RENDER_LIST_MAX] = { 0, 0, 0 };
|
uint32_t instance_buffer_size[RENDER_LIST_MAX] = { 0, 0, 0 };
|
||||||
LocalVector<InstanceData> instance_data[RENDER_LIST_MAX];
|
LocalVector<InstanceData> instance_data[RENDER_LIST_MAX];
|
||||||
|
|
@ -327,6 +330,9 @@ private:
|
||||||
uint32_t reserved : 23;
|
uint32_t reserved : 23;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static_assert(std::is_trivially_destructible_v<RenderElementInfo>);
|
||||||
|
static_assert(std::is_trivially_constructible_v<RenderElementInfo>);
|
||||||
|
|
||||||
template <PassMode p_pass_mode>
|
template <PassMode p_pass_mode>
|
||||||
_FORCE_INLINE_ void _render_list_template(RenderingDevice::DrawListID p_draw_list, RenderingDevice::FramebufferFormatID p_framebuffer_Format, RenderListParameters *p_params, uint32_t p_from_element, uint32_t p_to_element);
|
_FORCE_INLINE_ void _render_list_template(RenderingDevice::DrawListID p_draw_list, RenderingDevice::FramebufferFormatID p_framebuffer_Format, RenderListParameters *p_params, uint32_t p_from_element, uint32_t p_to_element);
|
||||||
void _render_list(RenderingDevice::DrawListID p_draw_list, RenderingDevice::FramebufferFormatID p_framebuffer_Format, RenderListParameters *p_params, uint32_t p_from_element, uint32_t p_to_element);
|
void _render_list(RenderingDevice::DrawListID p_draw_list, RenderingDevice::FramebufferFormatID p_framebuffer_Format, RenderListParameters *p_params, uint32_t p_from_element, uint32_t p_to_element);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue