Merge pull request #30898 from clayjohn/max-lights-reflections
Add project setting for max lights and reflections in GLES3
This commit is contained in:
commit
639127de09
3 changed files with 20 additions and 6 deletions
|
@ -724,6 +724,12 @@
|
|||
<member name="rendering/limits/buffers/immediate_buffer_size_kb" type="int" setter="" getter="" default="2048">
|
||||
Max buffer size for drawing immediate objects (ImmediateGeometry nodes). Nodes using more than this size will not work.
|
||||
</member>
|
||||
<member name="rendering/limits/rendering/max_renderable_lights" type="int" setter="" getter="" default="4096">
|
||||
Max number of lights renderable in a frame. If more than this number are used, they will be ignored. On some systems (particularly web) setting this number as low as possible can increase the speed of shader compilation.
|
||||
</member>
|
||||
<member name="rendering/limits/rendering/max_renderable_reflections" type="int" setter="" getter="" default="1024">
|
||||
Max number of reflection probes renderable in a frame. If more than this number are used, they will be ignored. On some systems (particularly web) setting this number as low as possible can increase the speed of shader compilation.
|
||||
</member>
|
||||
<member name="rendering/limits/rendering/max_renderable_elements" type="int" setter="" getter="" default="65536">
|
||||
Max amount of elements renderable in a frame. If more than this are visible per frame, they will be dropped. Keep in mind elements refer to mesh surfaces and not meshes themselves.
|
||||
</member>
|
||||
|
|
|
@ -2824,7 +2824,7 @@ void RasterizerSceneGLES3::_setup_lights(RID *p_light_cull_result, int p_light_c
|
|||
|
||||
for (int i = 0; i < p_light_cull_count; i++) {
|
||||
|
||||
ERR_BREAK(i >= RenderList::MAX_LIGHTS);
|
||||
ERR_BREAK(i >= render_list.max_lights);
|
||||
|
||||
LightInstance *li = light_instance_owner.getptr(p_light_cull_result[i]);
|
||||
|
||||
|
@ -4189,7 +4189,7 @@ void RasterizerSceneGLES3::render_scene(const Transform &p_cam_transform, const
|
|||
|
||||
for (int i = 0; i < p_light_cull_count; i++) {
|
||||
|
||||
ERR_BREAK(i >= RenderList::MAX_LIGHTS);
|
||||
ERR_BREAK(i >= render_list.max_lights);
|
||||
|
||||
LightInstance *li = light_instance_owner.getptr(p_light_cull_result[i]);
|
||||
if (li->light_ptr->param[VS::LIGHT_PARAM_CONTACT_SHADOW_SIZE] > CMP_EPSILON) {
|
||||
|
@ -5064,6 +5064,10 @@ void RasterizerSceneGLES3::initialize() {
|
|||
|
||||
render_list.max_elements = GLOBAL_DEF_RST("rendering/limits/rendering/max_renderable_elements", (int)RenderList::DEFAULT_MAX_ELEMENTS);
|
||||
ProjectSettings::get_singleton()->set_custom_property_info("rendering/limits/rendering/max_renderable_elements", PropertyInfo(Variant::INT, "rendering/limits/rendering/max_renderable_elements", PROPERTY_HINT_RANGE, "1024,1000000,1"));
|
||||
render_list.max_lights = GLOBAL_DEF("rendering/limits/rendering/max_renderable_lights", (int)RenderList::DEFAULT_MAX_LIGHTS);
|
||||
ProjectSettings::get_singleton()->set_custom_property_info("rendering/limits/rendering/max_renderable_lights", PropertyInfo(Variant::INT, "rendering/limits/rendering/max_renderable_lights", PROPERTY_HINT_RANGE, "16,4096,1"));
|
||||
render_list.max_reflections = GLOBAL_DEF("rendering/limits/rendering/max_renderable_reflections", (int)RenderList::DEFAULT_MAX_REFLECTIONS);
|
||||
ProjectSettings::get_singleton()->set_custom_property_info("rendering/limits/rendering/max_renderable_reflections", PropertyInfo(Variant::INT, "rendering/limits/rendering/max_renderable_reflections", PROPERTY_HINT_RANGE, "8,1024,1"));
|
||||
|
||||
{
|
||||
//quad buffers
|
||||
|
@ -5158,7 +5162,7 @@ void RasterizerSceneGLES3::initialize() {
|
|||
glGetIntegerv(GL_MAX_UNIFORM_BLOCK_SIZE, &max_ubo_size);
|
||||
const int ubo_light_size = 160;
|
||||
state.ubo_light_size = ubo_light_size;
|
||||
state.max_ubo_lights = MIN(RenderList::MAX_LIGHTS, max_ubo_size / ubo_light_size);
|
||||
state.max_ubo_lights = MIN(render_list.max_lights, max_ubo_size / ubo_light_size);
|
||||
|
||||
state.spot_array_tmp = (uint8_t *)memalloc(ubo_light_size * state.max_ubo_lights);
|
||||
state.omni_array_tmp = (uint8_t *)memalloc(ubo_light_size * state.max_ubo_lights);
|
||||
|
@ -5183,7 +5187,7 @@ void RasterizerSceneGLES3::initialize() {
|
|||
state.scene_shader.add_custom_define("#define MAX_LIGHT_DATA_STRUCTS " + itos(state.max_ubo_lights) + "\n");
|
||||
state.scene_shader.add_custom_define("#define MAX_FORWARD_LIGHTS " + itos(state.max_forward_lights_per_object) + "\n");
|
||||
|
||||
state.max_ubo_reflections = MIN((int)RenderList::MAX_REFLECTIONS, max_ubo_size / sizeof(ReflectionProbeDataUBO));
|
||||
state.max_ubo_reflections = MIN(render_list.max_reflections, max_ubo_size / (int)sizeof(ReflectionProbeDataUBO));
|
||||
|
||||
state.reflection_array_tmp = (uint8_t *)memalloc(sizeof(ReflectionProbeDataUBO) * state.max_ubo_reflections);
|
||||
|
||||
|
|
|
@ -669,8 +669,8 @@ public:
|
|||
SORT_FLAG_SKELETON = 1,
|
||||
SORT_FLAG_INSTANCING = 2,
|
||||
MAX_DIRECTIONAL_LIGHTS = 16,
|
||||
MAX_LIGHTS = 4096,
|
||||
MAX_REFLECTIONS = 1024,
|
||||
DEFAULT_MAX_LIGHTS = 4096,
|
||||
DEFAULT_MAX_REFLECTIONS = 1024,
|
||||
|
||||
SORT_KEY_PRIORITY_SHIFT = 56,
|
||||
SORT_KEY_PRIORITY_MASK = 0xFF,
|
||||
|
@ -701,6 +701,8 @@ public:
|
|||
};
|
||||
|
||||
int max_elements;
|
||||
int max_lights;
|
||||
int max_reflections;
|
||||
|
||||
struct Element {
|
||||
|
||||
|
@ -813,6 +815,8 @@ public:
|
|||
RenderList() {
|
||||
|
||||
max_elements = DEFAULT_MAX_ELEMENTS;
|
||||
max_lights = DEFAULT_MAX_LIGHTS;
|
||||
max_reflections = DEFAULT_MAX_REFLECTIONS;
|
||||
}
|
||||
|
||||
~RenderList() {
|
||||
|
|
Loading…
Reference in a new issue